forked from Mirrors/openclonk
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
parent
7a4dc6ac79
commit
d53c8bffad
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue