Browse Source

add gl-support-rescale-normal

David Rose 20 years ago
parent
commit
9dab4ee9ea

+ 21 - 1
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -461,7 +461,8 @@ reset() {
   _supports_bgr = 
   _supports_bgr = 
     has_extension("GL_EXT_bgra") || is_at_least_version(1, 2);
     has_extension("GL_EXT_bgra") || is_at_least_version(1, 2);
   _supports_rescale_normal = 
   _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 = 
   _supports_multisample = 
     has_extension("GL_ARB_multisample");
     has_extension("GL_ARB_multisample");
@@ -4840,8 +4841,14 @@ do_auto_rescale_normal() {
   if (_external_transform->has_identity_scale()) {
   if (_external_transform->has_identity_scale()) {
     // If there's no scale at all, don't do anything.
     // If there's no scale at all, don't do anything.
     GLP(Disable)(GL_NORMALIZE);
     GLP(Disable)(GL_NORMALIZE);
+    if (GLCAT.is_spam()) {
+      GLCAT.spam() << "glDisable(GL_NORMALIZE)\n";
+    }
     if (_supports_rescale_normal && support_rescale_normal) {
     if (_supports_rescale_normal && support_rescale_normal) {
       GLP(Disable)(GL_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()) {
   } else if (_external_transform->has_uniform_scale()) {
@@ -4849,15 +4856,28 @@ do_auto_rescale_normal() {
     if (_supports_rescale_normal && support_rescale_normal) {
     if (_supports_rescale_normal && support_rescale_normal) {
       GLP(Enable)(GL_RESCALE_NORMAL);
       GLP(Enable)(GL_RESCALE_NORMAL);
       GLP(Disable)(GL_NORMALIZE);
       GLP(Disable)(GL_NORMALIZE);
+      if (GLCAT.is_spam()) {
+	GLCAT.spam() << "glEnable(GL_RESCALE_NORMAL)\n";
+	GLCAT.spam() << "glDisable(GL_NORMALIZE)\n";
+      }
     } else {
     } else {
       GLP(Enable)(GL_NORMALIZE);
       GLP(Enable)(GL_NORMALIZE);
+      if (GLCAT.is_spam()) {
+	GLCAT.spam() << "glEnable(GL_NORMALIZE)\n";
+      }
     }
     }
   
   
   } else {
   } else {
     // If there's a non-uniform scale, normalize everything.
     // If there's a non-uniform scale, normalize everything.
     GLP(Enable)(GL_NORMALIZE);
     GLP(Enable)(GL_NORMALIZE);
+    if (GLCAT.is_spam()) {
+      GLCAT.spam() << "glEnable(GL_NORMALIZE)\n";
+    }
     if (_supports_rescale_normal && support_rescale_normal) {
     if (_supports_rescale_normal && support_rescale_normal) {
       GLP(Disable)(GL_RESCALE_NORMAL);
       GLP(Disable)(GL_RESCALE_NORMAL);
+      if (GLCAT.is_spam()) {
+	GLCAT.spam() << "glDisable(GL_RESCALE_NORMAL)\n";
+      }
     }
     }
   }
   }
 }
 }

+ 10 - 3
panda/src/glstuff/glmisc_src.cxx

@@ -31,9 +31,16 @@ ConfigVariableBool CLP(ignore_clamp)
 ConfigVariableBool CLP(support_clamp_to_border)
 ConfigVariableBool CLP(support_clamp_to_border)
   ("gl-support-clamp-to-border", true,
   ("gl-support-clamp-to-border", true,
    PRC_DESC("Configure this true to enable the use of the clamp_to_border "
    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)
 ConfigVariableBool CLP(ignore_filters)
   ("gl-ignore-filters", false,
   ("gl-ignore-filters", false,