Browse Source

protect against negative limits

David Rose 18 years ago
parent
commit
25e5c77e80
1 changed files with 6 additions and 2 deletions
  1. 6 2
      panda/src/glstuff/glGraphicsStateGuardian_src.cxx

+ 6 - 2
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -908,8 +908,12 @@ reset() {
   GLint max_elements_vertices, max_elements_indices;
   GLint max_elements_vertices, max_elements_indices;
   GLP(GetIntegerv)(GL_MAX_ELEMENTS_VERTICES, &max_elements_vertices);
   GLP(GetIntegerv)(GL_MAX_ELEMENTS_VERTICES, &max_elements_vertices);
   GLP(GetIntegerv)(GL_MAX_ELEMENTS_INDICES, &max_elements_indices);
   GLP(GetIntegerv)(GL_MAX_ELEMENTS_INDICES, &max_elements_indices);
-  _max_vertices_per_array = max_elements_vertices;
-  _max_vertices_per_primitive = max_elements_indices;
+  if (max_elements_vertices > 0) {
+    _max_vertices_per_array = max_elements_vertices;
+  }
+  if (max_elements_indices > 0) {
+    _max_vertices_per_primitive = max_elements_indices;
+  }
 
 
   if (GLCAT.is_debug()) {
   if (GLCAT.is_debug()) {
     GLCAT.debug()
     GLCAT.debug()