progs/redbook: use glew

This commit is contained in:
Brian Paul 2010-02-15 18:04:00 -07:00
parent bd3829b5f5
commit c6e63f3cc2
11 changed files with 36 additions and 9 deletions

View 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 \

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);

View file

@ -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();

View 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);