Mesa (master): progs: Make fp-tri use glew and add scons target

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Thu Feb 19 10:01:49 UTC 2009


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

Author: Jakob Bornecrantz <jakob at vmware.com>
Date:   Sat Feb 14 01:05:13 2009 +0100

progs: Make fp-tri use glew and add scons target

---

 progs/SConscript    |    1 +
 progs/fp/Makefile   |    2 +-
 progs/fp/SConscript |   13 +++++++++++++
 progs/fp/fp-tri.c   |   16 +++++++++++++---
 4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/progs/SConscript b/progs/SConscript
index 6484c76..544ea64 100644
--- a/progs/SConscript
+++ b/progs/SConscript
@@ -5,4 +5,5 @@ SConscript([
     'samples/SConscript',
     'trivial/SConscript',
     'vp/SConscript',
+    'fp/SConscript',
 ])
diff --git a/progs/fp/Makefile b/progs/fp/Makefile
index ef6644c..681928c 100755
--- a/progs/fp/Makefile
+++ b/progs/fp/Makefile
@@ -8,7 +8,7 @@ TOP = ../..
 include $(TOP)/configs/current
 
 
-LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
+LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
 
 SOURCES = \
 	tri-tex.c \
diff --git a/progs/fp/SConscript b/progs/fp/SConscript
new file mode 100644
index 0000000..e31fa32
--- /dev/null
+++ b/progs/fp/SConscript
@@ -0,0 +1,13 @@
+Import('env')
+
+if not env['GLUT']:
+    Return()
+
+env = env.Clone()
+
+env.Prepend(LIBS = ['$GLUT_LIB'])
+
+env.Program(
+        target = 'fp-tri',
+        source = ['fp-tri.c'],
+    )
diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c
index 843f897..b695901 100644
--- a/progs/fp/fp-tri.c
+++ b/progs/fp/fp-tri.c
@@ -2,10 +2,14 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#define GL_GLEXT_PROTOTYPES
-#include <GL/glut.h>
+
+#ifndef WIN32
 #include <unistd.h>
 #include <signal.h>
+#endif
+
+#include <GL/glew.h>
+#include <GL/glut.h>
 
 unsigned show_fps = 0;
 unsigned int frame_cnt = 0;
@@ -15,11 +19,14 @@ static const char *filename = NULL;
 static void usage(char *name)
 {
    fprintf(stderr, "usage: %s [ options ] shader_filename\n", name);
+#ifndef WIN32
    fprintf(stderr, "\n" );
    fprintf(stderr, "options:\n");
    fprintf(stderr, "    -fps  show frames per second\n");
+#endif
 }
 
+#ifndef WIN32
 void alarmhandler (int sig)
 {
    if (sig == SIGALRM) {
@@ -31,6 +38,7 @@ void alarmhandler (int sig)
    signal(SIGALRM, alarmhandler);
    alarm(5);
 }
+#endif
 
 static void args(int argc, char *argv[])
 {
@@ -142,7 +150,6 @@ static void Display(void)
    glEnd();
 
    glFlush();
-
    if (show_fps) {
       ++frame_cnt;
       glutPostRedisplay();
@@ -158,14 +165,17 @@ int main(int argc, char **argv)
    glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH);
    args(argc, argv);
    glutCreateWindow(filename);
+   glewInit();
    glutReshapeFunc(Reshape);
    glutKeyboardFunc(Key);
    glutDisplayFunc(Display);
    Init();
+#ifndef WIN32
    if (show_fps) {
       signal(SIGALRM, alarmhandler);
       alarm(5);
    }
+#endif
    glutMainLoop();
    return 0;
 }




More information about the mesa-commit mailing list