Merge commit 'origin/master' into gallium-0.2
[mesa.git] / progs / egl / demo3.c
index 6c7358400f9d72a1de611153aaeaa7faeeb907a5..a6096a257ec0435598c24a4deae6155dfb3ee939 100644 (file)
@@ -2,7 +2,11 @@
  * Exercise EGL API functions
  */
 
-#include <GLES/egl.h>
+#define EGL_EGLEXT_PROTOTYPES
+
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <GL/gl.h>
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -576,7 +580,7 @@ main(int argc, char *argv[])
    /*
    EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
    */
-   EGLDisplay d = eglGetDisplay("!fb_dri");
+   EGLDisplay d = eglGetDisplay("!EGL_i915");
    assert(d);
 
    if (!eglInitialize(d, &maj, &min)) {
@@ -602,33 +606,32 @@ main(int argc, char *argv[])
       printf("failed to create screen surface\n");
       return 0;
    }
-   
-   eglShowSurfaceMESA(d, screen, screen_surf, mode);
+
+   eglShowScreenSurfaceMESA(d, screen, screen_surf, mode);
 
    b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
    if (!b) {
       printf("make current failed\n");
       return 0;
    }
+   glViewport(0, 0, 1024, 768);
+
 
-   Init();   
+   Init();
    Reshape(1024, 768);
 
-   glDrawBuffer( GL_FRONT ); 
-   glClearColor( 0, 
-                1.0, 
-                0,
-                1);
+   glDrawBuffer( GL_FRONT );
+   glClearColor( 0, 1.0, 0, 1);
 
-   glClear( GL_COLOR_BUFFER_BIT ); 
+   glClear( GL_COLOR_BUFFER_BIT );
 
-   doubleBuffer = 1;   
-   glDrawBuffer( GL_BACK ); 
+   doubleBuffer = 1;
+   glDrawBuffer( GL_BACK );
 
    Draw(d, screen_surf);
-   
+
    write_ppm("dump.ppm", ((struct fb_display *)_eglLookupDisplay(d))->pFB, 1024, 768);
-   
+
    eglDestroySurface(d, screen_surf);
    eglDestroyContext(d, ctx);
    eglTerminate(d);