mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Fixed wglGetProcAddress not providing OpenGL 1.1 functions when the context is provided by an Nvidia ICD.
This commit is contained in:
parent
485d367a91
commit
61aeff13c9
@ -86,7 +86,7 @@ void ensureExtensionsInit(HDC deviceContext)
|
|||||||
|
|
||||||
// We don't check the return value since the extension
|
// We don't check the return value since the extension
|
||||||
// flags are cleared even if loading fails
|
// flags are cleared even if loading fails
|
||||||
gladLoadWGL(deviceContext, getOpenGl32Function);
|
gladLoadWGL(deviceContext, sf::priv::WglContext::getFunction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace WglContextImpl
|
} // namespace WglContextImpl
|
||||||
@ -200,22 +200,22 @@ GlFunctionPointer WglContext::getFunction(const char* name)
|
|||||||
{
|
{
|
||||||
assert(WglContextImpl::currentContext != nullptr);
|
assert(WglContextImpl::currentContext != nullptr);
|
||||||
|
|
||||||
auto address = reinterpret_cast<GlFunctionPointer>(wglGetProcAddress(reinterpret_cast<LPCSTR>(name)));
|
// 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)
|
||||||
if (address)
|
|
||||||
{
|
{
|
||||||
// Test whether the returned value is a valid error code
|
auto address = reinterpret_cast<GlFunctionPointer>(wglGetProcAddress(reinterpret_cast<LPCSTR>(name)));
|
||||||
auto errorCode = reinterpret_cast<ptrdiff_t>(address);
|
|
||||||
|
|
||||||
if ((errorCode != -1) && (errorCode != 1) && (errorCode != 2) && (errorCode != 3))
|
if (address)
|
||||||
return address;
|
{
|
||||||
|
// Test whether the returned value is a valid error code
|
||||||
|
auto errorCode = reinterpret_cast<ptrdiff_t>(address);
|
||||||
|
|
||||||
|
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
|
return WglContextImpl::getOpenGl32Function(name);
|
||||||
if (WglContextImpl::currentContext->m_isGeneric)
|
|
||||||
return WglContextImpl::getOpenGl32Function(name);
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user