diff options
Diffstat (limited to 'progs/trivial')
168 files changed, 0 insertions, 25690 deletions
diff --git a/progs/trivial/.gitignore b/progs/trivial/.gitignore deleted file mode 100644 index 2b42f04289..0000000000 --- a/progs/trivial/.gitignore +++ /dev/null @@ -1,168 +0,0 @@ -clear -clear-fbo -clear-fbo-scissor -clear-fbo-tex -clear-random -clear-repeat -clear-scissor -clear-undefined -createwin -dlist-begin-call-end -dlist-dangling -dlist-degenerate -dlist-edgeflag -dlist-edgeflag-dangling -dlist-flat-tri -dlist-mat-tri -dlist-recursive-call -dlist-tri-flat-tri -dlist-tri-mat-tri -draw2arrays -drawarrays -drawelements -drawrange -extfuncs.h -flat-clip -fs-tri -line -line-clip -line-cull -line-flat -line-smooth -line-stipple-wide -line-userclip -line-userclip-clip -line-userclip-nop -line-userclip-nop-clip -line-wide -lineloop -lineloop-clip -lineloop-elts -linestrip -linestrip-clip -linestrip-flat-stipple -linestrip-stipple -linestrip-stipple-wide -long-fixed-func -pgon-mode -point -point-clip -point-param -point-sprite -point-wide -point-wide-smooth -poly -poly-flat -poly-flat-clip -poly-flat-unfilled-clip -poly-unfilled -quad -quad-clip -quad-clip-all-vertices -quad-clip-nearplane -quad-degenerate -quad-flat -quad-offset-factor -quad-offset-unfilled -quad-offset-units -quad-tex-2d -quad-tex-3d -quad-tex-alpha -quad-tex-pbo -quad-tex-sub -quad-unfilled -quad-unfilled-clip -quad-unfilled-stipple -quads -quadstrip -quadstrip-clip -quadstrip-cont -quadstrip-flat -readtex.c -readtex.h -readpixels -sub-tex -tex-quads -tri -tri-alpha -tri-alpha-tex -tri-array-interleaved -tri-blend -tri-blend-color -tri-blend-max -tri-blend-min -tri-blend-revsub -tri-blend-sub -tri-clear -tri-clip -tri-cull -tri-cull-both -tri-dlist -tri-edgeflag -tri-fbo -tri-fbo-tex -tri-fbo-tex-mip -tri-flat -tri-flat-clip -tri-fog -tri-fp -tri-fp-const-imm -tri-lit -tri-lit-material -tri-logicop-none -tri-logicop-xor -tri-mask-tri -tri-multitex-vbo -tri-orig -tri-point-line-clipped -tri-query -tri-repeat -tri-scissor-tri -tri-square -tri-stencil -tri-stipple -tri-tex -tri-tex-3d -tri-tri -tri-unfilled -tri-unfilled-clip -tri-unfilled-edgeflag -tri-unfilled-fog -tri-unfilled-point -tri-unfilled-smooth -tri-unfilled-tri -tri-unfilled-tri-lit -tri-unfilled-userclip -tri-unfilled-userclip-stip -tri-userclip -tri-viewport -tri-z -tri-z-9 -tri-z-eq -trifan -trifan-flat -trifan-flat-clip -trifan-flat-unfilled-clip -trifan-unfilled -tristrip -tristrip-clip -tristrip-flat -vbo-drawarrays -vbo-drawelements -vbo-drawrange -vbo-noninterleaved -vbo-tri -vp-array -vp-array-hf -vp-array-int -vp-clip -vp-line-clip -vp-tri -vp-tri-cb -vp-tri-cb-pos -vp-tri-cb-tex -vp-tri-imm -vp-tri-invariant -vp-tri-swap -vp-tri-tex -vp-unfilled diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile deleted file mode 100644 index a10748f948..0000000000 --- a/progs/trivial/Makefile +++ /dev/null @@ -1,243 +0,0 @@ -# progs/tests/Makefile - - -# These programs aren't intended to be included with the normal distro. -# They're not too interesting but they're good for testing. - -TOP = ../.. -include $(TOP)/configs/current - - -LIBS = -L$(TOP)/$(LIB_DIR) -l $(GLEW_LIB) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) - -SOURCES = \ - clear-fbo-scissor.c \ - clear-fbo-tex.c \ - clear-fbo.c \ - clear-scissor.c \ - clear-undefined.c \ - clear-repeat.c \ - clear-random.c \ - clear.c \ - createwin.c \ - dlist-dangling.c \ - dlist-flat-tri.c \ - dlist-mat-tri.c \ - dlist-tri-flat-tri.c \ - dlist-tri-mat-tri.c \ - dlist-recursive-call.c \ - dlist-begin-call-end.c \ - dlist-edgeflag-dangling.c \ - dlist-edgeflag.c \ - dlist-degenerate.c \ - drawarrays.c \ - draw2arrays.c \ - drawelements.c \ - drawrange.c \ - flat-clip.c \ - fs-tri.c \ - line-clip.c \ - line-cull.c \ - line-flat.c \ - line-smooth.c \ - line-stipple-wide.c \ - line-userclip-clip.c \ - line-userclip-nop-clip.c \ - line-userclip-nop.c \ - line-userclip.c \ - line-wide.c \ - line.c \ - lineloop-clip.c \ - lineloop-elts.c \ - lineloop.c \ - linestrip-clip.c \ - linestrip-flat-stipple.c \ - linestrip-stipple-wide.c \ - linestrip-stipple.c \ - linestrip.c \ - long-fixed-func.c \ - pgon-mode.c \ - point-clip.c \ - point-param.c \ - point-sprite.c \ - point-wide.c \ - point-wide-smooth.c \ - point.c \ - poly-flat.c \ - poly-flat-clip.c \ - poly-flat-unfilled-clip.c \ - poly-unfilled.c \ - poly.c \ - quad-clip-all-vertices.c \ - quad-clip-nearplane.c \ - quad-clip.c \ - quad-degenerate.c \ - quad-flat.c \ - quad-offset-factor.c \ - quad-offset-unfilled.c \ - quad-offset-units.c \ - quad-tex-2d.c \ - quad-tex-3d.c \ - quad-tex-alpha.c \ - quad-tex-pbo.c \ - quad-tex-sub.c \ - quad-unfilled-clip.c \ - quad-unfilled-stipple.c \ - quad-unfilled.c \ - quad.c \ - quads.c \ - quadstrip-clip.c \ - quadstrip-cont.c \ - quadstrip-flat.c \ - quadstrip.c \ - readpixels.c \ - sub-tex.c \ - tex-quads.c \ - tri-alpha.c \ - tri-alpha-tex.c \ - tri-array-interleaved.c \ - tri-blend-color.c \ - tri-blend-max.c \ - tri-blend-min.c \ - tri-blend-revsub.c \ - tri-blend-sub.c \ - tri-blend.c \ - tri-clear.c \ - tri-clip.c \ - tri-cull-both.c \ - tri-cull.c \ - tri-logicop-none.c \ - tri-logicop-xor.c \ - tri-dlist.c \ - tri-edgeflag.c \ - tri-fbo-tex-mip.c \ - tri-fbo-tex.c \ - tri-fbo.c \ - tri-flat-clip.c \ - tri-flat.c \ - tri-fog.c \ - tri-fp.c \ - tri-fp-const-imm.c \ - tri-lit.c \ - tri-lit-material.c \ - tri-mask-tri.c \ - tri-orig.c \ - tri-point-line-clipped.c \ - tri-query.c \ - tri-repeat.c \ - tri-scissor-tri.c \ - tri-square.c \ - tri-stencil.c \ - tri-stipple.c \ - tri-multitex-vbo.c \ - tri-tex.c \ - tri-tex-3d.c \ - tri-tri.c \ - tri-unfilled-fog.c \ - tri-unfilled-edgeflag.c \ - tri-unfilled-clip.c \ - tri-unfilled-point.c \ - tri-unfilled-smooth.c \ - tri-unfilled-tri.c \ - tri-unfilled-tri-lit.c \ - tri-unfilled-userclip-stip.c \ - tri-unfilled-userclip.c \ - tri-unfilled.c \ - tri-userclip.c \ - tri-viewport.c \ - tri-z-9.c \ - tri-z-eq.c \ - tri-z.c \ - tri.c \ - trifan-flat.c \ - trifan-flat-clip.c \ - trifan-flat-unfilled-clip.c \ - trifan-unfilled.c \ - trifan.c \ - tristrip-clip.c \ - tristrip-flat.c \ - tristrip.c \ - vbo-tri.c \ - vbo-drawarrays.c \ - vbo-noninterleaved.c \ - vbo-drawelements.c \ - vbo-drawrange.c \ - vp-array.c \ - vp-array-hf.c \ - vp-array-int.c \ - vp-clip.c \ - vp-line-clip.c \ - vp-tri.c \ - vp-tri-invariant.c \ - vp-tri-swap.c \ - vp-tri-tex.c \ - vp-tri-imm.c \ - vp-tri-cb.c \ - vp-tri-cb-pos.c \ - vp-tri-cb-tex.c \ - vp-unfilled.c - -PROGS = $(SOURCES:%.c=%) - -INCLUDES = -I. -I$(TOP)/include -I../samples - -UTIL_FILES = readtex.h readtex.c - - -##### RULES ##### - -.SUFFIXES: -.SUFFIXES: .c - -.c: - $(APP_CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $< $(LIBS) -o $@ - -.c.o: - $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -.S.o: - $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - - -##### TARGETS ##### - -default: $(UTIL_FILES) $(PROGS) - -clean: - -rm -f $(PROGS) - -rm -f *.o - - -texrect: texrect.o readtex.o - $(APP_CC) $(CFLAGS) $(LDFLAGS) texrect.o readtex.o $(LIBS) -o $@ - -texrect.o: texrect.c readtex.h - $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -invert: invert.o readtex.o - $(APP_CC) $(CFLAGS) $(LDFLAGS) invert.o readtex.o $(LIBS) -o $@ - -invert.o: invert.c readtex.h - $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - -readtex.o: readtex.c - $(APP_CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ - - -readtex.h: $(TOP)/progs/util/readtex.h - ln -s $(TOP)/progs/util/readtex.h . - -readtex.c: $(TOP)/progs/util/readtex.c - ln -s $(TOP)/progs/util/readtex.c . - - -fs-tri: fs-tri.c extfuncs.h - - -extfuncs.h: $(TOP)/progs/util/extfuncs.h - cp $< . - - -# Emacs tags -tags: - etags `find . -name \*.[ch]` `find ../include` diff --git a/progs/trivial/SConscript b/progs/trivial/SConscript deleted file mode 100644 index 24b4f91fb0..0000000000 --- a/progs/trivial/SConscript +++ /dev/null @@ -1,174 +0,0 @@ -Import('*') - -progs = [ - 'clear-fbo-scissor', - 'clear-fbo-tex', - 'clear-fbo', - 'clear-scissor', - 'clear-undefined', - 'clear-repeat', - 'clear', - 'dlist-dangling', - 'dlist-edgeflag-dangling', - 'dlist-edgeflag', - 'dlist-degenerate', - 'drawarrays', - 'draw2arrays', - 'drawelements', - 'drawrange', - 'flat-clip', - 'fs-tri', - 'line-clip', - 'line-cull', - 'line-flat', - 'line-smooth', - 'line-stipple-wide', - 'line-userclip-clip', - 'line-userclip-nop-clip', - 'line-userclip-nop', - 'line-userclip', - 'line-wide', - 'line', - 'lineloop-clip', - 'lineloop-elts', - 'lineloop', - 'linestrip-flat-stipple', - 'linestrip-stipple-wide', - 'linestrip-stipple', - 'linestrip', - 'long-fixed-func', - 'pgon-mode', - 'point-clip', - 'point-param', - 'point-sprite', - 'point-wide', - 'point-wide-smooth', - 'point', - 'poly-flat', - 'poly-flat-clip', - 'poly-flat-unfilled-clip', - 'poly-unfilled', - 'poly', - 'quad-clip-all-vertices', - 'quad-clip-nearplane', - 'quad-clip', - 'quad-degenerate', - 'quad-flat', - 'quad-offset-factor', - 'quad-offset-unfilled', - 'quad-offset-units', - 'quad-tex-2d', - 'quad-tex-3d', - 'quad-tex-alpha', - 'quad-tex-pbo', - 'quad-tex-sub', - 'quad-unfilled-clip', - 'quad-unfilled-stipple', - 'quad-unfilled', - 'quad', - 'quads', - 'quadstrip-clip', - 'quadstrip-cont', - 'quadstrip-flat', - 'quadstrip', - 'sub-tex', - 'tex-quads', - 'tri-alpha', - 'tri-blend-color', - 'tri-blend-max', - 'tri-blend-min', - 'tri-blend-revsub', - 'tri-blend-sub', - 'tri-blend', - 'tri-clip', - 'tri-clear', - 'tri-cull-both', - 'tri-cull', - 'tri-dlist', - 'tri-edgeflag', - 'tri-fbo-tex-mip', - 'tri-fbo-tex', - 'tri-fbo', - 'tri-flat-clip', - 'tri-flat', - 'tri-fog', - 'tri-fp', - 'tri-fp-const-imm', - 'tri-lit', - 'tri-logicop-none', - 'tri-logicop-xor', - 'tri-mask-tri', - 'tri-orig', - 'tri-point-line-clipped', - 'tri-query', - 'tri-repeat', - 'tri-scissor-tri', - 'tri-stencil', - 'tri-stipple', - 'tri-multitex-vbo', - 'tri-tex', - 'tri-tex-3d', - 'tri-tri', - 'tri-unfilled-fog', - 'tri-unfilled-edgeflag', - 'tri-unfilled-clip', - 'tri-unfilled-smooth', - 'tri-unfilled-tri', - 'tri-unfilled-tri-lit', - 'tri-unfilled-userclip-stip', - 'tri-unfilled-userclip', - 'tri-unfilled', - 'tri-userclip', - 'tri-viewport', - 'tri-z-eq', - 'tri-z', - 'tri', - 'trifan-flat', - 'trifan-flat-clip', - 'trifan-flat-unfilled-clip', - 'trifan-unfilled', - 'trifan', - 'tristrip-clip', - 'tristrip-flat', - 'tristrip', - 'vbo-drawarrays', - 'vbo-noninterleaved', - 'vbo-drawelements', - 'vbo-drawrange', - 'vp-array', - 'vp-array-int', - 'vp-clip', - 'vp-line-clip', - 'vp-tri', - 'vp-tri-invariant', - 'vp-tri-swap', - 'vp-tri-tex', - 'vp-tri-imm', - 'vp-tri-cb', - 'vp-tri-cb-pos', - 'vp-tri-cb-tex', - 'vp-unfilled', -] - -for prog in progs: - prog = progs_env.Program( - target = prog, - source = prog + '.c', - ) - -# auto code generation -#getprocaddress: getprocaddress.c getproclist.h - -#getproclist.h: $(TOP)/src/mesa/glapi/gen/gl_API.xml getprocaddress.c getprocaddress.py -# python getprocaddress.py > getproclist.h - - -#readtex.h: $(TOP)/progs/util/readtex.h -# ln -s $(TOP)/progs/util/readtex.h . - -#readtex.c: $(TOP)/progs/util/readtex.c -# ln -s $(TOP)/progs/util/readtex.c . - - -#extfuncs.h: $(TOP)/progs/util/extfuncs.h -# cp $< . diff --git a/progs/trivial/clear-fbo-scissor.c b/progs/trivial/clear-fbo-scissor.c deleted file mode 100644 index 6a605e16a8..0000000000 --- a/progs/trivial/clear-fbo-scissor.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Use scissor to clear the four quadrants of the FBO to different - * colors. Then draw a grey triangle in the middle. - */ - - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <string.h> -#include <GL/glew.h> -#include <GL/glut.h> -#include <GL/glu.h> - - -static int Width = 512, Height = 512; -static GLuint MyFB, MyRB; -static GLboolean UseTex = GL_FALSE; -static GLboolean UseCopyPix = GL_FALSE; - - -#define CheckError() \ - do { \ - GLenum err = glGetError(); \ - if (err != GL_NO_ERROR) \ - printf("Error: %s\n", gluErrorString(err)); \ - assert(err == GL_NO_ERROR); \ - } while (0) - - -static void -Init(void) -{ - GLenum status; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { - printf("GL_EXT_framebuffer_object not found!\n"); - exit(0); - } - - glGenFramebuffersEXT(1, &MyFB); - glGenRenderbuffersEXT(1, &MyRB); - - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - - if (UseTex) { - GLuint tex; - glGenTextures(1, &tex); - glBindTexture(GL_TEXTURE_2D, tex); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, Width, Height, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, - GL_COLOR_ATTACHMENT0_EXT, - GL_TEXTURE_2D, tex, 0); - } - else { - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, MyRB); - - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, - GL_COLOR_ATTACHMENT0_EXT, - GL_RENDERBUFFER_EXT, MyRB); - - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); - } - - status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { - fprintf(stderr, "Framebuffer object is incomplete (0x%x)!\n", status); - } - - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); - glMatrixMode(GL_MODELVIEW); - - Width = width; - Height = height; - if (!UseTex) { - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); - } -} - - -static void -Key(unsigned char key, int x, int y) -{ - if (key == 27) { - exit(0); - } - glutPostRedisplay(); -} - - -static void -Draw(void) -{ - GLboolean scissor = GL_TRUE; - - /* draw to user framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); - glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); - - glViewport(0, 0, Width, Height); - CheckError(); - - if (scissor) { - glEnable(GL_SCISSOR_TEST); - - /* lower-left = red */ - glClearColor(1, 0, 0, 0); - glScissor(0, 0, Width / 2, Height / 2); - glClear(GL_COLOR_BUFFER_BIT); - - /* lower-right = green */ - glClearColor(0, 1, 0, 0); - glScissor(Width / 2, 0, Width - Width / 2, Height / 2); - glClear(GL_COLOR_BUFFER_BIT); - - /* upper-left = blue */ - glClearColor(0, 0, 1, 0); - glScissor(0, Height / 2, Width / 2, Height - Height / 2); - glClear(GL_COLOR_BUFFER_BIT); - - /* upper-right = white */ - glClearColor(1, 1, 1, 0); - glScissor(Width / 2, Height / 2, Width - Width / 2, Height - Height / 2); - glClear(GL_COLOR_BUFFER_BIT); - - glDisable(GL_SCISSOR_TEST); - } - else { - glClearColor(0, 1, 0, 0); - glClear(GL_COLOR_BUFFER_BIT); - } - - CheckError(); - - /* gray triangle in middle, pointing up */ - glColor3f(0.5, 0.5, 0.5); - glBegin(GL_TRIANGLES); - glVertex2f(Width/4, Height/4); - glVertex2f(Width*3/4, Height/4); - glVertex2f(Width/2, Height*3/4); - glVertex2f(-0.5, -0.5); - glVertex2f(+0.5, -0.5); - glVertex2f( 0.0, 0.7); - glEnd(); - - CheckError(); - - /* copy fbo to window */ - glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, MyFB); - glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); - glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, 0); - glDrawBuffer(GL_BACK); - - if (UseCopyPix) { - glWindowPos2i(0, 0); - glCopyPixels(0, 0, Width, Height, GL_COLOR); - } - else { - GLubyte *buffer = malloc(Width * Height * 4); - - /* read from user framebuffer */ - glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - - /* draw to window */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - glWindowPos2iARB(0, 0); - glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - - free(buffer); - } - - /* Bind normal framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - - glutSwapBuffers(); - - CheckError(); -} - - -int -main(int argc, char *argv[]) -{ - int i; - - glutInit(&argc, argv); - glutInitWindowPosition(100, 0); - glutInitWindowSize(Width, Height); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-t") == 0) - UseTex = GL_TRUE; - else if (strcmp(argv[i], "-c") == 0) - UseCopyPix = GL_TRUE; - } - - if (UseTex) - printf("Using render to texture\n"); - else - printf("Using user-created render buffer\n"); - - if (!glutCreateWindow(argv[0])) { - exit(1); - } - - glewInit(); - Init(); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/clear-fbo-tex.c b/progs/trivial/clear-fbo-tex.c deleted file mode 100644 index ff31706fd1..0000000000 --- a/progs/trivial/clear-fbo-tex.c +++ /dev/null @@ -1,223 +0,0 @@ - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <string.h> - -#include <GL/glew.h> -#include <GL/glut.h> - - - -static GLenum TexTarget = GL_TEXTURE_2D; -static int TexWidth = 512, TexHeight = 512; -static GLenum TexIntFormat = GL_RGBA; /* either GL_RGB or GL_RGBA */ - -static int Width = 512, Height = 512; -static GLuint MyFB, TexObj; - - -#define CheckError() assert(glGetError() == 0) - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - - if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { - printf("GL_EXT_framebuffer_object not found!\n"); - exit(0); - } - - - glGenFramebuffersEXT(1, &MyFB); - glGenTextures(1, &TexObj); - - /* Make texture object/image */ - glBindTexture(TexTarget, TexObj); - glTexParameteri(TexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(TexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(TexTarget, GL_TEXTURE_BASE_LEVEL, 0); - glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, 0); - - glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - - - { - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - TexTarget, TexObj, 0); - - - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - } - -} - - - -static void -Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - - Width = width; - Height = height; -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - break; - } - - glutPostRedisplay(); -} - - - -static void Draw( void ) -{ - - - /* draw to texture image */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - /* glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); */ - /* glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); */ - - - glViewport(0, 0, TexWidth, TexHeight); - CheckError(); - - glClearColor(0.5, 0.5, 1.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - CheckError(); - - if (0) { - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - } - - { - GLubyte *buffer = malloc(Width * Height * 4); - - /* read from user framebuffer */ - glReadPixels(0, 0, Width-60, Height-60, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - CheckError(); - - /* draw to window */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - glViewport(0, 0, Width, Height); - - /* Try to clear the window, but will overwrite: - */ - glClearColor(0.8, 0.8, 0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - - glWindowPos2iARB(30, 30); - glDrawPixels(Width-60, Height-60, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - - free(buffer); - } - - /* Bind normal framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - glViewport(0, 0, Width, Height); - - if (0) { - glBegin(GL_TRIANGLES); - glColor3f(0,.7,0); - glVertex3f( 0.5, -0.5, -30.0); - glColor3f(0,0,.8); - glVertex3f( 0.5, 0.5, -30.0); - glColor3f(.9,0,0); - glVertex3f(-0.5, 0.0, -30.0); - glEnd(); - } - - if (doubleBuffer) { - glutSwapBuffers(); - } - - CheckError(); -} - - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - - - -int -main( int argc, char *argv[] ) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize( Width, Height ); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(argv[0]) == GL_FALSE) { - exit(1); - } - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/clear-fbo.c b/progs/trivial/clear-fbo.c deleted file mode 100644 index 6435c901ad..0000000000 --- a/progs/trivial/clear-fbo.c +++ /dev/null @@ -1,208 +0,0 @@ - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <string.h> - -#include <GL/glew.h> -#include <GL/glut.h> - - - -static int Width = 512, Height = 512; -static GLuint MyFB, MyRB; - - -#define CheckError() assert(glGetError() == 0) - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - - if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { - printf("GL_EXT_framebuffer_object not found!\n"); - exit(0); - } - - - glGenFramebuffersEXT(1, &MyFB); - glGenRenderbuffersEXT(1, &MyRB); - - { - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, MyRB); - - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, - GL_RENDERBUFFER_EXT, MyRB); - - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); - - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - } - -} - - - -static void -Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - - Width = width; - Height = height; - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - break; - } - - glutPostRedisplay(); -} - - - -static void Draw( void ) -{ - - /* draw to user framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); - glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); - - - glViewport(0, 0, Width, Height); - CheckError(); - - glClearColor(0.5, 0.5, 1.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - CheckError(); - - if (0) { - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - } - - { - GLubyte *buffer = malloc(Width * Height * 4); - - /* read from user framebuffer */ - glReadPixels(0, 0, Width-60, Height-60, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - CheckError(); - - /* draw to window */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - glViewport(0, 0, Width, Height); - - /* Try to clear the window, but will overwrite: - */ - glClearColor(0.8, 0.8, 0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - - glWindowPos2iARB(30, 30); - glDrawPixels(Width-60, Height-60, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - - free(buffer); - } - - /* Bind normal framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - glViewport(0, 0, Width, Height); - - if (0) { - glBegin(GL_TRIANGLES); - glColor3f(0,.7,0); - glVertex3f( 0.5, -0.5, -30.0); - glColor3f(0,0,.8); - glVertex3f( 0.5, 0.5, -30.0); - glColor3f(.9,0,0); - glVertex3f(-0.5, 0.0, -30.0); - glEnd(); - } - - if (doubleBuffer) - glutSwapBuffers(); - else - glFinish(); - - CheckError(); -} - - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - - - -int -main( int argc, char *argv[] ) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize( Width, Height ); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(argv[0]) == GL_FALSE) { - exit(1); - } - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/clear-random.c b/progs/trivial/clear-random.c deleted file mode 100644 index ab67f84518..0000000000 --- a/progs/trivial/clear-random.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - -} - -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(0); - default: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClearColor( - rand() / (float)RAND_MAX, - rand() / (float)RAND_MAX, - rand() / (float)RAND_MAX, - 0.0); - - glClear(GL_COLOR_BUFFER_BIT); - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); - glutInitWindowSize( 256, 256); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/clear-repeat.c b/progs/trivial/clear-repeat.c deleted file mode 100644 index f966adb080..0000000000 --- a/progs/trivial/clear-repeat.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.3, 0.1, 0.3, 0.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(0); - default: - glutPostRedisplay(); - return; - } -} - -static void Draw(void) -{ - static float f = 0; - while (1) { - f += .1; - glClearColor((sin(f)+1)/2.0,(cos(f)+1)/2.0,0.5,1); - glClear(GL_COLOR_BUFFER_BIT); - glutSwapBuffers(); - - { - static GLint T0 = 0; - static GLint Frames = 0; - GLint t = glutGet(GLUT_ELAPSED_TIME); - - Frames++; - - if (t - T0 >= 5000) { - GLfloat seconds = (t - T0) / 1000.0; - GLfloat fps = Frames / seconds; - printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps); - fflush(stdout); - T0 = t; - Frames = 0; - } - } - - } - glutPostRedisplay(); -} - -static GLenum Args(int argc, char **argv) -{ - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300); - - type = GLUT_RGB | GLUT_ALPHA; - type |= GLUT_DOUBLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/clear-scissor.c b/progs/trivial/clear-scissor.c deleted file mode 100644 index 2b6dee77a9..0000000000 --- a/progs/trivial/clear-scissor.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * glClear + glScissor - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -GLenum doubleBuffer; -GLint Width = 200, Height = 150; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); -} - -static void Reshape(int width, int height) -{ - Width = width; - Height = 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: - break; - } - glutPostRedisplay(); -} - -static void Draw(void) -{ - glEnable(GL_SCISSOR_TEST); - - glClearColor(1, 0, 0, 0); - glScissor(0, 0, Width / 2, Height / 2); - glClear(GL_COLOR_BUFFER_BIT); - - glClearColor(0, 1, 0, 0); - glScissor(Width / 2, 0, Width - Width / 2, Height / 2); - glClear(GL_COLOR_BUFFER_BIT); - - glClearColor(0, 0, 1, 0); - glScissor(0, Height / 2, Width / 2, Height - Height / 2); - glClear(GL_COLOR_BUFFER_BIT); - - glClearColor(1, 1, 1, 0); - glScissor(Width / 2, Height / 2, Width - Width / 2, Height - Height / 2); - glClear(GL_COLOR_BUFFER_BIT); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( Width, Height ); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(argv[0]) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/clear-undefined.c b/progs/trivial/clear-undefined.c deleted file mode 100644 index 5ec33bf3d7..0000000000 --- a/progs/trivial/clear-undefined.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * glClear + glScissor + Undefined content of framebuffer - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -GLenum doubleBuffer; -GLint Width = 200, Height = 150; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fprintf(stderr, "Top right corner should be red\n"); - fflush(stderr); -} - -static void Reshape(int width, int height) -{ - Width = width; - Height = 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: - glutPostRedisplay(); - return; - } - -} - -static void Draw(void) -{ - glColor4f(1.0, 0.0, 0.0, 1.0); - glBegin(GL_QUADS); - glVertex2d(0.0, 0.0); - glVertex2d(0.0, 1.0); - glVertex2d(1.0, 1.0); - glVertex2d(1.0, 0.0); - glEnd(); - - glBegin(GL_QUADS); - glVertex2d(0.0, 0.0); - glVertex2d(0.0, -1.0); - glVertex2d(1.0, -1.0); - glVertex2d(1.0, 0.0); - glEnd(); - - glEnable(GL_SCISSOR_TEST); - glClearColor(1, 1, 0, 0); - glScissor(Width / 2, 0, Width - Width / 2, Height / 2); - glClear(GL_COLOR_BUFFER_BIT); - - glClearColor(0, 0, 1, 0); - glScissor(0, Height / 2, Width / 2, Height - Height / 2); - glClear(GL_COLOR_BUFFER_BIT); - glDisable(GL_SCISSOR_TEST); - - glColor4f(0.0, 1.0, 0.0, 1.0); - glBegin(GL_QUADS); - glVertex2d( 0.0, 0.0); - glVertex2d( 0.0, -1.0); - glVertex2d(-1.0, -1.0); - glVertex2d(-1.0, 0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_TRUE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( Width, Height ); - - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(argv[0]) == GL_FALSE) { - exit(1); - } - - Init(); - Reshape(Width, Height); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/clear.c b/progs/trivial/clear.c deleted file mode 100644 index 56c3ea52e6..0000000000 --- a/progs/trivial/clear.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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(0); - default: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); - glutInitWindowSize( 256, 256); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/createwin.c b/progs/trivial/createwin.c deleted file mode 100644 index 93da30ee29..0000000000 --- a/progs/trivial/createwin.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - /* glutMainLoop(); */ - return 0; -} diff --git a/progs/trivial/dlist-begin-call-end.c b/progs/trivial/dlist-begin-call-end.c deleted file mode 100644 index dbfaef3978..0000000000 --- a/progs/trivial/dlist-begin-call-end.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLint first_list, list; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - /* First list will disrupt state which might potentially be - * short-circuited in calling list: - */ - first_list = glGenLists(1); - glNewList(first_list, GL_COMPILE); - /* glColor3f(0,1,0); */ - glEndList(); - - - /* List that looks like it might have redundant state: - */ - list = glGenLists(1); - glNewList(list, GL_COMPILE); - - glShadeModel(GL_FLAT); - glBegin(GL_TRIANGLES); - glColor3f(1,0,0); - glVertex3f( -0.9, 0.9, -30.0); - glVertex3f( -0.9, -0.9, -30.0); - glCallList( first_list ); - glVertex3f( 0.9, 0.0, -30.0); - glEnd(); - glEndList(); -} - -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: - break; - } - - glutPostRedisplay(); -} - - - - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glShadeModel( GL_SMOOTH ); - glCallList(list); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/dlist-dangling.c b/progs/trivial/dlist-dangling.c deleted file mode 100644 index 756ab93f87..0000000000 --- a/progs/trivial/dlist-dangling.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLint list; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - - list = glGenLists(1); - glNewList(list, GL_COMPILE); - glBegin(GL_TRIANGLES); - glVertex3f( 0.9, -0.9, -30.0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - glEndList(); -} - -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: - break; - } - - glutPostRedisplay(); -} - - - - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glColor3f(0,.9,0); - glCallList(list); - - glRotatef(45,0,0,1); - glColor3f(1,0,1); - glCallList(list); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/dlist-degenerate.c b/progs/trivial/dlist-degenerate.c deleted file mode 100644 index c7f2d2a6e9..0000000000 --- a/progs/trivial/dlist-degenerate.c +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Test display list corner cases. - */ - - -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glut.h> - - -static int Win; -static GLfloat Xrot = 0, Yrot = 0, Zrot = 0; -static GLboolean Anim = GL_FALSE; -static GLuint List1 = 0, List2 = 0; - - -static void -Idle(void) -{ - Xrot += 3.0; - Yrot += 4.0; - Zrot += 2.0; - glutPostRedisplay(); -} - - -static void -Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glPushMatrix(); - glRotatef(Xrot, 1, 0, 0); - glRotatef(Yrot, 0, 1, 0); - glRotatef(Zrot, 0, 0, 1); - - glCallList(List1); - glCallList(List2); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -15.0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 'z': - Zrot -= step; - break; - case 'Z': - Zrot += step; - break; - case 27: - glutDestroyWindow(Win); - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -SpecialKey(int key, int x, int y) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - Xrot -= step; - break; - case GLUT_KEY_DOWN: - Xrot += step; - break; - case GLUT_KEY_LEFT: - Yrot -= step; - break; - case GLUT_KEY_RIGHT: - Yrot += step; - break; - } - glutPostRedisplay(); -} - - -static void -Init(void) -{ - /* List1: start of primitive */ - List1 = glGenLists(1); - glNewList(List1, GL_COMPILE); - glBegin(GL_POLYGON); - glVertex2f(-1, -1); - glVertex2f( 1, -1); - glEndList(); - - /* List2: end of primitive */ - List2 = glGenLists(1); - glNewList(List2, GL_COMPILE); - glVertex2f( 1, 1); - glVertex2f(-1, 1); - glEnd(); - glEndList(); - - glEnable(GL_DEPTH_TEST); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(400, 400); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - Win = glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutSpecialFunc(SpecialKey); - glutDisplayFunc(Draw); - if (Anim) - glutIdleFunc(Idle); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/dlist-edgeflag-dangling.c b/progs/trivial/dlist-edgeflag-dangling.c deleted file mode 100644 index 51504471e2..0000000000 --- a/progs/trivial/dlist-edgeflag-dangling.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLint list; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_POINT); - - list = glGenLists(1); - glNewList(list, GL_COMPILE); - glBegin(GL_TRIANGLES); - glVertex3f( 0.9, -0.9, -30.0); - glEdgeFlag(1); - glVertex3f( 0.9, 0.9, -30.0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - glEndList(); -} - -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: - break; - } - - glutPostRedisplay(); -} - - - - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glPushMatrix(); - glColor3f(0,.9,0); - glEdgeFlag(0); - glCallList(list); - - glRotatef(45,0,0,1); - glColor3f(1,0,1); - glCallList(list); - glPopMatrix(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/dlist-edgeflag.c b/progs/trivial/dlist-edgeflag.c deleted file mode 100644 index 9456b96473..0000000000 --- a/progs/trivial/dlist-edgeflag.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLint list; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_POINT); - - list = glGenLists(1); - glNewList(list, GL_COMPILE); - glBegin(GL_TRIANGLES); - glEdgeFlag(1); -/* glColor3f(0,0,.7); */ - glVertex3f( 0.9, -0.9, -30.0); - glEdgeFlag(0); -/* glColor3f(.8,0,0); */ - glVertex3f( 0.9, 0.9, -30.0); - glEdgeFlag(1); -/* glColor3f(0,.9,0); */ - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - glEndList(); -} - -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: - break; - } - - glutPostRedisplay(); -} - - - - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glPushMatrix(); - glColor3f(0,.9,0); - glCallList(list); - - glRotatef(45,0,0,1); - glColor3f(1,0,1); - glCallList(list); - glPopMatrix(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/dlist-flat-tri.c b/progs/trivial/dlist-flat-tri.c deleted file mode 100644 index 3ee9b283a4..0000000000 --- a/progs/trivial/dlist-flat-tri.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLint list; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - list = glGenLists(1); - glNewList(list, GL_COMPILE); - - /* XXX: this state-change will only be executed if list is called - * from outside a begin/end pair: - */ - glShadeModel( GL_FLAT ); - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( -0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f( -0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.0, -30.0); - glEnd(); - - /* This statechange is potentially NOT redundant: - */ - glShadeModel( GL_FLAT ); - glBegin(GL_TRIANGLES); - glColor3f(0,1,0); - glVertex3f( -0.5, 0.5, -30.0); - glColor3f(0,0,1); - glVertex3f( -0.5, -0.5, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.5, 0.0, -30.0); - glEnd(); - - glEndList(); -} - -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: - break; - } - - glutPostRedisplay(); -} - - - - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glShadeModel( GL_SMOOTH ); - - glBegin(GL_TRIANGLES); - - /* Note: call the list from inside a begin/end pair. The end is - * provided by the display list... - */ - glCallList(list); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/dlist-mat-tri.c b/progs/trivial/dlist-mat-tri.c deleted file mode 100644 index d17c4b913b..0000000000 --- a/progs/trivial/dlist-mat-tri.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLint list; - -static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0}; -static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0}; -/*static GLfloat blue[4] = {0.2, 0.2, .7, 1.0};*/ - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - list = glGenLists(1); - glNewList(list, GL_COMPILE); - - /* XXX: this state-change will be executed regardless of whether - * the list is called from outside a begin/end pair: - */ - glMaterialfv(GL_FRONT, GL_AMBIENT, red); - glBegin(GL_TRIANGLES); - glVertex3f( -0.9, 0.9, -30.0); - glVertex3f( -0.9, -0.9, -30.0); - glVertex3f( 0.9, 0.0, -30.0); - glEnd(); - - glMaterialfv(GL_FRONT, GL_DIFFUSE, red); - glBegin(GL_TRIANGLES); - glVertex3f( -0.7, 0.7, -30.0); - glVertex3f( -0.7, -0.7, -30.0); - glVertex3f( 0.7, 0.0, -30.0); - glEnd(); - - /* This statechange is redundant: - */ - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); - glBegin(GL_TRIANGLES); - glVertex3f( -0.5, 0.5, -30.0); - glVertex3f( -0.5, -0.5, -30.0); - glVertex3f( 0.5, 0.0, -30.0); - glEnd(); - - glEndList(); -} - -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: - break; - } - - glutPostRedisplay(); -} - - - - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glShadeModel( GL_SMOOTH ); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); - - glBegin(GL_TRIANGLES); - - /* Note: call the list from inside a begin/end pair. The end is - * provided by the display list... - */ - glCallList(list); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/dlist-recursive-call.c b/progs/trivial/dlist-recursive-call.c deleted file mode 100644 index 90224f63cb..0000000000 --- a/progs/trivial/dlist-recursive-call.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLint first_list, list; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - /* First list will disrupt state which might potentially be - * short-circuited in calling list: - */ - first_list = glGenLists(1); - glNewList(first_list, GL_COMPILE); - glShadeModel( GL_SMOOTH ); - glEndList(); - - - /* List that looks like it might have redundant state: - */ - list = glGenLists(1); - glNewList(list, GL_COMPILE); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glShadeModel( GL_FLAT ); - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( -0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f( -0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.0, -30.0); - glEnd(); - - glCallList( first_list ); - - /* Do a quick begin/end to ensure we are not inside a dangling - * primitive from the called list: - */ - glBegin( GL_POINTS ); - glEnd(); - - /* This statechange is NOT redundant: - */ - glShadeModel( GL_FLAT ); - glBegin(GL_TRIANGLES); - glColor3f(1,0,0); - glVertex3f( -0.5, 0.5, -30.0); - glColor3f(0,1,0); - glVertex3f( -0.5, -0.5, -30.0); - glColor3f(0,0,1); - glVertex3f( 0.5, 0.0, -30.0); - glEnd(); - - glEndList(); -} - -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: - break; - } - - glutPostRedisplay(); -} - - - - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glShadeModel( GL_SMOOTH ); - glCallList(list); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/dlist-tri-flat-tri.c b/progs/trivial/dlist-tri-flat-tri.c deleted file mode 100644 index 3265a4d6dc..0000000000 --- a/progs/trivial/dlist-tri-flat-tri.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLint list; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - list = glGenLists(1); - glNewList(list, GL_COMPILE); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glShadeModel( GL_FLAT ); - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( -0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f( -0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.0, -30.0); - glEnd(); - - /* This statechange is redundant: - */ - glShadeModel( GL_FLAT ); - glBegin(GL_TRIANGLES); - glColor3f(1,0,0); - glVertex3f( -0.5, 0.5, -30.0); - glColor3f(0,1,0); - glVertex3f( -0.5, -0.5, -30.0); - glColor3f(0,0,1); - glVertex3f( 0.5, 0.0, -30.0); - glEnd(); - - glEndList(); -} - -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: - break; - } - - glutPostRedisplay(); -} - - - - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glShadeModel( GL_SMOOTH ); - glCallList(list); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/dlist-tri-mat-tri.c b/progs/trivial/dlist-tri-mat-tri.c deleted file mode 100644 index 053bb124a2..0000000000 --- a/progs/trivial/dlist-tri-mat-tri.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLint list; - -static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0}; -static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0}; -static GLfloat blue[4] = {0.2, 0.2, .9, 1.0}; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - list = glGenLists(1); - glNewList(list, GL_COMPILE); - - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); - - glBegin(GL_TRIANGLES); - glNormal3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glVertex3f( 0.9, 0.9, -30.0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); - - glBegin(GL_TRIANGLES); - glVertex3f( -0.9, 0.9, -30.0); - glVertex3f( -0.9, -0.9, -30.0); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); - glVertex3f( 0.9, 0.0, -30.0); - glEnd(); - - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); - glBegin(GL_TRIANGLES); - glVertex3f( -0.5, 0.5, -30.0); - glVertex3f( -0.5, -0.5, -30.0); - glVertex3f( 0.5, 0.0, -30.0); - glEnd(); - - glEndList(); -} - -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: - break; - } - - glutPostRedisplay(); -} - - - - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glShadeModel( GL_SMOOTH ); - glCallList(list); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/draw2arrays.c b/progs/trivial/draw2arrays.c deleted file mode 100644 index 2345ae9e9e..0000000000 --- a/progs/trivial/draw2arrays.c +++ /dev/null @@ -1,117 +0,0 @@ -/* Basic VBO */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -GLfloat pos[][3] = - { { 0.9, -0.9, 0.0 }, - { 0.9, 0.9, 0.0 }, - { -0.9, 0.9, 0.0 }, - { -0.9, -0.9, 0.0 } }; - -GLubyte color[][4] = -{ { 0x00, 0x00, 0xff, 0x00 }, - { 0x00, 0xff, 0x00, 0x00 }, - { 0xff, 0x00, 0x00, 0x00 }, - { 0xff, 0xff, 0xff, 0x00 } }; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - - glVertexPointer( 3, GL_FLOAT, sizeof(pos[0]), pos ); - glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(color[0]), color ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_ARB); - - /* glDrawArrays( GL_TRIANGLES, 0, 3 ); */ - glDrawArrays( GL_TRIANGLES, 1, 3 ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/drawarrays.c b/progs/trivial/drawarrays.c deleted file mode 100644 index f5c0a50f9a..0000000000 --- a/progs/trivial/drawarrays.c +++ /dev/null @@ -1,128 +0,0 @@ -/* Basic VBO */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - - -struct { - GLfloat pos[3]; - GLubyte color[4]; -} verts[] = -{ - { { 0.9, -0.9, 0.0 }, - { 0x00, 0x00, 0xff, 0x00 } - }, - - { { 0.9, 0.9, 0.0 }, - { 0x00, 0xff, 0x00, 0x00 } - }, - - { { -0.9, 0.9, 0.0 }, - { 0xff, 0x00, 0x00, 0x00 } - }, - - { { -0.9, -0.9, 0.0 }, - { 0xff, 0xff, 0xff, 0x00 } - }, -}; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts[0].pos ); - glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), verts[0].color ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_ARB); - - /* glDrawArrays( GL_TRIANGLES, 0, 3 ); */ - glDrawArrays( GL_TRIANGLES, 1, 3 ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/drawelements.c b/progs/trivial/drawelements.c deleted file mode 100644 index 4c115030af..0000000000 --- a/progs/trivial/drawelements.c +++ /dev/null @@ -1,121 +0,0 @@ -/* Test rebasing */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -GLfloat verts[][4] = { - { 0.9, -0.9, 0.0, 1.0 }, - { 0.9, 0.9, 0.0, 1.0 }, - { -0.9, 0.9, 0.0, 1.0 }, - { -0.9, -0.9, 0.0, 1.0 }, -}; - -GLubyte color[][4] = { - { 0x00, 0x00, 0xff, 0x00 }, - { 0x00, 0xff, 0x00, 0x00 }, - { 0xff, 0x00, 0x00, 0x00 }, - { 0xff, 0xff, 0xff, 0x00 }, -}; - -GLuint indices[] = { 1, 2, 3 }; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts ); - glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - /* Should have min_index == 1, maybe force a rebase: - */ - glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, indices ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/drawrange.c b/progs/trivial/drawrange.c deleted file mode 100644 index e9ea99b537..0000000000 --- a/progs/trivial/drawrange.c +++ /dev/null @@ -1,119 +0,0 @@ -/* Test rebasing */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -GLfloat verts[][4] = { - { 0.9, -0.9, 0.0, 1.0 }, - { 0.9, 0.9, 0.0, 1.0 }, - { -0.9, 0.9, 0.0, 1.0 }, - { -0.9, -0.9, 0.0, 1.0 }, -}; - -GLubyte color[][4] = { - { 0x00, 0x00, 0xff, 0x00 }, - { 0x00, 0xff, 0x00, 0x00 }, - { 0xff, 0x00, 0x00, 0x00 }, - { 0xff, 0xff, 0xff, 0x00 }, -}; - -GLuint indices[] = { 1, 2, 3 }; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts ); - glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - glDrawRangeElements( GL_TRIANGLES, 1, 3, 3, GL_UNSIGNED_INT, indices ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/flat-clip.c b/progs/trivial/flat-clip.c deleted file mode 100644 index dbe17a342e..0000000000 --- a/progs/trivial/flat-clip.c +++ /dev/null @@ -1,151 +0,0 @@ -/** - * Test flat shading and clipping. - * - * Brian Paul - * 30 August 2007 - */ - - -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glut.h> - -static int Win; -static GLfloat Scale = 2.0, Zrot = 50; -static GLenum Mode = GL_LINE_LOOP; -static GLboolean Smooth = 0; -static GLenum PolygonMode = GL_FILL; - - -static void -Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - if (Smooth) - glShadeModel(GL_SMOOTH); - else - glShadeModel(GL_FLAT); - - glPushMatrix(); - glScalef(Scale, Scale, 1); - glRotatef(Zrot, 0, 0, 1); - - glPolygonMode(GL_FRONT_AND_BACK, PolygonMode); - - glBegin(Mode); - glColor3f(1, 0, 0); - glVertex2f(-1, -1); - glColor3f(0, 1, 0); - glVertex2f( 2, -1); - glColor3f(0, 0, 1); - glVertex2f( 0, 1); - glEnd(); - - glPushMatrix(); - glScalef(0.9, 0.9, 1); - glBegin(Mode); - glColor3f(1, 0, 0); - glVertex2f( 0, 1); - - glColor3f(0, 0, 1); - glVertex2f( 2, -1); - - glColor3f(0, 1, 0); - glVertex2f(-1, -1); - - glEnd(); - glPopMatrix(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -15.0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 'p': - if (Mode == GL_TRIANGLES) - Mode = GL_LINE_LOOP; - else - Mode = GL_TRIANGLES; - break; - case 'f': - if (PolygonMode == GL_POINT) - PolygonMode = GL_LINE; - else if (PolygonMode == GL_LINE) - PolygonMode = GL_FILL; - else - PolygonMode = GL_POINT; - printf("PolygonMode = 0x%x\n", PolygonMode); - break; - case 'r': - Zrot -= 5.0; - break; - case 'R': - Zrot += 5.0; - break; - case 'z': - Scale *= 1.1; - break; - case 'Z': - Scale /= 1.1; - break; - case 's': - Smooth = !Smooth; - break; - case 27: - glutDestroyWindow(Win); - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -Init(void) -{ - printf("Usage:\n"); - printf(" z/Z: change triangle size\n"); - printf(" r/R: rotate\n"); - printf(" p: toggle line/fill mode\n"); - printf(" s: toggle smooth/flat shading\n"); - printf(" f: switch polygon fill mode\n"); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(400, 400); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - Win = glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/fs-tri.c b/progs/trivial/fs-tri.c deleted file mode 100644 index 6e86df1dcf..0000000000 --- a/progs/trivial/fs-tri.c +++ /dev/null @@ -1,209 +0,0 @@ -/* Test fragment shader */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - - -static GLuint fragShader; -static GLuint vertShader; -static GLuint program; -static GLint win = 0; -static GLfloat xpos = 0, ypos = 0; - - -static void -Redisplay(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - glPushMatrix(); - glTranslatef(xpos, ypos, 0); - - glBegin(GL_TRIANGLES); - glColor3f(1, 0, 0); - glVertex2f(-0.9, -0.9); - glColor3f(0, 1, 0); - glVertex2f( 0.9, -0.9); - glColor3f(0, 0, 1); - glVertex2f( 0, 0.9); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1, 1, -1, 1, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - - -static void -CleanUp(void) -{ - glDeleteShader(fragShader); - glDeleteShader(vertShader); - glDeleteProgram(program); - glutDestroyWindow(win); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - - switch(key) { - case 27: - CleanUp(); - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -SpecialKey(int key, int x, int y) -{ - const GLfloat step = 0.1; - - (void) x; - (void) y; - - switch(key) { - case GLUT_KEY_UP: - ypos += step; - break; - case GLUT_KEY_DOWN: - ypos -= step; - break; - case GLUT_KEY_LEFT: - xpos -= step; - break; - case GLUT_KEY_RIGHT: - xpos += step; - break; - } - glutPostRedisplay(); -} - - -static void -LoadAndCompileShader(GLuint shader, const char *text) -{ - GLint stat; - - glShaderSource(shader, 1, (const GLchar **) &text, NULL); - - glCompileShader(shader); - - glGetShaderiv(shader, GL_COMPILE_STATUS, &stat); - if (!stat) { - GLchar log[1000]; - GLsizei len; - glGetShaderInfoLog(shader, 1000, &len, log); - fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log); - exit(1); - } -} - - -static void -CheckLink(GLuint prog) -{ - GLint stat; - glGetProgramiv(prog, GL_LINK_STATUS, &stat); - if (!stat) { - GLchar log[1000]; - GLsizei len; - glGetProgramInfoLog(prog, 1000, &len, log); - fprintf(stderr, "Linker error:\n%s\n", log); - } -} - - -static void -Init(void) -{ - /* fragment color is a function of fragment position: */ - static const char *fragShaderText = - "void main() {\n" - " gl_FragColor = gl_FragCoord * vec4(0.005); \n" - " //gl_FragColor = gl_Color; \n" - " //gl_FragColor = vec4(1, 0, 0.5, 0); \n" - "}\n"; -#if 0 - static const char *vertShaderText = - "varying vec3 normal;\n" - "void main() {\n" - " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" - " normal = gl_NormalMatrix * gl_Normal;\n" - "}\n"; -#endif - const char *version; - - version = (const char *) glGetString(GL_VERSION); - if (version[0] != '2' || version[1] != '.') { - printf("This program requires OpenGL 2.x, found %s\n", version); - exit(1); - } - - fragShader = glCreateShader(GL_FRAGMENT_SHADER); - LoadAndCompileShader(fragShader, fragShaderText); - -#if 0 - vertShader = glCreateShader(GL_VERTEX_SHADER); - LoadAndCompileShader(vertShader, vertShaderText); -#endif - - program = glCreateProgram(); - glAttachShader(program, fragShader); -#if 0 - glAttachShader(program, vertShader); -#endif - glLinkProgram(program); - CheckLink(program); - glUseProgram(program); - - assert(glGetError() == 0); - - glClearColor(0.3f, 0.3f, 0.3f, 0.0f); - - printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER)); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition( 0, 0); - glutInitWindowSize(200, 200); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - win = glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutSpecialFunc(SpecialKey); - glutDisplayFunc(Redisplay); - Init(); - glutMainLoop(); - return 0; -} - - diff --git a/progs/trivial/line-clip.c b/progs/trivial/line-clip.c deleted file mode 100644 index e4e388ed5c..0000000000 --- a/progs/trivial/line-clip.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-1.9, 0.0, -30.0); - /* Repeat - no loop support yet: - */ - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-cull.c b/progs/trivial/line-cull.c deleted file mode 100644 index c531ff132f..0000000000 --- a/progs/trivial/line-cull.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,1); - glVertex3f( -1.5, 0.5, -30.0); - glColor3f(1,0,0); - glVertex3f( 0, 2.0, -30.0); - glColor3f(0,1,0); - glVertex3f(-1.5, 2.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-flat.c b/progs/trivial/line-flat.c deleted file mode 100644 index e2ddb87b9e..0000000000 --- a/progs/trivial/line-flat.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - glBegin(GL_LINES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - - - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-smooth.c b/progs/trivial/line-smooth.c deleted file mode 100644 index 9c4b9a0115..0000000000 --- a/progs/trivial/line-smooth.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <math.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLboolean smooth = GL_TRUE; -GLfloat width = 1.0; - - -static void Init(void) -{ - float range[2], aarange[2]; - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - glGetFloatv(GL_LINE_WIDTH_RANGE, aarange); - glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range); - printf("Non-AA line width range: %f .. %f\n", range[0], range[1]); - printf("AA line width range: %f .. %f\n", aarange[0], aarange[1]); - fflush(stdout); -} - - -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); - glLoadIdentity(); - glTranslatef(0, 0, -30); -} - -static void Key(unsigned char key, int x, int y) -{ - switch (key) { - case 'w': - width -= 0.5; - if (width < 0.5) - width = 0.5; - break; - case 'W': - width += 0.5; - break; - case 's': - smooth = !smooth; - break; - case 27: - exit(1); - default: - return; - } - printf("LineWidth: %g\n", width); - glutPostRedisplay(); -} - - -static void Draw(void) -{ - float a; - - glClear(GL_COLOR_BUFFER_BIT); - - glLineWidth(width); - - if (smooth) { - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - glEnable(GL_LINE_SMOOTH); - } - - glColor3f(1, 1, 1); - - glBegin(GL_LINES); - for (a = 0; a < 3.14159; a += 0.2) { - float x = .9 * cos(a); - float y = .9 * sin(a); - - glVertex2f(-x, -y); - glVertex2f( x, y); - } - glEnd(); - - glDisable(GL_LINE_SMOOTH); - glDisable(GL_BLEND); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(argv[0]) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-stipple-wide.c b/progs/trivial/line-stipple-wide.c deleted file mode 100644 index 767583bbea..0000000000 --- a/progs/trivial/line-stipple-wide.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_LINE_STIPPLE); - glLineStipple( 5, 0xfffe ); - glLineWidth( 4 ); - - glBegin(GL_LINES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-userclip-clip.c b/progs/trivial/line-userclip-clip.c deleted file mode 100644 index 3265b2c3bf..0000000000 --- a/progs/trivial/line-userclip-clip.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - static GLdouble plane[4] = { -.5, 0, 1, 0 }; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - glClipPlane(GL_CLIP_PLANE0, plane); - glEnable(GL_CLIP_PLANE0); -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(0,.9,0); - glVertex3f(-1.9, 0.0, 0.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-userclip-nop-clip.c b/progs/trivial/line-userclip-nop-clip.c deleted file mode 100644 index 0198e27807..0000000000 --- a/progs/trivial/line-userclip-nop-clip.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - static GLdouble plane[4] = { 0, 0, 1, 0 }; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - glClipPlane(GL_CLIP_PLANE0, plane); - glEnable(GL_CLIP_PLANE0); -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(0,.9,0); - glVertex3f(-1.9, 0.0, 0.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-userclip-nop.c b/progs/trivial/line-userclip-nop.c deleted file mode 100644 index 6c863a3c82..0000000000 --- a/progs/trivial/line-userclip-nop.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - static GLdouble plane[4] = { 0, 0, 1, 0 }; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - glClipPlane(GL_CLIP_PLANE0, plane); - glEnable(GL_CLIP_PLANE0); -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, 0.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-userclip.c b/progs/trivial/line-userclip.c deleted file mode 100644 index 6cfcb6fc73..0000000000 --- a/progs/trivial/line-userclip.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - static GLdouble plane[4] = { -.5, 0, 1, 0 }; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - glClipPlane(GL_CLIP_PLANE0, plane); - glEnable(GL_CLIP_PLANE0); -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, 0.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line-wide.c b/progs/trivial/line-wide.c deleted file mode 100644 index 1945712c5d..0000000000 --- a/progs/trivial/line-wide.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glLineWidth(4.0); - - glBegin(GL_LINES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - - - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/line.c b/progs/trivial/line.c deleted file mode 100644 index 58ab96836f..0000000000 --- a/progs/trivial/line.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - - - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/lineloop-clip.c b/progs/trivial/lineloop-clip.c deleted file mode 100644 index 5e6b6217a1..0000000000 --- a/progs/trivial/lineloop-clip.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_LOOP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-1.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/lineloop-elts.c b/progs/trivial/lineloop-elts.c deleted file mode 100644 index ab944157c0..0000000000 --- a/progs/trivial/lineloop-elts.c +++ /dev/null @@ -1,121 +0,0 @@ -/* Test rebasing */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -GLfloat verts[][4] = { - { 0.9, -0.9, 0.0, 1.0 }, - { 0.9, 0.9, 0.0, 1.0 }, - { -0.9, 0.9, 0.0, 1.0 }, - { -0.9, -0.9, 0.0, 1.0 }, -}; - -GLubyte color[][4] = { - { 0x00, 0x00, 0xff, 0x00 }, - { 0x00, 0xff, 0x00, 0x00 }, - { 0xff, 0x00, 0x00, 0x00 }, - { 0xff, 0xff, 0xff, 0x00 }, -}; - -GLuint indices[] = { 1, 2, 3 }; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts ); - glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - /* Should have min_index == 1, maybe force a rebase: - */ - glDrawElements( GL_LINE_LOOP, 3, GL_UNSIGNED_INT, indices ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/lineloop.c b/progs/trivial/lineloop.c deleted file mode 100644 index 82eccd24f8..0000000000 --- a/progs/trivial/lineloop.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_LOOP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/linestrip-clip.c b/progs/trivial/linestrip-clip.c deleted file mode 100644 index 5e90ea2eb0..0000000000 --- a/progs/trivial/linestrip-clip.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - - glColor3f(0,.9,0); - glVertex3f(-1.9, 0.0, -30.0); - - glColor3f(0,0,.7); - glVertex3f( 0.8, -0.8, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/linestrip-flat-stipple.c b/progs/trivial/linestrip-flat-stipple.c deleted file mode 100644 index bae5c3a1c3..0000000000 --- a/progs/trivial/linestrip-flat-stipple.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glShadeModel(GL_FLAT); - glEnable(GL_LINE_STIPPLE); - glLineStipple( 5, 0xfffe ); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/linestrip-stipple-wide.c b/progs/trivial/linestrip-stipple-wide.c deleted file mode 100644 index 0296941a0d..0000000000 --- a/progs/trivial/linestrip-stipple-wide.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_LINE_STIPPLE); - glLineStipple( 5, 0xfffe ); - glLineWidth( 4 ); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/linestrip-stipple.c b/progs/trivial/linestrip-stipple.c deleted file mode 100644 index a847d47dee..0000000000 --- a/progs/trivial/linestrip-stipple.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_LINE_STIPPLE); - glLineStipple( 5, 0xfffe ); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/linestrip.c b/progs/trivial/linestrip.c deleted file mode 100644 index b6d6882146..0000000000 --- a/progs/trivial/linestrip.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_LINE_STRIP); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/long-fixed-func.c b/progs/trivial/long-fixed-func.c deleted file mode 100644 index 4b6c412f9e..0000000000 --- a/progs/trivial/long-fixed-func.c +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Enable as much fixed-function vertex processing state as possible - * to test fixed-function -> program code generation. - */ - - - -#include <GL/glew.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -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 -Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(.8,0,0); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.0, 0.9, -30.0); - glEnd(); - - glFlush(); - - glutSwapBuffers(); -} - - -static void -Init(void) -{ - GLubyte tex[16][16][4]; - GLfloat pos[4] = {5, 10, 3, 1.0}; - int i, j; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.3, 0.1, 0.3, 0.0); - - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j++) { - if ((i+j) & 1) { - tex[i][j][0] = 100; - tex[i][j][1] = 100; - tex[i][j][2] = 100; - tex[i][j][3] = 255; - } - else { - tex[i][j][0] = 200; - tex[i][j][1] = 200; - tex[i][j][2] = 200; - tex[i][j][3] = 255; - } - } - } - - - glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1); - glFogi(GL_FOG_MODE, GL_LINEAR); - glEnable(GL_FOG); - - glPointParameterfv(GL_DISTANCE_ATTENUATION_EXT, pos); - - for (i = 0; i < 8; i++) { - GLuint texObj; - - glEnable(GL_LIGHT0 + i); - glLightf(GL_LIGHT0 + i, GL_SPOT_EXPONENT, 3.5); - glLightf(GL_LIGHT0 + i, GL_SPOT_CUTOFF, 30.); - glLightf(GL_LIGHT0 + i, GL_CONSTANT_ATTENUATION, 3.); - glLightf(GL_LIGHT0 + i, GL_LINEAR_ATTENUATION, 3.); - glLightf(GL_LIGHT0 + i, GL_QUADRATIC_ATTENUATION, 3.); - glLightfv(GL_LIGHT0 + i, GL_POSITION, pos); - - glActiveTexture(GL_TEXTURE0 + i); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); - glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); - glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glEnable(GL_TEXTURE_GEN_R); - glEnable(GL_TEXTURE_GEN_Q); - glEnable(GL_TEXTURE_2D); - - glMatrixMode(GL_TEXTURE); - glScalef(2.0, 1.0, 3.0); - - glGenTextures(1, &texObj); - glBindTexture(GL_TEXTURE_2D, texObj); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, - GL_RGBA, GL_UNSIGNED_BYTE, tex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - } - - glEnable(GL_LIGHTING); - glActiveTexture(GL_TEXTURE0); - glMatrixMode(GL_MODELVIEW); -} - - -static void -Key(unsigned char key, int x, int y) -{ - if (key == 27) { - exit(0); - } - glutPostRedisplay(); -} - - -int -main(int argc, char **argv) -{ - GLenum type = GLUT_RGB | GLUT_DOUBLE; - - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize( 250, 250); - glutInitDisplayMode(type); - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - glewInit(); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/pgon-mode.c b/progs/trivial/pgon-mode.c deleted file mode 100644 index db58638619..0000000000 --- a/progs/trivial/pgon-mode.c +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Test glPolygonMode. - * A tri-strip w/ two tris is drawn so that the first tri is front-facing - * but the second tri is back-facing. - * Set glPolygonMode differently for the front/back faces - * - */ - - -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glut.h> - -static int Win; -static GLfloat Zrot = 0; -static GLboolean FrontFillBackUnfilled = GL_TRUE; -static GLboolean Lines = GL_TRUE; - - -static void -Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - if (FrontFillBackUnfilled) { - if (Lines) { - printf("FrontMode = FILL, BackMode = LINE\n"); - glPolygonMode(GL_BACK, GL_LINE); - } - else { - printf("FrontMode = FILL, BackMode = POINT\n"); - glPolygonMode(GL_BACK, GL_POINT); - } - glPolygonMode(GL_FRONT, GL_FILL); - } - else { - if (Lines) { - printf("FrontMode = LINE, BackMode = FILL\n"); - glPolygonMode(GL_FRONT, GL_LINE); - } - else { - printf("FrontMode = POINT, BackMode = FILL\n"); - glPolygonMode(GL_FRONT, GL_POINT); - } - glPolygonMode(GL_BACK, GL_FILL); - } - - glPushMatrix(); - glRotatef(Zrot, 0, 0, 1); - - glBegin(GL_TRIANGLE_STRIP); - glVertex2f(-1, 0); - glVertex2f( 1, 0); - glVertex2f(0, 1); - glVertex2f(0, -1); - glEnd(); - - glPopMatrix(); - - glutSwapBuffers(); -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -15.0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - const GLfloat step = 3.0; - (void) x; - (void) y; - switch (key) { - case 'p': - FrontFillBackUnfilled = !FrontFillBackUnfilled; - break; - case 'l': - Lines = !Lines; - break; - case 'z': - Zrot -= step; - break; - case 'Z': - Zrot += step; - break; - case 27: - glutDestroyWindow(Win); - exit(0); - break; - } - glutPostRedisplay(); -} - - -static void -Init(void) -{ - printf("GL_RENDERER = %s\n", (char*) glGetString(GL_RENDERER)); - - glLineWidth(3.0); - glPointSize(3.0); - - glColor4f(1, 1, 1, 0.8); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - printf("Press 'p' to toggle polygon mode\n"); -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(400, 400); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); - Win = glutCreateWindow(argv[0]); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/point-clip.c b/progs/trivial/point-clip.c deleted file mode 100644 index 23cfd77863..0000000000 --- a/progs/trivial/point-clip.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_POINTS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-1.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/point-param.c b/progs/trivial/point-param.c deleted file mode 100644 index 46bd773265..0000000000 --- a/progs/trivial/point-param.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <GL/glew.h> -#include <math.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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, 100.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - switch (key) { - case 27: - exit(1); - default: - break; - } - glutPostRedisplay(); -} - - -static float -expected(float z, float size, const float atten[3]) -{ - float dist = fabs(z); - const GLfloat q = atten[0] + dist * (atten[1] + dist * atten[2]); - const GLfloat a = sqrt(1.0 / q); - return size * a; -} - - -static void Draw(void) -{ - static GLfloat atten[3] = { 0.0, 0.1, .01 }; - float size = 40.0; - int i; - - glClear(GL_COLOR_BUFFER_BIT); - - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glPointSize(size); - glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, atten); - - glColor3f(1,0,0); - - printf("Expected point sizes:\n"); - glBegin(GL_POINTS); - for (i = 0; i < 5; i++) { - float x = -0.8 + i * 0.4; - float z = -i * 20 - 10; - glVertex3f( x, 0.0, z); - printf(" %f\n", expected(z, size, atten)); - } - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(argv[0]) == GL_FALSE) { - exit(1); - } - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/point-sprite.c b/progs/trivial/point-sprite.c deleted file mode 100644 index 16e6771514..0000000000 --- a/progs/trivial/point-sprite.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - -#define SIZE 16 - { - GLubyte tex2d[SIZE][SIZE][3]; - GLint s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { -#if 1 - tex2d[t][s][0] = (s < SIZE/2) ? 0 : 255; - tex2d[t][s][1] = (t < SIZE/2) ? 0 : 255; - tex2d[t][s][2] = 0; -#else - tex2d[t][s][0] = s*255/(SIZE-1); - tex2d[t][s][1] = t*255/(SIZE-1); - tex2d[t][s][2] = 0; -#endif - } - } - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexImage2D(GL_TEXTURE_2D, 0, 3, SIZE, SIZE, 0, - GL_RGB, GL_UNSIGNED_BYTE, tex2d); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glEnable(GL_TEXTURE_2D); - } - - glEnable(GL_POINT_SPRITE); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glPointSize(16.0); - - glBegin(GL_POINTS); - glColor3f(1,0,0); - glVertex3f( 0.6, -0.6, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.6, 0.6, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.6, 0.6, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.6, -0.6, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/point-wide-smooth.c b/progs/trivial/point-wide-smooth.c deleted file mode 100644 index 752cb8aee3..0000000000 --- a/progs/trivial/point-wide-smooth.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glPointSize(8.0); - - glEnable(GL_POINT_SMOOTH); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - glBegin(GL_POINTS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/point-wide.c b/progs/trivial/point-wide.c deleted file mode 100644 index 3b00ee9e50..0000000000 --- a/progs/trivial/point-wide.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glDisable(GL_DEPTH_TEST); - - glPointSize(8.0); - - glBegin(GL_POINTS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/point.c b/progs/trivial/point.c deleted file mode 100644 index 8f5299cf6b..0000000000 --- a/progs/trivial/point.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_POINTS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/poly-flat-clip.c b/progs/trivial/poly-flat-clip.c deleted file mode 100644 index 2a968bed40..0000000000 --- a/progs/trivial/poly-flat-clip.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - - glBegin(GL_POLYGON); - glColor3f(1,0,0); - glVertex3f( 0, 0, -30.0); - glColor3f(1,1,0); - glVertex3f( 1.3, 1.1, -30.0); - glColor3f(1,0,1); - glVertex3f(-.9, .9, -30.0); - glColor3f(0,1,1); - glVertex3f(-1.1, -1.3, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/poly-flat-unfilled-clip.c b/progs/trivial/poly-flat-unfilled-clip.c deleted file mode 100644 index 89f4e0656a..0000000000 --- a/progs/trivial/poly-flat-unfilled-clip.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_LINE); - glLineWidth(4.0); - - - glBegin(GL_POLYGON); - glColor3f(1,0,0); - glVertex3f( 0, 0, -30.0); - glColor3f(1,1,0); - glVertex3f( 1.3, 1.1, -30.0); - glColor3f(1,0,1); - glVertex3f(-.9, .9, -30.0); - glColor3f(0,1,1); - glVertex3f(-1.1, -1.3, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/poly-flat.c b/progs/trivial/poly-flat.c deleted file mode 100644 index 33c2e04e0f..0000000000 --- a/progs/trivial/poly-flat.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - - glBegin(GL_POLYGON); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/poly-unfilled.c b/progs/trivial/poly-unfilled.c deleted file mode 100644 index c8c0d7a9e3..0000000000 --- a/progs/trivial/poly-unfilled.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glBegin(GL_POLYGON); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/poly.c b/progs/trivial/poly.c deleted file mode 100644 index 964eb42d78..0000000000 --- a/progs/trivial/poly.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_POLYGON); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-clip-all-vertices.c b/progs/trivial/quad-clip-all-vertices.c deleted file mode 100644 index 7712d8ca5b..0000000000 --- a/progs/trivial/quad-clip-all-vertices.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 1.9, -1.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 1.9, 1.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-1.9, 1.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-1.9, -1.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-clip-nearplane.c b/progs/trivial/quad-clip-nearplane.c deleted file mode 100644 index 9380e4f9ae..0000000000 --- a/progs/trivial/quad-clip-nearplane.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -float Z = -6; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - fprintf(stderr, "Press z/Z to translate quad\n"); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -1.0, 1.0, 5, 100.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - switch (key) { - case 'z': - Z += 0.5; - break; - case 'Z': - Z -= 0.5; - break; - case 27: - exit(1); - default: - return; - } - printf("Z = %f\n", Z); - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glPushMatrix(); - glTranslatef(0, -0.5, Z); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( -0.8, 0, -4.0); - glColor3f(1,1,0); - glVertex3f( 0.8, 0, -4.0); - glColor3f(1,0,1); - glVertex3f( 0.8, 0, 4.0); - glColor3f(0,1,1); - glVertex3f( -0.8, 0, 4.0); - glEnd(); - - glPopMatrix(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); - glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-clip.c b/progs/trivial/quad-clip.c deleted file mode 100644 index 2847c9f960..0000000000 --- a/progs/trivial/quad-clip.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-1.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-degenerate.c b/progs/trivial/quad-degenerate.c deleted file mode 100644 index 85e129d4be..0000000000 --- a/progs/trivial/quad-degenerate.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-flat.c b/progs/trivial/quad-flat.c deleted file mode 100644 index bed98e31a4..0000000000 --- a/progs/trivial/quad-flat.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - if (1) { - glBegin(GL_LINES); - glColor3f(1,0,0); - glVertex3f( 0.95, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.95, 0.9, -30.0); - glEnd(); - } - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-offset-factor.c b/progs/trivial/quad-offset-factor.c deleted file mode 100644 index 1fc57a54ae..0000000000 --- a/progs/trivial/quad-offset-factor.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(1.0, 1.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void quad( float half ) -{ - glBegin(GL_QUADS); - glVertex3f( half/9.0, -half/9.0, -25.0 + half); - glVertex3f( half/9.0, half/9.0, -25.0 + half); - glVertex3f(-half/9.0, half/9.0, -25.0 - half); - glVertex3f(-half/9.0, -half/9.0, -25.0 - half); - glEnd(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glEnable(GL_DEPTH_TEST); - - /* red: offset back */ - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(1, 0); - glColor3f(1,0,0); - quad(9); - - /* green: no offset */ - glDisable(GL_POLYGON_OFFSET_FILL); - glColor3f(0,1,0); - quad(6); - - /* black: offset zero, should not be visible because of z test */ - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(0, 0); - glColor3f(0,0,0); - quad(6); - - /* blue: offset forward */ - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(-1, 0); - glColor3f(0,0,1); - quad(3); - - glDisable(GL_POLYGON_OFFSET_FILL); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA | GLUT_DEPTH; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-offset-unfilled.c b/progs/trivial/quad-offset-unfilled.c deleted file mode 100644 index 62f50fb98c..0000000000 --- a/progs/trivial/quad-offset-unfilled.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(1.0, 1.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glEnable(GL_DEPTH_TEST); - - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - - - - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(1, 0); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -10.0); - glVertex3f( 0.9, 0.9, -10.0); - glVertex3f(-0.9, 0.9, -40.0); - glVertex3f(-0.9, -0.9, -40.0); - glEnd(); - - glDisable(GL_POLYGON_OFFSET_FILL); - - glBegin(GL_QUADS); - glColor3f(0,1,0); - glVertex3f( 0.6, -0.6, -15.0); - glVertex3f( 0.6, 0.6, -15.0); - glVertex3f(-0.6, 0.6, -35.0); - glVertex3f(-0.6, -0.6, -35.0); - glEnd(); - - glEnable(GL_POLYGON_OFFSET_LINE); - glPolygonOffset(-1, 0); - - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glBegin(GL_QUADS); - glColor3f(0,0,1); - glVertex3f( 0.3, -0.3, -20.0); - glVertex3f( 0.3, 0.3, -20.0); - glVertex3f(-0.3, 0.3, -30.0); - glVertex3f(-0.3, -0.3, -30.0); - glEnd(); - - - glDisable(GL_POLYGON_OFFSET_FILL); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA | GLUT_DEPTH; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-offset-units.c b/progs/trivial/quad-offset-units.c deleted file mode 100644 index 1ac2338692..0000000000 --- a/progs/trivial/quad-offset-units.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(1.0, 1.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.2, 1.2, -1.2, 1.2, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - switch (key) { - case 27: - exit(1); - default: - break; - } - - glutPostRedisplay(); -} - -static void quad( float half ) -{ - glBegin(GL_QUADS); - glVertex3f( half/9.0, -half/9.0, -25.0 + half); - glVertex3f( half/9.0, half/9.0, -25.0 + half); - glVertex3f(-half/9.0, half/9.0, -25.0 - half); - glVertex3f(-half/9.0, -half/9.0, -25.0 - half); - glEnd(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glEnable(GL_DEPTH_TEST); - - /* red: offset back */ - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(0, 4); - glColor3f(1,0,0); - quad(9); - - /* black: no offset */ - glDisable(GL_POLYGON_OFFSET_FILL); - glColor3f(0,0,0); - quad(6); - - /* green: offset 0 (this should obscure the black quad) */ - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(0, 0); - glDepthFunc( GL_EQUAL ); - glColor3f(0,1,0); - quad(6); - - /* blue: offset forward */ - glDepthFunc( GL_LESS ); - glPolygonOffset(0, -4); - glColor3f(0,0,1); - quad(3); - - glDisable(GL_POLYGON_OFFSET_FILL); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA | GLUT_DEPTH; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-tex-2d.c b/progs/trivial/quad-tex-2d.c deleted file mode 100644 index 8a886ef578..0000000000 --- a/progs/trivial/quad-tex-2d.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - -static GLenum Target = GL_TEXTURE_2D; -static GLenum Filter = GL_NEAREST; -GLenum doubleBuffer; -static float Rot = 0; -static int win = 0; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - -#define SIZE 32 - { - GLubyte tex2d[SIZE][SIZE][3]; - GLint s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { -#if 0 - tex2d[t][s][0] = (s < SIZE/2) ? 0 : 255; - tex2d[t][s][1] = (t < SIZE/2) ? 0 : 255; - tex2d[t][s][2] = 0; -#else - tex2d[t][s][0] = s*255/(SIZE-1); - tex2d[t][s][1] = t*255/(SIZE-1); - tex2d[t][s][2] = 0; -#endif - } - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - if (Target == GL_TEXTURE_1D) - glTexImage1D(Target, 0, 3, SIZE, 0, GL_RGB, GL_UNSIGNED_BYTE, tex2d); - else - glTexImage2D(Target, 0, 3, SIZE, SIZE, 0, - GL_RGB, GL_UNSIGNED_BYTE, tex2d); - - glEnable(Target); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(Target, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(Target, GL_TEXTURE_MIN_FILTER, Filter); - glTexParameterf(Target, GL_TEXTURE_MAG_FILTER, Filter); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - } -} - -static void Reshape(int width, int height) -{ - glViewport(0, 0, (GLint)width, (GLint)height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); -#if 0 - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); -#else - glFrustum(-1, 1, -1, 1, 10, 20); -#endif - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0, 0, -15); -} - -static void Key(unsigned char key, int x, int y) -{ - switch (key) { - case 'r': - Rot += 10.0; - break; - case 'R': - Rot -= 10.0; - break; - case 27: - glutDestroyWindow(win); - exit(0); - default: - return; - } - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glPushMatrix(); - glRotatef(Rot, 0, 1, 0); - - glBegin(GL_QUADS); - glTexCoord2f(1,0); - glVertex3f( 0.9, -0.9, 0.0); - glTexCoord2f(1,1); - glVertex3f( 0.9, 0.9, 0.0); - glTexCoord2f(0,1); - glVertex3f(-0.9, 0.9, 0.0); - glTexCoord2f(0,0); - glVertex3f(-0.9, -0.9, 0.0); - glEnd(); - - glPopMatrix(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - win = glutCreateWindow(*argv); - if (!win) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-tex-3d.c b/progs/trivial/quad-tex-3d.c deleted file mode 100644 index d05131d3b8..0000000000 --- a/progs/trivial/quad-tex-3d.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - -GLfloat z= 0; -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - -#define SIZE 16 - { - GLubyte tex3d[SIZE][SIZE][SIZE][3]; - GLint r, s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { - for (r = 0; r < SIZE; r++) { -#if 0 - tex3d[r][t][s][0] = (s < SIZE/2) ? 0 : 255; - tex3d[r][t][s][1] = (t < SIZE/2) ? 0 : 255; - tex3d[r][t][s][2] = (r < SIZE/2) ? 0 : 255; -#else - tex3d[r][t][s][0] = s*255/(SIZE-1); - tex3d[r][t][s][1] = t*255/(SIZE-1); - tex3d[r][t][s][2] = r*255/(SIZE-1); -#endif - } - } - } - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexImage3D(GL_TEXTURE_3D, 0, 3, SIZE, SIZE, SIZE, 0, - GL_RGB, GL_UNSIGNED_BYTE, tex3d); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glEnable(GL_TEXTURE_3D); - } - -} - -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 ' ': - z += 1.0/SIZE; - break; - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - fprintf(stderr, "z: %f\n", z); - - glBegin(GL_QUADS); - glTexCoord3f(1,0,z); - glVertex3f( 0.9, -0.9, -30.0); - glTexCoord3f(1,1,z); - glVertex3f( 0.9, 0.9, -30.0); - glTexCoord3f(0,1,z); - glVertex3f(-0.9, 0.9, -30.0); - glTexCoord3f(0,0,z); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-tex-alpha.c b/progs/trivial/quad-tex-alpha.c deleted file mode 100644 index 9db6792fad..0000000000 --- a/progs/trivial/quad-tex-alpha.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - -#define SIZE 16 - { - GLubyte tex2d[SIZE][SIZE][4]; - GLint s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { - tex2d[t][s][0] = (s < SIZE/2) ? 0 : 255; - tex2d[t][s][1] = (t < SIZE/2) ? 0 : 255; - tex2d[t][s][2] = 0; - tex2d[t][s][3] = ((t^s) & 3) * 63; - } - } - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexImage2D(GL_TEXTURE_2D, 0, 4, SIZE, SIZE, 0, - GL_RGBA, GL_UNSIGNED_BYTE, tex2d); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glEnable(GL_TEXTURE_2D); - } -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glDisable(GL_DEPTH_TEST); - glDisable(GL_STENCIL_TEST); - glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_GEQUAL, 0.5); - - glBegin(GL_QUADS); - glTexCoord2f(1,0); - glVertex3f( 0.9, -0.9, -30.0); - glTexCoord2f(1,1); - glVertex3f( 0.9, 0.9, -30.0); - glTexCoord2f(0,1); - glVertex3f(-0.9, 0.9, -30.0); - glTexCoord2f(0,0); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-tex-pbo.c b/progs/trivial/quad-tex-pbo.c deleted file mode 100644 index b7aa1db436..0000000000 --- a/progs/trivial/quad-tex-pbo.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <GL/glew.h> - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - -GLenum doubleBuffer; - -static GLuint DrawPBO; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - -#define SIZE 16 - { - GLubyte tex2d[SIZE][SIZE][4]; - GLint s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { - /* bgra: - */ - tex2d[t][s][0] = 0x30; - tex2d[t][s][1] = t*255/(SIZE-1); - tex2d[t][s][2] = s*255/(SIZE-1); - tex2d[t][s][3] = 0xff; - } - } - - - /* put image into DrawPBO */ - glGenBuffersARB(1, &DrawPBO); - glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, DrawPBO); - glBufferDataARB(GL_PIXEL_PACK_BUFFER_EXT, - SIZE * SIZE * 4, tex2d, GL_STATIC_DRAW); - glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, 0); - - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SIZE, SIZE, 0, - GL_BGRA, GL_UNSIGNED_BYTE, NULL); - glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glEnable(GL_TEXTURE_2D); - } - -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUADS); - glTexCoord2f(1,0); - glVertex3f( 0.9, -0.9, -30.0); - glTexCoord2f(1,1); - glVertex3f( 0.9, 0.9, -30.0); - glTexCoord2f(0,1); - glVertex3f(-0.9, 0.9, -30.0); - glTexCoord2f(0,0); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-tex-sub.c b/progs/trivial/quad-tex-sub.c deleted file mode 100644 index 5620dbc6f8..0000000000 --- a/progs/trivial/quad-tex-sub.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - -#define SIZE 16 -GLenum doubleBuffer; -GLint line = 0; - -static void MakeImage() -{ - GLubyte tex2d[SIZE][SIZE][3]; - GLint s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { - tex2d[t][s][0] = s*255/(SIZE-1); - tex2d[t][s][1] = t*255/(SIZE-1); - tex2d[t][s][2] = 0*255/(SIZE-1); - } - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, - SIZE, SIZE, - 0, - GL_RGB, GL_UNSIGNED_BYTE, tex2d); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glEnable(GL_TEXTURE_2D); -} - -static void UpdateLine() -{ - GLubyte tex[SIZE][3]; - GLubyte b = 0; - GLint s, t; - - t = line % SIZE; - if (line % (SIZE * 2) < SIZE) - b = 255; - else - b = 0; - - for (s = 0; s < SIZE; s++) { - tex[s][0] = s*255/(SIZE-1); - tex[s][1] = t*255/(SIZE-1); - tex[s][2] = b; - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexSubImage2D(GL_TEXTURE_2D, 0, - 0, t, - SIZE, 1, - GL_RGB, GL_UNSIGNED_BYTE, tex); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); -} - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - MakeImage(); - UpdateLine(); - line++; -} - -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: - UpdateLine(); - line++; - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUADS); - glTexCoord2f(1,0); - glVertex3f( 0.9, -0.9, -30.0); - glTexCoord2f(1,1); - glVertex3f( 0.9, 0.9, -30.0); - glTexCoord2f(0,1); - glVertex3f(-0.9, 0.9, -30.0); - glTexCoord2f(0,0); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); - glutInitWindowSize(250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-unfilled-clip.c b/progs/trivial/quad-unfilled-clip.c deleted file mode 100644 index d2e8718775..0000000000 --- a/progs/trivial/quad-unfilled-clip.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-1.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-unfilled-stipple.c b/progs/trivial/quad-unfilled-stipple.c deleted file mode 100644 index 8c1737e675..0000000000 --- a/progs/trivial/quad-unfilled-stipple.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glEnable(GL_LINE_STIPPLE); - glLineStipple( 5, 0xfffe ); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,1); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,0); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,0,0); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad-unfilled.c b/progs/trivial/quad-unfilled.c deleted file mode 100644 index b756449d7a..0000000000 --- a/progs/trivial/quad-unfilled.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quad.c b/progs/trivial/quad.c deleted file mode 100644 index 582de783d5..0000000000 --- a/progs/trivial/quad.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quads.c b/progs/trivial/quads.c deleted file mode 100644 index de7854a255..0000000000 --- a/progs/trivial/quads.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUADS); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - - glColor3f(1,1,1); - glVertex3f( 0.1, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f( 0.1, -0.9, -30.0); - - if (0) { - glEnd(); - glFlush(); - glBegin(GL_QUADS); - } - - glColor3f(0,1,0); - glVertex3f(-0.1, -0.9, -30.0); - glColor3f(1,0,0); - glVertex3f(-0.1, 0.9, -30.0); - - - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quadstrip-clip.c b/progs/trivial/quadstrip-clip.c deleted file mode 100644 index 4cea81a45d..0000000000 --- a/progs/trivial/quadstrip-clip.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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); - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUAD_STRIP); - glColor3f(1,1,1); - glVertex3f( 1.9, -0.9, -30.0); - glVertex3f( 0.9, 0.9, -30.0); - - glColor3f(1,0,0); - glVertex3f( 0.1, -0.8, -30.0); - glVertex3f( 0.1, 0.8, -30.0); - - glColor3f(0,1,0); - glVertex3f(-0.1, -0.9, -30.0); - glVertex3f(-0.1, 0.9, -30.0); - - glColor3f(0,0,0); - glVertex3f(-0.9, -0.8, -30.0); - glVertex3f(-0.9, 0.8, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quadstrip-cont.c b/progs/trivial/quadstrip-cont.c deleted file mode 100644 index 44412698dc..0000000000 --- a/progs/trivial/quadstrip-cont.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUAD_STRIP); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - - glColor3f(1,0,0); - glVertex3f( 0.1, -0.8, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.1, 0.8, -30.0); - - glColor3f(0,1,1); - glVertex3f(-0.1, -0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.1, 0.9, -30.0); - - glColor3f(0,1,1); - glVertex3f(-0.9, -0.8, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.8, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static void -idle(void) -{ - glutPostRedisplay(); -} - - -static void -visible(int vis) -{ - if (vis == GLUT_VISIBLE) - glutIdleFunc(idle); - else - glutIdleFunc(NULL); -} - - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutVisibilityFunc(visible); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quadstrip-flat.c b/progs/trivial/quadstrip-flat.c deleted file mode 100644 index 0e0b3b49fa..0000000000 --- a/progs/trivial/quadstrip-flat.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - glBegin(GL_QUAD_STRIP); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - - glColor3f(1,0,0); - glVertex3f( 0.1, -0.8, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.1, 0.8, -30.0); - - glColor3f(0,1,1); - glVertex3f(-0.1, -0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.1, 0.9, -30.0); - - glColor3f(0,1,1); - glVertex3f(-0.9, -0.8, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.8, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/quadstrip.c b/progs/trivial/quadstrip.c deleted file mode 100644 index 1be815fb8c..0000000000 --- a/progs/trivial/quadstrip.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_QUAD_STRIP); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - - glColor3f(1,0,0); - glVertex3f( 0.1, -0.8, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.1, 0.8, -30.0); - - glColor3f(0,1,1); - glVertex3f(-0.1, -0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.1, 0.9, -30.0); - - glColor3f(0,1,1); - glVertex3f(-0.9, -0.8, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.8, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/readpixels.c b/progs/trivial/readpixels.c deleted file mode 100644 index b063f17956..0000000000 --- a/progs/trivial/readpixels.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * glRead/DrawPixels test - */ - - -#include <GL/glew.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - -static int Width = 250, Height = 250; -static GLfloat Zoom = 1.0; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - glClearColor(0.3, 0.1, 0.3, 0.0); -} - -static void Reshape(int width, int height) -{ - Width = width / 2; - Height = height; - /* draw on left half (we'll read that area) */ - glViewport(0, 0, Width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - switch (key) { - case 27: - exit(0); - default: - break; - } - glutPostRedisplay(); -} - -static void Draw(void) -{ - GLfloat *image = (GLfloat *) malloc(Width * Height * 4 * sizeof(GLfloat)); - - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(.8,0,0); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.0, 0.9, -30.0); - glEnd(); - - glBegin(GL_QUADS); - glColor3f(1, 1, 1); - glVertex2f(-1.0, -1.0); - glVertex2f(-0.9, -1.0); - glVertex2f(-0.9, -0.9); - glVertex2f(-1.0, -0.9); - glEnd(); - - glReadPixels(0, 0, Width, Height, GL_RGBA, GL_FLOAT, image); - printf("Pixel(0,0) = %f, %f, %f, %f\n", - image[0], image[1], image[2], image[3]); - /* draw to right half of window */ - glWindowPos2iARB(Width, 0); - glPixelZoom(Zoom, Zoom); - glDrawPixels(Width, Height, GL_RGBA, GL_FLOAT, image); - free(image); - - glutSwapBuffers(); -} - -int main(int argc, char **argv) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(Width*2, Height); - glutInitDisplayMode(GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE); - if (glutCreateWindow(argv[0]) == GL_FALSE) { - exit(1); - } - - if (argc > 1) - Zoom = atof(argv[1]); - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/sub-tex.c b/progs/trivial/sub-tex.c deleted file mode 100644 index 0b8bb28182..0000000000 --- a/progs/trivial/sub-tex.c +++ /dev/null @@ -1,137 +0,0 @@ -/** - * Draw a series of textured quads after each quad, use glTexSubImage() - * to change one row of the texture image. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - - -static GLint Win = 0; -static GLuint Tex = 0; - - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fflush(stderr); - - glGenTextures(1, &Tex); - glBindTexture(GL_TEXTURE_2D, Tex); - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); -} - - -static void Reshape(int width, int height) -{ - float ar = (float) width / height; - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-ar, ar, -1.0, 1.0, -1.0, 1.0); - glMatrixMode(GL_MODELVIEW); -} - - -static void Key(unsigned char key, int x, int y) -{ - if (key == 27) { - glDeleteTextures(1, &Tex); - glutDestroyWindow(Win); - exit(1); - } - glutPostRedisplay(); -} - - -static void Draw(void) -{ - GLubyte tex[16][16][4]; - GLubyte row[16][4]; - int i, j; - - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j++) { - if ((i + j) & 1) { - tex[i][j][0] = 128; - tex[i][j][1] = 128; - tex[i][j][2] = 128; - tex[i][j][3] = 255; - } - else { - tex[i][j][0] = 255; - tex[i][j][1] = 255; - tex[i][j][2] = 255; - tex[i][j][3] = 255; - } - } - } - - for (i = 0; i < 16; i++) { - row[i][0] = 255; - row[i][1] = 0; - row[i][2] = 0; - row[i][3] = 255; - } - - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, - GL_RGBA, GL_UNSIGNED_BYTE, tex); - glEnable(GL_TEXTURE_2D); - - glClear(GL_COLOR_BUFFER_BIT); - - for (i = 0; i < 9; i++) { - - glPushMatrix(); - glTranslatef(-4.0 + i, 0, 0); - glScalef(0.5, 0.5, 1.0); - - glBegin(GL_QUADS); - glTexCoord2f(1,0); - glVertex3f( 0.9, -0.9, 0.0); - glTexCoord2f(1,1); - glVertex3f( 0.9, 0.9, 0.0); - glTexCoord2f(0,1); - glVertex3f(-0.9, 0.9, 0.0); - glTexCoord2f(0,0); - glVertex3f(-0.9, -0.9, 0.0); - glEnd(); - - glPopMatrix(); - - /* replace a row of the texture image with red texels */ - if (i * 2 < 16) - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, i*2, 16, 1, - GL_RGBA, GL_UNSIGNED_BYTE, row); - } - - - glutSwapBuffers(); -} - - -int main(int argc, char **argv) -{ - glutInit(&argc, argv); - glutInitWindowSize(900, 200); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); - Win = glutCreateWindow(*argv); - if (!Win) { - exit(1); - } - glewInit(); - Init(); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tex-quads.c b/progs/trivial/tex-quads.c deleted file mode 100644 index 626e178b87..0000000000 --- a/progs/trivial/tex-quads.c +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Draw a series of quads, each with a different texture. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - -#define NUM_TEX 10 - -static GLint Win = 0; -static GLuint Tex[NUM_TEX]; - - -static void Init(void) -{ - int i; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fflush(stderr); - - glGenTextures(NUM_TEX, Tex); - - for (i = 0; i < NUM_TEX; i++) { - glBindTexture(GL_TEXTURE_2D, Tex[i]); - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - } -} - - -static void Reshape(int width, int height) -{ - float ar = (float) width / height; - glViewport(0, 0, width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-ar, ar, -1.0, 1.0, -1.0, 1.0); - glMatrixMode(GL_MODELVIEW); -} - - -static void Key(unsigned char key, int x, int y) -{ - if (key == 27) { - glDeleteTextures(NUM_TEX, Tex); - glutDestroyWindow(Win); - exit(1); - } - glutPostRedisplay(); -} - - -static void Draw(void) -{ - GLubyte tex[16][16][4]; - int t, i, j; - - for (t = 0; t < NUM_TEX; t++) { - - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j++) { - if (i < t) { - /* red row */ - tex[i][j][0] = 255; - tex[i][j][1] = 0; - tex[i][j][2] = 0; - tex[i][j][3] = 255; - } - else if ((i + j) & 1) { - tex[i][j][0] = 128; - tex[i][j][1] = 128; - tex[i][j][2] = 128; - tex[i][j][3] = 255; - } - else { - tex[i][j][0] = 255; - tex[i][j][1] = 255; - tex[i][j][2] = 255; - tex[i][j][3] = 255; - } - } - } - - glBindTexture(GL_TEXTURE_2D, Tex[t]); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, - GL_RGBA, GL_UNSIGNED_BYTE, tex); - } - - glEnable(GL_TEXTURE_2D); - - glClear(GL_COLOR_BUFFER_BIT); - - for (i = 0; i < NUM_TEX; i++) { - - glBindTexture(GL_TEXTURE_2D, Tex[i]); - - glPushMatrix(); - glTranslatef(-4.0 + i, 0, 0); - glScalef(0.5, 0.5, 1.0); - - glBegin(GL_QUADS); - glTexCoord2f(1,0); - glVertex3f( 0.9, -0.9, 0.0); - glTexCoord2f(1,1); - glVertex3f( 0.9, 0.9, 0.0); - glTexCoord2f(0,1); - glVertex3f(-0.9, 0.9, 0.0); - glTexCoord2f(0,0); - glVertex3f(-0.9, -0.9, 0.0); - glEnd(); - - glPopMatrix(); - } - - - glutSwapBuffers(); -} - - -int main(int argc, char **argv) -{ - glutInit(&argc, argv); - glutInitWindowSize(900, 200); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); - Win = glutCreateWindow(*argv); - if (!Win) { - exit(1); - } - glewInit(); - Init(); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-alpha-tex.c b/progs/trivial/tri-alpha-tex.c deleted file mode 100644 index 853d564ae7..0000000000 --- a/progs/trivial/tri-alpha-tex.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - -#define SIZE 16 - { - GLubyte tex2d[SIZE][SIZE][4]; - GLint s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { - tex2d[t][s][0] = (s < SIZE/2) ? 0 : 255; - tex2d[t][s][1] = (t < SIZE/2) ? 0 : 255; - tex2d[t][s][2] = 0; - tex2d[t][s][3] = ((t^s) & 3) * 63; - } - } - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexImage2D(GL_TEXTURE_2D, 0, 4, SIZE, SIZE, 0, - GL_RGBA, GL_UNSIGNED_BYTE, tex2d); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glEnable(GL_TEXTURE_2D); - } -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glDisable(GL_DEPTH_TEST); - glDisable(GL_STENCIL_TEST); - glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_GEQUAL, 0.5); - - glBegin(GL_QUADS); - glTexCoord2f(1,0); - glVertex3f( 0.9, -0.9, -30.0); - glTexCoord2f(1,1); - glVertex3f( 0.9, 0.9, -30.0); - glTexCoord2f(0,1); - glVertex3f(-0.9, 0.9, -30.0); - glTexCoord2f(0,0); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); -#if 0 - glBegin(GL_TRIANGLES); - glColor4f(0,0,.7,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor4f(.8,0,0,.5); - glVertex3f( 0.9, 0.9, -30.0); - glColor4f(0,.9,0,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); -#endif - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-alpha.c b/progs/trivial/tri-alpha.c deleted file mode 100644 index bd1c88ecf8..0000000000 --- a/progs/trivial/tri-alpha.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glDisable(GL_DEPTH_TEST); - glDisable(GL_STENCIL_TEST); - glEnable(GL_ALPHA_TEST); - glAlphaFunc(GL_GEQUAL, 0.5); - - glBegin(GL_TRIANGLES); - glColor4f(0,0,.7,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor4f(.8,0,0,.5); - glVertex3f( 0.9, 0.9, -30.0); - glColor4f(0,.9,0,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-array-interleaved.c b/progs/trivial/tri-array-interleaved.c deleted file mode 100644 index 95de2056cf..0000000000 --- a/progs/trivial/tri-array-interleaved.c +++ /dev/null @@ -1,120 +0,0 @@ -/* Test rebasing */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -struct { - GLubyte color[4]; - GLfloat vert[3]; -} verts[] = { - - { { 0x00, 0x00, 0xff, 0x00 }, - { 0.9, -0.9, 0.0 } }, - - { { 0x00, 0xff, 0x00, 0x00 }, - { 0.9, 0.9, 0.0 } }, - - { { 0xff, 0x00, 0x00, 0x00 }, - { -0.9, 0.9, 0.0 } }, - - { { 0xff, 0xff, 0xff, 0x00 }, - { -0.9, -0.9, 0.0 } }, -}; - -GLuint indices[] = { 1, 2, 3 }; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - glInterleavedArrays( GL_C4UB_V3F, sizeof(verts[0]), verts ); -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - /* Should have min_index == 1, maybe force a rebase: - */ - glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, indices ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-blend-color.c b/progs/trivial/tri-blend-color.c deleted file mode 100644 index 629b35c4ab..0000000000 --- a/progs/trivial/tri-blend-color.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClearColor(0.0, 0.0, 1.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_BLEND); - glBlendEquation(GL_FUNC_ADD); - glBlendColor(1.0, 0, 0, 0); - glBlendFunc(GL_CONSTANT_COLOR, GL_SRC_COLOR); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-blend-max.c b/progs/trivial/tri-blend-max.c deleted file mode 100644 index b173dab8ec..0000000000 --- a/progs/trivial/tri-blend-max.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 1993-1997, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * Permission to use, copy, modify, and distribute this software for - * any purpose and without fee is hereby granted, provided that the above - * copyright notice appear in all copies and that both the copyright notice - * and this permission notice appear in supporting documentation, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(R) is a registered trademark of Silicon Graphics, Inc. - */ - -/* - * alpha.c - * This program draws several overlapping filled polygons - * to demonstrate the effect order has on alpha blending results. - * Use the 't' key to toggle the order of drawing polygons. - */ -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - -static int leftFirst = GL_TRUE; - -/* Initialize alpha blending function. - */ -static void init(void) -{ - glBlendEquation (GL_MAX); - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glShadeModel (GL_FLAT); - glClearColor (1.0, 0.0, 0.0, 0.0); -} - -static void drawLeftTriangle(void) -{ - /* draw yellow triangle on LHS of screen */ - - glBegin (GL_TRIANGLES); - glColor4f(1.0, 1.0, 0.0, 0.75); - glVertex3f(0.1, 0.9, 0.0); - glVertex3f(0.1, 0.1, 0.0); - glVertex3f(0.7, 0.5, 0.0); - glEnd(); -} - -static void drawRightTriangle(void) -{ - /* draw cyan triangle on RHS of screen */ - - glEnable (GL_BLEND); - glBegin (GL_TRIANGLES); - glColor4f(0.0, 1.0, 1.0, 0.75); - glVertex3f(0.9, 0.9, 0.0); - glVertex3f(0.3, 0.5, 0.0); - glVertex3f(0.9, 0.1, 0.0); - glEnd(); - glDisable (GL_BLEND); -} - -static void display(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - if (leftFirst) { - drawLeftTriangle(); - drawRightTriangle(); - } - else { - drawRightTriangle(); - drawLeftTriangle(); - } - - glFlush(); -} - -static void reshape(int w, int h) -{ - glViewport(0, 0, (GLsizei) w, (GLsizei) h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - if (w <= h) - gluOrtho2D (0.0, 1.0, 0.0, 1.0*(GLfloat)h/(GLfloat)w); - else - gluOrtho2D (0.0, 1.0*(GLfloat)w/(GLfloat)h, 0.0, 1.0); -} - -/* ARGSUSED1 */ -static void keyboard(unsigned char key, int x, int y) -{ - switch (key) { - case 't': - case 'T': - leftFirst = !leftFirst; - glutPostRedisplay(); - break; - case 27: /* Escape key */ - exit(0); - break; - default: - break; - } -} - -/* Main Loop - * Open window with initial window size, title bar, - * RGBA display mode, and handle input events. - */ -int main(int argc, char** argv) -{ - glutInit(&argc, argv); - glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); - glutInitWindowSize (200, 200); - glutCreateWindow (argv[0]); - glewInit(); - init(); - glutReshapeFunc (reshape); - glutKeyboardFunc (keyboard); - glutDisplayFunc (display); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-blend-min.c b/progs/trivial/tri-blend-min.c deleted file mode 100644 index 629139acae..0000000000 --- a/progs/trivial/tri-blend-min.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 1993-1997, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * Permission to use, copy, modify, and distribute this software for - * any purpose and without fee is hereby granted, provided that the above - * copyright notice appear in all copies and that both the copyright notice - * and this permission notice appear in supporting documentation, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(R) is a registered trademark of Silicon Graphics, Inc. - */ - -/* - * alpha.c - * This program draws several overlapping filled polygons - * to demonstrate the effect order has on alpha blending results. - * Use the 't' key to toggle the order of drawing polygons. - */ -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - -static int leftFirst = GL_TRUE; - -/* Initialize alpha blending function. - */ -static void init(void) -{ - glBlendEquation (GL_MIN); - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glShadeModel (GL_FLAT); - glClearColor (1.0, 0.0, 0.0, 0.0); -} - -static void drawLeftTriangle(void) -{ - /* draw yellow triangle on LHS of screen */ - - glBegin (GL_TRIANGLES); - glColor4f(1.0, 1.0, 0.0, 0.75); - glVertex3f(0.1, 0.9, 0.0); - glVertex3f(0.1, 0.1, 0.0); - glVertex3f(0.7, 0.5, 0.0); - glEnd(); -} - -static void drawRightTriangle(void) -{ - /* draw cyan triangle on RHS of screen */ - - glEnable (GL_BLEND); - glBegin (GL_TRIANGLES); - glColor4f(0.0, 1.0, 1.0, 0.75); - glVertex3f(0.9, 0.9, 0.0); - glVertex3f(0.3, 0.5, 0.0); - glVertex3f(0.9, 0.1, 0.0); - glEnd(); - glDisable (GL_BLEND); -} - -static void display(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - if (leftFirst) { - drawLeftTriangle(); - drawRightTriangle(); - } - else { - drawRightTriangle(); - drawLeftTriangle(); - } - - glFlush(); -} - -static void reshape(int w, int h) -{ - glViewport(0, 0, (GLsizei) w, (GLsizei) h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - if (w <= h) - gluOrtho2D (0.0, 1.0, 0.0, 1.0*(GLfloat)h/(GLfloat)w); - else - gluOrtho2D (0.0, 1.0*(GLfloat)w/(GLfloat)h, 0.0, 1.0); -} - -/* ARGSUSED1 */ -static void keyboard(unsigned char key, int x, int y) -{ - switch (key) { - case 't': - case 'T': - leftFirst = !leftFirst; - glutPostRedisplay(); - break; - case 27: /* Escape key */ - exit(0); - break; - default: - break; - } -} - -/* Main Loop - * Open window with initial window size, title bar, - * RGBA display mode, and handle input events. - */ -int main(int argc, char** argv) -{ - glutInit(&argc, argv); - glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); - glutInitWindowSize (200, 200); - glutCreateWindow (argv[0]); - glewInit(); - init(); - glutReshapeFunc (reshape); - glutKeyboardFunc (keyboard); - glutDisplayFunc (display); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-blend-revsub.c b/progs/trivial/tri-blend-revsub.c deleted file mode 100644 index ef1e92c85d..0000000000 --- a/progs/trivial/tri-blend-revsub.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 1993-1997, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * Permission to use, copy, modify, and distribute this software for - * any purpose and without fee is hereby granted, provided that the above - * copyright notice appear in all copies and that both the copyright notice - * and this permission notice appear in supporting documentation, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(R) is a registered trademark of Silicon Graphics, Inc. - */ - -/* - * alpha.c - * This program draws several overlapping filled polygons - * to demonstrate the effect order has on alpha blending results. - * Use the 't' key to toggle the order of drawing polygons. - */ -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - -static int leftFirst = GL_TRUE; - -/* Initialize alpha blending function. - */ -static void init(void) -{ - glBlendEquation (GL_FUNC_REVERSE_SUBTRACT); - glBlendFunc (GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA); - glShadeModel (GL_FLAT); - glClearColor (1.0, 0.0, 0.0, 0.0); -} - -static void drawLeftTriangle(void) -{ - /* draw yellow triangle on LHS of screen */ - - glBegin (GL_TRIANGLES); - glColor4f(1.0, 1.0, 0.0, 0.75); - glVertex3f(0.1, 0.9, 0.0); - glVertex3f(0.1, 0.1, 0.0); - glVertex3f(0.7, 0.5, 0.0); - glEnd(); -} - -static void drawRightTriangle(void) -{ - /* draw cyan triangle on RHS of screen */ - - glEnable (GL_BLEND); - glBegin (GL_TRIANGLES); - glColor4f(0.0, 1.0, 1.0, 0.75); - glVertex3f(0.9, 0.9, 0.0); - glVertex3f(0.3, 0.5, 0.0); - glVertex3f(0.9, 0.1, 0.0); - glEnd(); - glDisable (GL_BLEND); -} - -static void display(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - if (leftFirst) { - drawLeftTriangle(); - drawRightTriangle(); - } - else { - drawRightTriangle(); - drawLeftTriangle(); - } - - glFlush(); -} - -static void reshape(int w, int h) -{ - glViewport(0, 0, (GLsizei) w, (GLsizei) h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - if (w <= h) - gluOrtho2D (0.0, 1.0, 0.0, 1.0*(GLfloat)h/(GLfloat)w); - else - gluOrtho2D (0.0, 1.0*(GLfloat)w/(GLfloat)h, 0.0, 1.0); -} - -/* ARGSUSED1 */ -static void keyboard(unsigned char key, int x, int y) -{ - switch (key) { - case 't': - case 'T': - leftFirst = !leftFirst; - glutPostRedisplay(); - break; - case 27: /* Escape key */ - exit(0); - break; - default: - break; - } -} - -/* Main Loop - * Open window with initial window size, title bar, - * RGBA display mode, and handle input events. - */ -int main(int argc, char** argv) -{ - glutInit(&argc, argv); - glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); - glutInitWindowSize (200, 200); - glutCreateWindow (argv[0]); - glewInit(); - init(); - glutReshapeFunc (reshape); - glutKeyboardFunc (keyboard); - glutDisplayFunc (display); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-blend-sub.c b/progs/trivial/tri-blend-sub.c deleted file mode 100644 index 3c560ae6ef..0000000000 --- a/progs/trivial/tri-blend-sub.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 1993-1997, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * Permission to use, copy, modify, and distribute this software for - * any purpose and without fee is hereby granted, provided that the above - * copyright notice appear in all copies and that both the copyright notice - * and this permission notice appear in supporting documentation, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(R) is a registered trademark of Silicon Graphics, Inc. - */ - -/* - * alpha.c - * This program draws several overlapping filled polygons - * to demonstrate the effect order has on alpha blending results. - * Use the 't' key to toggle the order of drawing polygons. - */ -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - -static int leftFirst = GL_TRUE; - -/* Initialize alpha blending function. - */ -static void init(void) -{ - glBlendEquation (GL_FUNC_SUBTRACT); - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glShadeModel (GL_FLAT); - glClearColor (1.0, 0.0, 0.0, 0.0); -} - -static void drawLeftTriangle(void) -{ - /* draw yellow triangle on LHS of screen */ - - glBegin (GL_TRIANGLES); - glColor4f(1.0, 1.0, 0.0, 0.75); - glVertex3f(0.1, 0.9, 0.0); - glVertex3f(0.1, 0.1, 0.0); - glVertex3f(0.7, 0.5, 0.0); - glEnd(); -} - -static void drawRightTriangle(void) -{ - /* draw cyan triangle on RHS of screen */ - - glEnable (GL_BLEND); - glBegin (GL_TRIANGLES); - glColor4f(0.0, 1.0, 1.0, 0.75); - glVertex3f(0.9, 0.9, 0.0); - glVertex3f(0.3, 0.5, 0.0); - glVertex3f(0.9, 0.1, 0.0); - glEnd(); - glDisable (GL_BLEND); -} - -static void display(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - if (leftFirst) { - drawLeftTriangle(); - drawRightTriangle(); - } - else { - drawRightTriangle(); - drawLeftTriangle(); - } - - glFlush(); -} - -static void reshape(int w, int h) -{ - glViewport(0, 0, (GLsizei) w, (GLsizei) h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - if (w <= h) - gluOrtho2D (0.0, 1.0, 0.0, 1.0*(GLfloat)h/(GLfloat)w); - else - gluOrtho2D (0.0, 1.0*(GLfloat)w/(GLfloat)h, 0.0, 1.0); -} - -/* ARGSUSED1 */ -static void keyboard(unsigned char key, int x, int y) -{ - switch (key) { - case 't': - case 'T': - leftFirst = !leftFirst; - glutPostRedisplay(); - break; - case 27: /* Escape key */ - exit(0); - break; - default: - break; - } -} - -/* Main Loop - * Open window with initial window size, title bar, - * RGBA display mode, and handle input events. - */ -int main(int argc, char** argv) -{ - glutInit(&argc, argv); - glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); - glutInitWindowSize (200, 200); - glutCreateWindow (argv[0]); - glewInit(); - init(); - glutReshapeFunc (reshape); - glutKeyboardFunc (keyboard); - glutDisplayFunc (display); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-blend.c b/progs/trivial/tri-blend.c deleted file mode 100644 index f41be89b09..0000000000 --- a/progs/trivial/tri-blend.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 1993-1997, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * Permission to use, copy, modify, and distribute this software for - * any purpose and without fee is hereby granted, provided that the above - * copyright notice appear in all copies and that both the copyright notice - * and this permission notice appear in supporting documentation, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(R) is a registered trademark of Silicon Graphics, Inc. - */ - -/* - * alpha.c - * This program draws several overlapping filled polygons - * to demonstrate the effect order has on alpha blending results. - * Use the 't' key to toggle the order of drawing polygons. - */ -#include <GL/glut.h> -#include <stdlib.h> - -static int leftFirst = GL_TRUE; - -/* Initialize alpha blending function. - */ -static void init(void) -{ - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glShadeModel (GL_FLAT); - glClearColor (1.0, 0.0, 0.0, 0.0); -} - -static void drawLeftTriangle(void) -{ - /* draw yellow triangle on LHS of screen */ - - glBegin (GL_TRIANGLES); - glColor4f(1.0, 1.0, 0.0, 0.75); - glVertex3f(0.1, 0.9, 0.0); - glVertex3f(0.1, 0.1, 0.0); - glVertex3f(0.7, 0.5, 0.0); - glEnd(); -} - -static void drawRightTriangle(void) -{ - /* draw cyan triangle on RHS of screen */ - - glEnable (GL_BLEND); - glBegin (GL_TRIANGLES); - glColor4f(0.0, 1.0, 1.0, 0.75); - glVertex3f(0.9, 0.9, 0.0); - glVertex3f(0.3, 0.5, 0.0); - glVertex3f(0.9, 0.1, 0.0); - glEnd(); - glDisable (GL_BLEND); -} - -static void display(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - if (leftFirst) { - drawLeftTriangle(); - drawRightTriangle(); - } - else { - drawRightTriangle(); - drawLeftTriangle(); - } - - glFlush(); -} - -static void reshape(int w, int h) -{ - glViewport(0, 0, (GLsizei) w, (GLsizei) h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - if (w <= h) - gluOrtho2D (0.0, 1.0, 0.0, 1.0*(GLfloat)h/(GLfloat)w); - else - gluOrtho2D (0.0, 1.0*(GLfloat)w/(GLfloat)h, 0.0, 1.0); -} - -/* ARGSUSED1 */ -static void keyboard(unsigned char key, int x, int y) -{ - switch (key) { - case 't': - case 'T': - leftFirst = !leftFirst; - glutPostRedisplay(); - break; - case 27: /* Escape key */ - exit(0); - break; - default: - break; - } -} - -/* Main Loop - * Open window with initial window size, title bar, - * RGBA display mode, and handle input events. - */ -int main(int argc, char** argv) -{ - glutInit(&argc, argv); - glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_ALPHA); - glutInitWindowSize (200, 200); - glutCreateWindow (argv[0]); - init(); - glutReshapeFunc (reshape); - glutKeyboardFunc (keyboard); - glutDisplayFunc (display); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-clear.c b/progs/trivial/tri-clear.c deleted file mode 100644 index e52ed81bf4..0000000000 --- a/progs/trivial/tri-clear.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - -GLint Width = 250, Height = 250; - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glEnable(GL_SCISSOR_TEST); - glClearColor(1, 0, 1, 0); - glScissor(Width / 2, Height / 2, Width - Width / 2, Height - Height / 2); - glClear(GL_COLOR_BUFFER_BIT); - glDisable(GL_SCISSOR_TEST); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize( Width, Height); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-clip.c b/progs/trivial/tri-clip.c deleted file mode 100644 index 3e3879c985..0000000000 --- a/progs/trivial/tri-clip.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -static GLenum doubleBuffer; -static GLfloat Xpos = 0, Ypos = 0; - - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - glutPostRedisplay(); -} - -static void -SpecialKey(int key, int x, int y) -{ - const GLfloat step = 0.25; - (void) x; - (void) y; - switch (key) { - case GLUT_KEY_UP: - Ypos += step; - break; - case GLUT_KEY_DOWN: - Ypos -= step; - break; - case GLUT_KEY_LEFT: - Xpos -= step; - break; - case GLUT_KEY_RIGHT: - Xpos += step; - break; - } - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glPushMatrix(); - glTranslatef(Xpos, Ypos, 0); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-1.9, 0.0, -30.0); - glEnd(); - - glPopMatrix(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutSpecialFunc(SpecialKey); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-cull-both.c b/progs/trivial/tri-cull-both.c deleted file mode 100644 index 809599d4a6..0000000000 --- a/progs/trivial/tri-cull-both.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - glCullFace(GL_FRONT_AND_BACK); - glEnable(GL_CULL_FACE); - -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - - - glBegin(GL_TRIANGLES); - glColor3f(.8,0,0); - glVertex3f( 0.93, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.93, 0.0, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.93, -0.8, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-cull.c b/progs/trivial/tri-cull.c deleted file mode 100644 index c71ad9a031..0000000000 --- a/progs/trivial/tri-cull.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - -static GLenum doubleBuffer; -static GLint cullmode = 0; -static GLenum front = GL_CCW; /* GL default */ - -static void cull(void) -{ - cullmode = (cullmode + 1) % 4; - if (cullmode == 0) { - glCullFace(GL_FRONT); - glEnable(GL_CULL_FACE); - printf("cull GL_FRONT\n"); - } - else if (cullmode == 1) { - glCullFace(GL_BACK); - glEnable(GL_CULL_FACE); - printf("cull GL_BACK\n"); - } - else if (cullmode == 2) { - glCullFace(GL_FRONT_AND_BACK); - glEnable(GL_CULL_FACE); - printf("cull GL_FRONT_AND_BACK\n"); - } - else { - glDisable(GL_CULL_FACE); - printf("cull none\n"); - } -} - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - glClearColor(0.0, 0.0, 1.0, 0.0); - cull(); -} - -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); - case 'c': - cull(); - break; - case 'f': - front = ((front == GL_CCW) ? GL_CW : GL_CCW); - glFrontFace(front); - printf("front face = %s\n", front == GL_CCW ? "GL_CCW" : "GL_CW"); - break; - default: - return; - } - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - /* CCW / front-facing */ - glColor3f(0,0,.7); - glVertex3f(-0.1, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f(-0.1, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - - /* CW / back-facing */ - glColor3f(0,0,.7); - glVertex3f( 0.1, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.1, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f( 0.9, 0.0, -30.0); - - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-dlist.c b/progs/trivial/tri-dlist.c deleted file mode 100644 index 62d0a965d8..0000000000 --- a/progs/trivial/tri-dlist.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; -GLint list; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - list = glGenLists(1); - glNewList(list, GL_COMPILE); - glBegin(GL_TRIANGLES); -/* glColor3f(0,0,.7); */ - glVertex3f( 0.9, -0.9, -30.0); -/* glColor3f(.8,0,0); */ - glVertex3f( 0.9, 0.9, -30.0); -/* glColor3f(0,.9,0); */ - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - glEndList(); -} - -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: - break; - } - - glutPostRedisplay(); -} - - - - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glColor3f(0,.9,0); - glCallList(list); - - glRotatef(45,0,0,1); - glColor3f(1,0,1); - glCallList(list); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-edgeflag.c b/progs/trivial/tri-edgeflag.c deleted file mode 100644 index 4c8736ad8c..0000000000 --- a/progs/trivial/tri-edgeflag.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - -static GLenum doubleBuffer; -static GLenum frontface = GL_CCW; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); -} - -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 'f': - frontface = (frontface == GL_CCW) ? GL_CW : GL_CCW; - glFrontFace(frontface); - break; - case 27: - exit(1); - default: - return; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_POINT); - - glBegin(GL_TRIANGLES); - glEdgeFlag(1); - glColor3f(0.3,0.3,.9); - glVertex3f( 0.9, -0.9, -0.0); - glEdgeFlag(0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glEdgeFlag(1); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-fbo-tex-mip.c b/progs/trivial/tri-fbo-tex-mip.c deleted file mode 100644 index 2e8fb74a00..0000000000 --- a/progs/trivial/tri-fbo-tex-mip.c +++ /dev/null @@ -1,259 +0,0 @@ -/* Framebuffer object test */ - - -#include <GL/glew.h> -#include <GL/glut.h> -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> - -/* For debug */ - - -static int Win = 0; -static int Width = 512, Height = 512; - -static GLenum TexTarget = GL_TEXTURE_2D; -static int TexWidth = 512, TexHeight = 512; - -static GLuint MyFB; -static GLuint TexObj; -static GLboolean Anim = GL_FALSE; -static GLfloat Rot = 0.0; -static GLuint TextureLevel = 4; /* which texture level to render to */ -static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */ - - -static void -CheckError(int line) -{ - GLenum err = glGetError(); - if (err) { - printf("GL Error 0x%x at line %d\n", (int) err, line); - } -} - - -static void -Idle(void) -{ - Rot = glutGet(GLUT_ELAPSED_TIME) * 0.1; - glutPostRedisplay(); -} - - -static void -RenderTexture(void) -{ - GLenum status; - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -15.0); - - if (1) { - /* draw to texture image */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - - status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { - printf("Framebuffer incomplete!!!\n"); - } - - glViewport(0, 0, - TexWidth / (1 << TextureLevel), - TexHeight / (1 << TextureLevel)); - glClearColor(0.5, 0.5, 1.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - - CheckError(__LINE__); - - glBegin(GL_POLYGON); - glColor3f(1, 0, 0); - glVertex2f(-1, -1); - glColor3f(0, 1, 0); - glVertex2f(1, -1); - glColor3f(0, 0, 1); - glVertex2f(0, 1); - glEnd(); - - /* Bind normal framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - } - else { - } - - CheckError(__LINE__); -} - - - -static void -Display(void) -{ - float ar = (float) Width / (float) Height; - - RenderTexture(); - - /* draw textured quad in the window */ - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -7.0); - - glViewport(0, 0, Width, Height); - - glClearColor(0.25, 0.25, 0.25, 0); - glClear(GL_COLOR_BUFFER_BIT); - - glPushMatrix(); - glRotatef(Rot, 0, 1, 0); - glEnable(TexTarget); - glBindTexture(TexTarget, TexObj); - - { - glBegin(GL_POLYGON); - glColor3f(0.25, 0.25, 0.25); - glTexCoord2f(0, 0); - glVertex2f(-1, -1); - glTexCoord2f(1, 0); - glVertex2f(1, -1); - glColor3f(1.0, 1.0, 1.0); - glTexCoord2f(1, 1); - glVertex2f(1, 1); - glTexCoord2f(0, 1); - glVertex2f(-1, 1); - glEnd(); - } - - glPopMatrix(); - glDisable(TexTarget); - - glutSwapBuffers(); - CheckError(__LINE__); -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - Width = width; - Height = height; -} - - -static void -CleanUp(void) -{ - glDeleteFramebuffersEXT(1, &MyFB); - - glDeleteTextures(1, &TexObj); - - glutDestroyWindow(Win); - - exit(0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 's': - Rot += 2.0; - break; - case 27: - CleanUp(); - break; - } - glutPostRedisplay(); -} - - -static void -Init(int argc, char *argv[]) -{ - if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { - printf("GL_EXT_framebuffer_object not found!\n"); - exit(0); - } - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - - /* Make texture object/image */ - glGenTextures(1, &TexObj); - glBindTexture(TexTarget, TexObj); - glTexParameteri(TexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(TexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(TexTarget, GL_TEXTURE_BASE_LEVEL, TextureLevel); - glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel); - - glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glTexImage2D(TexTarget, TextureLevel, TexIntFormat, - TexWidth / (1 << TextureLevel), TexHeight / (1 << TextureLevel), 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - - - - /* gen framebuffer id, delete it, do some assertions, just for testing */ - glGenFramebuffersEXT(1, &MyFB); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - assert(glIsFramebufferEXT(MyFB)); - - - CheckError(__LINE__); - - /* Render color to texture */ - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - TexTarget, TexObj, TextureLevel); - - - - CheckError(__LINE__); - - /* bind regular framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - - -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(Width, Height); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); - Win = glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Display); - if (Anim) - glutIdleFunc(Idle); - Init(argc, argv); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-fbo-tex.c b/progs/trivial/tri-fbo-tex.c deleted file mode 100644 index eacb7d577b..0000000000 --- a/progs/trivial/tri-fbo-tex.c +++ /dev/null @@ -1,255 +0,0 @@ -/* Framebuffer object test */ - - -#include <GL/glew.h> -#include <GL/glut.h> -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> - -/* For debug */ - - -static int Win = 0; -static int Width = 512, Height = 512; - -static GLenum TexTarget = GL_TEXTURE_2D; -static int TexWidth = 512, TexHeight = 512; - -static GLuint MyFB; -static GLuint TexObj; -static GLboolean Anim = GL_FALSE; -static GLfloat Rot = 0.0; -static GLuint TextureLevel = 0; /* which texture level to render to */ -static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */ - - -static void -CheckError(int line) -{ - GLenum err = glGetError(); - if (err) { - printf("GL Error 0x%x at line %d\n", (int) err, line); - } -} - - -static void -Idle(void) -{ - Rot = glutGet(GLUT_ELAPSED_TIME) * 0.1; - glutPostRedisplay(); -} - - -static void -RenderTexture(void) -{ - GLenum status; - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -15.0); - - if (1) { - /* draw to texture image */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - - status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { - printf("Framebuffer incomplete!!!\n"); - } - - glViewport(0, 0, TexWidth, TexHeight); - - glClearColor(0.5, 0.5, 1.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - - CheckError(__LINE__); - - glBegin(GL_POLYGON); - glColor3f(1, 0, 0); - glVertex2f(-1, -1); - glColor3f(0, 1, 0); - glVertex2f(1, -1); - glColor3f(0, 0, 1); - glVertex2f(0, 1); - glEnd(); - - /* Bind normal framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - } - else { - } - - CheckError(__LINE__); -} - - - -static void -Display(void) -{ - float ar = (float) Width / (float) Height; - - RenderTexture(); - - /* draw textured quad in the window */ - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glTranslatef(0.0, 0.0, -7.0); - - glViewport(0, 0, Width, Height); - - glClearColor(0.25, 0.25, 0.25, 0); - glClear(GL_COLOR_BUFFER_BIT); - - glPushMatrix(); - glRotatef(Rot, 0, 1, 0); - glEnable(TexTarget); - glBindTexture(TexTarget, TexObj); - - { - glBegin(GL_POLYGON); - glColor3f(0.25, 0.25, 0.25); - glTexCoord2f(0, 0); - glVertex2f(-1, -1); - glTexCoord2f(1, 0); - glVertex2f(1, -1); - glColor3f(1.0, 1.0, 1.0); - glTexCoord2f(1, 1); - glVertex2f(1, 1); - glTexCoord2f(0, 1); - glVertex2f(-1, 1); - glEnd(); - } - - glPopMatrix(); - glDisable(TexTarget); - - glutSwapBuffers(); - CheckError(__LINE__); -} - - -static void -Reshape(int width, int height) -{ - glViewport(0, 0, width, height); - Width = width; - Height = height; -} - - -static void -CleanUp(void) -{ - glDeleteFramebuffersEXT(1, &MyFB); - - glDeleteTextures(1, &TexObj); - - glutDestroyWindow(Win); - - exit(0); -} - - -static void -Key(unsigned char key, int x, int y) -{ - (void) x; - (void) y; - switch (key) { - case 'a': - Anim = !Anim; - if (Anim) - glutIdleFunc(Idle); - else - glutIdleFunc(NULL); - break; - case 's': - Rot += 2.0; - break; - case 27: - CleanUp(); - break; - } - glutPostRedisplay(); -} - - -static void -Init(int argc, char *argv[]) -{ - if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { - printf("GL_EXT_framebuffer_object not found!\n"); - exit(0); - } - - printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - - - /* Make texture object/image */ - glGenTextures(1, &TexObj); - glBindTexture(TexTarget, TexObj); - glTexParameteri(TexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(TexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(TexTarget, GL_TEXTURE_BASE_LEVEL, TextureLevel); - glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel); - - glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); - - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - - - - /* gen framebuffer id, delete it, do some assertions, just for testing */ - glGenFramebuffersEXT(1, &MyFB); - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - assert(glIsFramebufferEXT(MyFB)); - - - CheckError(__LINE__); - - /* Render color to texture */ - glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - TexTarget, TexObj, TextureLevel); - - - - CheckError(__LINE__); - - /* bind regular framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - - -} - - -int -main(int argc, char *argv[]) -{ - glutInit(&argc, argv); - glutInitWindowPosition(0, 0); - glutInitWindowSize(Width, Height); - glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); - Win = glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Display); - if (Anim) - glutIdleFunc(Idle); - Init(argc, argv); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-fbo.c b/progs/trivial/tri-fbo.c deleted file mode 100644 index 089180f97a..0000000000 --- a/progs/trivial/tri-fbo.c +++ /dev/null @@ -1,203 +0,0 @@ - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <string.h> - -#include <GL/glew.h> -#include <GL/glut.h> - - - -static int Width = 400, Height = 400; -static GLuint MyFB, MyRB; - - -#define CheckError() assert(glGetError() == 0) - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - - if (!glutExtensionSupported("GL_EXT_framebuffer_object")) { - printf("GL_EXT_framebuffer_object not found!\n"); - exit(0); - } - - - glGenFramebuffersEXT(1, &MyFB); - glGenRenderbuffersEXT(1, &MyRB); - - { - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, MyRB); - - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT, - GL_RENDERBUFFER_EXT, MyRB); - - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); - - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - } - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - - - -static void -Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - - Width = width; - Height = height; - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height); -} - - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - break; - } - - glutPostRedisplay(); -} - - - -static void Draw( void ) -{ - - /* draw to user framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB); - glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT); - glReadBuffer(GL_COLOR_ATTACHMENT1_EXT); - - glClearColor(0.5, 0.5, 1.0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - CheckError(); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - - { - GLubyte *buffer = malloc(Width * Height * 4); - - /* read from user framebuffer */ - glReadPixels(0, 0, Width-60, Height-60, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - CheckError(); - - /* draw to window */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - /* Try to clear the window, but will overwrite: - */ - glClearColor(0.8, 0.8, 0, 0.0); - glClear(GL_COLOR_BUFFER_BIT); - - glWindowPos2iARB(30, 30); - glDrawPixels(Width-60, Height-60, GL_RGBA, GL_UNSIGNED_BYTE, buffer); - - - free(buffer); - } - - /* Bind normal framebuffer */ - glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); - - if (1) { - glBegin(GL_TRIANGLES); - glColor3f(0,.7,0); - glVertex3f( 0.5, -0.5, -30.0); - glColor3f(0,0,.8); - glVertex3f( 0.5, 0.5, -30.0); - glColor3f(.9,0,0); - glVertex3f(-0.5, 0.0, -30.0); - glEnd(); - } - - if (doubleBuffer) - glutSwapBuffers(); - else - glFinish(); - - CheckError(); -} - - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - - - -int -main( int argc, char *argv[] ) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize( Width, Height ); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(argv[0]) == GL_FALSE) { - exit(1); - } - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-flat-clip.c b/progs/trivial/tri-flat-clip.c deleted file mode 100644 index a23f8a382b..0000000000 --- a/progs/trivial/tri-flat-clip.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.5, 0.5, 0.5, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - 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(-1.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-flat.c b/progs/trivial/tri-flat.c deleted file mode 100644 index 0614321844..0000000000 --- a/progs/trivial/tri-flat.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.5, 0.5, 0.5, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - 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 (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-fog.c b/progs/trivial/tri-fog.c deleted file mode 100644 index 7fc254a467..0000000000 --- a/progs/trivial/tri-fog.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - -GLint Width = 250, Height = 250; - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - glEnable(GL_FOG); - glFogi(GL_FOG_MODE, GL_LINEAR); - glFogf(GL_FOG_START, 25); - glFogf(GL_FOG_END, 35); -#if 0 - glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable (GL_BLEND); -#endif -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_FOG); - - glBegin(GL_TRIANGLES); - glColor3f(1,1,1); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,1); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,1,1); - glVertex3f(-0.9, 0.0, -40.0); - glEnd(); - -#if 0 - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f( 0.9, 0.0, -30.0); - glEnd(); -#endif - - glDisable(GL_FOG); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize(Width, Height); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-fp-const-imm.c b/progs/trivial/tri-fp-const-imm.c deleted file mode 100644 index accea62042..0000000000 --- a/progs/trivial/tri-fp-const-imm.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - GLint errno; - GLuint prognum; - static const char *prog1 = - "!!ARBfp1.0\n" - "TEMP R1;\n" - "MOV R1, state.material.emission;\n" - "MUL R1, R1, {0.9}.x;\n" - "MOV result.color, R1;\n" - "END\n"; - - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - /* Setup the fragment program */ - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prognum); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *)prog1); - - 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(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glTexCoord3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glColor3f(.8,0,0); - glTexCoord3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glColor3f(0,.9,0); - glTexCoord3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-fp.c b/progs/trivial/tri-fp.c deleted file mode 100644 index 6ecfef4d2a..0000000000 --- a/progs/trivial/tri-fp.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - GLint errno; - GLuint prognum; - static const char *prog1 = - "!!ARBfp1.0\n" - "MOV result.color, fragment.texcoord[1];\n" - /* "MOV result.color, fragment.color;\n" */ - "END\n"; - - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - /* Setup the fragment program */ - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prognum); - glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *)prog1); - - 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(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glTexCoord3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glColor3f(.8,0,0); - glTexCoord3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glColor3f(0,.9,0); - glTexCoord3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-lit-material.c b/progs/trivial/tri-lit-material.c deleted file mode 100644 index 16cebb2b98..0000000000 --- a/progs/trivial/tri-lit-material.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0}; - static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0}; - static GLfloat blue[4] = {0.2, 0.2, .9, 1.0}; - - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); - glNormal3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); - glNormal3f(0,0,.8); - glVertex3f( 0.9, 0.9, -0.0); - - glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); - glNormal3f(0,0,.9); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-lit.c b/progs/trivial/tri-lit.c deleted file mode 100644 index 26ebd99d91..0000000000 --- a/progs/trivial/tri-lit.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glNormal3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glNormal3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glNormal3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-logicop-none.c b/progs/trivial/tri-logicop-none.c deleted file mode 100644 index 2b6a3d6f5c..0000000000 --- a/progs/trivial/tri-logicop-none.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer = 1; -int win; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.3, 0.1, 0.3, 0.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(0); - default: - glutPostRedisplay(); - return; - } -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(.8,0,0); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.0, 0.9, -30.0); - glEnd(); - - - glLineWidth(4.0); - - glBegin(GL_LINES); - glColor3f(.1,.7,.1); - glVertex3f( 0.5, -0.5, -30.0); - glVertex3f( 0.5, 0.5, -30.0); - - glColor3f(.1,.1,.8); - glVertex3f( 0.5, 0.5, -30.0); - glVertex3f(-0.5, 0.5, -30.0); - - glColor3f(.5,.1,.1); - glVertex3f(-0.5, 0.5, -30.0); - glVertex3f(-0.5, -0.5, -30.0); - - glColor3f(.8,.8,.8); - glVertex3f(-0.5, -0.5, -30.0); - glVertex3f( 0.5, -0.5, -30.0); - glEnd(); - - /* glLineWidth(12.0); */ - - /* Redraw parts of the lines: - */ - glBegin(GL_LINES); - glColor3f(.1,.7,.1); - glVertex3f( 0.5, -0.2, -30.0); - glVertex3f( 0.5, 0.2, -30.0); - - glColor3f(.1,.1,.8); - glVertex3f( 0.2, 0.5, -30.0); - glVertex3f(-0.2, 0.5, -30.0); - - glColor3f(.5,.1,.1); - glVertex3f(-0.5, 0.2, -30.0); - glVertex3f(-0.5, -0.2, -30.0); - - glColor3f(.8,.8,.8); - glVertex3f(-0.2, -0.5, -30.0); - glVertex3f( 0.2, -0.5, -30.0); - glEnd(); - - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - win = glutCreateWindow(*argv); - if (!win) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-logicop-xor.c b/progs/trivial/tri-logicop-xor.c deleted file mode 100644 index b8207cd6d8..0000000000 --- a/progs/trivial/tri-logicop-xor.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer = 1; -int win; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.3, 0.1, 0.3, 0.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(0); - default: - glutPostRedisplay(); - return; - } -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(.8,0,0); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.0, 0.9, -30.0); - glEnd(); - - - glLineWidth(4.0); - - glEnable(GL_BLEND); - glEnable(GL_COLOR_LOGIC_OP); - glLogicOp(GL_XOR); - - glBegin(GL_LINES); - glColor3f(.1,.7,.1); - glVertex3f( 0.5, -0.5, -30.0); - glVertex3f( 0.5, 0.5, -30.0); - - glColor3f(.1,.1,.8); - glVertex3f( 0.5, 0.5, -30.0); - glVertex3f(-0.5, 0.5, -30.0); - - glColor3f(.5,.1,.1); - glVertex3f(-0.5, 0.5, -30.0); - glVertex3f(-0.5, -0.5, -30.0); - - glColor3f(.8,.8,.8); - glVertex3f(-0.5, -0.5, -30.0); - glVertex3f( 0.5, -0.5, -30.0); - glEnd(); - - /* glLineWidth(12.0); */ - - /* Redraw parts of the lines to remove them: - */ - glBegin(GL_LINES); - glColor3f(.1,.7,.1); - glVertex3f( 0.5, -0.2, -30.0); - glVertex3f( 0.5, 0.2, -30.0); - - glColor3f(.1,.1,.8); - glVertex3f( 0.2, 0.5, -30.0); - glVertex3f(-0.2, 0.5, -30.0); - - glColor3f(.5,.1,.1); - glVertex3f(-0.5, 0.2, -30.0); - glVertex3f(-0.5, -0.2, -30.0); - - glColor3f(.8,.8,.8); - glVertex3f(-0.2, -0.5, -30.0); - glVertex3f( 0.2, -0.5, -30.0); - glEnd(); - - - - glDisable(GL_COLOR_LOGIC_OP); - glDisable(GL_BLEND); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - win = glutCreateWindow(*argv); - if (!win) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-mask-tri.c b/progs/trivial/tri-mask-tri.c deleted file mode 100644 index d62620905d..0000000000 --- a/progs/trivial/tri-mask-tri.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -GLint Width = 250, Height = 250; -GLenum doubleBuffer; -GLint Win; -GLboolean Rmask = GL_TRUE, Gmask = GL_FALSE, Bmask = GL_TRUE; - - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - glClearColor(0.0, 0.0, 1.0, 0.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 'r': - Rmask = !Rmask; - break; - case 'g': - Gmask = !Gmask; - break; - case 'b': - Bmask = !Bmask; - break; - case 27: - glutDestroyWindow(Win); - exit(1); - default: - return; - } - glutPostRedisplay(); -} - -static void Draw(void) -{ - printf("ColorMask = %d, %d, %d\n", Rmask, Gmask, Bmask); - glColorMask(1,1,1,1); - - glClear(GL_COLOR_BUFFER_BIT); - - /* right triangle: green */ - glBegin(GL_TRIANGLES); - glColor3f(0,1,0); - glVertex3f( 0.9, -0.9, -30.0); - glVertex3f( 0.9, 0.9, -30.0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glColorMask(Rmask, Gmask, Bmask, 0); - - /* left triangle: white&mask: purple middle region: white */ - glBegin(GL_TRIANGLES); - glColor3f(1,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glVertex3f(-0.9, 0.9, -30.0); - glVertex3f( 0.9, 0.0, -30.0); - glEnd(); - - glDisable(GL_SCISSOR_TEST); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } - else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } - else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - - glutInitWindowPosition(100, 0); glutInitWindowSize(Width, Height); - glutInitDisplayMode(type); - Win = glutCreateWindow(*argv); - Init(); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-multitex-vbo.c b/progs/trivial/tri-multitex-vbo.c deleted file mode 100644 index ca4edaa5dd..0000000000 --- a/progs/trivial/tri-multitex-vbo.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - -#define NR_VERTS 4 - -struct { - GLfloat position[NR_VERTS][4]; - GLubyte color[NR_VERTS][4]; - GLfloat tex0[NR_VERTS][2]; - GLfloat tex1[NR_VERTS][2]; -} verts = { - - { { 0.9, -0.9, 0.0, 1.0 }, - { 0.9, 0.9, 0.0, 1.0 }, - { -0.9, 0.9, 0.0, 1.0 }, - { -0.9, -0.9, 0.0, 1.0 } }, - - { { 0x00, 0x00, 0xff, 0x00 }, - { 0x00, 0xff, 0x00, 0x00 }, - { 0xff, 0x00, 0x00, 0x00 }, - { 0xff, 0xff, 0xff, 0x00 } - }, - - { { 1, -1 }, - { 1, 1 }, - { -1, 1 }, - { -1, -1 } }, - - { { 3, 0 }, - { 0, 3 }, - { -3, 0 }, - { 0, -3} }, - -}; - -GLuint indices[] = { 0, 1, 2, 3 }; - -GLuint arrayObj, elementObj; - - -GLenum doubleBuffer; - - -#define Offset(ptr, member) (void *)((const char *)&((ptr)->member) - (const char *)(ptr)) - -static void Init(void) -{ - GLuint texObj[2]; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - glGenTextures(2, texObj); - -#define SIZE 32 - { - GLubyte tex2d[SIZE][SIZE][3]; - GLint s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { - tex2d[t][s][0] = s*255/(SIZE-1); - tex2d[t][s][1] = t*255/(SIZE-1); - tex2d[t][s][2] = 0; - } - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glActiveTextureARB(GL_TEXTURE0_ARB); - glBindTexture(GL_TEXTURE_2D, texObj[0]); - - - glTexImage2D(GL_TEXTURE_2D, 0, 3, SIZE, SIZE, 0, - GL_RGB, GL_UNSIGNED_BYTE, tex2d); - - glEnable(GL_TEXTURE_2D); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - } - - { - GLubyte tex2d[SIZE][SIZE][3]; - GLint s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { - GLboolean on = ((s/4) ^ (t/4)) & 1; - tex2d[t][s][0] = on ? 128 : 0; - tex2d[t][s][1] = on ? 128 : 0; - tex2d[t][s][2] = on ? 128 : 0; - } - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glActiveTextureARB(GL_TEXTURE1_ARB); - glBindTexture(GL_TEXTURE_2D, texObj[1]); - - glTexImage2D(GL_TEXTURE_2D, 0, 3, SIZE, SIZE, 0, - GL_RGB, GL_UNSIGNED_BYTE, tex2d); - - glEnable(GL_TEXTURE_2D); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - } - - glActiveTextureARB( GL_TEXTURE0_ARB ); - - - { - - glGenBuffersARB(1, &arrayObj); - glGenBuffersARB(1, &elementObj); - - glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj); - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementObj); - - glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), &verts, GL_STATIC_DRAW_ARB); - glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(indices), indices, GL_STATIC_DRAW_ARB); - - glEnableClientState( GL_VERTEX_ARRAY ); - glVertexPointer( 4, GL_FLOAT, 0, Offset(&verts, position) ); - - glEnableClientState( GL_COLOR_ARRAY ); - glColorPointer( 4, GL_UNSIGNED_BYTE, 0, Offset(&verts, color) ); - - glClientActiveTextureARB( GL_TEXTURE0_ARB ); - glEnableClientState( GL_TEXTURE_COORD_ARRAY ); - glTexCoordPointer( 2, GL_FLOAT, 0, Offset(&verts, tex0) ); - - glClientActiveTextureARB( GL_TEXTURE1_ARB ); - glEnableClientState( GL_TEXTURE_COORD_ARRAY ); - glTexCoordPointer( 2, GL_FLOAT, 0, Offset(&verts, tex1) ); - - glClientActiveTextureARB( GL_TEXTURE0_ARB ); - } -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, NULL ); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - glewInit(); - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-orig.c b/progs/trivial/tri-orig.c deleted file mode 100644 index f86ac52a02..0000000000 --- a/progs/trivial/tri-orig.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-point-line-clipped.c b/progs/trivial/tri-point-line-clipped.c deleted file mode 100644 index f8c1015f5f..0000000000 --- a/progs/trivial/tri-point-line-clipped.c +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Test frustum/user clipping w/ glPolygonMode LINE/POINT. - * - * The bottom/left and bottom/right verts are outside the frustum and clipped. - * The top vertex is clipped by a user clipping plane. - * - * A filled gray reference triangle is shown underneath the points/lines. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <GL/glut.h> - - -static int win; - - -static void -ColorTri(void) -{ - glBegin(GL_TRIANGLES); - glColor3f(1, 0, 0); glVertex3f(-1.5, -0.8, 0.0); - glColor3f(0, 1, 0); glVertex3f( 1.5, -0.8, 0.0); - glColor3f(0, 0, 1); glVertex3f( 0.0, 0.9, 0.0); - glEnd(); -} - - -static void -GrayTri(void) -{ - glColor3f(0.3, 0.3, 0.3); - glBegin(GL_TRIANGLES); - glVertex3f(-1.5, -0.8, 0.0); - glVertex3f( 1.5, -0.8, 0.0); - glVertex3f( 0.0, 0.9, 0.0); - glEnd(); -} - - -static void -Draw(void) -{ - static const GLdouble plane[4] = { 0, -1.0, 0, 0.5 }; - - glClear(GL_COLOR_BUFFER_BIT); - - glPointSize(13.0); - glLineWidth(5.0); - - glClipPlane(GL_CLIP_PLANE0, plane); - glEnable(GL_CLIP_PLANE0); - - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - GrayTri(); - - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - ColorTri(); - - glPolygonMode(GL_FRONT_AND_BACK, GL_POINT); - ColorTri(); - - glutSwapBuffers(); -} - - -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, -1.0, 1.0); - glMatrixMode(GL_MODELVIEW); -} - - -static void -Key(unsigned char key, int x, int y) -{ - if (key == 27) { - glutDestroyWindow(win); - exit(0); - } - else { - glutPostRedisplay(); - } -} - - -static void -Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); -} - - -int -main(int argc, char **argv) -{ - glutInitWindowSize(300, 300); - glutInit(&argc, argv); - glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH); - win = glutCreateWindow(*argv); - if (!win) { - return 1; - } - Init(); - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-query.c b/progs/trivial/tri-query.c deleted file mode 100644 index 8898f182c7..0000000000 --- a/progs/trivial/tri-query.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - -static GLuint OccQuery; - -GLenum doubleBuffer; - -static void Init(void) -{ - if (!glutExtensionSupported("GL_ARB_occlusion_query")) { - fprintf(stderr, "Sorry, this program requires GL_ARB_occlusion_query\n"); - exit(1); - } - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - glGenQueriesARB(1, &OccQuery); -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - GLuint passed; - GLint ready; - - glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); - - glEnable(GL_DEPTH_TEST); - - glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glEndQueryARB(GL_SAMPLES_PASSED_ARB); - - do { - /* do useful work here, if any */ - glGetQueryObjectivARB(OccQuery, GL_QUERY_RESULT_AVAILABLE_ARB, &ready); - } while (!ready); - glGetQueryObjectuivARB(OccQuery, GL_QUERY_RESULT_ARB, &passed); - - fprintf(stderr, " %d Fragments Visible\n", passed); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_DEPTH; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-repeat.c b/progs/trivial/tri-repeat.c deleted file mode 100644 index 91e355c71f..0000000000 --- a/progs/trivial/tri-repeat.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.3, 0.1, 0.3, 0.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(0); - default: - glutPostRedisplay(); - return; - } -} - -static void Draw(void) -{ - static float f = 0; - f += .1; - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f((sin(f)+1)/2.0,0,0); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(0,(cos(f)+1)/2.0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.0, 0.9, -30.0); - glEnd(); - - glutSwapBuffers(); - glutPostRedisplay(); -} - -static GLenum Args(int argc, char **argv) -{ - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= GLUT_DOUBLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-scissor-tri.c b/progs/trivial/tri-scissor-tri.c deleted file mode 100644 index 1bb15501bb..0000000000 --- a/progs/trivial/tri-scissor-tri.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - -GLint Width = 300, Height = 300; - -GLenum doubleBuffer; - -/* scissor bounds */ -static GLint Left, Right, Bottom, Top; - - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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); - - Width = width; - Height = height; - - Left = Width / 4; - Right = Width * 3 / 4; - Bottom = Height / 4; - Top = Height * 3 / 4; -} - -static void Key(unsigned char key, int x, int y) -{ - int step = 2; - switch (key) { - case 'l': - Left -= step; - break; - case 'L': - Left += step; - break; - case 'r': - Right -= step; - break; - case 'R': - Right += step; - break; - case 'b': - Bottom -= step; - break; - case 'B': - Bottom += step; - break; - case 't': - Top -= step; - break; - case 'T': - Top += step; - break; - case 27: - exit(1); - default: - ; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - printf("Scissor %d, %d .. %d, %d\n", Left, Bottom, Right, Top); - glScissor(Left, Bottom, Right-Left, Top-Bottom); - glEnable(GL_SCISSOR_TEST); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f( 0.9, 0.0, -30.0); - glEnd(); - - glDisable(GL_SCISSOR_TEST); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize(Width, Height); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-square.c b/progs/trivial/tri-square.c deleted file mode 100644 index 2014bd489c..0000000000 --- a/progs/trivial/tri-square.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluOrtho2D(0, (GLdouble)width, 0, (GLdouble)height); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glColor3f(1,1,1); - - glBegin(GL_TRIANGLES); - glVertex3f( 10, 10, -30.0); - glVertex3f( 200, 150, -30.0); - glVertex3f( 10, 200, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-stencil.c b/progs/trivial/tri-stencil.c deleted file mode 100644 index d66b68c415..0000000000 --- a/progs/trivial/tri-stencil.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> -#include <GL/glut.h> - - -static void Init(void) -{ -} - -static void Reshape(int width, int height) -{ - - glViewport(0, 0, (GLint)width, (GLint)height); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(-5.0, 5.0, -5.0, 5.0, -5.0, 5.0); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - printf("Exiting...\n"); - exit(1); - case 'r': - printf("Redisplaying...\n"); - glutPostRedisplay(); - break; - default: - printf("No such key '%c'...\n", key); - break; - } -} - -static void Draw(void) -{ - glShadeModel(GL_FLAT); - - { - glClearColor(0.0, 0.0, 0.0, 0.0); - glClearStencil(0); - glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); - } - - - glStencilMask(1); - glEnable(GL_STENCIL_TEST); - glStencilFunc(GL_ALWAYS, 1, 1); - glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); - - /* red triangle (setting stencil to 1) */ - glColor3ub(200, 0, 0); - glBegin(GL_POLYGON); - glVertex3i(-4, -4, 0); - glVertex3i( 4, -4, 0); - glVertex3i( 0, 4, 0); - glEnd(); - -#if 1 - glStencilFunc(GL_EQUAL, 1, 1); - glStencilOp(GL_INCR, GL_KEEP, GL_DECR); - - /* green quad (if over red, decr stencil to 0, else incr to 1) */ - glColor3ub(0, 200, 0); - glBegin(GL_POLYGON); - glVertex3i(3, 3, 0); - glVertex3i(-3, 3, 0); - glVertex3i(-3, -3, 0); - glVertex3i(3, -3, 0); - glEnd(); -#endif - -#if 1 - glStencilFunc(GL_EQUAL, 1, 1); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - - /* blue quad (where stencil == 1) */ - glColor3ub(0, 0, 200); - glBegin(GL_POLYGON); - glVertex3f(2.5, 2.5, 0); - glVertex3f(-2.5, 2.5, 0); - glVertex3f(-2.5, -2.5, 0); - glVertex3f(2.5, -2.5, 0); - glEnd(); -#endif - - glFlush(); -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-dr") == 0) { - } else { - printf("%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); - glutInitWindowSize( 300, 300); - - type = GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH | GLUT_STENCIL; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-stipple.c b/progs/trivial/tri-stipple.c deleted file mode 100644 index 15a08fec7c..0000000000 --- a/progs/trivial/tri-stipple.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - -static GLubyte fly[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x03, 0x80, 0x01, 0xC0, 0x06, 0xC0, 0x03, 0x60, 0x04, 0x60, 0x06, 0x20, -0x04, 0x30, 0x0C, 0x20, 0x04, 0x18, 0x18, 0x20, 0x04, 0x0C, 0x30, 0x20, -0x04, 0x06, 0x60, 0x20, 0x44, 0x03, 0xC0, 0x22, 0x44, 0x01, 0x80, 0x22, -0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, -0x44, 0x01, 0x80, 0x22, 0x44, 0x01, 0x80, 0x22, 0x66, 0x01, 0x80, 0x66, -0x33, 0x01, 0x80, 0xCC, 0x19, 0x81, 0x81, 0x98, 0x0C, 0xC1, 0x83, 0x30, -0x07, 0xe1, 0x87, 0xe0, 0x03, 0x3f, 0xfc, 0xc0, 0x03, 0x31, 0x8c, 0xc0, -0x03, 0x33, 0xcc, 0xc0, 0x06, 0x64, 0x26, 0x60, 0x0c, 0xcc, 0x33, 0x30, -0x18, 0xcc, 0x33, 0x18, 0x10, 0xc4, 0x23, 0x08, 0x10, 0x63, 0xC6, 0x08, -0x10, 0x30, 0x0c, 0x08, 0x10, 0x18, 0x18, 0x08, 0x10, 0x00, 0x00, 0x08}; - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glEnable (GL_POLYGON_STIPPLE); - glPolygonStipple (fly); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-tex-3d.c b/progs/trivial/tri-tex-3d.c deleted file mode 100644 index 073a080d7a..0000000000 --- a/progs/trivial/tri-tex-3d.c +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glew.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - -#define SIZE 16 - { - GLubyte tex3d[SIZE][SIZE][SIZE][3]; - GLint r, s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { - for (r = 0; r < SIZE; r++) { -#if 0 - tex3d[r][t][s][0] = (s < SIZE/2) ? 0 : 255; - tex3d[r][t][s][1] = (t < SIZE/2) ? 0 : 255; - tex3d[r][t][s][2] = (r < SIZE/2) ? 0 : 255; -#else - tex3d[r][t][s][0] = s*255/(SIZE-1); - tex3d[r][t][s][1] = t*255/(SIZE-1); - tex3d[r][t][s][2] = r*255/(SIZE-1); -#endif - } - } - } - - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glTexImage3D(GL_TEXTURE_3D, 0, 3, SIZE, SIZE, SIZE, 0, - GL_RGB, GL_UNSIGNED_BYTE, tex3d); - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glEnable(GL_TEXTURE_3D); - } - -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glTexCoord3f( 0,0,.9); - glVertex3f( 0.9, -0.9, -30.0); - glTexCoord3f(.9,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glTexCoord3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-tex.c b/progs/trivial/tri-tex.c deleted file mode 100644 index 244e154504..0000000000 --- a/progs/trivial/tri-tex.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - - -#define SIZE 32 - { - GLubyte tex2d[SIZE][SIZE][3]; - GLint s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { -#if 0 - tex2d[t][s][0] = (s < SIZE/2) ? 0 : 255; - tex2d[t][s][1] = (t < SIZE/2) ? 0 : 255; - tex2d[t][s][2] = 0; -#else - tex2d[t][s][0] = s*255/(SIZE-1); - tex2d[t][s][1] = t*255/(SIZE-1); - tex2d[t][s][2] = 0; -#endif - } - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - glTexImage2D(GL_TEXTURE_2D, 0, 3, SIZE, SIZE, 0, - GL_RGB, GL_UNSIGNED_BYTE, tex2d); - - glEnable(GL_TEXTURE_2D); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - } - -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glTexCoord2f(1,-1); - glVertex3f( 0.9, -0.9, -0.0); - glTexCoord2f(1,1); - glVertex3f( 0.9, 0.9, -0.0); - glTexCoord2f(-1,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-tri.c b/progs/trivial/tri-tri.c deleted file mode 100644 index 7bf400793e..0000000000 --- a/progs/trivial/tri-tri.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f( 0.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-unfilled-clip.c b/progs/trivial/tri-unfilled-clip.c deleted file mode 100644 index 585919e16d..0000000000 --- a/progs/trivial/tri-unfilled-clip.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-1.9, 0.0, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-unfilled-edgeflag.c b/progs/trivial/tri-unfilled-edgeflag.c deleted file mode 100644 index f536f64229..0000000000 --- a/progs/trivial/tri-unfilled-edgeflag.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_LINE); - - glBegin(GL_TRIANGLES); - glEdgeFlag(1); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glEdgeFlag(0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glEdgeFlag(1); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-unfilled-fog.c b/progs/trivial/tri-unfilled-fog.c deleted file mode 100644 index c6ecc705b3..0000000000 --- a/progs/trivial/tri-unfilled-fog.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - -GLint Width = 250, Height = 250; - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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); - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_FOG); - - glPolygonMode(GL_FRONT, GL_FILL); - glPolygonMode(GL_BACK, GL_FILL); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.7, -0.7, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.7, 0.7, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.7, 0.0, -30.0); - glEnd(); - - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_LINE); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -30.0); - glEnd(); - - glDisable(GL_FOG); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize(Width, Height); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-unfilled-point.c b/progs/trivial/tri-unfilled-point.c deleted file mode 100644 index 11e276e1a5..0000000000 --- a/progs/trivial/tri-unfilled-point.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT, GL_POINT); - glPolygonMode(GL_BACK, GL_POINT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-unfilled-smooth.c b/progs/trivial/tri-unfilled-smooth.c deleted file mode 100644 index fa31667e65..0000000000 --- a/progs/trivial/tri-unfilled-smooth.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_LINE_SMOOTH); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.6, -0.6, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.6, 0.6, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.6, 0.0, -0.0); - glEnd(); - - glPolygonMode(GL_FRONT, GL_LINE); -/* glPolygonMode(GL_BACK, GL_LINE); */ - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-unfilled-tri-lit.c b/progs/trivial/tri-unfilled-tri-lit.c deleted file mode 100644 index d6baeb4697..0000000000 --- a/progs/trivial/tri-unfilled-tri-lit.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glEnable(GL_LIGHTING); - glEnable(GL_LIGHT0); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_LINE); - - glBegin(GL_TRIANGLES); - glNormal3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glNormal3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glNormal3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glPolygonMode(GL_FRONT, GL_FILL); - glPolygonMode(GL_BACK, GL_FILL); - - glBegin(GL_TRIANGLES); - glNormal3f(0,0,.7); - glVertex3f( 0.8, -0.8, -0.0); - glNormal3f(.8,0,0); - glVertex3f( 0.8, 0.8, -0.0); - glNormal3f(0,.9,0); - glVertex3f(-0.8, 0.0, -0.0); - glEnd(); - - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_LINE); - - glBegin(GL_TRIANGLES); - glNormal3f(.8,0,0); - glVertex3f( -0.9, 0.9, -0.0); - glNormal3f(0,0,.7); - glVertex3f( -0.9, -0.9, -0.0); - glNormal3f(0,.9,0); - glVertex3f( 0.9, 0.0, -0.0); - glEnd(); - - glPolygonMode(GL_FRONT, GL_FILL); - glPolygonMode(GL_BACK, GL_FILL); - - glBegin(GL_TRIANGLES); - glNormal3f(.8,0,0); - glVertex3f( -0.8, 0.8, -0.0); - glNormal3f(0,0,.7); - glVertex3f( -0.8, -0.8, -0.0); - glNormal3f(0,.9,0); - glVertex3f( 0.8, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-unfilled-tri.c b/progs/trivial/tri-unfilled-tri.c deleted file mode 100644 index 75a70b8a41..0000000000 --- a/progs/trivial/tri-unfilled-tri.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_LINE); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glPolygonMode(GL_FRONT, GL_FILL); - glPolygonMode(GL_BACK, GL_FILL); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.8, -0.8, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.8, 0.8, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.8, 0.0, -0.0); - glEnd(); - - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_LINE); - - glBegin(GL_TRIANGLES); - glColor3f(.8,0,0); - glVertex3f( -0.9, 0.9, -0.0); - glColor3f(0,0,.7); - glVertex3f( -0.9, -0.9, -0.0); - glColor3f(0,.9,0); - glVertex3f( 0.9, 0.0, -0.0); - glEnd(); - - glPolygonMode(GL_FRONT, GL_FILL); - glPolygonMode(GL_BACK, GL_FILL); - - glBegin(GL_TRIANGLES); - glColor3f(.8,0,0); - glVertex3f( -0.8, 0.8, -0.0); - glColor3f(0,0,.7); - glVertex3f( -0.8, -0.8, -0.0); - glColor3f(0,.9,0); - glVertex3f( 0.8, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-unfilled-userclip-stip.c b/progs/trivial/tri-unfilled-userclip-stip.c deleted file mode 100644 index 02bfa92f83..0000000000 --- a/progs/trivial/tri-unfilled-userclip-stip.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - static GLdouble plane[4] = { -.5, 0, 1, 0 }; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - glClipPlane(GL_CLIP_PLANE0, plane); - glEnable(GL_CLIP_PLANE0); - glLineWidth( 4 ); -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glEnable(GL_LINE_STIPPLE); - glLineStipple( 5, 0xfffe ); - - - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, 0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-unfilled-userclip.c b/progs/trivial/tri-unfilled-userclip.c deleted file mode 100644 index 11e53fc7cc..0000000000 --- a/progs/trivial/tri-unfilled-userclip.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - static GLdouble plane[4] = { -.5, 0, 1, 0 }; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - glClipPlane(GL_CLIP_PLANE0, plane); - glEnable(GL_CLIP_PLANE0); -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, 0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-unfilled.c b/progs/trivial/tri-unfilled.c deleted file mode 100644 index afa1058dad..0000000000 --- a/progs/trivial/tri-unfilled.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_LINE); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-userclip.c b/progs/trivial/tri-userclip.c deleted file mode 100644 index 5651c73832..0000000000 --- a/progs/trivial/tri-userclip.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - static GLdouble plane[4] = { -.5, 0, 1, 0 }; - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.0); - glClipPlane(GL_CLIP_PLANE0, plane); - glEnable(GL_CLIP_PLANE0); -} - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, 0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-viewport.c b/progs/trivial/tri-viewport.c deleted file mode 100644 index 3e52449b47..0000000000 --- a/progs/trivial/tri-viewport.c +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - -GLenum doubleBuffer = 1; -int win; -static float tx = 0; -static float ty = 0; -static float tw = 0; -static float th = 0; -static float z = -5; - - -static float win_width = 250; -static float win_height = 250; -static enum { - ORTHO, - FRUSTUM, - MODE_MAX -} mode = ORTHO; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0, 0, 0, 0.0); -} - -static void Reshape(int width, int height) -{ - win_width = width; - win_height = height; - glutPostRedisplay(); -} - - -static void Key(unsigned char key, int x, int y) -{ - switch (key) { - case 27: - exit(0); - case 'w': - tw += 1.0; - break; - case 'W': - tw -= 1.0; - break; - case 'h': - th += 1.0; - break; - case 'H': - th -= 1.0; - break; - - case 'z': - z += 1.0; - break; - case 'Z': - z -= 1.0; - break; - case 'm': - mode++; - mode %= MODE_MAX; - break; - case ' ': - tw = th = tx = ty = 0; - z = -5; - mode = ORTHO; - break; - default: - break; - } - glutPostRedisplay(); -} - - -static void Draw(void) -{ - int i; - float w = tw + win_width; - float h = th + win_height; - - fprintf(stderr, "glViewport(%f %f %f %f)\n", tx, ty, w, h); - fprintf(stderr, "mode: %s\n", mode == FRUSTUM ? "FRUSTUM" : "ORTHO"); - fprintf(stderr, "z: %f\n", z); - fflush(stderr); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - switch (mode) { - case FRUSTUM: - glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); - break; - case ORTHO: - default: - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - break; - } - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - - glClear(GL_COLOR_BUFFER_BIT); - - - /*********************************************************************** - * Should be clipped to be no larger than the triangles: - */ - glViewport(tx, ty, w, h); - - glBegin(GL_POLYGON); - glColor3f(1,1,0); - glVertex3f(-100, -100, z); - glVertex3f(-100, 100, z); - glVertex3f(100, 100, z); - glVertex3f(100, -100, z); - glEnd(); - - glBegin(GL_POLYGON); - glColor3f(0,1,1); - glVertex3f(-10, -10, z); - glVertex3f(-10, 10, z); - glVertex3f(10, 10, z); - glVertex3f(10, -10, z); - glEnd(); - - glBegin(GL_POLYGON); - glColor3f(1,0,0); - glVertex3f(-2, -2, z); - glVertex3f(-2, 2, z); - glVertex3f(2, 2, z); - glVertex3f(2, -2, z); - glEnd(); - - - glBegin(GL_POLYGON); - glColor3f(.5,.5,1); - glVertex3f(-1, -1, z); - glVertex3f(-1, 1, z); - glVertex3f(1, 1, z); - glVertex3f(1, -1, z); - glEnd(); - - /*********************************************************************** - */ - glViewport(0, 0, win_width, win_height); - glBegin(GL_LINES); - glColor3f(1,1,0); - glVertex3f(-1, 0, z); - glVertex3f(1, 0, z); - - glVertex3f(0, -1, z); - glVertex3f(0, 1, z); - glEnd(); - - - /*********************************************************************** - */ - glViewport(tx, ty, w, h); - glBegin(GL_TRIANGLES); - glColor3f(1,0,0); - glVertex3f(-1, -1, z); - glVertex3f(0, -1, z); - glVertex3f(-.5, -.5, z); - - glColor3f(1,1,1); - glVertex3f(0, -1, z); - glVertex3f(1, -1, z); - glVertex3f(.5, -.5, z); - - glVertex3f(-.5, -.5, z); - glVertex3f(.5, -.5, z); - glVertex3f(0, 0, z); - - - glColor3f(0,1,0); - glVertex3f(1, 1, z); - glVertex3f(0, 1, z); - glVertex3f(.5, .5, z); - - glColor3f(1,1,1); - glVertex3f(0, 1, z); - glVertex3f(-1, 1, z); - glVertex3f(-.5, .5, z); - - glVertex3f(.5, .5, z); - glVertex3f(-.5, .5, z); - glVertex3f( 0, 0, z); - - glEnd(); - - - glViewport(0, 0, win_width, win_height); - - glBegin(GL_LINES); - glColor3f(.5,.5,0); - for (i = -10; i < 10; i++) { - float f = i / 10.0; - - if (i == 0) - continue; - - glVertex3f(-1, f, z); - glVertex3f(1, f, z); - - glVertex3f(f, -1, z); - glVertex3f(f, 1, z); - } - glEnd(); - - - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - if (getenv("VPX")) - tx = atof(getenv("VPX")); - - if (getenv("VPY")) - ty = atof(getenv("VPY")); - - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - - -static void -special(int k, int x, int y) -{ - switch (k) { - case GLUT_KEY_UP: - ty += 1.0; - break; - case GLUT_KEY_DOWN: - ty -= 1.0; - break; - case GLUT_KEY_LEFT: - tx -= 1.0; - break; - case GLUT_KEY_RIGHT: - tx += 1.0; - break; - default: - break; - } - glutPostRedisplay(); -} - - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - win = glutCreateWindow(*argv); - if (!win) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutSpecialFunc(special); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-z-9.c b/progs/trivial/tri-z-9.c deleted file mode 100644 index 37b9e2f873..0000000000 --- a/progs/trivial/tri-z-9.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - -} - -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, 1, -1); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClearColor(0.0, 0.0, 1.0, 0.0); - glClearDepth(1.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glDepthFunc(GL_EQUAL); - glEnable(GL_DEPTH_TEST); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, .5); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, .5); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, .5); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_DEPTH; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-z-eq.c b/progs/trivial/tri-z-eq.c deleted file mode 100644 index c04ffae7f1..0000000000 --- a/progs/trivial/tri-z-eq.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - -} - -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, 1, -1); - glMatrixMode(GL_MODELVIEW); -} - -static void Key(unsigned char key, int x, int y) -{ - - switch (key) { - case 27: - exit(1); - default: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - float z = 1.0; - - glClearColor(0.0, 0.0, 1.0, 0.0); - glClearDepth(1.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glDepthFunc(GL_EQUAL); - glEnable(GL_DEPTH_TEST); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, z); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, z); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, z); - glEnd(); - - glFlush(); - - { - GLfloat z; - glReadPixels(125, 125, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z); - printf("Z at (125, 125) = %f\n", z); - } - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(100, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_DEPTH; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri-z.c b/progs/trivial/tri-z.c deleted file mode 100644 index 092249dd76..0000000000 --- a/progs/trivial/tri-z.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 1993-1997, Silicon Graphics, Inc. - * ALL RIGHTS RESERVED - * Permission to use, copy, modify, and distribute this software for - * any purpose and without fee is hereby granted, provided that the above - * copyright notice appear in all copies and that both the copyright notice - * and this permission notice appear in supporting documentation, and that - * the name of Silicon Graphics, Inc. not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. - * - * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" - * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR - * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON - * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, - * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY - * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, - * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF - * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN - * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE - * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. - * - * US Government Users Restricted Rights - * Use, duplication, or disclosure by the Government is subject to - * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph - * (c)(1)(ii) of the Rights in Technical Data and Computer Software - * clause at DFARS 252.227-7013 and/or in similar or successor - * clauses in the FAR or the DOD or NASA FAR Supplement. - * Unpublished-- rights reserved under the copyright laws of the - * United States. Contractor/manufacturer is Silicon Graphics, - * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. - * - * OpenGL(R) is a registered trademark of Silicon Graphics, Inc. - */ - -#include <GL/glut.h> -#include <stdlib.h> -#include <stdio.h> - -static int leftFirst = GL_TRUE; - -static struct { GLenum func; const char *str; } funcs[] = - { - { GL_LESS, "GL_LESS" }, - { GL_LEQUAL, "GL_LEQUAL" }, - { GL_GREATER, "GL_GREATER" }, - { GL_GEQUAL, "GL_GEQUAL" }, - { GL_EQUAL, "GL_EQUAL" }, - { GL_NOTEQUAL, "GL_NOTEQUAL" }, - { GL_ALWAYS, "GL_ALWAYS" }, - { GL_NEVER, "GL_NEVER" }, - }; - -#define NUM_FUNCS (sizeof(funcs) / sizeof(funcs[0])) - -static int curFunc = 0; -static double clearVal = 1.0; -static float minZ = 0.0; -static float maxZ = 1.0; - -static void usage(void) -{ - printf("t - toggle rendering order of triangles\n"); - printf("c - toggle Z clear value between 0, 1\n"); - printf("f - cycle through depth test functions\n"); - printf("n/N - decrease/increase depthrange minZ\n"); - printf("x/X - decrease/increase depthrange maxZ\n"); - printf("spc - reset\n"); - printf("z - set to reverse-direction (ztrick) mode\n"); - fflush(stdout); -} - - -static void init(void) -{ - glEnable(GL_DEPTH_TEST); - glClearColor (1.0, 0.0, 0.0, 0.0); -} - -static void drawLeftTriangle(void) -{ - /* draw yellow triangle on LHS of screen */ - glBegin (GL_TRIANGLES); - glColor4f(1.0, 1.0, 0.0, 0.75); - glVertex3f(0.1, 0.9, -1.0); - glVertex3f(0.1, 0.1, -1.0); - glVertex3f(0.8, 0.5, 1.0); - glEnd(); -} - -static void drawRightTriangle(void) -{ - /* draw cyan triangle on RHS of screen */ - glBegin (GL_TRIANGLES); - glColor4f(0.0, 1.0, 1.0, 0.75); - glVertex3f(0.9, 0.9, 0.0); - glVertex3f(0.2, 0.5, 0.0); - glVertex3f(0.9, 0.1, 0.0); - glEnd(); -} - -static void display(void) -{ - printf("GL_CLEAR_DEPTH = %.2f, GL_DEPTH_FUNC = %s, DepthRange(%.1f, %.1f)\n", - clearVal, funcs[curFunc].str, minZ, maxZ); - fflush(stdout); - glClearDepth(clearVal); - glDepthRange(minZ, maxZ); - glDepthFunc(funcs[curFunc].func); - - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - - if (leftFirst) { - drawLeftTriangle(); - drawRightTriangle(); - } - else { - drawRightTriangle(); - drawLeftTriangle(); - } - - glFlush(); -} - -static void reshape(int w, int h) -{ - glViewport(0, 0, (GLsizei) w, (GLsizei) h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - if (w <= h) - gluOrtho2D (0.0, 1.0, 0.0, 1.0*(GLfloat)h/(GLfloat)w); - else - gluOrtho2D (0.0, 1.0*(GLfloat)w/(GLfloat)h, 0.0, 1.0); -} - -/* ARGSUSED1 */ -static void keyboard(unsigned char key, int x, int y) -{ - switch (key) { - case 'n': - minZ -= .1; - break; - case 'N': - minZ += .1; - break; - case 'x': - maxZ -= .1; - break; - case 'X': - maxZ += .1; - break; - case 'c': - case 'C': - clearVal = 1.0 - clearVal; - break; - case 'f': - case 'F': - curFunc = (curFunc + 1) % NUM_FUNCS; - break; - case 't': - case 'T': - leftFirst = !leftFirst; - break; - case ' ': - curFunc = 0; - clearVal = 1.0; - minZ = 0.0; - maxZ = 1.0; - break; - case 'z': - curFunc = 2; - clearVal = 0.0; - minZ = 1.0; - maxZ = 0.0; - break; - case 27: /* Escape key */ - exit(0); - break; - default: - return; - } - glutPostRedisplay(); -} - -/* Main Loop - * Open window with initial window size, title bar, - * RGBA display mode, and handle input events. - */ -int main(int argc, char** argv) -{ - glutInit(&argc, argv); - glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH); - glutInitWindowSize (200, 200); - glutCreateWindow (argv[0]); - glutReshapeFunc (reshape); - glutKeyboardFunc (keyboard); - glutDisplayFunc (display); - init(); - usage(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tri.c b/progs/trivial/tri.c deleted file mode 100644 index cac3fcb7d9..0000000000 --- a/progs/trivial/tri.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer = 1; -int win; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.3, 0.1, 0.3, 0.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: - glutDestroyWindow(win); - exit(0); - default: - glutPostRedisplay(); - return; - } -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(.8,0,0); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(0,.9,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(0,0,.7); - glVertex3f( 0.0, 0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - win = glutCreateWindow(*argv); - if (!win) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/trifan-flat-clip.c b/progs/trivial/trifan-flat-clip.c deleted file mode 100644 index 89bc471191..0000000000 --- a/progs/trivial/trifan-flat-clip.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - - glBegin(GL_TRIANGLE_FAN); - glColor3f(1,0,0); - glVertex3f( 0, 0, -30.0); - glColor3f(1,1,0); - glVertex3f( 1.3, 1.1, -30.0); - glColor3f(1,0,1); - glVertex3f(-.9, .9, -30.0); - glColor3f(0,1,1); - glVertex3f(-1.1, -1.3, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/trifan-flat-unfilled-clip.c b/progs/trivial/trifan-flat-unfilled-clip.c deleted file mode 100644 index 3a1a226e54..0000000000 --- a/progs/trivial/trifan-flat-unfilled-clip.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_LINE); - glLineWidth(4.0); - - - glBegin(GL_TRIANGLE_FAN); - glColor3f(1,0,0); - glVertex3f( 0, 0, -30.0); - glColor3f(1,1,0); - glVertex3f( 1.3, 1.1, -30.0); - glColor3f(1,0,1); - glVertex3f(-.9, .9, -30.0); - glColor3f(0,1,1); - glVertex3f(-1.1, -1.3, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/trifan-flat.c b/progs/trivial/trifan-flat.c deleted file mode 100644 index d25abdf49e..0000000000 --- a/progs/trivial/trifan-flat.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - - glBegin(GL_TRIANGLE_FAN); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/trifan-unfilled.c b/progs/trivial/trifan-unfilled.c deleted file mode 100644 index 2e3ff8218f..0000000000 --- a/progs/trivial/trifan-unfilled.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - glBegin(GL_TRIANGLE_FAN); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/trifan.c b/progs/trivial/trifan.c deleted file mode 100644 index b8a7615114..0000000000 --- a/progs/trivial/trifan.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLE_FAN); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tristrip-clip.c b/progs/trivial/tristrip-clip.c deleted file mode 100644 index 4e6ee1fbca..0000000000 --- a/progs/trivial/tristrip-clip.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLE_STRIP); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-1.9, 0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tristrip-flat.c b/progs/trivial/tristrip-flat.c deleted file mode 100644 index a90b8b6cb6..0000000000 --- a/progs/trivial/tristrip-flat.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - glShadeModel(GL_FLAT); - - if (0) { - glBegin(GL_LINES); - glColor3f(1,0,0); - glVertex3f( 0.95, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.95, 0.9, -30.0); - glEnd(); - } - - glBegin(GL_TRIANGLE_STRIP); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(0,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,0,.5); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(1,1,1); - glVertex3f(-0.9, 0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/tristrip.c b/progs/trivial/tristrip.c deleted file mode 100644 index 29915ff111..0000000000 --- a/progs/trivial/tristrip.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the name of - * Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF - * ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLE_STRIP); - glColor3f(1,0,0); - glVertex3f( 0.9, -0.9, -30.0); - glColor3f(1,1,0); - glVertex3f( 0.9, 0.9, -30.0); - glColor3f(0,1,1); - glVertex3f(-0.9, -0.9, -30.0); - glColor3f(1,0,1); - glVertex3f(-0.9, 0.9, -30.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vbo-drawarrays.c b/progs/trivial/vbo-drawarrays.c deleted file mode 100644 index cb26e84115..0000000000 --- a/progs/trivial/vbo-drawarrays.c +++ /dev/null @@ -1,134 +0,0 @@ -/* Basic VBO */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - - -struct { - GLfloat pos[3]; - GLubyte color[4]; -} verts[] = -{ - { { 0.9, -0.9, 0.0 }, - { 0x00, 0x00, 0xff, 0x00 } - }, - - { { 0.9, 0.9, 0.0 }, - { 0x00, 0xff, 0x00, 0x00 } - }, - - { { -0.9, 0.9, 0.0 }, - { 0xff, 0x00, 0x00, 0x00 } - }, - - { { -0.9, -0.9, 0.0 }, - { 0xff, 0xff, 0xff, 0x00 } - }, -}; - -GLuint arrayObj, elementObj; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - - glGenBuffersARB(1, &arrayObj); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB); - - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), 0 ); - glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), (void *)(3*sizeof(float)) ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_ARB); - - /* glDrawArrays( GL_TRIANGLES, 0, 3 ); */ - glDrawArrays( GL_TRIANGLES, 1, 3 ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vbo-drawelements.c b/progs/trivial/vbo-drawelements.c deleted file mode 100644 index b1b16d920b..0000000000 --- a/progs/trivial/vbo-drawelements.c +++ /dev/null @@ -1,138 +0,0 @@ -/* Basic VBO */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -struct { - GLfloat pos[3]; - GLubyte color[4]; -} verts[] = -{ - { { 0.9, -0.9, 0.0 }, - { 0x00, 0x00, 0xff, 0x00 } - }, - - { { 0.9, 0.9, 0.0 }, - { 0x00, 0xff, 0x00, 0x00 } - }, - - { { -0.9, 0.9, 0.0 }, - { 0xff, 0x00, 0x00, 0x00 } - }, - - { { -0.9, -0.9, 0.0 }, - { 0xff, 0xff, 0xff, 0x00 } - }, -}; - -GLuint indices[] = { 0, 1, 2, 3 }; - -GLuint arrayObj, elementObj; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - - glGenBuffersARB(1, &arrayObj); - glGenBuffersARB(1, &elementObj); - - glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj); - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementObj); - - glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB); - glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(indices), indices, GL_STATIC_DRAW_ARB); - - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), 0 ); - glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), (void *)(3*sizeof(float)) ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_ARB); - glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, NULL ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vbo-drawrange.c b/progs/trivial/vbo-drawrange.c deleted file mode 100644 index fa87eaf8fe..0000000000 --- a/progs/trivial/vbo-drawrange.c +++ /dev/null @@ -1,146 +0,0 @@ -/* Basic VBO */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -#define ELTOBJ 0 - -struct { - GLfloat pos[3]; - GLubyte color[4]; -} verts[] = -{ - { { 0.9, -0.9, 0.0 }, - { 0x00, 0x00, 0xff, 0x00 } - }, - - { { 0.9, 0.9, 0.0 }, - { 0x00, 0xff, 0x00, 0x00 } - }, - - { { -0.9, 0.9, 0.0 }, - { 0xff, 0x00, 0x00, 0x00 } - }, - - { { -0.9, -0.9, 0.0 }, - { 0xff, 0xff, 0xff, 0x00 } - }, -}; - -GLuint indices[] = { 1, 2, 3 }; - -GLuint arrayObj, elementObj; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - - glGenBuffersARB(1, &arrayObj); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB); - -#if ELTOBJ - glGenBuffersARB(1, &elementObj); - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementObj); - glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(indices), indices, GL_STATIC_DRAW_ARB); -#endif - - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), 0 ); - glColorPointer( 4, GL_UNSIGNED_BYTE, sizeof(verts[0]), (void *)(3*sizeof(float)) ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_ARB); - -#if ELTOBJ - glDrawRangeElements( GL_TRIANGLES, 1, 3, 3, GL_UNSIGNED_INT, NULL ); -#else - glDrawRangeElements( GL_TRIANGLES, 1, 3, 3, GL_UNSIGNED_INT, indices ); -#endif - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vbo-noninterleaved.c b/progs/trivial/vbo-noninterleaved.c deleted file mode 100644 index f7c42a8981..0000000000 --- a/progs/trivial/vbo-noninterleaved.c +++ /dev/null @@ -1,139 +0,0 @@ -/* Basic VBO */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - - -struct { - GLfloat pos[4][4]; - GLfloat col[4][4]; -} verts = -{ - /* Position: a quad - */ - { - { 0.9, -0.9, 0.0, 1.0 }, - { 0.9, 0.9, 0.0, 1.0 }, - { -0.9, 0.9, 0.0, 1.0 }, - { -0.9, -0.9, 0.0, 1.0 }, - }, - - /* Color: all red - */ - { - { 1.0, 0.0, 0.0, 1.0 }, - { 1.0, 0.0, 0.0, 1.0 }, - { 1.0, 0.0, 0.0, 1.0 }, - { 1.0, 0.0, 0.0, 1.0 }, - }, - - -}; - -GLuint arrayObj, elementObj; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - - glGenBuffersARB(1, &arrayObj); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), &verts, GL_STATIC_DRAW_ARB); - - glVertexPointer( 4, GL_FLOAT, sizeof(verts.pos[0]), 0 ); - glColorPointer( 4, GL_FLOAT, sizeof(verts.col[0]), (void *)(4*4*sizeof(float)) ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_ARB); - - /* glDrawArrays( GL_TRIANGLES, 0, 3 ); */ - /* glDrawArrays( GL_TRIANGLES, 1, 3 ); */ - glDrawArrays( GL_QUADS, 0, 4 ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vbo-tri.c b/progs/trivial/vbo-tri.c deleted file mode 100644 index d4cba14414..0000000000 --- a/progs/trivial/vbo-tri.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Even simpler for many drivers than trivial/tri -- pass-through - * vertex shader and vertex data in a VBO. - */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - - -struct { - GLfloat pos[4]; - GLfloat color[4]; -} verts[] = -{ - { { -0.9, -0.9, 0.0, 1.0 }, - {.8,0,0, 1}, - }, - - { { 0.9, -0.9, 0.0, 1.0 }, - { 0, .9, 0, 1 }, - }, - - { { 0, 0.9, 0.0, 1.0 }, - {0,0,.7, 1}, - }, -}; - -GLuint arrayObj; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - - glGenBuffersARB(1, &arrayObj); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, GL_STATIC_DRAW_ARB); - - glVertexPointer( 4, GL_FLOAT, sizeof(verts[0]), 0 ); - glColorPointer( 4, GL_FLOAT, sizeof(verts[0]), (void *)(4*sizeof(float)) ); -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - glDrawArrays( GL_TRIANGLES, 0, 3 ); - - glutSwapBuffers(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-array-hf.c b/progs/trivial/vp-array-hf.c deleted file mode 100644 index f812436437..0000000000 --- a/progs/trivial/vp-array-hf.c +++ /dev/null @@ -1,215 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -typedef union { GLfloat f; GLint i; } fi_type; -/** - * Convert a 4-byte float to a 2-byte half float. - * Based on code from: - * http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/008786.html - */ -static GLhalf -_mesa_float_to_half(GLfloat val) -{ - - const fi_type fi = {val}; - const int flt_m = fi.i & 0x7fffff; - const int flt_e = (fi.i >> 23) & 0xff; - const int flt_s = (fi.i >> 31) & 0x1; - int s, e, m = 0; - GLhalf result; - - /* sign bit */ - s = flt_s; - - /* handle special cases */ - if ((flt_e == 0) && (flt_m == 0)) { - /* zero */ - /* m = 0; - already set */ - e = 0; - } - else if ((flt_e == 0) && (flt_m != 0)) { - /* denorm -- denorm float maps to 0 half */ - /* m = 0; - already set */ - e = 0; - } - else if ((flt_e == 0xff) && (flt_m == 0)) { - /* infinity */ - /* m = 0; - already set */ - e = 31; - } - else if ((flt_e == 0xff) && (flt_m != 0)) { - /* NaN */ - m = 1; - e = 31; - } - else { - /* regular number */ - const int new_exp = flt_e - 127; - if (new_exp < -24) { - /* this maps to 0 */ - /* m = 0; - already set */ - e = 0; - } - else if (new_exp < -14) { - /* this maps to a denorm */ - unsigned int exp_val = (unsigned int) (-14 - new_exp); /* 2^-exp_val*/ - e = 0; - switch (exp_val) { - case 0: - /* m = 0; - already set */ - break; - case 1: m = 512 + (flt_m >> 14); break; - case 2: m = 256 + (flt_m >> 15); break; - case 3: m = 128 + (flt_m >> 16); break; - case 4: m = 64 + (flt_m >> 17); break; - case 5: m = 32 + (flt_m >> 18); break; - case 6: m = 16 + (flt_m >> 19); break; - case 7: m = 8 + (flt_m >> 20); break; - case 8: m = 4 + (flt_m >> 21); break; - case 9: m = 2 + (flt_m >> 22); break; - case 10: m = 1; break; - } - } - else if (new_exp > 15) { - /* map this value to infinity */ - /* m = 0; - already set */ - e = 31; - } - else { - /* regular */ - e = new_exp + 15; - m = flt_m >> 13; - } - } - - result = (s << 15) | (e << 10) | m; - return result; -} - - -GLfloat verts[][4] = { - { 0.9, -0.9, 0.0, 1.0 }, - { 0.9, 0.9, 0.0, 1.0 }, - { -0.9, 0.9, 0.0, 1.0 }, - { -0.9, -0.9, 0.0, 1.0 }, -}; - -GLhalf hverts[16]; - -GLubyte color[][4] = { - { 0x00, 0x00, 0xff, 0x00 }, - { 0x00, 0xff, 0x00, 0x00 }, - { 0xff, 0x00, 0x00, 0x00 }, - { 0xff, 0xff, 0xff, 0x00 }, -}; - -GLuint indices[] = { 0, 1, 2, 3 }; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - GLuint i, j; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - if (!glutExtensionSupported("GL_ARB_half_float_vertex")) { - printf("GL_ARB_half_float_vertex not found!\n"); - exit(0); - } - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - for (i = 0; i < 4; i++) - for (j = 0; j < 4; j++) - hverts[i * 4 + j] = _mesa_float_to_half(verts[i][j]); - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - glVertexPointer( 4, GL_HALF_FLOAT, 8, hverts ); - glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, indices ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-array-int.c b/progs/trivial/vp-array-int.c deleted file mode 100644 index 2e1ac1374d..0000000000 --- a/progs/trivial/vp-array-int.c +++ /dev/null @@ -1,118 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -GLint verts[][4] = { - { 1, -1, 0, 1 }, - { 1, 1, 0, 1 }, - { -1, 1, 0, 1 }, - { -1, -1, 0, 1 }, -}; - -GLubyte color[][4] = { - { 0x00, 0x00, 0xff, 0x00 }, - { 0x00, 0xff, 0x00, 0x00 }, - { 0xff, 0x00, 0x00, 0x00 }, - { 0xff, 0xff, 0xff, 0x00 }, -}; - -GLuint indices[] = { 0, 1, 2, 3 }; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - glVertexPointer( 3, GL_INT, sizeof(verts[0]), verts ); - glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, indices ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-array.c b/progs/trivial/vp-array.c deleted file mode 100644 index 852bf7d44d..0000000000 --- a/progs/trivial/vp-array.c +++ /dev/null @@ -1,118 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -GLfloat verts[][4] = { - { 0.9, -0.9, 0.0, 1.0 }, - { 0.9, 0.9, 0.0, 1.0 }, - { -0.9, 0.9, 0.0, 1.0 }, - { -0.9, -0.9, 0.0, 1.0 }, -}; - -GLubyte color[][4] = { - { 0x00, 0x00, 0xff, 0x00 }, - { 0x00, 0xff, 0x00, 0x00 }, - { 0xff, 0x00, 0x00, 0x00 }, - { 0xff, 0xff, 0xff, 0x00 }, -}; - -GLuint indices[] = { 0, 1, 2, 3 }; - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - glVertexPointer( 3, GL_FLOAT, sizeof(verts[0]), verts ); - glColorPointer( 4, GL_UNSIGNED_BYTE, 0, color ); - -} - - - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, indices ); - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-clip.c b/progs/trivial/vp-clip.c deleted file mode 100644 index 267b927b93..0000000000 --- a/progs/trivial/vp-clip.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } -} - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 2.0, -2.0, 0.0); - glColor3f(0,1,0); - glVertex3f( 2.0, 2.0, 0.0); - glColor3f(1,0,0); - glVertex3f(-2.0, 0.0, 0.0); - glEnd(); - - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-line-clip.c b/progs/trivial/vp-line-clip.c deleted file mode 100644 index d27e4aae07..0000000000 --- a/progs/trivial/vp-line-clip.c +++ /dev/null @@ -1,117 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } -} - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - -#if 0 - glBegin(GL_LINES); - glColor3f(0,0,1); - glVertex3f( 0.75, -0.75, 0.0); - glColor3f(0,1,0); - glVertex3f( 0.75, 0.75, 0.0); - - glColor3f(0,1,0); - glVertex3f( 0.75, 0.75, 0.0); - glColor3f(1,0,0); - glVertex3f(-1.75, 0.0, 0.0); - glEnd(); -#else - glBegin(GL_LINE_STRIP); - glColor3f(0,0,1); - glVertex3f( 0.75, -0.75, 0.0); - glColor3f(0,1,0); - glVertex3f( 0.75, 0.75, 0.0); - glColor3f(1,0,0); - glVertex3f(-1.75, 0.0, 0.0); - glEnd(); -#endif - - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-tri-cb-pos.c b/progs/trivial/vp-tri-cb-pos.c deleted file mode 100644 index 9cbc4d1193..0000000000 --- a/progs/trivial/vp-tri-cb-pos.c +++ /dev/null @@ -1,158 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include <stdio.h> -#include <assert.h> -#include <string.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - - - -GLenum doubleBuffer; - -static void Init(void) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "PARAM Emission = state.material.emission; \n" - "PARAM Ambient = state.material.ambient; \n" - "PARAM Diffuse = state.material.diffuse; \n" - "PARAM Specular = state.material.specular; \n" - "DP4 result.position.x, Ambient, vertex.position;\n" - "DP4 result.position.y, Diffuse, vertex.position;\n" - "DP4 result.position.z, Specular, vertex.position;\n" - "DP4 result.position.w, Emission, vertex.position;\n" - "MOV result.color, vertex.color;\n" - "END\n"; - - const float Ambient[4] = { 0.0, 1.0, 0.0, 0.0 }; - const float Diffuse[4] = { 1.0, 0.0, 0.0, 0.0 }; - const float Specular[4] = { 0.0, 0.0, 1.0, 0.0 }; - const float Emission[4] = { 0.0, 0.0, 0.0, 1.0 }; - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, Ambient); - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, Diffuse); - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Specular); - glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, Emission); - - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - glEnable(GL_VERTEX_PROGRAM_NV); - -} - - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-tri-cb-tex.c b/progs/trivial/vp-tri-cb-tex.c deleted file mode 100644 index e543e2ec3f..0000000000 --- a/progs/trivial/vp-tri-cb-tex.c +++ /dev/null @@ -1,191 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include <stdio.h> -#include <assert.h> -#include <string.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - - - -GLenum doubleBuffer; - -static void Init(void) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "PARAM Emission = state.material.emission; \n" - "PARAM Ambient = state.material.ambient; \n" - "PARAM Diffuse = state.material.diffuse; \n" - "PARAM Specular = state.material.specular; \n" - "DP4 result.position.x, Ambient, vertex.position;\n" - "DP4 result.position.y, Diffuse, vertex.position;\n" - "DP4 result.position.z, Specular, vertex.position;\n" - "DP4 result.position.w, Emission, vertex.position;\n" - "MOV result.texcoord[0], vertex.texcoord[0];\n" - "END\n"; - - const float Ambient[4] = { 0.0, 1.0, 0.0, 0.0 }; - const float Diffuse[4] = { 1.0, 0.0, 0.0, 0.0 }; - const float Specular[4] = { 0.0, 0.0, 1.0, 0.0 }; - const float Emission[4] = { 0.0, 0.0, 0.0, 1.0 }; - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, Ambient); - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, Diffuse); - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Specular); - glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, Emission); - - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - glEnable(GL_VERTEX_PROGRAM_NV); - -#define SIZE 32 - { - GLubyte tex2d[SIZE][SIZE][3]; - GLint s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { -#if 0 - tex2d[t][s][0] = (s < SIZE/2) ? 0 : 255; - tex2d[t][s][1] = (t < SIZE/2) ? 0 : 255; - tex2d[t][s][2] = 0; -#else - tex2d[t][s][0] = s*255/(SIZE-1); - tex2d[t][s][1] = t*255/(SIZE-1); - tex2d[t][s][2] = 0; -#endif - } - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - glTexImage2D(GL_TEXTURE_2D, 0, 3, SIZE, SIZE, 0, - GL_RGB, GL_UNSIGNED_BYTE, tex2d); - - glEnable(GL_TEXTURE_2D); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - } - -} - - -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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glBegin(GL_TRIANGLES); - glTexCoord2f(1,-1); - glVertex3f( 0.9, -0.9, -0.0); - glTexCoord2f(1,1); - glVertex3f( 0.9, 0.9, -0.0); - glTexCoord2f(-1,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - glewInit(); - - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-tri-cb.c b/progs/trivial/vp-tri-cb.c deleted file mode 100644 index 1f12a2c297..0000000000 --- a/progs/trivial/vp-tri-cb.c +++ /dev/null @@ -1,108 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "PARAM Diffuse = state.material.diffuse; \n" - "MOV result.color, Diffuse;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - const float Diffuse[4] = { 0.0, 1.0, 0.0, 1.0 }; - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, Diffuse); - - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } -} - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-tri-imm.c b/progs/trivial/vp-tri-imm.c deleted file mode 100644 index f2549f3697..0000000000 --- a/progs/trivial/vp-tri-imm.c +++ /dev/null @@ -1,102 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "ADD result.color, vertex.color, {.5}.x;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } -} - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,0); - glVertex3f( 0.9, -0.9, -0.0); - glVertex3f( 0.9, 0.9, -0.0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-tri-invariant.c b/progs/trivial/vp-tri-invariant.c deleted file mode 100644 index 4dbe95eb9a..0000000000 --- a/progs/trivial/vp-tri-invariant.c +++ /dev/null @@ -1,147 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - - -#define CI_OFFSET_1 16 -#define CI_OFFSET_2 32 - - -GLenum doubleBuffer; - -static void Init(void) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "OPTION ARB_position_invariant ;" - "MOV result.color, vertex.color;\n" - "END\n"; - - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - - fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); - fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); - fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); - fflush(stderr); - - glClearColor(0.0, 0.0, 1.0, 0.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: - break; - } - - glutPostRedisplay(); -} - -static void Draw(void) -{ - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_VERTEX_PROGRAM_ARB); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - glFlush(); - - if (doubleBuffer) { - glutSwapBuffers(); - } -} - -static GLenum Args(int argc, char **argv) -{ - GLint i; - - doubleBuffer = GL_FALSE; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-sb") == 0) { - doubleBuffer = GL_FALSE; - } else if (strcmp(argv[i], "-db") == 0) { - doubleBuffer = GL_TRUE; - } else { - fprintf(stderr, "%s (Bad option).\n", argv[i]); - return GL_FALSE; - } - } - return GL_TRUE; -} - -int main(int argc, char **argv) -{ - GLenum type; - - glutInit(&argc, argv); - - if (Args(argc, argv) == GL_FALSE) { - exit(1); - } - - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); - - type = GLUT_RGB | GLUT_ALPHA; - type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; - glutInitDisplayMode(type); - - if (glutCreateWindow(*argv) == GL_FALSE) { - exit(1); - } - - glewInit(); - Init(); - - glutReshapeFunc(Reshape); - glutKeyboardFunc(Key); - glutDisplayFunc(Draw); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-tri-swap.c b/progs/trivial/vp-tri-swap.c deleted file mode 100644 index a3ab1206fd..0000000000 --- a/progs/trivial/vp-tri-swap.c +++ /dev/null @@ -1,104 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.position, vertex.color;\n" - "MOV result.color, vertex.position;\n" - "END\n"; - - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } -} - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-tri-tex.c b/progs/trivial/vp-tri-tex.c deleted file mode 100644 index bd2b5e59f9..0000000000 --- a/progs/trivial/vp-tri-tex.c +++ /dev/null @@ -1,138 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.texcoord[0], vertex.texcoord[0];\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } - -#define SIZE 32 - { - GLubyte tex2d[SIZE][SIZE][3]; - GLint s, t; - - for (s = 0; s < SIZE; s++) { - for (t = 0; t < SIZE; t++) { -#if 0 - tex2d[t][s][0] = (s < SIZE/2) ? 0 : 255; - tex2d[t][s][1] = (t < SIZE/2) ? 0 : 255; - tex2d[t][s][2] = 0; -#else - tex2d[t][s][0] = s*255/(SIZE-1); - tex2d[t][s][1] = t*255/(SIZE-1); - tex2d[t][s][2] = 0; -#endif - } - } - - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - - glTexImage2D(GL_TEXTURE_2D, 0, 3, SIZE, SIZE, 0, - GL_RGB, GL_UNSIGNED_BYTE, tex2d); - - glEnable(GL_TEXTURE_2D); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - } - -} - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - glBegin(GL_TRIANGLES); - glTexCoord2f(1,-1); - glVertex3f( 0.9, -0.9, -0.0); - glTexCoord2f(1,1); - glVertex3f( 0.9, 0.9, -0.0); - glTexCoord2f(-1,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-tri.c b/progs/trivial/vp-tri.c deleted file mode 100644 index 2932977314..0000000000 --- a/progs/trivial/vp-tri.c +++ /dev/null @@ -1,105 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" -/* "MOV result.color, {0,0,0,1};\n" */ - "MOV result.position, vertex.position;\n" - "END\n"; - - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } -} - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - - glEnable(GL_VERTEX_PROGRAM_NV); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,.7); - glVertex3f( 0.9, -0.9, -0.0); - glColor3f(.8,0,0); - glVertex3f( 0.9, 0.9, -0.0); - glColor3f(0,.9,0); - glVertex3f(-0.9, 0.0, -0.0); - glEnd(); - - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_DEPTH | GLUT_RGB | GLUT_SINGLE ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} diff --git a/progs/trivial/vp-unfilled.c b/progs/trivial/vp-unfilled.c deleted file mode 100644 index fe2de674ea..0000000000 --- a/progs/trivial/vp-unfilled.c +++ /dev/null @@ -1,105 +0,0 @@ -/* Test glGenProgramsNV(), glIsProgramNV(), glLoadProgramNV() */ - -#include <assert.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> -#include <GL/glew.h> -#include <GL/glut.h> - -static void Init( void ) -{ - GLint errno; - GLuint prognum; - - static const char *prog1 = - "!!ARBvp1.0\n" - "MOV result.color, vertex.color;\n" - "MOV result.position, vertex.position;\n" - "END\n"; - - glGenProgramsARB(1, &prognum); - - glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prognum); - glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen(prog1), (const GLubyte *) prog1); - - assert(glIsProgramARB(prognum)); - errno = glGetError(); - printf("glGetError = %d\n", errno); - if (errno != GL_NO_ERROR) - { - GLint errorpos; - - glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorpos); - printf("errorpos: %d\n", errorpos); - printf("%s\n", (char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)); - } -} - -static void Display( void ) -{ - glClearColor(0.3, 0.3, 0.3, 1); - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); - glPolygonMode(GL_FRONT, GL_LINE); - glPolygonMode(GL_BACK, GL_POINT); - - glEnable(GL_VERTEX_PROGRAM_NV); - - glBegin(GL_TRIANGLES); - glColor3f(0,0,1); - glVertex3f( 0.9, -0.9, 0.0); - glColor3f(0,1,0); - glVertex3f( 0.9, 0.9, 0.0); - glColor3f(1,0,0); - glVertex3f(-0.9, 0.0, 0.0); - glEnd(); - - - glFlush(); -} - - -static void Reshape( int width, int height ) -{ - glViewport( 0, 0, width, height ); - glMatrixMode( GL_PROJECTION ); - glLoadIdentity(); - glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); - glMatrixMode( GL_MODELVIEW ); - glLoadIdentity(); - /*glTranslatef( 0.0, 0.0, -15.0 );*/ -} - - -static void Key( unsigned char key, int x, int y ) -{ - (void) x; - (void) y; - switch (key) { - case 27: - exit(0); - break; - } - glutPostRedisplay(); -} - - - - -int main( int argc, char *argv[] ) -{ - glutInit( &argc, argv ); - glutInitWindowPosition( 0, 0 ); - glutInitWindowSize( 250, 250 ); - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH ); - glutCreateWindow(argv[0]); - glewInit(); - glutReshapeFunc( Reshape ); - glutKeyboardFunc( Key ); - glutDisplayFunc( Display ); - Init(); - glutMainLoop(); - return 0; -} |