Module: Demos Branch: master Commit: e567bd4aee3fb25e77d037a0c06c5903b246b3b9 URL: http://cgit.freedesktop.org/mesa/demos/commit/?id=e567bd4aee3fb25e77d037a0c06c5903b246b3b9
Author: José Fonseca <jose.r.fons...@gmail.com> Date: Sun Oct 30 23:08:41 2011 +0000 cva,dinoshade: Use GLEW more effectively. Eliminate GL_VERSION parsing code. --- src/demos/dinoshade.c | 16 ++-------------- src/tests/cva.c | 16 +++------------- 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/src/demos/dinoshade.c b/src/demos/dinoshade.c index 7d4b351..6d5a130 100644 --- a/src/demos/dinoshade.c +++ b/src/demos/dinoshade.c @@ -787,18 +787,6 @@ special(int k, int x, int y) glutPostRedisplay(); } -static int -supportsOneDotOne(void) -{ - const char *version; - int major, minor; - - version = (char *) glGetString(GL_VERSION); - if (sscanf(version, "%d.%d", &major, &minor) == 2) - return major * 10 + minor >= 11; - return 0; /* OpenGL version string malformed! */ -} - int main(int argc, char **argv) { @@ -862,7 +850,7 @@ main(int argc, char **argv) makeDinosaur(); #ifdef GL_VERSION_1_1 - if (supportsOneDotOne() && !forceExtension) { + if (GLEW_VERSION_1_1 && !forceExtension) { polygonOffsetVersion = ONE_DOT_ONE; glPolygonOffset(-2.0, -9.0); } else @@ -870,7 +858,7 @@ main(int argc, char **argv) { #ifdef GL_EXT_polygon_offset /* check for the polygon offset extension */ - if (glutExtensionSupported("GL_EXT_polygon_offset")) { + if (GLEW_EXT_polygon_offset) { polygonOffsetVersion = EXTENSION; glPolygonOffsetEXT(-2.0, -0.002); } else diff --git a/src/tests/cva.c b/src/tests/cva.c index 987a9c7..f097736 100644 --- a/src/tests/cva.c +++ b/src/tests/cva.c @@ -61,11 +61,9 @@ static void init( void ) glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts ); glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color ); -#ifdef GL_EXT_compiled_vertex_array - if ( compiled ) { + if ( GLEW_EXT_compiled_vertex_array ) { glLockArraysEXT( 0, 4 ); } -#endif } static void display( void ) @@ -113,8 +111,6 @@ static GLboolean args( int argc, char **argv ) int main( int argc, char **argv ) { GLenum type; - char *string; - double version; glutInit( &argc, argv ); @@ -133,21 +129,15 @@ int main( int argc, char **argv ) /* Make sure the server supports GL 1.2 vertex arrays. */ - string = (char *) glGetString( GL_VERSION ); - - version = atof(string); - if ( version < 1.2 ) { + if ( !GLEW_VERSION_1_2 ) { fprintf( stderr, "This program requires OpenGL 1.2 vertex arrays.\n" ); exit( -1 ); } /* See if the server supports compiled vertex arrays. */ - string = (char *) glGetString( GL_EXTENSIONS ); - - if ( !strstr( string, "GL_EXT_compiled_vertex_array" ) ) { + if ( !GLEW_EXT_compiled_vertex_array ) { fprintf( stderr, "Compiled vertex arrays not supported by this renderer.\n" ); - compiled = GL_FALSE; } init(); _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit