From 7056a74734d078c501d8318d47a364832aa8aeb6 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 30 Jan 2010 23:07:31 +0800 Subject: [PATCH] progs/es1: Add bindtex. It is ported from progs/egl/xeglbindtex.c. With the OpenGL ES port, the OpenGL version is removed. --- progs/egl/Makefile | 4 ---- progs/es1/xegl/Makefile | 5 +++++ .../{egl/xeglbindtex.c => es1/xegl/bindtex.c} | 22 ++++++++----------- 3 files changed, 14 insertions(+), 17 deletions(-) rename progs/{egl/xeglbindtex.c => es1/xegl/bindtex.c} (96%) diff --git a/progs/egl/Makefile b/progs/egl/Makefile index ff9a858c569..68bb5679f85 100644 --- a/progs/egl/Makefile +++ b/progs/egl/Makefile @@ -20,7 +20,6 @@ PROGRAMS = \ eglgears \ eglscreen \ peglgears \ - xeglbindtex \ xeglgears \ xeglthreads \ xegl_tri @@ -57,9 +56,6 @@ eglscreen: eglscreen.o $(HEADERS) $(LIB_DEP) peglgears: peglgears.o $(HEADERS) $(LIB_DEP) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB) -xeglbindtex: xeglbindtex.o $(HEADERS) $(LIB_DEP) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11 - xeglgears: xeglgears.o $(HEADERS) $(LIB_DEP) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11 diff --git a/progs/es1/xegl/Makefile b/progs/es1/xegl/Makefile index 7f684d68e3b..6869c443065 100644 --- a/progs/es1/xegl/Makefile +++ b/progs/es1/xegl/Makefile @@ -20,6 +20,7 @@ ES1_LIBS = \ -L$(TOP)/$(LIB_DIR) -lGLESv1_CM $(LIBDRM_LIB) -lX11 PROGRAMS = \ + bindtex \ drawtex \ es1_info \ msaa \ @@ -39,6 +40,10 @@ default: $(PROGRAMS) +bindtex: bindtex.o $(ES1_LIB_DEPS) + $(CC) $(CFLAGS) bindtex.o $(ES1_LIBS) -o $@ + + drawtex: drawtex.o $(ES1_LIB_DEPS) $(CC) $(CFLAGS) drawtex.o $(ES1_LIBS) -o $@ diff --git a/progs/egl/xeglbindtex.c b/progs/es1/xegl/bindtex.c similarity index 96% rename from progs/egl/xeglbindtex.c rename to progs/es1/xegl/bindtex.c index de0ede92ca4..c243b5941b7 100644 --- a/progs/egl/xeglbindtex.c +++ b/progs/es1/xegl/bindtex.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include static EGLDisplay dpy; @@ -53,7 +53,6 @@ make_pbuffer(int width, int height) EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE, - EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_NONE }; EGLint pbuf_attribs[] = { @@ -72,7 +71,6 @@ make_pbuffer(int width, int height) exit(1); } - eglBindAPI(EGL_OPENGL_API); ctx_pbuf = eglCreateContext(dpy, config, EGL_NO_CONTEXT, NULL ); surf_pbuf = eglCreatePbufferSurface(dpy, config, pbuf_attribs); if (surf_pbuf == EGL_NO_SURFACE) { @@ -101,7 +99,7 @@ use_pbuffer(void) glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glFrustum(-ar, ar, -1, 1, 1.0, 10.0); + glFrustumf(-ar, ar, -1, 1, 1.0, 10.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); @@ -128,7 +126,6 @@ make_window(Display *x_dpy, const char *name, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 8, - EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, EGL_NONE }; @@ -189,10 +186,9 @@ make_window(Display *x_dpy, const char *name, None, (char **)NULL, 0, &sizehints); } - eglBindAPI(EGL_OPENGL_API); ctx_win = eglCreateContext(dpy, config, EGL_NO_CONTEXT, NULL ); if (!ctx_win) { - printf("Error: glXCreateContext failed\n"); + printf("Error: eglCreateContext failed\n"); exit(1); } @@ -227,10 +223,10 @@ draw_triangle(void) { 3, -3 }, { 0, 3 } }; - GLfloat colors[3][3] = { - { 1, 0, 0 }, - { 0, 1, 0 }, - { 0, 0, 1 } + GLfloat colors[3][4] = { + { 1, 0, 0, 1 }, + { 0, 1, 0, 1 }, + { 0, 0, 1, 1 } }; GLint i; @@ -250,7 +246,7 @@ draw_triangle(void) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glVertexPointer(2, GL_FLOAT, 0, verts); - glColorPointer(3, GL_FLOAT, 0, colors); + glColorPointer(4, GL_FLOAT, 0, colors); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); @@ -356,7 +352,7 @@ reshape(int width, int height) glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glFrustum(-ar, ar, -1, 1, 5.0, 60.0); + glFrustumf(-ar, ar, -1, 1, 5.0, 60.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); -- 2.30.2