Mesa (master): progs/redbook: use glew

Brian Paul brianp at kemper.freedesktop.org
Tue Feb 16 01:05:07 UTC 2010


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

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Feb 15 18:04:00 2010 -0700

progs/redbook: use glew

---

 progs/redbook/Makefile      |    2 +-
 progs/redbook/combiner.c    |    2 ++
 progs/redbook/convolution.c |    7 +++++++
 progs/redbook/fogcoord.c    |    4 ++--
 progs/redbook/histogram.c   |    7 +++++++
 progs/redbook/minmax.c      |    7 +++++++
 progs/redbook/multitex.c    |    2 ++
 progs/redbook/mvarray.c     |    4 ++--
 progs/redbook/pointp.c      |    4 ++--
 progs/redbook/shadowmap.c   |    4 ++--
 progs/redbook/texture3d.c   |    2 ++
 11 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/progs/redbook/Makefile b/progs/redbook/Makefile
index b73ad05..b41e488 100644
--- a/progs/redbook/Makefile
+++ b/progs/redbook/Makefile
@@ -7,7 +7,7 @@ INCDIR = $(TOP)/include
 
 LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
 
-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)
 
 PROGS = aaindex \
 	aapoly \
diff --git a/progs/redbook/combiner.c b/progs/redbook/combiner.c
index 5e7e441..92e4de4 100644
--- a/progs/redbook/combiner.c
+++ b/progs/redbook/combiner.c
@@ -58,6 +58,7 @@
  *  scaling factor and reversing the order of subtraction
  *  for a combination function.
  */
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -368,6 +369,7 @@ int main(int argc, char** argv)
    glutInitWindowSize(400, 400);
    glutInitWindowPosition(100, 100);
    glutCreateWindow(argv[0]);
+   glewInit();
    init();
    glutDisplayFunc(display);
    glutReshapeFunc(reshape);
diff --git a/progs/redbook/convolution.c b/progs/redbook/convolution.c
index e120c58..0543379 100644
--- a/progs/redbook/convolution.c
+++ b/progs/redbook/convolution.c
@@ -45,6 +45,7 @@
  *  Use various 2D convolutions filters to find edges in an image.
  *  
  */
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <assert.h>
 #include <stdio.h>
@@ -131,6 +132,11 @@ GLfloat  laplacian[3][3] = {
 
 static void init(void)
 {
+   if (!glutExtensionSupported("GL_ARB_imaging")) {
+      fprintf(stderr, "Sorry, this program requires GL_ARB_imaging.\n");
+      exit(1);
+   }
+
    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    glClearColor(0.0, 0.0, 0.0, 0.0);
 
@@ -197,6 +203,7 @@ int main(int argc, char** argv)
    glutInitWindowSize(width, height);
    glutInitWindowPosition(100, 100);
    glutCreateWindow(argv[0]);
+   glewInit();
    init();
    glutReshapeFunc(reshape);
    glutKeyboardFunc(keyboard);
diff --git a/progs/redbook/fogcoord.c b/progs/redbook/fogcoord.c
index 39e4689..17ef7ae 100644
--- a/progs/redbook/fogcoord.c
+++ b/progs/redbook/fogcoord.c
@@ -58,8 +58,7 @@
  *  three vertices of the triangle. 
  */
 
-#define GL_GLEXT_PROTOTYPES
-
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <math.h>
 #include <stdlib.h>
@@ -185,6 +184,7 @@ int main(int argc, char** argv)
    glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
    glutInitWindowSize(500, 500);
    glutCreateWindow(argv[0]);
+   glewInit();
    init();
    glutReshapeFunc (reshape);
    glutKeyboardFunc (keyboard);
diff --git a/progs/redbook/histogram.c b/progs/redbook/histogram.c
index 7ddceb6..de1e59e 100644
--- a/progs/redbook/histogram.c
+++ b/progs/redbook/histogram.c
@@ -46,6 +46,7 @@
  *  use of the glHistogram() function.
  */
 
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <assert.h>
 #include <stdlib.h>
@@ -113,6 +114,11 @@ readImage( const char* filename, GLsizei* width, GLsizei *height )
 
 static void init(void)
 {
+   if (!glutExtensionSupported("GL_ARB_imaging")) {
+      fprintf(stderr, "Sorry, this program requires GL_ARB_imaging.\n");
+      exit(1);
+   }
+
    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    glClearColor(0.0, 0.0, 0.0, 0.0);
 
@@ -192,6 +198,7 @@ int main(int argc, char** argv)
    glutInitWindowSize(width, height);
    glutInitWindowPosition(100, 100);
    glutCreateWindow(argv[0]);
+   glewInit();
    init();
    glutReshapeFunc(reshape);
    glutKeyboardFunc(keyboard);
diff --git a/progs/redbook/minmax.c b/progs/redbook/minmax.c
index 6ff97e9..da5b875 100644
--- a/progs/redbook/minmax.c
+++ b/progs/redbook/minmax.c
@@ -45,6 +45,7 @@
  *  Determine the minimum and maximum values of a group of pixels.
  *  This demonstrates use of the glMinmax() call.
  */
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -108,6 +109,11 @@ readImage( const char* filename, GLsizei* width, GLsizei *height )
 
 static void init(void)
 {
+   if (!glutExtensionSupported("GL_ARB_imaging")) {
+      fprintf(stderr, "Sorry, this program requires GL_ARB_imaging.\n");
+      exit(1);
+   }
+
    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    glClearColor(0.0, 0.0, 0.0, 0.0);
 
@@ -160,6 +166,7 @@ int main(int argc, char** argv)
    glutInitWindowSize(width, height);
    glutInitWindowPosition(100, 100);
    glutCreateWindow(argv[0]);
+   glewInit();
    init();
    glutReshapeFunc(reshape);
    glutKeyboardFunc(keyboard);
diff --git a/progs/redbook/multitex.c b/progs/redbook/multitex.c
index 060db3b..118f0ea 100644
--- a/progs/redbook/multitex.c
+++ b/progs/redbook/multitex.c
@@ -42,6 +42,7 @@
 
 /*  multitex.c
  */
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -166,6 +167,7 @@ int main(int argc, char** argv)
    glutInitWindowSize(250, 250);
    glutInitWindowPosition(100, 100);
    glutCreateWindow(argv[0]);
+   glewInit();
    init();
    glutReshapeFunc(reshape);
    glutDisplayFunc(display);
diff --git a/progs/redbook/mvarray.c b/progs/redbook/mvarray.c
index cbc3937..1022723 100644
--- a/progs/redbook/mvarray.c
+++ b/progs/redbook/mvarray.c
@@ -46,8 +46,7 @@
  *  specifically the OpenGL routine glMultiDrawElements().
  */
 
-#define GL_GLEXT_PROTOTYPES
-
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -118,6 +117,7 @@ int main(int argc, char** argv)
    glutInitWindowSize (350, 350); 
    glutInitWindowPosition (100, 100);
    glutCreateWindow (argv[0]);
+   glewInit();
    init ();
    glutDisplayFunc(display); 
    glutReshapeFunc(reshape);
diff --git a/progs/redbook/pointp.c b/progs/redbook/pointp.c
index ed62fa1..b273623 100644
--- a/progs/redbook/pointp.c
+++ b/progs/redbook/pointp.c
@@ -60,8 +60,7 @@
  *  will not get less than 2.0, nor greater than GL_POINT_SIZE_MAX.
  */
 
-#define GL_GLEXT_PROTOTYPES
-
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -170,6 +169,7 @@ int main(int argc, char** argv)
    glutInitWindowSize (500, 500); 
    glutInitWindowPosition (100, 100);
    glutCreateWindow (argv[0]);
+   glewInit();
    init ();
    glutDisplayFunc (display); 
    glutReshapeFunc (reshape);
diff --git a/progs/redbook/shadowmap.c b/progs/redbook/shadowmap.c
index 3fe1d1e..f37191d 100644
--- a/progs/redbook/shadowmap.c
+++ b/progs/redbook/shadowmap.c
@@ -40,11 +40,10 @@
  * OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
  */
 
-#define GL_GLEXT_PROTOTYPES
-
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <GL/glew.h>
 #include <GL/glut.h>
 /*#include "helpers.h"*/
 
@@ -338,6 +337,7 @@ main( int argc, char** argv )
     glutInitWindowSize( 512, 512 );
     glutInitWindowPosition( 100, 100 );
     glutCreateWindow( argv[0] );
+    glewInit();
 
     init();
 
diff --git a/progs/redbook/texture3d.c b/progs/redbook/texture3d.c
index 9f57e08..c7b77c1 100644
--- a/progs/redbook/texture3d.c
+++ b/progs/redbook/texture3d.c
@@ -46,6 +46,7 @@
  *  with different texture coordinates to obtain different
  *  "slices" of the 3D texture.
  */
+#include <GL/glew.h>
 #include <GL/glut.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -142,6 +143,7 @@ int main(int argc, char** argv)
    glutInitWindowSize(250, 250);
    glutInitWindowPosition(100, 100);
    glutCreateWindow(argv[0]);
+   glewInit();
    init();
    glutReshapeFunc(reshape);
    glutDisplayFunc(display);




More information about the mesa-commit mailing list