From b1399a5dd20fad801ee10383143439f8cf4615db Mon Sep 17 00:00:00 2001 From: Keith Whitwell <keith@tungstengraphics.com> Date: Sun, 25 Nov 2007 15:06:54 +0000 Subject: gallium: more trivial tests --- progs/trivial/clear-fbo-tex.c | 220 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) create mode 100644 progs/trivial/clear-fbo-tex.c (limited to 'progs/trivial/clear-fbo-tex.c') diff --git a/progs/trivial/clear-fbo-tex.c b/progs/trivial/clear-fbo-tex.c new file mode 100644 index 00000000000..68f1ab3d77e --- /dev/null +++ b/progs/trivial/clear-fbo-tex.c @@ -0,0 +1,220 @@ + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <string.h> + +#define GL_GLEXT_PROTOTYPES +#include <GL/glut.h> + + + +static GLenum TexTarget = GL_TEXTURE_2D; +static int TexWidth = 512, TexHeight = 512; +static GLenum TexIntFormat = GL_RGBA; /* either GL_RGB or GL_RGBA */ + +static int Width = 512, Height = 512; +static GLuint MyFB, TexObj; + + +#define CheckError() assert(glGetError() == 0) + +GLenum doubleBuffer; + +static void Init(void) +{ + fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + + + if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { + printf("GL_EXT_framebuffer_object not found!\n"); + exit(0); + } + + + glGenFramebuffersEXT(1, &MyFB); + glGenTextures(1, &TexObj); + + /* Make texture object/image */ + 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, 0); + glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, 0); + + glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + + + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + + + + { + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); + + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + TexTarget, TexObj, 0); + + + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + } + +} + + + +static void +Reshape( int width, int height ) +{ + glViewport( 0, 0, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode( GL_MODELVIEW ); + + Width = width; + Height = height; +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + default: + return; + } + + glutPostRedisplay(); +} + + + +static void Draw( void ) +{ + + + /* draw to texture image */ + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); +// glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); +// glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); + + + glViewport(0, 0, TexWidth, TexHeight); + CheckError(); + + glClearColor(0.5, 0.5, 1.0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + CheckError(); + + if (0) { + glBegin(GL_TRIANGLES); + glColor3f(0,0,.7); + glVertex3f( 0.9, -0.9, -30.0); + glColor3f(.8,0,0); + glVertex3f( 0.9, 0.9, -30.0); + glColor3f(0,.9,0); + glVertex3f(-0.9, 0.0, -30.0); + glEnd(); + } + + { + GLubyte *buffer = malloc(Width * Height * 4); + + /* read from user framebuffer */ + glReadPixels(0, 0, Width-60, Height-60, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + CheckError(); + + /* draw to window */ + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + glViewport(0, 0, Width, Height); + + /* Try to clear the window, but will overwrite: + */ + glClearColor(0.8, 0.8, 0, 0.0); + glClear(GL_COLOR_BUFFER_BIT); + + glWindowPos2iARB(30, 30); + glDrawPixels(Width-60, Height-60, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + + free(buffer); + } + + /* Bind normal framebuffer */ + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + glViewport(0, 0, Width, Height); + + if (0) { + glBegin(GL_TRIANGLES); + glColor3f(0,.7,0); + glVertex3f( 0.5, -0.5, -30.0); + glColor3f(0,0,.8); + glVertex3f( 0.5, 0.5, -30.0); + glColor3f(.9,0,0); + glVertex3f(-0.5, 0.0, -30.0); + glEnd(); + } + + if (doubleBuffer) { + glutSwapBuffers(); + } + + CheckError(); +} + + +static GLenum Args(int argc, char **argv) +{ + GLint i; + + doubleBuffer = GL_FALSE; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-sb") == 0) { + doubleBuffer = GL_FALSE; + } else if (strcmp(argv[i], "-db") == 0) { + doubleBuffer = GL_TRUE; + } else { + fprintf(stderr, "%s (Bad option).\n", argv[i]); + return GL_FALSE; + } + } + return GL_TRUE; +} + + + +int +main( int argc, char *argv[] ) +{ + GLenum type; + + glutInit(&argc, argv); + + if (Args(argc, argv) == GL_FALSE) { + exit(1); + } + + glutInitWindowPosition(100, 0); glutInitWindowSize( Width, Height ); + + type = GLUT_RGB; + type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; + glutInitDisplayMode(type); + + if (glutCreateWindow(argv[0]) == GL_FALSE) { + exit(1); + } + + Init(); + + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From 479ea7d87b6d283cd74d345cb618d69a889284d9 Mon Sep 17 00:00:00 2001 From: José Fonseca <jfonseca@vmware.com> 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/clear-fbo-tex.c') diff --git a/progs/SConstruct b/progs/SConstruct index ac5314fac57..bce48f72ff1 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 2c158c8d49a..dce96f6bc8c 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 68f1ab3d77e..eccfde5ae63 100644 --- a/progs/trivial/clear-fbo-tex.c +++ b/progs/trivial/clear-fbo-tex.c @@ -5,7 +5,7 @@ #include <math.h> #include <string.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> @@ -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 82218ed4985..64b25430c66 100644 --- a/progs/trivial/clear-fbo.c +++ b/progs/trivial/clear-fbo.c @@ -5,7 +5,7 @@ #include <math.h> #include <string.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> @@ -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 596eee9eef1..27d86682f75 100644 --- a/progs/trivial/drawarrays.c +++ b/progs/trivial/drawarrays.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> @@ -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 e0c8e80b68c..4c115030afc 100644 --- a/progs/trivial/drawelements.c +++ b/progs/trivial/drawelements.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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 9c787cbfcde..e9ea99b5376 100644 --- a/progs/trivial/drawrange.c +++ b/progs/trivial/drawrange.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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 96da8e4ad6b..ab944157c01 100644 --- a/progs/trivial/lineloop-elts.c +++ b/progs/trivial/lineloop-elts.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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 88f4fe01ec8..41ad25c1b3d 100644 --- a/progs/trivial/long-fixed-func.c +++ b/progs/trivial/long-fixed-func.c @@ -5,7 +5,7 @@ -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -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 96544a05255..1edeec3468a 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 <GL/glew.h> #include <math.h> #include <stdio.h> #include <string.h> @@ -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 fd02d9d6adc..ca7ea91d2f3 100644 --- a/progs/trivial/quad-tex-3d.c +++ b/progs/trivial/quad-tex-3d.c @@ -25,6 +25,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <GL/glew.h> #include <GL/glut.h> @@ -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 5b63c698a7e..c6f60f51fa6 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 <GL/glew.h> #include <stdio.h> #include <string.h> @@ -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 783468ae2f6..88aac2684a8 100644 --- a/progs/trivial/readpixels.c +++ b/progs/trivial/readpixels.c @@ -3,7 +3,7 @@ */ -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -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 e40e69266e8..95de2056cf1 100644 --- a/progs/trivial/tri-array-interleaved.c +++ b/progs/trivial/tri-array-interleaved.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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 b9a539410bc..d2d72d0b62f 100644 --- a/progs/trivial/tri-blend-color.c +++ b/progs/trivial/tri-blend-color.c @@ -25,6 +25,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <GL/glew.h> #include <GL/glut.h> @@ -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 ebc241c1c16..b39f8f3f12a 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 <GL/glut.h> #include <stdlib.h> +#include <GL/glew.h> +#include <GL/glut.h> 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 00b2dec7056..656297c0ce0 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 <GL/glut.h> #include <stdlib.h> +#include <GL/glew.h> +#include <GL/glut.h> 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 be187fd4cee..fe225f1f4e0 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 <GL/glut.h> #include <stdlib.h> +#include <GL/glew.h> +#include <GL/glut.h> 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 d207791108c..cc1aeaf4a48 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 <GL/glut.h> #include <stdlib.h> +#include <GL/glew.h> +#include <GL/glut.h> 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 d413d4081f1..253f9310db4 100644 --- a/progs/trivial/tri-fbo-tex.c +++ b/progs/trivial/tri-fbo-tex.c @@ -9,7 +9,7 @@ */ -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> #include <assert.h> #include <stdio.h> @@ -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 82d70c40b7e..7a38f2124cc 100644 --- a/progs/trivial/tri-fbo.c +++ b/progs/trivial/tri-fbo.c @@ -5,7 +5,7 @@ #include <math.h> #include <string.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> @@ -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 71113802ed1..9e2c63a22af 100644 --- a/progs/trivial/tri-fp-const-imm.c +++ b/progs/trivial/tri-fp-const-imm.c @@ -25,7 +25,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> @@ -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 9ff355a4caf..fcf57f5a85f 100644 --- a/progs/trivial/tri-fp.c +++ b/progs/trivial/tri-fp.c @@ -25,7 +25,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> @@ -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 c9161c4f0ad..25cfcb8e148 100644 --- a/progs/trivial/tri-query.c +++ b/progs/trivial/tri-query.c @@ -25,7 +25,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> @@ -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 613803fd1b1..50f6a754189 100644 --- a/progs/trivial/tri-tex-3d.c +++ b/progs/trivial/tri-tex-3d.c @@ -25,6 +25,7 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <GL/glew.h> #include <GL/glut.h> @@ -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 fb590098a32..c29954b9033 100644 --- a/progs/trivial/vbo-drawarrays.c +++ b/progs/trivial/vbo-drawarrays.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> @@ -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 dddb45695cb..b1b16d920b9 100644 --- a/progs/trivial/vbo-drawelements.c +++ b/progs/trivial/vbo-drawelements.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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 407b7541f07..fa87eaf8fe5 100644 --- a/progs/trivial/vbo-drawrange.c +++ b/progs/trivial/vbo-drawrange.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> #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 4d60f2bd5f5..2e1ac1374d7 100644 --- a/progs/trivial/vp-array-int.c +++ b/progs/trivial/vp-array-int.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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 abe8f62bec3..852bf7d44d7 100644 --- a/progs/trivial/vp-array.c +++ b/progs/trivial/vp-array.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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 206ba0b8cb8..267b927b93f 100644 --- a/progs/trivial/vp-clip.c +++ b/progs/trivial/vp-clip.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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 b2aaf17ca4f..d27e4aae079 100644 --- a/progs/trivial/vp-line-clip.c +++ b/progs/trivial/vp-line-clip.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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 eb3aa0a8dc6..430a4d3964c 100644 --- a/progs/trivial/vp-tri-cb-pos.c +++ b/progs/trivial/vp-tri-cb-pos.c @@ -5,7 +5,7 @@ #include <string.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> @@ -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 1e99d5b6abc..57fd2cdbbd1 100644 --- a/progs/trivial/vp-tri-cb-tex.c +++ b/progs/trivial/vp-tri-cb-tex.c @@ -5,7 +5,7 @@ #include <string.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> @@ -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 f9d0d7f559d..1f12a2c297a 100644 --- a/progs/trivial/vp-tri-cb.c +++ b/progs/trivial/vp-tri-cb.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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 c774573ba8b..f2549f3697f 100644 --- a/progs/trivial/vp-tri-imm.c +++ b/progs/trivial/vp-tri-imm.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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 e9ca1a03789..a3ab1206fdf 100644 --- a/progs/trivial/vp-tri-swap.c +++ b/progs/trivial/vp-tri-swap.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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 83ec1ef2e2f..bd2b5e59f9d 100644 --- a/progs/trivial/vp-tri-tex.c +++ b/progs/trivial/vp-tri-tex.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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 d2ef5043b22..29329773143 100644 --- a/progs/trivial/vp-tri.c +++ b/progs/trivial/vp-tri.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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 ac23181fff7..fe2de674ea3 100644 --- a/progs/trivial/vp-unfilled.c +++ b/progs/trivial/vp-unfilled.c @@ -5,7 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> 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