Created
December 12, 2013 01:21
-
-
Save Akira-Hayasaka/7921732 to your computer and use it in GitHub Desktop.
get openGL version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void GetGLVersion(int* major, int* minor) | |
{ | |
// for all versions | |
char* ver = (char*)glGetString(GL_VERSION); // ver = "3.2.0" | |
*major = ver[0] - '0'; | |
if( *major >= 3) | |
{ | |
// for GL 3.x | |
glGetIntegerv(GL_MAJOR_VERSION, major); // major = 3 | |
glGetIntegerv(GL_MINOR_VERSION, minor); // minor = 2 | |
} | |
else | |
{ | |
*minor = ver[2] - '0'; | |
} | |
// GLSL | |
ver = (char*)glGetString(GL_SHADING_LANGUAGE_VERSION); // ver = "1.50 NVIDIA via Cg compiler" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment