diff options
author | Chia-I Wu <olvaffe@gmail.com> | 2009-09-15 14:16:22 +0800 |
---|---|---|
committer | Chia-I Wu <olvaffe@gmail.com> | 2009-09-15 14:16:22 +0800 |
commit | e2ba90a9cc762cf00a168f0a59d31e7dc52fc42e (patch) | |
tree | fe3206d7602ad935296884742980f3c4d30bd867 /progs/fp | |
parent | 11a4292d4eb515813b82b8d688a318adef66b3e6 (diff) | |
parent | b4b8800315637d9218a81c76f09df7d601710d29 (diff) |
Merge commit 'eee/mesa-es' into android
Diffstat (limited to 'progs/fp')
91 files changed, 556 insertions, 3788 deletions
diff --git a/progs/fp/.gitignore b/progs/fp/.gitignore index b265f1fed7..aa51f76c9b 100644 --- a/progs/fp/.gitignore +++ b/progs/fp/.gitignore @@ -40,3 +40,4 @@ tri-swz tri-swz2 tri-tex tri-xpd +fp-tri diff --git a/progs/fp/Makefile b/progs/fp/Makefile index 3e52474777..681928cf26 100644..100755 --- a/progs/fp/Makefile +++ b/progs/fp/Makefile @@ -8,49 +8,17 @@ 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-abs.c \ - tri-add.c \ - tri-cmp.c \ - tri-cos.c \ - tri-dp3.c \ - tri-dp4.c \ - tri-dph.c \ - tri-dst.c \ - tri-ex2.c \ - tri-flr.c \ - tri-frc.c \ - tri-kil.c \ - tri-lg2.c \ - tri-lit.c \ - tri-lrp.c \ - tri-mad.c \ - tri-max.c \ - tri-min.c \ - tri-mov.c \ - tri-mul.c \ - tri-pow.c \ - tri-param.c \ - tri-rcp.c \ - tri-rsq.c \ - tri-scs.c \ - tri-sge.c \ - tri-sge2.c \ - tri-sin.c \ - tri-slt.c \ - tri-sub.c \ - tri-swz.c \ - tri-swz2.c \ tri-tex.c \ - tri-xpd.c \ - tri-position.c \ point-position.c \ tri-depth.c \ tri-depth2.c \ tri-depthwrite.c \ tri-depthwrite2.c \ + tri-param.c \ + fp-tri.c NOTDONE=\ tri-txb.c \ @@ -72,13 +40,13 @@ UTIL_FILES = readtex.h readtex.c .SUFFIXES: .c .c: - $(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ + $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ .c.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ .S.o: - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ ##### TARGETS ##### @@ -100,18 +68,20 @@ getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress. texrect: texrect.o readtex.o $(CC) $(CFLAGS) $(LDFLAGS) texrect.o readtex.o $(LIBS) -o $@ +# $(APP_CC) texrect.o readtex.o $(LIBS) -o $@ texrect.o: texrect.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ invert: invert.o readtex.o $(CC) $(CFLAGS) $(LDFLAGS) invert.o readtex.o $(LIBS) -o $@ +# $(APP_CC) invert.o readtex.o $(LIBS) -o $@ invert.o: invert.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ readtex.o: readtex.c - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ readtex.h: $(TOP)/progs/util/readtex.h diff --git a/progs/fp/SConscript b/progs/fp/SConscript new file mode 100644 index 0000000000..a78318542c --- /dev/null +++ b/progs/fp/SConscript @@ -0,0 +1,30 @@ +Import('env') + +if not env['GLUT']: + Return() + +env = env.Clone() + +env.Prepend(CPPPATH = [ + '../util', +]) + +env.Prepend(LIBS = ['$GLUT_LIB']) + +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/abs.txt b/progs/fp/abs.txt new file mode 100644 index 0000000000..61ef952b05 --- /dev/null +++ b/progs/fp/abs.txt @@ -0,0 +1,5 @@ +!!ARBfp1.0 +TEMP R0; +SUB R0, {0.5}.x, fragment.color; +ABS result.color, R0; +END diff --git a/progs/fp/add-swz.txt b/progs/fp/add-swz.txt new file mode 100644 index 0000000000..5ec51bcb84 --- /dev/null +++ b/progs/fp/add-swz.txt @@ -0,0 +1,5 @@ +!!ARBfp1.0 +TEMP R0; +ADD R0, fragment.color, fragment.color; +ADD result.color, R0.xxxx, R0; +END diff --git a/progs/fp/add.txt b/progs/fp/add.txt new file mode 100644 index 0000000000..031076df0f --- /dev/null +++ b/progs/fp/add.txt @@ -0,0 +1,5 @@ +!!ARBfp1.0 +TEMP R0; +ADD R0, fragment.color, fragment.color; +ADD result.color, R0, R0; +END diff --git a/progs/fp/cmp.txt b/progs/fp/cmp.txt new file mode 100644 index 0000000000..78451609a3 --- /dev/null +++ b/progs/fp/cmp.txt @@ -0,0 +1,5 @@ +!!ARBfp1.0 +TEMP R0; +SUB R0, {0.5}.x, fragment.color; +CMP result.color, R0, fragment.color, {0.0}.x; +END diff --git a/progs/fp/cos.txt b/progs/fp/cos.txt new file mode 100644 index 0000000000..d51b13b63a --- /dev/null +++ b/progs/fp/cos.txt @@ -0,0 +1,8 @@ +!!ARBfp1.0 +TEMP R0; +MUL R0, fragment.color, {3.14}.x; +COS result.color.x, R0.x; +COS result.color.y, R0.y; +COS result.color.z, R0.z; +END + diff --git a/progs/fp/dp3.txt b/progs/fp/dp3.txt new file mode 100644 index 0000000000..75532f88a7 --- /dev/null +++ b/progs/fp/dp3.txt @@ -0,0 +1,4 @@ +!!ARBfp1.0 +TEMP R0; +DP3 result.color, fragment.color, fragment.color; +END diff --git a/progs/fp/dp4.txt b/progs/fp/dp4.txt new file mode 100644 index 0000000000..8d09c8dbf6 --- /dev/null +++ b/progs/fp/dp4.txt @@ -0,0 +1,4 @@ +!!ARBfp1.0 +TEMP R0; +DP4 result.color, fragment.color.xxxx, fragment.color; +END diff --git a/progs/fp/dph.txt b/progs/fp/dph.txt new file mode 100644 index 0000000000..6eb59a410d --- /dev/null +++ b/progs/fp/dph.txt @@ -0,0 +1,4 @@ +!!ARBfp1.0 +TEMP R0; +DPH result.color, fragment.color, fragment.color.xyzx; +END diff --git a/progs/fp/dst.txt b/progs/fp/dst.txt new file mode 100644 index 0000000000..6ebabbd5ea --- /dev/null +++ b/progs/fp/dst.txt @@ -0,0 +1,3 @@ +!!ARBfp1.0 +DST result.color, fragment.color, fragment.color; +END diff --git a/progs/fp/ex2.txt b/progs/fp/ex2.txt new file mode 100644 index 0000000000..b540f7b192 --- /dev/null +++ b/progs/fp/ex2.txt @@ -0,0 +1,5 @@ +!!ARBfp1.0 +TEMP R0; +EX2 R0, fragment.color.x; +SUB result.color, R0, {1.0}.x; +END diff --git a/progs/fp/flr.txt b/progs/fp/flr.txt new file mode 100644 index 0000000000..c3479c7bd5 --- /dev/null +++ b/progs/fp/flr.txt @@ -0,0 +1,5 @@ +!!ARBfp1.0 +TEMP R0; +ADD R0, fragment.color, {0.5}.x; +FLR result.color, R0; +END diff --git a/progs/fp/fp-tri.c b/progs/fp/fp-tri.c new file mode 100644 index 0000000000..52a8fcfc22 --- /dev/null +++ b/progs/fp/fp-tri.c @@ -0,0 +1,256 @@ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#ifndef WIN32 +#include <unistd.h> +#include <signal.h> +#endif + +#include <GL/glew.h> +#include <GL/glut.h> + +#include "readtex.c" + + +#define TEXTURE_FILE "../images/bw.rgb" + +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); +#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) { + printf("%d frames in 5.0 seconds = %.3f FPS\n", frame_cnt, + frame_cnt / 5.0); + + frame_cnt = 0; + } + signal(SIGALRM, alarmhandler); + alarm(5); +} +#endif + +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 ) +{ + GLuint Texture; + 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 (!GLEW_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); + + + /* 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); + } + + + 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); +} + +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); + + 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(); + + 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); + 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; +} diff --git a/progs/fp/frc.txt b/progs/fp/frc.txt new file mode 100644 index 0000000000..efacaa8f92 --- /dev/null +++ b/progs/fp/frc.txt @@ -0,0 +1,5 @@ +!!ARBfp1.0 +TEMP R0; +MUL R0, fragment.color, {3.0}.x; +FRC result.color, R0; +END 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/kil.txt b/progs/fp/kil.txt new file mode 100644 index 0000000000..d95deb0a9e --- /dev/null +++ b/progs/fp/kil.txt @@ -0,0 +1,6 @@ +!!ARBfp1.0 +TEMP R0; +SUB R0, fragment.color, {0.5,0,0,0}; +KIL R0; +MOV result.color, R0; +END diff --git a/progs/fp/lg2.txt b/progs/fp/lg2.txt new file mode 100644 index 0000000000..6707d7cb6d --- /dev/null +++ b/progs/fp/lg2.txt @@ -0,0 +1,5 @@ +!!ARBfp1.0 +TEMP R0; +MUL R0, fragment.color, {4.0}.x; +LG2 result.color, R0.x; +END diff --git a/progs/fp/lit.txt b/progs/fp/lit.txt new file mode 100644 index 0000000000..333c50d3cc --- /dev/null +++ b/progs/fp/lit.txt @@ -0,0 +1,5 @@ +!!ARBfp1.0 +TEMP R0; +SUB R0, {0.5}.x, fragment.color; +LIT result.color, R0; +END 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 diff --git a/progs/fp/lrp.txt b/progs/fp/lrp.txt new file mode 100644 index 0000000000..56cb5f5152 --- /dev/null +++ b/progs/fp/lrp.txt @@ -0,0 +1,4 @@ +!!ARBfp1.0 +TEMP R0, R1; +LRP result.color, fragment.color.z, {1,0,0,1}, {0,1,0,1}; +END diff --git a/progs/fp/mad.txt b/progs/fp/mad.txt new file mode 100644 index 0000000000..77ffac49cf --- /dev/null +++ b/progs/fp/mad.txt @@ -0,0 +1,4 @@ +!!ARBfp1.0 +TEMP R0, R1; +MAD result.color, fragment.color.z, {1,0,0,1}, fragment.color; +END diff --git a/progs/fp/max.txt b/progs/fp/max.txt new file mode 100644 index 0000000000..0f3bffd6a5 --- /dev/null +++ b/progs/fp/max.txt @@ -0,0 +1,3 @@ +!!ARBfp1.0 +MAX result.color, {0.5}.x, fragment.color; +END diff --git a/progs/fp/min.txt b/progs/fp/min.txt new file mode 100644 index 0000000000..06d8f911c3 --- /dev/null +++ b/progs/fp/min.txt @@ -0,0 +1,3 @@ +!!ARBfp1.0 +MIN result.color, {0.5}.x, fragment.color; +END diff --git a/progs/fp/mov.txt b/progs/fp/mov.txt new file mode 100644 index 0000000000..4c67baec5e --- /dev/null +++ b/progs/fp/mov.txt @@ -0,0 +1,3 @@ +!!ARBfp1.0 +MOV result.color, fragment.color; +END diff --git a/progs/fp/mul-swz.txt b/progs/fp/mul-swz.txt new file mode 100644 index 0000000000..7ef2f58633 --- /dev/null +++ b/progs/fp/mul-swz.txt @@ -0,0 +1,3 @@ +!!ARBfp1.0 +MUL result.color, fragment.color.zyxw, fragment.color; +END diff --git a/progs/fp/mul.txt b/progs/fp/mul.txt new file mode 100644 index 0000000000..907155de78 --- /dev/null +++ b/progs/fp/mul.txt @@ -0,0 +1,3 @@ +!!ARBfp1.0 +MUL result.color, fragment.color, fragment.color; +END diff --git a/progs/fp/negate.txt b/progs/fp/negate.txt new file mode 100644 index 0000000000..3d00a04a58 --- /dev/null +++ b/progs/fp/negate.txt @@ -0,0 +1,6 @@ +!!ARBfp1.0 +# this should result in fragment color passing through unchanged +TEMP R0; +ADD R0, fragment.color, fragment.color; +ADD result.color, R0, -fragment.color; +END 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 <stdio.h> #include <string.h> #include <stdlib.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> -#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/position.txt b/progs/fp/position.txt new file mode 100644 index 0000000000..1875897d78 --- /dev/null +++ b/progs/fp/position.txt @@ -0,0 +1,4 @@ +!!ARBfp1.0 +MOV result.color, {0}.x; +MUL result.color.xy, fragment.position, {.005}.x; +END diff --git a/progs/fp/pow.txt b/progs/fp/pow.txt new file mode 100644 index 0000000000..35c738556e --- /dev/null +++ b/progs/fp/pow.txt @@ -0,0 +1,4 @@ +!!ARBfp1.0 +TEMP R0; +POW result.color, fragment.color.x, fragment.color.y; +END diff --git a/progs/fp/rcp.txt b/progs/fp/rcp.txt new file mode 100644 index 0000000000..122161c49e --- /dev/null +++ b/progs/fp/rcp.txt @@ -0,0 +1,5 @@ +!!ARBfp1.0 +TEMP R0; +ADD R0, fragment.color.x, fragment.color.x; +RCP result.color, R0.x; +END diff --git a/progs/fp/rsq.txt b/progs/fp/rsq.txt new file mode 100644 index 0000000000..b28de4bdb6 --- /dev/null +++ b/progs/fp/rsq.txt @@ -0,0 +1,5 @@ +!!ARBfp1.0 +TEMP R0; +MUL R0, fragment.color, {3.0}.x; +RSQ result.color, R0.x; +END 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 + diff --git a/progs/fp/scs.txt b/progs/fp/scs.txt new file mode 100644 index 0000000000..5a8c9f16e9 --- /dev/null +++ b/progs/fp/scs.txt @@ -0,0 +1,5 @@ +!!ARBfp1.0 +TEMP R0; +MUL R0, fragment.color, {3.14}.x; +SCS result.color, R0.x; +END diff --git a/progs/fp/sge.txt b/progs/fp/sge.txt new file mode 100644 index 0000000000..5385692467 --- /dev/null +++ b/progs/fp/sge.txt @@ -0,0 +1,3 @@ +!!ARBfp1.0 +SGE result.color, {0.5}.x, fragment.color; +END diff --git a/progs/fp/sge2.txt b/progs/fp/sge2.txt new file mode 100644 index 0000000000..e02a50d477 --- /dev/null +++ b/progs/fp/sge2.txt @@ -0,0 +1,8 @@ +!!ARBfp1.0 +TEMP R0; +TEMP R1; +SGE R0, fragment.color, fragment.color.yzxw; +SGE R1, fragment.color, fragment.color.zxyw; +MUL R0, R0, R1; +MUL result.color, R0, fragment.color; +END diff --git a/progs/fp/sin.txt b/progs/fp/sin.txt new file mode 100644 index 0000000000..4a8cdb69f9 --- /dev/null +++ b/progs/fp/sin.txt @@ -0,0 +1,8 @@ +!!ARBfp1.0 +TEMP R0; +MUL R0, fragment.color, {3.14}.x; +MOV result.color, {0.0}.x; +SIN result.color.x, R0.x; +SIN result.color.y, R0.y; +SIN result.color.z, R0.z; +END diff --git a/progs/fp/slt.txt b/progs/fp/slt.txt new file mode 100644 index 0000000000..a3b3ff5656 --- /dev/null +++ b/progs/fp/slt.txt @@ -0,0 +1,3 @@ +!!ARBfp1.0 +SLT result.color, {0.5}.x, fragment.color; +END diff --git a/progs/fp/sub.txt b/progs/fp/sub.txt new file mode 100644 index 0000000000..b4e5cc0e9f --- /dev/null +++ b/progs/fp/sub.txt @@ -0,0 +1,3 @@ +!!ARBfp1.0 +SUB result.color, fragment.color.yzxw, fragment.color; +END diff --git a/progs/fp/swz.txt b/progs/fp/swz.txt new file mode 100644 index 0000000000..e28f112b14 --- /dev/null +++ b/progs/fp/swz.txt @@ -0,0 +1,3 @@ +!!ARBfp1.0 +SWZ result.color, fragment.color, 1,x,y,z; +END diff --git a/progs/fp/swz2.txt b/progs/fp/swz2.txt new file mode 100644 index 0000000000..5c12b84815 --- /dev/null +++ b/progs/fp/swz2.txt @@ -0,0 +1,4 @@ +!!ARBfp1.0 +TEMP R0, R1; +SWZ result.color, fragment.color, 1, 0, 0, 1; +END diff --git a/progs/fp/swz3.txt b/progs/fp/swz3.txt new file mode 100644 index 0000000000..382f5880d3 --- /dev/null +++ b/progs/fp/swz3.txt @@ -0,0 +1,5 @@ +!!ARBfp1.0 +TEMP R0, R1; +MOV R0, -fragment.color; +SWZ result.color, R0, -y, -x, z, 1; +END 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 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 diff --git a/progs/fp/tri-abs.c b/progs/fp/tri-abs.c deleted file mode 100644 index 44aa2cfa3a..0000000000 --- a/progs/fp/tri-abs.c +++ /dev/null @@ -1,107 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "SUB R0, {0.5}.x, fragment.color; \n" - "ABS result.color, R0; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-add.c b/progs/fp/tri-add.c deleted file mode 100644 index b086126c86..0000000000 --- a/progs/fp/tri-add.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "ADD R0, fragment.color, fragment.color; \n" - "ADD result.color, R0, R0; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-cmp.c b/progs/fp/tri-cmp.c deleted file mode 100644 index 968b67f3d9..0000000000 --- a/progs/fp/tri-cmp.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "SUB R0, {0.5}.x, fragment.color; \n" - "CMP result.color, R0, fragment.color, {0.0}.x; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-cos.c b/progs/fp/tri-cos.c deleted file mode 100644 index 7ea2453218..0000000000 --- a/progs/fp/tri-cos.c +++ /dev/null @@ -1,113 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0; \n" - "MUL R0, fragment.color, {3.14}.x; \n" - "COS result.color.x, R0.x; \n" - "COS result.color.y, R0.y; \n" - "COS result.color.z, R0.z; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} 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 <stdio.h> #include <string.h> #include <stdlib.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> -#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 <stdio.h> #include <string.h> #include <stdlib.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> -#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 <stdio.h> #include <string.h> #include <stdlib.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> @@ -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 <stdio.h> #include <string.h> #include <stdlib.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> @@ -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-dp3.c b/progs/fp/tri-dp3.c deleted file mode 100644 index 0e18de2dc4..0000000000 --- a/progs/fp/tri-dp3.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "DP3 result.color, fragment.color, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-dp4.c b/progs/fp/tri-dp4.c deleted file mode 100644 index 400bbf4da2..0000000000 --- a/progs/fp/tri-dp4.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "DP4 result.color, fragment.color.xxxx, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-dph.c b/progs/fp/tri-dph.c deleted file mode 100644 index 958073c413..0000000000 --- a/progs/fp/tri-dph.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "DPH result.color, fragment.color, fragment.color.xyzx; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-dst.c b/progs/fp/tri-dst.c deleted file mode 100644 index 3d85e85643..0000000000 --- a/progs/fp/tri-dst.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "DST result.color, fragment.color, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-ex2.c b/progs/fp/tri-ex2.c deleted file mode 100644 index f09b1d7846..0000000000 --- a/progs/fp/tri-ex2.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "EX2 R0, fragment.color.x; \n" - "SUB result.color, R0, {1.0}.x; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-flr.c b/progs/fp/tri-flr.c deleted file mode 100644 index 059f6b6754..0000000000 --- a/progs/fp/tri-flr.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "ADD R0, fragment.color, {0.5}.x; \n" - "FLR result.color, R0; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-fp.c b/progs/fp/tri-fp.c deleted file mode 100644 index 4148a8def3..0000000000 --- a/progs/fp/tri-fp.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "SLT result.color, {0.5}.x, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-frc.c b/progs/fp/tri-frc.c deleted file mode 100644 index 8d60c9dc20..0000000000 --- a/progs/fp/tri-frc.c +++ /dev/null @@ -1,111 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0; \n" - "MUL R0, fragment.color, {3.0}.x; \n" - "FRC result.color, R0; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} 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 <stdio.h> #include <string.h> #include <stdlib.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> @@ -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-kil.c b/progs/fp/tri-kil.c deleted file mode 100644 index 47dbd04964..0000000000 --- a/progs/fp/tri-kil.c +++ /dev/null @@ -1,111 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "SUB R0, fragment.color, {0.5,0,0,0}; \n" - "KIL R0;" - "MOV result.color, R0;" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-lg2.c b/progs/fp/tri-lg2.c deleted file mode 100644 index c7eec46974..0000000000 --- a/progs/fp/tri-lg2.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "MUL R0, fragment.color, {4.0}.x; \n" - "LG2 result.color, R0.x; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-lit.c b/progs/fp/tri-lit.c deleted file mode 100644 index 21e3b6f216..0000000000 --- a/progs/fp/tri-lit.c +++ /dev/null @@ -1,111 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "SUB R0, {0.5}.x, fragment.color; \n" - "LIT result.color, R0; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-lrp.c b/progs/fp/tri-lrp.c deleted file mode 100644 index a5659eed60..0000000000 --- a/progs/fp/tri-lrp.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0, R1;\n" - "LRP result.color, fragment.color.z, {1,0,0,1}, {0,1,0,1}; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-mad.c b/progs/fp/tri-mad.c deleted file mode 100644 index b46d139fb3..0000000000 --- a/progs/fp/tri-mad.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0, R1;\n" - "MAD result.color, fragment.color.z, {1,0,0,1}, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-max.c b/progs/fp/tri-max.c deleted file mode 100644 index 481a067916..0000000000 --- a/progs/fp/tri-max.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MAX result.color, {0.5}.x, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-min.c b/progs/fp/tri-min.c deleted file mode 100644 index 7bb722f85f..0000000000 --- a/progs/fp/tri-min.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MIN result.color, {0.5}.x, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-mov.c b/progs/fp/tri-mov.c deleted file mode 100644 index 40b5b66f5c..0000000000 --- a/progs/fp/tri-mov.c +++ /dev/null @@ -1,102 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MOV result.color, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-mul.c b/progs/fp/tri-mul.c deleted file mode 100644 index 61dd3e0458..0000000000 --- a/progs/fp/tri-mul.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MUL result.color, fragment.color, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} 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 <stdio.h> #include <string.h> #include <stdlib.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> -#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-position.c b/progs/fp/tri-position.c deleted file mode 100644 index 18e8182a68..0000000000 --- a/progs/fp/tri-position.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "MUL result.color, fragment.position, {.005}.x; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-pow.c b/progs/fp/tri-pow.c deleted file mode 100644 index ef91e43e99..0000000000 --- a/progs/fp/tri-pow.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "POW result.color, fragment.color.x, fragment.color.y; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-rcp.c b/progs/fp/tri-rcp.c deleted file mode 100644 index e2a2704934..0000000000 --- a/progs/fp/tri-rcp.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "ADD R0, fragment.color.x, fragment.color.x; \n" - "RCP result.color, R0.x; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-rsq.c b/progs/fp/tri-rsq.c deleted file mode 100644 index c5b2c1b32e..0000000000 --- a/progs/fp/tri-rsq.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "MUL R0, fragment.color, {3.0}.x; \n" - "RSQ result.color, R0.x; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-scs.c b/progs/fp/tri-scs.c deleted file mode 100644 index ce7c0062c3..0000000000 --- a/progs/fp/tri-scs.c +++ /dev/null @@ -1,111 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0; \n" - "MUL R0, fragment.color, {3.14}.x; \n" - "SCS result.color, R0.x; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-sge.c b/progs/fp/tri-sge.c deleted file mode 100644 index 6a360ca932..0000000000 --- a/progs/fp/tri-sge.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "SGE result.color, {0.5}.x, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-sge2.c b/progs/fp/tri-sge2.c deleted file mode 100644 index c4330098ed..0000000000 --- a/progs/fp/tri-sge2.c +++ /dev/null @@ -1,114 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0;\n" - "TEMP R1;\n" - "SGE R0, fragment.color, fragment.color.yzxw; \n" - "SGE R1, fragment.color, fragment.color.zxyw; \n" - "MUL R0, R0, R1; \n" - "MUL result.color, R0, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-sin.c b/progs/fp/tri-sin.c deleted file mode 100644 index 772903e4b2..0000000000 --- a/progs/fp/tri-sin.c +++ /dev/null @@ -1,114 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0; \n" - "MUL R0, fragment.color, {3.14}.x; \n" - "MOV result.color, {0.0}.x; \n" - "SIN result.color.x, R0.x; \n" - "SIN result.color.y, R0.y; \n" - "SIN result.color.z, R0.z; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-slt.c b/progs/fp/tri-slt.c deleted file mode 100644 index 4148a8def3..0000000000 --- a/progs/fp/tri-slt.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "SLT result.color, {0.5}.x, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-sub.c b/progs/fp/tri-sub.c deleted file mode 100644 index 6faa414550..0000000000 --- a/progs/fp/tri-sub.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "SUB result.color, fragment.color.yzxw, fragment.color; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-swz.c b/progs/fp/tri-swz.c deleted file mode 100644 index 5f34f7a322..0000000000 --- a/progs/fp/tri-swz.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "SWZ result.color, fragment.color, 1,x,y,z; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/tri-swz2.c b/progs/fp/tri-swz2.c deleted file mode 100644 index fd76b58f53..0000000000 --- a/progs/fp/tri-swz2.c +++ /dev/null @@ -1,109 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "TEMP R0, R1;\n" - "SWZ result.color, fragment.color, 1, 0, 0, 1; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} 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 <stdio.h> #include <string.h> #include <stdlib.h> -#define GL_GLEXT_PROTOTYPES +#include <GL/glew.h> #include <GL/glut.h> #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); diff --git a/progs/fp/tri-xpd.c b/progs/fp/tri-xpd.c deleted file mode 100644 index 9aca46b2fa..0000000000 --- a/progs/fp/tri-xpd.c +++ /dev/null @@ -1,108 +0,0 @@ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#define GL_GLEXT_PROTOTYPES -#include <GL/glut.h> -#include "GL/gl.h" - - - -static void Init( void ) -{ - static const char *modulate2D = - "!!ARBfp1.0\n" - "XPD result.color, fragment.color, {2,2,2,0}; \n" - "END" - ; - GLuint modulateProg; - - 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, &modulateProg); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, modulateProg); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(modulate2D), (const GLubyte *)modulate2D); - - printf("glGetError = 0x%x\n", (int) glGetError()); - 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 Draw(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(); - - -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow("First Tri") == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/fp/xpd.txt b/progs/fp/xpd.txt new file mode 100644 index 0000000000..d8dc08dcf7 --- /dev/null +++ b/progs/fp/xpd.txt @@ -0,0 +1,3 @@ +!!ARBfp1.0 +XPD result.color, fragment.color, {2,2,2,0}; +END |