WGL: Reinitialize GLEW after creating rendering context

The GL driver is allowed to use different entry points depending on the
context. This means that we can't just initialize GLEW once and use it
all the time, but we must refresh the entry point list every time we
create a new context.
Controls
Nicolas Hake 2015-05-25 18:32:35 +02:00
parent 7a4dc6ac79
commit d53c8bffad
1 changed files with 10 additions and 0 deletions

View File

@ -333,6 +333,16 @@ bool CStdGLCtx::Init(C4Window * pWindow, C4AbstractApp *pApp, HWND hWindow)
if (hrc)
{
Select();
// After selecting the new context, we have to reinitialize GLEW to
// update its function pointers - the driver may elect to expose
// different extensions depending on the context attributes
GLenum err = glewInit();
if (err != GLEW_OK)
{
// Uh. This is a problem.
pGL->Error(reinterpret_cast<const char*>(glewGetErrorString(err)));
return false;
}
return true;
}