From f49a8620371e9914602017294c055e578ce92601 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 21 Apr 2005 14:45:12 +0000 Subject: [PATCH] fix nvidia crash --- panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index b414ef3d91..ab53774010 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -2316,6 +2316,18 @@ begin_draw_primitives(const qpGeom *geom, const qpGeomMunger *munger, display_lists && (!hardware_animation || display_list_animation)) { // If the geom claims to be totally static, try to build it into // a display list. + + // Before we compile or call a display list, make sure the current + // buffers are unbound, or the nVidia drivers may crash. + if (_current_vbuffer_index != 0) { + _glBindBuffer(GL_ARRAY_BUFFER, 0); + _current_vbuffer_index = 0; + } + if (_current_ibuffer_index != 0) { + _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + _current_ibuffer_index = 0; + } + GeomContext *gc = ((qpGeom *)geom)->prepare_now(get_prepared_objects(), this); nassertr(gc != (GeomContext *)NULL, false); CLP(GeomContext) *ggc = DCAST(CLP(GeomContext), gc);