Browse Source

glgsg: fix unnecessary create-delete-create of new textures

rdb 6 years ago
parent
commit
802a08b146
1 changed files with 3 additions and 1 deletions
  1. 3 1
      panda/src/glstuff/glGraphicsStateGuardian_src.cxx

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

@@ -5850,7 +5850,8 @@ prepare_texture(Texture *tex, int view) {
   report_my_gl_errors();
   report_my_gl_errors();
   // Make sure we'll support this texture when it's rendered.  Don't bother to
   // Make sure we'll support this texture when it's rendered.  Don't bother to
   // prepare it if we won't.
   // prepare it if we won't.
-  switch (tex->get_texture_type()) {
+  Texture::TextureType texture_type = tex->get_texture_type();
+  switch (texture_type) {
   case Texture::TT_3d_texture:
   case Texture::TT_3d_texture:
     if (!_supports_3d_texture) {
     if (!_supports_3d_texture) {
       GLCAT.warning()
       GLCAT.warning()
@@ -5896,6 +5897,7 @@ prepare_texture(Texture *tex, int view) {
   }
   }
 
 
   CLP(TextureContext) *gtc = new CLP(TextureContext)(this, _prepared_objects, tex, view);
   CLP(TextureContext) *gtc = new CLP(TextureContext)(this, _prepared_objects, tex, view);
+  gtc->_target = get_texture_target(texture_type);
   report_my_gl_errors();
   report_my_gl_errors();
 
 
   return gtc;
   return gtc;