progs/redbook: use glew
authorBrian Paul <brianp@vmware.com>
Tue, 16 Feb 2010 01:04:00 +0000 (18:04 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 16 Feb 2010 01:04:39 +0000 (18:04 -0700)
progs/redbook/Makefile
progs/redbook/combiner.c
progs/redbook/convolution.c
progs/redbook/fogcoord.c
progs/redbook/histogram.c
progs/redbook/minmax.c
progs/redbook/multitex.c
progs/redbook/mvarray.c
progs/redbook/pointp.c
progs/redbook/shadowmap.c
progs/redbook/texture3d.c

index b73ad05..b41e488 100644 (file)
@@ -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 \
index 5e7e441..92e4de4 100644 (file)
@@ -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);
index e120c58..0543379 100644 (file)
@@ -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);
index 39e4689..17ef7ae 100644 (file)
@@ -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);
index 7ddceb6..de1e59e 100644 (file)
@@ -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);
index 6ff97e9..da5b875 100644 (file)
@@ -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);
index 060db3b..118f0ea 100644 (file)
@@ -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);
index cbc3937..1022723 100644 (file)
@@ -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);
index ed62fa1..b273623 100644 (file)
@@ -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);
index 3fe1d1e..f37191d 100644 (file)
  * 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();
 
index 9f57e08..c7b77c1 100644 (file)
@@ -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);