diff --git a/src/gl/system/gl_wipe.cpp b/src/gl/system/gl_wipe.cpp index 57ad3ba893..53af826bd2 100644 --- a/src/gl/system/gl_wipe.cpp +++ b/src/gl/system/gl_wipe.cpp @@ -240,6 +240,7 @@ void OpenGLFrameBuffer::WipeCleanup() delete wipeendscreen; wipeendscreen = NULL; } + FMaterial::ClearLastTexture(); } //========================================================================== diff --git a/src/gl/textures/gl_hwtexture.cpp b/src/gl/textures/gl_hwtexture.cpp index d076f6a3e6..f491169b41 100644 --- a/src/gl/textures/gl_hwtexture.cpp +++ b/src/gl/textures/gl_hwtexture.cpp @@ -403,6 +403,7 @@ void FHardwareTexture::UnbindAll() { Unbind(texunit); } + FMaterial::ClearLastTexture(); } //=========================================================================== diff --git a/src/gl/textures/gl_material.cpp b/src/gl/textures/gl_material.cpp index 503c0b7930..efbbec3323 100644 --- a/src/gl/textures/gl_material.cpp +++ b/src/gl/textures/gl_material.cpp @@ -753,6 +753,7 @@ void FMaterial::BindToFrameBuffer() // must create the hardware texture first mBaseLayer->Bind(0, 0, 0, false, NULL); FHardwareTexture::Unbind(0); + ClearLastTexture(); } mBaseLayer->mHwTexture->BindToFrameBuffer(); } @@ -809,3 +810,7 @@ void FMaterial::FlushAll() } } +void FMaterial::ClearLastTexture() +{ + last = NULL; +} diff --git a/src/gl/textures/gl_material.h b/src/gl/textures/gl_material.h index 714ab5a03d..dfdbeb7430 100644 --- a/src/gl/textures/gl_material.h +++ b/src/gl/textures/gl_material.h @@ -253,6 +253,7 @@ public: static void FlushAll(); static FMaterial *ValidateTexture(FTexture * tex, bool expand); static FMaterial *ValidateTexture(FTextureID no, bool expand, bool trans); + static void ClearLastTexture(); };