Use some more compatible OpenGL version checking.

This commit is contained in:
Brandon Wright 2018-05-28 18:40:29 -05:00
parent 78bc52cd8e
commit 171a20cb6d
2 changed files with 6 additions and 5 deletions

View File

@ -35,14 +35,14 @@ bool gl_version_at_least (int maj, int min)
if (major_version < 0 || minor_version < 0) if (major_version < 0 || minor_version < 0)
{ {
glGetIntegerv (GL_MAJOR_VERSION, &major_version); const char *version_string = (const char *) glGetString (GL_VERSION);
glGetIntegerv (GL_MINOR_VERSION, &minor_version); sscanf (version_string, "%d.%d", &major_version, &minor_version);
} }
if (maj > major_version) if (major_version > maj)
return true; return true;
if (maj == major_version && min >= minor_version) if (maj == major_version && minor_version >= min)
return true; return true;
return false; return false;

View File

@ -953,12 +953,13 @@ bool COpenGL::ShaderAailable()
bool COpenGL::NPOTAvailable() bool COpenGL::NPOTAvailable()
{ {
const char *extensions = (const char *)glGetString(GL_EXTENSIONS); const char *extensions = (const char *)glGetString(GL_EXTENSIONS);
const char *version = (const char *)glGetString(GL_VERSION);
if (!extensions) if (!extensions)
return false; return false;
int glVersionMajor = 0; int glVersionMajor = 0;
glGetIntegerv(GL_MAJOR_VERSION, &glVersionMajor); glVersionMajor = atoi (version);
if (glVersionMajor >= 2) if (glVersionMajor >= 2)
return true; return true;