From 34064f07ad8deb05d81a960d657260e63201ac5b Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 13 Apr 2006 22:56:38 +0000 Subject: [PATCH] fix GL texture state change, DX texture reload --- panda/src/dxgsg8/dxTextureContext8.cxx | 2 +- panda/src/dxgsg9/dxTextureContext9.cxx | 1 + panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 2 ++ panda/src/glstuff/glTextureContext_src.h | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/panda/src/dxgsg8/dxTextureContext8.cxx b/panda/src/dxgsg8/dxTextureContext8.cxx index 24892e90f1..39a51a300a 100644 --- a/panda/src/dxgsg8/dxTextureContext8.cxx +++ b/panda/src/dxgsg8/dxTextureContext8.cxx @@ -84,7 +84,6 @@ create_texture(DXScreenData &scrn) { nassertr(IS_VALID_PTR(get_texture()), false); delete_texture(); - mark_loaded(); #ifdef DO_PSTATS update_data_size_bytes(get_texture()->estimate_texture_memory()); @@ -695,6 +694,7 @@ create_texture(DXScreenData &scrn) { } get_texture()->texture_uploaded(); + mark_loaded(); return true; error_exit: diff --git a/panda/src/dxgsg9/dxTextureContext9.cxx b/panda/src/dxgsg9/dxTextureContext9.cxx index 4391328755..ace5591d0f 100755 --- a/panda/src/dxgsg9/dxTextureContext9.cxx +++ b/panda/src/dxgsg9/dxTextureContext9.cxx @@ -837,6 +837,7 @@ create_texture(DXScreenData &scrn) { } get_texture()->texture_uploaded(); } + mark_loaded(); return true; diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index c09bb1aeeb..8d00c13703 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -6558,6 +6558,7 @@ upload_texture(CLP(TextureContext) *gtc) { if (success) { gtc->_already_applied = true; + gtc->_uses_mipmaps = uses_mipmaps; gtc->_internal_format = internal_format; gtc->_width = width; gtc->_height = height; @@ -6673,6 +6674,7 @@ upload_texture_image(CLP(TextureContext) *gtc, if (!gtc->_already_applied || + gtc->_uses_mipmaps != uses_mipmaps || gtc->_internal_format != internal_format || gtc->_width != width || gtc->_height != height || diff --git a/panda/src/glstuff/glTextureContext_src.h b/panda/src/glstuff/glTextureContext_src.h index f7c4d6a34d..32d51d5d3b 100644 --- a/panda/src/glstuff/glTextureContext_src.h +++ b/panda/src/glstuff/glTextureContext_src.h @@ -36,6 +36,7 @@ public: // glTexImage2D() call. If none of these have changed, we can // reload the texture image with a glTexSubImage2D(). bool _already_applied; + bool _uses_mipmaps; GLint _internal_format; GLsizei _width; GLsizei _height;