Fixed wglGetProcAddress not providing OpenGL 1.1 functions when the context is provided by an Nvidia ICD.

This commit is contained in:
binary1248 2023-04-06 04:00:01 +02:00 committed by Lukas Dürrenberger
parent 485d367a91
commit 61aeff13c9

View File

@ -86,7 +86,7 @@ void ensureExtensionsInit(HDC deviceContext)
// We don't check the return value since the extension
// flags are cleared even if loading fails
gladLoadWGL(deviceContext, getOpenGl32Function);
gladLoadWGL(deviceContext, sf::priv::WglContext::getFunction);
}
}
} // namespace WglContextImpl
@ -200,6 +200,9 @@ GlFunctionPointer WglContext::getFunction(const char* name)
{
assert(WglContextImpl::currentContext != nullptr);
// If we are using the generic GDI implementation, skip to loading directly from OpenGL32.dll since it doesn't support extensions
if (!WglContextImpl::currentContext->m_isGeneric)
{
auto address = reinterpret_cast<GlFunctionPointer>(wglGetProcAddress(reinterpret_cast<LPCSTR>(name)));
if (address)
@ -210,12 +213,9 @@ GlFunctionPointer WglContext::getFunction(const char* name)
if ((errorCode != -1) && (errorCode != 1) && (errorCode != 2) && (errorCode != 3))
return address;
}
}
// If we are using the generic GDI implementation, try loading directly from OpenGL32.dll as well
if (WglContextImpl::currentContext->m_isGeneric)
return WglContextImpl::getOpenGl32Function(name);
return nullptr;
}