From b1399a5dd20fad801ee10383143439f8cf4615db Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 25 Nov 2007 15:06:54 +0000 Subject: gallium: more trivial tests --- progs/trivial/tri-fbo-tex.c | 267 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 267 insertions(+) create mode 100644 progs/trivial/tri-fbo-tex.c (limited to 'progs/trivial/tri-fbo-tex.c') diff --git a/progs/trivial/tri-fbo-tex.c b/progs/trivial/tri-fbo-tex.c new file mode 100644 index 0000000000..d413d4081f --- /dev/null +++ b/progs/trivial/tri-fbo-tex.c @@ -0,0 +1,267 @@ +/* + * Test GL_EXT_framebuffer_object render-to-texture + * + * Draw a teapot into a texture image with stenciling. + * Then draw a textured quad using that texture. + * + * Brian Paul + * 18 Apr 2005 + */ + + +#define GL_GLEXT_PROTOTYPES +#include +#include +#include +#include +#include +#include + +/* For debug */ + + +static int Win = 0; +static int Width = 512, Height = 512; + +static GLenum TexTarget = GL_TEXTURE_2D; +static int TexWidth = 512, TexHeight = 512; + +static GLuint MyFB; +static GLuint TexObj; +static GLboolean Anim = GL_FALSE; +static GLfloat Rot = 0.0; +static GLuint TextureLevel = 0; /* which texture level to render to */ +static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */ + + +static void +CheckError(int line) +{ + GLenum err = glGetError(); + if (err) { + printf("GL Error 0x%x at line %d\n", (int) err, line); + } +} + + +static void +Idle(void) +{ + Rot = glutGet(GLUT_ELAPSED_TIME) * 0.1; + glutPostRedisplay(); +} + + +static void +RenderTexture(void) +{ + GLenum status; + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -15.0); + + if (1) { + /* draw to texture image */ + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); + + status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { + printf("Framebuffer incomplete!!!\n"); + } + + glViewport(0, 0, TexWidth, TexHeight); + + glClearColor(0.5, 0.5, 1.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + + CheckError(__LINE__); + + glBegin(GL_POLYGON); + glColor3f(1, 0, 0); + glVertex2f(-1, -1); + glColor3f(0, 1, 0); + glVertex2f(1, -1); + glColor3f(0, 0, 1); + glVertex2f(0, 1); + glEnd(); + + /* Bind normal framebuffer */ + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + } + else { + } + + CheckError(__LINE__); +} + + + +static void +Display(void) +{ + float ar = (float) Width / (float) Height; + + RenderTexture(); + + /* draw textured quad in the window */ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -7.0); + + glViewport(0, 0, Width, Height); + + glClearColor(0.25, 0.25, 0.25, 0); + glClear(GL_COLOR_BUFFER_BIT); + + glPushMatrix(); + glRotatef(Rot, 0, 1, 0); + glEnable(TexTarget); + glBindTexture(TexTarget, TexObj); + + { + glBegin(GL_POLYGON); + glColor3f(0.25, 0.25, 0.25); + glTexCoord2f(0, 0); + glVertex2f(-1, -1); + glTexCoord2f(1, 0); + glVertex2f(1, -1); + glColor3f(1.0, 1.0, 1.0); + glTexCoord2f(1, 1); + glVertex2f(1, 1); + glTexCoord2f(0, 1); + glVertex2f(-1, 1); + glEnd(); + } + + glPopMatrix(); + glDisable(TexTarget); + + glutSwapBuffers(); + CheckError(__LINE__); +} + + +static void +Reshape(int width, int height) +{ + glViewport(0, 0, width, height); + Width = width; + Height = height; +} + + +static void +CleanUp(void) +{ + glDeleteFramebuffersEXT(1, &MyFB); + + glDeleteTextures(1, &TexObj); + + glutDestroyWindow(Win); + + exit(0); +} + + +static void +Key(unsigned char key, int x, int y) +{ + (void) x; + (void) y; + switch (key) { + case 'a': + Anim = !Anim; + if (Anim) + glutIdleFunc(Idle); + else + glutIdleFunc(NULL); + break; + case 's': + Rot += 2.0; + break; + case 27: + CleanUp(); + break; + } + glutPostRedisplay(); +} + + +static void +Init(int argc, char *argv[]) +{ + static const GLfloat mat[4] = { 1.0, 0.5, 0.5, 1.0 }; + GLint i; + + if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { + printf("GL_EXT_framebuffer_object not found!\n"); + exit(0); + } + + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + + + /* Make texture object/image */ + glGenTextures(1, &TexObj); + glBindTexture(TexTarget, TexObj); + glTexParameteri(TexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(TexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(TexTarget, GL_TEXTURE_BASE_LEVEL, TextureLevel); + glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel); + + glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + + + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + + + + + /* gen framebuffer id, delete it, do some assertions, just for testing */ + glGenFramebuffersEXT(1, &MyFB); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); + assert(glIsFramebufferEXT(MyFB)); + + + CheckError(__LINE__); + + /* Render color to texture */ + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + TexTarget, TexObj, TextureLevel); + + + + CheckError(__LINE__); + + /* bind regular framebuffer */ + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + + +} + + +int +main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowPosition(0, 0); + glutInitWindowSize(Width, Height); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); + Win = glutCreateWindow(argv[0]); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Display); + if (Anim) + glutIdleFunc(Idle); + Init(argc, argv); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From 479ea7d87b6d283cd74d345cb618d69a889284d9 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Fri, 23 Jan 2009 14:35:36 +0000 Subject: progs/trivial: Use glew where needed. Builds on windows now. --- progs/SConstruct | 25 +++++++++++++++++++++++-- progs/trivial/Makefile | 2 +- progs/trivial/clear-fbo-tex.c | 4 +++- progs/trivial/clear-fbo.c | 4 +++- progs/trivial/drawarrays.c | 3 ++- progs/trivial/drawelements.c | 3 ++- progs/trivial/drawrange.c | 3 ++- progs/trivial/lineloop-elts.c | 3 ++- progs/trivial/long-fixed-func.c | 3 ++- progs/trivial/point-param.c | 4 +++- progs/trivial/quad-tex-3d.c | 3 +++ progs/trivial/quad-tex-pbo.c | 4 +++- progs/trivial/readpixels.c | 4 +++- progs/trivial/tri-array-interleaved.c | 3 ++- progs/trivial/tri-blend-color.c | 3 +++ progs/trivial/tri-blend-max.c | 4 +++- progs/trivial/tri-blend-min.c | 4 +++- progs/trivial/tri-blend-revsub.c | 4 +++- progs/trivial/tri-blend-sub.c | 4 +++- progs/trivial/tri-fbo-tex.c | 3 ++- progs/trivial/tri-fbo.c | 4 +++- progs/trivial/tri-fp-const-imm.c | 4 +++- progs/trivial/tri-fp.c | 4 +++- progs/trivial/tri-query.c | 4 +++- progs/trivial/tri-tex-3d.c | 3 +++ progs/trivial/vbo-drawarrays.c | 3 ++- progs/trivial/vbo-drawelements.c | 3 ++- progs/trivial/vbo-drawrange.c | 3 ++- progs/trivial/vp-array-int.c | 3 ++- progs/trivial/vp-array.c | 3 ++- progs/trivial/vp-clip.c | 3 ++- progs/trivial/vp-line-clip.c | 3 ++- progs/trivial/vp-tri-cb-pos.c | 6 ++++-- progs/trivial/vp-tri-cb-tex.c | 4 +++- progs/trivial/vp-tri-cb.c | 3 ++- progs/trivial/vp-tri-imm.c | 3 ++- progs/trivial/vp-tri-swap.c | 3 ++- progs/trivial/vp-tri-tex.c | 3 ++- progs/trivial/vp-tri.c | 3 ++- progs/trivial/vp-unfilled.c | 3 ++- 40 files changed, 119 insertions(+), 39 deletions(-) (limited to 'progs/trivial/tri-fbo-tex.c') diff --git a/progs/SConstruct b/progs/SConstruct index ac5314fac5..bce48f72ff 100644 --- a/progs/SConstruct +++ b/progs/SConstruct @@ -10,9 +10,23 @@ env = Environment( # Use Mesa's headers and libs -if 0: +if 1: + build_topdir = 'build' + build_subdir = env['platform'] + if env['machine'] != 'generic': + build_subdir += '-' + env['machine'] + if env['debug']: + build_subdir += "-debug" + if env['profile']: + build_subdir += "-profile" + build_dir = os.path.join(build_topdir, build_subdir) + + env.Append(CPPDEFINES = ['GLEW_STATIC']) env.Append(CPPPATH = ['#../include']) - env.Append(LIBPATH = ['#../lib']) + env.Append(LIBPATH = [ + '#../' + build_dir + '/glew/', + '#../' + build_dir + '/glut/glx', + ]) conf = Configure(env) @@ -32,6 +46,13 @@ if conf.CheckCHeader('GL/glut.h'): env['GLUT_LIB'] = 'glut' env['GLUT'] = True +# GLEW +env['GLEW'] = False +if conf.CheckCHeader('GL/glew.h'): + env['GLEW_LIB'] = 'glew' + env['GLEW'] = True + env.Prepend(LIBS = ['glew']) + conf.Finish() diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile index 2c158c8d49..dce96f6bc8 100644 --- a/progs/trivial/Makefile +++ b/progs/trivial/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 $(GLEW_LIB) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) SOURCES = \ clear-fbo-tex.c \ diff --git a/progs/trivial/clear-fbo-tex.c b/progs/trivial/clear-fbo-tex.c index 68f1ab3d77..eccfde5ae6 100644 --- a/progs/trivial/clear-fbo-tex.c +++ b/progs/trivial/clear-fbo-tex.c @@ -5,7 +5,7 @@ #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -210,6 +210,8 @@ main( int argc, char *argv[] ) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/trivial/clear-fbo.c b/progs/trivial/clear-fbo.c index 82218ed498..64b25430c6 100644 --- a/progs/trivial/clear-fbo.c +++ b/progs/trivial/clear-fbo.c @@ -5,7 +5,7 @@ #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -195,6 +195,8 @@ main( int argc, char *argv[] ) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/trivial/drawarrays.c b/progs/trivial/drawarrays.c index 596eee9eef..27d86682f7 100644 --- a/progs/trivial/drawarrays.c +++ b/progs/trivial/drawarrays.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -118,6 +118,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/drawelements.c b/progs/trivial/drawelements.c index e0c8e80b68..4c115030af 100644 --- a/progs/trivial/drawelements.c +++ b/progs/trivial/drawelements.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include GLfloat verts[][4] = { @@ -111,6 +111,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/drawrange.c b/progs/trivial/drawrange.c index 9c787cbfcd..e9ea99b537 100644 --- a/progs/trivial/drawrange.c +++ b/progs/trivial/drawrange.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include GLfloat verts[][4] = { @@ -109,6 +109,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/lineloop-elts.c b/progs/trivial/lineloop-elts.c index 96da8e4ad6..ab944157c0 100644 --- a/progs/trivial/lineloop-elts.c +++ b/progs/trivial/lineloop-elts.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include GLfloat verts[][4] = { @@ -111,6 +111,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/long-fixed-func.c b/progs/trivial/long-fixed-func.c index 88f4fe01ec..41ad25c1b3 100644 --- a/progs/trivial/long-fixed-func.c +++ b/progs/trivial/long-fixed-func.c @@ -5,7 +5,7 @@ -#define GL_GLEXT_PROTOTYPES +#include #include #include #include @@ -142,6 +142,7 @@ main(int argc, char **argv) if (glutCreateWindow("tri-long-fixedfunc") == GL_FALSE) { exit(1); } + glewInit(); glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutDisplayFunc(Draw); diff --git a/progs/trivial/point-param.c b/progs/trivial/point-param.c index 96544a0525..1edeec3468 100644 --- a/progs/trivial/point-param.c +++ b/progs/trivial/point-param.c @@ -22,7 +22,7 @@ * OF THIS SOFTWARE. */ -#define GL_GLEXT_PROTOTYPES +#include #include #include #include @@ -146,6 +146,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/trivial/quad-tex-3d.c b/progs/trivial/quad-tex-3d.c index fd02d9d6ad..ca7ea91d2f 100644 --- a/progs/trivial/quad-tex-3d.c +++ b/progs/trivial/quad-tex-3d.c @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -167,6 +168,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/trivial/quad-tex-pbo.c b/progs/trivial/quad-tex-pbo.c index 5b63c698a7..c6f60f51fa 100644 --- a/progs/trivial/quad-tex-pbo.c +++ b/progs/trivial/quad-tex-pbo.c @@ -22,7 +22,7 @@ * OF THIS SOFTWARE. */ -#define GL_GLEXT_PROTOTYPES +#include #include #include @@ -171,6 +171,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/trivial/readpixels.c b/progs/trivial/readpixels.c index 783468ae2f..88aac2684a 100644 --- a/progs/trivial/readpixels.c +++ b/progs/trivial/readpixels.c @@ -3,7 +3,7 @@ */ -#define GL_GLEXT_PROTOTYPES +#include #include #include #include @@ -91,6 +91,8 @@ int main(int argc, char **argv) if (argc > 1) Zoom = atof(argv[1]); + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/trivial/tri-array-interleaved.c b/progs/trivial/tri-array-interleaved.c index e40e69266e..95de2056cf 100644 --- a/progs/trivial/tri-array-interleaved.c +++ b/progs/trivial/tri-array-interleaved.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include struct { @@ -110,6 +110,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/tri-blend-color.c b/progs/trivial/tri-blend-color.c index b9a539410b..d2d72d0b62 100644 --- a/progs/trivial/tri-blend-color.c +++ b/progs/trivial/tri-blend-color.c @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -131,6 +132,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/trivial/tri-blend-max.c b/progs/trivial/tri-blend-max.c index ebc241c1c1..b39f8f3f12 100644 --- a/progs/trivial/tri-blend-max.c +++ b/progs/trivial/tri-blend-max.c @@ -41,8 +41,9 @@ * to demonstrate the effect order has on alpha blending results. * Use the 't' key to toggle the order of drawing polygons. */ -#include #include +#include +#include static int leftFirst = GL_TRUE; @@ -136,6 +137,7 @@ int main(int argc, char** argv) glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutInitWindowSize (200, 200); glutCreateWindow (argv[0]); + glewInit(); init(); glutReshapeFunc (reshape); glutKeyboardFunc (keyboard); diff --git a/progs/trivial/tri-blend-min.c b/progs/trivial/tri-blend-min.c index 00b2dec705..656297c0ce 100644 --- a/progs/trivial/tri-blend-min.c +++ b/progs/trivial/tri-blend-min.c @@ -41,8 +41,9 @@ * to demonstrate the effect order has on alpha blending results. * Use the 't' key to toggle the order of drawing polygons. */ -#include #include +#include +#include static int leftFirst = GL_TRUE; @@ -136,6 +137,7 @@ int main(int argc, char** argv) glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutInitWindowSize (200, 200); glutCreateWindow (argv[0]); + glewInit(); init(); glutReshapeFunc (reshape); glutKeyboardFunc (keyboard); diff --git a/progs/trivial/tri-blend-revsub.c b/progs/trivial/tri-blend-revsub.c index be187fd4ce..fe225f1f4e 100644 --- a/progs/trivial/tri-blend-revsub.c +++ b/progs/trivial/tri-blend-revsub.c @@ -41,8 +41,9 @@ * to demonstrate the effect order has on alpha blending results. * Use the 't' key to toggle the order of drawing polygons. */ -#include #include +#include +#include static int leftFirst = GL_TRUE; @@ -136,6 +137,7 @@ int main(int argc, char** argv) glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutInitWindowSize (200, 200); glutCreateWindow (argv[0]); + glewInit(); init(); glutReshapeFunc (reshape); glutKeyboardFunc (keyboard); diff --git a/progs/trivial/tri-blend-sub.c b/progs/trivial/tri-blend-sub.c index d207791108..cc1aeaf4a4 100644 --- a/progs/trivial/tri-blend-sub.c +++ b/progs/trivial/tri-blend-sub.c @@ -41,8 +41,9 @@ * to demonstrate the effect order has on alpha blending results. * Use the 't' key to toggle the order of drawing polygons. */ -#include #include +#include +#include static int leftFirst = GL_TRUE; @@ -136,6 +137,7 @@ int main(int argc, char** argv) glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutInitWindowSize (200, 200); glutCreateWindow (argv[0]); + glewInit(); init(); glutReshapeFunc (reshape); glutKeyboardFunc (keyboard); diff --git a/progs/trivial/tri-fbo-tex.c b/progs/trivial/tri-fbo-tex.c index d413d4081f..253f9310db 100644 --- a/progs/trivial/tri-fbo-tex.c +++ b/progs/trivial/tri-fbo-tex.c @@ -9,7 +9,7 @@ */ -#define GL_GLEXT_PROTOTYPES +#include #include #include #include @@ -256,6 +256,7 @@ main(int argc, char *argv[]) glutInitWindowSize(Width, Height); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); Win = glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutDisplayFunc(Display); diff --git a/progs/trivial/tri-fbo.c b/progs/trivial/tri-fbo.c index 82d70c40b7..7a38f2124c 100644 --- a/progs/trivial/tri-fbo.c +++ b/progs/trivial/tri-fbo.c @@ -5,7 +5,7 @@ #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -190,6 +190,8 @@ main( int argc, char *argv[] ) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/trivial/tri-fp-const-imm.c b/progs/trivial/tri-fp-const-imm.c index 71113802ed..9e2c63a22a 100644 --- a/progs/trivial/tri-fp-const-imm.c +++ b/progs/trivial/tri-fp-const-imm.c @@ -25,7 +25,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -159,6 +159,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/trivial/tri-fp.c b/progs/trivial/tri-fp.c index 9ff355a4ca..fcf57f5a85 100644 --- a/progs/trivial/tri-fp.c +++ b/progs/trivial/tri-fp.c @@ -25,7 +25,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -157,6 +157,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/trivial/tri-query.c b/progs/trivial/tri-query.c index c9161c4f0a..25cfcb8e14 100644 --- a/progs/trivial/tri-query.c +++ b/progs/trivial/tri-query.c @@ -25,7 +25,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -148,6 +148,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/trivial/tri-tex-3d.c b/progs/trivial/tri-tex-3d.c index 613803fd1b..50f6a75418 100644 --- a/progs/trivial/tri-tex-3d.c +++ b/progs/trivial/tri-tex-3d.c @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -160,6 +161,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/trivial/vbo-drawarrays.c b/progs/trivial/vbo-drawarrays.c index fb590098a3..c29954b903 100644 --- a/progs/trivial/vbo-drawarrays.c +++ b/progs/trivial/vbo-drawarrays.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -124,6 +124,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/vbo-drawelements.c b/progs/trivial/vbo-drawelements.c index dddb45695c..b1b16d920b 100644 --- a/progs/trivial/vbo-drawelements.c +++ b/progs/trivial/vbo-drawelements.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include struct { @@ -128,6 +128,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/vbo-drawrange.c b/progs/trivial/vbo-drawrange.c index 407b7541f0..fa87eaf8fe 100644 --- a/progs/trivial/vbo-drawrange.c +++ b/progs/trivial/vbo-drawrange.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include #define ELTOBJ 0 @@ -136,6 +136,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/vp-array-int.c b/progs/trivial/vp-array-int.c index 4d60f2bd5f..2e1ac1374d 100644 --- a/progs/trivial/vp-array-int.c +++ b/progs/trivial/vp-array-int.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include GLint verts[][4] = { @@ -108,6 +108,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/vp-array.c b/progs/trivial/vp-array.c index abe8f62bec..852bf7d44d 100644 --- a/progs/trivial/vp-array.c +++ b/progs/trivial/vp-array.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include GLfloat verts[][4] = { @@ -108,6 +108,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/vp-clip.c b/progs/trivial/vp-clip.c index 206ba0b8cb..267b927b93 100644 --- a/progs/trivial/vp-clip.c +++ b/progs/trivial/vp-clip.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include static void Init( void ) @@ -93,6 +93,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/vp-line-clip.c b/progs/trivial/vp-line-clip.c index b2aaf17ca4..d27e4aae07 100644 --- a/progs/trivial/vp-line-clip.c +++ b/progs/trivial/vp-line-clip.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include static void Init( void ) @@ -107,6 +107,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/vp-tri-cb-pos.c b/progs/trivial/vp-tri-cb-pos.c index eb3aa0a8dc..430a4d3964 100644 --- a/progs/trivial/vp-tri-cb-pos.c +++ b/progs/trivial/vp-tri-cb-pos.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -146,11 +146,13 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutDisplayFunc(Draw); glutMainLoop(); - return 0; + return 0; } diff --git a/progs/trivial/vp-tri-cb-tex.c b/progs/trivial/vp-tri-cb-tex.c index 1e99d5b6ab..57fd2cdbbd 100644 --- a/progs/trivial/vp-tri-cb-tex.c +++ b/progs/trivial/vp-tri-cb-tex.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -179,6 +179,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/trivial/vp-tri-cb.c b/progs/trivial/vp-tri-cb.c index f9d0d7f559..1f12a2c297 100644 --- a/progs/trivial/vp-tri-cb.c +++ b/progs/trivial/vp-tri-cb.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include static void Init( void ) @@ -98,6 +98,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/vp-tri-imm.c b/progs/trivial/vp-tri-imm.c index c774573ba8..f2549f3697 100644 --- a/progs/trivial/vp-tri-imm.c +++ b/progs/trivial/vp-tri-imm.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include static void Init( void ) @@ -92,6 +92,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/vp-tri-swap.c b/progs/trivial/vp-tri-swap.c index e9ca1a0378..a3ab1206fd 100644 --- a/progs/trivial/vp-tri-swap.c +++ b/progs/trivial/vp-tri-swap.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include static void Init( void ) @@ -94,6 +94,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/vp-tri-tex.c b/progs/trivial/vp-tri-tex.c index 83ec1ef2e2..bd2b5e59f9 100644 --- a/progs/trivial/vp-tri-tex.c +++ b/progs/trivial/vp-tri-tex.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include static void Init( void ) @@ -128,6 +128,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/vp-tri.c b/progs/trivial/vp-tri.c index d2ef5043b2..2932977314 100644 --- a/progs/trivial/vp-tri.c +++ b/progs/trivial/vp-tri.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include static void Init( void ) @@ -95,6 +95,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); diff --git a/progs/trivial/vp-unfilled.c b/progs/trivial/vp-unfilled.c index ac23181fff..fe2de674ea 100644 --- a/progs/trivial/vp-unfilled.c +++ b/progs/trivial/vp-unfilled.c @@ -5,7 +5,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include static void Init( void ) @@ -95,6 +95,7 @@ int main( int argc, char *argv[] ) glutInitWindowSize( 250, 250 ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); glutCreateWindow(argv[0]); + glewInit(); glutReshapeFunc( Reshape ); glutKeyboardFunc( Key ); glutDisplayFunc( Display ); -- cgit v1.2.3