Clear global state tracking variables when the OpenGL context is (re)created

This commit is contained in:
Magnus Norddahl 2016-08-26 01:36:21 +02:00
commit 960038bb81
5 changed files with 39 additions and 2 deletions

View file

@ -99,6 +99,11 @@ OpenGLFrameBuffer::OpenGLFrameBuffer(void *hMonitor, int width, int height, int
// If wglSwapIntervalEXT is called after glBindFramebuffer in a frame the setting is not changed!
SetVSync(vid_vsync);
// Make sure all global variables tracking OpenGL context state are reset..
FHardwareTexture::InitGlobalState();
FMaterial::InitGlobalState();
gl_RenderState.Reset();
GLRenderer = new FGLRenderer(this);
memcpy (SourcePalette, GPalette.BaseColors, sizeof(PalEntry)*256);
UpdatePalette ();