Merge branch 'mesa_7_7_branch'
[mesa.git] / progs / demos / winpos.c
index 2ee1df69fbc0a70e986d26351cc65f2ad3ada99d..f935f9bee0f1ae829fb67b9743bc755f0cd3d1fa 100644 (file)
@@ -11,7 +11,7 @@
 #ifdef _WIN32
 #include <windows.h>
 #endif
-#define GL_GLEXT_PROTOTYPES
+#include "GL/glew.h"
 #include "GL/glut.h"
 
 #include "readtex.h"
@@ -29,8 +29,7 @@ static GLubyte *Image;
 static int ImgWidth, ImgHeight;
 static GLenum ImgFormat;
 
-typedef void (APIENTRY * PFNWINDOWPOSFUNC)(GLfloat x, GLfloat y);
-static PFNWINDOWPOSFUNC WindowPosFunc;
+static PFNGLWINDOWPOS2FPROC WindowPosFunc;
 
 static void draw( void )
 {
@@ -71,19 +70,16 @@ static void reshape( int width, int height )
 
 static void init( void )
 {
-#ifdef GL_ARB_window_pos
-   if (glutExtensionSupported("GL_ARB_window_pos")) {
+   if (GLEW_ARB_window_pos) {
       printf("Using GL_ARB_window_pos\n");
-      WindowPosFunc = &glWindowPos2fARB;
+      WindowPosFunc = glWindowPos2fARB;
    }
    else
-#elif defined(GL_ARB_window_pos)
-   if (glutExtensionSupported("GL_MESA_window_pos")) {
+   if (GLEW_MESA_window_pos) {
       printf("Using GL_MESA_window_pos\n");
-      WindowPosFunc = &glWindowPos2fMESA;
+      WindowPosFunc = glWindowPos2fMESA;
    }
    else
-#endif
    {
       printf("Sorry, GL_ARB/MESA_window_pos extension not available.\n");
       exit(1);
@@ -100,14 +96,16 @@ static void init( void )
 
 int main( int argc, char *argv[] )
 {
-   glutInitWindowPosition(0, 0);
    glutInitWindowSize(500, 500);
+   glutInit(&argc, argv);
    glutInitDisplayMode( GLUT_RGB );
 
    if (glutCreateWindow("winpos") <= 0) {
       exit(0);
    }
 
+   glewInit();
+
    init();
 
    glutReshapeFunc( reshape );