Updated includes.
[mesa.git] / progs / demos / vao_demo.c
index e6a89f645b8f3af64ac82f3ad6817aedaf5c632e..ce416712fe264e1274cdd755cdc4ef80a83de88b 100644 (file)
@@ -22,6 +22,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
@@ -45,6 +46,7 @@ static PFNGLISVERTEXARRAYAPPLEPROC is_vertex_array = NULL;
 
 static int Width = 400;
 static int Height = 200;
+static int Win = 0;
 static const GLfloat Near = 5.0, Far = 25.0;
 static GLfloat angle = 0.0;
 
@@ -258,6 +260,7 @@ static void Key( unsigned char key, int x, int y )
    (void) y;
    switch (key) {
       case 27:
+         glutDestroyWindow(Win);
          exit(0);
          break;
    }
@@ -278,11 +281,15 @@ static void Init( void )
       exit(1);
    }
 
-   bind_vertex_array = glutGetProcAddress( "glBindVertexArrayAPPLE" );
-   gen_vertex_arrays = glutGetProcAddress( "glGenVertexArraysAPPLE" );
-   delete_vertex_arrays = glutGetProcAddress( "glDeleteVertexArraysAPPLE" );
-   is_vertex_array = glutGetProcAddress( "glIsVertexArrayAPPLE" );
+   bind_vertex_array = (PFNGLBINDVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glBindVertexArrayAPPLE" );
+   gen_vertex_arrays = (PFNGLGENVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glGenVertexArraysAPPLE" );
+   delete_vertex_arrays = (PFNGLDELETEVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glDeleteVertexArraysAPPLE" );
+   is_vertex_array = (PFNGLISVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glIsVertexArrayAPPLE" );
 
+   assert(bind_vertex_array);
+   assert(gen_vertex_arrays);
+   assert(delete_vertex_arrays);
+   assert(is_vertex_array);
 
    glEnable( GL_DEPTH_TEST );
    
@@ -312,7 +319,7 @@ int main( int argc, char *argv[] )
    glutInitWindowPosition( 0, 0 );
    glutInitWindowSize( Width, Height );
    glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
-   glutCreateWindow( "GL_APPLE_vertex_array_object demo" );
+   Win = glutCreateWindow( "GL_APPLE_vertex_array_object demo" );
    glutReshapeFunc( Reshape );
    glutKeyboardFunc( Key );
    glutDisplayFunc( Display );