From 9dab4ee9ea3805d1641ec07fdc3e8a9aab34e124 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 13 Jan 2006 16:02:17 +0000 Subject: [PATCH] add gl-support-rescale-normal --- .../glstuff/glGraphicsStateGuardian_src.cxx | 22 ++++++++++++++++++- panda/src/glstuff/glmisc_src.cxx | 13 ++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 59be836e06..5f1a2fc5d1 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -461,7 +461,8 @@ reset() { _supports_bgr = has_extension("GL_EXT_bgra") || is_at_least_version(1, 2); _supports_rescale_normal = - has_extension("GL_EXT_rescale_normal") || is_at_least_version(1, 2); + CLP(support_rescale_normal) && + (has_extension("GL_EXT_rescale_normal") || is_at_least_version(1, 2)); _supports_multisample = has_extension("GL_ARB_multisample"); @@ -4840,8 +4841,14 @@ do_auto_rescale_normal() { if (_external_transform->has_identity_scale()) { // If there's no scale at all, don't do anything. GLP(Disable)(GL_NORMALIZE); + if (GLCAT.is_spam()) { + GLCAT.spam() << "glDisable(GL_NORMALIZE)\n"; + } if (_supports_rescale_normal && support_rescale_normal) { GLP(Disable)(GL_RESCALE_NORMAL); + if (GLCAT.is_spam()) { + GLCAT.spam() << "glDisable(GL_RESCALE_NORMAL)\n"; + } } } else if (_external_transform->has_uniform_scale()) { @@ -4849,15 +4856,28 @@ do_auto_rescale_normal() { if (_supports_rescale_normal && support_rescale_normal) { GLP(Enable)(GL_RESCALE_NORMAL); GLP(Disable)(GL_NORMALIZE); + if (GLCAT.is_spam()) { + GLCAT.spam() << "glEnable(GL_RESCALE_NORMAL)\n"; + GLCAT.spam() << "glDisable(GL_NORMALIZE)\n"; + } } else { GLP(Enable)(GL_NORMALIZE); + if (GLCAT.is_spam()) { + GLCAT.spam() << "glEnable(GL_NORMALIZE)\n"; + } } } else { // If there's a non-uniform scale, normalize everything. GLP(Enable)(GL_NORMALIZE); + if (GLCAT.is_spam()) { + GLCAT.spam() << "glEnable(GL_NORMALIZE)\n"; + } if (_supports_rescale_normal && support_rescale_normal) { GLP(Disable)(GL_RESCALE_NORMAL); + if (GLCAT.is_spam()) { + GLCAT.spam() << "glDisable(GL_RESCALE_NORMAL)\n"; + } } } } diff --git a/panda/src/glstuff/glmisc_src.cxx b/panda/src/glstuff/glmisc_src.cxx index ea6eb03584..fb71213c37 100644 --- a/panda/src/glstuff/glmisc_src.cxx +++ b/panda/src/glstuff/glmisc_src.cxx @@ -31,9 +31,16 @@ ConfigVariableBool CLP(ignore_clamp) ConfigVariableBool CLP(support_clamp_to_border) ("gl-support-clamp-to-border", true, PRC_DESC("Configure this true to enable the use of the clamp_to_border " - "if the GL claims to support it, or false not to use it even " - "if it appears to be available. (On some OpenGL drivers, " - "enabling this mode can force software rendering.)")); + "extension if the GL claims to support it, or false not to " + "use it even if it appears to be available. (On some OpenGL " + "drivers, enabling this mode can force software rendering.)")); + +ConfigVariableBool CLP(support_rescale_normal) + ("gl-support-rescale-normal", true, + PRC_DESC("Configure this true to enable the use of the rescale_normal " + "extension if the GL claims to support it, or false not to use " + "it even if it appears to be available. (This appears to be " + "buggy on some drivers.)")); ConfigVariableBool CLP(ignore_filters) ("gl-ignore-filters", false,