aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/extras/Mesa_6.4.1/progs/samples
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/extras/Mesa_6.4.1/progs/samples')
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/.cvsignore45
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/Imakefile101
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile48
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.DJ85
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.dja25
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.mgw68
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.win41
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/README520
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/accum.c157
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/bitmap1.c250
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/bitmap2.c787
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/blendeq.c319
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/blendxor.c206
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/copy.c193
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/cursor.c150
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/depth.c209
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/eval.c472
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/fog.c311
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/font.c273
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/line.c219
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/loadppm.c72
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/logo.c1635
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/nurb.c357
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/oglinfo.c218
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/olympic.c389
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/overlay.c378
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/point.c234
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/prim.c546
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/quad.c457
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/rgbtoppm.c285
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/select.c456
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/shape.c345
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/sphere.c1014
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/star.c345
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/stencil.c143
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/stretch.c390
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/texture.c474
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/tkmap.c71
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/tri.c403
-rw-r--r--nx-X11/extras/Mesa_6.4.1/progs/samples/wave.c619
40 files changed, 13310 insertions, 0 deletions
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/.cvsignore b/nx-X11/extras/Mesa_6.4.1/progs/samples/.cvsignore
new file mode 100644
index 000000000..12b065056
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/.cvsignore
@@ -0,0 +1,45 @@
+.cvsignore
+accum
+bitmap1
+bitmap2
+blendeq
+blendxor
+copy
+cursor
+depth
+eval
+fog
+font
+line
+logo
+nurb
+oglinfo
+olympic
+overlay
+point
+prim
+quad
+select
+shape
+sphere
+star
+stencil
+stretch
+texture
+tri
+wave
+bugger
+pend
+lthreads
+lxdemo
+lxgears
+lxheads
+lxinfo
+lxpixmap
+anywin
+ffset
+bdemo
+binfo
+incopy
+demo
+font
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/Imakefile b/nx-X11/extras/Mesa_6.4.1/progs/samples/Imakefile
new file mode 100644
index 000000000..948a97835
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/Imakefile
@@ -0,0 +1,101 @@
+LOCAL_LIBRARIES = $(XLIB) $(TOP)\lib\glut.a $(TOP)\lib\Mesaglu.a $(TOP)\lib\MesaGL.a
+
+INCLUDES = -I$(TOP)\include
+
+SRCS = accum.c \
+ bitmap1.c \
+ bitmap2.c \
+ blendeq.c \
+ blendxor.c \
+ copy.c \
+ cursor.c \
+ depth.c \
+ eval.c \
+ fog.c \
+ font.c \
+ line.c \
+ logo.c \
+ nurb.c \
+ oglinfo.c \
+ olympic.c \
+ overlay.c \
+ point.c \
+ prim.c \
+ quad.c \
+ select.c \
+ shape.c \
+ speed.c \
+ sphere.c \
+ star.c \
+ stencil.c \
+ stretch.c \
+ texture.c \
+ tri.c \
+ wave.c
+
+PROGRAMS = ProgramTargetName(accum) \
+ ProgramTargetName(bitmap1) \
+ ProgramTargetName(bitmap2) \
+ ProgramTargetName(blendeq) \
+ ProgramTargetName(blendxor) \
+ ProgramTargetName(copy) \
+ ProgramTargetName(cursor) \
+ ProgramTargetName(depth) \
+ ProgramTargetName(eval) \
+ ProgramTargetName(fog) \
+ ProgramTargetName(font) \
+ ProgramTargetName(line) \
+ ProgramTargetName(logo) \
+ ProgramTargetName(nurb) \
+ ProgramTargetName(oglinfo) \
+ ProgramTargetName(olympic) \
+ ProgramTargetName(overlay) \
+ ProgramTargetName(point) \
+ ProgramTargetName(prim) \
+ ProgramTargetName(quad) \
+ ProgramTargetName(select) \
+ ProgramTargetName(shape) \
+ ProgramTargetName(speed) \
+ ProgramTargetName(sphere) \
+ ProgramTargetName(star) \
+ ProgramTargetName(stencil) \
+ ProgramTargetName(stretch) \
+ ProgramTargetName(texture) \
+ ProgramTargetName(tri) \
+ ProgramTargetName(wave)
+
+AllTarget($(PROGRAMS))
+
+NormalProgramTarget(accum,accum.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(bitmap1,bitmap1.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(bitmap2,bitmap2.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(blendeq,blendeq.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(blendxor,blendxor.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(copy,copy.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(cursor,cursor.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(depth,depth.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(eval,eval.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(fog,fog.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(font,font.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(line,line.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(logo,logo.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(nurb,nurb.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(oglinfo,oglinfo.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(olympic,olympic.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(overlay,overlay.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(point,point.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(prim,prim.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(quad,quad.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(select,select.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(shape,shape.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(speed,speed.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(sphere,sphere.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(star,star.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(stencil,stencil.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(stretch,stretch.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(texture,texture.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(tri,tri.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+NormalProgramTarget(wave,wave.o,NullParameter,$(LOCAL_LIBRARIES),NullParameter)
+
+DependTarget()
+
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile b/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile
new file mode 100644
index 000000000..f14b7dfc0
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile
@@ -0,0 +1,48 @@
+# progs/samples/Makefile
+
+TOP = ../..
+include $(TOP)/configs/current
+
+INCDIR = $(TOP)/include
+
+LIB_DEP = $(LIB_DIR)/$(GL_LIB_NAME) $(LIB_DIR)/$(GLU_LIB_NAME) $(LIB_DIR)/$(GLUT_LIB_NAME)
+
+PROGS = accum bitmap1 bitmap2 blendeq blendxor copy cursor depth eval fog \
+ font line logo nurb olympic overlay point prim quad select \
+ shape sphere star stencil stretch texture tri wave
+
+
+##### RULES #####
+
+.SUFFIXES:
+.SUFFIXES: .c
+
+.c: $(LIB_DEP)
+ $(CC) -I$(INCDIR) $(CFLAGS) $< $(APP_LIB_DEPS) -o $@
+
+
+##### TARGETS #####
+
+default: $(PROGS)
+
+
+sphere: sphere.o readtex.o
+ $(CC) -I$(INCDIR) $(CFLAGS) sphere.o readtex.o $(APP_LIB_DEPS) -o $@
+
+sphere.o: sphere.c readtex.h
+ $(CC) -c -I$(INCDIR) $(CFLAGS) sphere.c
+
+readtex.c: $(TOP)/progs/util/readtex.c
+ cp $< .
+
+readtex.h: $(TOP)/progs/util/readtex.h
+ cp $< .
+
+readtex.o: readtex.c readtex.h
+ $(CC) -c -I$(INCDIR) $(CFLAGS) $< -o $@
+
+
+clean:
+ -rm -f $(PROGS)
+ -rm -f *.o *~
+ -rm -f readtex.c readtex.h
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.DJ b/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.DJ
new file mode 100644
index 000000000..cda4e0594
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.DJ
@@ -0,0 +1,85 @@
+# Mesa 3-D graphics library
+# Version: 4.0
+#
+# Copyright (C) 1999 Brian Paul All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+# DOS/DJGPP samples makefile v1.6 for Mesa
+#
+# Copyright (C) 2002 - Daniel Borca
+# Email : dborca@users.sourceforge.net
+# Web : http://www.geocities.com/dborca
+
+
+#
+# Available options:
+#
+# Environment variables:
+# GLIDE path to Glide3 SDK; used with FX.
+# default = $(TOP)/glide3
+# FX=1 build for 3dfx Glide3. Note that this disables
+# compilation of most DMesa code and requires fxMesa.
+# As a consequence, you'll need the DJGPP Glide3
+# library to build any application.
+# default = no
+# DXE=1 use DXE modules (see README.DJ for details).
+# default = no
+#
+# Targets:
+# <file.exe> build a specific file
+#
+
+
+
+.PHONY: all
+.SUFFIXES: .c .o .exe
+.SECONDARY: ../util/readtex.o ../util/showbuffer.o
+
+TOP = ../..
+GLIDE ?= $(TOP)/glide3
+
+CC = gcc
+CFLAGS = -Wall -W -pedantic
+CFLAGS += -O2 -ffast-math
+CFLAGS += -I$(TOP)/include -I../util
+CFLAGS += -DGLUT_IMPORT_LIB
+ifeq ($(FX),1)
+CFLAGS += -DFX
+endif
+
+LD = gxx
+LDFLAGS = -s -L$(TOP)/lib
+
+ifeq ($(DXE),1)
+LDLIBS += -liglut -liglu -ligl
+else
+LDLIBS = -lglut -lglu -lgl
+ifeq ($(FX),1)
+LDFLAGS += -L$(GLIDE)/lib
+LDLIBS += -lgld3x
+endif
+endif
+
+.c.o:
+ $(CC) -o $@ $(CFLAGS) -c $<
+%.exe: ../util/readtex.o ../util/showbuffer.o %.o
+ $(LD) -o $@ $(LDFLAGS) $^ $(LDLIBS)
+
+all:
+ $(error Must specify <filename.exe> to build)
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.dja b/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.dja
new file mode 100644
index 000000000..b60a11197
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.dja
@@ -0,0 +1,25 @@
+
+# Makefile for sample programs for MS-DOS with DJGPP and ALLEGRO
+
+
+
+INCDIR = ../include
+LIBDIR = ../lib
+include ../common.dja
+
+ _PROGS = accum bitmap1 bitmap2 blendeq blendxor copy cursor depth \
+ eval fog font line logo nurb oglinfo olympic overlay point \
+ prim quad select shape sphere star stencil stretch texture \
+ tri wave
+
+ PROGS = $(_PROGS:=.exe)
+
+
+default: $(PROGS)
+
+clean:
+ del *.
+
+realclean: clean
+ del *.exe
+
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.mgw b/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.mgw
new file mode 100644
index 000000000..119354057
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.mgw
@@ -0,0 +1,68 @@
+# Mesa 3-D graphics library
+# Version: 4.0
+#
+# Copyright (C) 1999 Brian Paul All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+# MinGW samples makefile v1.2 for Mesa
+#
+# Copyright (C) 2002 - Daniel Borca
+# Email : dborca@users.sourceforge.net
+# Web : http://www.geocities.com/dborca
+
+
+#
+# Available options:
+#
+# Environment variables:
+#
+# Targets:
+# <file.exe> build a specific file
+#
+
+
+
+.PHONY: all
+.SUFFIXES: .c .o .exe
+.SECONDARY: ../util/readtex.o ../util/showbuffer.o
+
+TOP = ../..
+
+CC = mingw32-gcc
+CFLAGS = -Wall -W -pedantic
+CFLAGS += -O2 -ffast-math
+CFLAGS += -I$(TOP)/include -I../util
+ifeq ($(FX),1)
+CFLAGS += -DFX
+endif
+CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK -D_STDCALL_SUPPORTED
+CFLAGS += -D_WINDEF_ -D_WINGDI_
+
+LD = mingw32-g++
+LDFLAGS = -s -L$(TOP)/lib
+
+LDLIBS = -lglut32 -lglu32 -lopengl32
+
+.c.o:
+ $(CC) -o $@ $(CFLAGS) -c $<
+%.exe: ../util/readtex.o ../util/showbuffer.o %.o
+ $(LD) -o $@ $(LDFLAGS) $^ $(LDLIBS)
+
+all:
+ $(error Must specify <filename.exe> to build)
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.win b/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.win
new file mode 100644
index 000000000..e74568f7c
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/Makefile.win
@@ -0,0 +1,41 @@
+
+# Mesa 3-D graphics library
+# Version: 3.5
+# Copyright (C) 1995-2001 Brian Paul
+
+# Makefile for GLUT-based demo programs for Windows
+
+!include <win32.mak>
+
+##### MACROS #####
+
+TOP = ..
+INCDIR = ..\include
+LIBDIR = ..\lib
+
+PROGS = accum bitmap1 bitmap2 blendeq blendxor copy cursor depth eval fog \
+ font line logo nurb oglinfo olympic overlay point prim quad select \
+ shape sphere star stencil stretch texture tri wave
+
+SRCS = \
+ accum.c \
+ bitmap1.c \
+ bitmap2.c \
+ blendeq.c \
+ blendxor.c \
+ copy.c \
+ cursor.c depth.c eval.c fog.c \
+ font.c line.c logo.c nurb.c olympic.c overlay.c point.c prim.c quad.c select.c \
+ shape.c sphere.c star.c stencil.c stretch.c texture.c tri.c wave.c
+
+!include "../mesawin32.mak"
+
+##### TARGETS #####
+
+clean::
+
+clobber::
+
+$(EXES) : $*.obj
+ @echo $@
+ $(link) -out:$@ $* /LIBPATH:$(LIBDIR) $(LIBS)
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/README b/nx-X11/extras/Mesa_6.4.1/progs/samples/README
new file mode 100644
index 000000000..853158873
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/README
@@ -0,0 +1,520 @@
+/*
+ * 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.
+ */
+
+accum - Accumulation test.
+ - RGBA, SB/DB (SB default).
+ - cmd line options:
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit
+ 1 Use filled polygon mode.
+ 2 Use outlined polygon mode.
+
+bitmap1 - Bitmap test.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+
+bitmap2 - Bitmap test.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ 1 Toggle display list mode.
+ 2 Toggle color animation mode.
+
+copy - Pixel copy test.
+ - RGBA, SB/DB (SB default).
+ - cmd line options:
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ -dr Direct render mode.
+ -ir Indirect render mode.
+ -f <file name> RGB image file.
+ - keys:
+ ESC Quit.
+ Z Increase zoom factor.
+ z Decrease zoom factor.
+ - mouse input:
+ Left Copy location.
+
+cursor - Cursor test.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ SPACE switch cursor color.
+
+depth - Z buffer test.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ 1 Toggle anti-aliased mode.
+ 2 Toggle stipple mode.
+
+eval - Evaluator test.
+ - RGBA, SB/DB (SB default).
+ - cmd line options:
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ LEFT Rotate.
+ RIGHT Rotate.
+ UP Rotate.
+ DOWN Rotate.
+ 1 Toggle dimensions.
+ 2 Toggle dimensions.
+ e Use eval mode.
+ m Use mesh mode.
+ f Toggle polygon mode.
+ p Toggle point mode.
+ c Toggle color mode.
+ t Toggle texture mode.
+ l Toggle lighting mode.
+
+fog - Fog test.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ LEFT Rotate.
+ RIGHT Rotate.
+ UP Rotate.
+ DOWN Rotate.
+ D Increase fog density.
+ d Decrease fog density.
+
+font - font test.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ Left Shift left.
+ Right Shift right.
+ Up Shift up.
+ Down Shift down.
+ n Shift in.
+ m Shift out.
+ q Scale up x.
+ w Scale down x.
+ a Scale up y.
+ s Scale down y.
+ z Scale up z.
+ x Scale down z.
+ e Rotate clockwise x.
+ r Rotate counter-clockwise x.
+ d Rotate clockwise y.
+ f Rotate counter-clockwise y.
+ c Rotate clockwise z.
+ v Rotate counter-clockwise z.
+
+line - Line test.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ W Increase line width.
+ w Decrease line width.
+ 1 Toggle stipple mode.
+ 2 Toggle anti-aliased mode.
+
+logo - Demo.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ LEFT Rotate.
+ RIGHT Rotate
+ UP Move clipping plane.
+ DOWN Move clipping plane.
+ Z Translate.
+ z Translate.
+ 1 Use GL_POINT polygon mode.
+ 2 Use GL_LINE polygon mode.
+ 3 Use GL_FILL polygon mode.
+ p Toggle polygon fill modes.
+ 4 Use GL_NICEST for GL_POLYGON_SMOOTH_HINT.
+ 5 Use anti-aliased polygon mode.
+ 6 Use aliased polygon mode.
+ 8 Toggle dither mode.
+ 9 Toggle stipple polygon mode.
+ 0 Toggle flat/smooth shading mode.
+ q Disable cull mode.
+ w Use front face cull mode.
+ e Use back face cull mode.
+ r Use clockwise front face mode.
+ t Use counter-clockwise front face mode.
+ y Use MSB first stipple pattern.
+ u Use LSB first stipple pattern.
+ a Use brick texture map.
+ s Use checker texture map.
+ d Disable texture map.
+ f Use decal texture environment mode.
+ g Use modulate texture environment mode.
+
+nurb - Nurb test.
+ - RGBA, SB/DB (SB default).
+ - cmd line options:
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ LEFT Rotate.
+ RIGHT Rotate.
+ UP Rotate.
+ DOWN Rotate.
+
+olympic - Olymipic rings demo.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ SPACE Restart demo.
+
+overlay - Overlay plane demo.
+ - RGBA, SB/DB (SB default).
+ - cmd line options:
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ SPACE Toggle star weird movement mode.
+ t Toggle star turbo mode.
+
+point - Point test.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ LEFT Translate.
+ RIGHT Translate.
+ UP Translate.
+ DOWN Translate.
+ W Increase point width.
+ w Decrease point width.
+ 1 Toggle anti-aliased mode.
+
+prim - Primitive test.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ 1 Toggle flat/smooth shade mode.
+ 2 Toggle outlined/filled polygon mode.
+ 3 Toggle color mask mode.
+
+quad - Quadric test.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ -dr Direct render mode.
+ -ir Indirect render mode.
+ -f <file name> texture file.
+ - keys:
+ ESC Quit.
+ LEFT Rotate.
+ RIGHT Rotate.
+ UP Rotate.
+ DOWN Rotate.
+ X Rotate.
+ x Rotate.
+ 1 Use GLU_FILL draw style.
+ 2 Use GLU_POINT draw style.
+ 3 Use GLU_LINE draw style.
+ 4 Use GLU_SILHOUETTE draw style.
+ 0 Toggle flat/smooth shade mode.
+ f Cylce through quadrics.
+ d Toggle orientation.
+ A Increase number of stacks.
+ a Decrease number of stacks.
+ S Increase number of slices.
+ s Decrease number of slices.
+ G Increase radius1.
+ g Decrease radius1.
+ J Increase radius2.
+ j Decrease radius2.
+ H Increase height.
+ h Decrease height.
+ K Increase angle1.
+ k Decrease angle1.
+ L Increase angle2.
+ l Decrease angle2.
+ z Toggle texture mode.
+ q Disable cull mode.
+ w Use front face cull mode.
+ e Use back face cull mode.
+ r Use clockwise front face mode.
+ t Use counter-clockwise front face mode.
+ y Toggle dither mode.
+
+select - Selection test.
+ - RGBA, SB.
+ - cmd line options:
+ - keys:
+ ESC Quit.
+ LEFT Rotate.
+ RIGHT Rotate.
+ Z Increase zoom factor.
+ z Decrease zoom factor.
+ d Zoom at current mouse location.
+ f Print feedback information.
+ l Toggle outlined/filled polygon mode.
+ - mouse:
+ Left Recolor selected triangle.
+ Center Enlarge selected triangle.
+ Right Delete selected triangle.
+
+shape - shape test.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ Left Shift left.
+ Right Shift right.
+ Up Shift up.
+ Down Shift down.
+ n Shift in.
+ m Shift out.
+ q Scale up x.
+ w Scale down x.
+ a Scale up y.
+ s Scale down y.
+ z Scale up z.
+ x Scale down z.
+ e Rotate clockwise x.
+ r Rotate counter-clockwise x.
+ d Rotate clockwise y.
+ f Rotate counter-clockwise y.
+ c Rotate clockwise z.
+ v Rotate counter-clockwise z.
+ SPACE switch shapes.
+
+speed - Speed test.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ a Toggle anti-aliased mode.
+ d Toggle z buffering mode.
+ f Toggle fog mode.
+ F Toggle fog hint mode.
+ s Toggle flat/smooth shading mode.
+ t Toggle texturing mode.
+
+sphere - Spheremap test.
+ - RGBA, SB/DB (SB default).
+ - cmd line options:
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ -dr Direct render mode.
+ -ir Indirect render mode.
+ -f <file name> texture file.
+ -3 Use RGB components.
+ -4 Use RGBA components.
+ - keys:
+ ESC Quit.
+ LEFT Rotate about the y axis.
+ RIGHT Rotate about the y axis.
+ UP Rotate about the x axis.
+ DOWN Rotate about the x axis.
+ a Toggle auto rotate mode.
+ c toggle between cylinder or cube object.
+ t Use torus object.
+ d Use decal texture mode.
+ m Use modulate texture mode.
+ l Toggle lighted mode.
+ f Toggle fog mode.
+ 0 Use nearest magification filter.
+ 1 Use linear magification.
+ 2 Use nearest minification filter.
+ 3 Use linear minification filter.
+ 4 Use nearest-mipmap-nearest minification filter.
+ 5 Use nearest-mipmap-linear minification filter.
+ 6 Use linear-mipmap-nearest minification filter.
+ 7 Use linear-mipmap-linear minification filter.
+
+star - Demo.
+ - RGBA, SB/DB (SB default).
+ - cmd line options:
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ SPACE Toggle weird movement mode.
+ t Toggle turbo mode.
+
+stencil - Stencil test.
+ - RGBA, SB.
+ - cmd line options:
+
+stretch - Texture test.
+ - RGBA, SB.
+ - cmd line options:
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ -dr Direct render mode.
+ -ir Indirect render mode.
+ -f <file name> texture file.
+ - keys:
+ ESC Quit.
+ SPACE Start animation.
+ - mouse:
+ Left Added stretch point.
+
+texture - Texture test.
+ - RGBA, SB/DB (SB default).
+ - cmd line options:
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ -dr Direct render mode.
+ -ir Indirect render mode.
+ -f <file name> texture file.
+ - keys:
+ ESC Quit.
+ LEFT Rotate.
+ RIGHT Rotate.
+ UP Rotate.
+ DOWN Rotate.
+ T Translate.
+ t Translate.
+ s Toggle sphere map mode.
+ 0 Use nearest magification filter.
+ 1 Use linear magification filter.
+ 2 Use nearest minification filter.
+ 3 Use linear minification filter.
+ 4 Use nearest-mipmap-nearest minification filter.
+ 5 Use nearest-mipmap-linear minification filter.
+ 6 Use linear-mipmap-nearest minification filter.
+ 7 Use linear-mipmap-linear minification filter.
+
+tri - Triangle test.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ - keys:
+ ESC Quit.
+ LEFT Translate.
+ RIGHT Translate.
+ Z Increase zoom factor.
+ z Decrease zoom factor.
+ 1 Use point polygon mode.
+ 2 Use line polygon mode.
+ 3 Use filled polygon mode.
+ 4 Use point primitive.
+ 5 Use line-loop primitive.
+ 6 Use polygon primitive.
+ 7 Toggle cull mode.
+ 8 Use clockwise/counter-clockwise front face mode.
+ 9 Toggle front/back face cull mode.
+ v Toggle show verticies mode.
+ s Toggle flat/smooth shade mode.
+ h Toggle hide bottom triangle mode.
+ o Toggle outline mode.
+ m Toggle dither mode.
+ 0 Toggle anti-aliased mode.
+
+wave - Demo.
+ - RGBA/CI (RGBA default), SB/DB (SB default).
+ - cmd line options:
+ -rgb RGBA mode.
+ -ci Color index mode.
+ -sb Single buffer mode.
+ -db Double buffer mode.
+ -dr Direct render mode.
+ -ir Indirect render mode.
+ -grid <x> <y> Number of grids.
+ -size <number> Size of grid.
+ -wave <number> Height of wave (floating point number).
+ -frames <count> Number of frames.
+ - keys:
+ ESC Quit.
+ c Toggle contouring mode.
+ s Toggle flat/smooth shade mode.
+ l Toggle lighting mode.
+ d Toggle depth checking mode.
+ SPACE Toggle step/animation mode.
+ n Single step in step mode.
+ a Toggle spin mode.
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/accum.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/accum.c
new file mode 100644
index 000000000..24dfc07d2
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/accum.c
@@ -0,0 +1,157 @@
+/*
+ * 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;
+GLint thing1, thing2;
+
+
+static void Init(void)
+{
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClearAccum(0.0, 0.0, 0.0, 0.0);
+
+ thing1 = glGenLists(1);
+ glNewList(thing1, GL_COMPILE);
+ glColor3f(1.0, 0.0, 0.0);
+ glRectf(-1.0, -1.0, 1.0, 0.0);
+ glEndList();
+
+ thing2 = glGenLists(1);
+ glNewList(thing2, GL_COMPILE);
+ glColor3f(0.0, 1.0, 0.0);
+ glRectf(0.0, -1.0, 1.0, 1.0);
+ glEndList();
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+ (void) x;
+ (void) y;
+ switch (key) {
+ case 27:
+ exit(1);
+ case '1':
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ break;
+ case '2':
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+
+ glPushMatrix();
+
+ glScalef(0.8, 0.8, 1.0);
+
+ glClear(GL_COLOR_BUFFER_BIT);
+ glCallList(thing1);
+ glAccum(GL_LOAD, 0.5);
+
+ glClear(GL_COLOR_BUFFER_BIT);
+ glCallList(thing2);
+ glAccum(GL_ACCUM, 0.5);
+
+ glAccum(GL_RETURN, 1.0);
+
+ 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 {
+ 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_ACCUM;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Accum Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/bitmap1.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/bitmap1.c
new file mode 100644
index 000000000..517d584e2
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/bitmap1.c
@@ -0,0 +1,250 @@
+/*
+ * 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 OPENGL_WIDTH 24
+#define OPENGL_HEIGHT 13
+
+
+GLenum rgb, doubleBuffer, windType;
+
+float boxA[3] = {
+ 0, 0, 0
+};
+float boxB[3] = {
+ -100, 0, 0
+};
+float boxC[3] = {
+ 100, 0, 0
+};
+float boxD[3] = {
+ 0, 95, 0
+};
+float boxE[3] = {
+ 0, -105, 0
+};
+GLubyte OpenGL_bits1[] = {
+ 0x00, 0x03, 0x00,
+ 0x7f, 0xfb, 0xff,
+ 0x7f, 0xfb, 0xff,
+ 0x00, 0x03, 0x00,
+ 0x3e, 0x8f, 0xb7,
+ 0x63, 0xdb, 0xb0,
+ 0x63, 0xdb, 0xb7,
+ 0x63, 0xdb, 0xb6,
+ 0x63, 0x8f, 0xf3,
+ 0x63, 0x00, 0x00,
+ 0x63, 0x00, 0x00,
+ 0x63, 0x00, 0x00,
+ 0x3e, 0x00, 0x00,
+};
+GLubyte OpenGL_bits2[] = {
+ 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0x01,
+ 0xff, 0xff, 0x01,
+ 0x00, 0x00, 0x00,
+ 0xf9, 0xfc, 0x01,
+ 0x8d, 0x0d, 0x00,
+ 0x8d, 0x0d, 0x00,
+ 0x8d, 0x0d, 0x00,
+ 0xcc, 0x0d, 0x00,
+ 0x0c, 0x4c, 0x0a,
+ 0x0c, 0x4c, 0x0e,
+ 0x8c, 0xed, 0x0e,
+ 0xf8, 0x0c, 0x00,
+};
+GLubyte logo_bits[] = {
+ 0x00, 0x66, 0x66,
+ 0xff, 0x66, 0x66,
+ 0x00, 0x00, 0x00,
+ 0xff, 0x3c, 0x3c,
+ 0x00, 0x42, 0x40,
+ 0xff, 0x42, 0x40,
+ 0x00, 0x41, 0x40,
+ 0xff, 0x21, 0x20,
+ 0x00, 0x2f, 0x20,
+ 0xff, 0x20, 0x20,
+ 0x00, 0x10, 0x90,
+ 0xff, 0x10, 0x90,
+ 0x00, 0x0f, 0x10,
+ 0xff, 0x00, 0x00,
+ 0x00, 0x66, 0x66,
+ 0xff, 0x66, 0x66,
+};
+
+#include "tkmap.c"
+
+static void Init(void)
+{
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClearIndex(0.0);
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(-175, 175, -175, 175);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ }
+}
+
+static void Draw(void)
+{
+ float mapI[2], mapIA[2], mapIR[2];
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ mapI[0] = 0.0;
+ mapI[1] = 1.0;
+ mapIR[0] = 0.0;
+ mapIR[1] = 0.0;
+ mapIA[0] = 1.0;
+ mapIA[1] = 1.0;
+
+ glPixelMapfv(GL_PIXEL_MAP_I_TO_R, 2, mapIR);
+ glPixelMapfv(GL_PIXEL_MAP_I_TO_G, 2, mapI);
+ glPixelMapfv(GL_PIXEL_MAP_I_TO_B, 2, mapI);
+ glPixelMapfv(GL_PIXEL_MAP_I_TO_A, 2, mapIA);
+ glPixelTransferi(GL_MAP_COLOR, GL_TRUE);
+
+ SetColor(COLOR_WHITE);
+ glRasterPos3fv(boxA);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 24);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, 8);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, 2);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glBitmap(16, 12, 8.0, 0.0, 0.0, 0.0, logo_bits);
+
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, GL_TRUE);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ SetColor(COLOR_WHITE);
+ glRasterPos3fv(boxB);
+ glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
+ OpenGL_bits1);
+ glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
+ OpenGL_bits2);
+
+ SetColor(COLOR_YELLOW);
+ glRasterPos3fv(boxC);
+ glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
+ OpenGL_bits1);
+ glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
+ OpenGL_bits2);
+
+ SetColor(COLOR_CYAN);
+ glRasterPos3fv(boxD);
+ glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
+ OpenGL_bits1);
+ glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
+ OpenGL_bits2);
+
+ SetColor(COLOR_RED);
+ glRasterPos3fv(boxE);
+ glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
+ OpenGL_bits1);
+ glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, OPENGL_WIDTH, 0.0, OPENGL_WIDTH, 0.0,
+ OpenGL_bits2);
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ printf("%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
+
+ windType = (rgb) ? GLUT_RGB : GLUT_INDEX;
+ windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(windType);
+
+ if (glutCreateWindow("Bitmap Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/bitmap2.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/bitmap2.c
new file mode 100644
index 000000000..5faac8416
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/bitmap2.c
@@ -0,0 +1,787 @@
+/*
+ * 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 EXP_WIDTH 80
+#define EXP_HEIGHT 80
+
+
+GLenum rgb, doubleBuffer, windType;
+
+#include "tkmap.c"
+
+GLenum useLists, abuse;
+GLubyte exp_bits[7][800] = {
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x40, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x81, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xf2, 0x1f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xbe, 0x7c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xf6, 0x4f, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xde, 0x7d, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xea, 0xef, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0x55, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xdd, 0xfd, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xbf, 0xae, 0x22, 0x36, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xdb, 0xf7, 0x3f, 0x1e, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x50, 0xbf, 0xbf, 0x85, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xff, 0xe5, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xee, 0x7e, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x74, 0x4b, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xe8, 0x3e, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xf8, 0x49, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x54, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x80, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xc0, 0x70, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x78, 0x91, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x60, 0xf1, 0x53, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x40, 0x97, 0x5c, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xa0, 0x0c, 0x8c, 0x1b, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xc4, 0x01, 0x00, 0xc8, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x88, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x60, 0x00, 0x02, 0x40, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x70, 0x00, 0x0c, 0x40, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x70, 0xe0, 0x0d, 0x00, 0x04, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x72, 0xc8, 0x07, 0x40, 0x08, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x02, 0x78, 0x2f, 0x40, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x40, 0x02, 0xb0, 0x0a, 0x20, 0x77, 0x00, 0x00,
+ 0x00, 0x00, 0x40, 0x13, 0x10, 0x33, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xc0, 0x02, 0x78, 0xbb, 0x81, 0x09, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x02, 0xdc, 0xe7, 0x00, 0x09, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xac, 0x78, 0x00, 0x31, 0x00, 0x00,
+ 0x00, 0x00, 0x40, 0x03, 0x74, 0x4b, 0x00, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x02, 0xe8, 0x3e, 0x00, 0x01, 0x10, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0xf8, 0x49, 0x80, 0x09, 0x1c, 0x00,
+ 0x00, 0x00, 0x00, 0x0c, 0x40, 0x07, 0x00, 0x05, 0x1c, 0x00,
+ 0x00, 0x00, 0x80, 0x09, 0x04, 0x80, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x1d, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0xe3, 0x0b, 0x00, 0x22, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x8f, 0x10, 0x00, 0xa0, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x4f, 0x20, 0x78, 0x60, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x80, 0x79, 0x18, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x78, 0x7c, 0x05, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x18, 0xc0, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x84, 0x80, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x60, 0x06, 0x0c, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x07, 0x64, 0x3a, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x72, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x3b, 0x00, 0x00, 0xc0, 0x33, 0x00, 0x00,
+ 0x00, 0x00, 0xa0, 0x1b, 0x00, 0x00, 0x80, 0x42, 0x00, 0x00,
+ 0x00, 0x00, 0xd0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
+ 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00,
+ 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x50, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
+ 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
+ 0x00, 0x30, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x00, 0x80, 0x03, 0x03, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00,
+ 0x00, 0xe2, 0x82, 0x03, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00,
+ 0x00, 0x0e, 0x80, 0x03, 0x00, 0x4c, 0x00, 0x00, 0x10, 0x00,
+ 0x00, 0x0e, 0x80, 0x03, 0xec, 0x10, 0x00, 0x00, 0x60, 0x00,
+ 0x00, 0x12, 0x00, 0x00, 0x05, 0x93, 0x01, 0x00, 0x20, 0x00,
+ 0x00, 0x12, 0x00, 0x00, 0x00, 0x5c, 0x0c, 0x00, 0x60, 0x00,
+ 0x00, 0x30, 0x00, 0xc0, 0x05, 0x81, 0x10, 0x00, 0x00, 0x00,
+ 0x00, 0x2c, 0x00, 0x00, 0xcc, 0x06, 0x00, 0x00, 0x20, 0x00,
+ 0x00, 0x30, 0x00, 0x00, 0x28, 0x20, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x30, 0x80, 0x80, 0x22, 0x00, 0x02, 0x00, 0x00, 0x02,
+ 0x00, 0x20, 0x00, 0x80, 0x02, 0x20, 0x08, 0x00, 0x20, 0x02,
+ 0x00, 0x38, 0x00, 0x00, 0x00, 0x11, 0x28, 0x00, 0x20, 0x06,
+ 0x00, 0x20, 0x00, 0x80, 0x0e, 0xc0, 0x21, 0x00, 0x5c, 0x00,
+ 0x00, 0x24, 0x00, 0x90, 0x40, 0x58, 0x04, 0x00, 0x20, 0x01,
+ 0x00, 0x24, 0x00, 0x10, 0x22, 0x02, 0x05, 0x00, 0x20, 0x02,
+ 0x00, 0x00, 0x00, 0x00, 0x28, 0xb6, 0x00, 0x00, 0x20, 0x01,
+ 0x00, 0x70, 0x00, 0x00, 0x18, 0xc1, 0x00, 0x00, 0xc0, 0x01,
+ 0x00, 0xc0, 0x00, 0x00, 0x40, 0x83, 0x04, 0x00, 0xc0, 0x01,
+ 0x00, 0x00, 0x01, 0x80, 0xfc, 0x41, 0x02, 0x00, 0x10, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x03, 0x30, 0x00, 0x00, 0x10, 0x00,
+ 0x00, 0x10, 0x02, 0x00, 0x40, 0x1d, 0x00, 0x00, 0x20, 0x00,
+ 0x00, 0x30, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00,
+ 0x00, 0x00, 0x04, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, 0x00,
+ 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
+ 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01,
+ 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00,
+ 0x00, 0x00, 0x38, 0x00, 0x81, 0x0f, 0x00, 0x00, 0x2a, 0x00,
+ 0x00, 0x00, 0xf8, 0x02, 0x80, 0x0f, 0x00, 0x00, 0x10, 0x00,
+ 0x00, 0x00, 0xf8, 0x02, 0x80, 0x0f, 0x00, 0x00, 0x08, 0x00,
+ 0x00, 0x00, 0x00, 0x06, 0xc0, 0x01, 0x00, 0x00, 0x07, 0x00,
+ 0x00, 0x00, 0x00, 0x14, 0xe0, 0x00, 0x00, 0x80, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x70, 0x00, 0x00, 0x85, 0x00, 0x00,
+ 0x00, 0x00, 0xc0, 0x00, 0x30, 0x00, 0x20, 0x3c, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x80, 0x00, 0x0b, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xe0, 0x79, 0x83, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x19, 0x22, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x28, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x04, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x80, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xe0, 0x03, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
+ 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x03, 0x00, 0x00, 0x00, 0x02, 0x90, 0x00, 0x00, 0x00, 0x40,
+ 0x02, 0x02, 0x00, 0x80, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x40, 0x00, 0x00, 0x40, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x20, 0x00, 0x04, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x30, 0x28, 0x90, 0x05, 0x00, 0x00, 0x40,
+ 0x00, 0x00, 0x00, 0x48, 0x05, 0x00, 0x21, 0x00, 0x00, 0x0c,
+ 0x00, 0x00, 0x00, 0x84, 0x00, 0x54, 0x05, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x40, 0x05, 0x80, 0x41, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0e, 0x02, 0x01, 0x00, 0x00, 0x20,
+ 0x00, 0x00, 0x00, 0x08, 0x20, 0x20, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x84, 0x82, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x48, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x40,
+ 0x04, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x21, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x90, 0x40, 0x40, 0x04, 0x00, 0x00, 0x80,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x41, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x40, 0xa0, 0x00, 0x00, 0x00, 0x50,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x40,
+ 0x40, 0x00, 0x00, 0x00, 0x40, 0x02, 0x04, 0x00, 0x00, 0x30,
+ 0x00, 0x00, 0x00, 0x80, 0x84, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0xc2, 0x20, 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x10, 0xc0, 0x05, 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x20, 0x04, 0x00, 0x02, 0x00, 0x00, 0x10,
+ 0x08, 0x00, 0x00, 0x80, 0x00, 0x10, 0x10, 0x00, 0x00, 0x08,
+ 0x10, 0x02, 0x00, 0x00, 0x21, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
+ 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x18, 0x08, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x08, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x3a, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x40, 0x04,
+ 0x00, 0x60, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x04,
+ 0x00, 0xb8, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00,
+ 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x08, 0x00, 0x00,
+ 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x1f, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x40, 0x00, 0x80, 0x80, 0x00, 0x80, 0x00, 0x00,
+ 0x00, 0x00, 0x60, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x01, 0x00, 0x01, 0x10, 0x04, 0x00, 0x00,
+ 0x00, 0x40, 0x00, 0x02, 0x02, 0x90, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x03, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x1c, 0x20, 0x05, 0x00, 0x04, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x20, 0x40, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0xc4, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x40, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x10, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x42, 0x00, 0x00, 0x04, 0x20, 0x01, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x20, 0x05, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x81, 0x07, 0x01, 0x03, 0x00, 0x00,
+ 0x00, 0x00, 0x40, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x02, 0x80, 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x80, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0xc0, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x40, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x02, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x40, 0x0d, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x1f, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
+ 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xd0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x10, 0x00, 0x00, 0x04, 0x00, 0x00, 0x20, 0x00,
+ 0x02, 0x02, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xc0, 0x00, 0x40, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x00,
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01,
+ 0x00, 0x04, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
+ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00,
+ 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x06, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00
+ },
+ {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x80, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04,
+ 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ }
+};
+GLint exp_lists[7];
+
+
+static void Init(void)
+{
+ GLint i;
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClearIndex(0.0);
+
+ glPixelStorei(GL_UNPACK_LSB_FIRST, GL_TRUE);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ for (i = 0; i < 7; i++) {
+ exp_lists[i] = glGenLists(1);
+ glNewList(exp_lists[i], GL_COMPILE);
+ glBitmap(80, 80, 40.0, 40.0, 0.0, 0.0, exp_bits[i]);
+ glEndList();
+ }
+
+ abuse = GL_FALSE;
+ useLists = GL_TRUE;
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(-175, 175, -175, 175);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ case '1':
+ useLists = !useLists;
+ break;
+ case '2':
+ abuse = !abuse;
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+ GLint i, j;
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ for (i = 0; i < 7; i++) {
+ for (j = 0; j < 40; j++) {
+ switch (j % 7) {
+ case 0:
+ SetColor(COLOR_YELLOW);
+ break;
+ case 1:
+ SetColor(COLOR_GREEN);
+ break;
+ case 2:
+ SetColor(COLOR_BLUE);
+ break;
+ case 3:
+ SetColor(COLOR_MAGENTA);
+ break;
+ case 4:
+ SetColor(COLOR_CYAN);
+ break;
+ case 5:
+ SetColor(COLOR_WHITE);
+ break;
+ case 6:
+ SetColor(COLOR_RED);
+ break;
+ }
+ glRasterPos3i((j*3)%5, (j*3)%8, 0);
+
+ if (useLists) {
+ glCallList(exp_lists[i]);
+ } else {
+ glBitmap(80, 80, 40.0, 40.0, 0.0, 0.0, exp_bits[i]);
+ }
+ if (!abuse) {
+ break;
+ }
+ }
+
+ if (i == 6) {
+ break;
+ }
+
+ for (j = 0; j < 40; j++) {
+ SetColor(COLOR_BLACK);
+ glRasterPos3i((j*3)%5, (j*3)%8, 0);
+ if (useLists) {
+ glCallList(exp_lists[i]);
+ } else {
+ glBitmap(80, 80, 40.0, 40.0, 0.0, 0.0, exp_bits[i]);
+ }
+ if (!abuse) {
+ break;
+ }
+ }
+ }
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ printf("%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
+
+ windType = (rgb) ? GLUT_RGB : GLUT_INDEX;
+ windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(windType);
+
+ if (glutCreateWindow("Bitmap Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/blendeq.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/blendeq.c
new file mode 100644
index 000000000..f78afd303
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/blendeq.c
@@ -0,0 +1,319 @@
+/*
+** blendeq.c - Demonstrates the use of the blend_minmax, blend_subtract,
+** and blend_logic_op extensions using glBlendEquationEXT.
+**
+** Over a two-color backround, draw rectangles using twelve blend
+** options. The values are read back as UNSIGNED_BYTE and printed
+** in hex over each value. These values are useful for logic
+** op comparisons when channels are 8 bits deep.
+*/
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#ifdef _WIN32
+#include <windows.h>
+#endif
+#define GL_GLEXT_PROTOTYPES
+#include <GL/glut.h>
+
+GLenum doubleBuffer;
+static int dithering = 0;
+int use11ops = 0;
+int supportlogops = 0;
+static int doPrint = 1;
+static int deltaY;
+GLint windW, windH;
+
+static void DrawString(const char *string)
+{
+ int i;
+
+ for (i = 0; string[i]; i++)
+ glutBitmapCharacter(GLUT_BITMAP_9_BY_15, string[i]);
+}
+
+static void Init(void)
+{
+
+ glDisable(GL_DITHER);
+ glShadeModel(GL_FLAT);
+}
+
+static void Reshape(int width, int height)
+{
+
+ windW = (GLint)width;
+ windH = (GLint)height;
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+ deltaY = windH /16;
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(0, windW, 0, windH);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ case 'd':
+ dithering = !dithering;
+ break;
+ case 'l':
+ if (supportlogops == 3)
+ use11ops = (!use11ops);
+ if (use11ops)
+ printf("Using GL 1.1 color logic ops.\n");
+ else printf("Using GL_EXT_blend_logic_op.\n");
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void PrintColorStrings( void )
+{
+ GLubyte ubbuf[3];
+ int i, xleft, xright;
+ char colorString[18];
+
+ xleft = 5 + windW/4;
+ xright = 5 + windW/2;
+
+ for (i = windH - deltaY + 4; i > 0; i-=deltaY) {
+ glReadPixels(xleft, i+10, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, ubbuf);
+ sprintf(colorString, "(0x%x, 0x%x, 0x%x)",
+ ubbuf[0], ubbuf[1], ubbuf[2]);
+ glRasterPos2f(xleft, i);
+ DrawString(colorString);
+ glReadPixels(xright, i+10, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, ubbuf);
+ sprintf(colorString, "(0x%x, 0x%x, 0x%x)",
+ ubbuf[0], ubbuf[1], ubbuf[2]);
+ glRasterPos2f(xright, i);
+ DrawString(colorString);
+ }
+}
+
+static void Draw(void)
+{
+ int stringOffset = 5, stringx = 8;
+ int x1, x2, xleft, xright;
+ int i;
+
+ (dithering) ? glEnable(GL_DITHER) : glDisable(GL_DITHER);
+ glDisable(GL_BLEND);
+ if (supportlogops & 2)
+ glDisable(GL_COLOR_LOGIC_OP);
+
+ glClearColor(0.5, 0.6, 0.1, 1.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* Draw background */
+ glColor3f(0.1, 0.1, 1.0);
+ glRectf(0.0, 0.0, windW/2, windH);
+
+ /* Draw labels */
+ glColor3f(0.8, 0.8, 0.0);
+ i = windH - deltaY + stringOffset;
+ glRasterPos2f(stringx, i); i -= deltaY;
+ DrawString("SOURCE");
+ glRasterPos2f(stringx, i); i -= deltaY;
+ DrawString("DEST");
+ glRasterPos2f(stringx, i); i -= deltaY;
+ DrawString("min");
+ glRasterPos2f(stringx, i); i -= deltaY;
+ DrawString("max");
+ glRasterPos2f(stringx, i); i -= deltaY;
+ DrawString("subtract");
+ glRasterPos2f(stringx, i); i -= deltaY;
+ DrawString("reverse_subtract");
+ glRasterPos2f(stringx, i); i -= deltaY;
+ DrawString("clear");
+ glRasterPos2f(stringx, i); i -= deltaY;
+ DrawString("set");
+ glRasterPos2f(stringx, i); i -= deltaY;
+ DrawString("copy");
+ glRasterPos2f(stringx, i); i -= deltaY;
+ DrawString("noop");
+ glRasterPos2f(stringx, i); i -= deltaY;
+ DrawString("and");
+ glRasterPos2f(stringx, i); i -= deltaY;
+ DrawString("invert");
+ glRasterPos2f(stringx, i); i -= deltaY;
+ DrawString("or");
+ glRasterPos2f(stringx, i); i -= deltaY;
+ DrawString("xor");
+
+
+ i = windH - deltaY;
+ x1 = windW/4;
+ x2 = 3 * windW/4;
+ xleft = 5 + windW/4;
+ xright = 5 + windW/2;
+
+ /* Draw foreground color for comparison */
+ glColor3f(0.9, 0.2, 0.8);
+ glRectf(x1, i, x2, i+deltaY);
+
+ /* Leave one rectangle of background color */
+
+ /* Begin test cases */
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_ONE, GL_ONE);
+
+ i -= 2*deltaY;
+ glBlendEquationEXT(GL_MIN_EXT);
+ glRectf(x1, i, x2, i+deltaY);
+
+ i -= deltaY;
+ glBlendEquationEXT(GL_MAX_EXT);
+ glRectf(x1, i, x2, i+deltaY);
+
+ i -= deltaY;
+ glBlendEquationEXT(GL_FUNC_SUBTRACT_EXT);
+ glRectf(x1, i, x2, i+deltaY);
+
+ i -= deltaY;
+ glBlendEquationEXT(GL_FUNC_REVERSE_SUBTRACT_EXT);
+ glRectf(x1, i, x2, i+deltaY);
+
+ glBlendFunc(GL_ONE, GL_ZERO);
+ i -= deltaY;
+ if (!use11ops)
+ glBlendEquationEXT(GL_LOGIC_OP);
+ else
+ glEnable(GL_COLOR_LOGIC_OP);
+ glLogicOp(GL_CLEAR);
+ glRectf(x1, i, x2, i+deltaY);
+
+ i -= deltaY;
+ glLogicOp(GL_SET);
+ glRectf(x1, i, x2, i+deltaY);
+
+ i -= deltaY;
+ glLogicOp(GL_COPY);
+ glRectf(x1, i, x2, i+deltaY);
+
+ i -= deltaY;
+ glLogicOp(GL_NOOP);
+ glRectf(x1, i, x2, i+deltaY);
+
+ i -= deltaY;
+ glLogicOp(GL_AND);
+ glRectf(x1, i, x2, i+deltaY);
+
+ i -= deltaY;
+ glLogicOp(GL_INVERT);
+ glRectf(x1, i, x2, i+deltaY);
+
+ i -= deltaY;
+ glLogicOp(GL_OR);
+ glRectf(x1, i, x2, i+deltaY);
+
+ i -= deltaY;
+ glLogicOp(GL_XOR);
+ glRectf(x1, i, x2, i+deltaY);
+ glRectf(x1, i+10, x2, i+5);
+
+ if (doPrint) {
+ glDisable(GL_BLEND);
+ if (supportlogops & 2)
+ glDisable(GL_COLOR_LOGIC_OP);
+ glColor3f(1.0, 1.0, 1.0);
+ PrintColorStrings();
+ }
+ 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 {
+ printf("%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ GLenum type;
+ char *s;
+ char *extName1 = "GL_EXT_blend_logic_op";
+ char *extName2 = "GL_EXT_blend_minmax";
+ char *extName3 = "GL_EXT_blend_subtract";
+ char *version;
+
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 800, 400);
+
+ type = GLUT_RGB;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Blend Equation") == GL_FALSE) {
+ exit(1);
+ }
+
+ /* Make sure blend_logic_op extension is there. */
+ s = (char *) glGetString(GL_EXTENSIONS);
+ version = (char*) glGetString(GL_VERSION);
+ if (!s)
+ exit(1);
+ if (strstr(s,extName1)) {
+ supportlogops = 1;
+ use11ops = 0;
+ printf("blend_logic_op extension available.\n");
+ }
+ if (strncmp(version,"1.1",3)>=0) {
+ supportlogops += 2;
+ use11ops = 1;
+ printf("1.1 color logic ops available.\n");
+ }
+ if (supportlogops == 0) {
+ printf("Blend_logic_op extension and GL 1.1 not present.\n");
+ exit(1);
+ }
+ if (strstr(s,extName2) == 0) {
+ printf("Blend_minmax extension is not present.\n");
+ exit(1);
+ }
+ if (strstr(s,extName3) == 0) {
+ printf("Blend_subtract extension is not present.\n");
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/blendxor.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/blendxor.c
new file mode 100644
index 000000000..5bc4aa9be
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/blendxor.c
@@ -0,0 +1,206 @@
+/*
+** blendxor.c - Demonstrates the use of the blend_logic_op
+** extension to draw hilights. Using XOR to draw the same
+** image twice restores the background to its original value.
+*/
+
+#include <stdio.h>
+#include <string.h>
+#ifndef _WIN32
+#include <unistd.h>
+#endif
+#include <stdlib.h>
+#ifdef _WIN32
+#include <windows.h>
+#endif
+#define GL_GLEXT_LEGACY
+#define GL_GLEXT_PROTOTYPES
+#include <GL/glut.h>
+#include <GL/glext.h>
+
+
+GLenum doubleBuffer;
+int dithering = 0;
+int use11ops = 0;
+int supportlogops = 0;
+GLint windW, windH;
+
+static void Init(void)
+{
+ glDisable(GL_DITHER);
+ glShadeModel(GL_FLAT);
+}
+
+static void Reshape(int width, int height)
+{
+
+ windW = (GLint)width;
+ windH = (GLint)height;
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(0, 400, 0, 400);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ case 'd':
+ dithering = !dithering;
+ break;
+ case 'l':
+ if (supportlogops == 3)
+ use11ops = (!use11ops);
+ if (use11ops)
+ printf("Using GL 1.1 color logic ops.\n");
+ else printf("Using GL_EXT_blend_logic_op.\n");
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+ int i;
+
+ glDisable(GL_BLEND);
+ if (supportlogops & 2)
+ glDisable(GL_COLOR_LOGIC_OP);
+
+ (dithering) ? glEnable(GL_DITHER) : glDisable(GL_DITHER);
+
+ glClearColor(0.5, 0.6, 0.1, 1.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ /* Draw background prims */
+ glColor3f(0.1, 0.1, 1.0);
+ glBegin(GL_TRIANGLES);
+ glVertex2i(5, 5);
+ glVertex2i(130, 50);
+ glVertex2i(100, 300);
+ glEnd();
+ glColor3f(0.5, 0.2, 0.9);
+ glBegin(GL_TRIANGLES);
+ glVertex2i(200, 100);
+ glVertex2i(330, 50);
+ glVertex2i(340, 400);
+ glEnd();
+
+ glEnable(GL_BLEND);
+ if (!use11ops)
+ glBlendEquationEXT(GL_LOGIC_OP);
+ else
+ glEnable(GL_COLOR_LOGIC_OP);
+ glLogicOp(GL_XOR);
+
+ /* Draw a set of rectangles across the window */
+ glColor3f(0.9, 0.2, 0.8);
+ for(i = 0; i < 400; i+=60) {
+ glBegin(GL_POLYGON);
+ glVertex2i(i, 100);
+ glVertex2i(i+50, 100);
+ glVertex2i(i+50, 200);
+ glVertex2i(i, 200);
+ glEnd();
+ }
+ glFlush(); /* Added by Brian Paul */
+#ifndef _WIN32
+ sleep(2);
+#endif
+
+ /* Redraw the rectangles, which should erase them */
+ for(i = 0; i < 400; i+=60) {
+ glBegin(GL_POLYGON);
+ glVertex2i(i, 100);
+ glVertex2i(i+50, 100);
+ glVertex2i(i+50, 200);
+ glVertex2i(i, 200);
+ 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 {
+ printf("%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ GLenum type;
+ char *s;
+ char *extName = "GL_EXT_blend_logic_op";
+ char *version;
+
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 400, 400);
+
+ type = GLUT_RGB;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Blend XOR") == GL_FALSE) {
+ exit(1);
+ }
+
+ /* Make sure blend_logic_op extension is there. */
+ s = (char *) glGetString(GL_EXTENSIONS);
+ version = (char*) glGetString(GL_VERSION);
+ if (!s)
+ exit(1);
+ if (strstr(s,extName)) {
+ supportlogops = 1;
+ use11ops = 0;
+ printf("blend_logic_op extension available.\n");
+ }
+ if (strncmp(version,"1.1",3)>=0) {
+ supportlogops += 2;
+ use11ops = 1;
+ printf("1.1 color logic ops available.\n");
+ }
+ if (supportlogops == 0) {
+ printf("Blend_logic_op extension and GL 1.1 not present.\n");
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/copy.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/copy.c
new file mode 100644
index 000000000..391c637d6
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/copy.c
@@ -0,0 +1,193 @@
+/*
+ * 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>
+
+
+#include "loadppm.c"
+
+GLenum doubleBuffer;
+GLint windW, windH;
+
+char *fileName = 0;
+PPMImage *image;
+float point[3];
+float zoom;
+GLint x, y;
+
+static void Init(void)
+{
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+
+ x = 0;
+ y = windH;
+ zoom = 1.8;
+}
+
+static void Reshape(int width, int height)
+{
+
+ windW = (GLint)width;
+ windH = (GLint)height;
+
+ glViewport(0, 0, windW, windH);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(0, windW, 0, windH);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ case 'Z':
+ zoom += 0.2;
+ break;
+ case 'z':
+ zoom -= 0.2;
+ if (zoom < 0.2) {
+ zoom = 0.2;
+ }
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Mouse(int button, int state, int mouseX, int mouseY)
+{
+ if (state != GLUT_DOWN)
+ return;
+ x = (GLint)mouseX;
+ y = (GLint)mouseY;
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ point[0] = (windW / 2) - (image->sizeX / 2);
+ point[1] = (windH / 2) - (image->sizeY / 2);
+ point[2] = 0;
+ glRasterPos3fv(point);
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glPixelZoom(1.0, 1.0);
+ glDrawPixels(image->sizeX, image->sizeY, GL_RGB, GL_UNSIGNED_BYTE,
+ image->data);
+
+ point[0] = (float)x;
+ point[1] = windH - (float)y;
+ point[2] = 0.0;
+ glRasterPos3fv(point);
+
+ glPixelZoom(zoom, zoom);
+ glCopyPixels((windW/2)-(image->sizeX/2),
+ (windH/2)-(image->sizeY/2),
+ image->sizeX, image->sizeY, GL_COLOR);
+
+ 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 if (strcmp(argv[i], "-f") == 0) {
+ if (i+1 >= argc || argv[i+1][0] == '-') {
+ printf("-f (No file name).\n");
+ return GL_FALSE;
+ } else {
+ fileName = argv[++i];
+ }
+ } 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);
+ }
+
+ if (fileName == 0) {
+ printf("No image file.\n");
+ exit(1);
+ }
+
+ image = LoadPPM(fileName);
+
+ windW = 300;
+ windH = 300;
+ glutInitWindowPosition(0, 0); glutInitWindowSize( windW, windH);
+
+ type = GLUT_RGB;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Copy Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutMouseFunc(Mouse);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/cursor.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/cursor.c
new file mode 100644
index 000000000..de8fc5855
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/cursor.c
@@ -0,0 +1,150 @@
+/*
+ * 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 rgb, doubleBuffer, windType;
+int windX, windY;
+int cursor;
+
+
+#include "tkmap.c"
+
+static void Init(void)
+{
+ cursor = 0;
+ glutSetCursor(cursor);
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClearIndex(0.0);
+}
+
+static void Reshape(int width, int height)
+{
+
+ windX = width;
+ windY = height;
+ glViewport(0, 0, windX, windY);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(0, windX, 0, windY);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ case 32:
+ cursor++;
+ if (cursor > 19) {
+ cursor = 0;
+ }
+ glutSetCursor(cursor);
+ }
+}
+
+static void Draw(void)
+{
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glBegin(GL_POLYGON);
+ SetColor(COLOR_BLACK);
+ glVertex2i(0, 0);
+ SetColor(COLOR_RED);
+ glVertex2i(windX, 0);
+ SetColor(COLOR_GREEN);
+ glVertex2i(windX, windY);
+ SetColor(COLOR_BLUE);
+ glVertex2i(0, windY);
+ glEnd();
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ printf("%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ windX = 300;
+ windY = 300;
+ glutInitWindowPosition(0, 0); glutInitWindowSize( windX, windY);
+
+ windType = (rgb) ? GLUT_RGB : GLUT_INDEX;
+ windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(windType);
+
+ if (glutCreateWindow("Cursor Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/depth.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/depth.c
new file mode 100644
index 000000000..afe2ec17a
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/depth.c
@@ -0,0 +1,209 @@
+/*
+ * 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 rgb, doubleBuffer;
+
+GLenum antiAlias, stipple;
+GLubyte stippleBits[32*4] = {
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+ 0xAA, 0xAA, 0xAA, 0xAA, 0x55, 0x55, 0x55, 0x55,
+};
+
+
+#include "tkmap.c"
+
+static void Init(void)
+{
+ GLint i;
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClearIndex(0.0);
+
+ if (!rgb) {
+ for (i = 0; i < 16; i++) {
+ glutSetColor(i+CI_OFFSET_1, 0.0, 0.0, i/15.0);
+ glutSetColor(i+CI_OFFSET_2, 0.0, i/15.0, 0.0);
+ }
+ }
+
+ glPolygonStipple(stippleBits);
+
+ antiAlias = GL_FALSE;
+ stipple = GL_FALSE;
+}
+
+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 '1':
+ antiAlias = !antiAlias;
+ break;
+ case '2':
+ stipple = !stipple;
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+ GLint ci1, ci2;
+
+ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+
+ if (antiAlias) {
+ ci1 = CI_OFFSET_1;
+ ci2 = CI_OFFSET_2;
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ glEnable(GL_BLEND);
+ glEnable(GL_POLYGON_SMOOTH);
+ glDisable(GL_DEPTH_TEST);
+ } else {
+ ci1 = COLOR_BLUE;
+ ci2 = COLOR_GREEN;
+ glDisable(GL_BLEND);
+ glDisable(GL_POLYGON_SMOOTH);
+ glEnable(GL_DEPTH_TEST);
+ }
+
+ if (stipple) {
+ glEnable(GL_POLYGON_STIPPLE);
+ } else {
+ glDisable(GL_POLYGON_STIPPLE);
+ }
+
+ glBegin(GL_TRIANGLES);
+ (rgb) ? glColor3fv(RGBMap[COLOR_BLUE]) : glIndexi(ci1);
+ glVertex3f( 0.9, -0.9, -30.0);
+ glVertex3f( 0.9, 0.9, -30.0);
+ glVertex3f(-0.9, 0.0, -30.0);
+ (rgb) ? glColor3fv(RGBMap[COLOR_GREEN]) : glIndexi(ci2);
+ glVertex3f(-0.9, -0.9, -40.0);
+ glVertex3f(-0.9, 0.9, -40.0);
+ glVertex3f( 0.9, 0.0, -25.0);
+ glEnd();
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } 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_DEPTH;
+ type |= (rgb) ? GLUT_RGB : GLUT_INDEX;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Depth Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/eval.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/eval.c
new file mode 100644
index 000000000..3ad9c5468
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/eval.c
@@ -0,0 +1,472 @@
+/*
+ * 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 VORDER 10
+#define CORDER 10
+#define TORDER 3
+
+#define VMAJOR_ORDER 2
+#define VMINOR_ORDER 3
+
+#define CMAJOR_ORDER 2
+#define CMINOR_ORDER 2
+
+#define TMAJOR_ORDER 2
+#define TMINOR_ORDER 2
+
+#define VDIM 4
+#define CDIM 4
+#define TDIM 2
+
+#define ONE_D 1
+#define TWO_D 2
+
+#define EVAL 3
+#define MESH 4
+
+
+GLenum doubleBuffer;
+
+float rotX = 0.0, rotY = 0.0, translateZ = -1.0;
+
+GLenum arrayType = ONE_D;
+GLenum colorType = GL_FALSE;
+GLenum textureType = GL_FALSE;
+GLenum polygonFilled = GL_FALSE;
+GLenum lighting = GL_FALSE;
+GLenum mapPoint = GL_FALSE;
+GLenum mapType = EVAL;
+
+double point1[10*4] = {
+ -0.5, 0.0, 0.0, 1.0,
+ -0.4, 0.5, 0.0, 1.0,
+ -0.3,-0.5, 0.0, 1.0,
+ -0.2, 0.5, 0.0, 1.0,
+ -0.1,-0.5, 0.0, 1.0,
+ 0.0, 0.5, 0.0, 1.0,
+ 0.1,-0.5, 0.0, 1.0,
+ 0.2, 0.5, 0.0, 1.0,
+ 0.3,-0.5, 0.0, 1.0,
+ 0.4, 0.0, 0.0, 1.0,
+};
+double cpoint1[10*4] = {
+ 0.0, 0.0, 1.0, 1.0,
+ 0.3, 0.0, 0.7, 1.0,
+ 0.6, 0.0, 0.3, 1.0,
+ 1.0, 0.0, 0.0, 1.0,
+ 1.0, 0.3, 0.0, 1.0,
+ 1.0, 0.6, 0.0, 1.0,
+ 1.0, 1.0, 0.0, 1.0,
+ 1.0, 1.0, 0.5, 1.0,
+ 1.0, 1.0, 1.0, 1.0,
+};
+double tpoint1[11*4] = {
+ 0.0, 0.0, 0.0, 1.0,
+ 0.0, 0.1, 0.0, 1.0,
+ 0.0, 0.2, 0.0, 1.0,
+ 0.0, 0.3, 0.0, 1.0,
+ 0.0, 0.4, 0.0, 1.0,
+ 0.0, 0.5, 0.0, 1.0,
+ 0.0, 0.6, 0.0, 1.0,
+ 0.0, 0.7, 0.0, 1.0,
+ 0.0, 0.8, 0.0, 1.0,
+ 0.0, 0.9, 0.0, 1.0,
+};
+double point2[2*3*4] = {
+ -0.5, -0.5, 0.5, 1.0,
+ 0.0, 1.0, 0.5, 1.0,
+ 0.5, -0.5, 0.5, 1.0,
+ -0.5, 0.5, -0.5, 1.0,
+ 0.0, -1.0, -0.5, 1.0,
+ 0.5, 0.5, -0.5, 1.0,
+};
+double cpoint2[2*2*4] = {
+ 0.0, 0.0, 0.0, 1.0,
+ 0.0, 0.0, 1.0, 1.0,
+ 0.0, 1.0, 0.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0,
+};
+double tpoint2[2*2*2] = {
+ 0.0, 0.0, 0.0, 1.0,
+ 1.0, 0.0, 1.0, 1.0,
+};
+float textureImage[4*2*4] = {
+ 1.0, 1.0, 1.0, 1.0,
+ 1.0, 0.0, 0.0, 1.0,
+ 1.0, 0.0, 0.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0,
+ 1.0, 0.0, 0.0, 1.0,
+ 1.0, 0.0, 0.0, 1.0,
+ 1.0, 1.0, 1.0, 1.0,
+};
+
+
+static void Init(void)
+{
+ static float ambient[] = {0.1, 0.1, 0.1, 1.0};
+ static float diffuse[] = {1.0, 1.0, 1.0, 1.0};
+ static float position[] = {0.0, 0.0, -150.0, 0.0};
+ static float front_mat_diffuse[] = {1.0, 0.2, 1.0, 1.0};
+ static float back_mat_diffuse[] = {1.0, 1.0, 0.2, 1.0};
+ static float lmodel_ambient[] = {1.0, 1.0, 1.0, 1.0};
+ static float lmodel_twoside[] = {GL_TRUE};
+ static float decal[] = {GL_DECAL};
+ static float repeat[] = {GL_REPEAT};
+ static float nr[] = {GL_NEAREST};
+
+ glFrontFace(GL_CCW);
+
+ glEnable(GL_DEPTH_TEST);
+
+ glMap1d(GL_MAP1_VERTEX_4, 0.0, 1.0, VDIM, VORDER, point1);
+ glMap1d(GL_MAP1_COLOR_4, 0.0, 1.0, CDIM, CORDER, cpoint1);
+
+ glMap2d(GL_MAP2_VERTEX_4, 0.0, 1.0, VMINOR_ORDER*VDIM, VMAJOR_ORDER, 0.0,
+ 1.0, VDIM, VMINOR_ORDER, point2);
+ glMap2d(GL_MAP2_COLOR_4, 0.0, 1.0, CMINOR_ORDER*CDIM, CMAJOR_ORDER, 0.0,
+ 1.0, CDIM, CMINOR_ORDER, cpoint2);
+ glMap2d(GL_MAP2_TEXTURE_COORD_2, 0.0, 1.0, TMINOR_ORDER*TDIM,
+ TMAJOR_ORDER, 0.0, 1.0, TDIM, TMINOR_ORDER, tpoint2);
+
+ glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
+ glLightfv(GL_LIGHT0, GL_POSITION, position);
+
+ glMaterialfv(GL_FRONT, GL_DIFFUSE, front_mat_diffuse);
+ glMaterialfv(GL_BACK, GL_DIFFUSE, back_mat_diffuse);
+
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+ glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
+
+ glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, decal);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, repeat);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, repeat);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nr);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nr);
+ glTexImage2D(GL_TEXTURE_2D, 0, 4, 2, 4, 0, GL_RGBA, GL_FLOAT,
+ (GLvoid *)textureImage);
+}
+
+static void DrawPoints1(void)
+{
+ GLint i;
+
+ glColor3f(0.0, 1.0, 0.0);
+ glPointSize(2);
+ glBegin(GL_POINTS);
+ for (i = 0; i < VORDER; i++) {
+ glVertex4dv(&point1[i*4]);
+ }
+ glEnd();
+}
+
+static void DrawPoints2(void)
+{
+ GLint i, j;
+
+ glColor3f(1.0, 0.0, 1.0);
+ glPointSize(2);
+ glBegin(GL_POINTS);
+ for (i = 0; i < VMAJOR_ORDER; i++) {
+ for (j = 0; j < VMINOR_ORDER; j++) {
+ glVertex4dv(&point2[i*4*VMINOR_ORDER+j*4]);
+ }
+ }
+ glEnd();
+}
+
+static void DrawMapEval1(float du)
+{
+ float u;
+
+ glColor3f(1.0, 0.0, 0.0);
+ glBegin(GL_LINE_STRIP);
+ for (u = 0.0; u < 1.0; u += du) {
+ glEvalCoord1d(u);
+ }
+ glEvalCoord1d(1.0);
+ glEnd();
+}
+
+static void DrawMapEval2(float du, float dv)
+{
+ float u, v, tmp;
+
+ glColor3f(1.0, 0.0, 0.0);
+ for (v = 0.0; v < 1.0; v += dv) {
+ glBegin(GL_QUAD_STRIP);
+ for (u = 0.0; u <= 1.0; u += du) {
+ glEvalCoord2d(u,v);
+ tmp = (v + dv < 1.0) ? (v + dv) : 1.0;
+ glEvalCoord2d(u, tmp);
+ }
+ glEvalCoord2d(1.0, v);
+ glEvalCoord2d(1.0, v+dv);
+ glEnd();
+ }
+}
+
+static void RenderEval(void)
+{
+
+ if (colorType) {
+ glEnable(GL_MAP1_COLOR_4);
+ glEnable(GL_MAP2_COLOR_4);
+ } else {
+ glDisable(GL_MAP1_COLOR_4);
+ glDisable(GL_MAP2_COLOR_4);
+ }
+
+ if (textureType) {
+ glEnable(GL_TEXTURE_2D);
+ glEnable(GL_MAP2_TEXTURE_COORD_2);
+ } else {
+ glDisable(GL_TEXTURE_2D);
+ glDisable(GL_MAP2_TEXTURE_COORD_2);
+ }
+
+ if (polygonFilled) {
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ } else {
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ }
+
+ glShadeModel(GL_SMOOTH);
+
+ switch (mapType) {
+ case EVAL:
+ switch (arrayType) {
+ case ONE_D:
+ glDisable(GL_MAP2_VERTEX_4);
+ glEnable(GL_MAP1_VERTEX_4);
+ DrawPoints1();
+ DrawMapEval1(0.1/VORDER);
+ break;
+ case TWO_D:
+ glDisable(GL_MAP1_VERTEX_4);
+ glEnable(GL_MAP2_VERTEX_4);
+ DrawPoints2();
+ DrawMapEval2(0.1/VMAJOR_ORDER,0.1/VMINOR_ORDER);
+ break;
+ default:
+ break;
+ }
+ break;
+ case MESH:
+ switch (arrayType) {
+ case ONE_D:
+ DrawPoints1();
+ glDisable(GL_MAP2_VERTEX_4);
+ glEnable (GL_MAP1_VERTEX_4);
+ glColor3f(0.0, 0.0, 1.0);
+ glMapGrid1d(40, 0.0, 1.0);
+ if (mapPoint) {
+ glPointSize(2);
+ glEvalMesh1(GL_POINT, 0, 40);
+ } else {
+ glEvalMesh1(GL_LINE, 0, 40);
+ }
+ break;
+ case TWO_D:
+ DrawPoints2();
+ glDisable(GL_MAP1_VERTEX_4);
+ glEnable(GL_MAP2_VERTEX_4);
+ glColor3f(0.0, 0.0, 1.0);
+ glMapGrid2d(20, 0.0, 1.0, 20, 0.0, 1.0);
+ if (mapPoint) {
+ glPointSize(2);
+ glEvalMesh2(GL_POINT, 0, 20, 0, 20);
+ } else if (polygonFilled) {
+ glEvalMesh2(GL_FILL, 0, 20, 0, 20);
+ } else {
+ glEvalMesh2(GL_LINE, 0, 20, 0, 20);
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+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, 10.0);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key2(int key, int x, int y)
+{
+ switch (key) {
+ case GLUT_KEY_LEFT:
+ rotY -= 30;
+ break;
+ case GLUT_KEY_RIGHT:
+ rotY += 30;
+ break;
+ case GLUT_KEY_UP:
+ rotX -= 30;
+ break;
+ case GLUT_KEY_DOWN:
+ rotX += 30;
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+ switch (key) {
+ case 27:
+ exit(1);
+ case '1':
+ arrayType = ONE_D;
+ break;
+ case '2':
+ arrayType = TWO_D;
+ break;
+ case 'e':
+ mapType = EVAL;
+ break;
+ case 'm':
+ mapType = MESH;
+ break;
+ case 'f':
+ polygonFilled = !polygonFilled;
+ break;
+ case 'p':
+ mapPoint = !mapPoint;
+ break;
+ case 'c':
+ colorType = !colorType;
+ break;
+ case 't':
+ textureType = !textureType;
+ break;
+ case 'l':
+ lighting =! lighting;
+ if (lighting) {
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+ glEnable(GL_AUTO_NORMAL);
+ } else {
+ glDisable(GL_LIGHTING);
+ glDisable(GL_LIGHT0);
+ glDisable(GL_AUTO_NORMAL);
+ }
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+
+ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+
+ glPushMatrix();
+
+ glTranslatef(0.0, 0.0 , translateZ);
+ glRotatef(rotX, 1, 0, 0);
+ glRotatef(rotY, 0, 1, 0);
+ RenderEval();
+
+ 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 {
+ 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_DEPTH;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Evaluator Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutSpecialFunc(Key2);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/fog.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/fog.c
new file mode 100644
index 000000000..3f3ffdbcc
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/fog.c
@@ -0,0 +1,311 @@
+/*
+ * 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 rgb, doubleBuffer;
+
+#include "tkmap.c"
+
+double plane[4] = {
+ 1.0, 0.0, -1.0, 0.0
+};
+float rotX = 5.0, rotY = -5.0, zTranslate = -65.0;
+float fogDensity = 0.02;
+GLint cubeList = 1;
+
+float scp[18][3] = {
+ {
+ 1.000000, 0.000000, 0.000000
+ },
+ {
+ 1.000000, 0.000000, 5.000000
+ },
+ {
+ 0.707107, 0.707107, 0.000000
+ },
+ {
+ 0.707107, 0.707107, 5.000000
+ },
+ {
+ 0.000000, 1.000000, 0.000000
+ },
+ {
+ 0.000000, 1.000000, 5.000000
+ },
+ {
+ -0.707107, 0.707107, 0.000000
+ },
+ {
+ -0.707107, 0.707107, 5.000000
+ },
+ {
+ -1.000000, 0.000000, 0.000000
+ },
+ {
+ -1.000000, 0.000000, 5.000000
+ },
+ {
+ -0.707107, -0.707107, 0.000000
+ },
+ {
+ -0.707107, -0.707107, 5.000000
+ },
+ {
+ 0.000000, -1.000000, 0.000000
+ },
+ {
+ 0.000000, -1.000000, 5.000000
+ },
+ {
+ 0.707107, -0.707107, 0.000000
+ },
+ {
+ 0.707107, -0.707107, 5.000000
+ },
+ {
+ 1.000000, 0.000000, 0.000000
+ },
+ {
+ 1.000000, 0.000000, 5.000000
+ },
+};
+
+
+static void Build_lists(void)
+{
+
+ glNewList(cubeList, GL_COMPILE);
+ glBegin(GL_TRIANGLE_STRIP);
+ glNormal3fv(scp[0]); glVertex3fv(scp[0]);
+ glNormal3fv(scp[0]); glVertex3fv(scp[1]);
+ glNormal3fv(scp[2]); glVertex3fv(scp[2]);
+ glNormal3fv(scp[2]); glVertex3fv(scp[3]);
+ glNormal3fv(scp[4]); glVertex3fv(scp[4]);
+ glNormal3fv(scp[4]); glVertex3fv(scp[5]);
+ glNormal3fv(scp[6]); glVertex3fv(scp[6]);
+ glNormal3fv(scp[6]); glVertex3fv(scp[7]);
+ glNormal3fv(scp[8]); glVertex3fv(scp[8]);
+ glNormal3fv(scp[8]); glVertex3fv(scp[9]);
+ glNormal3fv(scp[10]); glVertex3fv(scp[10]);
+ glNormal3fv(scp[10]); glVertex3fv(scp[11]);
+ glNormal3fv(scp[12]); glVertex3fv(scp[12]);
+ glNormal3fv(scp[12]); glVertex3fv(scp[13]);
+ glNormal3fv(scp[14]); glVertex3fv(scp[14]);
+ glNormal3fv(scp[14]); glVertex3fv(scp[15]);
+ glNormal3fv(scp[16]); glVertex3fv(scp[16]);
+ glNormal3fv(scp[16]); glVertex3fv(scp[17]);
+ glEnd();
+ glEndList();
+}
+
+static void Init(void)
+{
+ static float ambient[] = {0.1, 0.1, 0.1, 1.0};
+ static float diffuse[] = {1.0, 1.0, 1.0, 1.0};
+ static float position[] = {90.0, 90.0, 0.0, 0.0};
+ static float front_mat_shininess[] = {30.0};
+ static float front_mat_specular[] = {0.0, 0.0, 0.0, 1.0};
+ static float front_mat_diffuse[] = {0.0, 1.0, 0.0, 1.0};
+ static float back_mat_shininess[] = {50.0};
+ static float back_mat_specular[] = {0.0, 0.0, 1.0, 1.0};
+ static float back_mat_diffuse[] = {1.0, 0.0, 0.0, 1.0};
+ static float lmodel_ambient[] = {0.0, 0.0, 0.0, 1.0};
+ static float fog_color[] = {0.8, 0.8, 0.8, 1.0};
+
+ glFrontFace(GL_CW);
+
+ glEnable(GL_DEPTH_TEST);
+
+ glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
+ glLightfv(GL_LIGHT0, GL_POSITION, position);
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+ glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+
+ glMaterialfv(GL_FRONT, GL_SHININESS, front_mat_shininess);
+ glMaterialfv(GL_FRONT, GL_SPECULAR, front_mat_specular);
+ glMaterialfv(GL_FRONT, GL_DIFFUSE, front_mat_diffuse);
+ glMaterialfv(GL_BACK, GL_SHININESS, back_mat_shininess);
+ glMaterialfv(GL_BACK, GL_SPECULAR, back_mat_specular);
+ glMaterialfv(GL_BACK, GL_DIFFUSE, back_mat_diffuse);
+
+ glEnable(GL_FOG);
+ glFogi(GL_FOG_MODE, GL_EXP);
+ glFogf(GL_FOG_DENSITY, fogDensity);
+ if (rgb) {
+ glFogfv(GL_FOG_COLOR, fog_color);
+ glClearColor(0.8, 0.8, 0.8, 1.0);
+ } else {
+ glFogi(GL_FOG_INDEX, 1<<5);
+ SetFogRamp(5, 3);
+ glClearIndex(128);
+ }
+
+ Build_lists();
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluPerspective(45.0, 1.0, 1.0, 200.0);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key2(int key, int x, int y)
+{
+
+ switch (key) {
+ case GLUT_KEY_UP:
+ rotX -= 5;
+ break;
+ case GLUT_KEY_DOWN:
+ rotX += 5;
+ break;
+ case GLUT_KEY_LEFT:
+ rotY -= 5;
+ break;
+ case GLUT_KEY_RIGHT:
+ rotY += 5;
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ case 'D':
+ if (rgb) {
+ fogDensity *= 1.10;
+ glFogf(GL_FOG_DENSITY, fogDensity);
+ }
+ break;
+ case 'd':
+ if (rgb) {
+ fogDensity /= 1.10;
+ glFogf(GL_FOG_DENSITY, fogDensity);
+ }
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+
+ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+
+ glPushMatrix();
+
+ glTranslatef(0, 0, zTranslate);
+ glRotatef(rotY, 0,1,0);
+ glRotatef(rotX, 1,0,0);
+ glScalef(1.0, 1.0, 10.0);
+
+ glCallList(cubeList);
+
+ glPopMatrix();
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_TRUE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } 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_DEPTH;
+ type |= (rgb) ? GLUT_RGB : GLUT_INDEX;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Fog Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutSpecialFunc(Key2);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/font.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/font.c
new file mode 100644
index 000000000..a0091a65d
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/font.c
@@ -0,0 +1,273 @@
+/*
+ * 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 OPENGL_WIDTH 24
+#define OPENGL_HEIGHT 13
+
+
+char string[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz";
+GLenum rgb, doubleBuffer, windType;
+float angleX = 0.0, angleY = 0.0, angleZ = 0.0;
+float scaleX = 1.0, scaleY = 1.0, scaleZ = 1.0;
+float shiftX = 0.0, shiftY = 0.0, shiftZ = 0.0;
+
+
+#include "tkmap.c"
+
+
+static void DrawBitmapString(void *font, const char *string)
+{
+ int i;
+
+ for (i = 0; string[i]; i++)
+ glutBitmapCharacter(font, string[i]);
+}
+
+static void DrawStrokeString(void *font, const char *string)
+{
+ int i;
+
+ for (i = 0; string[i]; i++)
+ glutStrokeCharacter(font, string[i]);
+}
+
+static void Init(void)
+{
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClearIndex(0.0);
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(-400.0, 400.0, -200.0, 200.0, -400.0, 400.0);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key2(int key, int x, int y)
+{
+
+ switch (key) {
+ case GLUT_KEY_LEFT:
+ shiftX -= 20.0;
+ break;
+ case GLUT_KEY_RIGHT:
+ shiftX += 20.0;
+ break;
+ case GLUT_KEY_UP:
+ shiftY += 20.0;
+ break;
+ case GLUT_KEY_DOWN:
+ shiftY -= 20.0;
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+
+ case 'n':
+ shiftZ += 20.0;
+ break;
+ case 'm':
+ shiftZ -= 20.0;
+ break;
+
+ case 'q':
+ scaleX -= 0.1;
+ if (scaleX < 0.1) {
+ scaleX = 0.1;
+ }
+ break;
+ case 'w':
+ scaleX += 0.1;
+ break;
+ case 'a':
+ scaleY -= 0.1;
+ if (scaleY < 0.1) {
+ scaleY = 0.1;
+ }
+ break;
+ case 's':
+ scaleY += 0.1;
+ break;
+ case 'z':
+ scaleZ -= 0.1;
+ if (scaleZ < 0.1) {
+ scaleZ = 0.1;
+ }
+ break;
+ case 'x':
+ scaleZ += 0.1;
+ break;
+
+ case 'e':
+ angleX -= 5.0;
+ if (angleX < 0.0) {
+ angleX = 360.0 + angleX;
+ }
+ break;
+ case 'r':
+ angleX += 5.0;
+ if (angleX > 360.0) {
+ angleX = angleX - 360.0;
+ }
+ break;
+ case 'd':
+ angleY -= 5.0;
+ if (angleY < 0.0) {
+ angleY = 360.0 + angleY;
+ }
+ break;
+ case 'f':
+ angleY += 5.0;
+ if (angleY > 360.0) {
+ angleY = angleY - 360.0;
+ }
+ break;
+ case 'c':
+ angleZ -= 5.0;
+ if (angleZ < 0.0) {
+ angleZ = 360.0 + angleZ;
+ }
+ break;
+ case 'v':
+ angleZ += 5.0;
+ if (angleZ > 360.0) {
+ angleZ = angleZ - 360.0;
+ }
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ SetColor(COLOR_WHITE);
+
+ glPushMatrix();
+
+ glTranslatef(shiftX, shiftY, shiftZ);
+ glRotatef(angleX, 1.0, 0.0, 0.0);
+ glRotatef(angleY, 0.0, 1.0, 0.0);
+ glRotatef(angleZ, 0.0, 0.0, 1.0);
+ glScalef(scaleX, scaleY, scaleZ);
+
+ glPushMatrix();
+ glRasterPos2f(-390.5, 0.5);
+ DrawBitmapString(GLUT_BITMAP_9_BY_15, string);
+ glPopMatrix();
+
+ glPushMatrix();
+ glTranslatef(-390.5, -30.5, 0.0);
+ DrawStrokeString(GLUT_STROKE_ROMAN, string);
+ glPopMatrix();
+
+ glPopMatrix();
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ printf("%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 800, 400);
+
+ windType = (rgb) ? GLUT_RGB : GLUT_INDEX;
+ windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(windType);
+
+ if (glutCreateWindow("Font Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutSpecialFunc(Key2);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/line.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/line.c
new file mode 100644
index 000000000..83f70cb3a
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/line.c
@@ -0,0 +1,219 @@
+/*
+ * 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 16
+
+
+GLenum rgb, doubleBuffer, windType;
+
+GLenum mode1, mode2;
+GLint size;
+float pntA[3] = {
+ -160.0, 0.0, 0.0
+};
+float pntB[3] = {
+ -130.0, 0.0, 0.0
+};
+float pntC[3] = {
+ -40.0, -50.0, 0.0
+};
+float pntD[3] = {
+ 30.0, 60.0, 0.0
+};
+
+
+#include "tkmap.c"
+
+static void Init(void)
+{
+ GLint i;
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+
+ glLineStipple(1, 0xF0E0);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+
+ if (!rgb) {
+ for (i = 0; i < 16; i++) {
+ glutSetColor(i+CI_OFFSET, i/15.0, i/15.0, 0.0);
+ }
+ }
+
+ mode1 = GL_FALSE;
+ mode2 = GL_FALSE;
+ size = 1;
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(-175, 175, -175, 175);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ case '1':
+ mode1 = !mode1;
+ break;
+ case '2':
+ mode2 = !mode2;
+ break;
+ case 'W':
+ size++;
+ break;
+ case 'w':
+ size--;
+ if (size < 1) {
+ size = 1;
+ }
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+ GLint ci, i;
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glLineWidth(size);
+
+ if (mode1) {
+ glEnable(GL_LINE_STIPPLE);
+ } else {
+ glDisable(GL_LINE_STIPPLE);
+ }
+
+ if (mode2) {
+ ci = CI_OFFSET;
+ glEnable(GL_LINE_SMOOTH);
+ glEnable(GL_BLEND);
+ } else {
+ ci = COLOR_YELLOW;
+ glDisable(GL_LINE_SMOOTH);
+ glDisable(GL_BLEND);
+ }
+
+ glPushMatrix();
+
+ glShadeModel( GL_FLAT );
+
+ for (i = 0; i < 360; i += 5) {
+ glRotatef(5.0, 0,0,1);
+
+ (rgb) ? glColor3f(1.0, 1.0, 0.0) : glIndexi(ci);
+ glBegin(GL_LINE_STRIP);
+ glVertex3fv(pntA);
+ glVertex3fv(pntB);
+ glEnd();
+
+ glPointSize(1);
+
+ SetColor(COLOR_GREEN);
+ glBegin(GL_POINTS);
+ glVertex3fv(pntA);
+ glVertex3fv(pntB);
+ glEnd();
+ }
+
+ glPopMatrix();
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_TRUE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ printf("%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
+
+ windType = (rgb) ? GLUT_RGB : GLUT_INDEX;
+ windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(windType);
+
+ if (glutCreateWindow("Line Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/loadppm.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/loadppm.c
new file mode 100644
index 000000000..be056d629
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/loadppm.c
@@ -0,0 +1,72 @@
+
+typedef struct {
+ size_t sizeX, sizeY;
+ GLubyte *data;
+} PPMImage;
+
+static PPMImage *LoadPPM(const char *filename)
+{
+ char buff[16];
+ PPMImage *result;
+ FILE *fp;
+ int maxval;
+
+ fp = fopen(filename, "rb");
+ if (!fp)
+ {
+ fprintf(stderr, "Unable to open file `%s'\n", filename);
+ exit(1);
+ }
+
+ if (!fgets(buff, sizeof(buff), fp))
+ {
+ perror(filename);
+ exit(1);
+ }
+
+ if (buff[0] != 'P' || buff[1] != '6')
+ {
+ fprintf(stderr, "Invalid image format (must be `P6')\n");
+ exit(1);
+ }
+
+ result = (PPMImage *) malloc(sizeof(PPMImage));
+ if (!result)
+ {
+ fprintf(stderr, "Unable to allocate memory\n");
+ exit(1);
+ }
+
+ if (fscanf(fp, "%lu %lu", &result->sizeX, &result->sizeY) != 2)
+ {
+ fprintf(stderr, "Error loading image `%s'\n", filename);
+ exit(1);
+ }
+
+ if (fscanf(fp, "%d", &maxval) != 1)
+ {
+ fprintf(stderr, "Error loading image `%s'\n", filename);
+ exit(1);
+ }
+
+ while (fgetc(fp) != '\n')
+ ;
+
+ result->data = (GLubyte *) malloc(3 * result->sizeX * result->sizeY);
+ if (!result)
+ {
+ fprintf(stderr, "Unable to allocate memory\n");
+ exit(1);
+ }
+
+ if (fread(result->data, 3 * result->sizeX, result->sizeY, fp) != result->sizeY)
+ {
+ fprintf(stderr, "Error loading image `%s'\n", filename);
+ exit(1);
+ }
+
+ fclose(fp);
+
+ return result;
+}
+
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/logo.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/logo.c
new file mode 100644
index 000000000..ae74af685
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/logo.c
@@ -0,0 +1,1635 @@
+
+/*
+ * 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 PI 3.141592654
+
+#define BLACK 0
+#define GRAY 128
+#define WHITE 255
+#define BL 0x00
+#define WH 0xFF
+#define RD 0xA4,0x00,0x00,0xFF
+#define WT 0xFF,0xFF,0xFF,0xFF
+
+#define CHECKIMAGEWIDTH 8
+#define CHECKIMAGEHEIGHT 8
+#define BRICKIMAGEWIDTH 16
+#define BRICKIMAGEHEIGHT 16
+
+
+GLenum rgb, doubleBuffer;
+
+#include "tkmap.c"
+
+float black[3] = {0.0, 0.0, 0.0};
+float white[3] = {1.0, 1.0, 1.0};
+float gray[3] = {0.5, 0.5, 0.5};
+float blue[3] = {0.0, 0.0, 1.0};
+GLint colorIndexes[3] = {0, 200, 255};
+
+GLenum polyMode;
+GLboolean dithering;
+GLboolean shade;
+GLboolean doStipple;
+GLboolean noDraw = 0;
+GLboolean LineSmooth = GL_FALSE;
+
+double plane[4] = {1.0, 0.0, -1.0, 0.0};
+float xRotation = 30.0, yRotation = 30.0;
+float zTranslation = -15.0;
+
+GLint singleCylinder;
+GLint doubleCylinder;
+GLint elbow, logo;
+
+GLubyte checkImage[3*CHECKIMAGEWIDTH*CHECKIMAGEHEIGHT] = {
+ BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH,
+ WH, WH, BL, BL, BL, WH, WH, WH, WH, WH, WH, BL, BL, BL, WH, WH,
+ WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL,
+ BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH,
+ WH, WH, BL, BL, BL, WH, WH, WH, WH, WH, WH, BL, BL, BL, WH, WH,
+ WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL,
+ BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH,
+ WH, WH, BL, BL, BL, WH, WH, WH, WH, WH, WH, BL, BL, BL, WH, WH,
+ WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL,
+ BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH,
+ WH, WH, BL, BL, BL, WH, WH, WH, WH, WH, WH, BL, BL, BL, WH, WH,
+ WH, BL, BL, BL, WH, WH, WH, BL, BL, BL, WH, WH, WH, BL, BL, BL,
+};
+GLubyte brickImage[4*BRICKIMAGEWIDTH*BRICKIMAGEHEIGHT] = {
+ RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD,
+ RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD,
+ RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD,
+ RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD,
+ WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT,
+ RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD,
+ RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD,
+ RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD,
+ RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD,
+ WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT,
+ RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD,
+ RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD,
+ RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD,
+ RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD,
+ WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT,
+ RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD
+};
+
+GLubyte *image = checkImage;
+GLint imageHeight = CHECKIMAGEHEIGHT;
+GLint imageWidth = CHECKIMAGEWIDTH;
+
+static float decal[] = {
+ GL_DECAL,
+};
+static float modulate[] = {
+ GL_MODULATE,
+};
+static float repeat[] = {
+ GL_REPEAT,
+};
+static float nearest[] = {
+ GL_NEAREST,
+};
+
+GLubyte stipple[4*32] = {
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+
+ 0x00, 0x0F, 0xF0, 0x00,
+ 0x00, 0x0F, 0xF0, 0x00,
+ 0x00, 0x0F, 0xF0, 0x00,
+ 0x00, 0x0F, 0xF0, 0x00,
+ 0x00, 0x0F, 0xF0, 0x00,
+ 0x00, 0x0F, 0xF0, 0x00,
+ 0x00, 0x0F, 0xF0, 0x00,
+ 0x00, 0x0F, 0xF0, 0x00,
+
+ 0x00, 0x0F, 0xF0, 0x00,
+ 0x00, 0x0F, 0xF0, 0x00,
+ 0x00, 0x0F, 0xF0, 0x00,
+ 0x00, 0x0F, 0xF0, 0x00,
+ 0x00, 0x0F, 0xF0, 0x00,
+ 0x00, 0x0F, 0xF0, 0x00,
+ 0x00, 0x0F, 0xF0, 0x00,
+ 0x00, 0x0F, 0xF0, 0x00,
+
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00,
+};
+
+float tscp[18][2] = {
+ {
+ 0.0, 0.0
+ },
+ {
+ 1.0, 0.0
+ },
+ {
+ 0.0, 0.125
+ },
+ {
+ 1.0, 0.125
+ },
+ {
+ 0.0, 0.250
+ },
+ {
+ 1.0, 0.25
+ },
+ {
+ 0.0, 0.375
+ },
+ {
+ 1.0, 0.375
+ },
+ {
+ 0.0, 0.50
+ },
+ {
+ 1.0, 0.50
+ },
+ {
+ 0.0, 0.625
+ },
+ {
+ 1.0, 0.625
+ },
+ {
+ 0.0, 0.75
+ },
+ {
+ 1.0, 0.75
+ },
+ {
+ 0.0, 0.875
+ },
+ {
+ 1.0, 0.875
+ },
+ {
+ 0.0, 1.0
+ },
+ {
+ 1.0, 1.0
+ }
+};
+float scp[18][3] = {
+ {
+ 1.000000, 0.000000, 0.000000
+ },
+ {
+ 1.000000, 0.000000, 5.000000
+ },
+ {
+ 0.707107, 0.707107, 0.000000
+ },
+ {
+ 0.707107, 0.707107, 5.000000
+ },
+ {
+ 0.000000, 1.000000, 0.000000
+ },
+ {
+ 0.000000, 1.000000, 5.000000
+ },
+ {
+ -0.707107, 0.707107, 0.000000
+ },
+ {
+ -0.707107, 0.707107, 5.000000
+ },
+ {
+ -1.000000, 0.000000, 0.000000
+ },
+ {
+ -1.000000, 0.000000, 5.000000
+ },
+ {
+ -0.707107, -0.707107, 0.000000
+ },
+ {
+ -0.707107, -0.707107, 5.000000
+ },
+ {
+ 0.000000, -1.000000, 0.000000
+ },
+ {
+ 0.000000, -1.000000, 5.000000
+ },
+ {
+ 0.707107, -0.707107, 0.000000
+ },
+ {
+ 0.707107, -0.707107, 5.000000
+ },
+ {
+ 1.000000, 0.000000, 0.000000
+ },
+ {
+ 1.000000, 0.000000, 5.000000
+ }
+};
+float dcp[18][3] = {
+ {
+ 1.000000, 0.000000, 0.000000
+ },
+ {
+ 1.000000, 0.000000, 7.000000
+ },
+ {
+ 0.707107, 0.707107, 0.000000
+ },
+ {
+ 0.707107, 0.707107, 7.000000
+ },
+ {
+ 0.000000, 1.000000, 0.000000
+ },
+ {
+ 0.000000, 1.000000, 7.000000
+ },
+ {
+ -0.707107, 0.707107, 0.000000
+ },
+ {
+ -0.707107, 0.707107, 7.000000
+ },
+ {
+ -1.000000, 0.000000, 0.000000
+ },
+ {
+ -1.000000, 0.000000, 7.000000
+ },
+ {
+ -0.707107, -0.707107, 0.000000
+ },
+ {
+ -0.707107, -0.707107, 7.000000
+ },
+ {
+ 0.000000, -1.000000, 0.000000
+ },
+ {
+ 0.000000, -1.000000, 7.000000
+ },
+ {
+ 0.707107, -0.707107, 0.000000
+ },
+ {
+ 0.707107, -0.707107, 7.000000
+ },
+ {
+ 1.000000, 0.000000, 0.000000
+ },
+ {
+ 1.000000, 0.000000, 7.000000
+ }
+};
+float ep[7][9][3] = {
+ {
+ {
+ 1.000000, 0.000000, 0.000000
+ },
+ {
+ 0.707107, 0.707107, 0.000000
+ },
+ {
+ 0.000000, 1.000000, 0.000000
+ },
+ {
+ -0.707107, 0.707107, 0.000000
+ },
+ {
+ -1.000000, 0.000000, 0.000000
+ },
+ {
+ -0.707107, -0.707107, 0.000000
+ },
+ {
+ 0.000000, -1.000000, 0.000000
+ },
+ {
+ 0.707107, -0.707107, 0.000000
+ },
+ {
+ 1.000000, 0.000000, 0.000000
+ }
+ },
+ {
+ {
+ 1.000000, 0.034074, 0.258819
+ },
+ {
+ 0.707107, 0.717087, 0.075806
+ },
+ {
+ 0.000000, 1.000000, 0.000000
+ },
+ {
+ -0.707107, 0.717087, 0.075806
+ },
+ {
+ -1.000000, 0.034074, 0.258819
+ },
+ {
+ -0.707107, -0.648939, 0.441832
+ },
+ {
+ 0.000000, -0.931852, 0.517638
+ },
+ {
+ 0.707107, -0.648939, 0.441832
+ },
+ {
+ 1.000000, 0.034074, 0.258819
+ }
+ },
+ {
+ {
+ 1.000000, 0.133975, 0.500000
+ },
+ {
+ 0.707107, 0.746347, 0.146447
+ },
+ {
+ 0.000000, 1.000000, 0.000000
+ },
+ {
+ -0.707107, 0.746347, 0.146447
+ },
+ {
+ -1.000000, 0.133975, 0.500000
+ },
+ {
+ -0.707107, -0.478398, 0.853553
+ },
+ {
+ 0.000000, -0.732051, 1.000000
+ },
+ {
+ 0.707107, -0.478398, 0.853553
+ },
+ {
+ 1.000000, 0.133975, 0.500000
+ }
+ },
+ {
+ {
+ 1.000000, 0.292893, 0.707107
+ },
+ {
+ 0.707107, 0.792893, 0.207107
+ },
+ {
+ 0.000000, 1.000000, 0.000000
+ },
+ {
+ -0.707107, 0.792893, 0.207107
+ },
+ {
+ -1.000000, 0.292893, 0.707107
+ },
+ {
+ -0.707107, -0.207107, 1.207107
+ },
+ {
+ 0.000000, -0.414214, 1.414214
+ },
+ {
+ 0.707107, -0.207107, 1.207107
+ },
+ {
+ 1.000000, 0.292893, 0.707107
+ }
+ },
+ {
+ {
+ 1.000000, 0.500000, 0.866025
+ },
+ {
+ 0.707107, 0.853553, 0.253653
+ },
+ {
+ 0.000000, 1.000000, 0.000000
+ },
+ {
+ -0.707107, 0.853553, 0.253653
+ },
+ {
+ -1.000000, 0.500000, 0.866025
+ },
+ {
+ -0.707107, 0.146447, 1.478398
+ },
+ {
+ 0.000000, 0.000000, 1.732051
+ },
+ {
+ 0.707107, 0.146447, 1.478398
+ },
+ {
+ 1.000000, 0.500000, 0.866025
+ }
+ },
+ {
+ {
+ 1.000000, 0.741181, 0.965926
+ },
+ {
+ 0.707107, 0.924194, 0.282913
+ },
+ {
+ 0.000000, 1.000000, 0.000000
+ },
+ {
+ -0.707107, 0.924194, 0.282913
+ },
+ {
+ -1.000000, 0.741181, 0.965926
+ },
+ {
+ -0.707107, 0.558168, 1.648939
+ },
+ {
+ 0.000000, 0.482362, 1.931852
+ },
+ {
+ 0.707107, 0.558168, 1.648939
+ },
+ {
+ 1.000000, 0.741181, 0.965926
+ }
+ },
+ {
+ {
+ 1.000000, 1.000000, 1.000000
+ },
+ {
+ 0.707107, 1.000000, 0.292893
+ },
+ {
+ 0.000000, 1.000000, 0.000000
+ },
+ {
+ -0.707107, 1.000000, 0.292893
+ },
+ {
+ -1.000000, 1.000000, 1.000000
+ },
+ {
+ -0.707107, 1.000000, 1.707107
+ },
+ {
+ 0.000000, 1.000000, 2.000000
+ },
+ {
+ 0.707107, 1.000000, 1.707107
+ },
+ {
+ 1.000000, 1.000000, 1.000000
+ }
+ }
+};
+float en[7][9][3] = {
+ {
+ {
+ 1.000000, 0.000000, 0.000000
+ },
+ {
+ 0.707107, 0.707107, 0.000000
+ },
+ {
+ 0.000000, 1.000000, 0.000000
+ },
+ {
+ -0.707107, 0.707107, 0.000000
+ },
+ {
+ -1.000000, 0.000000, 0.000000
+ },
+ {
+ -0.707107, -0.707107, 0.000000
+ },
+ {
+ 0.000000, -1.000000, 0.000000
+ },
+ {
+ 0.707107, -0.707107, 0.000000
+ },
+ {
+ 1.000000, 0.000000, 0.000000
+ }
+ },
+ {
+ {
+ 1.000000, 0.000000, 0.000000
+ },
+ {
+ 0.707107, 0.683013, -0.183013
+ },
+ {
+ 0.000000, 0.965926, -0.258819
+ },
+ {
+ -0.707107, 0.683013, -0.183013
+ },
+ {
+ -1.000000, 0.000000, 0.000000
+ },
+ {
+ -0.707107, -0.683013, 0.183013
+ },
+ {
+ 0.000000, -0.965926, 0.258819
+ },
+ {
+ 0.707107, -0.683013, 0.183013
+ },
+ {
+ 1.000000, 0.000000, 0.000000
+ }
+ },
+ {
+ {
+ 1.000000, 0.000000, 0.000000
+ },
+ {
+ 0.707107, 0.612372, -0.353553
+ },
+ {
+ 0.000000, 0.866025, -0.500000
+ },
+ {
+ -0.707107, 0.612372, -0.353553
+ },
+ {
+ -1.000000, 0.000000, 0.000000
+ },
+ {
+ -0.707107, -0.612372, 0.353553
+ },
+ {
+ 0.000000, -0.866025, 0.500000
+ },
+ {
+ 0.707107, -0.612372, 0.353553
+ },
+ {
+ 1.000000, 0.000000, 0.000000
+ }
+ },
+ {
+ {
+ 1.000000, 0.000000, 0.000000
+ },
+ {
+ /* These 3 lines added by BEP */
+ 0.707107, 0.500000, -0.500000
+ },
+ {
+ 0.000000, 0.707107, -0.707107
+ },
+ {
+ -0.707107, 0.500000, -0.500000
+ },
+ {
+ -1.000000, 0.000000, 0.000000
+ },
+ {
+ -0.707107, -0.500000, 0.500000
+ },
+ {
+ 0.000000, -0.707107, 0.707107
+ },
+ {
+ 0.707107, -0.500000, 0.500000
+ },
+ {
+ 1.000000, 0.000000, 0.000000
+ }
+ },
+ {
+ {
+ 1.000000, 0.000000, 0.000000
+ },
+ {
+ 0.707107, 0.353553, -0.612372
+ },
+ {
+ 0.000000, 0.500000, -0.866025
+ },
+ {
+ -0.707107, 0.353553, -0.612372
+ },
+ {
+ -1.000000, 0.000000, 0.000000
+ },
+ {
+ -0.707107, -0.353553, 0.612372
+ },
+ {
+ 0.000000, -0.500000, 0.866025
+ },
+ {
+ 0.707107, -0.353553, 0.612372
+ },
+ {
+ 1.000000, 0.000000, 0.000000
+ }
+ },
+ {
+ {
+ 1.000000, 0.000000, 0.000000
+ },
+ {
+ 0.707107, 0.183013, -0.683013
+ },
+ {
+ 0.000000, 0.258819, -0.965926
+ },
+ {
+ -0.707107, 0.183013, -0.683013
+ },
+ {
+ -1.000000, 0.000000, 0.000000
+ },
+ {
+ -0.707107, -0.183013, 0.683013
+ },
+ {
+ 0.000000, -0.258819, 0.965926
+ },
+ {
+ 0.707107, -0.183013, 0.683013
+ },
+ {
+ 1.000000, 0.000000, 0.000000
+ }
+ },
+ {
+ {
+ 1.000000, 0.000000, 0.000000
+ },
+ {
+ 0.707107, 0.000000, -0.707107
+ },
+ {
+ 0.000000, 0.000000, -1.000000
+ },
+ {
+ -0.707107, 0.000000, -0.707107
+ },
+ {
+ -1.000000, 0.000000, 0.000000
+ },
+ {
+ -0.707107, 0.000000, 0.707107
+ },
+ {
+ 0.000000, 0.000000, 1.000000
+ },
+ {
+ 0.707107, 0.000000, 0.707107
+ },
+ {
+ 1.000000, 0.000000, 0.000000
+ }
+ }
+};
+float tep[7][9][2] = {
+ {
+ {
+ 0, 0.0
+ },
+ {
+ 0.125, 0.0
+ },
+ {
+ 0.25, 0.0
+ },
+ {
+ 0.375, 0.0
+ },
+ {
+ 0.5, 0.0
+ },
+ {
+ 0.625, 0.0
+ },
+ {
+ 0.75, 0.0
+ },
+ {
+ 0.875, 0.0
+ },
+ {
+ 1.0, 0.0
+ }
+ },
+ {
+ {
+ 0, 0.16667
+ },
+ {
+ 0.125, 0.16667
+ },
+ {
+ 0.25, 0.16667
+ },
+ {
+ 0.375, 0.16667
+ },
+ {
+ 0.5, 0.16667
+ },
+ {
+ 0.625, 0.16667
+ },
+ {
+ 0.75, 0.16667
+ },
+ {
+ 0.875, 0.16667
+ },
+ {
+ 1.0, 0.16667
+ }
+ },
+ {
+ {
+ 0, 0.33333
+ },
+ {
+ 0.125, 0.33333
+ },
+ {
+ 0.25, 0.33333
+ },
+ {
+ 0.375, 0.33333
+ },
+ {
+ 0.5, 0.33333
+ },
+ {
+ 0.625, 0.33333
+ },
+ {
+ 0.75, 0.33333
+ },
+ {
+ 0.875, 0.33333
+ },
+ {
+ 1.0, 0.33333
+ }
+ },
+ {
+ {
+ 0, 0.5
+ },
+ {
+ 0.125, 0.5
+ },
+ {
+ 0.25, 0.5
+ },
+ {
+ 0.375, 0.5
+ },
+ {
+ 0.5, 0.5
+ },
+ {
+ 0.625, 0.5
+ },
+ {
+ 0.75, 0.5
+ },
+ {
+ 0.875, 0.5
+ },
+ {
+ 1.0, 0.5
+ }
+ },
+ {
+ {
+ 0, 0.6667
+ },
+ {
+ 0.125, 0.6667
+ },
+ {
+ 0.25, 0.6667
+ },
+ {
+ 0.375, 0.6667
+ },
+ {
+ 0.5, 0.6667
+ },
+ {
+ 0.625, 0.6667
+ },
+ {
+ 0.75, 0.6667
+ },
+ {
+ 0.875, 0.6667
+ },
+ {
+ 1.0, 0.6667
+ }
+ },
+ {
+ {
+ 0, 0.83333
+ },
+ {
+ 0.125, 0.83333
+ },
+ {
+ 0.25, 0.83333
+ },
+ {
+ 0.375, 0.83333
+ },
+ {
+ 0.5, 0.83333
+ },
+ {
+ 0.625, 0.83333
+ },
+ {
+ 0.75, 0.83333
+ },
+ {
+ 0.875, 0.83333
+ },
+ {
+ 1.0, 0.83333
+ }
+ },
+ {
+ {
+ 0, 1.0
+ },
+ {
+ 0.125, 1.0
+ },
+ {
+ 0.25, 1.0
+ },
+ {
+ 0.375, 1.0
+ },
+ {
+ 0.5, 1.0
+ },
+ {
+ 0.625, 1.0
+ },
+ {
+ 0.75, 1.0
+ },
+ {
+ 0.875, 1.0
+ },
+ {
+ 1.0, 1.0
+ }
+ }
+};
+
+
+static void SetUpAntiAliasedGrayScale(void)
+{
+ float color;
+ GLint i, j;
+
+ for (i = 0; i < 16; i++) {
+ color = (2 * i + 1) / 32.0;
+ for (j = 0; j < 16; j++) {
+ glutSetColor(i*16+j, color*j/15.0, color*j/15.0, color*j/15.0);
+ }
+ }
+}
+
+static void BendForward(void)
+{
+
+ glTranslatef(0.0, 1.0, 0.0);
+ glRotatef(90.0, 1, 0, 0);
+ glTranslatef(0.0, -1.0, 0.0);
+}
+
+static void BendLeft(void)
+{
+
+ glRotatef(-90.0, 0, 0, 1);
+ glTranslatef(0.0, 1.0, 0.0);
+ glRotatef(90.0, 1, 0, 0);
+ glTranslatef(0.0, -1.0, 0.0);
+}
+
+static void BendRight(void)
+{
+
+ glRotatef(90.0, 0, 0, 1);
+ glTranslatef(0.0, 1.0, 0.0);
+ glRotatef(90.0, 1, 0, 0);
+ glTranslatef(0.0, -1.0, 0.0);
+}
+
+static void BuildSingleCylinder(void)
+{
+
+ glNewList(singleCylinder, GL_COMPILE);
+
+ glBegin(GL_TRIANGLE_STRIP);
+ glNormal3fv(scp[0]); glTexCoord2fv(tscp[0]); glVertex3fv(scp[0]);
+ glNormal3fv(scp[0]); glTexCoord2fv(tscp[1]); glVertex3fv(scp[1]);
+ glNormal3fv(scp[2]); glTexCoord2fv(tscp[2]); glVertex3fv(scp[2]);
+ glNormal3fv(scp[2]); glTexCoord2fv(tscp[3]); glVertex3fv(scp[3]);
+ glNormal3fv(scp[4]); glTexCoord2fv(tscp[4]); glVertex3fv(scp[4]);
+ glNormal3fv(scp[4]); glTexCoord2fv(tscp[5]); glVertex3fv(scp[5]);
+ glNormal3fv(scp[6]); glTexCoord2fv(tscp[6]); glVertex3fv(scp[6]);
+ glNormal3fv(scp[6]); glTexCoord2fv(tscp[7]); glVertex3fv(scp[7]);
+ glNormal3fv(scp[8]); glTexCoord2fv(tscp[8]); glVertex3fv(scp[8]);
+ glNormal3fv(scp[8]); glTexCoord2fv(tscp[9]); glVertex3fv(scp[9]);
+ glNormal3fv(scp[10]); glTexCoord2fv(tscp[10]); glVertex3fv(scp[10]);
+ glNormal3fv(scp[10]); glTexCoord2fv(tscp[11]); glVertex3fv(scp[11]);
+ glNormal3fv(scp[12]); glTexCoord2fv(tscp[12]); glVertex3fv(scp[12]);
+ glNormal3fv(scp[12]); glTexCoord2fv(tscp[13]); glVertex3fv(scp[13]);
+ glNormal3fv(scp[14]); glTexCoord2fv(tscp[14]); glVertex3fv(scp[14]);
+ glNormal3fv(scp[14]); glTexCoord2fv(tscp[15]); glVertex3fv(scp[15]);
+ glNormal3fv(scp[16]); glTexCoord2fv(tscp[16]); glVertex3fv(scp[16]);
+ glNormal3fv(scp[16]); glTexCoord2fv(tscp[17]); glVertex3fv(scp[17]);
+ glEnd();
+
+ glEndList();
+}
+
+static void BuildDoubleCylinder(void)
+{
+
+ glNewList(doubleCylinder, GL_COMPILE);
+
+ glBegin(GL_TRIANGLE_STRIP);
+ glNormal3fv(dcp[0]); glTexCoord2fv(tscp[0]); glVertex3fv(dcp[0]);
+ glNormal3fv(dcp[0]); glTexCoord2fv(tscp[1]); glVertex3fv(dcp[1]);
+ glNormal3fv(dcp[2]); glTexCoord2fv(tscp[2]); glVertex3fv(dcp[2]);
+ glNormal3fv(dcp[2]); glTexCoord2fv(tscp[3]); glVertex3fv(dcp[3]);
+ glNormal3fv(dcp[4]); glTexCoord2fv(tscp[4]); glVertex3fv(dcp[4]);
+ glNormal3fv(dcp[4]); glTexCoord2fv(tscp[5]); glVertex3fv(dcp[5]);
+ glNormal3fv(dcp[6]); glTexCoord2fv(tscp[6]); glVertex3fv(dcp[6]);
+ glNormal3fv(dcp[6]); glTexCoord2fv(tscp[7]); glVertex3fv(dcp[7]);
+ glNormal3fv(dcp[8]); glTexCoord2fv(tscp[8]); glVertex3fv(dcp[8]);
+ glNormal3fv(dcp[8]); glTexCoord2fv(tscp[9]); glVertex3fv(dcp[9]);
+ glNormal3fv(dcp[10]); glTexCoord2fv(tscp[10]); glVertex3fv(dcp[10]);
+ glNormal3fv(dcp[10]); glTexCoord2fv(tscp[11]); glVertex3fv(dcp[11]);
+ glNormal3fv(dcp[12]); glTexCoord2fv(tscp[12]); glVertex3fv(dcp[12]);
+ glNormal3fv(dcp[12]); glTexCoord2fv(tscp[13]); glVertex3fv(dcp[13]);
+ glNormal3fv(dcp[14]); glTexCoord2fv(tscp[14]); glVertex3fv(dcp[14]);
+ glNormal3fv(dcp[14]); glTexCoord2fv(tscp[15]); glVertex3fv(dcp[15]);
+ glNormal3fv(dcp[16]); glTexCoord2fv(tscp[16]); glVertex3fv(dcp[16]);
+ glNormal3fv(dcp[16]); glTexCoord2fv(tscp[17]); glVertex3fv(dcp[17]);
+ glEnd();
+
+ glEndList();
+}
+
+static void BuildElbow(void)
+{
+
+ glNewList(elbow, GL_COMPILE);
+
+ glBegin(GL_TRIANGLE_STRIP);
+ glNormal3fv(en[0][0]); glTexCoord2fv(tep[0][0]); glVertex3fv(ep[0][0]);
+ glNormal3fv(en[1][0]); glTexCoord2fv(tep[1][0]); glVertex3fv(ep[1][0]);
+ glNormal3fv(en[0][1]); glTexCoord2fv(tep[0][1]); glVertex3fv(ep[0][1]);
+ glNormal3fv(en[1][1]); glTexCoord2fv(tep[1][1]); glVertex3fv(ep[1][1]);
+ glNormal3fv(en[0][2]); glTexCoord2fv(tep[0][2]); glVertex3fv(ep[0][2]);
+ glNormal3fv(en[1][2]); glTexCoord2fv(tep[1][2]); glVertex3fv(ep[1][2]);
+ glNormal3fv(en[0][3]); glTexCoord2fv(tep[0][3]); glVertex3fv(ep[0][3]);
+ glNormal3fv(en[1][3]); glTexCoord2fv(tep[1][3]); glVertex3fv(ep[1][3]);
+ glNormal3fv(en[0][4]); glTexCoord2fv(tep[0][4]); glVertex3fv(ep[0][4]);
+ glNormal3fv(en[1][4]); glTexCoord2fv(tep[1][4]); glVertex3fv(ep[1][4]);
+ glNormal3fv(en[0][5]); glTexCoord2fv(tep[0][5]); glVertex3fv(ep[0][5]);
+ glNormal3fv(en[1][5]); glTexCoord2fv(tep[1][5]); glVertex3fv(ep[1][5]);
+ glNormal3fv(en[0][6]); glTexCoord2fv(tep[0][6]); glVertex3fv(ep[0][6]);
+ glNormal3fv(en[1][6]); glTexCoord2fv(tep[1][6]); glVertex3fv(ep[1][6]);
+ glNormal3fv(en[0][7]); glTexCoord2fv(tep[0][7]); glVertex3fv(ep[0][7]);
+ glNormal3fv(en[1][7]); glTexCoord2fv(tep[1][7]); glVertex3fv(ep[1][7]);
+ glNormal3fv(en[0][8]); glTexCoord2fv(tep[0][8]); glVertex3fv(ep[0][8]);
+ glNormal3fv(en[1][8]); glTexCoord2fv(tep[1][8]); glVertex3fv(ep[1][8]);
+ glEnd();
+ glBegin(GL_TRIANGLE_STRIP);
+ glNormal3fv(en[1][0]); glTexCoord2fv(tep[1][0]); glVertex3fv(ep[1][0]);
+ glNormal3fv(en[2][0]); glTexCoord2fv(tep[2][0]); glVertex3fv(ep[2][0]);
+ glNormal3fv(en[1][1]); glTexCoord2fv(tep[1][1]); glVertex3fv(ep[1][1]);
+ glNormal3fv(en[2][1]); glTexCoord2fv(tep[2][1]); glVertex3fv(ep[2][1]);
+ glNormal3fv(en[1][2]); glTexCoord2fv(tep[1][2]); glVertex3fv(ep[1][2]);
+ glNormal3fv(en[2][2]); glTexCoord2fv(tep[2][2]); glVertex3fv(ep[2][2]);
+ glNormal3fv(en[1][3]); glTexCoord2fv(tep[1][3]); glVertex3fv(ep[1][3]);
+ glNormal3fv(en[2][3]); glTexCoord2fv(tep[2][3]); glVertex3fv(ep[2][3]);
+ glNormal3fv(en[1][4]); glTexCoord2fv(tep[1][4]); glVertex3fv(ep[1][4]);
+ glNormal3fv(en[2][4]); glTexCoord2fv(tep[2][4]); glVertex3fv(ep[2][4]);
+ glNormal3fv(en[1][5]); glTexCoord2fv(tep[1][5]); glVertex3fv(ep[1][5]);
+ glNormal3fv(en[2][5]); glTexCoord2fv(tep[2][5]); glVertex3fv(ep[2][5]);
+ glNormal3fv(en[1][6]); glTexCoord2fv(tep[1][6]); glVertex3fv(ep[1][6]);
+ glNormal3fv(en[2][6]); glTexCoord2fv(tep[2][6]); glVertex3fv(ep[2][6]);
+ glNormal3fv(en[1][7]); glTexCoord2fv(tep[1][7]); glVertex3fv(ep[1][7]);
+ glNormal3fv(en[2][7]); glTexCoord2fv(tep[2][7]); glVertex3fv(ep[2][7]);
+ glNormal3fv(en[1][8]); glTexCoord2fv(tep[1][8]); glVertex3fv(ep[1][8]);
+ glNormal3fv(en[2][8]); glTexCoord2fv(tep[2][8]); glVertex3fv(ep[2][8]);
+ glEnd();
+ glBegin(GL_TRIANGLE_STRIP);
+ glNormal3fv(en[2][0]); glTexCoord2fv(tep[2][0]); glVertex3fv(ep[2][0]);
+ glNormal3fv(en[3][0]); glTexCoord2fv(tep[3][0]); glVertex3fv(ep[3][0]);
+ glNormal3fv(en[2][1]); glTexCoord2fv(tep[2][1]); glVertex3fv(ep[2][1]);
+ glNormal3fv(en[3][1]); glTexCoord2fv(tep[3][1]); glVertex3fv(ep[3][1]);
+ glNormal3fv(en[2][2]); glTexCoord2fv(tep[2][2]); glVertex3fv(ep[2][2]);
+ glNormal3fv(en[3][2]); glTexCoord2fv(tep[3][2]); glVertex3fv(ep[3][2]);
+ glNormal3fv(en[2][3]); glTexCoord2fv(tep[2][3]); glVertex3fv(ep[2][3]);
+ glNormal3fv(en[3][3]); glTexCoord2fv(tep[3][3]); glVertex3fv(ep[3][3]);
+ glNormal3fv(en[2][4]); glTexCoord2fv(tep[2][4]); glVertex3fv(ep[2][4]);
+ glNormal3fv(en[3][4]); glTexCoord2fv(tep[3][4]); glVertex3fv(ep[3][4]);
+ glNormal3fv(en[2][5]); glTexCoord2fv(tep[2][5]); glVertex3fv(ep[2][5]);
+ glNormal3fv(en[3][5]); glTexCoord2fv(tep[3][5]); glVertex3fv(ep[3][5]);
+ glNormal3fv(en[2][6]); glTexCoord2fv(tep[2][6]); glVertex3fv(ep[2][6]);
+ glNormal3fv(en[3][6]); glTexCoord2fv(tep[3][6]); glVertex3fv(ep[3][6]);
+ glNormal3fv(en[2][7]); glTexCoord2fv(tep[2][7]); glVertex3fv(ep[2][7]);
+ glNormal3fv(en[3][7]); glTexCoord2fv(tep[3][7]); glVertex3fv(ep[3][7]);
+ glNormal3fv(en[2][8]); glTexCoord2fv(tep[2][8]); glVertex3fv(ep[2][8]);
+ glNormal3fv(en[3][8]); glTexCoord2fv(tep[3][8]); glVertex3fv(ep[3][8]);
+ glEnd();
+ glBegin(GL_TRIANGLE_STRIP);
+ glNormal3fv(en[3][0]); glTexCoord2fv(tep[3][0]); glVertex3fv(ep[3][0]);
+ glNormal3fv(en[4][0]); glTexCoord2fv(tep[4][0]); glVertex3fv(ep[4][0]);
+ glNormal3fv(en[3][1]); glTexCoord2fv(tep[3][1]); glVertex3fv(ep[3][1]);
+ glNormal3fv(en[4][1]); glTexCoord2fv(tep[4][1]); glVertex3fv(ep[4][1]);
+ glNormal3fv(en[3][2]); glTexCoord2fv(tep[3][2]); glVertex3fv(ep[3][2]);
+ glNormal3fv(en[4][2]); glTexCoord2fv(tep[4][2]); glVertex3fv(ep[4][2]);
+ glNormal3fv(en[3][3]); glTexCoord2fv(tep[3][3]); glVertex3fv(ep[3][3]);
+ glNormal3fv(en[4][3]); glTexCoord2fv(tep[4][3]); glVertex3fv(ep[4][3]);
+ glNormal3fv(en[3][4]); glTexCoord2fv(tep[3][4]); glVertex3fv(ep[3][4]);
+ glNormal3fv(en[4][4]); glTexCoord2fv(tep[4][4]); glVertex3fv(ep[4][4]);
+ glNormal3fv(en[3][5]); glTexCoord2fv(tep[3][5]); glVertex3fv(ep[3][5]);
+ glNormal3fv(en[4][5]); glTexCoord2fv(tep[4][5]); glVertex3fv(ep[4][5]);
+ glNormal3fv(en[3][6]); glTexCoord2fv(tep[3][6]); glVertex3fv(ep[3][6]);
+ glNormal3fv(en[4][6]); glTexCoord2fv(tep[4][6]); glVertex3fv(ep[4][6]);
+ glNormal3fv(en[3][7]); glTexCoord2fv(tep[3][7]); glVertex3fv(ep[3][7]);
+ glNormal3fv(en[4][7]); glTexCoord2fv(tep[4][7]); glVertex3fv(ep[4][7]);
+ glNormal3fv(en[3][8]); glTexCoord2fv(tep[3][8]); glVertex3fv(ep[3][8]);
+ glNormal3fv(en[4][8]); glTexCoord2fv(tep[4][8]); glVertex3fv(ep[4][8]);
+ glEnd();
+ glBegin(GL_TRIANGLE_STRIP);
+ glNormal3fv(en[4][0]); glTexCoord2fv(tep[4][0]); glVertex3fv(ep[4][0]);
+ glNormal3fv(en[5][0]); glTexCoord2fv(tep[5][0]); glVertex3fv(ep[5][0]);
+ glNormal3fv(en[4][1]); glTexCoord2fv(tep[4][1]); glVertex3fv(ep[4][1]);
+ glNormal3fv(en[5][1]); glTexCoord2fv(tep[5][1]); glVertex3fv(ep[5][1]);
+ glNormal3fv(en[4][2]); glTexCoord2fv(tep[4][2]); glVertex3fv(ep[4][2]);
+ glNormal3fv(en[5][2]); glTexCoord2fv(tep[5][2]); glVertex3fv(ep[5][2]);
+ glNormal3fv(en[4][3]); glTexCoord2fv(tep[4][3]); glVertex3fv(ep[4][3]);
+ glNormal3fv(en[5][3]); glTexCoord2fv(tep[5][3]); glVertex3fv(ep[5][3]);
+ glNormal3fv(en[4][4]); glTexCoord2fv(tep[4][4]); glVertex3fv(ep[4][4]);
+ glNormal3fv(en[5][4]); glTexCoord2fv(tep[5][4]); glVertex3fv(ep[5][4]);
+ glNormal3fv(en[4][5]); glTexCoord2fv(tep[4][5]); glVertex3fv(ep[4][5]);
+ glNormal3fv(en[5][5]); glTexCoord2fv(tep[5][5]); glVertex3fv(ep[5][5]);
+ glNormal3fv(en[4][6]); glTexCoord2fv(tep[4][6]); glVertex3fv(ep[4][6]);
+ glNormal3fv(en[5][6]); glTexCoord2fv(tep[5][6]); glVertex3fv(ep[5][6]);
+ glNormal3fv(en[4][7]); glTexCoord2fv(tep[4][7]); glVertex3fv(ep[4][7]);
+ glNormal3fv(en[5][7]); glTexCoord2fv(tep[5][7]); glVertex3fv(ep[5][7]);
+ glNormal3fv(en[4][8]); glTexCoord2fv(tep[4][8]); glVertex3fv(ep[4][8]);
+ glNormal3fv(en[5][8]); glTexCoord2fv(tep[5][8]); glVertex3fv(ep[5][8]);
+ glEnd();
+ glBegin(GL_TRIANGLE_STRIP);
+ glNormal3fv(en[5][0]); glTexCoord2fv(tep[5][0]); glVertex3fv(ep[5][0]);
+ glNormal3fv(en[6][0]); glTexCoord2fv(tep[6][0]); glVertex3fv(ep[6][0]);
+ glNormal3fv(en[5][1]); glTexCoord2fv(tep[5][1]); glVertex3fv(ep[5][1]);
+ glNormal3fv(en[6][1]); glTexCoord2fv(tep[6][1]); glVertex3fv(ep[6][1]);
+ glNormal3fv(en[5][2]); glTexCoord2fv(tep[5][2]); glVertex3fv(ep[5][2]);
+ glNormal3fv(en[6][2]); glTexCoord2fv(tep[6][2]); glVertex3fv(ep[6][2]);
+ glNormal3fv(en[5][3]); glTexCoord2fv(tep[5][3]); glVertex3fv(ep[5][3]);
+ glNormal3fv(en[6][3]); glTexCoord2fv(tep[6][3]); glVertex3fv(ep[6][3]);
+ glNormal3fv(en[5][4]); glTexCoord2fv(tep[5][4]); glVertex3fv(ep[5][4]);
+ glNormal3fv(en[6][4]); glTexCoord2fv(tep[6][4]); glVertex3fv(ep[6][4]);
+ glNormal3fv(en[5][5]); glTexCoord2fv(tep[5][5]); glVertex3fv(ep[5][5]);
+ glNormal3fv(en[6][5]); glTexCoord2fv(tep[6][5]); glVertex3fv(ep[6][5]);
+ glNormal3fv(en[5][6]); glTexCoord2fv(tep[5][6]); glVertex3fv(ep[5][6]);
+ glNormal3fv(en[6][6]); glTexCoord2fv(tep[6][6]); glVertex3fv(ep[6][6]);
+ glNormal3fv(en[5][7]); glTexCoord2fv(tep[5][7]); glVertex3fv(ep[5][7]);
+ glNormal3fv(en[6][7]); glTexCoord2fv(tep[6][7]); glVertex3fv(ep[6][7]);
+ glNormal3fv(en[5][8]); glTexCoord2fv(tep[5][8]); glVertex3fv(ep[5][8]);
+ glNormal3fv(en[6][8]); glTexCoord2fv(tep[6][8]); glVertex3fv(ep[6][8]);
+ glEnd();
+
+ glEndList();
+}
+
+static void BuildLogo(void)
+{
+
+ glNewList(logo, GL_COMPILE);
+
+ glTranslatef(5.5, -3.5, 4.5);
+ glTranslatef(0.0, 0.0, -7.0);
+ glCallList(doubleCylinder);
+ BendForward();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -7.0);
+ glCallList(doubleCylinder);
+ BendForward();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -5.0);
+ glCallList(singleCylinder);
+ BendRight();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -7.0);
+ glCallList(doubleCylinder);
+ BendForward();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -7.0);
+ glCallList(doubleCylinder);
+ BendForward();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -5.0);
+ glCallList(singleCylinder);
+ BendLeft();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -7.0);
+ glCallList(doubleCylinder);
+ BendForward();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -7.0);
+ glCallList(doubleCylinder);
+ BendForward();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -5.0);
+ glCallList(singleCylinder);
+ BendRight();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -7.0);
+ glCallList(doubleCylinder);
+ BendForward();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -7.0);
+ glCallList(doubleCylinder);
+ BendForward();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -5.0);
+ glCallList(singleCylinder);
+ BendLeft();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -7.0);
+ glCallList(doubleCylinder);
+ BendForward();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -7.0);
+ glCallList(doubleCylinder);
+ BendForward();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -5.0);
+ glCallList(singleCylinder);
+ BendRight();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -7.0);
+ glCallList(doubleCylinder);
+ BendForward();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -7.0);
+ glCallList(doubleCylinder);
+ BendForward();
+ glCallList(elbow);
+ glTranslatef(0.0, 0.0, -5.0);
+ glCallList(singleCylinder);
+ BendLeft();
+ glCallList(elbow);
+
+ glEndList();
+}
+
+static void BuildLists(void)
+{
+
+ singleCylinder = glGenLists(1);
+ doubleCylinder = glGenLists(1);
+ elbow = glGenLists(1);
+ logo = glGenLists(1);
+
+ BuildSingleCylinder();
+ BuildDoubleCylinder();
+ BuildElbow();
+ BuildLogo();
+}
+
+static void Init(void)
+{
+ static float ambient[] = {0.1, 0.1, 0.1, 1.0};
+ static float diffuse[] = {0.5, 1.0, 1.0, 1.0};
+ static float position[] = {90.0, 90.0, 150.0, 0.0};
+ static float front_mat_shininess[] = {30.0};
+ static float front_mat_specular[] = {0.2, 0.2, 0.2, 1.0};
+ static float front_mat_diffuse[] = {0.5, 0.28, 0.38, 1.0};
+ static float back_mat_shininess[] = {50.0};
+ static float back_mat_specular[] = {0.5, 0.5, 0.2, 1.0};
+ static float back_mat_diffuse[] = {1.0, 1.0, 0.2, 1.0};
+ static float lmodel_ambient[] = {1.0, 1.0, 1.0, 1.0};
+ static float lmodel_twoside[] = {GL_TRUE};
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+
+ glFrontFace(GL_CW);
+
+ glEnable(GL_DEPTH_TEST);
+
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+ glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
+ glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
+ glLightfv(GL_LIGHT0, GL_POSITION, position);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+
+ glMaterialfv(GL_FRONT, GL_SHININESS, front_mat_shininess);
+ glMaterialfv(GL_FRONT, GL_SPECULAR, front_mat_specular);
+ glMaterialfv(GL_FRONT, GL_DIFFUSE, front_mat_diffuse);
+ glMaterialfv(GL_BACK, GL_SHININESS, back_mat_shininess);
+ glMaterialfv(GL_BACK, GL_SPECULAR, back_mat_specular);
+ glMaterialfv(GL_BACK, GL_DIFFUSE, back_mat_diffuse);
+
+ glEnable(GL_CLIP_PLANE0);
+
+ if (rgb) {
+ glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, decal);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, repeat);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, repeat);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nearest);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nearest);
+ glTexImage2D(GL_TEXTURE_2D, 0, 3, CHECKIMAGEWIDTH, CHECKIMAGEHEIGHT, 0,
+ GL_RGB, GL_UNSIGNED_BYTE, (GLvoid *)checkImage);
+ glEnable(GL_TEXTURE_2D);
+
+ glCullFace(GL_BACK);
+ glEnable(GL_CULL_FACE);
+ } else {
+ SetGreyRamp();
+ /* commented out by BrianP because it's the wrong way to handle a 4-bit visual!
+ if (doubleBuffer) {
+ colorIndexes[1] = 10;
+ colorIndexes[2] = 15;
+ }
+ */
+ glMaterialiv(GL_FRONT_AND_BACK, GL_COLOR_INDEXES, colorIndexes);
+ }
+
+ BuildLists();
+
+ dithering = GL_TRUE;
+ shade = GL_TRUE;
+ doStipple = GL_FALSE;
+ polyMode = GL_BACK;
+}
+
+static void Reshape(int width, int height)
+{
+ glViewport(0, 0, (GLint)width, (GLint)height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluPerspective(90, 1.0, 1.0, 200.0);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key2(int key, int x, int y)
+{
+ (void) x;
+ (void) y;
+ switch (key) {
+ case GLUT_KEY_LEFT:
+ yRotation += 0.5;
+ break;
+ case GLUT_KEY_RIGHT:
+ yRotation -= 0.5;
+ break;
+ case GLUT_KEY_UP:
+ plane[3] += 2.0;
+ break;
+ case GLUT_KEY_DOWN:
+ plane[3] -= 2.0;
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+ (void) x;
+ (void) y;
+ switch (key) {
+ case 27:
+ exit(1);
+
+ case 'Z':
+ zTranslation -= 1.0;
+ break;
+ case 'z':
+ zTranslation += 1.0;
+ break;
+
+ case '1':
+ glPolygonMode(polyMode, GL_POINT);
+ break;
+ case '2':
+ glPolygonMode(polyMode, GL_LINE);
+ break;
+ case '3':
+ glPolygonMode(polyMode, GL_FILL);
+ break;
+ case 'p':
+ switch (polyMode) {
+ case GL_BACK:
+ polyMode = GL_FRONT;
+ printf("PolygonMode GL_FRONT\n");
+ break;
+ case GL_FRONT:
+ polyMode = GL_FRONT_AND_BACK;
+ printf("PolygonMode GL_FRONT_AND_BACK\n");
+ break;
+ case GL_FRONT_AND_BACK:
+ polyMode = GL_BACK;
+ printf("PolygonMode GL_BACK\n");
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case '4':
+ glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
+ break;
+ case '5':
+ glEnable(GL_POLYGON_SMOOTH);
+ if (rgb) {
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ glEnable(GL_BLEND);
+ glDisable(GL_DEPTH_TEST);
+ } else {
+ SetUpAntiAliasedGrayScale();
+ }
+ break;
+ case '6':
+ glDisable(GL_POLYGON_SMOOTH);
+ if (rgb) {
+ glBlendFunc(GL_ONE, GL_ZERO);
+ glDisable(GL_BLEND);
+ glEnable(GL_DEPTH_TEST);
+ } else {
+ SetGreyRamp();
+ }
+ break;
+
+ case '8':
+ dithering = !dithering;
+ (dithering) ? glEnable(GL_DITHER) : glDisable(GL_DITHER);
+ break;
+
+ case '9':
+ doStipple = !doStipple;
+ if (doStipple) {
+ glPolygonStipple(stipple);
+ glEnable(GL_POLYGON_STIPPLE);
+ } else {
+ glDisable(GL_POLYGON_STIPPLE);
+ }
+ break;
+
+ case '0':
+ shade = !shade;
+ (shade) ? glShadeModel(GL_SMOOTH) : glShadeModel(GL_FLAT);
+ break;
+
+ case 'q':
+ glDisable(GL_CULL_FACE);
+ printf("disable culling\n");
+ break;
+ case 'w':
+ glEnable(GL_CULL_FACE);
+ glCullFace(GL_FRONT);
+ printf("enable front face culling\n");
+ break;
+ case 'e':
+ glEnable(GL_CULL_FACE);
+ glCullFace(GL_BACK);
+ printf("enable back face culling\n");
+ break;
+
+ case 'r':
+ glFrontFace(GL_CW);
+ break;
+ case 't':
+ glFrontFace(GL_CCW);
+ break;
+ case 'y':
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, 0);
+ glPolygonStipple(stipple);
+ break;
+ case 'u':
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, 1);
+ glPolygonStipple(stipple);
+ break;
+
+ case 'a':
+ glEnable(GL_TEXTURE_2D);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, repeat);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, repeat);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nearest);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nearest);
+ glTexImage2D(GL_TEXTURE_2D, 0, 4, BRICKIMAGEWIDTH,
+ BRICKIMAGEHEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ (GLvoid *)brickImage);
+ break;
+ case 's':
+ glEnable(GL_TEXTURE_2D);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, repeat);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, repeat);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nearest);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nearest);
+ glTexImage2D(GL_TEXTURE_2D, 0, 3, CHECKIMAGEWIDTH,
+ CHECKIMAGEHEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE,
+ (GLvoid *)checkImage);
+ break;
+ case 'd':
+ glDisable(GL_TEXTURE_2D);
+ break;
+
+ case 'f':
+ glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, decal);
+ break;
+ case 'g':
+ glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, modulate);
+ break;
+
+ case 'n':
+ /* added by BrianP */
+ noDraw = !noDraw;
+ if (noDraw) {
+ glDrawBuffer( GL_NONE );
+ }
+ else {
+ if (doubleBuffer) {
+ glDrawBuffer( GL_BACK );
+ }
+ else {
+ glDrawBuffer( GL_FRONT );
+ }
+ }
+ break;
+
+ case 'l':
+ /* Line Smooth - added by BrianP */
+ LineSmooth = !LineSmooth;
+ if (LineSmooth) {
+ glEnable(GL_LINE_SMOOTH);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ }
+ else {
+ glDisable(GL_LINE_SMOOTH);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glDisable(GL_BLEND);
+ }
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+
+ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+
+ glPushMatrix();
+
+ glTranslatef(0, 0, zTranslation);
+ glRotatef(30.0, 1, 0, 0);
+ glRotatef(yRotation, 0, 1, 0);
+ glClipPlane(GL_CLIP_PLANE0, plane);
+ glCallList(logo);
+
+ glPopMatrix();
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ printf("%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ unsigned int type;
+
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
+
+ type = GLUT_DEPTH;
+ type |= (rgb) ? GLUT_RGB : GLUT_INDEX;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Logo Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutSpecialFunc(Key2);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/nurb.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/nurb.c
new file mode 100644
index 000000000..dc8991295
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/nurb.c
@@ -0,0 +1,357 @@
+/*
+ * 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>
+
+
+#ifndef CALLBACK
+#define CALLBACK
+#endif
+
+
+#define INREAL float
+
+#define S_NUMPOINTS 13
+#define S_ORDER 3
+#define S_NUMKNOTS (S_NUMPOINTS + S_ORDER)
+#define T_NUMPOINTS 3
+#define T_ORDER 3
+#define T_NUMKNOTS (T_NUMPOINTS + T_ORDER)
+#define SQRT_TWO 1.41421356237309504880
+
+
+typedef INREAL Point[4];
+
+
+GLenum doubleBuffer;
+
+GLenum expectedError;
+GLint rotX = 40, rotY = 40;
+INREAL sknots[S_NUMKNOTS] = {
+ -1.0, -1.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0,
+ 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 9.0, 9.0
+};
+INREAL tknots[T_NUMKNOTS] = {
+ 1.0, 1.0, 1.0, 2.0, 2.0, 2.0
+};
+Point ctlpoints[S_NUMPOINTS][T_NUMPOINTS] = {
+ {
+ {
+ 4.0, 2.0, 2.0, 1.0
+ },
+ {
+ 4.0, 1.6, 2.5, 1.0
+ },
+ {
+ 4.0, 2.0, 3.0, 1.0
+ }
+ },
+ {
+ {
+ 5.0, 4.0, 2.0, 1.0
+ },
+ {
+ 5.0, 4.0, 2.5, 1.0
+ },
+ {
+ 5.0, 4.0, 3.0, 1.0
+ }
+ },
+ {
+ {
+ 6.0, 5.0, 2.0, 1.0
+ },
+ {
+ 6.0, 5.0, 2.5, 1.0
+ },
+ {
+ 6.0, 5.0, 3.0, 1.0
+ }
+ },
+ {
+ {
+ SQRT_TWO*6.0, SQRT_TWO*6.0, SQRT_TWO*2.0, SQRT_TWO
+ },
+ {
+ SQRT_TWO*6.0, SQRT_TWO*6.0, SQRT_TWO*2.5, SQRT_TWO
+ },
+ {
+ SQRT_TWO*6.0, SQRT_TWO*6.0, SQRT_TWO*3.0, SQRT_TWO
+ }
+ },
+ {
+ {
+ 5.2, 6.7, 2.0, 1.0
+ },
+ {
+ 5.2, 6.7, 2.5, 1.0
+ },
+ {
+ 5.2, 6.7, 3.0, 1.0
+ }
+ },
+ {
+ {
+ SQRT_TWO*4.0, SQRT_TWO*6.0, SQRT_TWO*2.0, SQRT_TWO
+ },
+ {
+ SQRT_TWO*4.0, SQRT_TWO*6.0, SQRT_TWO*2.5, SQRT_TWO
+ },
+ {
+ SQRT_TWO*4.0, SQRT_TWO*6.0, SQRT_TWO*3.0, SQRT_TWO
+ }
+ },
+ {
+ {
+ 4.0, 5.2, 2.0, 1.0
+ },
+ {
+ 4.0, 4.6, 2.5, 1.0
+ },
+ {
+ 4.0, 5.2, 3.0, 1.0
+ }
+ },
+ {
+ {
+ SQRT_TWO*4.0, SQRT_TWO*6.0, SQRT_TWO*2.0, SQRT_TWO
+ },
+ {
+ SQRT_TWO*4.0, SQRT_TWO*6.0, SQRT_TWO*2.5, SQRT_TWO
+ },
+ {
+ SQRT_TWO*4.0, SQRT_TWO*6.0, SQRT_TWO*3.0, SQRT_TWO
+ }
+ },
+ {
+ {
+ 2.8, 6.7, 2.0, 1.0
+ },
+ {
+ 2.8, 6.7, 2.5, 1.0
+ },
+ {
+ 2.8, 6.7, 3.0, 1.0
+ }
+ },
+ {
+ {
+ SQRT_TWO*2.0, SQRT_TWO*6.0, SQRT_TWO*2.0, SQRT_TWO
+ },
+ {
+ SQRT_TWO*2.0, SQRT_TWO*6.0, SQRT_TWO*2.5, SQRT_TWO
+ },
+ {
+ SQRT_TWO*2.0, SQRT_TWO*6.0, SQRT_TWO*3.0, SQRT_TWO
+ }
+ },
+ {
+ {
+ 2.0, 5.0, 2.0, 1.0
+ },
+ {
+ 2.0, 5.0, 2.5, 1.0
+ },
+ {
+ 2.0, 5.0, 3.0, 1.0
+ }
+ },
+ {
+ {
+ 3.0, 4.0, 2.0, 1.0
+ },
+ {
+ 3.0, 4.0, 2.5, 1.0
+ },
+ {
+ 3.0, 4.0, 3.0, 1.0
+ }
+ },
+ {
+ {
+ 4.0, 2.0, 2.0, 1.0
+ },
+ {
+ 4.0, 1.6, 2.5, 1.0
+ },
+ {
+ 4.0, 2.0, 3.0, 1.0
+ }
+ }
+};
+GLUnurbsObj *theNurbs;
+
+
+static void CALLBACK ErrorCallback(GLenum which)
+{
+
+ if (which != expectedError) {
+ fprintf(stderr, "Unexpected error occured (%d):\n", which);
+ fprintf(stderr, " %s\n", (char *) gluErrorString(which));
+ }
+}
+
+typedef void (GLAPIENTRY *callback_t)();
+
+static void Init(void)
+{
+
+ theNurbs = gluNewNurbsRenderer();
+ gluNurbsCallback(theNurbs, GLU_ERROR, (callback_t) ErrorCallback);
+
+ gluNurbsProperty(theNurbs, GLU_SAMPLING_TOLERANCE, 15.0);
+ gluNurbsProperty(theNurbs, GLU_DISPLAY_MODE, GLU_OUTLINE_PATCH);
+
+ expectedError = GLU_INVALID_ENUM;
+ gluNurbsProperty(theNurbs, ~0, 15.0);
+ expectedError = GLU_NURBS_ERROR13;
+ gluEndSurface(theNurbs);
+ expectedError = 0;
+
+ glColor3f(1.0, 1.0, 1.0);
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glFrustum(-2.0, 2.0, -2.0, 2.0, 0.8, 10.0);
+ gluLookAt(7.0, 4.5, 4.0, 4.5, 4.5, 2.5, 6.0, -3.0, 2.0);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key2(int key, int x, int y)
+{
+
+ switch (key) {
+ case GLUT_KEY_DOWN:
+ rotX -= 5;
+ break;
+ case GLUT_KEY_UP:
+ rotX += 5;
+ break;
+ case GLUT_KEY_LEFT:
+ rotY -= 5;
+ break;
+ case GLUT_KEY_RIGHT:
+ rotY += 5;
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ }
+}
+
+static void Draw(void)
+{
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glPushMatrix();
+
+ glTranslatef(4.0, 4.5, 2.5);
+ glRotatef(rotY, 1, 0, 0);
+ glRotatef(rotX, 0, 1, 0);
+ glTranslatef(-4.0, -4.5, -2.5);
+
+ gluBeginSurface(theNurbs);
+ gluNurbsSurface(theNurbs, S_NUMKNOTS, sknots, T_NUMKNOTS, tknots,
+ 4*T_NUMPOINTS, 4, &ctlpoints[0][0][0], S_ORDER,
+ T_ORDER, GL_MAP2_VERTEX_4);
+ gluEndSurface(theNurbs);
+
+ 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 {
+ 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;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("NURBS Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutSpecialFunc(Key2);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/oglinfo.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/oglinfo.c
new file mode 100644
index 000000000..4fe51efb3
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/oglinfo.c
@@ -0,0 +1,218 @@
+/* oglinfo.c */
+
+/* This demo modified by BrianP to accomodate Mesa and test
+ * the GLX 1.1 functions.
+ */
+
+
+
+#include <GL/gl.h>
+#include <GL/glx.h>
+#include <GL/glu.h>
+#include <stdio.h>
+#include <string.h>
+
+int visual_request0[] = { None }; /* don't need much of a visual */
+int visual_request1[] = { GLX_RGBA, None }; /* in case CI failed */
+
+int main(int argc, char **argv)
+{
+ char *display_name = NULL;
+ char *string;
+ Display *dpy;
+ int screen_num;
+ int major, minor;
+ XVisualInfo *vis;
+ GLXContext ctx;
+ Window root, win;
+ Colormap cmap;
+ XSetWindowAttributes swa;
+ int dontcare;
+
+ /* parse arguments */
+ if(argc > 1) {
+ if(!strcmp(argv[1],"-display"))
+ display_name = argv[2];
+ else {
+ fprintf(stderr, "Usage: %s [-display <display>]\n",argv[0]);
+ return 0;
+ }
+ }
+
+ /* get display */
+ if (!(dpy = XOpenDisplay(display_name))) {
+ fprintf(stderr,"Error: XOpenDisplay() failed.\n");
+ return 1;
+ }
+
+ /* does the server know about OpenGL & GLX? */
+#ifndef MESA
+ if(!XQueryExtension(dpy, "GLX", &dontcare, &dontcare, &dontcare)) {
+ fprintf(stderr,"This system doesn't appear to support OpenGL\n");
+ return 1;
+ }
+#else
+ (void) dontcare;
+#endif
+
+ /* find the glx version */
+ if(glXQueryVersion(dpy, &major, &minor))
+ printf("GLX Version: %d.%d\n", major, minor);
+ else {
+ fprintf(stderr, "Error: glXQueryVersion() failed.\n");
+ return 1;
+ }
+
+ /* get screen number */
+ screen_num = DefaultScreen(dpy);
+
+/* This #ifdef isn't redundant. It keeps the build from breaking
+** if you are building on a machine that has an old (1.0) version
+** of glx.
+**
+** This program could still be *run* on a machine that has an old
+** version of glx, even if it was *compiled* on a version that has
+** a new version.
+**
+** If compiled on a system with an old version of glx, then it will
+** never recognize glx extensions, since that code would have been
+** #ifdef'ed out.
+*/
+#ifdef GLX_VERSION_1_1
+
+ /*
+ ** This test guarantees that glx, on the display you are inquiring,
+ ** suppports glXQueryExtensionsString().
+ */
+ if(minor > 0 || major > 1)
+ string = (char *) glXQueryExtensionsString(dpy, screen_num);
+ else
+ string = "";
+
+ if(string)
+ printf("GLX Extensions (client & server): %s\n",
+ string);
+ else {
+ fprintf(stderr, "Error: glXQueryExtensionsString() failed.\n");
+ return 1;
+ }
+
+ if (minor>0 || major>1) {
+ printf("glXGetClientString(GLX_VENDOR): %s\n", glXGetClientString(dpy,GLX_VENDOR));
+ printf("glXGetClientString(GLX_VERSION): %s\n", glXGetClientString(dpy,GLX_VERSION));
+ printf("glXGetClientString(GLX_EXTENSIONS): %s\n", glXGetClientString(dpy,GLX_EXTENSIONS));
+ printf("glXQueryServerString(GLX_VENDOR): %s\n", glXQueryServerString(dpy,screen_num,GLX_VENDOR));
+ printf("glXQueryServerString(GLX_VERSION): %s\n", glXQueryServerString(dpy,screen_num,GLX_VERSION));
+ printf("glXQueryServerString(GLX_EXTENSIONS): %s\n", glXQueryServerString(dpy,screen_num,GLX_EXTENSIONS));
+ }
+
+
+#endif
+
+ /* get any valid OpenGL visual */
+ if (!(vis = glXChooseVisual(dpy, screen_num, visual_request0))) {
+ if (!(vis = glXChooseVisual(dpy, screen_num, visual_request1))) {
+ fprintf(stderr,"Error: glXChooseVisual() failed.\n");
+ return 1;
+ }
+ }
+
+ /* get context */
+ ctx = glXCreateContext(dpy,vis,0,GL_TRUE);
+
+ /* root window */
+ root = RootWindow(dpy,vis->screen);
+
+ /* get RGBA colormap */
+ cmap = XCreateColormap(dpy, root, vis->visual, AllocNone);
+
+ /* get window */
+ swa.colormap = cmap;
+ swa.border_pixel = 0;
+ swa.event_mask = StructureNotifyMask;
+ win = XCreateWindow(dpy, root, 0, 0, 1, 1, 0, vis->depth,
+ InputOutput,vis->visual,
+ CWBorderPixel|CWColormap|CWEventMask,
+ &swa);
+
+ glXMakeCurrent(dpy,win,ctx);
+
+ string = (char *) glGetString(GL_VERSION);
+ if(string)
+#ifdef MESA
+ printf("Mesa Version: %s\n", string);
+#else
+ printf("OpenGL Version: %s\n", string);
+#endif
+ else {
+ fprintf(stderr, "Error: glGetString(GL_VERSION) failed.\n");
+ return 1;
+ }
+
+ string = (char *) glGetString(GL_EXTENSIONS);
+
+ if(string)
+#ifdef MESA
+ printf("Mesa Extensions: %s\n", string);
+#else
+ printf("OpenGL Extensions: %s\n", string);
+#endif
+ else {
+ fprintf(stderr, "Error: glGetString(GL_EXTENSIONS) failed.\n");
+ return 1;
+ }
+
+ string = (char *) glGetString(GL_RENDERER);
+
+ if(string)
+#ifdef MESA
+ printf("Mesa Renderer: %s\n", string);
+#else
+ printf("OpenGL renderer: %s\n", string);
+#endif
+ else {
+ fprintf(stderr, "Error: glGetString(GL_RENDERER) failed.\n");
+ return 1;
+ }
+
+/*
+** This #ifdef prevents a build failure if you compile on an a
+** machine with an old GLU library.
+**
+** If you build on a pre GLU 1.1 machine, you will never be able
+** to get glu info, even if you run on a GLU 1.1 or latter machine,
+** since the code has been #ifdef'ed out.
+*/
+#ifdef GLU_VERSION_1_1
+
+ /*
+ ** If the glx version is 1.1 or latter, gluGetString() is guaranteed
+ ** to exist.
+ */
+ if(minor > 0 || major > 1)
+ string = (char *) gluGetString(GLU_VERSION);
+ else
+ string = "1.0";
+
+ if(string)
+ printf("GLU Version: %s\n", string);
+ else {
+ fprintf(stderr, "Error: gluGetString(GLU_VERSION) failed.\n");
+ return 1;
+ }
+
+ if(minor > 0 || major > 1)
+ string = (char *) gluGetString(GLU_EXTENSIONS);
+ else
+ string = "";
+
+ if(string)
+ printf("GLU Extensions: %s\n", string);
+ else {
+ fprintf(stderr, "Error: gluGetString(GLU_EXTENSIONS) failed.\n");
+ return 1;
+ }
+
+#endif
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/olympic.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/olympic.c
new file mode 100644
index 000000000..5385e4870
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/olympic.c
@@ -0,0 +1,389 @@
+/*
+ * 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.
+ */
+
+/*
+ * Nov 20, 1995 use stdlib's rand()/srand() instead of random()/srand48(), etc.
+ */
+
+/*
+ * Modified by Li Wei(liwei@aiar.xjtu.edu.cn) to be able to run in Windows
+ * 6/13
+ *
+ * Modified by Brian Paul to compile with Windows OR Unix. 7/23/97
+ */
+
+
+#define _HPUX_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <GL/glut.h>
+
+#ifndef RAND_MAX
+# define RAND_MAX 32767
+#endif
+
+
+#define XSIZE 100
+#define YSIZE 75
+
+#define RINGS 5
+#define BLUERING 0
+#define BLACKRING 1
+#define REDRING 2
+#define YELLOWRING 3
+#define GREENRING 4
+
+#define BACKGROUND 8
+
+
+GLenum rgb, doubleBuffer;
+
+#include "tkmap.c"
+
+unsigned char rgb_colors[RINGS][3];
+int mapped_colors[RINGS];
+float dests[RINGS][3];
+float offsets[RINGS][3];
+float angs[RINGS];
+float rotAxis[RINGS][3];
+int iters[RINGS];
+GLuint theTorus;
+
+
+void FillTorus(float rc, int numc, float rt, int numt)
+{
+ int i, j, k;
+ double s, t;
+ double x, y, z;
+ double pi, twopi;
+
+ pi = 3.14159265358979323846;
+ twopi = 2 * pi;
+
+ for (i = 0; i < numc; i++) {
+ glBegin(GL_QUAD_STRIP);
+ for (j = 0; j <= numt; j++) {
+ for (k = 1; k >= 0; k--) {
+ s = (i + k) % numc + 0.5;
+ t = j % numt;
+
+ x = cos(t*twopi/numt) * cos(s*twopi/numc);
+ y = sin(t*twopi/numt) * cos(s*twopi/numc);
+ z = sin(s*twopi/numc);
+ glNormal3f(x, y, z);
+
+ x = (rt + rc * cos(s*twopi/numc)) * cos(t*twopi/numt);
+ y = (rt + rc * cos(s*twopi/numc)) * sin(t*twopi/numt);
+ z = rc * sin(s*twopi/numc);
+ glVertex3f(x, y, z);
+ }
+ }
+ glEnd();
+ }
+}
+
+float Clamp(int iters_left, float t)
+{
+ if (iters_left < 3) {
+ return 0.0;
+ }
+ return (iters_left-2)*t/iters_left;
+}
+
+void DrawScene(void)
+{
+ int i, j;
+ GLboolean goIdle;
+ static double t0 = -1.;
+ double t, dt;
+ t = glutGet(GLUT_ELAPSED_TIME) / 1000.;
+ if (t0 < 0.)
+ t0 = t;
+ dt = t - t0;
+
+ if (dt < 1./30.)
+ return;
+
+ t0 = t;
+
+ goIdle = GL_TRUE;
+ for (i = 0; i < RINGS; i++) {
+ if (iters[i]) {
+ for (j = 0; j < 3; j++) {
+ offsets[i][j] = Clamp(iters[i], offsets[i][j]);
+ }
+ angs[i] = Clamp(iters[i], angs[i]);
+ iters[i]--;
+ goIdle = GL_FALSE;
+ }
+ }
+ if (goIdle) {
+ glutIdleFunc(NULL);
+ }
+
+ glPushMatrix();
+
+ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+ gluLookAt(0,0,10, 0,0,0, 0,1,0);
+
+ for (i = 0; i < RINGS; i++) {
+ if (rgb) {
+ glColor3ubv(rgb_colors[i]);
+ } else {
+ glIndexi(mapped_colors[i]);
+ }
+ glPushMatrix();
+ glTranslatef(dests[i][0]+offsets[i][0], dests[i][1]+offsets[i][1],
+ dests[i][2]+offsets[i][2]);
+ glRotatef(angs[i], rotAxis[i][0], rotAxis[i][1], rotAxis[i][2]);
+ glCallList(theTorus);
+ glPopMatrix();
+ }
+
+ glPopMatrix();
+
+ glFlush();
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+float MyRand(void)
+{
+ return 10.0 * ( (float) rand() / (float) RAND_MAX - 0.5 );
+}
+
+#if !defined(GLUTCALLBACK)
+#define GLUTCALLBACK
+#endif
+
+void GLUTCALLBACK glut_post_redisplay_p(void)
+{
+ glutPostRedisplay();
+}
+
+void ReInit(void)
+{
+ int i;
+ float deviation;
+
+ deviation = MyRand() / 2;
+ deviation = deviation * deviation;
+ for (i = 0; i < RINGS; i++) {
+ offsets[i][0] = MyRand();
+ offsets[i][1] = MyRand();
+ offsets[i][2] = MyRand();
+ angs[i] = 260.0 * MyRand();
+ rotAxis[i][0] = MyRand();
+ rotAxis[i][1] = MyRand();
+ rotAxis[i][2] = MyRand();
+ iters[i] = (deviation * MyRand() + 60.0);
+ }
+ glutIdleFunc(glut_post_redisplay_p);
+}
+
+void Init(void)
+{
+ float base, height;
+ float aspect, x, y;
+ int i;
+
+ float top_y = 1.0;
+ float bottom_y = 0.0;
+ float top_z = 0.15;
+ float bottom_z = 0.69;
+ float spacing = 2.5;
+ static float lmodel_ambient[] = {0.0, 0.0, 0.0, 0.0};
+ static float lmodel_twoside[] = {GL_FALSE};
+ static float lmodel_local[] = {GL_FALSE};
+ static float light0_ambient[] = {0.1, 0.1, 0.1, 1.0};
+ static float light0_diffuse[] = {1.0, 1.0, 1.0, 0.0};
+ static float light0_position[] = {0.8660254, 0.5, 1, 0};
+ static float light0_specular[] = {1.0, 1.0, 1.0, 0.0};
+ static float bevel_mat_ambient[] = {0.0, 0.0, 0.0, 1.0};
+ static float bevel_mat_shininess[] = {40.0};
+ static float bevel_mat_specular[] = {1.0, 1.0, 1.0, 0.0};
+ static float bevel_mat_diffuse[] = {1.0, 0.0, 0.0, 0.0};
+
+ srand( (unsigned int) glutGet(GLUT_ELAPSED_TIME) );
+
+ ReInit();
+ for (i = 0; i < RINGS; i++) {
+ rgb_colors[i][0] = rgb_colors[i][1] = rgb_colors[i][2] = 0;
+ }
+ rgb_colors[BLUERING][2] = 255;
+ rgb_colors[REDRING][0] = 255;
+ rgb_colors[GREENRING][1] = 255;
+ rgb_colors[YELLOWRING][0] = 255;
+ rgb_colors[YELLOWRING][1] = 255;
+ mapped_colors[BLUERING] = COLOR_BLUE;
+ mapped_colors[REDRING] = COLOR_RED;
+ mapped_colors[GREENRING] = COLOR_GREEN;
+ mapped_colors[YELLOWRING] = COLOR_YELLOW;
+ mapped_colors[BLACKRING] = COLOR_BLACK;
+
+ dests[BLUERING][0] = -spacing;
+ dests[BLUERING][1] = top_y;
+ dests[BLUERING][2] = top_z;
+
+ dests[BLACKRING][0] = 0.0;
+ dests[BLACKRING][1] = top_y;
+ dests[BLACKRING][2] = top_z;
+
+ dests[REDRING][0] = spacing;
+ dests[REDRING][1] = top_y;
+ dests[REDRING][2] = top_z;
+
+ dests[YELLOWRING][0] = -spacing / 2.0;
+ dests[YELLOWRING][1] = bottom_y;
+ dests[YELLOWRING][2] = bottom_z;
+
+ dests[GREENRING][0] = spacing / 2.0;
+ dests[GREENRING][1] = bottom_y;
+ dests[GREENRING][2] = bottom_z;
+
+ base = 2.0;
+ height = 2.0;
+ theTorus = glGenLists(1);
+ glNewList(theTorus, GL_COMPILE);
+ FillTorus(0.1, 8, 1.0, 25);
+ glEndList();
+
+ x = (float)XSIZE;
+ y = (float)YSIZE;
+ aspect = x / y;
+ glEnable(GL_CULL_FACE);
+ glCullFace(GL_BACK);
+ glEnable(GL_DEPTH_TEST);
+ glClearDepth(1.0);
+
+ if (rgb) {
+ glClearColor(0.5, 0.5, 0.5, 0.0);
+ glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
+ glLightfv(GL_LIGHT0, GL_SPECULAR, light0_specular);
+ glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
+ glEnable(GL_LIGHT0);
+
+ glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, lmodel_local);
+ glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+ glEnable(GL_LIGHTING);
+
+ glMaterialfv(GL_FRONT, GL_AMBIENT, bevel_mat_ambient);
+ glMaterialfv(GL_FRONT, GL_SHININESS, bevel_mat_shininess);
+ glMaterialfv(GL_FRONT, GL_SPECULAR, bevel_mat_specular);
+ glMaterialfv(GL_FRONT, GL_DIFFUSE, bevel_mat_diffuse);
+
+ glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
+ glEnable(GL_COLOR_MATERIAL);
+ glShadeModel(GL_SMOOTH);
+ } else {
+ glClearIndex(BACKGROUND);
+ glShadeModel(GL_FLAT);
+ }
+
+ glMatrixMode(GL_PROJECTION);
+ gluPerspective(45, 1.33, 0.1, 100.0);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, width, height);
+}
+
+void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ case 32:
+ ReInit();
+ break;
+ }
+}
+
+GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_TRUE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } 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( 400, 300);
+
+ type = GLUT_DEPTH;
+ type |= (rgb) ? GLUT_RGB : GLUT_INDEX;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Olympic") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(DrawScene);
+ glutIdleFunc(glut_post_redisplay_p);
+
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/overlay.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/overlay.c
new file mode 100644
index 000000000..23b5a4793
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/overlay.c
@@ -0,0 +1,378 @@
+/*
+ * 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 <time.h>
+#include <GL/glut.h>
+
+
+#ifndef PI
+#define PI 3.141592657
+#endif
+
+
+enum {
+ NORMAL = 0,
+ WEIRD = 1
+};
+
+enum {
+ STREAK = 0,
+ CIRCLE = 1
+};
+
+#define MAXSTARS 400
+#define MAXPOS 10000
+#define MAXWARP 10
+#define MAXANGLES 6000
+
+
+typedef struct _starRec {
+ GLint type;
+ float x[2], y[2], z[2];
+ float offsetX, offsetY, offsetR, rotation;
+} starRec;
+
+
+GLenum doubleBuffer;
+GLint windW, windH;
+
+GLenum flag = NORMAL, overlayInit = GL_FALSE;
+GLint starCount = MAXSTARS / 2;
+float speed = 1.0;
+GLint nitro = 0;
+starRec stars[MAXSTARS];
+float sinTable[MAXANGLES];
+
+
+float Sin(float angle)
+{
+
+ return (sinTable[(GLint)angle]);
+}
+
+float Cos(float angle)
+{
+
+ return (sinTable[((GLint)angle+(MAXANGLES/4))%MAXANGLES]);
+}
+
+void NewStar(GLint n, GLint d)
+{
+
+ if (rand()%4 == 0) {
+ stars[n].type = CIRCLE;
+ } else {
+ stars[n].type = STREAK;
+ }
+ stars[n].x[0] = (float)(rand() % MAXPOS - MAXPOS / 2);
+ stars[n].y[0] = (float)(rand() % MAXPOS - MAXPOS / 2);
+ stars[n].z[0] = (float)(rand() % MAXPOS + d);
+ if (rand()%4 == 0 && flag == WEIRD) {
+ stars[n].offsetX = (float)(rand() % 100 - 100 / 2);
+ stars[n].offsetY = (float)(rand() % 100 - 100 / 2);
+ stars[n].offsetR = (float)(rand() % 25 - 25 / 2);
+ } else {
+ stars[n].offsetX = 0.0;
+ stars[n].offsetY = 0.0;
+ stars[n].offsetR = 0.0;
+ }
+}
+
+void RotatePoint(float *x, float *y, float rotation)
+{
+ float tmpX, tmpY;
+
+ tmpX = *x * Cos(rotation) - *y * Sin(rotation);
+ tmpY = *y * Cos(rotation) + *x * Sin(rotation);
+ *x = tmpX;
+ *y = tmpY;
+}
+
+void MoveStars(void)
+{
+ float offset;
+ GLint n;
+
+ offset = speed * 60.0;
+
+ for (n = 0; n < starCount; n++) {
+ stars[n].x[1] = stars[n].x[0];
+ stars[n].y[1] = stars[n].y[0];
+ stars[n].z[1] = stars[n].z[0];
+ stars[n].x[0] += stars[n].offsetX;
+ stars[n].y[0] += stars[n].offsetY;
+ stars[n].z[0] -= offset;
+ stars[n].rotation += stars[n].offsetR;
+ if (stars[n].rotation > MAXANGLES) {
+ stars[n].rotation = 0.0;
+ }
+ }
+}
+
+GLenum StarPoint(GLint n)
+{
+ float x0, y0, x1, y1, width;
+ GLint i;
+
+ x0 = stars[n].x[0] * windW / stars[n].z[0];
+ y0 = stars[n].y[0] * windH / stars[n].z[0];
+ RotatePoint(&x0, &y0, stars[n].rotation);
+ x0 += windW / 2.0;
+ y0 += windH / 2.0;
+
+ if (x0 >= 0.0 && x0 < windW && y0 >= 0.0 && y0 < windH) {
+ if (stars[n].type == STREAK) {
+ x1 = stars[n].x[1] * windW / stars[n].z[1];
+ y1 = stars[n].y[1] * windH / stars[n].z[1];
+ RotatePoint(&x1, &y1, stars[n].rotation);
+ x1 += windW / 2.0;
+ y1 += windH / 2.0;
+
+ glLineWidth(MAXPOS/100.0/stars[n].z[0]+1.0);
+ glColor3f(1.0, (MAXWARP-speed)/MAXWARP, (MAXWARP-speed)/MAXWARP);
+ if (fabs(x0-x1) < 1.0 && fabs(y0-y1) < 1.0) {
+ glBegin(GL_POINTS);
+ glVertex2f(x0, y0);
+ glEnd();
+ } else {
+ glBegin(GL_LINES);
+ glVertex2f(x0, y0);
+ glVertex2f(x1, y1);
+ glEnd();
+ }
+ } else {
+ width = MAXPOS / 10.0 / stars[n].z[0] + 1.0;
+ glColor3f(1.0, 0.0, 0.0);
+ glBegin(GL_POLYGON);
+ for (i = 0; i < 8; i++) {
+ float x = x0 + width * Cos((float)i*MAXANGLES/8.0);
+ float y = y0 + width * Sin((float)i*MAXANGLES/8.0);
+ glVertex2f(x, y);
+ };
+ glEnd();
+ }
+ return GL_TRUE;
+ } else {
+ return GL_FALSE;
+ }
+}
+
+void ShowStars(void)
+{
+ GLint n;
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ for (n = 0; n < starCount; n++) {
+ if (stars[n].z[0] > speed || (stars[n].z[0] > 0.0 && speed < MAXWARP)) {
+ if (StarPoint(n) == GL_FALSE) {
+ NewStar(n, MAXPOS);
+ }
+ } else {
+ NewStar(n, MAXPOS);
+ }
+ }
+}
+
+static void Init(void)
+{
+ float angle;
+ GLint n;
+
+ srand((unsigned int)time(NULL));
+
+ for (n = 0; n < MAXSTARS; n++) {
+ NewStar(n, 100);
+ }
+
+ angle = 0.0;
+ for (n = 0; n < MAXANGLES ; n++) {
+ sinTable[n] = sin(angle);
+ angle += PI / (MAXANGLES / 2.0);
+ }
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+
+ glDisable(GL_DITHER);
+}
+
+void Reshape(int width, int height)
+{
+
+ windW = (GLint)width;
+ windH = (GLint)height;
+
+ glutUseLayer(GLUT_OVERLAY);
+
+ glViewport(0, 0, windW, windH);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(-0.5, windW+0.5, -0.5, windH+0.5);
+ glMatrixMode(GL_MODELVIEW);
+ overlayInit = GL_FALSE;
+
+ glutUseLayer(GLUT_NORMAL);
+
+ glViewport(0, 0, windW, windH);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(-0.5, windW+0.5, -0.5, windH+0.5);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ case 32:
+ flag = (flag == NORMAL) ? WEIRD : NORMAL;
+ break;
+ case 't':
+ nitro = 1;
+ break;
+ default:
+ return;
+ }
+}
+
+void Idle(void)
+{
+
+ if (overlayInit == GL_FALSE) {
+ glutUseLayer(GLUT_OVERLAY);
+ glClear(GL_COLOR_BUFFER_BIT);
+/* glColor3f(1.0, 0.0, 0.0);*/
+
+ glIndexf( 2.0 );
+ glBegin(GL_POLYGON);
+ glVertex2i(windW/4-10, windH/4-10);
+ glVertex2i(windW/2-10, windH/4-10);
+ glVertex2i(windW/2-10, windH/2-10);
+ glVertex2i(windW/4-10, windH/2-10);
+ glEnd();
+
+ glIndexf( 0.0 );
+ glBegin(GL_POLYGON);
+ glVertex2i(windW/4, windH/4);
+ glVertex2i(windW/2, windH/4);
+ glVertex2i(windW/2, windH/2);
+ glVertex2i(windW/4, windH/2);
+ glEnd();
+
+ glIndexf( 1.0 );
+ glBegin(GL_POLYGON);
+ glVertex2i(windW/4+10, windH/4+10);
+ glVertex2i(windW/2+10, windH/4+10);
+ glVertex2i(windW/2+10, windH/2+10);
+ glVertex2i(windW/4+10, windH/2+10);
+ glEnd();
+
+ glutUseLayer(GLUT_NORMAL);
+ overlayInit = GL_TRUE;
+ }
+
+ MoveStars();
+ ShowStars();
+ if (nitro > 0) {
+ speed = (float)(nitro / 10) + 1.0;
+ if (speed > MAXWARP) {
+ speed = MAXWARP;
+ }
+ if (++nitro > MAXWARP*10) {
+ nitro = -nitro;
+ }
+ } else if (nitro < 0) {
+ nitro++;
+ speed = (float)(-nitro / 10) + 1.0;
+ if (speed > MAXWARP) {
+ speed = MAXWARP;
+ }
+ }
+
+ 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;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ GLenum type;
+
+ glutInit(&argc, argv);
+
+ if (!glutLayerGet(GLUT_OVERLAY_POSSIBLE))
+ {
+ fprintf(stderr, "Overlay not available\n");
+ return(1);
+ }
+
+ if (Args(argc, argv) == GL_FALSE) {
+ return(1);
+ }
+
+ windW = 300;
+ windH = 300;
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
+
+ type = GLUT_RGB;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Overlay Test") == GL_FALSE) {
+ return(1);
+ }
+
+ glutEstablishOverlay();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutIdleFunc(Idle);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/point.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/point.c
new file mode 100644
index 000000000..4cb6ad7d5
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/point.c
@@ -0,0 +1,234 @@
+/*
+ * 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_RED COLOR_RED
+#define CI_ANTI_ALIAS_GREEN 16
+#define CI_ANTI_ALIAS_YELLOW 32
+#define CI_ANTI_ALIAS_RED 48
+
+
+GLenum rgb, doubleBuffer, windType;
+GLint windW, windH;
+
+#include "tkmap.c"
+
+GLenum mode;
+GLint size;
+float point[3] = {
+ 1.0, 1.0, 0.0
+};
+
+
+static void Init(void)
+{
+ GLint i;
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+
+ glBlendFunc(GL_SRC_ALPHA, GL_ZERO);
+
+ if (!rgb) {
+ for (i = 0; i < 16; i++) {
+ glutSetColor(i+CI_ANTI_ALIAS_RED, i/15.0, 0.0, 0.0);
+ glutSetColor(i+CI_ANTI_ALIAS_YELLOW, i/15.0, i/15.0, 0.0);
+ glutSetColor(i+CI_ANTI_ALIAS_GREEN, 0.0, i/15.0, 0.0);
+ }
+ }
+
+ mode = GL_FALSE;
+ size = 1;
+}
+
+static void Reshape(int width, int height)
+{
+
+ windW = (GLint)width;
+ windH = (GLint)height;
+
+ glViewport(0, 0, width, height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(-windW/2, windW/2, -windH/2, windH/2);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key2(int key, int x, int y)
+{
+
+ switch (key) {
+ case GLUT_KEY_LEFT:
+ point[0] -= 0.25;
+ break;
+ case GLUT_KEY_RIGHT:
+ point[0] += 0.25;
+ break;
+ case GLUT_KEY_UP:
+ point[1] += 0.25;
+ break;
+ case GLUT_KEY_DOWN:
+ point[1] -= 0.25;
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ case '1':
+ mode = !mode;
+ break;
+ case 'W':
+ size++;
+ break;
+ case 'w':
+ size--;
+ if (size < 1) {
+ size = 1;
+ }
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ SetColor(COLOR_YELLOW);
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(-windW/2, 0);
+ glVertex2f(windW/2, 0);
+ glEnd();
+ glBegin(GL_LINE_STRIP);
+ glVertex2f(0, -windH/2);
+ glVertex2f(0, windH/2);
+ glEnd();
+
+ if (mode) {
+ glEnable(GL_BLEND);
+ glEnable(GL_POINT_SMOOTH);
+ } else {
+ glDisable(GL_BLEND);
+ glDisable(GL_POINT_SMOOTH);
+ }
+
+ glPointSize(size);
+ if (mode) {
+ (rgb) ? glColor3f(1.0, 0.0, 0.0) : glIndexf(CI_ANTI_ALIAS_RED);
+ } else {
+ (rgb) ? glColor3f(1.0, 0.0, 0.0) : glIndexf(CI_RED);
+ }
+ glBegin(GL_POINTS);
+ glVertex3fv(point);
+ glEnd();
+
+ glDisable(GL_POINT_SMOOTH);
+ glDisable(GL_BLEND);
+
+ glPointSize(1);
+ SetColor(COLOR_GREEN);
+ glBegin(GL_POINTS);
+ glVertex3fv(point);
+ glEnd();
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ printf("%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ windW = 300;
+ windH = 300;
+ glutInitWindowPosition(0, 0); glutInitWindowSize( windW, windH);
+
+ windType = (rgb) ? GLUT_RGB : GLUT_INDEX;
+ windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(windType);
+
+ if (glutCreateWindow("Point Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutSpecialFunc(Key2);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/prim.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/prim.c
new file mode 100644
index 000000000..388e0153b
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/prim.c
@@ -0,0 +1,546 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <GL/glut.h>
+
+
+#define PIXEL_CENTER(x) ((long)(x) + 0.5)
+
+#define GAP 10
+#define ROWS 3
+#define COLS 4
+
+#define OPENGL_WIDTH 48
+#define OPENGL_HEIGHT 13
+
+
+GLenum rgb, doubleBuffer, windType;
+GLint windW, windH;
+
+GLenum mode1, mode2;
+GLint boxW, boxH;
+GLubyte OpenGL_bits[] = {
+ 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x7f, 0xfb, 0xff, 0xff, 0xff, 0x01,
+ 0x7f, 0xfb, 0xff, 0xff, 0xff, 0x01,
+ 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x3e, 0x8f, 0xb7, 0xf9, 0xfc, 0x01,
+ 0x63, 0xdb, 0xb0, 0x8d, 0x0d, 0x00,
+ 0x63, 0xdb, 0xb7, 0x8d, 0x0d, 0x00,
+ 0x63, 0xdb, 0xb6, 0x8d, 0x0d, 0x00,
+ 0x63, 0x8f, 0xf3, 0xcc, 0x0d, 0x00,
+ 0x63, 0x00, 0x00, 0x0c, 0x4c, 0x0a,
+ 0x63, 0x00, 0x00, 0x0c, 0x4c, 0x0e,
+ 0x63, 0x00, 0x00, 0x8c, 0xed, 0x0e,
+ 0x3e, 0x00, 0x00, 0xf8, 0x0c, 0x00,
+};
+
+
+#include "tkmap.c"
+
+static void Init(void)
+{
+
+ mode1 = GL_TRUE;
+ mode2 = GL_TRUE;
+}
+
+static void Reshape(int width, int height)
+{
+
+ windW = (GLint)width;
+ windH = (GLint)height;
+}
+
+static void RotateColorMask(void)
+{
+ static GLint rotation = 0;
+
+ rotation = (rotation + 1) & 0x3;
+ switch (rotation) {
+ case 0:
+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+ glIndexMask( 0xff );
+ break;
+ case 1:
+ glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE);
+ glIndexMask(0xFE);
+ break;
+ case 2:
+ glColorMask(GL_TRUE, GL_FALSE, GL_TRUE, GL_TRUE);
+ glIndexMask(0xFD);
+ break;
+ case 3:
+ glColorMask(GL_TRUE, GL_TRUE, GL_FALSE, GL_TRUE);
+ glIndexMask(0xFB);
+ break;
+ }
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ case '1':
+ mode1 = !mode1;
+ break;
+ case '2':
+ mode2 = !mode2;
+ break;
+ case '3':
+ RotateColorMask();
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Viewport(GLint row, GLint column)
+{
+ GLint x, y;
+
+ boxW = (windW - (COLS + 1) * GAP) / COLS;
+ boxH = (windH - (ROWS + 1) * GAP) / ROWS;
+
+ x = GAP + column * (boxW + GAP);
+ y = GAP + row * (boxH + GAP);
+
+ glViewport(x, y, boxW, boxH);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(-boxW/2, boxW/2, -boxH/2, boxH/2, 0.0, 1.0);
+ glMatrixMode(GL_MODELVIEW);
+
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(x, y, boxW, boxH);
+}
+
+static void Point(void)
+{
+ GLint i;
+
+ glBegin(GL_POINTS);
+ SetColor(COLOR_WHITE);
+ glVertex2i(0, 0);
+ for (i = 1; i < 8; i++) {
+ GLint j = i * 2;
+ SetColor(COLOR_BLACK+i);
+ glVertex2i(-j, -j);
+ glVertex2i(-j, 0);
+ glVertex2i(-j, j);
+ glVertex2i(0, j);
+ glVertex2i(j, j);
+ glVertex2i(j, 0);
+ glVertex2i(j, -j);
+ glVertex2i(0, -j);
+ }
+ glEnd();
+}
+
+static void Lines(void)
+{
+ GLint i;
+
+ glPushMatrix();
+
+ glTranslatef(-12, 0, 0);
+ for (i = 1; i < 8; i++) {
+ SetColor(COLOR_BLACK+i);
+ glBegin(GL_LINES);
+ glVertex2i(-boxW/4, -boxH/4);
+ glVertex2i(boxW/4, boxH/4);
+ glEnd();
+ glTranslatef(4, 0, 0);
+ }
+
+ glPopMatrix();
+
+ glBegin(GL_LINES);
+ glVertex2i(0, 0);
+ glEnd();
+}
+
+static void LineStrip(void)
+{
+
+ glBegin(GL_LINE_STRIP);
+ SetColor(COLOR_RED);
+ glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(-boxH/4));
+ SetColor(COLOR_GREEN);
+ glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(boxH/4));
+ SetColor(COLOR_BLUE);
+ glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(boxH/4));
+ SetColor(COLOR_WHITE);
+ glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(-boxH/4));
+ glEnd();
+
+ glBegin(GL_LINE_STRIP);
+ glVertex2i(0, 0);
+ glEnd();
+}
+
+static void LineLoop(void)
+{
+
+ glBegin(GL_LINE_LOOP);
+ SetColor(COLOR_RED);
+ glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(-boxH/4));
+ SetColor(COLOR_GREEN);
+ glVertex2f(PIXEL_CENTER(-boxW/4), PIXEL_CENTER(boxH/4));
+ SetColor(COLOR_BLUE);
+ glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(boxH/4));
+ SetColor(COLOR_WHITE);
+ glVertex2f(PIXEL_CENTER(boxW/4), PIXEL_CENTER(-boxH/4));
+ glEnd();
+
+ glEnable(GL_LOGIC_OP);
+ glLogicOp(GL_XOR);
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_ONE, GL_ONE);
+
+ SetColor(COLOR_MAGENTA);
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(-boxH/8));
+ glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(boxH/8));
+ glEnd();
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(PIXEL_CENTER(-boxW/8), PIXEL_CENTER(boxH/8+5));
+ glVertex2f(PIXEL_CENTER(boxW/8), PIXEL_CENTER(boxH/8+5));
+ glEnd();
+ glDisable(GL_LOGIC_OP);
+ glDisable(GL_BLEND);
+
+ SetColor(COLOR_GREEN);
+ glBegin(GL_POINTS);
+ glVertex2i(0, 0);
+ glEnd();
+
+ glBegin(GL_LINE_LOOP);
+ glVertex2i(0, 0);
+ glEnd();
+}
+
+static void Bitmap(void)
+{
+
+ glBegin(GL_LINES);
+ SetColor(COLOR_GREEN);
+ glVertex2i(-boxW/2, 0);
+ glVertex2i(boxW/2, 0);
+ glVertex2i(0, -boxH/2);
+ glVertex2i(0, boxH/2);
+ SetColor(COLOR_RED);
+ glVertex2i(0, -3);
+ glVertex2i(0, -3+OPENGL_HEIGHT);
+ SetColor(COLOR_BLUE);
+ glVertex2i(0, -3);
+ glVertex2i(OPENGL_WIDTH, -3);
+ glEnd();
+
+ SetColor(COLOR_GREEN);
+
+ glPixelStorei(GL_UNPACK_LSB_FIRST, GL_TRUE);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ glRasterPos2i(0, 0);
+ glBitmap(OPENGL_WIDTH, OPENGL_HEIGHT, 0, 3, 0.0, 0.0, OpenGL_bits);
+}
+
+static void Triangles(void)
+{
+
+ glBegin(GL_TRIANGLES);
+ SetColor(COLOR_GREEN);
+ glVertex2i(-boxW/4, -boxH/4);
+ SetColor(COLOR_RED);
+ glVertex2i(-boxW/8, -boxH/16);
+ SetColor(COLOR_BLUE);
+ glVertex2i(boxW/8, -boxH/16);
+
+ SetColor(COLOR_GREEN);
+ glVertex2i(-boxW/4, boxH/4);
+ SetColor(COLOR_RED);
+ glVertex2i(-boxW/8, boxH/16);
+ SetColor(COLOR_BLUE);
+ glVertex2i(boxW/8, boxH/16);
+ glEnd();
+
+ glBegin(GL_TRIANGLES);
+ glVertex2i(0, 0);
+ glVertex2i(-100, 100);
+ glEnd();
+}
+
+static void TriangleStrip(void)
+{
+
+ glBegin(GL_TRIANGLE_STRIP);
+ SetColor(COLOR_GREEN);
+ glVertex2i(-boxW/4, -boxH/4);
+ SetColor(COLOR_RED);
+ glVertex2i(-boxW/4, boxH/4);
+ SetColor(COLOR_BLUE);
+ glVertex2i(0, -boxH/4);
+ SetColor(COLOR_WHITE);
+ glVertex2i(0, boxH/4);
+ SetColor(COLOR_CYAN);
+ glVertex2i(boxW/4, -boxH/4);
+ SetColor(COLOR_YELLOW);
+ glVertex2i(boxW/4, boxH/4);
+ glEnd();
+
+ glBegin(GL_TRIANGLE_STRIP);
+ glVertex2i(0, 0);
+ glVertex2i(-100, 100);
+ glEnd();
+}
+
+static void TriangleFan(void)
+{
+ GLint vx[8][2];
+ GLint x0, y0, x1, y1, x2, y2, x3, y3;
+ GLint i;
+
+ y0 = -boxH/4;
+ y1 = y0 + boxH/2/3;
+ y2 = y1 + boxH/2/3;
+ y3 = boxH/4;
+ x0 = -boxW/4;
+ x1 = x0 + boxW/2/3;
+ x2 = x1 + boxW/2/3;
+ x3 = boxW/4;
+
+ vx[0][0] = x0; vx[0][1] = y1;
+ vx[1][0] = x0; vx[1][1] = y2;
+ vx[2][0] = x1; vx[2][1] = y3;
+ vx[3][0] = x2; vx[3][1] = y3;
+ vx[4][0] = x3; vx[4][1] = y2;
+ vx[5][0] = x3; vx[5][1] = y1;
+ vx[6][0] = x2; vx[6][1] = y0;
+ vx[7][0] = x1; vx[7][1] = y0;
+
+ glBegin(GL_TRIANGLE_FAN);
+ SetColor(COLOR_WHITE);
+ glVertex2i(0, 0);
+ for (i = 0; i < 8; i++) {
+ SetColor(COLOR_WHITE-i);
+ glVertex2iv(vx[i]);
+ }
+ glEnd();
+
+ glBegin(GL_TRIANGLE_FAN);
+ glVertex2i(0, 0);
+ glVertex2i(-100, 100);
+ glEnd();
+}
+
+static void Rect(void)
+{
+
+ SetColor(COLOR_GREEN);
+ glRecti(-boxW/4, -boxH/4, boxW/4, boxH/4);
+}
+
+static void PolygonFunc(void)
+{
+ GLint vx[8][2];
+ GLint x0, y0, x1, y1, x2, y2, x3, y3;
+ GLint i;
+
+ y0 = -boxH/4;
+ y1 = y0 + boxH/2/3;
+ y2 = y1 + boxH/2/3;
+ y3 = boxH/4;
+ x0 = -boxW/4;
+ x1 = x0 + boxW/2/3;
+ x2 = x1 + boxW/2/3;
+ x3 = boxW/4;
+
+ vx[0][0] = x0; vx[0][1] = y1;
+ vx[1][0] = x0; vx[1][1] = y2;
+ vx[2][0] = x1; vx[2][1] = y3;
+ vx[3][0] = x2; vx[3][1] = y3;
+ vx[4][0] = x3; vx[4][1] = y2;
+ vx[5][0] = x3; vx[5][1] = y1;
+ vx[6][0] = x2; vx[6][1] = y0;
+ vx[7][0] = x1; vx[7][1] = y0;
+
+ glBegin(GL_POLYGON);
+ for (i = 0; i < 8; i++) {
+ SetColor(COLOR_WHITE-i);
+ glVertex2iv(vx[i]);
+ }
+ glEnd();
+
+ glBegin(GL_POLYGON);
+ glVertex2i(0, 0);
+ glVertex2i(100, 100);
+ glEnd();
+}
+
+static void Quads(void)
+{
+
+ glBegin(GL_QUADS);
+ SetColor(COLOR_GREEN);
+ glVertex2i(-boxW/4, -boxH/4);
+ SetColor(COLOR_RED);
+ glVertex2i(-boxW/8, -boxH/16);
+ SetColor(COLOR_BLUE);
+ glVertex2i(boxW/8, -boxH/16);
+ SetColor(COLOR_WHITE);
+ glVertex2i(boxW/4, -boxH/4);
+
+ SetColor(COLOR_GREEN);
+ glVertex2i(-boxW/4, boxH/4);
+ SetColor(COLOR_RED);
+ glVertex2i(-boxW/8, boxH/16);
+ SetColor(COLOR_BLUE);
+ glVertex2i(boxW/8, boxH/16);
+ SetColor(COLOR_WHITE);
+ glVertex2i(boxW/4, boxH/4);
+ glEnd();
+
+ glBegin(GL_QUADS);
+ glVertex2i(0, 0);
+ glVertex2i(100, 100);
+ glVertex2i(-100, 100);
+ glEnd();
+}
+
+static void QuadStrip(void)
+{
+
+ glBegin(GL_QUAD_STRIP);
+ SetColor(COLOR_GREEN);
+ glVertex2i(-boxW/4, -boxH/4);
+ SetColor(COLOR_RED);
+ glVertex2i(-boxW/4, boxH/4);
+ SetColor(COLOR_BLUE);
+ glVertex2i(0, -boxH/4);
+ SetColor(COLOR_WHITE);
+ glVertex2i(0, boxH/4);
+ SetColor(COLOR_CYAN);
+ glVertex2i(boxW/4, -boxH/4);
+ SetColor(COLOR_YELLOW);
+ glVertex2i(boxW/4, boxH/4);
+ glEnd();
+
+ glBegin(GL_QUAD_STRIP);
+ glVertex2i(0, 0);
+ glVertex2i(100, 100);
+ glVertex2i(-100, 100);
+ glEnd();
+}
+
+static void Draw(void)
+{
+
+ glViewport(0, 0, windW, windH);
+ glDisable(GL_SCISSOR_TEST);
+
+ glPushAttrib(GL_COLOR_BUFFER_BIT);
+
+ glColorMask(1, 1, 1, 1);
+ glIndexMask(~0);
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glPopAttrib();
+
+ if (mode1) {
+ glShadeModel(GL_SMOOTH);
+ } else {
+ glShadeModel(GL_FLAT);
+ }
+
+ if (mode2) {
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ } else {
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ }
+
+ Viewport(0, 0); Point();
+ Viewport(0, 1); Lines();
+ Viewport(0, 2); LineStrip();
+ Viewport(0, 3); LineLoop();
+
+ Viewport(1, 0); Bitmap();
+
+ Viewport(1, 1); TriangleFan();
+ Viewport(1, 2); Triangles();
+ Viewport(1, 3); TriangleStrip();
+
+ Viewport(2, 0); Rect();
+ Viewport(2, 1); PolygonFunc();
+ Viewport(2, 2); Quads();
+ Viewport(2, 3); QuadStrip();
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ printf("%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ windW = 600;
+ windH = 300;
+ glutInitWindowPosition(0, 0); glutInitWindowSize( windW, windH);
+
+ windType = (rgb) ? GLUT_RGB : GLUT_INDEX;
+ windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(windType);
+
+ if (glutCreateWindow("Primitive Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/quad.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/quad.c
new file mode 100644
index 000000000..193850abc
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/quad.c
@@ -0,0 +1,457 @@
+/*
+ * 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>
+
+
+#ifndef CALLBACK
+#define CALLBACK
+#endif
+
+
+#define PI 3.141592654
+#define BLACK 0
+#define GRAY 128
+#define WHITE 255
+#define RD 0xA4,0x00,0x00,0xFF
+#define WT 0xFF,0xFF,0xFF,0xFF
+#define brickImageWidth 16
+#define brickImageHeight 16
+
+
+#include "loadppm.c"
+
+GLenum rgb, doubleBuffer;
+
+#include "tkmap.c"
+
+float black[3] = {
+ 0.0, 0.0, 0.0
+};
+float blue[3] = {
+ 0.0, 0.0, 1.0
+};
+float gray[3] = {
+ 0.5, 0.5, 0.5
+};
+float white[3] = {
+ 1.0, 1.0, 1.0
+};
+
+GLenum doDither = GL_TRUE;
+GLenum shade = GL_TRUE;
+GLenum texture = GL_TRUE;
+
+float xRotation = 30.0, yRotation = 30.0, zRotation = 0.0;
+GLint radius1, radius2;
+GLdouble angle1, angle2;
+GLint slices, stacks;
+GLint height;
+GLint orientation = GLU_OUTSIDE;
+GLint whichQuadric=0;
+GLUquadricObj *quadObj;
+
+GLubyte brickImage[4*brickImageWidth*brickImageHeight] = {
+ RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD,
+ RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD,
+ RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD,
+ RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD,
+ WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT,
+ RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD,
+ RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD,
+ RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD,
+ RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD, RD,
+ WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT,
+ RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD,
+ RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD,
+ RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD,
+ RD, RD, RD, RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD,
+ WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT, WT,
+ RD, RD, RD, RD, WT, RD, RD, RD, RD, RD, RD, RD, RD, RD, WT, RD
+};
+char *texFileName = 0;
+
+
+static void CALLBACK ErrorHandler(GLenum which)
+{
+
+ fprintf(stderr, "Quad Error: %s\n", (char *) gluErrorString(which));
+}
+
+typedef void (GLAPIENTRY *callback_t)();
+
+static void Init(void)
+{
+ static GLint colorIndexes[3] = {0, 200, 255};
+ static float ambient[] = {0.1, 0.1, 0.1, 1.0};
+ static float diffuse[] = {0.5, 1.0, 1.0, 1.0};
+ static float position[] = {90.0, 90.0, 150.0, 0.0};
+ static float front_mat_shininess[] = {30.0};
+ static float front_mat_specular[] = {0.2, 0.2, 0.2, 1.0};
+ static float front_mat_diffuse[] = {0.5, 0.28, 0.38, 1.0};
+ static float back_mat_shininess[] = {50.0};
+ static float back_mat_specular[] = {0.5, 0.5, 0.2, 1.0};
+ static float back_mat_diffuse[] = {1.0, 1.0, 0.2, 1.0};
+ static float lmodel_ambient[] = {1.0, 1.0, 1.0, 1.0};
+ static float lmodel_twoside[] = {GL_TRUE};
+ static float decal[] = {GL_DECAL};
+ static float repeat[] = {GL_REPEAT};
+ static float nearest[] = {GL_NEAREST};
+ static PPMImage *image;
+
+ if (!rgb) {
+ SetGreyRamp();
+ }
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+
+ glEnable(GL_DEPTH_TEST);
+
+ glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
+ glLightfv(GL_LIGHT0, GL_POSITION, position);
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+ glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+
+ glMaterialfv(GL_FRONT, GL_SHININESS, front_mat_shininess);
+ glMaterialfv(GL_FRONT, GL_SPECULAR, front_mat_specular);
+ glMaterialfv(GL_FRONT, GL_DIFFUSE, front_mat_diffuse);
+ glMaterialfv(GL_BACK, GL_SHININESS, back_mat_shininess);
+ glMaterialfv(GL_BACK, GL_SPECULAR, back_mat_specular);
+ glMaterialfv(GL_BACK, GL_DIFFUSE, back_mat_diffuse);
+ if (!rgb) {
+ glMaterialiv( GL_FRONT_AND_BACK, GL_COLOR_INDEXES, colorIndexes);
+ }
+
+ glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, decal);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, repeat);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, repeat);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, nearest);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, nearest);
+ if (texFileName) {
+ image = LoadPPM(texFileName);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image->sizeX, image->sizeY,
+ GL_RGB, GL_UNSIGNED_BYTE, image->data);
+ } else {
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glTexImage2D(GL_TEXTURE_2D, 0, 4, brickImageWidth, brickImageHeight,
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid *)brickImage);
+ }
+
+ quadObj = gluNewQuadric();
+ gluQuadricCallback(quadObj, GLU_ERROR, (callback_t) ErrorHandler);
+
+ radius1 = 10;
+ radius2 = 5;
+ angle1 = 90;
+ angle2 = 180;
+ slices = 16;
+ stacks = 10;
+ height = 20;
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glFrustum(-1, 1, -1, 1, 1, 10);
+ gluLookAt(2, 2, 2, 0, 0, 0, 0, 0, 1);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key2(int key, int x, int y)
+{
+
+ switch (key) {
+ case GLUT_KEY_LEFT:
+ yRotation += 5;
+ break;
+ case GLUT_KEY_RIGHT:
+ yRotation -= 5;
+ break;
+ case GLUT_KEY_UP:
+ xRotation += 5;
+ break;
+ case GLUT_KEY_DOWN:
+ xRotation -= 5;
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+
+ case 'X':
+ zRotation += 5;
+ break;
+ case 'x':
+ zRotation -= 5;
+ break;
+
+ case '1':
+ gluQuadricDrawStyle(quadObj, GLU_FILL);
+ break;
+ case '2':
+ gluQuadricDrawStyle(quadObj, GLU_POINT);
+ break;
+ case '3':
+ gluQuadricDrawStyle(quadObj, GLU_LINE);
+ break;
+ case '4':
+ gluQuadricDrawStyle(quadObj, GLU_SILHOUETTE);
+ break;
+
+ case '0':
+ shade = !shade;
+ if (shade) {
+ glShadeModel(GL_SMOOTH);
+ gluQuadricNormals(quadObj, GLU_SMOOTH);
+ } else {
+ glShadeModel(GL_FLAT);
+ gluQuadricNormals(quadObj, GLU_FLAT);
+ }
+ break;
+
+ case 'A':
+ stacks++;
+ break;
+ case 'a':
+ stacks--;
+ break;
+
+ case 'S':
+ slices++;
+ break;
+ case 's':
+ slices--;
+ break;
+
+ case 'd':
+ switch(orientation) {
+ case GLU_OUTSIDE:
+ orientation = GLU_INSIDE;
+ break;
+ case GLU_INSIDE:
+ default:
+ orientation = GLU_OUTSIDE;
+ break;
+ }
+ gluQuadricOrientation(quadObj, orientation);
+ break;
+
+ case 'f':
+ whichQuadric = (whichQuadric + 1) % 4;
+ break;
+
+ case 'G':
+ radius1 += 1;
+ break;
+ case 'g':
+ radius1 -= 1;
+ break;
+
+ case 'J':
+ radius2 += 1;
+ break;
+ case 'j':
+ radius2 -= 1;
+ break;
+
+ case 'H':
+ height += 2;
+ break;
+ case 'h':
+ height -= 2;
+ break;
+
+ case 'K':
+ angle1 += 5;
+ break;
+ case 'k':
+ angle1 -= 5;
+ break;
+
+ case 'L':
+ angle2 += 5;
+ break;
+ case 'l':
+ angle2 -= 5;
+ break;
+
+ case 'z':
+ texture = !texture;
+ if (texture) {
+ gluQuadricTexture(quadObj, GL_TRUE);
+ glEnable(GL_TEXTURE_2D);
+ } else {
+ gluQuadricTexture(quadObj, GL_FALSE);
+ glDisable(GL_TEXTURE_2D);
+ }
+ break;
+
+ case 'q':
+ glDisable(GL_CULL_FACE);
+ break;
+ case 'w':
+ glEnable(GL_CULL_FACE);
+ glCullFace(GL_FRONT);
+ break;
+ case 'e':
+ glEnable(GL_CULL_FACE);
+ glCullFace(GL_BACK);
+ break;
+
+ case 'r':
+ glFrontFace(GL_CW);
+ break;
+ case 't':
+ glFrontFace(GL_CCW);
+ break;
+
+ case 'y':
+ doDither = !doDither;
+ (doDither) ? glEnable(GL_DITHER) : glDisable(GL_DITHER);
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+
+ glLoadIdentity();
+ glRotatef(xRotation, 1, 0, 0);
+ glRotatef(yRotation, 0, 1, 0);
+ glRotatef(zRotation, 0, 0, 1);
+
+ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+
+ glColor3f(1.0, 1.0, 1.0);
+ switch (whichQuadric) {
+ case 0:
+ glTranslatef(0, 0, -height/20.0);
+ gluCylinder(quadObj, radius1/10.0, radius2/10.0, height/10.0,
+ slices, stacks);
+ break;
+ case 1:
+ gluSphere(quadObj, radius1/10.0, slices, stacks);
+ break;
+ case 2:
+ gluPartialDisk(quadObj, radius2/10.0, radius1/10.0, slices,
+ stacks, angle1, angle2);
+ break;
+ case 3:
+ gluDisk(quadObj, radius2/10.0, radius1/10.0, slices, stacks);
+ break;
+ }
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else if (strcmp(argv[i], "-f") == 0) {
+ if (i+1 >= argc || argv[i+1][0] == '-') {
+ printf("-f (No file name).\n");
+ return GL_FALSE;
+ } else {
+ texFileName = argv[++i];
+ }
+ } 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_DEPTH;
+ type |= (rgb) ? GLUT_RGB : GLUT_INDEX;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Quad Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutSpecialFunc(Key2);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/rgbtoppm.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/rgbtoppm.c
new file mode 100644
index 000000000..116d9a8cf
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/rgbtoppm.c
@@ -0,0 +1,285 @@
+
+/* texture.c - by David Blythe, SGI */
+
+/* texload is a simplistic routine for reading an SGI .rgb image file. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <GL/glut.h>
+
+typedef struct _ImageRec {
+ unsigned short imagic;
+ unsigned short type;
+ unsigned short dim;
+ unsigned short xsize, ysize, zsize;
+ unsigned int min, max;
+ unsigned int wasteBytes;
+ char name[80];
+ unsigned long colorMap;
+ FILE *file;
+ unsigned char *tmp;
+ unsigned long rleEnd;
+ unsigned int *rowStart;
+ int *rowSize;
+} ImageRec;
+
+void
+rgbtorgb(unsigned char *r,unsigned char *g,unsigned char *b,unsigned char *l,int n) {
+ while(n--) {
+ l[0] = r[0];
+ l[1] = g[0];
+ l[2] = b[0];
+ l += 3; r++; g++; b++;
+ }
+}
+
+static void
+ConvertShort(unsigned short *array, unsigned int length) {
+ unsigned short b1, b2;
+ unsigned char *ptr;
+
+ ptr = (unsigned char *)array;
+ while (length--) {
+ b1 = *ptr++;
+ b2 = *ptr++;
+ *array++ = (b1 << 8) | (b2);
+ }
+}
+
+static void
+ConvertUint(unsigned *array, unsigned int length) {
+ unsigned int b1, b2, b3, b4;
+ unsigned char *ptr;
+
+ ptr = (unsigned char *)array;
+ while (length--) {
+ b1 = *ptr++;
+ b2 = *ptr++;
+ b3 = *ptr++;
+ b4 = *ptr++;
+ *array++ = (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4);
+ }
+}
+
+static ImageRec *ImageOpen(char *fileName)
+{
+ union {
+ int testWord;
+ char testByte[4];
+ } endianTest;
+ ImageRec *image;
+ int swapFlag;
+ int x;
+
+ endianTest.testWord = 1;
+ if (endianTest.testByte[0] == 1) {
+ swapFlag = 1;
+ } else {
+ swapFlag = 0;
+ }
+
+ image = (ImageRec *)malloc(sizeof(ImageRec));
+ if (image == NULL) {
+ fprintf(stderr, "Out of memory!\n");
+ exit(1);
+ }
+ if ((image->file = fopen(fileName, "rb")) == NULL) {
+ return NULL;
+ }
+
+ fread(image, 1, 12, image->file);
+
+ if (swapFlag) {
+ ConvertShort(&image->imagic, 6);
+ }
+
+ image->tmp = (unsigned char *)malloc(image->xsize*256);
+ if (image->tmp == NULL) {
+ fprintf(stderr, "\nOut of memory!\n");
+ exit(1);
+ }
+
+ if ((image->type & 0xFF00) == 0x0100) {
+ x = image->ysize * image->zsize * (int) sizeof(unsigned);
+ image->rowStart = (unsigned *)malloc(x);
+ image->rowSize = (int *)malloc(x);
+ if (image->rowStart == NULL || image->rowSize == NULL) {
+ fprintf(stderr, "\nOut of memory!\n");
+ exit(1);
+ }
+ image->rleEnd = 512 + (2 * x);
+ fseek(image->file, 512, SEEK_SET);
+ fread(image->rowStart, 1, x, image->file);
+ fread(image->rowSize, 1, x, image->file);
+ if (swapFlag) {
+ ConvertUint(image->rowStart, x/(int) sizeof(unsigned));
+ ConvertUint((unsigned *)image->rowSize, x/(int) sizeof(int));
+ }
+ }
+ return image;
+}
+
+static void
+ImageClose(ImageRec *image) {
+ fclose(image->file);
+ free(image->tmp);
+ free(image);
+}
+
+static void
+ImageGetRow(ImageRec *image, unsigned char *buf, int y, int z) {
+ unsigned char *iPtr, *oPtr, pixel;
+ int count;
+
+ if ((image->type & 0xFF00) == 0x0100) {
+ fseek(image->file, (long) image->rowStart[y+z*image->ysize], SEEK_SET);
+ fread(image->tmp, 1, (unsigned int)image->rowSize[y+z*image->ysize],
+ image->file);
+
+ iPtr = image->tmp;
+ oPtr = buf;
+ for (;;) {
+ pixel = *iPtr++;
+ count = (int)(pixel & 0x7F);
+ if (!count) {
+ return;
+ }
+ if (pixel & 0x80) {
+ while (count--) {
+ *oPtr++ = *iPtr++;
+ }
+ } else {
+ pixel = *iPtr++;
+ while (count--) {
+ *oPtr++ = pixel;
+ }
+ }
+ }
+ } else {
+ fseek(image->file, 512+(y*image->xsize)+(z*image->xsize*image->ysize),
+ SEEK_SET);
+ fread(buf, 1, image->xsize, image->file);
+ }
+}
+
+GLubyte *
+read_alpha_texture(char *name, int *width, int *height)
+{
+ unsigned char *base, *lptr;
+ ImageRec *image;
+ int y;
+
+ image = ImageOpen(name);
+ if(!image) {
+ return NULL;
+ }
+
+ (*width)=image->xsize;
+ (*height)=image->ysize;
+ if (image->zsize != 1) {
+ ImageClose(image);
+ return NULL;
+ }
+
+ base = (unsigned char *)malloc(image->xsize*image->ysize*sizeof(unsigned char));
+ lptr = base;
+ for(y=0; y<image->ysize; y++) {
+ ImageGetRow(image,lptr,y,0);
+ lptr += image->xsize;
+ }
+ ImageClose(image);
+
+ return (unsigned char *) base;
+}
+
+GLubyte *
+read_rgb_texture(char *name, int *width, int *height)
+{
+ unsigned char *base, *ptr;
+ unsigned char *rbuf, *gbuf, *bbuf, *abuf;
+ ImageRec *image;
+ int y;
+
+ image = ImageOpen(name);
+
+ if(!image)
+ return NULL;
+ (*width)=image->xsize;
+ (*height)=image->ysize;
+ if (image->zsize != 3 && image->zsize != 4) {
+ ImageClose(image);
+ return NULL;
+ }
+
+ base = (unsigned char*)malloc(image->xsize*image->ysize*sizeof(unsigned int)*3);
+ rbuf = (unsigned char *)malloc(image->xsize*sizeof(unsigned char));
+ gbuf = (unsigned char *)malloc(image->xsize*sizeof(unsigned char));
+ bbuf = (unsigned char *)malloc(image->xsize*sizeof(unsigned char));
+ abuf = (unsigned char *)malloc(image->xsize*sizeof(unsigned char));
+ if(!base || !rbuf || !gbuf || !bbuf || !abuf) {
+ if (base) free(base);
+ if (rbuf) free(rbuf);
+ if (gbuf) free(gbuf);
+ if (bbuf) free(bbuf);
+ if (abuf) free(abuf);
+ return NULL;
+ }
+ ptr = base;
+ for(y=0; y<image->ysize; y++) {
+ if(image->zsize == 4) {
+ ImageGetRow(image,rbuf,y,0);
+ ImageGetRow(image,gbuf,y,1);
+ ImageGetRow(image,bbuf,y,2);
+ ImageGetRow(image,abuf,y,3); /* Discard. */
+ rgbtorgb(rbuf,gbuf,bbuf,ptr,image->xsize);
+ ptr += (image->xsize * 3);
+ } else {
+ ImageGetRow(image,rbuf,y,0);
+ ImageGetRow(image,gbuf,y,1);
+ ImageGetRow(image,bbuf,y,2);
+ rgbtorgb(rbuf,gbuf,bbuf,ptr,image->xsize);
+ ptr += (image->xsize * 3);
+ }
+ }
+ ImageClose(image);
+ free(rbuf);
+ free(gbuf);
+ free(bbuf);
+ free(abuf);
+
+ return (GLubyte *) base;
+}
+
+int main(int argc, char **argv)
+{
+ int width, height;
+ GLubyte *data;
+ char buff[32];
+ int n;
+ FILE *fo;
+
+ if (argc != 3)
+ {
+ fprintf(stderr, "usage: %s <infile.rgb> <outfile.p6>\n", argv[0]);
+ return 1;
+ }
+
+ data = read_rgb_texture(argv[1], &width, &height);
+
+ n = sprintf(buff, "P6\n%d %d\n255\n", width, height);
+
+ /* [dBorca] avoid LF to CRLF conversion */
+ if ((fo = fopen(argv[2], "wb")) == NULL) {
+ fprintf(stderr, "Cannot open output file!\n");
+ exit(1);
+ }
+
+ fwrite(buff, n, 1, fo);
+ fwrite(data, width * 3, height, fo);
+
+ fclose(fo);
+
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/select.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/select.c
new file mode 100644
index 000000000..2c8f333bf
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/select.c
@@ -0,0 +1,456 @@
+/*
+ * 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 <math.h>
+#include <string.h>
+#include <time.h>
+#include <GL/glut.h>
+
+
+#define MAXOBJS 10000
+#define MAXSELECT 100
+#define MAXFEED 300
+#define SOLID 1
+#define LINE 2
+#define POINT 3
+
+
+GLint windW, windH;
+
+GLuint selectBuf[MAXSELECT];
+GLfloat feedBuf[MAXFEED];
+GLint vp[4];
+float zRotation = 90.0;
+float zoom = 1.0;
+GLint objectCount;
+GLint numObjects;
+struct object {
+ float v1[2];
+ float v2[2];
+ float v3[2];
+ float color[3];
+} objects[MAXOBJS];
+GLenum linePoly = GL_FALSE;
+
+
+static void InitObjects(GLint num)
+{
+ GLint i;
+ float x, y;
+
+ if (num > MAXOBJS) {
+ num = MAXOBJS;
+ }
+ if (num < 1) {
+ num = 1;
+ }
+ objectCount = num;
+
+ srand((unsigned int)time(NULL));
+ for (i = 0; i < num; i++) {
+ x = (rand() % 300) - 150;
+ y = (rand() % 300) - 150;
+
+ objects[i].v1[0] = x + (rand() % 50) - 25;
+ objects[i].v2[0] = x + (rand() % 50) - 25;
+ objects[i].v3[0] = x + (rand() % 50) - 25;
+ objects[i].v1[1] = y + (rand() % 50) - 25;
+ objects[i].v2[1] = y + (rand() % 50) - 25;
+ objects[i].v3[1] = y + (rand() % 50) - 25;
+ objects[i].color[0] = ((rand() % 100) + 50) / 150.0;
+ objects[i].color[1] = ((rand() % 100) + 50) / 150.0;
+ objects[i].color[2] = ((rand() % 100) + 50) / 150.0;
+ }
+}
+
+static void Init(void)
+{
+
+ numObjects = 10;
+ InitObjects(numObjects);
+ glGetIntegerv(GL_VIEWPORT, vp);
+}
+
+static void Reshape(int width, int height)
+{
+
+ windW = (GLint)width;
+ windH = (GLint)height;
+}
+
+static void Render(GLenum mode)
+{
+ GLint i;
+
+ for (i = 0; i < objectCount; i++) {
+ if (mode == GL_SELECT) {
+ glLoadName(i);
+ }
+ glColor3fv(objects[i].color);
+ glBegin(GL_POLYGON);
+ glVertex2fv(objects[i].v1);
+ glVertex2fv(objects[i].v2);
+ glVertex2fv(objects[i].v3);
+ glEnd();
+ }
+}
+
+static GLint DoSelect(GLint x, GLint y)
+{
+ GLint hits;
+
+ glSelectBuffer(MAXSELECT, selectBuf);
+ (void)glRenderMode(GL_SELECT);
+ glInitNames();
+ glPushName(~0);
+
+ glPushMatrix();
+
+ glViewport(0, 0, windW, windH);
+ glGetIntegerv(GL_VIEWPORT, vp);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluPickMatrix(x, windH-y, 4, 4, vp);
+ gluOrtho2D(-175, 175, -175, 175);
+ glMatrixMode(GL_MODELVIEW);
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glScalef(zoom, zoom, zoom);
+ glRotatef(zRotation, 0, 0, 1);
+
+ Render(GL_SELECT);
+
+ glPopMatrix();
+
+ hits = glRenderMode(GL_RENDER);
+ if (hits <= 0) {
+ return -1;
+ }
+
+ return selectBuf[(hits-1)*4+3];
+}
+
+static void RecolorTri(GLint h)
+{
+
+ objects[h].color[0] = ((rand() % 100) + 50) / 150.0;
+ objects[h].color[1] = ((rand() % 100) + 50) / 150.0;
+ objects[h].color[2] = ((rand() % 100) + 50) / 150.0;
+}
+
+static void DeleteTri(GLint h)
+{
+
+ objects[h] = objects[objectCount-1];
+ objectCount--;
+}
+
+static void GrowTri(GLint h)
+{
+ float v[2];
+ float *oldV = NULL;
+ GLint i;
+
+ v[0] = objects[h].v1[0] + objects[h].v2[0] + objects[h].v3[0];
+ v[1] = objects[h].v1[1] + objects[h].v2[1] + objects[h].v3[1];
+ v[0] /= 3;
+ v[1] /= 3;
+
+ for (i = 0; i < 3; i++) {
+ switch (i) {
+ case 0:
+ oldV = objects[h].v1;
+ break;
+ case 1:
+ oldV = objects[h].v2;
+ break;
+ case 2:
+ oldV = objects[h].v3;
+ break;
+ }
+ oldV[0] = 1.5 * (oldV[0] - v[0]) + v[0];
+ oldV[1] = 1.5 * (oldV[1] - v[1]) + v[1];
+ }
+}
+
+static void Mouse(int button, int state, int mouseX, int mouseY)
+{
+ GLint hit;
+
+ if (state != GLUT_DOWN)
+ return;
+
+ hit = DoSelect((GLint)mouseX, (GLint)mouseY);
+ if (hit != -1) {
+ if (button == GLUT_LEFT_BUTTON) {
+ RecolorTri(hit);
+ }
+ if (button == GLUT_MIDDLE_BUTTON) {
+ GrowTri(hit);
+ }
+ if (button == GLUT_RIGHT_BUTTON) {
+ DeleteTri(hit);
+ }
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+
+ glPushMatrix();
+
+ glViewport(0, 0, windW, windH);
+ glGetIntegerv(GL_VIEWPORT, vp);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(-175, 175, -175, 175);
+ glMatrixMode(GL_MODELVIEW);
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glScalef(zoom, zoom, zoom);
+ glRotatef(zRotation, 0, 0, 1);
+
+ Render(GL_RENDER);
+
+ glPopMatrix();
+
+ glFlush();
+}
+
+static void DrawZoom(GLint x, GLint y)
+{
+
+ glPushMatrix();
+
+ glViewport(0, 0, windW, windH);
+ glGetIntegerv(GL_VIEWPORT, vp);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluPickMatrix(x, windH-y, 4, 4, vp);
+ gluOrtho2D(-175, 175, -175, 175);
+ glMatrixMode(GL_MODELVIEW);
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glScalef(zoom, zoom, zoom);
+ glRotatef(zRotation, 0, 0, 1);
+
+ Render(GL_RENDER);
+
+ glPopMatrix();
+}
+
+static void DumpFeedbackVert(GLint *i, GLint n)
+{
+ GLint index;
+
+ index = *i;
+ if (index+7 > n) {
+ *i = n;
+ printf(" ???\n");
+ return;
+ }
+ printf(" (%g %g %g), color = (%4.2f %4.2f %4.2f)\n",
+ feedBuf[index],
+ feedBuf[index+1],
+ feedBuf[index+2],
+ feedBuf[index+3],
+ feedBuf[index+4],
+ feedBuf[index+5]);
+ index += 7;
+ *i = index;
+}
+
+static void DrawFeedback(GLint n)
+{
+ GLint i;
+ GLint verts;
+
+ printf("Feedback results (%d floats):\n", n);
+ for (i = 0; i < n; i++) {
+ switch ((GLint)feedBuf[i]) {
+ case GL_POLYGON_TOKEN:
+ printf("Polygon");
+ i++;
+ if (i < n) {
+ verts = (GLint)feedBuf[i];
+ i++;
+ printf(": %d vertices", verts);
+ } else {
+ verts = 0;
+ }
+ printf("\n");
+ while (verts) {
+ DumpFeedbackVert(&i, n);
+ verts--;
+ }
+ i--;
+ break;
+ case GL_LINE_TOKEN:
+ printf("Line:\n");
+ i++;
+ DumpFeedbackVert(&i, n);
+ DumpFeedbackVert(&i, n);
+ i--;
+ break;
+ case GL_LINE_RESET_TOKEN:
+ printf("Line Reset:\n");
+ i++;
+ DumpFeedbackVert(&i, n);
+ DumpFeedbackVert(&i, n);
+ i--;
+ break;
+ default:
+ printf("%9.2f\n", feedBuf[i]);
+ break;
+ }
+ }
+ if (i == MAXFEED) {
+ printf("...\n");
+ }
+ printf("\n");
+}
+
+static void DoFeedback(void)
+{
+ GLint x;
+
+ glFeedbackBuffer(MAXFEED, GL_3D_COLOR, feedBuf);
+ (void)glRenderMode(GL_FEEDBACK);
+
+ glPushMatrix();
+
+ glViewport(0, 0, windW, windH);
+ glGetIntegerv(GL_VIEWPORT, vp);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(-175, 175, -175, 175);
+ glMatrixMode(GL_MODELVIEW);
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glScalef(zoom, zoom, zoom);
+ glRotatef(zRotation, 0, 0, 1);
+
+ Render(GL_FEEDBACK);
+
+ glPopMatrix();
+
+ x = glRenderMode(GL_RENDER);
+ if (x == -1) {
+ x = MAXFEED;
+ }
+
+ DrawFeedback((GLint)x);
+}
+
+static void Key2(int key, int x, int y)
+{
+ switch (key) {
+ case GLUT_KEY_LEFT:
+ zRotation += 0.5;
+ break;
+ case GLUT_KEY_RIGHT:
+ zRotation -= 0.5;
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+ switch (key) {
+ case 27:
+ exit(1);
+ case 'Z':
+ zoom /= 0.75;
+ break;
+ case 'z':
+ zoom *= 0.75;
+ break;
+ case 'f':
+ DoFeedback();
+ break;
+ case 'd':
+ DrawZoom(x, y);
+ break;
+ case 'l':
+ linePoly = !linePoly;
+ if (linePoly) {
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ } else {
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ }
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+int main(int argc, char **argv)
+{
+ GLenum type;
+
+ glutInit(&argc, argv);
+
+ windW = 300;
+ windH = 300;
+ glutInitWindowPosition(0, 0); glutInitWindowSize( windW, windH);
+
+ type = GLUT_RGB | GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Select Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutSpecialFunc(Key2);
+ glutMouseFunc(Mouse);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/shape.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/shape.c
new file mode 100644
index 000000000..d342ee5b0
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/shape.c
@@ -0,0 +1,345 @@
+/*
+ * 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 OPENGL_WIDTH 24
+#define OPENGL_HEIGHT 13
+
+
+GLenum rgb, doubleBuffer, windType;
+GLint objectIndex = 0;
+GLuint bases[20];
+float angleX = 0.0, angleY = 0.0, angleZ = 0.0;
+float scaleX = 1.0, scaleY = 1.0, scaleZ = 1.0;
+float shiftX = 0.0, shiftY = 0.0, shiftZ = 0.0;
+
+
+#include "tkmap.c"
+
+static void Init(void)
+{
+
+ bases[0] = glGenLists(1);
+ glNewList(bases[0], GL_COMPILE);
+ glutWireSphere(1.0, 20, 10);
+ glEndList();
+
+ bases[1] = glGenLists(1);
+ glNewList(bases[1], GL_COMPILE);
+ glutSolidSphere(1.0, 20, 10);
+ glEndList();
+
+ bases[2] = glGenLists(1);
+ glNewList(bases[2], GL_COMPILE);
+ glutWireCube(1.0);
+ glEndList();
+
+ bases[3] = glGenLists(1);
+ glNewList(bases[3], GL_COMPILE);
+ glutSolidCube(1.0);
+ glEndList();
+
+ bases[4] = glGenLists(1);
+ glNewList(bases[4], GL_COMPILE);
+ glutWireTorus(1.0, 1.0, 10, 20);
+ glEndList();
+
+ bases[5] = glGenLists(1);
+ glNewList(bases[5], GL_COMPILE);
+ glutSolidTorus(1.0, 1.0, 10, 20);
+ glEndList();
+
+ bases[6] = glGenLists(1);
+ glNewList(bases[6], GL_COMPILE);
+ glutWireIcosahedron();
+ glEndList();
+
+ bases[7] = glGenLists(1);
+ glNewList(bases[7], GL_COMPILE);
+ glutSolidIcosahedron();
+ glEndList();
+
+ bases[8] = glGenLists(1);
+ glNewList(bases[8], GL_COMPILE);
+ glutWireOctahedron();
+ glEndList();
+
+ bases[9] = glGenLists(1);
+ glNewList(bases[9], GL_COMPILE);
+ glutSolidOctahedron();
+ glEndList();
+
+ bases[10] = glGenLists(1);
+ glNewList(bases[10], GL_COMPILE);
+ glutWireTetrahedron();
+ glEndList();
+
+ bases[11] = glGenLists(1);
+ glNewList(bases[11], GL_COMPILE);
+ glutSolidTetrahedron();
+ glEndList();
+
+ bases[12] = glGenLists(1);
+ glNewList(bases[12], GL_COMPILE);
+ glutWireDodecahedron();
+ glEndList();
+
+ bases[13] = glGenLists(1);
+ glNewList(bases[13], GL_COMPILE);
+ glutSolidDodecahedron();
+ glEndList();
+
+ bases[14] = glGenLists(1);
+ glNewList(bases[14], GL_COMPILE);
+ glutWireCone(5.0, 5.0, 20, 10);
+ glEndList();
+
+ bases[15] = glGenLists(1);
+ glNewList(bases[15], GL_COMPILE);
+ glutSolidCone(5.0, 5.0, 20, 10);
+ glEndList();
+
+ bases[16] = glGenLists(1);
+ glNewList(bases[16], GL_COMPILE);
+ glutWireTeapot(1.0);
+ glEndList();
+
+ bases[17] = glGenLists(1);
+ glNewList(bases[17], GL_COMPILE);
+ glutSolidTeapot(1.0);
+ glEndList();
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glClearIndex(0.0);
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(-400.0, 400.0, -200.0, 200.0, -400.0, 400.0);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key2(int key, int x, int y)
+{
+
+ switch (key) {
+ case GLUT_KEY_LEFT:
+ shiftX -= 20.0;
+ break;
+ case GLUT_KEY_RIGHT:
+ shiftX += 20.0;
+ break;
+ case GLUT_KEY_UP:
+ shiftY += 20.0;
+ break;
+ case GLUT_KEY_DOWN:
+ shiftY -= 20.0;
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+
+ case 32:
+ objectIndex++;
+ if (objectIndex > 17) {
+ objectIndex = 0;
+ }
+ break;
+
+ case 'n':
+ shiftZ += 20.0;
+ break;
+ case 'm':
+ shiftZ -= 20.0;
+ break;
+
+ case 'q':
+ scaleX -= 0.1;
+ if (scaleX < 0.1) {
+ scaleX = 0.1;
+ }
+ break;
+ case 'w':
+ scaleX += 0.1;
+ break;
+ case 'a':
+ scaleY -= 0.1;
+ if (scaleY < 0.1) {
+ scaleY = 0.1;
+ }
+ break;
+ case 's':
+ scaleY += 0.1;
+ break;
+ case 'z':
+ scaleZ -= 0.1;
+ if (scaleZ < 0.1) {
+ scaleZ = 0.1;
+ }
+ break;
+ case 'x':
+ scaleZ += 0.1;
+ break;
+
+ case 'e':
+ angleX -= 5.0;
+ if (angleX < 0.0) {
+ angleX = 360.0 + angleX;
+ }
+ break;
+ case 'r':
+ angleX += 5.0;
+ if (angleX > 360.0) {
+ angleX = angleX - 360.0;
+ }
+ break;
+ case 'd':
+ angleY -= 5.0;
+ if (angleY < 0.0) {
+ angleY = 360.0 + angleY;
+ }
+ break;
+ case 'f':
+ angleY += 5.0;
+ if (angleY > 360.0) {
+ angleY = angleY - 360.0;
+ }
+ break;
+ case 'c':
+ angleZ -= 5.0;
+ if (angleZ < 0.0) {
+ angleZ = 360.0 + angleZ;
+ }
+ break;
+ case 'v':
+ angleZ += 5.0;
+ if (angleZ > 360.0) {
+ angleZ = angleZ - 360.0;
+ }
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ SetColor(COLOR_WHITE);
+
+ glPushMatrix();
+
+ glTranslatef(shiftX, shiftY, shiftZ);
+ glRotatef(angleX, 1.0, 0.0, 0.0);
+ glRotatef(angleY, 0.0, 1.0, 0.0);
+ glRotatef(angleZ, 0.0, 0.0, 1.0);
+ glScalef(scaleX, scaleY, scaleZ);
+
+ glCallList(bases[objectIndex]);
+ glPopMatrix();
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ printf("%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 400, 400);
+
+ windType = (rgb) ? GLUT_RGB : GLUT_INDEX;
+ windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(windType);
+
+ if (glutCreateWindow("Font Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutSpecialFunc(Key2);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/sphere.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/sphere.c
new file mode 100644
index 000000000..7d0508dee
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/sphere.c
@@ -0,0 +1,1014 @@
+/*
+ * 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.
+ */
+
+/* BEP: renamed "nearest" as "nnearest" to avoid math.h collision on AIX */
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <stdlib.h>
+#include <GL/glut.h>
+#include "readtex.h"
+
+
+#ifndef PI
+#define PI 3.14159265358979323846
+#endif
+
+
+GLenum doubleBuffer;
+int W = 400, H = 400;
+
+char *imageFileName = "../images/reflect.rgb";
+
+float *minFilter, *magFilter, *sWrapMode, *tWrapMode;
+float decal[] = {GL_DECAL};
+float modulate[] = {GL_MODULATE};
+float repeat[] = {GL_REPEAT};
+float clamp[] = {GL_CLAMP};
+float nnearest[] = {GL_NEAREST};
+float linear[] = {GL_LINEAR};
+float nearest_mipmap_nearest[] = {GL_NEAREST_MIPMAP_NEAREST};
+float nearest_mipmap_linear[] = {GL_NEAREST_MIPMAP_LINEAR};
+float linear_mipmap_nearest[] = {GL_LINEAR_MIPMAP_NEAREST};
+float linear_mipmap_linear[] = {GL_LINEAR_MIPMAP_LINEAR};
+GLint sphereMap[] = {GL_SPHERE_MAP};
+
+float xRotation = 0.0, yRotation = 0.0;
+float zTranslate = -3.0;
+GLenum autoRotate = GL_TRUE;
+GLboolean isLit = GL_TRUE;
+GLboolean isFogged = GL_FALSE;
+GLboolean doTexture = GL_TRUE;
+float *textureEnvironment = modulate;
+
+int cube, cage, cylinder, torus, genericObject;
+
+float c[6][4][4][3] = {
+ {
+ {
+ {
+ 1.0, 1.0, -1.0
+ },
+ {
+ 0.0, 1.0, -1.0
+ },
+ {
+ 0.0, 0.0, -1.0
+ },
+ {
+ 1.0, 0.0, -1.0
+ },
+ },
+ {
+ {
+ 0.0, 1.0, -1.0
+ },
+ {
+ -1.0, 1.0, -1.0
+ },
+ {
+ -1.0, 0.0, -1.0
+ },
+ {
+ 0.0, 0.0, -1.0
+ },
+ },
+ {
+ {
+ 0.0, 0.0, -1.0
+ },
+ {
+ -1.0, 0.0, -1.0
+ },
+ {
+ -1.0, -1.0, -1.0
+ },
+ {
+ 0.0, -1.0, -1.0
+ },
+ },
+ {
+ {
+ 1.0, 0.0, -1.0
+ },
+ {
+ 0.0, 0.0, -1.0
+ },
+ {
+ 0.0, -1.0, -1.0
+ },
+ {
+ 1.0, -1.0, -1.0
+ },
+ },
+ },
+ {
+ {
+ {
+ 1.0, 1.0, 1.0
+ },
+ {
+ 1.0, 1.0, 0.0
+ },
+ {
+ 1.0, 0.0, 0.0
+ },
+ {
+ 1.0, 0.0, 1.0
+ },
+ },
+ {
+ {
+ 1.0, 1.0, 0.0
+ },
+ {
+ 1.0, 1.0, -1.0
+ },
+ {
+ 1.0, 0.0, -1.0
+ },
+ {
+ 1.0, 0.0, 0.0
+ },
+ },
+ {
+ {
+ 1.0, 0.0, -1.0
+ },
+ {
+ 1.0, -1.0, -1.0
+ },
+ {
+ 1.0, -1.0, 0.0
+ },
+ {
+ 1.0, 0.0, 0.0
+ },
+ },
+ {
+ {
+ 1.0, 0.0, 0.0
+ },
+ {
+ 1.0, -1.0, 0.0
+ },
+ {
+ 1.0, -1.0, 1.0
+ },
+ {
+ 1.0, 0.0, 1.0
+ },
+ },
+ },
+ {
+ {
+ {
+ -1.0, 1.0, 1.0
+ },
+ {
+ 0.0, 1.0, 1.0
+ },
+ {
+ 0.0, 0.0, 1.0
+ },
+ {
+ -1.0, 0.0, 1.0
+ },
+ },
+ {
+ {
+ 0.0, 1.0, 1.0
+ },
+ {
+ 1.0, 1.0, 1.0
+ },
+ {
+ 1.0, 0.0, 1.0
+ },
+ {
+ 0.0, 0.0, 1.0
+ },
+ },
+ {
+ {
+ 1.0, 0.0, 1.0
+ },
+ {
+ 1.0, -1.0, 1.0
+ },
+ {
+ 0.0, -1.0, 1.0
+ },
+ {
+ 0.0, 0.0, 1.0
+ },
+ },
+ {
+ {
+ 0.0, -1.0, 1.0
+ },
+ {
+ -1.0, -1.0, 1.0
+ },
+ {
+ -1.0, 0.0, 1.0
+ },
+ {
+ 0.0, 0.0, 1.0
+ },
+ },
+ },
+ {
+ {
+ {
+ -1.0, 1.0, -1.0
+ },
+ {
+ -1.0, 1.0, 0.0
+ },
+ {
+ -1.0, 0.0, 0.0
+ },
+ {
+ -1.0, 0.0, -1.0
+ },
+ },
+ {
+ {
+ -1.0, 1.0, 0.0
+ },
+ {
+ -1.0, 1.0, 1.0
+ },
+ {
+ -1.0, 0.0, 1.0
+ },
+ {
+ -1.0, 0.0, 0.0
+ },
+ },
+ {
+ {
+ -1.0, 0.0, 1.0
+ },
+ {
+ -1.0, -1.0, 1.0
+ },
+ {
+ -1.0, -1.0, 0.0
+ },
+ {
+ -1.0, 0.0, 0.0
+ },
+ },
+ {
+ {
+ -1.0, -1.0, 0.0
+ },
+ {
+ -1.0, -1.0, -1.0
+ },
+ {
+ -1.0, 0.0, -1.0
+ },
+ {
+ -1.0, 0.0, 0.0
+ },
+ },
+ },
+ {
+ {
+ {
+ -1.0, 1.0, 1.0
+ },
+ {
+ -1.0, 1.0, 0.0
+ },
+ {
+ 0.0, 1.0, 0.0
+ },
+ {
+ 0.0, 1.0, 1.0
+ },
+ },
+ {
+ {
+ -1.0, 1.0, 0.0
+ },
+ {
+ -1.0, 1.0, -1.0
+ },
+ {
+ 0.0, 1.0, -1.0
+ },
+ {
+ 0.0, 1.0, 0.0
+ },
+ },
+ {
+ {
+ 0.0, 1.0, -1.0
+ },
+ {
+ 1.0, 1.0, -1.0
+ },
+ {
+ 1.0, 1.0, 0.0
+ },
+ {
+ 0.0, 1.0, 0.0
+ },
+ },
+ {
+ {
+ 1.0, 1.0, 0.0
+ },
+ {
+ 1.0, 1.0, 1.0
+ },
+ {
+ 0.0, 1.0, 1.0
+ },
+ {
+ 0.0, 1.0, 0.0
+ },
+ },
+ },
+ {
+ {
+ {
+ -1.0, -1.0, -1.0
+ },
+ {
+ -1.0, -1.0, 0.0
+ },
+ {
+ 0.0, -1.0, 0.0
+ },
+ {
+ 0.0, -1.0, -1.0
+ },
+ },
+ {
+ {
+ -1.0, -1.0, 0.0
+ },
+ {
+ -1.0, -1.0, 1.0
+ },
+ {
+ 0.0, -1.0, 1.0
+ },
+ {
+ 0.0, -1.0, 0.0
+ },
+ },
+ {
+ {
+ 0.0, -1.0, 1.0
+ },
+ {
+ 1.0, -1.0, 1.0
+ },
+ {
+ 1.0, -1.0, 0.0
+ },
+ {
+ 0.0, -1.0, 0.0
+ },
+ },
+ {
+ {
+ 1.0, -1.0, 0.0
+ },
+ {
+ 1.0, -1.0, -1.0
+ },
+ {
+ 0.0, -1.0, -1.0
+ },
+ {
+ 0.0, -1.0, 0.0
+ },
+ },
+ }
+};
+
+float n[6][3] = {
+ {
+ 0.0, 0.0, -1.0
+ },
+ {
+ 1.0, 0.0, 0.0
+ },
+ {
+ 0.0, 0.0, 1.0
+ },
+ {
+ -1.0, 0.0, 0.0
+ },
+ {
+ 0.0, 1.0, 0.0
+ },
+ {
+ 0.0, -1.0, 0.0
+ }
+};
+
+GLfloat identity[16] = {
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1,
+};
+
+
+void BuildCylinder(int numEdges)
+{
+ int i, top = 1.0, bottom = -1.0;
+ float x[100], y[100], angle;
+
+ for (i = 0; i <= numEdges; i++) {
+ angle = i * 2.0 * PI / numEdges;
+ x[i] = cos(angle); /* was cosf() */
+ y[i] = sin(angle); /* was sinf() */
+ }
+
+ glNewList(cylinder, GL_COMPILE);
+ glBegin(GL_TRIANGLE_STRIP);
+ for (i = 0; i <= numEdges; i++) {
+ glNormal3f(x[i], y[i], 0.0);
+ glVertex3f(x[i], y[i], bottom);
+ glVertex3f(x[i], y[i], top);
+ }
+ glEnd();
+ glBegin(GL_TRIANGLE_FAN);
+ glNormal3f(0.0, 0.0, 1.0);
+ glVertex3f(0.0, 0.0, top);
+ for (i = 0; i <= numEdges; i++) {
+ glVertex3f(x[i], -y[i], top);
+ }
+ glEnd();
+ glBegin(GL_TRIANGLE_FAN);
+ glNormal3f(0.0, 0.0, -1.0);
+ glVertex3f(0.0, 0.0, bottom);
+ for (i = 0; i <= numEdges; i++) {
+ glVertex3f(x[i], y[i], bottom);
+ }
+ glEnd();
+ glEndList();
+}
+
+void BuildTorus(float rc, int numc, float rt, int numt)
+{
+ int i, j, k;
+ double s, t;
+ double x, y, z;
+ double pi, twopi;
+
+ pi = 3.14159265358979323846;
+ twopi = 2.0 * pi;
+
+ glNewList(torus, GL_COMPILE);
+ for (i = 0; i < numc; i++) {
+ glBegin(GL_QUAD_STRIP);
+ for (j = 0; j <= numt; j++) {
+ for (k = 0; k <= 1; k++) {
+ s = (i + k) % numc + 0.5;
+ t = j % numt;
+
+ x = cos(t*twopi/numt) * cos(s*twopi/numc);
+ y = sin(t*twopi/numt) * cos(s*twopi/numc);
+ z = sin(s*twopi/numc);
+ glNormal3f(x, y, z);
+
+ x = (rt + rc * cos(s*twopi/numc)) * cos(t*twopi/numt);
+ y = (rt + rc * cos(s*twopi/numc)) * sin(t*twopi/numt);
+ z = rc * sin(s*twopi/numc);
+ glVertex3f(x, y, z);
+ }
+ }
+ glEnd();
+ }
+ glEndList();
+}
+
+void BuildCage(void)
+{
+ int i;
+ float inc;
+ float right, left, top, bottom, front, back;
+
+ front = 0.0;
+ back = -8.0;
+
+ left = -4.0;
+ bottom = -4.0;
+ right = 4.0;
+ top = 4.0;
+
+ inc = 2.0 * 4.0 * 0.1;
+
+ glNewList(cage, GL_COMPILE);
+ for (i = 0; i < 10; i++) {
+
+ /*
+ ** Back
+ */
+ glBegin(GL_LINES);
+ glVertex3f(left+i*inc, top, back);
+ glVertex3f(left+i*inc, bottom, back);
+ glEnd();
+ glBegin(GL_LINES);
+ glVertex3f(right, bottom+i*inc, back);
+ glVertex3f(left, bottom+i*inc, back);
+ glEnd();
+
+ /*
+ ** Front
+ */
+ glBegin(GL_LINES);
+ glVertex3f(left+i*inc, top, front);
+ glVertex3f(left+i*inc, bottom, front);
+ glEnd();
+ glBegin(GL_LINES);
+ glVertex3f(right, bottom+i*inc, front);
+ glVertex3f(left, bottom+i*inc, front);
+ glEnd();
+
+ /*
+ ** Left
+ */
+ glBegin(GL_LINES);
+ glVertex3f(left, bottom+i*inc, front);
+ glVertex3f(left, bottom+i*inc, back);
+ glEnd();
+ glBegin(GL_LINES);
+ glVertex3f(left, top, back+i*inc);
+ glVertex3f(left, bottom, back+i*inc);
+ glEnd();
+
+ /*
+ ** Right
+ */
+ glBegin(GL_LINES);
+ glVertex3f(right, top-i*inc, front);
+ glVertex3f(right, top-i*inc, back);
+ glEnd();
+ glBegin(GL_LINES);
+ glVertex3f(right, top, back+i*inc);
+ glVertex3f(right, bottom, back+i*inc);
+ glEnd();
+
+ /*
+ ** Top
+ */
+ glBegin(GL_LINES);
+ glVertex3f(left+i*inc, top, front);
+ glVertex3f(left+i*inc, top, back);
+ glEnd();
+ glBegin(GL_LINES);
+ glVertex3f(right, top, back+i*inc);
+ glVertex3f(left, top, back+i*inc);
+ glEnd();
+
+ /*
+ ** Bottom
+ */
+ glBegin(GL_LINES);
+ glVertex3f(right-i*inc, bottom, front);
+ glVertex3f(right-i*inc, bottom, back);
+ glEnd();
+ glBegin(GL_LINES);
+ glVertex3f(right, bottom, back+i*inc);
+ glVertex3f(left, bottom, back+i*inc);
+ glEnd();
+ }
+ glEndList();
+}
+
+void BuildCube(void)
+{
+ int i, j;
+
+ glNewList(cube, GL_COMPILE);
+ for (i = 0; i < 6; i++) {
+ for (j = 0; j < 4; j++) {
+ glNormal3fv(n[i]);
+ glBegin(GL_POLYGON);
+ glVertex3fv(c[i][j][0]);
+ glVertex3fv(c[i][j][1]);
+ glVertex3fv(c[i][j][2]);
+ glVertex3fv(c[i][j][3]);
+ glEnd();
+ }
+ }
+ glEndList();
+}
+
+void BuildLists(void)
+{
+
+ cube = glGenLists(1);
+ BuildCube();
+
+ cage = glGenLists(2);
+ BuildCage();
+
+ cylinder = glGenLists(3);
+ BuildCylinder(60);
+
+ torus = glGenLists(4);
+ BuildTorus(0.65, 20, .85, 65);
+
+ genericObject = torus;
+}
+
+void SetDefaultSettings(void)
+{
+
+ magFilter = nnearest;
+ minFilter = nnearest;
+ sWrapMode = repeat;
+ tWrapMode = repeat;
+ textureEnvironment = modulate;
+ autoRotate = GL_TRUE;
+}
+
+unsigned char *AlphaPadImage(int bufSize, unsigned char *inData, int alpha)
+{
+ unsigned char *outData, *out_ptr, *in_ptr;
+ int i;
+
+ outData = (unsigned char *) malloc(bufSize * 4);
+ out_ptr = outData;
+ in_ptr = inData;
+
+ for (i = 0; i < bufSize; i++) {
+ *out_ptr++ = *in_ptr++;
+ *out_ptr++ = *in_ptr++;
+ *out_ptr++ = *in_ptr++;
+ *out_ptr++ = alpha;
+ }
+
+ free (inData);
+ return outData;
+}
+
+void Init(void)
+{
+ float ambient[] = {0.0, 0.0, 0.0, 1.0};
+ float diffuse[] = {1.0, 1.0, 1.0, 1.0};
+ float specular[] = {1.0, 1.0, 1.0, 1.0};
+ float position[] = {0.0, 0.0, 4.0, 0.0};
+ float fog_color[] = {0.0, 0.0, 0.0, 1.0};
+ float mat_ambient[] = {0.0, 0.0, 0.0, 1.0};
+ float mat_shininess[] = {90.0};
+ float mat_specular[] = {1.0, 1.0, 1.0, 1.0};
+ float mat_diffuse[] = {0.8, 0.8, 0.8, 1.0};
+ float lmodel_ambient[] = {0.2, 0.2, 0.2, 1.0};
+ float lmodel_twoside[] = {GL_TRUE};
+ int w, h;
+ GLenum format;
+ GLubyte *image;
+
+ printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+
+ SetDefaultSettings();
+
+ image = LoadRGBImage(imageFileName, &w, &h, &format);
+ if (!image) {
+ printf("Error: couldn't load %s\n", imageFileName);
+ exit(1);
+ }
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ gluBuild2DMipmaps(GL_TEXTURE_2D, format, w, h,
+ GL_RGB, GL_UNSIGNED_BYTE, image);
+
+ free(image);
+
+ glFogf(GL_FOG_DENSITY, 0.125);
+ glFogi(GL_FOG_MODE, GL_LINEAR);
+ glFogf(GL_FOG_START, 4.0);
+ glFogf(GL_FOG_END, 8.5);
+ glFogfv(GL_FOG_COLOR, fog_color);
+
+ glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
+ glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
+ glLightfv(GL_LIGHT0, GL_POSITION, position);
+ glEnable(GL_LIGHT0);
+
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_diffuse);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_ambient);
+
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+ glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
+ glShadeModel(GL_SMOOTH);
+
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+ glEnable(GL_DEPTH_TEST);
+
+ glFrontFace(GL_CW);
+ glEnable(GL_CULL_FACE);
+ glCullFace(GL_BACK);
+
+ glTexGeniv(GL_S, GL_TEXTURE_GEN_MODE, sphereMap);
+ glTexGeniv(GL_T, GL_TEXTURE_GEN_MODE, sphereMap);
+ glEnable(GL_TEXTURE_GEN_S);
+ glEnable(GL_TEXTURE_GEN_T);
+
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, sWrapMode);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, tWrapMode);
+
+ glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, textureEnvironment);
+
+ BuildLists();
+}
+
+void ReInit(void)
+{
+ if (genericObject == torus) {
+ glEnable(GL_DEPTH_TEST);
+ } else {
+ glDisable(GL_DEPTH_TEST);
+ }
+ glEnable(GL_DEPTH_TEST);
+
+#if 0
+ if (isFogged) {
+ textureEnvironment = modulate;
+ }
+#endif
+
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter);
+ glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, textureEnvironment);
+}
+
+void Draw(void)
+{
+ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
+
+ /* draw cage */
+ if (isFogged)
+ glEnable(GL_FOG);
+ else
+ glDisable(GL_FOG);
+ glColor3f(1, 1, 1);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_TEXTURE_2D);
+ glCallList(cage);
+
+ /* draw object */
+ if (isLit)
+ glEnable(GL_LIGHTING);
+ else
+ glColor3f(1.0, 0.5, 0.2);
+ if (doTexture)
+ glEnable(GL_TEXTURE_2D);
+
+ glPushMatrix();
+ glTranslatef(0.0, 0.0, zTranslate);
+ glRotatef(xRotation, 1, 0, 0);
+ glRotatef(yRotation, 0, 1, 0);
+ glCallList(genericObject);
+ glPopMatrix();
+
+ glFlush();
+ glutSwapBuffers();
+}
+
+void Reshape(int width, int height)
+{
+ W = width;
+ H = height;
+ ReInit();
+ glViewport( 0, 0, width, height ); /*new*/
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glFrustum(-0.2, 0.2, -0.2, 0.2, 0.15, 9.0);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+void Idle(void)
+{
+ static double t0 = -1.;
+ double t, dt;
+ t = glutGet(GLUT_ELAPSED_TIME) / 1000.;
+ if (t0 < 0.)
+ t0 = t;
+ dt = t - t0;
+ t0 = t;
+
+ xRotation += .75*60.*dt;
+ yRotation += .375*60.*dt;
+ glutPostRedisplay();
+}
+
+void Key2(int key, int x, int y)
+{
+
+ switch (key) {
+ case GLUT_KEY_LEFT:
+ yRotation -= 0.5;
+ autoRotate = GL_FALSE;
+ ReInit();
+ break;
+ case GLUT_KEY_RIGHT:
+ yRotation += 0.5;
+ autoRotate = GL_FALSE;
+ ReInit();
+ break;
+ case GLUT_KEY_UP:
+ xRotation -= 0.5;
+ autoRotate = GL_FALSE;
+ ReInit();
+ break;
+ case GLUT_KEY_DOWN:
+ xRotation += 0.5;
+ autoRotate = GL_FALSE;
+ ReInit();
+ break;
+ default:
+ return;
+ }
+ glutPostRedisplay();
+}
+
+void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ /* free(image->data);*/
+ exit(1);
+
+ case 'a':
+ autoRotate = !autoRotate;
+ if (autoRotate)
+ glutIdleFunc(Idle);
+ else
+ glutIdleFunc(NULL);
+
+ ReInit();
+ break;
+ case 'o':
+ if (genericObject == cube) {
+ genericObject = cylinder;
+ }
+ else if (genericObject == cylinder) {
+ genericObject = torus;
+ }
+ else {
+ genericObject = cube;
+ }
+ ReInit();
+ break;
+ case 'd':
+ textureEnvironment = decal;
+ ReInit();
+ break;
+ case 'm':
+ textureEnvironment = modulate;
+ ReInit();
+ break;
+ case 'l':
+ isLit = !isLit;
+ ReInit();
+ break;
+ case 'f':
+ isFogged = !isFogged;
+ ReInit();
+ break;
+ case 't':
+ doTexture = !doTexture;
+ ReInit();
+ break;
+ case '0':
+ magFilter = nnearest;
+ ReInit();
+ break;
+ case '1':
+ magFilter = linear;
+ ReInit();
+ break;
+ case '2':
+ minFilter = nnearest;
+ ReInit();
+ break;
+ case '3':
+ minFilter = linear;
+ ReInit();
+ break;
+ case '4':
+ minFilter = nearest_mipmap_nearest;
+ ReInit();
+ break;
+ case '5':
+ minFilter = nearest_mipmap_linear;
+ ReInit();
+ break;
+ case '6':
+ minFilter = linear_mipmap_nearest;
+ ReInit();
+ break;
+ case '7':
+ minFilter = linear_mipmap_linear;
+ ReInit();
+ break;
+ default:
+ return;
+ }
+ glutPostRedisplay();
+}
+
+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 if (strcmp(argv[i], "-f") == 0) {
+ if (i+1 >= argc || argv[i+1][0] == '-') {
+ printf("-f (No file name).\n");
+ return GL_FALSE;
+ } else {
+ imageFileName = argv[++i];
+ }
+ } 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);
+ }
+
+ if (imageFileName == 0) {
+ printf("No image file.\n");
+ exit(1);
+ }
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( W, H);
+
+ type = GLUT_RGB | GLUT_DEPTH;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Texture Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutSpecialFunc(Key2);
+ glutDisplayFunc(Draw);
+ glutIdleFunc(Idle);
+
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/star.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/star.c
new file mode 100644
index 000000000..2cf470e2a
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/star.c
@@ -0,0 +1,345 @@
+/*
+ * 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>
+
+
+#ifndef PI
+#define PI 3.141592657
+#endif
+
+enum {
+ NORMAL = 0,
+ WEIRD = 1
+};
+
+enum {
+ STREAK = 0,
+ CIRCLE = 1
+};
+
+#define MAXSTARS 400
+#define MAXPOS 10000
+#define MAXWARP 500
+#define MAXANGLES 6000
+
+
+typedef struct _starRec {
+ GLint type;
+ float x[2], y[2], z[2];
+ float offsetX, offsetY, offsetR, rotation;
+} starRec;
+
+
+GLenum doubleBuffer;
+GLint windW, windH;
+
+GLenum flag = NORMAL;
+GLint starCount = MAXSTARS / 2;
+float speed = 1.0;
+GLint nitro = 0;
+starRec stars[MAXSTARS];
+float sinTable[MAXANGLES];
+
+
+float Sin(float angle)
+{
+
+ return (sinTable[(GLint)angle]);
+}
+
+float Cos(float angle)
+{
+
+ return (sinTable[((GLint)angle+(MAXANGLES/4))%MAXANGLES]);
+}
+
+void NewStar(GLint n, GLint d)
+{
+
+ if (rand()%4 == 0) {
+ stars[n].type = CIRCLE;
+ } else {
+ stars[n].type = STREAK;
+ }
+ stars[n].x[0] = (float)(rand() % MAXPOS - MAXPOS / 2);
+ stars[n].y[0] = (float)(rand() % MAXPOS - MAXPOS / 2);
+ stars[n].z[0] = (float)(rand() % MAXPOS + d);
+ if (rand()%4 == 0 && flag == WEIRD) {
+ stars[n].offsetX = (float)(rand() % 100 - 100 / 2);
+ stars[n].offsetY = (float)(rand() % 100 - 100 / 2);
+ stars[n].offsetR = (float)(rand() % 25 - 25 / 2);
+ } else {
+ stars[n].offsetX = 0.0;
+ stars[n].offsetY = 0.0;
+ stars[n].offsetR = 0.0;
+ }
+}
+
+void RotatePoint(float *x, float *y, float rotation)
+{
+ float tmpX, tmpY;
+
+ tmpX = *x * Cos(rotation) - *y * Sin(rotation);
+ tmpY = *y * Cos(rotation) + *x * Sin(rotation);
+ *x = tmpX;
+ *y = tmpY;
+}
+
+void MoveStars(void)
+{
+ float offset;
+ GLint n;
+ static double t0 = -1.;
+ double t, dt;
+ t = glutGet(GLUT_ELAPSED_TIME) / 1000.;
+ if (t0 < 0.)
+ t0 = t;
+ dt = 85.*(t - t0);
+ t0 = t;
+
+ offset = speed * 60.0;
+
+ for (n = 0; n < starCount; n++) {
+ stars[n].x[1] = stars[n].x[0];
+ stars[n].y[1] = stars[n].y[0];
+ stars[n].z[1] = stars[n].z[0];
+ stars[n].x[0] += stars[n].offsetX*dt;
+ stars[n].y[0] += stars[n].offsetY*dt;
+ stars[n].z[0] -= offset*dt;
+ stars[n].rotation += stars[n].offsetR*dt;
+ if (stars[n].rotation > MAXANGLES) {
+ stars[n].rotation = 0.0;
+ }
+ else if (stars[n].rotation < 0.0) {
+ stars[n].rotation += 360.0;
+ }
+ }
+}
+
+GLenum StarPoint(GLint n)
+{
+ float x0, y0, x1, y1, width;
+ GLint i;
+
+ x0 = stars[n].x[0] * windW / stars[n].z[0];
+ y0 = stars[n].y[0] * windH / stars[n].z[0];
+ RotatePoint(&x0, &y0, stars[n].rotation);
+ x0 += windW / 2.0;
+ y0 += windH / 2.0;
+
+ if (x0 >= 0.0 && x0 < windW && y0 >= 0.0 && y0 < windH) {
+ if (stars[n].type == STREAK) {
+ x1 = stars[n].x[1] * windW / stars[n].z[1];
+ y1 = stars[n].y[1] * windH / stars[n].z[1];
+ RotatePoint(&x1, &y1, stars[n].rotation);
+ x1 += windW / 2.0;
+ y1 += windH / 2.0;
+
+ glLineWidth(MAXPOS/100.0/stars[n].z[0]+1.0);
+ glColor3f(1.0, (MAXWARP-speed)/MAXWARP, (MAXWARP-speed)/MAXWARP);
+ if (fabs(x0-x1) < 1.0 && fabs(y0-y1) < 1.0) {
+ glBegin(GL_POINTS);
+ glVertex2f(x0, y0);
+ glEnd();
+ } else {
+ glBegin(GL_LINES);
+ glVertex2f(x0, y0);
+ glVertex2f(x1, y1);
+ glEnd();
+ }
+ } else {
+ width = MAXPOS / 10.0 / stars[n].z[0] + 1.0;
+ glColor3f(1.0, 0.0, 0.0);
+ glBegin(GL_POLYGON);
+ for (i = 0; i < 8; i++) {
+ float x = x0 + width * Cos((float)i*MAXANGLES/8.0);
+ float y = y0 + width * Sin((float)i*MAXANGLES/8.0);
+ glVertex2f(x, y);
+ };
+ glEnd();
+ }
+ return GL_TRUE;
+ } else {
+ return GL_FALSE;
+ }
+}
+
+void ShowStars(void)
+{
+ GLint n;
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ for (n = 0; n < starCount; n++) {
+ if (stars[n].z[0] > speed || (stars[n].z[0] > 0.0 && speed < MAXWARP)) {
+ if (StarPoint(n) == GL_FALSE) {
+ NewStar(n, MAXPOS);
+ }
+ } else {
+ NewStar(n, MAXPOS);
+ }
+ }
+}
+
+static void Init(void)
+{
+ float angle;
+ GLint n;
+
+ srand((unsigned int) glutGet(GLUT_ELAPSED_TIME) );
+
+ for (n = 0; n < MAXSTARS; n++) {
+ NewStar(n, 100);
+ }
+
+ angle = 0.0;
+ for (n = 0; n < MAXANGLES ; n++) {
+ sinTable[n] = sin(angle);
+ angle += PI / (MAXANGLES / 2.0);
+ }
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+
+ glDisable(GL_DITHER);
+}
+
+void Reshape(int width, int height)
+{
+
+ windW = (GLint)width;
+ windH = (GLint)height;
+
+ glViewport(0, 0, windW, windH);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(-0.5, windW+0.5, -0.5, windH+0.5);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ case 32:
+ flag = (flag == NORMAL) ? WEIRD : NORMAL;
+ break;
+ case 't':
+ nitro = 1;
+ break;
+ default:
+ return;
+ }
+}
+
+void Draw(void)
+{
+
+ MoveStars();
+ ShowStars();
+ if (nitro > 0) {
+ speed = (float)(nitro / 10) + 1.0;
+ if (speed > MAXWARP) {
+ speed = MAXWARP;
+ }
+ if (++nitro > MAXWARP*10) {
+ nitro = -nitro;
+ }
+ } else if (nitro < 0) {
+ nitro++;
+ speed = (float)(-nitro / 10) + 1.0;
+ if (speed > MAXWARP) {
+ speed = MAXWARP;
+ }
+ }
+
+ 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;
+ }
+ }
+ return GL_TRUE;
+}
+
+#if !defined(GLUTCALLBACK)
+#define GLUTCALLBACK
+#endif
+
+void GLUTCALLBACK glut_post_redisplay_p(void)
+{
+ glutPostRedisplay();
+}
+
+int main(int argc, char **argv)
+{
+ GLenum type;
+
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ windW = 300;
+ windH = 300;
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
+
+ type = GLUT_RGB;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Stars") == GL_FALSE) {
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutIdleFunc(glut_post_redisplay_p);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/stencil.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/stencil.c
new file mode 100644
index 000000000..e00bbb61b
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/stencil.c
@@ -0,0 +1,143 @@
+/*
+ * 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)
+{
+ glShadeModel(GL_FLAT);
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+
+ glClearStencil(0);
+ glStencilMask(1);
+ glEnable(GL_STENCIL_TEST);
+}
+
+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:
+ exit(1);
+ }
+}
+
+static void Draw(void)
+{
+
+ glClear(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
+
+ glStencilFunc(GL_ALWAYS, 1, 1);
+ glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
+
+ glColor3ub(200, 0, 0);
+ glBegin(GL_POLYGON);
+ glVertex3i(-4, -4, 0);
+ glVertex3i( 4, -4, 0);
+ glVertex3i( 0, 4, 0);
+ glEnd();
+
+ glStencilFunc(GL_EQUAL, 1, 1);
+ glStencilOp(GL_INCR, GL_KEEP, GL_DECR);
+
+ glColor3ub(0, 200, 0);
+ glBegin(GL_POLYGON);
+ glVertex3i(3, 3, 0);
+ glVertex3i(-3, 3, 0);
+ glVertex3i(-3, -3, 0);
+ glVertex3i(3, -3, 0);
+ glEnd();
+
+ glStencilFunc(GL_EQUAL, 1, 1);
+ glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
+
+ glColor3ub(0, 0, 200);
+ glBegin(GL_POLYGON);
+ glVertex3i(3, 3, 0);
+ glVertex3i(-3, 3, 0);
+ glVertex3i(-3, -3, 0);
+ glVertex3i(3, -3, 0);
+ glEnd();
+
+ 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_STENCIL;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Stencil Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/stretch.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/stretch.c
new file mode 100644
index 000000000..1fd015d79
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/stretch.c
@@ -0,0 +1,390 @@
+/*
+ * 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>
+
+
+#define STEPCOUNT 40
+#define FALSE 0
+#define TRUE 1
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+
+
+enum {
+ OP_NOOP = 0,
+ OP_STRETCH,
+ OP_DRAWPOINT,
+ OP_DRAWIMAGE
+};
+
+
+typedef struct _cRec {
+ float x, y;
+} cRec;
+
+typedef struct _vertexRec {
+ float x, y;
+ float dX, dY;
+ float tX, tY;
+} vertexRec;
+
+
+#include "loadppm.c"
+
+GLenum doubleBuffer;
+int imageSizeX, imageSizeY;
+char *fileName = 0;
+PPMImage *image;
+cRec cList[50];
+vertexRec vList[5];
+int cCount, cIndex[2], cStep;
+GLenum op = OP_NOOP;
+
+
+void DrawImage(void)
+{
+
+ glRasterPos2i(0, 0);
+ glDrawPixels(image->sizeX, image->sizeY, GL_RGB, GL_UNSIGNED_BYTE,
+ image->data);
+
+ glFlush();
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+
+ glRasterPos2i(0, 0);
+ glDrawPixels(image->sizeX, image->sizeY, GL_RGB, GL_UNSIGNED_BYTE,
+ image->data);
+}
+
+void DrawPoint(void)
+{
+ int i;
+
+ glColor3f(1.0, 0.0, 1.0);
+ glPointSize(3.0);
+ glBegin(GL_POINTS);
+ for (i = 0; i < cCount; i++) {
+ glVertex2f(cList[i].x, cList[i].y);
+ }
+ glEnd();
+
+ glFlush();
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+void InitVList(void)
+{
+
+ vList[0].x = 0.0;
+ vList[0].y = 0.0;
+ vList[0].dX = 0.0;
+ vList[0].dY = 0.0;
+ vList[0].tX = 0.0;
+ vList[0].tY = 0.0;
+
+ vList[1].x = (float)imageSizeX;
+ vList[1].y = 0.0;
+ vList[1].dX = 0.0;
+ vList[1].dY = 0.0;
+ vList[1].tX = 1.0;
+ vList[1].tY = 0.0;
+
+ vList[2].x = (float)imageSizeX;
+ vList[2].y = (float)imageSizeY;
+ vList[2].dX = 0.0;
+ vList[2].dY = 0.0;
+ vList[2].tX = 1.0;
+ vList[2].tY = 1.0;
+
+ vList[3].x = 0.0;
+ vList[3].y = (float)imageSizeY;
+ vList[3].dX = 0.0;
+ vList[3].dY = 0.0;
+ vList[3].tX = 0.0;
+ vList[3].tY = 1.0;
+
+ vList[4].x = cList[0].x;
+ vList[4].y = cList[0].y;
+ vList[4].dX = (cList[1].x - cList[0].x) / STEPCOUNT;
+ vList[4].dY = (cList[1].y - cList[0].y) / STEPCOUNT;
+ vList[4].tX = cList[0].x / (float)imageSizeX;
+ vList[4].tY = cList[0].y / (float)imageSizeY;
+}
+
+void ScaleImage(int sizeX, int sizeY)
+{
+ GLubyte *buf;
+
+ buf = (GLubyte *)malloc(3*sizeX*sizeY);
+ gluScaleImage(GL_RGB, image->sizeX, image->sizeY, GL_UNSIGNED_BYTE,
+ image->data, sizeX, sizeY, GL_UNSIGNED_BYTE, buf);
+ free(image->data);
+ image->data = buf;
+ image->sizeX = sizeX;
+ image->sizeY = sizeY;
+}
+
+void SetPoint(int x, int y)
+{
+
+ cList[cCount].x = (float)x;
+ cList[cCount].y = (float)y;
+ cCount++;
+}
+
+void Stretch(void)
+{
+
+ glBegin(GL_TRIANGLES);
+ glTexCoord2f(vList[0].tX, vList[0].tY);
+ glVertex2f(vList[0].x, vList[0].y);
+ glTexCoord2f(vList[1].tX, vList[1].tY);
+ glVertex2f(vList[1].x, vList[1].y);
+ glTexCoord2f(vList[4].tX, vList[4].tY);
+ glVertex2f(vList[4].x, vList[4].y);
+ glEnd();
+
+ glBegin(GL_TRIANGLES);
+ glTexCoord2f(vList[1].tX, vList[1].tY);
+ glVertex2f(vList[1].x, vList[1].y);
+ glTexCoord2f(vList[2].tX, vList[2].tY);
+ glVertex2f(vList[2].x, vList[2].y);
+ glTexCoord2f(vList[4].tX, vList[4].tY);
+ glVertex2f(vList[4].x, vList[4].y);
+ glEnd();
+
+ glBegin(GL_TRIANGLES);
+ glTexCoord2f(vList[2].tX, vList[2].tY);
+ glVertex2f(vList[2].x, vList[2].y);
+ glTexCoord2f(vList[3].tX, vList[3].tY);
+ glVertex2f(vList[3].x, vList[3].y);
+ glTexCoord2f(vList[4].tX, vList[4].tY);
+ glVertex2f(vList[4].x, vList[4].y);
+ glEnd();
+
+ glBegin(GL_TRIANGLES);
+ glTexCoord2f(vList[3].tX, vList[3].tY);
+ glVertex2f(vList[3].x, vList[3].y);
+ glTexCoord2f(vList[0].tX, vList[0].tY);
+ glVertex2f(vList[0].x, vList[0].y);
+ glTexCoord2f(vList[4].tX, vList[4].tY);
+ glVertex2f(vList[4].x, vList[4].y);
+ glEnd();
+
+ glFlush();
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+
+ if (++cStep < STEPCOUNT) {
+ vList[4].x += vList[4].dX;
+ vList[4].y += vList[4].dY;
+ } else {
+ cIndex[0] = cIndex[1];
+ cIndex[1] = cIndex[1] + 1;
+ if (cIndex[1] == cCount) {
+ cIndex[1] = 0;
+ }
+ vList[4].dX = (cList[cIndex[1]].x - cList[cIndex[0]].x) / STEPCOUNT;
+ vList[4].dY = (cList[cIndex[1]].y - cList[cIndex[0]].y) / STEPCOUNT;
+ cStep = 0;
+ }
+}
+
+void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ free(image->data);
+ exit(1);
+ case 32:
+ if (cCount > 1) {
+ InitVList();
+ cIndex[0] = 0;
+ cIndex[1] = 1;
+ cStep = 0;
+ glEnable(GL_TEXTURE_2D);
+ op = OP_STRETCH;
+ }
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+void Mouse(int button, int state, int mouseX, int mouseY)
+{
+
+ if (state != GLUT_DOWN)
+ return;
+
+ if (op == OP_STRETCH) {
+ glDisable(GL_TEXTURE_2D);
+ cCount = 0;
+ op = OP_DRAWIMAGE;
+ } else {
+ SetPoint(mouseX, imageSizeY-mouseY);
+ op = OP_DRAWPOINT;
+ }
+
+ glutPostRedisplay();
+}
+
+void Animate(void)
+{
+ static double t0 = -1.;
+ double t, dt;
+ t = glutGet(GLUT_ELAPSED_TIME) / 1000.;
+ if (t0 < 0.)
+ t0 = t;
+ dt = t - t0;
+
+ if (dt < 1./60.)
+ return;
+
+ t0 = t;
+
+ switch (op) {
+ case OP_STRETCH:
+ Stretch();
+ break;
+ case OP_DRAWPOINT:
+ DrawPoint();
+ break;
+ case OP_DRAWIMAGE:
+ DrawImage();
+ break;
+ default:
+ break;
+ }
+}
+
+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 if (strcmp(argv[i], "-f") == 0) {
+ if (i+1 >= argc || argv[i+1][0] == '-') {
+ printf("-f (No file name).\n");
+ return GL_FALSE;
+ } else {
+ fileName = argv[++i];
+ }
+ } else {
+ printf("%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+#if !defined(GLUTCALLBACK)
+#define GLUTCALLBACK
+#endif
+
+void GLUTCALLBACK glut_post_redisplay_p(void)
+{
+ glutPostRedisplay();
+}
+
+int main(int argc, char **argv)
+{
+ GLenum type;
+
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ if (fileName == 0) {
+ printf("No image file.\n");
+ exit(1);
+ }
+
+ image = LoadPPM(fileName);
+
+ /* changed powf and logf to pow and log -Brian */
+ imageSizeX = (int)pow(2.0, (float)((int)(log(image->sizeX)/log(2.0))));
+ imageSizeY = (int)pow(2.0, (float)((int)(log(image->sizeY)/log(2.0))));
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( imageSizeX, imageSizeY);
+
+ type = GLUT_RGB;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Stretch") == GL_FALSE) {
+ exit(1);
+ }
+
+ glViewport(0, 0, imageSizeX, imageSizeY);
+ gluOrtho2D(0, imageSizeX, 0, imageSizeY);
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glPixelStorei(GL_PACK_ALIGNMENT, 1);
+
+ ScaleImage(imageSizeX, imageSizeY);
+
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexImage2D(GL_TEXTURE_2D, 0, 3, image->sizeX, image->sizeY, 0,
+ GL_RGB, GL_UNSIGNED_BYTE, (unsigned char *)image->data);
+
+ cCount = 0;
+ cIndex[0] = 0;
+ cIndex[1] = 0;
+ cStep = 0;
+ op = OP_DRAWIMAGE;
+
+ glutKeyboardFunc(Key);
+ glutMouseFunc(Mouse);
+ glutDisplayFunc(Animate);
+ glutIdleFunc(glut_post_redisplay_p);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/texture.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/texture.c
new file mode 100644
index 000000000..7ee41eef2
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/texture.c
@@ -0,0 +1,474 @@
+/*
+ * 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 <math.h>
+#include <stdlib.h>
+#include <GL/glut.h>
+
+
+#include "loadppm.c"
+
+GLenum doubleBuffer;
+
+char *texFileName = 0;
+PPMImage *image;
+
+float *minFilter, *magFilter, *sWrapMode, *tWrapMode;
+float decal[] = {GL_DECAL};
+float modulate[] = {GL_MODULATE};
+float repeat[] = {GL_REPEAT};
+float clamp[] = {GL_CLAMP};
+float nr[] = {GL_NEAREST};
+float ln[] = {GL_LINEAR};
+float nr_mipmap_nr[] = {GL_NEAREST_MIPMAP_NEAREST};
+float nr_mipmap_ln[] = {GL_NEAREST_MIPMAP_LINEAR};
+float ln_mipmap_nr[] = {GL_LINEAR_MIPMAP_NEAREST};
+float ln_mipmap_ln[] = {GL_LINEAR_MIPMAP_LINEAR};
+GLint sphereMap[] = {GL_SPHERE_MAP};
+
+GLenum doSphere = GL_FALSE;
+float xRotation = 0.0, yRotation = 0.0, zTranslate = -3.125;
+
+GLint cube;
+float c[6][4][3] = {
+ {
+ {
+ 1.0, 1.0, -1.0
+ },
+ {
+ -1.0, 1.0, -1.0
+ },
+ {
+ -1.0, -1.0, -1.0
+ },
+ {
+ 1.0, -1.0, -1.0
+ }
+ },
+ {
+ {
+ 1.0, 1.0, 1.0
+ },
+ {
+ 1.0, 1.0, -1.0
+ },
+ {
+ 1.0, -1.0, -1.0
+ },
+ {
+ 1.0, -1.0, 1.0
+ }
+ },
+ {
+ {
+ -1.0, 1.0, 1.0
+ },
+ {
+ 1.0, 1.0, 1.0
+ },
+ {
+ 1.0, -1.0, 1.0
+ },
+ {
+ -1.0, -1.0, 1.0
+ }
+ },
+ {
+ {
+ -1.0, 1.0, -1.0
+ },
+ {
+ -1.0, 1.0, 1.0
+ },
+ {
+ -1.0, -1.0, 1.0
+ },
+ {
+ -1.0, -1.0, -1.0
+ }
+ },
+ {
+ {
+ -1.0, 1.0, 1.0
+ },
+ {
+ -1.0, 1.0, -1.0
+ },
+ {
+ 1.0, 1.0, -1.0
+ },
+ {
+ 1.0, 1.0, 1.0
+ }
+ },
+ {
+ {
+ -1.0, -1.0, -1.0
+ },
+ {
+ -1.0, -1.0, 1.0
+ },
+ {
+ 1.0, -1.0, 1.0
+ },
+ {
+ 1.0, -1.0, -1.0
+ }
+ }
+};
+static float n[6][3] = {
+ {
+ 0.0, 0.0, -1.0
+ },
+ {
+ 1.0, 0.0, 0.0
+ },
+ {
+ 0.0, 0.0, 1.0
+ },
+ {
+ -1.0, 0.0, 0.0
+ },
+ {
+ 0.0, 1.0, 0.0
+ },
+ {
+ 0.0, -1.0, 0.0
+ }
+};
+static float t[6][4][2] = {
+ {
+ {
+ 1.1, 1.1
+ },
+ {
+ -0.1, 1.1
+ },
+ {
+ -0.1, -0.1
+ },
+ {
+ 1.1, -0.1
+ }
+ },
+ {
+ {
+ 1.1, 1.1
+ },
+ {
+ -0.1, 1.1
+ },
+ {
+ -0.1, -0.1
+ },
+ {
+ 1.1, -0.1
+ }
+ },
+ {
+ {
+ -0.1, 1.1
+ },
+ {
+ 1.1, 1.1
+ },
+ {
+ 1.1, -0.1
+ },
+ {
+ -0.1, -0.1
+ }
+ },
+ {
+ {
+ 1.1, 1.1
+ },
+ {
+ -0.1, 1.1
+ },
+ {
+ -0.1, -0.1
+ },
+ {
+ 1.1, -0.1
+ }
+ },
+ {
+ {
+ 1.1, 1.1
+ },
+ {
+ -0.1, 1.1
+ },
+ {
+ -0.1, -0.1
+ },
+ {
+ 1.1, -0.1
+ }
+ },
+ {
+ {
+ 1.1, 1.1
+ },
+ {
+ -0.1, 1.1
+ },
+ {
+ -0.1, -0.1
+ },
+ {
+ 1.1, -0.1
+ }
+ },
+};
+
+static void BuildCube(void)
+{
+ GLint i;
+
+ glNewList(cube, GL_COMPILE);
+ for (i = 0; i < 6; i++) {
+ glBegin(GL_POLYGON);
+ glNormal3fv(n[i]); glTexCoord2fv(t[i][0]); glVertex3fv(c[i][0]);
+ glNormal3fv(n[i]); glTexCoord2fv(t[i][1]); glVertex3fv(c[i][1]);
+ glNormal3fv(n[i]); glTexCoord2fv(t[i][2]); glVertex3fv(c[i][2]);
+ glNormal3fv(n[i]); glTexCoord2fv(t[i][3]); glVertex3fv(c[i][3]);
+ glEnd();
+ }
+ glEndList();
+}
+
+static void BuildLists(void)
+{
+
+ cube = glGenLists(1);
+ BuildCube();
+}
+
+static void Init(void)
+{
+
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ gluBuild2DMipmaps(GL_TEXTURE_2D, 3, image->sizeX, image->sizeY,
+ GL_RGB, GL_UNSIGNED_BYTE, image->data);
+ glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, decal);
+ glEnable(GL_TEXTURE_2D);
+
+ glFrontFace(GL_CCW);
+ glCullFace(GL_FRONT);
+ glEnable(GL_CULL_FACE);
+
+ BuildLists();
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+
+ magFilter = nr;
+ minFilter = nr;
+ sWrapMode = repeat;
+ tWrapMode = repeat;
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluPerspective(145.0, 1.0, 0.01, 1000);
+ glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key2(int key, int x, int y)
+{
+
+ switch (key) {
+ case GLUT_KEY_LEFT:
+ yRotation -= 0.5;
+ break;
+ case GLUT_KEY_RIGHT:
+ yRotation += 0.5;
+ break;
+ case GLUT_KEY_UP:
+ xRotation -= 0.5;
+ break;
+ case GLUT_KEY_DOWN:
+ xRotation += 0.5;
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+
+ case 'T':
+ zTranslate += 0.25;
+ break;
+ case 't':
+ zTranslate -= 0.25;
+ break;
+
+ case 's':
+ doSphere = !doSphere;
+ if (doSphere) {
+ glTexGeniv(GL_S, GL_TEXTURE_GEN_MODE, sphereMap);
+ glTexGeniv(GL_T, GL_TEXTURE_GEN_MODE, sphereMap);
+ glEnable(GL_TEXTURE_GEN_S);
+ glEnable(GL_TEXTURE_GEN_T);
+ } else {
+ glDisable(GL_TEXTURE_GEN_S);
+ glDisable(GL_TEXTURE_GEN_T);
+ }
+ break;
+
+ case '0':
+ magFilter = nr;
+ break;
+ case '1':
+ magFilter = ln;
+ break;
+ case '2':
+ minFilter = nr;
+ break;
+ case '3':
+ minFilter = ln;
+ break;
+ case '4':
+ minFilter = nr_mipmap_nr;
+ break;
+ case '5':
+ minFilter = nr_mipmap_ln;
+ break;
+ case '6':
+ minFilter = ln_mipmap_nr;
+ break;
+ case '7':
+ minFilter = ln_mipmap_ln;
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, sWrapMode);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, tWrapMode);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, magFilter);
+ glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, minFilter);
+
+ glPushMatrix();
+
+ glTranslatef(0.0, 0.0, zTranslate);
+ glRotatef(xRotation, 1, 0, 0);
+ glRotatef(yRotation, 0, 1, 0);
+ glCallList(cube);
+
+ 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 if (strcmp(argv[i], "-f") == 0) {
+ if (i+1 >= argc || argv[i+1][0] == '-') {
+ printf("-f (No file name).\n");
+ return GL_FALSE;
+ } else {
+ texFileName = argv[++i];
+ }
+ } 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);
+ }
+
+ if (texFileName == 0) {
+ printf("No image file.\n");
+ exit(1);
+ }
+
+ image = LoadPPM(texFileName);
+
+ glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
+
+ type = GLUT_RGB;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Texture Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutSpecialFunc(Key2);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/tkmap.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/tkmap.c
new file mode 100644
index 000000000..3ded79cac
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/tkmap.c
@@ -0,0 +1,71 @@
+
+enum {
+ COLOR_BLACK = 0,
+ COLOR_RED,
+ COLOR_GREEN,
+ COLOR_YELLOW,
+ COLOR_BLUE,
+ COLOR_MAGENTA,
+ COLOR_CYAN,
+ COLOR_WHITE
+};
+
+static float RGBMap[9][3] = {
+ {0, 0, 0},
+ {1, 0, 0},
+ {0, 1, 0},
+ {1, 1, 0},
+ {0, 0, 1},
+ {1, 0, 1},
+ {0, 1, 1},
+ {1, 1, 1},
+ {0.5, 0.5, 0.5}
+};
+
+static void SetColor(int c)
+{
+ if (glutGet(GLUT_WINDOW_RGBA))
+ glColor3fv(RGBMap[c]);
+ else
+ glIndexf(c);
+}
+
+static void InitMap(void)
+{
+ int i;
+
+ if (rgb)
+ return;
+
+ for (i = 0; i < 9; i++)
+ glutSetColor(i, RGBMap[i][0], RGBMap[i][1], RGBMap[i][2]);
+}
+
+static void SetFogRamp(int density, int startIndex)
+{
+ int fogValues, colorValues;
+ int i, j, k;
+ float intensity;
+
+ fogValues = 1 << density;
+ colorValues = 1 << startIndex;
+ for (i = 0; i < colorValues; i++) {
+ for (j = 0; j < fogValues; j++) {
+ k = i * fogValues + j;
+ intensity = (i * fogValues + j * colorValues) / 255.0;
+ glutSetColor(k, intensity, intensity, intensity);
+ }
+ }
+}
+
+static void SetGreyRamp(void)
+{
+ int i;
+ float intensity;
+
+ for (i = 0; i < 255; i++) {
+ intensity = i / 255.0;
+ glutSetColor(i, intensity, intensity, intensity);
+ }
+}
+
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/tri.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/tri.c
new file mode 100644
index 000000000..700325132
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/tri.c
@@ -0,0 +1,403 @@
+/*
+ * 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 SOLID 1
+#define LINE 2
+#define POINT 3
+
+
+GLenum rgb, doubleBuffer, windType;
+GLint windW, windH;
+
+GLenum dithering = GL_TRUE;
+GLenum showVerticies = GL_TRUE;
+GLenum hideBottomTriangle = GL_FALSE;
+GLenum outline = GL_TRUE;
+GLenum culling = GL_FALSE;
+GLenum winding = GL_FALSE;
+GLenum face = GL_FALSE;
+GLenum state = SOLID;
+GLenum aaMode = GL_FALSE;
+GLenum shade = GL_TRUE;
+
+GLint color1, color2, color3;
+
+float zRotation = 90.0;
+float zoom = 1.0;
+
+float boxA[3] = {-100, -100, 0};
+float boxB[3] = { 100, -100, 0};
+float boxC[3] = { 100, 100, 0};
+float boxD[3] = {-100, 100, 0};
+
+float p0[3] = {-125,-80, 0};
+float p1[3] = {-125, 80, 0};
+float p2[3] = { 172, 0, 0};
+
+
+#include "tkmap.c"
+
+static void Init(void)
+{
+ float r, g, b;
+ float percent1, percent2;
+ GLint i, j;
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+
+ glLineStipple(1, 0xF0F0);
+
+ glEnable(GL_SCISSOR_TEST);
+
+ if (!rgb) {
+ for (j = 0; j <= 12; j++) {
+ if (j <= 6) {
+ percent1 = j / 6.0;
+ r = 1.0 - 0.8 * percent1;
+ g = 0.2 + 0.8 * percent1;
+ b = 0.2;
+ } else {
+ percent1 = (j - 6) / 6.0;
+ r = 0.2;
+ g = 1.0 - 0.8 * percent1;
+ b = 0.2 + 0.8 * percent1;
+ }
+ glutSetColor(j+18, r, g, b);
+ for (i = 0; i < 16; i++) {
+ percent2 = i / 15.0;
+ glutSetColor(j*16+1+32, r*percent2, g*percent2, b*percent2);
+ }
+ }
+ color1 = 18;
+ color2 = 24;
+ color3 = 30;
+ }
+}
+
+static void Reshape(int width, int height)
+{
+
+ windW = (GLint)width;
+ windH = (GLint)height;
+}
+
+static void Key2(int key, int x, int y)
+{
+
+ switch (key) {
+ case GLUT_KEY_LEFT:
+ zRotation += 0.5;
+ break;
+ case GLUT_KEY_RIGHT:
+ zRotation -= 0.5;
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ case 'Z':
+ zoom *= 0.75;
+ break;
+ case 'z':
+ zoom /= 0.75;
+ if (zoom > 10) {
+ zoom = 10;
+ }
+ break;
+ case '1':
+ glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
+ break;
+ case '2':
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ break;
+ case '3':
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ break;
+ case '4':
+ state = POINT;
+ break;
+ case '5':
+ state = LINE;
+ break;
+ case '6':
+ state = SOLID;
+ break;
+ case '7':
+ culling = !culling;
+ break;
+ case '8':
+ winding = !winding;
+ break;
+ case '9':
+ face = !face;
+ break;
+ case 'v':
+ showVerticies = !showVerticies;
+ break;
+ case 's':
+ shade = !shade;
+ (shade) ? glShadeModel(GL_SMOOTH) : glShadeModel(GL_FLAT);
+ break;
+ case 'h':
+ hideBottomTriangle = !hideBottomTriangle;
+ break;
+ case 'o':
+ outline = !outline;
+ break;
+ case 'm':
+ dithering = !dithering;
+ break;
+ case '0':
+ aaMode = !aaMode;
+ if (aaMode) {
+ glEnable(GL_POLYGON_SMOOTH);
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ if (!rgb) {
+ color1 = 32;
+ color2 = 128;
+ color3 = 224;
+ }
+ } else {
+ glDisable(GL_POLYGON_SMOOTH);
+ glDisable(GL_BLEND);
+ if (!rgb) {
+ color1 = 18;
+ color2 = 24;
+ color3 = 30;
+ }
+ }
+ break;
+ default:
+ return;
+ }
+
+ glutPostRedisplay();
+}
+
+static void BeginPrim(void)
+{
+
+ switch (state) {
+ case SOLID:
+ glBegin(GL_POLYGON);
+ break;
+ case LINE:
+ glBegin(GL_LINE_LOOP);
+ break;
+ case POINT:
+ glBegin(GL_POINTS);
+ break;
+ default:
+ break;
+ }
+}
+
+static void EndPrim(void)
+{
+
+ glEnd();
+}
+
+static void Draw(void)
+{
+ float scaleX, scaleY;
+
+ glViewport(0, 0, windW, windH);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(-175, 175, -175, 175);
+ glMatrixMode(GL_MODELVIEW);
+
+ glScissor(0, 0, windW, windH);
+
+ (culling) ? glEnable(GL_CULL_FACE) : glDisable(GL_CULL_FACE);
+ (winding) ? glFrontFace(GL_CCW) : glFrontFace(GL_CW);
+ (face) ? glCullFace(GL_FRONT) : glCullFace(GL_BACK);
+
+ (dithering) ? glEnable(GL_DITHER) : glDisable(GL_DITHER);
+
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ SetColor(COLOR_GREEN);
+ glBegin(GL_LINE_LOOP);
+ glVertex3fv(boxA);
+ glVertex3fv(boxB);
+ glVertex3fv(boxC);
+ glVertex3fv(boxD);
+ glEnd();
+
+ if (!hideBottomTriangle) {
+ glPushMatrix();
+
+ glScalef(zoom, zoom, zoom);
+ glRotatef(zRotation, 0, 0, 1);
+
+ SetColor(COLOR_BLUE);
+ BeginPrim();
+ glVertex3fv(p0);
+ glVertex3fv(p1);
+ glVertex3fv(p2);
+ EndPrim();
+
+ if (showVerticies) {
+ (rgb) ? glColor3fv(RGBMap[COLOR_RED]) : glIndexf(color1);
+ glRectf(p0[0]-2, p0[1]-2, p0[0]+2, p0[1]+2);
+ (rgb) ? glColor3fv(RGBMap[COLOR_GREEN]) : glIndexf(color2);
+ glRectf(p1[0]-2, p1[1]-2, p1[0]+2, p1[1]+2);
+ (rgb) ? glColor3fv(RGBMap[COLOR_BLUE]) : glIndexf(color3);
+ glRectf(p2[0]-2, p2[1]-2, p2[0]+2, p2[1]+2);
+ }
+
+ glPopMatrix();
+ }
+
+ scaleX = (float)(windW - 20) / 2 / 175 * (175 - 100) + 10;
+ scaleY = (float)(windH - 20) / 2 / 175 * (175 - 100) + 10;
+
+ glViewport(scaleX, scaleY, windW-2*scaleX, windH-2*scaleY);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluOrtho2D(-100, 100, -100, 100);
+ glMatrixMode(GL_MODELVIEW);
+
+ glScissor(scaleX, scaleY, windW-2*scaleX, windH-2*scaleY);
+
+ glPushMatrix();
+
+ glScalef(zoom, zoom, zoom);
+ glRotatef(zRotation, 0,0,1);
+
+ glPointSize(10);
+ glLineWidth(5);
+ glEnable(GL_POINT_SMOOTH);
+ glEnable(GL_LINE_STIPPLE);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ SetColor(COLOR_RED);
+ BeginPrim();
+ (rgb) ? glColor3fv(RGBMap[COLOR_RED]) : glIndexf(color1);
+ glVertex3fv(p0);
+ (rgb) ? glColor3fv(RGBMap[COLOR_GREEN]) : glIndexf(color2);
+ glVertex3fv(p1);
+ (rgb) ? glColor3fv(RGBMap[COLOR_BLUE]) : glIndexf(color3);
+ glVertex3fv(p2);
+ EndPrim();
+
+ glPointSize(1);
+ glLineWidth(1);
+ glDisable(GL_POINT_SMOOTH);
+ glDisable(GL_LINE_STIPPLE);
+ glBlendFunc(GL_ONE, GL_ZERO);
+
+ if (outline) {
+ SetColor(COLOR_WHITE);
+ glBegin(GL_LINE_LOOP);
+ glVertex3fv(p0);
+ glVertex3fv(p1);
+ glVertex3fv(p2);
+ glEnd();
+ }
+
+ glPopMatrix();
+
+ glFlush();
+
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_FALSE;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else {
+ printf("%s (Bad option).\n", argv[i]);
+ return GL_FALSE;
+ }
+ }
+ return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+ glutInit(&argc, argv);
+
+ if (Args(argc, argv) == GL_FALSE) {
+ exit(1);
+ }
+
+ windW = 600;
+ windH = 300;
+ glutInitWindowPosition(0, 0); glutInitWindowSize( windW, windH);
+
+ windType = (rgb) ? GLUT_RGB : GLUT_INDEX;
+ windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(windType);
+
+ if (glutCreateWindow("Triangle Test") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutSpecialFunc(Key2);
+ glutDisplayFunc(Draw);
+ glutMainLoop();
+ return 0;
+}
diff --git a/nx-X11/extras/Mesa_6.4.1/progs/samples/wave.c b/nx-X11/extras/Mesa_6.4.1/progs/samples/wave.c
new file mode 100644
index 000000000..d3c468745
--- /dev/null
+++ b/nx-X11/extras/Mesa_6.4.1/progs/samples/wave.c
@@ -0,0 +1,619 @@
+/*
+ * 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>
+
+#ifndef PI
+#define PI 3.14159265358979323846
+#endif
+
+#define GETCOORD(frame, x, y) (&(theMesh.coords[frame*theMesh.numCoords+(x)+(y)*(theMesh.widthX+1)]))
+#define GETFACET(frame, x, y) (&(theMesh.facets[frame*theMesh.numFacets+(x)+(y)*theMesh.widthX]))
+
+
+GLenum rgb, doubleBuffer;
+
+#include "tkmap.c"
+
+GLint colorIndexes1[3];
+GLint colorIndexes2[3];
+GLenum clearMask = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT;
+
+GLenum smooth = GL_FALSE;
+GLenum lighting = GL_TRUE;
+GLenum depth = GL_TRUE;
+GLenum stepMode = GL_FALSE;
+GLenum spinMode = GL_FALSE;
+GLint contouring = 0;
+
+GLint widthX, widthY;
+GLint checkerSize;
+float height;
+
+GLint frames, curFrame = 0, nextFrame = 0;
+
+struct facet {
+ float color[3];
+ float normal[3];
+};
+struct coord {
+ float vertex[3];
+ float normal[3];
+};
+struct mesh {
+ GLint widthX, widthY;
+ GLint numFacets;
+ GLint numCoords;
+ GLint frames;
+ struct coord *coords;
+ struct facet *facets;
+} theMesh;
+
+GLubyte contourTexture1[] = {
+ 255, 255, 255, 255,
+ 255, 255, 255, 255,
+ 255, 255, 255, 255,
+ 127, 127, 127, 127,
+};
+GLubyte contourTexture2[] = {
+ 255, 255, 255, 255,
+ 255, 127, 127, 127,
+ 255, 127, 127, 127,
+ 255, 127, 127, 127,
+};
+
+#if !defined(GLUTCALLBACK)
+#define GLUTCALLBACK
+#endif
+
+
+void GLUTCALLBACK glut_post_redisplay_p(void)
+{
+ static double t0 = -1.;
+ double t, dt;
+ t = glutGet(GLUT_ELAPSED_TIME) / 1000.;
+ if (t0 < 0.)
+ t0 = t;
+ dt = t - t0;
+
+ if (dt < 1./30.)
+ return;
+
+ t0 = t;
+
+ glutPostRedisplay();
+}
+
+static void Animate(void)
+{
+ struct coord *coord;
+ struct facet *facet;
+ float *lastColor;
+ float *thisColor;
+ GLint i, j;
+
+ glClear(clearMask);
+
+ if (nextFrame || !stepMode) {
+ curFrame++;
+ }
+ if (curFrame >= theMesh.frames) {
+ curFrame = 0;
+ }
+
+ if ((nextFrame || !stepMode) && spinMode) {
+ glRotatef(5.0, 0.0, 0.0, 1.0);
+ }
+ nextFrame = 0;
+
+ for (i = 0; i < theMesh.widthX; i++) {
+ glBegin(GL_QUAD_STRIP);
+ lastColor = NULL;
+ for (j = 0; j < theMesh.widthY; j++) {
+ facet = GETFACET(curFrame, i, j);
+ if (!smooth && lighting) {
+ glNormal3fv(facet->normal);
+ }
+ if (lighting) {
+ if (rgb) {
+ thisColor = facet->color;
+ glColor3fv(facet->color);
+ } else {
+ thisColor = facet->color;
+ glMaterialfv(GL_FRONT_AND_BACK, GL_COLOR_INDEXES,
+ facet->color);
+ }
+ } else {
+ if (rgb) {
+ thisColor = facet->color;
+ glColor3fv(facet->color);
+ } else {
+ thisColor = facet->color;
+ glIndexf(facet->color[1]);
+ }
+ }
+
+ if (!lastColor || (thisColor[0] != lastColor[0] && smooth)) {
+ if (lastColor) {
+ glEnd();
+ glBegin(GL_QUAD_STRIP);
+ }
+ coord = GETCOORD(curFrame, i, j);
+ if (smooth && lighting) {
+ glNormal3fv(coord->normal);
+ }
+ glVertex3fv(coord->vertex);
+
+ coord = GETCOORD(curFrame, i+1, j);
+ if (smooth && lighting) {
+ glNormal3fv(coord->normal);
+ }
+ glVertex3fv(coord->vertex);
+ }
+
+ coord = GETCOORD(curFrame, i, j+1);
+ if (smooth && lighting) {
+ glNormal3fv(coord->normal);
+ }
+ glVertex3fv(coord->vertex);
+
+ coord = GETCOORD(curFrame, i+1, j+1);
+ if (smooth && lighting) {
+ glNormal3fv(coord->normal);
+ }
+ glVertex3fv(coord->vertex);
+
+ lastColor = thisColor;
+ }
+ glEnd();
+ }
+
+ glFlush();
+ if (doubleBuffer) {
+ glutSwapBuffers();
+ }
+}
+
+static void SetColorMap(void)
+{
+ static float green[3] = {0.2, 1.0, 0.2};
+ static float red[3] = {1.0, 0.2, 0.2};
+ float *color = 0, percent;
+ GLint *indexes = 0, entries, i, j;
+
+ entries = glutGet(GLUT_WINDOW_COLORMAP_SIZE);
+
+ colorIndexes1[0] = 1;
+ colorIndexes1[1] = 1 + (GLint)((entries - 1) * 0.3);
+ colorIndexes1[2] = (GLint)((entries - 1) * 0.5);
+ colorIndexes2[0] = 1 + (GLint)((entries - 1) * 0.5);
+ colorIndexes2[1] = 1 + (GLint)((entries - 1) * 0.8);
+ colorIndexes2[2] = entries - 1;
+
+ for (i = 0; i < 2; i++) {
+ switch (i) {
+ case 0:
+ color = green;
+ indexes = colorIndexes1;
+ break;
+ case 1:
+ color = red;
+ indexes = colorIndexes2;
+ break;
+ }
+
+ for (j = indexes[0]; j < indexes[1]; j++) {
+ percent = 0.2 + 0.8 * (j - indexes[0]) /
+ (float)(indexes[1] - indexes[0]);
+ glutSetColor(j, percent*color[0], percent*color[1],
+ percent*color[2]);
+ }
+ for (j=indexes[1]; j<=indexes[2]; j++) {
+ percent = (j - indexes[1]) / (float)(indexes[2] - indexes[1]);
+ glutSetColor(j, percent*(1-color[0])+color[0],
+ percent*(1-color[1])+color[1],
+ percent*(1-color[2])+color[2]);
+ }
+ }
+}
+
+static void InitMesh(void)
+{
+ struct coord *coord;
+ struct facet *facet;
+ float dp1[3], dp2[3];
+ float *pt1, *pt2, *pt3;
+ float angle, d, x, y;
+ GLint numFacets, numCoords, frameNum, i, j;
+
+ theMesh.widthX = widthX;
+ theMesh.widthY = widthY;
+ theMesh.frames = frames;
+
+ numFacets = widthX * widthY;
+ numCoords = (widthX + 1) * (widthY + 1);
+
+ theMesh.numCoords = numCoords;
+ theMesh.numFacets = numFacets;
+
+ theMesh.coords = (struct coord *)malloc(frames*numCoords*
+ sizeof(struct coord));
+ theMesh.facets = (struct facet *)malloc(frames*numFacets*
+ sizeof(struct facet));
+ if (theMesh.coords == NULL || theMesh.facets == NULL) {
+ printf("Out of memory.\n");
+ exit(1);
+ }
+
+ for (frameNum = 0; frameNum < frames; frameNum++) {
+ for (i = 0; i <= widthX; i++) {
+ x = i / (float)widthX;
+ for (j = 0; j <= widthY; j++) {
+ y = j / (float)widthY;
+
+ d = sqrt(x*x+y*y);
+ if (d == 0.0) {
+ d = 0.0001;
+ }
+ angle = 2 * PI * d + (2 * PI / frames * frameNum);
+
+ coord = GETCOORD(frameNum, i, j);
+
+ coord->vertex[0] = x - 0.5;
+ coord->vertex[1] = y - 0.5;
+ coord->vertex[2] = (height - height * d) * cos(angle);
+
+ coord->normal[0] = -(height / d) * x * ((1 - d) * 2 * PI *
+ sin(angle) + cos(angle));
+ coord->normal[1] = -(height / d) * y * ((1 - d) * 2 * PI *
+ sin(angle) + cos(angle));
+ coord->normal[2] = -1;
+
+ d = 1.0 / sqrt(coord->normal[0]*coord->normal[0]+
+ coord->normal[1]*coord->normal[1]+1);
+ coord->normal[0] *= d;
+ coord->normal[1] *= d;
+ coord->normal[2] *= d;
+ }
+ }
+ for (i = 0; i < widthX; i++) {
+ for (j = 0; j < widthY; j++) {
+ facet = GETFACET(frameNum, i, j);
+ if (((i/checkerSize)%2)^(j/checkerSize)%2) {
+ if (rgb) {
+ facet->color[0] = 1.0;
+ facet->color[1] = 0.2;
+ facet->color[2] = 0.2;
+ } else {
+ facet->color[0] = colorIndexes1[0];
+ facet->color[1] = colorIndexes1[1];
+ facet->color[2] = colorIndexes1[2];
+ }
+ } else {
+ if (rgb) {
+ facet->color[0] = 0.2;
+ facet->color[1] = 1.0;
+ facet->color[2] = 0.2;
+ } else {
+ facet->color[0] = colorIndexes2[0];
+ facet->color[1] = colorIndexes2[1];
+ facet->color[2] = colorIndexes2[2];
+ }
+ }
+ pt1 = GETCOORD(frameNum, i, j)->vertex;
+ pt2 = GETCOORD(frameNum, i, j+1)->vertex;
+ pt3 = GETCOORD(frameNum, i+1, j+1)->vertex;
+
+ dp1[0] = pt2[0] - pt1[0];
+ dp1[1] = pt2[1] - pt1[1];
+ dp1[2] = pt2[2] - pt1[2];
+
+ dp2[0] = pt3[0] - pt2[0];
+ dp2[1] = pt3[1] - pt2[1];
+ dp2[2] = pt3[2] - pt2[2];
+
+ facet->normal[0] = dp1[1] * dp2[2] - dp1[2] * dp2[1];
+ facet->normal[1] = dp1[2] * dp2[0] - dp1[0] * dp2[2];
+ facet->normal[2] = dp1[0] * dp2[1] - dp1[1] * dp2[0];
+
+ d = 1.0 / sqrt(facet->normal[0]*facet->normal[0]+
+ facet->normal[1]*facet->normal[1]+
+ facet->normal[2]*facet->normal[2]);
+
+ facet->normal[0] *= d;
+ facet->normal[1] *= d;
+ facet->normal[2] *= d;
+ }
+ }
+ }
+}
+
+static void InitMaterials(void)
+{
+ static float ambient[] = {0.1, 0.1, 0.1, 1.0};
+ static float diffuse[] = {0.5, 1.0, 1.0, 1.0};
+ static float position[] = {90.0, 90.0, 150.0, 0.0};
+ static float front_mat_shininess[] = {60.0};
+ static float front_mat_specular[] = {0.2, 0.2, 0.2, 1.0};
+ static float front_mat_diffuse[] = {0.5, 0.28, 0.38, 1.0};
+ static float back_mat_shininess[] = {60.0};
+ static float back_mat_specular[] = {0.5, 0.5, 0.2, 1.0};
+ static float back_mat_diffuse[] = {1.0, 1.0, 0.2, 1.0};
+ static float lmodel_ambient[] = {1.0, 1.0, 1.0, 1.0};
+ static float lmodel_twoside[] = {GL_TRUE};
+
+ glMatrixMode(GL_PROJECTION);
+ gluPerspective(90.0, 1.0, 0.5, 10.0);
+
+ glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
+ glLightfv(GL_LIGHT0, GL_POSITION, position);
+ glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+ glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+
+ glMaterialfv(GL_FRONT, GL_SHININESS, front_mat_shininess);
+ glMaterialfv(GL_FRONT, GL_SPECULAR, front_mat_specular);
+ glMaterialfv(GL_FRONT, GL_DIFFUSE, front_mat_diffuse);
+ glMaterialfv(GL_BACK, GL_SHININESS, back_mat_shininess);
+ glMaterialfv(GL_BACK, GL_SPECULAR, back_mat_specular);
+ glMaterialfv(GL_BACK, GL_DIFFUSE, back_mat_diffuse);
+ if (rgb) {
+ glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
+ }
+
+ if (rgb) {
+ glEnable(GL_COLOR_MATERIAL);
+ } else {
+ SetColorMap();
+ }
+}
+
+static void InitTexture(void)
+{
+
+ 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_MAG_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+}
+
+static void Init(void)
+{
+
+ glClearColor(0.0, 0.0, 0.0, 0.0);
+
+ glShadeModel(GL_FLAT);
+
+ glFrontFace(GL_CW);
+
+ glEnable(GL_DEPTH_TEST);
+
+ InitMaterials();
+ InitTexture();
+ InitMesh();
+
+ glMatrixMode(GL_MODELVIEW);
+ glTranslatef(0.0, 0.4, -1.8);
+ glScalef(2.0, 2.0, 2.0);
+ glRotatef(-35.0, 1.0, 0.0, 0.0);
+ glRotatef(35.0, 0.0, 0.0, 1.0);
+}
+
+static void Reshape(int width, int height)
+{
+
+ glViewport(0, 0, (GLint)width, (GLint)height);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+ switch (key) {
+ case 27:
+ exit(1);
+ case 'c':
+ contouring++;
+ if (contouring == 1) {
+ static GLfloat map[4] = {0, 0, 20, 0};
+
+ glTexImage2D(GL_TEXTURE_2D, 0, 3, 4, 4, 0, GL_LUMINANCE,
+ GL_UNSIGNED_BYTE, (GLvoid *)contourTexture1);
+ glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+ glTexGenfv(GL_S, GL_OBJECT_PLANE, map);
+ glTexGenfv(GL_T, GL_OBJECT_PLANE, map);
+ glEnable(GL_TEXTURE_2D);
+ glEnable(GL_TEXTURE_GEN_S);
+ glEnable(GL_TEXTURE_GEN_T);
+ } else if (contouring == 2) {
+ static GLfloat map[4] = {0, 0, 20, 0};
+
+ glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
+ glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
+ glPushMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTexGenfv(GL_S, GL_EYE_PLANE, map);
+ glTexGenfv(GL_T, GL_EYE_PLANE, map);
+ glPopMatrix();
+ } else {
+ contouring = 0;
+ glDisable(GL_TEXTURE_GEN_S);
+ glDisable(GL_TEXTURE_GEN_T);
+ glDisable(GL_TEXTURE_2D);
+ }
+ break;
+ case 's':
+ smooth = !smooth;
+ if (smooth) {
+ glShadeModel(GL_SMOOTH);
+ } else {
+ glShadeModel(GL_FLAT);
+ }
+ break;
+ case 'l':
+ lighting = !lighting;
+ if (lighting) {
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+ if (rgb) {
+ glEnable(GL_COLOR_MATERIAL);
+ }
+ } else {
+ glDisable(GL_LIGHTING);
+ glDisable(GL_LIGHT0);
+ if (rgb) {
+ glDisable(GL_COLOR_MATERIAL);
+ }
+ }
+ break;
+ case 'd':
+ depth = !depth;
+ if (depth) {
+ glEnable(GL_DEPTH_TEST);
+ clearMask |= GL_DEPTH_BUFFER_BIT;
+ } else {
+ glDisable(GL_DEPTH_TEST);
+ clearMask &= ~GL_DEPTH_BUFFER_BIT;
+ }
+ break;
+ case 32:
+ stepMode = !stepMode;
+ if (stepMode) {
+ glutIdleFunc(0);
+ } else {
+ glutIdleFunc(glut_post_redisplay_p);
+ }
+ break;
+ case 'n':
+ if (stepMode) {
+ nextFrame = 1;
+ }
+ break;
+ case 'a':
+ spinMode = !spinMode;
+ break;
+ default:
+ return;
+ }
+ glutPostRedisplay();
+}
+
+static GLenum Args(int argc, char **argv)
+{
+ GLint i;
+
+ rgb = GL_TRUE;
+ doubleBuffer = GL_TRUE;
+ frames = 10;
+ widthX = 10;
+ widthY = 10;
+ checkerSize = 2;
+ height = 0.2;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-ci") == 0) {
+ rgb = GL_FALSE;
+ } else if (strcmp(argv[i], "-rgb") == 0) {
+ rgb = GL_TRUE;
+ } else if (strcmp(argv[i], "-sb") == 0) {
+ doubleBuffer = GL_FALSE;
+ } else if (strcmp(argv[i], "-db") == 0) {
+ doubleBuffer = GL_TRUE;
+ } else if (strcmp(argv[i], "-grid") == 0) {
+ if (i+2 >= argc || argv[i+1][0] == '-' || argv[i+2][0] == '-') {
+ printf("-grid (No numbers).\n");
+ return GL_FALSE;
+ } else {
+ widthX = atoi(argv[++i]);
+ widthY = atoi(argv[++i]);
+ }
+ } else if (strcmp(argv[i], "-size") == 0) {
+ if (i+1 >= argc || argv[i+1][0] == '-') {
+ printf("-checker (No number).\n");
+ return GL_FALSE;
+ } else {
+ checkerSize = atoi(argv[++i]);
+ }
+ } else if (strcmp(argv[i], "-wave") == 0) {
+ if (i+1 >= argc || argv[i+1][0] == '-') {
+ printf("-wave (No number).\n");
+ return GL_FALSE;
+ } else {
+ height = atof(argv[++i]);
+ }
+ } else if (strcmp(argv[i], "-frames") == 0) {
+ if (i+1 >= argc || argv[i+1][0] == '-') {
+ printf("-frames (No number).\n");
+ return GL_FALSE;
+ } else {
+ frames = atoi(argv[++i]);
+ }
+ } 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_DEPTH;
+ type |= (rgb) ? GLUT_RGB : GLUT_INDEX;
+ type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+ glutInitDisplayMode(type);
+
+ if (glutCreateWindow("Wave Demo") == GL_FALSE) {
+ exit(1);
+ }
+
+ InitMap();
+
+ Init();
+
+ glutReshapeFunc(Reshape);
+ glutKeyboardFunc(Key);
+ glutDisplayFunc(Animate);
+ glutIdleFunc(glut_post_redisplay_p);
+ glutMainLoop();
+ return 0;
+}