diff --git a/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp b/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp index 045b2aa6f..47fc97969 100644 --- a/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp +++ b/Engine/source/gfx/gl/win32/gfxGLDevice.win.cpp @@ -272,6 +272,11 @@ void GFXGLDevice::init( const GFXVideoMode &mode, PlatformWindow *window ) int debugFlag = 0; #endif + // Create a temp rendering context, needed a current context to use wglCreateContextAttribsARB + HGLRC tempGLRC = wglCreateContext(hdcGL); + if (!wglMakeCurrent(hdcGL, tempGLRC)) + AssertFatal(false, "Couldn't make temp GL context."); + if( gglHasWExtension(hdcGL, ARB_create_context) ) { int const create_attribs[] = { @@ -292,6 +297,10 @@ void GFXGLDevice::init( const GFXVideoMode &mode, PlatformWindow *window ) else mContext = wglCreateContext( hdcGL ); + // Delete temp rendering context + wglMakeCurrent(NULL, NULL); + wglDeleteContext(tempGLRC); + if( !wglMakeCurrent( hdcGL, (HGLRC)mContext ) ) AssertFatal( false , "GFXGLDevice::init - cannot make our context current. Or maybe we can't create it." );