mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Fix OpenGL extensions not loading
This commit is contained in:
parent
53d8f66d43
commit
7e40f80f52
@ -218,10 +218,12 @@ namespace
|
||||
extensions.clear();
|
||||
|
||||
// Check whether a >= 3.0 context is available
|
||||
glGetStringiFuncType glGetStringiFunc = NULL;
|
||||
glGetStringiFunc = reinterpret_cast<glGetStringiFuncType>(sf::priv::GlContext::getFunction("glGetStringi"));
|
||||
int majorVersion = 0;
|
||||
glGetIntegerv(GL_MAJOR_VERSION, &majorVersion);
|
||||
|
||||
if (glGetError() == GL_INVALID_ENUM)
|
||||
if (glGetError() == GL_INVALID_ENUM || !glGetStringiFunc)
|
||||
{
|
||||
// Try to load the < 3.0 way
|
||||
const char* extensionString = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
|
||||
@ -240,22 +242,16 @@ namespace
|
||||
else
|
||||
{
|
||||
// Try to load the >= 3.0 way
|
||||
glGetStringiFuncType glGetStringiFunc = NULL;
|
||||
glGetStringiFunc = reinterpret_cast<glGetStringiFuncType>(sf::priv::GlContext::getFunction("glGetStringi"));
|
||||
int numExtensions = 0;
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
|
||||
|
||||
if (glGetStringiFunc)
|
||||
if (numExtensions)
|
||||
{
|
||||
int numExtensions = 0;
|
||||
glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
|
||||
|
||||
if (numExtensions)
|
||||
for (unsigned int i = 0; i < static_cast<unsigned int>(numExtensions); ++i)
|
||||
{
|
||||
for (unsigned int i = 0; i < static_cast<unsigned int>(numExtensions); ++i)
|
||||
{
|
||||
const char* extensionString = reinterpret_cast<const char*>(glGetStringiFunc(GL_EXTENSIONS, i));
|
||||
const char* extensionString = reinterpret_cast<const char*>(glGetStringiFunc(GL_EXTENSIONS, i));
|
||||
|
||||
extensions.push_back(extensionString);
|
||||
}
|
||||
extensions.push_back(extensionString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user