Mesa (master): progs/es1: Add bindtex.

Chia-I Wu olv at kemper.freedesktop.org
Sat Jan 30 15:14:09 UTC 2010


Module: Mesa
Branch: master
Commit: 7056a74734d078c501d8318d47a364832aa8aeb6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7056a74734d078c501d8318d47a364832aa8aeb6

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Sat Jan 30 23:07:31 2010 +0800

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 +++++
 progs/{egl/xeglbindtex.c => es1/xegl/bindtex.c} |   22 +++++++++-------------
 3 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/progs/egl/Makefile b/progs/egl/Makefile
index ff9a858..68bb567 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 7f684d6..6869c44 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 de0ede9..c243b59 100644
--- a/progs/egl/xeglbindtex.c
+++ b/progs/es1/xegl/bindtex.c
@@ -33,7 +33,7 @@
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
 #include <X11/keysym.h>
-#include <GL/gl.h>
+#include <GLES/gl.h>
 #include <EGL/egl.h>
 
 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();




More information about the mesa-commit mailing list