diff options
author | Brian Paul <brianp@vmware.com> | 2009-02-10 16:44:02 -0700 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-02-10 16:44:02 -0700 |
commit | 5340b6dff73a0a23531ce2a5f28fba8303adab6e (patch) | |
tree | b141fc3648568dd8b941c966059e6ed32a8bd0ad /progs/fp | |
parent | 9fd26daec24f21dbe17afcb2e2ab272667ee9a69 (diff) | |
parent | ee4c921b65fb76998711f3c40330505cbc49a0e0 (diff) |
Merge commit 'origin/gallium-master-merge'
This is the big merge of the gallium-0.2 branch into master.
gallium-master-merge was just the staging area for it.
Both gallium-0.2 and gallium-master-merge are considered closed now.
Conflicts:
progs/demos/Makefile
src/mesa/main/state.c
src/mesa/main/texenvprogram.c
Diffstat (limited to 'progs/fp')
75 files changed, 360 insertions, 3765 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..ef6644cce2 100644..100755 --- a/progs/fp/Makefile +++ b/progs/fp/Makefile @@ -11,46 +11,14 @@ include $(TOP)/configs/current LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_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/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..843f897871 --- /dev/null +++ b/progs/fp/fp-tri.c @@ -0,0 +1,171 @@ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#define GL_GLEXT_PROTOTYPES +#include <GL/glut.h> +#include <unistd.h> +#include <signal.h> + +unsigned show_fps = 0; +unsigned int frame_cnt = 0; +void alarmhandler(int); +static const char *filename = NULL; + +static void usage(char *name) +{ + fprintf(stderr, "usage: %s [ options ] shader_filename\n", name); + fprintf(stderr, "\n" ); + fprintf(stderr, "options:\n"); + fprintf(stderr, " -fps show frames per second\n"); +} + +void alarmhandler (int sig) +{ + if (sig == SIGALRM) { + printf("%d frames in 5.0 seconds = %.3f FPS\n", frame_cnt, + frame_cnt / 5.0); + + frame_cnt = 0; + } + signal(SIGALRM, alarmhandler); + alarm(5); +} + +static void args(int argc, char *argv[]) +{ + GLint i; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-fps") == 0) { + show_fps = 1; + } + else if (i == argc - 1) { + filename = argv[i]; + } + else { + usage(argv[0]); + exit(1); + } + } + + if (!filename) { + usage(argv[0]); + exit(1); + } +} + +static void Init( void ) +{ + GLint errno; + GLuint prognum; + char buf[4096]; + GLuint sz; + FILE *f; + + if ((f = fopen(filename, "r")) == NULL) { + fprintf(stderr, "Couldn't open %s\n", filename); + exit(1); + } + + sz = fread(buf, 1, sizeof(buf), f); + if (!feof(f)) { + fprintf(stderr, "file too long\n"); + exit(1); + } + fprintf(stderr, "%.*s\n", sz, buf); + + if (!glutExtensionSupported("GL_ARB_fragment_program")) { + printf("Error: GL_ARB_fragment_program not supported!\n"); + exit(1); + } + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + + /* Setup the fragment program */ + glGenProgramsARB(1, &prognum); + glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prognum); + glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + sz, (const GLubyte *)buf); + + errno = glGetError(); + printf("glGetError = 0x%x\n", errno); + if (errno != GL_NO_ERROR) { + GLint errorpos; + + glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); + printf("errorpos: %d\n", errorpos); + printf("glError(GL_PROGRAM_ERROR_STRING_ARB) = %s\n", + (char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB)); + } + glEnable(GL_FRAGMENT_PROGRAM_ARB); + + glClearColor(.3, .3, .3, 0); +} + +static void Reshape(int width, int height) +{ + + glViewport(0, 0, (GLint)width, (GLint)height); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); + glMatrixMode(GL_MODELVIEW); +} + +static void Key(unsigned char key, int x, int y) +{ + + switch (key) { + case 27: + exit(1); + default: + return; + } + + glutPostRedisplay(); +} + +static void Display(void) +{ + glClear(GL_COLOR_BUFFER_BIT); + + glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, 1.0, 1.0, 0.0, 0.0); + glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, 0.0, 0.0, 1.0, 1.0); + glBegin(GL_TRIANGLES); + glColor3f(0,0,1); + glVertex3f( 0.9, -0.9, -30.0); + glColor3f(1,0,0); + glVertex3f( 0.9, 0.9, -30.0); + glColor3f(0,1,0); + glVertex3f(-0.9, 0.0, -30.0); + glEnd(); + + glFlush(); + + if (show_fps) { + ++frame_cnt; + glutPostRedisplay(); + } +} + + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + glutInitWindowPosition(0, 0); + glutInitWindowSize(250, 250); + glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH); + args(argc, argv); + glutCreateWindow(filename); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Display); + Init(); + if (show_fps) { + signal(SIGALRM, alarmhandler); + alarm(5); + } + 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.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/position.txt b/progs/fp/position.txt new file mode 100644 index 0000000000..27fac12a3a --- /dev/null +++ b/progs/fp/position.txt @@ -0,0 +1,3 @@ +!!ARBfp1.0 +MUL result.color, 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/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-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-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-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-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 |