From fa49deb746574139347a701ca1f37bd2bcbc7715 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 1 Apr 2002 22:23:51 +0000 Subject: [PATCH] debug statements to help find lighting problem --- panda/src/glgsg/glGraphicsStateGuardian.I | 18 +----------------- panda/src/glgsg/glGraphicsStateGuardian.cxx | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/panda/src/glgsg/glGraphicsStateGuardian.I b/panda/src/glgsg/glGraphicsStateGuardian.I index 125755f997..3bf66fae65 100644 --- a/panda/src/glgsg/glGraphicsStateGuardian.I +++ b/panda/src/glgsg/glGraphicsStateGuardian.I @@ -1037,23 +1037,7 @@ get_current_alpha_scale() const { //////////////////////////////////////////////////////////////////// INLINE GLenum GLGraphicsStateGuardian::get_light_id(int index) const { - switch( index ) - { - case 0: return GL_LIGHT0; - case 1: return GL_LIGHT1; - case 2: return GL_LIGHT2; - case 3: return GL_LIGHT3; - case 4: return GL_LIGHT4; - case 5: return GL_LIGHT5; - case 6: return GL_LIGHT6; - case 7: return GL_LIGHT7; - default: - glgsg_cat.error() - << "get_light_id() - we don't currently support ids " - << "> 8" << endl; - break; - } - return GL_LIGHT0; + return GL_LIGHT0 + index; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/glgsg/glGraphicsStateGuardian.cxx b/panda/src/glgsg/glGraphicsStateGuardian.cxx index a442a5797d..e827ded2cb 100644 --- a/panda/src/glgsg/glGraphicsStateGuardian.cxx +++ b/panda/src/glgsg/glGraphicsStateGuardian.cxx @@ -291,6 +291,8 @@ reset() { GLint max_lights; glGetIntegerv(GL_MAX_LIGHTS, &max_lights); init_lights(max_lights); + glgsg_cat.debug() + << "max_lights = " << max_lights << "\n"; // Set up the clip plane id map GLint max_clip_planes; @@ -3319,6 +3321,10 @@ issue_depth_offset(const DepthOffsetAttrib *attrib) { //////////////////////////////////////////////////////////////////// void GLGraphicsStateGuardian:: bind_light(PointLight *light, int light_id) { + if (glgsg_cat.is_debug()) { + glgsg_cat.debug() + << "bind_light(PointLight, " << light_id << ")\n"; + } GLenum id = get_light_id(light_id); static const Colorf black(0.0f, 0.0f, 0.0f, 1.0f); glLightfv(id, GL_AMBIENT, black.get_data()); @@ -3360,6 +3366,10 @@ bind_light(PointLight *light, int light_id) { //////////////////////////////////////////////////////////////////// void GLGraphicsStateGuardian:: bind_light(DirectionalLight *light, int light_id) { + if (glgsg_cat.is_debug()) { + glgsg_cat.debug() + << "bind_light(DirectionalLight, " << light_id << ")\n"; + } GLenum id = get_light_id( light_id ); static const Colorf black(0.0f, 0.0f, 0.0f, 1.0f); glLightfv(id, GL_AMBIENT, black.get_data()); @@ -3402,6 +3412,10 @@ bind_light(DirectionalLight *light, int light_id) { //////////////////////////////////////////////////////////////////// void GLGraphicsStateGuardian:: bind_light(Spotlight *light, int light_id) { + if (glgsg_cat.is_debug()) { + glgsg_cat.debug() + << "bind_light(Spotlight, " << light_id << ")\n"; + } Lens *lens = light->get_lens(); nassertv(lens != (Lens *)NULL);