From c6e63f3cc235b2d7b06664a493584671a2493045 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 15 Feb 2010 18:04:00 -0700 Subject: [PATCH] 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 b73ad056d11..b41e488729b 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 5e7e44152a1..92e4de484ad 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 #include #include #include @@ -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 e120c586327..0543379f241 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 #include #include #include @@ -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 39e4689948d..17ef7ae5f3a 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 #include #include #include @@ -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 7ddceb69e2e..de1e59edea6 100644 --- a/progs/redbook/histogram.c +++ b/progs/redbook/histogram.c @@ -46,6 +46,7 @@ * use of the glHistogram() function. */ +#include #include #include #include @@ -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 6ff97e9121c..da5b875a475 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 #include #include #include @@ -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 060db3b1762..118f0ea77ee 100644 --- a/progs/redbook/multitex.c +++ b/progs/redbook/multitex.c @@ -42,6 +42,7 @@ /* multitex.c */ +#include #include #include #include @@ -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 cbc3937ee94..1022723ad94 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 #include #include #include @@ -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 ed62fa1771b..b273623d856 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 #include #include #include @@ -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 3fe1d1e8df2..f37191d9ff3 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 #include #include +#include #include /*#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 9f57e08c6d9..c7b77c1caeb 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 #include #include #include @@ -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); -- 2.30.2