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)
{
glGetIntegerv (GL_MAJOR_VERSION, &major_version);
glGetIntegerv (GL_MINOR_VERSION, &minor_version);
const char *version_string = (const char *) glGetString (GL_VERSION);
sscanf (version_string, "%d.%d", &major_version, &minor_version);
}
if (maj > major_version)
if (major_version > maj)
return true;
if (maj == major_version && min >= minor_version)
if (maj == major_version && minor_version >= min)
return true;
return false;

View File

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