Permalink
Browse files

Switched to glGetIntegerv(GL_MAJOR_VERSION, ...) instead of glGetStri…

…ng(GL_VERSION) string parsing.

Thanks to Rommel160 [github.com/Rommel160] for the suggestion.
  • Loading branch information...
skaslev committed Aug 21, 2011
1 parent 893d4bf commit 1e6f9db19b04e713eb0948d3e2c27b3e3999a90c
Showing with 10 additions and 15 deletions.
  1. +1 −1 .gitignore
  2. +3 −0 README.rst
  3. +6 −14 gl3w_gen.py
View
@@ -1,4 +1,4 @@
-.sconsign.dblite
+.*
*.o
*.os
bin
View
@@ -92,6 +92,9 @@ Slavomir Kaslev <slavomir.kaslev@gmail.com>
Kelvin McDowell
Mac OS X support
+Rommel160 [github.com/Rommel160]
+ Code contributions
+
Copyright
---------
View
@@ -158,22 +158,14 @@ def proc_t(proc):
static int parse_version(void)
{
- const char *p;
- int major, minor;
-
- if (!glGetString)
- return -1;
- p = (const char *) glGetString(GL_VERSION);
- if (!p)
+ if (!glGetIntegerv)
return -1;
- for (major = 0; *p >= '0' && *p <= '9'; p++)
- major = 10 * major + *p - '0';
- for (minor = 0, p++; *p >= '0' && *p <= '9'; p++)
- minor = 10 * minor + *p - '0';
- if (major < 3)
+
+ glGetIntegerv(GL_MAJOR_VERSION, &version.major);
+ glGetIntegerv(GL_MINOR_VERSION, &version.minor);
+
+ if (version.major < 3)
return -1;
- version.major = major;
- version.minor = minor;
return 0;
}

0 comments on commit 1e6f9db

Please sign in to comment.