From 55c1894d0a03a76fcdaed61528ea7e5c74237e38 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 17 Dec 2007 13:21:45 -0500 Subject: Add the new test program for fp's. --- progs/fp/fp-tri.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 progs/fp/fp-tri.c (limited to 'progs/fp/fp-tri.c') diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c new file mode 100644 index 0000000000..cb991f803e --- /dev/null +++ b/progs/fp/fp-tri.c @@ -0,0 +1,169 @@ + +#include +#include +#include +#define GL_GLEXT_PROTOTYPES +#include +#include +#include + +unsigned show_fps = 0; +unsigned int frame_cnt = 0; +void alarmhandler(int); +static const char *filename = NULL; + +static void usage(char *name) +{ + fprintf(stderr, "usage: %s [ options ] shader_filename\n", name); + fprintf(stderr, "\n" ); + fprintf(stderr, "options:\n"); + fprintf(stderr, " -fps show frames per second\n"); +} + +void alarmhandler (int sig) +{ + if (sig == SIGALRM) { + printf("%d frames in 5.0 seconds = %.3f FPS\n", frame_cnt, + frame_cnt / 5.0); + + frame_cnt = 0; + } + signal(SIGALRM, alarmhandler); + alarm(5); +} + +static void args(int argc, char *argv[]) +{ + GLint i; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-fps") == 0) { + show_fps = 1; + } + else if (i == argc - 1) { + filename = argv[i]; + } + else { + usage(argv[0]); + exit(1); + } + } + + if (!filename) { + usage(argv[0]); + exit(1); + } +} + +static void Init( void ) +{ + GLint errno; + GLuint prognum; + char buf[4096]; + GLuint sz; + FILE *f; + + if ((f = fopen(filename, "r")) == NULL) { + fprintf(stderr, "Couldn't open %s\n", filename); + exit(1); + } + + sz = fread(buf, 1, sizeof(buf), f); + if (!feof(f)) { + fprintf(stderr, "file too long\n"); + exit(1); + } + fprintf(stderr, "%.*s\n", sz, buf); + + if (!glutExtensionSupported("GL_ARB_fragment_program")) { + printf("Error: GL_ARB_fragment_program not supported!\n"); + exit(1); + } + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + + /* Setup the fragment program */ + glGenProgramsARB(1, &prognum); + glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prognum); + glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + sz, (const GLubyte *)buf); + + errno = glGetError(); + printf("glGetError = 0x%x\n", errno); + if (errno != GL_NO_ERROR) { + GLint errorpos; + + glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); + printf("errorpos: %d\n", errorpos); + printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", + (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); + } + glEnable(GL_FRAGMENT_PROGRAM_ARB); + + glClearColor(.3, .3, .3, 0); +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + default: + return; + } + + glutPostRedisplay(); +} + +static void Display(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + + glBegin(GL_TRIANGLES); + glColor3f(0,0,1); + glVertex3f( 0.9, -0.9, -30.0); + glColor3f(1,0,0); + glVertex3f( 0.9, 0.9, -30.0); + glColor3f(0,1,0); + glVertex3f(-0.9, 0.0, -30.0); + glEnd(); + + glFlush(); + + if (show_fps) { + ++frame_cnt; + glutPostRedisplay(); + } +} + + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + glutInitWindowPosition(0, 0); + glutInitWindowSize(250, 250); + glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH); + glutCreateWindow(argv[0]); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Display); + args(argc, argv); + Init(); + if (show_fps) { + signal(SIGALRM, alarmhandler); + alarm(5); + } + glutMainLoop(); + return 0; +} -- cgit v1.2.3 From 1f135456795adfb1d739a6fb66ab9540aa79b461 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 12 Sep 2008 10:28:36 +0100 Subject: fp: put test name in window title, add run script --- progs/fp/fp-tri.c | 4 ++-- progs/fp/run.sh | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100755 progs/fp/run.sh (limited to 'progs/fp/fp-tri.c') diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c index cb991f803e..c07cfa2076 100644 --- a/progs/fp/fp-tri.c +++ b/progs/fp/fp-tri.c @@ -154,11 +154,11 @@ int main(int argc, char **argv) glutInitWindowPosition(0, 0); glutInitWindowSize(250, 250); glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH); - glutCreateWindow(argv[0]); + args(argc, argv); + glutCreateWindow(filename); glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutDisplayFunc(Display); - args(argc, argv); Init(); if (show_fps) { signal(SIGALRM, alarmhandler); diff --git a/progs/fp/run.sh b/progs/fp/run.sh new file mode 100755 index 0000000000..480f8108a3 --- /dev/null +++ b/progs/fp/run.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +for i in *.txt ; do +echo $i +./fp-tri $i +done + -- cgit v1.2.3 From fa7529335c38d4c139e5b1fc17a518f7e5fa1d82 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 18 Sep 2008 14:14:56 +0200 Subject: progs/fp: Add a bit of local variable testing to fp-tri --- progs/fp/fp-tri.c | 2 ++ progs/fp/local.txt | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 progs/fp/local.txt (limited to 'progs/fp/fp-tri.c') diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c index cb991f803e..2512e824ee 100644 --- a/progs/fp/fp-tri.c +++ b/progs/fp/fp-tri.c @@ -130,6 +130,8 @@ static void Display(void) { glClear(GL_COLOR_BUFFER_BIT); + glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, 1.0, 1.0, 0.0, 0.0); + glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, 0.0, 0.0, 1.0, 1.0); glBegin(GL_TRIANGLES); glColor3f(0,0,1); glVertex3f( 0.9, -0.9, -30.0); diff --git a/progs/fp/local.txt b/progs/fp/local.txt new file mode 100644 index 0000000000..6cb2a2f13c --- /dev/null +++ b/progs/fp/local.txt @@ -0,0 +1,11 @@ +!!ARBfp1.0 +TEMP R0; +PARAM c[4] = { { 0, 0, 0, 0 }, + program.local[0..1], + { 1, 1, 1, 1 } }; +MOV R0, c[1]; +SUB R0, R0, c[0]; +ADD R0, R0, c[2]; +MUL R0, R0, c[3]; +MOV result.color, R0; +END -- cgit v1.2.3 From 96c773c77bf50140e7380d1358fd4528241719e8 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 14 Feb 2009 01:05:13 +0100 Subject: progs: Make fp-tri use glew and add scons target --- progs/SConscript | 1 + progs/fp/Makefile | 2 +- progs/fp/SConscript | 13 +++++++++++++ progs/fp/fp-tri.c | 16 +++++++++++++--- 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 progs/fp/SConscript (limited to 'progs/fp/fp-tri.c') diff --git a/progs/SConscript b/progs/SConscript index 6484c761fc..544ea64750 100644 --- a/progs/SConscript +++ b/progs/SConscript @@ -5,4 +5,5 @@ SConscript([ 'samples/SConscript', 'trivial/SConscript', 'vp/SConscript', + 'fp/SConscript', ]) diff --git a/progs/fp/Makefile b/progs/fp/Makefile index ef6644cce2..681928cf26 100755 --- a/progs/fp/Makefile +++ b/progs/fp/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$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) SOURCES = \ tri-tex.c \ diff --git a/progs/fp/SConscript b/progs/fp/SConscript new file mode 100644 index 0000000000..e31fa32023 --- /dev/null +++ b/progs/fp/SConscript @@ -0,0 +1,13 @@ +Import('env') + +if not env['GLUT']: + Return() + +env = env.Clone() + +env.Prepend(LIBS = ['$GLUT_LIB']) + +env.Program( + target = 'fp-tri', + source = ['fp-tri.c'], + ) diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c index 843f897871..b695901bcd 100644 --- a/progs/fp/fp-tri.c +++ b/progs/fp/fp-tri.c @@ -2,10 +2,14 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES -#include + +#ifndef WIN32 #include #include +#endif + +#include +#include unsigned show_fps = 0; unsigned int frame_cnt = 0; @@ -15,11 +19,14 @@ static const char *filename = NULL; static void usage(char *name) { fprintf(stderr, "usage: %s [ options ] shader_filename\n", name); +#ifndef WIN32 fprintf(stderr, "\n" ); fprintf(stderr, "options:\n"); fprintf(stderr, " -fps show frames per second\n"); +#endif } +#ifndef WIN32 void alarmhandler (int sig) { if (sig == SIGALRM) { @@ -31,6 +38,7 @@ void alarmhandler (int sig) signal(SIGALRM, alarmhandler); alarm(5); } +#endif static void args(int argc, char *argv[]) { @@ -142,7 +150,6 @@ static void Display(void) glEnd(); glFlush(); - if (show_fps) { ++frame_cnt; glutPostRedisplay(); @@ -158,14 +165,17 @@ int main(int argc, char **argv) glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH); args(argc, argv); glutCreateWindow(filename); + glewInit(); glutReshapeFunc(Reshape); glutKeyboardFunc(Key); glutDisplayFunc(Display); Init(); +#ifndef WIN32 if (show_fps) { signal(SIGALRM, alarmhandler); alarm(5); } +#endif glutMainLoop(); return 0; } -- cgit v1.2.3 From 185ff38895cfc1376f21d892b122235ed0563922 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 6 Mar 2009 21:15:19 +0000 Subject: fp: add some more texture, position and kill tests --- progs/fp/fp-tri.c | 20 +++++++++++++++++++- progs/fp/tex-pos-kil.txt | 8 ++++++++ progs/fp/tex-pos.txt | 6 ++++++ progs/fp/tex.txt | 3 +++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 progs/fp/tex-pos-kil.txt create mode 100644 progs/fp/tex-pos.txt create mode 100644 progs/fp/tex.txt (limited to 'progs/fp/fp-tri.c') diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c index b695901bcd..1598739c57 100644 --- a/progs/fp/fp-tri.c +++ b/progs/fp/fp-tri.c @@ -11,6 +11,11 @@ #include #include +#include "readtex.c" + + +#define TEXTURE_FILE "../images/bw.rgb" + unsigned show_fps = 0; unsigned int frame_cnt = 0; void alarmhandler(int); @@ -65,6 +70,7 @@ static void args(int argc, char *argv[]) static void Init( void ) { + GLuint Texture; GLint errno; GLuint prognum; char buf[4096]; @@ -107,7 +113,19 @@ static void Init( void ) } glEnable(GL_FRAGMENT_PROGRAM_ARB); - glClearColor(.3, .3, .3, 0); + + /* Load texture */ + glGenTextures(1, &Texture); + glBindTexture(GL_TEXTURE_2D, Texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) { + printf("Error: couldn't load texture image file %s\n", TEXTURE_FILE); + exit(1); + } + + glClearColor(.1, .3, .5, 0); } static void Reshape(int width, int height) diff --git a/progs/fp/tex-pos-kil.txt b/progs/fp/tex-pos-kil.txt new file mode 100644 index 0000000000..b7aaa9f7c8 --- /dev/null +++ b/progs/fp/tex-pos-kil.txt @@ -0,0 +1,8 @@ +!!ARBfp1.0 +TEMP R0; +MUL R0, fragment.position, {0.008}.x; +TEX R0, R0, texture[0], 2D; +SUB R0, R0, {0.25}.x; +KIL R0.xyzz; +MOV result.color, fragment.color; +END diff --git a/progs/fp/tex-pos.txt b/progs/fp/tex-pos.txt new file mode 100644 index 0000000000..b969f423f5 --- /dev/null +++ b/progs/fp/tex-pos.txt @@ -0,0 +1,6 @@ +!!ARBfp1.0 +TEMP R0; +MOV R0, {0.0}.x; +MUL R0.xy, fragment.position, {0.008}.x; +TEX result.color, R0, texture[0], 2D; +END diff --git a/progs/fp/tex.txt b/progs/fp/tex.txt new file mode 100644 index 0000000000..b3a885d9e0 --- /dev/null +++ b/progs/fp/tex.txt @@ -0,0 +1,3 @@ +!!ARBfp1.0 +TEX result.color, fragment.color, texture[0], 2D; +END -- cgit v1.2.3 From fb8a9875f6af28964a56e8307dd90a0b5fe97a4b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 9 Mar 2009 14:08:35 +0000 Subject: fp: enable a second texture unit and add a kil test for it --- progs/fp/fp-tri.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++ progs/fp/tex-pos-kil-1.txt | 7 +++++++ 2 files changed, 58 insertions(+) create mode 100644 progs/fp/tex-pos-kil-1.txt (limited to 'progs/fp/fp-tri.c') diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c index 1598739c57..bc490c0520 100644 --- a/progs/fp/fp-tri.c +++ b/progs/fp/fp-tri.c @@ -125,6 +125,57 @@ static void Init( void ) exit(1); } + + glGenTextures(1, &Texture); + glActiveTextureARB(GL_TEXTURE0_ARB + 1); + glBindTexture(GL_TEXTURE_2D, Texture); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + { + GLubyte data[32][32]; + int width = 32; + int height = 32; + int i; + int j; + + for (i = 0; i < 32; i++) + for (j = 0; j < 32; j++) + { + /** + ** +-----------+ + ** | W | + ** | +-----+ | + ** | | | | + ** | | B | | + ** | | | | + ** | +-----+ | + ** | | + ** +-----------+ + **/ + int i2 = i - height / 2; + int j2 = j - width / 2; + int h8 = height / 8; + int w8 = width / 8; + if ( -h8 <= i2 && i2 <= h8 && -w8 <= j2 && j2 <= w8 ) { + data[i][j] = 0x00; + } else if ( -2 * h8 <= i2 && i2 <= 2 * h8 && -2 * w8 <= j2 && j2 <= 2 * w8 ) { + data[i][j] = 0x55; + } else if ( -3 * h8 <= i2 && i2 <= 3 * h8 && -3 * w8 <= j2 && j2 <= 3 * w8 ) { + data[i][j] = 0xaa; + } else { + data[i][j] = 0xff; + } + } + + glTexImage2D( GL_TEXTURE_2D, 0, + GL_ALPHA8, + 32, 32, 0, + GL_ALPHA, GL_UNSIGNED_BYTE, data ); + } + + glClearColor(.1, .3, .5, 0); } diff --git a/progs/fp/tex-pos-kil-1.txt b/progs/fp/tex-pos-kil-1.txt new file mode 100644 index 0000000000..3f01e79ffe --- /dev/null +++ b/progs/fp/tex-pos-kil-1.txt @@ -0,0 +1,7 @@ +!!ARBfp1.0 +TEMP R0; +MUL R0, fragment.position, {0.03125}.x; +TEX R0, R0, texture[1], 2D; +KIL -R0; +MOV result.color, fragment.color; +END -- cgit v1.2.3 From 103a4bd71136b14424a4af5a2eadf56c51692115 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 23 Mar 2009 18:37:33 +0000 Subject: progs/fp: pass texcoord to triangle, add a test shader --- progs/fp/fp-tri.c | 6 ++++++ progs/fp/kil-pos.txt | 9 +++++++++ progs/fp/kil-texcoord-sgt.txt | 8 ++++++++ progs/fp/kill-pos.txt | 9 --------- 4 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 progs/fp/kil-pos.txt create mode 100644 progs/fp/kil-texcoord-sgt.txt delete mode 100644 progs/fp/kill-pos.txt (limited to 'progs/fp/fp-tri.c') diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c index bc490c0520..6c15540d38 100644 --- a/progs/fp/fp-tri.c +++ b/progs/fp/fp-tri.c @@ -210,11 +210,17 @@ static void Display(void) glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, 1.0, 1.0, 0.0, 0.0); glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, 0.0, 0.0, 1.0, 1.0); glBegin(GL_TRIANGLES); + glColor3f(0,0,1); + glTexCoord3f(1,1,0); glVertex3f( 0.9, -0.9, -30.0); + glColor3f(1,0,0); + glTexCoord3f(1,-1,0); glVertex3f( 0.9, 0.9, -30.0); + glColor3f(0,1,0); + glTexCoord3f(-1,0,0); glVertex3f(-0.9, 0.0, -30.0); glEnd(); diff --git a/progs/fp/kil-pos.txt b/progs/fp/kil-pos.txt new file mode 100644 index 0000000000..5ff4f6f2c8 --- /dev/null +++ b/progs/fp/kil-pos.txt @@ -0,0 +1,9 @@ +!!ARBfp1.0 +TEMP R0; +SUB R0.xy, fragment.position, {125}.x; +MOV R0.zw, {0}.x; +DP3 R0, R0, R0; +SUB R0.x, R0, {10000}.x; +KIL -R0.x; +MOV result.color, fragment.color; +END diff --git a/progs/fp/kil-texcoord-sgt.txt b/progs/fp/kil-texcoord-sgt.txt new file mode 100644 index 0000000000..c74fd10dac --- /dev/null +++ b/progs/fp/kil-texcoord-sgt.txt @@ -0,0 +1,8 @@ +!!ARBfp1.0 +TEMP R0; +MUL R0.xy, fragment.texcoord[0], fragment.texcoord[0]; +ADD R0.x, R0.x, R0.y; +SGE R0.y, R0.x, fragment.texcoord[0].w; +KIL -R0.y; +MOV result.color, fragment.color; +END diff --git a/progs/fp/kill-pos.txt b/progs/fp/kill-pos.txt deleted file mode 100644 index 5ff4f6f2c8..0000000000 --- a/progs/fp/kill-pos.txt +++ /dev/null @@ -1,9 +0,0 @@ -!!ARBfp1.0 -TEMP R0; -SUB R0.xy, fragment.position, {125}.x; -MOV R0.zw, {0}.x; -DP3 R0, R0, R0; -SUB R0.x, R0, {10000}.x; -KIL -R0.x; -MOV result.color, fragment.color; -END -- cgit v1.2.3 From e3f14f2f3bdd66400d02f0f9076593db609874a8 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 11 Jun 2009 13:19:34 +0100 Subject: progs: Port fp programs to GLEW. --- progs/fp/SConscript | 19 ++++++++++++++++--- progs/fp/fp-tri.c | 2 +- progs/fp/point-position.c | 7 ++++--- progs/fp/tri-depth.c | 9 ++++----- progs/fp/tri-depth2.c | 7 ++++--- progs/fp/tri-depthwrite.c | 6 ++++-- progs/fp/tri-depthwrite2.c | 6 ++++-- progs/fp/tri-inv.c | 6 ++++-- progs/fp/tri-param.c | 8 +++++--- progs/fp/tri-tex.c | 6 ++++-- 10 files changed, 50 insertions(+), 26 deletions(-) (limited to 'progs/fp/fp-tri.c') diff --git a/progs/fp/SConscript b/progs/fp/SConscript index 553799758b..a78318542c 100644 --- a/progs/fp/SConscript +++ b/progs/fp/SConscript @@ -11,7 +11,20 @@ env.Prepend(CPPPATH = [ env.Prepend(LIBS = ['$GLUT_LIB']) -env.Program( - target = 'fp-tri', - source = ['fp-tri.c'], +progs = [ + 'fp-tri', + 'tri-depth', + 'tri-depth2', + 'tri-depthwrite', + 'tri-depthwrite2', + 'tri-inv', + 'tri-param', + 'tri-tex', + 'point-position', +] + +for prog in progs: + env.Program( + target = prog, + source = [prog + '.c'], ) diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c index 6c15540d38..52a8fcfc22 100644 --- a/progs/fp/fp-tri.c +++ b/progs/fp/fp-tri.c @@ -89,7 +89,7 @@ static void Init( void ) } fprintf(stderr, "%.*s\n", sz, buf); - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } diff --git a/progs/fp/point-position.c b/progs/fp/point-position.c index c352a939cb..c0963d7a0b 100644 --- a/progs/fp/point-position.c +++ b/progs/fp/point-position.c @@ -2,9 +2,8 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include -#include "GL/gl.h" @@ -17,7 +16,7 @@ static void Init( void ) ; GLuint modulateProg; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -109,6 +108,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/fp/tri-depth.c b/progs/fp/tri-depth.c index a1f0579c8e..5488469e80 100644 --- a/progs/fp/tri-depth.c +++ b/progs/fp/tri-depth.c @@ -2,9 +2,8 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include -#include "GL/gl.h" @@ -19,7 +18,7 @@ static void Init( void ) ; GLuint modulateProg; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -89,8 +88,6 @@ int main(int argc, char **argv) glutInit(&argc, argv); - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); type = GLUT_RGB; @@ -101,6 +98,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/fp/tri-depth2.c b/progs/fp/tri-depth2.c index f309628283..6ed2307115 100644 --- a/progs/fp/tri-depth2.c +++ b/progs/fp/tri-depth2.c @@ -2,9 +2,8 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include -#include "GL/gl.h" @@ -21,7 +20,7 @@ static void Init( void ) ; GLuint modulateProg; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -106,6 +105,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/fp/tri-depthwrite.c b/progs/fp/tri-depthwrite.c index fedeec4577..8e4f3e6245 100644 --- a/progs/fp/tri-depthwrite.c +++ b/progs/fp/tri-depthwrite.c @@ -2,7 +2,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -16,7 +16,7 @@ static void Init(void) ; GLuint modulateProg; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -97,6 +97,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/fp/tri-depthwrite2.c b/progs/fp/tri-depthwrite2.c index 5547092ec9..3c0b4d30c9 100644 --- a/progs/fp/tri-depthwrite2.c +++ b/progs/fp/tri-depthwrite2.c @@ -2,7 +2,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -16,7 +16,7 @@ static void Init(void) ; GLuint modulateProg; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -97,6 +97,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/fp/tri-inv.c b/progs/fp/tri-inv.c index e902332386..7e8d8c5ce2 100644 --- a/progs/fp/tri-inv.c +++ b/progs/fp/tri-inv.c @@ -2,7 +2,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include @@ -17,7 +17,7 @@ static void Init( void ) ; GLuint modulateProg; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -99,6 +99,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/fp/tri-param.c b/progs/fp/tri-param.c index f3e55af3f1..57443d71bd 100644 --- a/progs/fp/tri-param.c +++ b/progs/fp/tri-param.c @@ -2,9 +2,9 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include -#include "GL/gl.h" + static void Init( void ) { @@ -15,7 +15,7 @@ static void Init( void ) ; GLuint modulateProg; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -104,6 +104,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); diff --git a/progs/fp/tri-tex.c b/progs/fp/tri-tex.c index 87f63894ce..1dbbb201ce 100644 --- a/progs/fp/tri-tex.c +++ b/progs/fp/tri-tex.c @@ -3,7 +3,7 @@ #include #include #include -#define GL_GLEXT_PROTOTYPES +#include #include #include "readtex.c" @@ -23,7 +23,7 @@ static void Init( void ) GLuint modulateProg; GLuint Texture; - if (!glutExtensionSupported("GL_ARB_fragment_program")) { + if (!GLEW_ARB_fragment_program) { printf("Error: GL_ARB_fragment_program not supported!\n"); exit(1); } @@ -120,6 +120,8 @@ int main(int argc, char **argv) exit(1); } + glewInit(); + Init(); glutReshapeFunc(Reshape); -- cgit v1.2.3