Browse Source

fix GL crash

David Rose 20 years ago
parent
commit
f660bfc9fc

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

@@ -3012,7 +3012,6 @@ prepare_index_buffer(qpGeomPrimitive *data) {
     _glGenBuffers(1, &gibc->_index);
 
     if (GLCAT.is_debug()) {
-      const qpGeomVertexArrayData *vertices = data->get_vertices();
       GLCAT.debug()
         << "creating index buffer " << gibc->_index << ": "
         << data->get_num_vertices() << " indices (" 

+ 11 - 0
panda/src/gobj/indexBufferContext.I

@@ -88,6 +88,17 @@ was_modified() const {
   return _modified != _data->get_modified();
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: IndexBufferContext::get_modified
+//       Access: Public
+//  Description: Returns the UpdateSeq that was recorded the last time
+//               mark_loaded() was called.
+////////////////////////////////////////////////////////////////////
+INLINE UpdateSeq IndexBufferContext::
+get_modified() const {
+  return _modified;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: IndexBufferContext::mark_loaded
 //       Access: Public

+ 1 - 0
panda/src/gobj/indexBufferContext.h

@@ -46,6 +46,7 @@ public:
   INLINE bool changed_size() const;
   INLINE bool changed_usage_hint() const;
   INLINE bool was_modified() const;
+  INLINE UpdateSeq get_modified() const;
 
   INLINE void mark_loaded();
 

+ 5 - 0
panda/src/gobj/qpgeomPrimitive.cxx

@@ -170,6 +170,7 @@ add_vertex(int vertex) {
 
   index.add_data1i(vertex);
 
+  cdata->_modified = qpGeom::get_next_modified();
   cdata->_got_minmax = false;
 }
 
@@ -203,6 +204,7 @@ add_consecutive_vertices(int start, int num_vertices) {
     index.add_data1i(v);
   }
 
+  cdata->_modified = qpGeom::get_next_modified();
   cdata->_got_minmax = false;
 }
 
@@ -267,6 +269,8 @@ close_primitive() {
 #endif
   }
 
+  cdata->_modified = qpGeom::get_next_modified();
+
   return true;
 }
 
@@ -284,6 +288,7 @@ clear_vertices() {
   cdata->_ends.clear();
   cdata->_mins.clear();
   cdata->_maxs.clear();
+  cdata->_modified = qpGeom::get_next_modified();
   cdata->_got_minmax = false;
 }
 

+ 11 - 0
panda/src/gobj/vertexBufferContext.I

@@ -88,6 +88,17 @@ was_modified() const {
   return _modified != _data->get_modified();
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: VertexBufferContext::get_modified
+//       Access: Public
+//  Description: Returns the UpdateSeq that was recorded the last time
+//               mark_loaded() was called.
+////////////////////////////////////////////////////////////////////
+INLINE UpdateSeq VertexBufferContext::
+get_modified() const {
+  return _modified;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: VertexBufferContext::mark_loaded
 //       Access: Public

+ 1 - 0
panda/src/gobj/vertexBufferContext.h

@@ -46,6 +46,7 @@ public:
   INLINE bool changed_size() const;
   INLINE bool changed_usage_hint() const;
   INLINE bool was_modified() const;
+  INLINE UpdateSeq get_modified() const;
 
   INLINE void mark_loaded();