Browse Source

fix GL texture state change, DX texture reload

David Rose 19 years ago
parent
commit
34064f07ad

+ 1 - 1
panda/src/dxgsg8/dxTextureContext8.cxx

@@ -84,7 +84,6 @@ create_texture(DXScreenData &scrn) {
   nassertr(IS_VALID_PTR(get_texture()), false);
   nassertr(IS_VALID_PTR(get_texture()), false);
 
 
   delete_texture();
   delete_texture();
-  mark_loaded();
 
 
 #ifdef DO_PSTATS
 #ifdef DO_PSTATS
   update_data_size_bytes(get_texture()->estimate_texture_memory());
   update_data_size_bytes(get_texture()->estimate_texture_memory());
@@ -695,6 +694,7 @@ create_texture(DXScreenData &scrn) {
   }
   }
 
 
   get_texture()->texture_uploaded();
   get_texture()->texture_uploaded();
+  mark_loaded();
   return true;
   return true;
 
 
  error_exit:
  error_exit:

+ 1 - 0
panda/src/dxgsg9/dxTextureContext9.cxx

@@ -837,6 +837,7 @@ create_texture(DXScreenData &scrn) {
     }
     }
     get_texture()->texture_uploaded();
     get_texture()->texture_uploaded();
   }
   }
+  mark_loaded();
 
 
   return true;
   return true;
 
 

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

@@ -6558,6 +6558,7 @@ upload_texture(CLP(TextureContext) *gtc) {
 
 
   if (success) {
   if (success) {
     gtc->_already_applied = true;
     gtc->_already_applied = true;
+    gtc->_uses_mipmaps = uses_mipmaps;
     gtc->_internal_format = internal_format;
     gtc->_internal_format = internal_format;
     gtc->_width = width;
     gtc->_width = width;
     gtc->_height = height;
     gtc->_height = height;
@@ -6673,6 +6674,7 @@ upload_texture_image(CLP(TextureContext) *gtc,
   
   
   
   
   if (!gtc->_already_applied ||
   if (!gtc->_already_applied ||
+      gtc->_uses_mipmaps != uses_mipmaps ||
       gtc->_internal_format != internal_format ||
       gtc->_internal_format != internal_format ||
       gtc->_width != width ||
       gtc->_width != width ||
       gtc->_height != height ||
       gtc->_height != height ||

+ 1 - 0
panda/src/glstuff/glTextureContext_src.h

@@ -36,6 +36,7 @@ public:
   // glTexImage2D() call.  If none of these have changed, we can
   // glTexImage2D() call.  If none of these have changed, we can
   // reload the texture image with a glTexSubImage2D().
   // reload the texture image with a glTexSubImage2D().
   bool _already_applied;
   bool _already_applied;
+  bool _uses_mipmaps;
   GLint _internal_format;
   GLint _internal_format;
   GLsizei _width;
   GLsizei _width;
   GLsizei _height;
   GLsizei _height;