Browse Source

glgsg: only consider texture/texgen in munger if !gl_parallel_arrays

This could possibly be used to workaround issue #218
rdb 8 years ago
parent
commit
a96b171095
1 changed files with 11 additions and 7 deletions
  1. 11 7
      panda/src/glstuff/glGeomMunger_src.cxx

+ 11 - 7
panda/src/glstuff/glGeomMunger_src.cxx

@@ -23,13 +23,8 @@ ALLOC_DELETED_CHAIN_DEF(CLP(GeomMunger));
 CLP(GeomMunger)::
 CLP(GeomMunger)(GraphicsStateGuardian *gsg, const RenderState *state) :
   StandardMunger(gsg, state, 4, NT_uint8, C_color),
-  _texture((const TextureAttrib *)state->get_attrib(TextureAttrib::get_class_slot())),
-  _tex_gen((const TexGenAttrib *)state->get_attrib(TexGenAttrib::get_class_slot()))
-{
-  // Set a callback to unregister ourselves when either the Texture or the
-  // TexGen object gets deleted.
-  _texture.set_callback(this);
-  _tex_gen.set_callback(this);
+  _texture(nullptr),
+  _tex_gen(nullptr) {
 
   _flags = 0;
 
@@ -38,6 +33,15 @@ CLP(GeomMunger)(GraphicsStateGuardian *gsg, const RenderState *state) :
   } else if (gl_parallel_arrays) {
     _flags |= F_parallel_arrays;
   }
+
+  if ((_flags & F_parallel_arrays) == 0) {
+    // Set a callback to unregister ourselves when either the Texture or the
+    // TexGen object gets deleted.
+    _texture = (const TextureAttrib *)state->get_attrib(TextureAttrib::get_class_slot());
+    _tex_gen = (const TexGenAttrib *)state->get_attrib(TexGenAttrib::get_class_slot());
+    _texture.set_callback(this);
+    _tex_gen.set_callback(this);
+  }
 }
 
 /**