texenvprogram: fix for ARB_draw_buffers.
[mesa.git] / progs / egl / eglgears.c
index 31346d95230862453d84ae0edd602a8225c38d13..63490953aee1b11f785359d419c5484bb5bae53e 100644 (file)
@@ -274,10 +274,10 @@ draw(void)
 static void
 reshape(int width, int height)
 {
-   glViewport(0, 0, (GLint) width, (GLint) height);
-
    GLfloat h = (GLfloat) height / (GLfloat) width;
 
+   glViewport(0, 0, (GLint) width, (GLint) height);
+
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
@@ -333,6 +333,8 @@ static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr)
        double st = current_time();
        double ct = st;
        int frames = 0;
+       GLfloat seconds, fps;
+
        while (ct - st < ttr)
        {
                double tt = current_time();
@@ -352,8 +354,8 @@ static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr)
                frames++;
        }
        
-       GLfloat seconds = ct - st;
-       GLfloat fps = frames / seconds;
+       seconds = ct - st;
+       fps = frames / seconds;
        printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps);
        
 }
@@ -372,7 +374,8 @@ main(int argc, char *argv[])
        EGLint screenAttribs[10];
        EGLModeMESA mode[MAX_MODES];
        EGLScreenMESA screen;
-       EGLint count, chosenMode;
+       EGLint count;
+       EGLint chosenMode = 0;
        GLboolean printInfo = GL_FALSE;
        EGLint width = 0, height = 0;
        
@@ -388,7 +391,7 @@ main(int argc, char *argv[])
        }
        
        /* DBR : Create EGL context/surface etc */
-       d = eglGetDisplay((EGLNativeDisplayType)"!EGL_i915");
+       d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
        assert(d);
 
        if (!eglInitialize(d, &maj, &min)) {
@@ -423,6 +426,7 @@ main(int argc, char *argv[])
        }
        printf("eglgears: Using screen mode/size %d: %d x %d\n", chosenMode, width, height);
 
+       eglBindAPI(EGL_OPENGL_API);
        ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
        if (ctx == EGL_NO_CONTEXT) {
                printf("eglgears: failed to create context\n");