Fixed a crash in GLES 2.0.

The glGetStringi is available only in GLES >= 3.0. We can't easily check if this function exists or not because it requires EGL >= 1.5 (and still we can't be sure that all drivers handle it properly).

Though glGetString(GL_EXTENSIONS) is allowed on both GLES2.0 and GLES3.0, so we can just fallback to this method.
This commit is contained in:
Deve
2016-12-30 11:07:18 +01:00
parent cb5f24e551
commit 412399cdf7

View File

@@ -349,6 +349,7 @@ void draw3DLine(const core::vector3df& start,
bool hasGLExtension(const char* extension)
{
#if !defined(USE_GLES2)
if (glGetStringi != NULL)
{
GLint numExtensions = 0;
@@ -364,6 +365,7 @@ bool hasGLExtension(const char* extension)
}
}
else
#endif
{
const char* extensions = (const char*) glGetString(GL_EXTENSIONS);
if (extensions && strstr(extensions, extension) != NULL)
@@ -381,6 +383,7 @@ bool hasGLExtension(const char* extension)
const std::string getGLExtensions()
{
std::string result;
#if !defined(USE_GLES2)
if (glGetStringi != NULL)
{
GLint num_extensions = 0;
@@ -394,6 +397,7 @@ const std::string getGLExtensions()
}
}
else
#endif
{
const char* extensions = (const char*) glGetString(GL_EXTENSIONS);
result = extensions;