diff options
Diffstat (limited to 'progs/egl')
-rw-r--r-- | progs/egl/Makefile | 8 | ||||
-rw-r--r-- | progs/egl/demo1.c | 5 | ||||
-rw-r--r-- | progs/egl/demo2.c | 57 | ||||
-rw-r--r-- | progs/egl/demo3.c | 3 | ||||
-rw-r--r-- | progs/egl/eglgears.c | 7 | ||||
-rw-r--r-- | progs/egl/eglinfo.c | 5 |
6 files changed, 60 insertions, 25 deletions
diff --git a/progs/egl/Makefile b/progs/egl/Makefile index 33447a9d57..da710cbbbf 100644 --- a/progs/egl/Makefile +++ b/progs/egl/Makefile @@ -46,7 +46,7 @@ demo3.o: demo3.c $(HEADERS) eglinfo: eglinfo.o $(TOP)/$(LIB_DIR)/libEGL.so - $(CC) $(CFLAGS) eglinfo.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) -o $@ + $(CC) $(CFLAGS) eglinfo.o -L$(TOP)/$(LIB_DIR) -lGL -lEGL $(LIBDRM_LIB) -o $@ eglinfo.o: eglinfo.c $(HEADERS) $(CC) -c $(CFLAGS) -I$(TOP)/include eglinfo.c @@ -63,3 +63,9 @@ clean: rm -f *.o *~ rm -f *.so rm -f $(PROGRAMS) + +run: + LD_LIBRARY_PATH=$(TOP)/lib ./eglgears + +debug: + LD_LIBRARY_PATH=$(TOP)/lib gdb ./eglgears diff --git a/progs/egl/demo1.c b/progs/egl/demo1.c index 9ef17e38b7..52673187c4 100644 --- a/progs/egl/demo1.c +++ b/progs/egl/demo1.c @@ -2,7 +2,10 @@ * Exercise EGL API functions */ +#define EGL_EGLEXT_PROTOTYPES + #include <GLES/egl.h> +#include <GLES/eglext.h> #include <assert.h> #include <stdio.h> #include <stdlib.h> @@ -102,7 +105,7 @@ main(int argc, char *argv[]) /* EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY); */ - EGLDisplay d = eglGetDisplay("!fb_dri"); + EGLDisplay d = eglGetDisplay((EGLNativeDisplayType) "!EGL_i915"); assert(d); if (!eglInitialize(d, &maj, &min)) { diff --git a/progs/egl/demo2.c b/progs/egl/demo2.c index 17bbca6158..c95aaafa13 100644 --- a/progs/egl/demo2.c +++ b/progs/egl/demo2.c @@ -2,35 +2,54 @@ * Exercise EGL API functions */ +#define EGL_EGLEXT_PROTOTYPES + #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <GLES/egl.h> +#include <GLES/eglext.h> +#include <GLES/gl.h> /*#define FRONTBUFFER*/ -static void _subset_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) +static void _subset_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, + GLfloat r, GLfloat g, GLfloat b) { - glBegin( GL_QUADS ); - glVertex2f( x1, y1 ); - glVertex2f( x2, y1 ); - glVertex2f( x2, y2 ); - glVertex2f( x1, y2 ); - glEnd(); + GLfloat v[4][2], c[4][4]; + int i; + + v[0][0] = x1; v[0][1] = y1; + v[1][0] = x2; v[1][1] = y1; + v[2][0] = x2; v[2][1] = y2; + v[3][0] = x1; v[3][1] = y2; + + for (i = 0; i < 4; i++) { + c[i][0] = r; + c[i][1] = g; + c[i][2] = b; + c[i][3] = 1.0; + } + + glVertexPointer(2, GL_FLOAT, 0, v); + glColorPointer(4, GL_FLOAT, 0, v); + glEnableClientState(GL_VERTEX_ARRAY); + glEnableClientState(GL_COLOR_ARRAY); + + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_COLOR_ARRAY); } static void redraw(EGLDisplay dpy, EGLSurface surf, int rot) { - printf("Redraw event\n"); + GLfloat r, g, b; -#ifdef FRONTBUFFER - glDrawBuffer( GL_FRONT ); -#else - glDrawBuffer( GL_BACK ); -#endif + printf("Redraw event\n"); glClearColor( rand()/(float)RAND_MAX, rand()/(float)RAND_MAX, @@ -39,13 +58,14 @@ static void redraw(EGLDisplay dpy, EGLSurface surf, int rot) glClear( GL_COLOR_BUFFER_BIT ); - glColor3f( rand()/(float)RAND_MAX, - rand()/(float)RAND_MAX, - rand()/(float)RAND_MAX ); + r = rand()/(float)RAND_MAX; + g = rand()/(float)RAND_MAX; + b = rand()/(float)RAND_MAX; + glPushMatrix(); glRotatef(rot, 0, 0, 1); glScalef(.5, .5, .5); - _subset_Rectf( -1, -1, 1, 1 ); + _subset_Rectf( -1, -1, 1, 1, r, g, b ); glPopMatrix(); #ifdef FRONTBUFFER @@ -102,7 +122,7 @@ main(int argc, char *argv[]) /* EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY); */ - EGLDisplay d = eglGetDisplay("!fb_dri"); + EGLDisplay d = eglGetDisplay((EGLNativeDisplayType) "!EGL_i915"); assert(d); if (!eglInitialize(d, &maj, &min)) { @@ -161,7 +181,6 @@ main(int argc, char *argv[]) } glViewport(0, 0, 1024, 768); - glDrawBuffer( GL_FRONT ); glClearColor( 0, 1.0, diff --git a/progs/egl/demo3.c b/progs/egl/demo3.c index 9edf7c952b..6ea7578793 100644 --- a/progs/egl/demo3.c +++ b/progs/egl/demo3.c @@ -3,6 +3,7 @@ */ #include <GLES/egl.h> +#include <GL/gl.h> #include <assert.h> #include <stdio.h> #include <stdlib.h> @@ -576,7 +577,7 @@ main(int argc, char *argv[]) /* EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY); */ - EGLDisplay d = eglGetDisplay(":0"); + EGLDisplay d = eglGetDisplay("!EGL_i915"); assert(d); if (!eglInitialize(d, &maj, &min)) { diff --git a/progs/egl/eglgears.c b/progs/egl/eglgears.c index 9feee20d88..a004cb7e86 100644 --- a/progs/egl/eglgears.c +++ b/progs/egl/eglgears.c @@ -27,13 +27,16 @@ * Program runs for 5 seconds then exits, outputing framerate to console */ +#define EGL_EGLEXT_PROTOTYPES + +#include <assert.h> #include <math.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <GL/gl.h> #include <GLES/egl.h> -#include <assert.h> +#include <GLES/eglext.h> #define MAX_CONFIGS 10 #define MAX_MODES 100 @@ -385,7 +388,7 @@ main(int argc, char *argv[]) } /* DBR : Create EGL context/surface etc */ - d = eglGetDisplay(":0"); + d = eglGetDisplay((EGLNativeDisplayType)"!EGL_i915"); assert(d); if (!eglInitialize(d, &maj, &min)) { diff --git a/progs/egl/eglinfo.c b/progs/egl/eglinfo.c index f9c2475445..442de5d63f 100644 --- a/progs/egl/eglinfo.c +++ b/progs/egl/eglinfo.c @@ -140,7 +140,7 @@ main(int argc, char *argv[]) { int maj, min; /*EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);*/ - EGLDisplay d = eglGetDisplay(":0"); + EGLDisplay d = eglGetDisplay("!EGL_i915"); if (!eglInitialize(d, &maj, &min)) { printf("eglinfo: eglInitialize failed\n"); @@ -150,6 +150,9 @@ main(int argc, char *argv[]) printf("EGL API version: %d.%d\n", maj, min); printf("EGL vendor string: %s\n", eglQueryString(d, EGL_VENDOR)); printf("EGL version string: %s\n", eglQueryString(d, EGL_VERSION)); +#ifdef EGL_VERSION_1_2 + printf("EGL client APIs: %s\n", eglQueryString(d, EGL_CLIENT_APIS)); +#endif printf("EGL extensions string:\n"); printf(" %s\n", eglQueryString(d, EGL_EXTENSIONS)); printf("\n"); |