Compare commits

...

143 Commits

Author SHA1 Message Date
Keith Whitwell
485f040741 Fixed includes & added a few hooks for the DRI. 1999-10-08 09:27:09 +00:00
Miklos Fazekas
a7313e045d Added PARB support. 1999-10-05 19:51:15 +00:00
Miklos Fazekas
3af541c541 Added gl_ext_multitexture_ADD suport. 1999-10-05 19:50:45 +00:00
Miklos Fazekas
37290c844c Added packed ARGB support. 1999-10-05 19:49:41 +00:00
Miklos Fazekas
1076e7cd21 Packed RGBA support. 1999-10-05 19:26:54 +00:00
Miklos Fazekas
6a659315cd Packed RGB support. 1999-10-05 19:00:11 +00:00
Miklos Fazekas
2ed47d29c6 Added support for GL_ext_texture_add 1999-10-05 18:48:49 +00:00
Miklos Fazekas
d598ca05e1 Minor cleanup. 1999-10-05 18:40:17 +00:00
Jouk Jansen
08a454c7af Added tess_winding.c for compilation 1999-10-04 05:26:46 +00:00
Gareth Hughes
dcf11bdb93 Fixed overflow bug in combineCallback. 1999-10-03 01:00:33 +00:00
Gareth Hughes
63fee8b3be Added tessellation winding rule support. Misc bug fixes. 1999-10-03 00:56:07 +00:00
Gareth Hughes
45b95f048d Added tessellation winding rule files. 1999-10-03 00:53:38 +00:00
Keith Whitwell
69cfdb2fcb more hooks for mga driver, including an immediate fastpath 1999-09-30 11:18:21 +00:00
Jon Taylor
0b6ae412d3 Disable genkgi sublib handling until we have some sublibs to handle 1999-09-21 00:46:26 +00:00
Keith Whitwell
7d1071526d added mesa.conf 1999-09-20 21:06:57 +00:00
Keith Whitwell
14f8b8b5c3 Bugfix for ctx->backface_sign calculation 1999-09-20 14:30:22 +00:00
Keith Whitwell
5a437d5889 Cleaning up 1999-09-19 23:43:02 +00:00
Keith Whitwell
c656951110 RasterMask was set incorrectly 1999-09-19 23:06:40 +00:00
tanner
bc34adfc54 lots of autoconf updates 1999-09-19 20:09:00 +00:00
Ted Jump
01db31b678 Changed name 'glGetProcAddressEXT' to 'gluGetProcAddressEXT' 1999-09-19 10:04:01 +00:00
Ted Jump
ea8e0b2156 Fixed LIBNAME entry 1999-09-19 10:03:19 +00:00
Ted Jump
a63baa3e8d Removed use of GLU.H - prevents compiler warning wrt:gluGetProcAddressEXT 1999-09-19 09:59:12 +00:00
Ted Jump
32b20284b8 Added NASM support 1999-09-19 09:55:37 +00:00
Ted Jump
725ec81ae8 More Win32 build compliance fixups 1999-09-19 02:03:18 +00:00
Keith Whitwell
1bf9dfaf5d Large patch:
- FX bug fixes.
        - Polygon mode and edgeflag work properly.
	- Clipping works with edgeflag.
	- Driver.ReducedPrimitiveChange() callback so drivers
          that implement lines & points as triangles can turn culling off
	  before rendering groups of these primitives.
        - Cleaned up feedback & select primitives.
1999-09-18 20:41:22 +00:00
Brian Paul
56b58668e8 disabled GL_EXT_get_proc_address for the time being 1999-09-18 01:06:52 +00:00
Brian Paul
e23bb9ff36 added a bunch of missing files to LIB_FILES 1999-09-17 18:08:32 +00:00
Keith Whitwell
39d29fe7fe Fix for write-rgba-span and others 1999-09-17 15:14:02 +00:00
Brian Paul
ecaf1a0865 silenced some warnings 1999-09-17 12:27:01 +00:00
Brian Paul
1bf28c46c2 glGetProcAddressEXT changes to accomodate Win32 and non-Win32 1999-09-17 12:21:36 +00:00
Brian Paul
9b563507cb pad GL_TINY to 6 digits 1999-09-17 12:07:10 +00:00
Brian Paul
d2a57c9b2b pad GLU_TINY to 6 digits 1999-09-17 12:06:56 +00:00
Gareth Hughes
b32966fc80 Winding rule updates. 1999-09-17 06:31:02 +00:00
Jouk Jansen
727f35a518 mesa_wgl.h should only be included when _WIN32 is defined 1999-09-17 05:56:43 +00:00
Ted Jump
477da9eff1 Modified to build better with Mesa wgl functions 1999-09-17 04:27:02 +00:00
Ted Jump
6799ecb675 Relocated wgl function prototypes to separate .h for easier work with fxwgl & glut 1999-09-17 04:25:56 +00:00
Ted Jump
5eea3d068f wgl function prototypes moved out to better work with fxwgl 1999-09-17 04:25:10 +00:00
Ted Jump
d29b1c2ea6 Patch error fixup 1999-09-17 03:17:18 +00:00
Ted Jump
1f256fd6b3 Win32 build req't updates 1999-09-17 03:07:28 +00:00
Ted Jump
3849b44d66 I changed the xxxGetProcAddressEXT function declarations to be more
MSVC friendly. Brianp - could you verify that they describe and operate
as intended on Linux/ETC platforms?
1999-09-17 02:44:19 +00:00
Ted Jump
d043adc890 Cleaned up exit from main to prevent MSVC warnings 1999-09-17 02:41:38 +00:00
Ted Jump
83c02efa52 Added ESC key handling 1999-09-17 02:40:51 +00:00
Ted Jump
74783e9936 Update for beta3 1999-09-17 02:37:14 +00:00
Brian Paul
67e9bd246b fixed typo 1999-09-17 01:00:38 +00:00
Brian Paul
6efd0fb9b5 link with -lGL instead of -lMesaGL 1999-09-17 00:55:21 +00:00
Brian Paul
1300ce1e14 added src-glut.beos back in demo files 1999-09-17 00:54:27 +00:00
Brian Paul
738e977580 link with -lGLU -lGL instead of -lMesaGLU -lMesaGL 1999-09-17 00:07:26 +00:00
Brian Paul
f33e6b1e83 version symbol changes 1999-09-17 00:06:57 +00:00
Brian Paul
20298685c3 gluGetProcAddressEXT change for C++ / BeOS 1999-09-17 00:06:14 +00:00
Brian Paul
3d7e15533f updated for GL instead of MesaGL 1999-09-17 00:03:47 +00:00
Brian Paul
4811b7c7e0 initial check-in 1999-09-16 22:45:24 +00:00
Brian Paul
b9e8741c8f added some casts in gluGetProcAddressEXT() 1999-09-16 22:37:56 +00:00
Brian Paul
1447677fa4 GLU_EXT_get_proc_address clean-up 1999-09-16 16:54:22 +00:00
Brian Paul
978b089aee clean-up of GLU_EXT_get_proc_address 1999-09-16 16:53:28 +00:00
Brian Paul
dd4f708894 GL_EXT_get_proc_address clean-up 1999-09-16 16:47:35 +00:00
Brian Paul
9df2b25af1 added GL_EXT_get_proc_address 1999-09-16 16:44:37 +00:00
Brian Paul
4ed71ebbb9 changed archive filenames to beta3 1999-09-16 16:43:38 +00:00
Brian Paul
92460c25a3 added glxinfo 1999-09-16 16:41:03 +00:00
Brian Paul
d2bfe1ee29 initial check-in 1999-09-16 16:40:46 +00:00
Brian Paul
43c9c2cfae added GLX_MESA_set_3dfx_mode. clean-up of glXGetProcAddress 1999-09-16 15:52:51 +00:00
Brian Paul
17f0efb896 changed version string to return 1.2 1999-09-16 15:46:05 +00:00
Keith Whitwell
e3f37862d2 Do pop for GL_VIEWPORT_BIT via. the api 1999-09-16 11:54:56 +00:00
Gareth Hughes
0099981b1c Misc winding rule bug fixes. 1999-09-16 06:41:42 +00:00
Brian Paul
69b78057d1 bumped version strings to Mesa 3.1 1999-09-15 20:04:04 +00:00
Brian Paul
b7064bcf33 misc changes to tar file list 1999-09-15 19:38:28 +00:00
Brian Paul
7bc00c9ca8 minor library name changes 1999-09-15 17:02:06 +00:00
Brian Paul
c8c391d584 removed mention of libMesaGL 1999-09-15 16:39:01 +00:00
Brian Paul
e42048f937 3.1 beta 3 info 1999-09-15 16:34:43 +00:00
Brian Paul
e300ab8b2b new MESA_ version number symbols 1999-09-15 16:32:48 +00:00
Brian Paul
212e625c24 new version number symbols 1999-09-15 16:31:31 +00:00
Brian Paul
cd65179540 added a few more files to the tar list 1999-09-15 15:20:50 +00:00
Brian Paul
2f49a40a07 added third, tiny version number to mklib scripts 1999-09-15 15:11:01 +00:00
Brian Paul
d9bb106726 added third, tiny version number to arguments 1999-09-15 15:10:20 +00:00
Brian Paul
210ef19797 added TINY version symbol 1999-09-15 15:09:00 +00:00
Brian Paul
af19f37b79 removed unused GLcontext arg from a few functions 1999-09-15 13:56:44 +00:00
Gareth Hughes
a852e8fc0f Added debugging pragma message. 1999-09-15 02:12:16 +00:00
Gareth Hughes
d7c9c1e5c0 Fixed vector macro calls, specifically COPY_3V params. 1999-09-15 02:11:10 +00:00
Gareth Hughes
2b2746fedd Added debugging output. 1999-09-14 22:46:02 +00:00
Brian Paul
bbe0c46722 added linux-386-pthread-shared-glide 1999-09-14 12:20:17 +00:00
Gareth Hughes
d21c43cd15 Win32 fix by Eero Pajarre. 1999-09-14 06:23:40 +00:00
Gareth Hughes
77dcf82d81 Fixed legacy gluNextContour impact on gluTessEndContour. 1999-09-14 05:37:58 +00:00
Gareth Hughes
49e0bc42e2 Fixed GLUtriangulatorObj again (spelling). 1999-09-14 03:23:08 +00:00
Gareth Hughes
32c658b057 Fixed definition of GLUtriangluatorObj for 1.3 tessellator. 1999-09-14 01:32:58 +00:00
Brian Paul
de37ce3e22 fixed pixel packing/unpacking code in gluBuild2DMipmaps() 1999-09-14 00:30:28 +00:00
Brian Paul
a96e8ad978 added gluCheckExtension() 1999-09-14 00:11:40 +00:00
Brian Paul
daa0b0f656 added gluUnProject4() 1999-09-14 00:10:31 +00:00
Gareth Hughes
d1603d4a46 Fixed file headers. Tracking down macro bugs. 1999-09-13 22:20:13 +00:00
Jouk Jansen
70cf58648a strcmp needs the string.h 1999-09-13 14:31:32 +00:00
Brian Paul
eada67136a added Eero's multitexture function patch 1999-09-13 14:09:23 +00:00
Jon Taylor
9c097c0f11 Re-added missing GGIMesa context bufsize structure member 1999-09-13 01:08:37 +00:00
Brian Paul
0f9aed04d8 fixed typo in GetProcAddress 1999-09-12 12:04:13 +00:00
Brian Paul
d8ede96148 clean-up of glXGetProcAddressEXT() 1999-09-11 20:13:21 +00:00
Keith Whitwell
6fd3b96822 bugix from raul for fxddbitmap 1999-09-11 16:01:26 +00:00
Brian Paul
84ffacb978 added 1.2 function to gluGetProcAddressEXT() 1999-09-11 12:04:54 +00:00
Brian Paul
c5d7d70be8 GL_EXT_get_proc_address clean-up 1999-09-11 11:48:11 +00:00
Brian Paul
c0e2871718 include extensions.h 1999-09-11 11:47:15 +00:00
Brian Paul
f893f032fa added GLU_EXT_get_proc_address 1999-09-11 11:34:21 +00:00
Brian Paul
89a42b7e73 added GLX_EXT_get_proc_address 1999-09-11 11:33:45 +00:00
Brian Paul
585a68c82b added GL_EXT_get_proc_address 1999-09-11 11:31:34 +00:00
Brian Paul
ed3453350a added GL_EXT_get_proc_address 1999-09-11 11:26:34 +00:00
Keith Whitwell
6c8657fa5f new DD_Z_NEVER flag 1999-09-10 14:24:35 +00:00
Gareth Hughes
f0f3815e4f Fixed triangle output, recovery process termination. 1999-09-10 04:32:10 +00:00
Brian Paul
95740b2c11 changed C++ comments to C style 1999-09-10 03:05:04 +00:00
Gareth Hughes
2856b53e03 Added GLU 1.3 tessellation (except winding rule code). 1999-09-10 02:03:31 +00:00
Brian Paul
2ba7c1cbe4 moved gl_GetPointerv() into get.h 1999-09-09 23:48:02 +00:00
Brian Paul
00dd504c72 moved gl_GetString() into get.c 1999-09-09 23:47:09 +00:00
Miklos Fazekas
e4c15c12d8 More compliant error check. 1999-09-09 18:49:36 +00:00
Brian Paul
36ca6bd82a minor changes. always call compactify_arrays() 1999-09-08 22:14:31 +00:00
Brian Paul
45224face0 removed TexCoordUnit from GLcontext, use Array.ActiveTexture instead 1999-09-07 22:31:30 +00:00
Brian Paul
2ca99ca2e7 added vertices.c 1999-09-07 21:32:30 +00:00
Keith Whitwell
9b7c843671 fixes for the mga driver 1999-09-05 19:59:33 +00:00
Keith Whitwell
324beb95f3 fix for mga depthbuffer resize 1999-09-04 14:40:49 +00:00
Keith Whitwell
da54ffc852 more bugfixes 1999-09-03 15:48:54 +00:00
Keith Whitwell
44c73933e9 Fog, displaylist and zoom operations 1999-09-03 14:56:40 +00:00
Keith Whitwell
8d8e248ab2 fix for GL_COMPILE_AND_EXECUTE bug 1999-09-03 11:53:33 +00:00
Keith Whitwell
b6e6937287 fixed GL_FRONT_AND_BACK cull bug 1999-09-02 13:16:17 +00:00
Jouk Jansen
a4bb2ef30e Added vertices.c to compile list 1999-08-30 07:13:55 +00:00
Keith Whitwell
d858a651d8 removed bogus call 1999-08-29 16:18:23 +00:00
Keith Whitwell
50149b085e more fixes on the fast path 1999-08-29 14:06:02 +00:00
Keith Whitwell
3875679607 new files to support vertex-based geometry 1999-08-29 10:26:31 +00:00
Josh Vanderhoof
4f738b4c10 features weren 1999-08-28 01:38:54 +00:00
Jon Taylor
a43cfd71da Fixed double buffering bug when running in X 1999-08-27 21:06:30 +00:00
Jouk Jansen
443dd9fd4d This time the correct file 1999-08-27 11:02:57 +00:00
Keith Whitwell
2be79c1aa2 various pipeline bugs 1999-08-26 14:50:49 +00:00
Jouk Jansen
0552b30633 Update after disk crash 1999-08-24 12:34:50 +00:00
Jouk Jansen
49160c9a81 Update after disk crash 1999-08-24 12:34:20 +00:00
Jon Taylor
668b4ab2fa *** empty log message *** 1999-08-24 02:03:34 +00:00
Jon Taylor
6583efcfe9 Misc small cleanups 1999-08-23 22:34:08 +00:00
Jon Taylor
e76342e688 Updated to reflect GGIMesa 3.1 changes 1999-08-23 22:22:31 +00:00
Jon Taylor
7b9c36d568 *** empty log message *** 1999-08-23 21:13:19 +00:00
Jon Taylor
72fc9a527d *** empty log message *** 1999-08-22 08:56:50 +00:00
Jon Taylor
14c53fe1d5 *** empty log message *** 1999-08-21 22:46:13 +00:00
Jon Taylor
035e8d0143 *** empty log message *** 1999-08-21 22:36:52 +00:00
Jon Taylor
b35b28e4d9 *** empty log message *** 1999-08-21 08:53:27 +00:00
Jon Taylor
035e96ec3c *** empty log message *** 1999-08-21 06:27:37 +00:00
Jon Taylor
95dcb43951 *** empty log message *** 1999-08-21 05:57:17 +00:00
Brian Paul
212ce73b08 added a few more bug fixes 1999-08-20 01:19:36 +00:00
Brian Paul
b30e70436c fixed alpha channel problem in gl_blend_pixels() 1999-08-19 15:48:01 +00:00
Brian Paul
a4dcdcf0ff initial check-in (post crash) 1999-08-19 13:57:42 +00:00
Brian Paul
2d550f6ff1 initial check-in (post-crash) 1999-08-19 13:52:56 +00:00
Brian Paul
5a41d02502 minor change for irix-debug 1999-08-19 13:26:16 +00:00
Brian Paul
65b5e1e3fd glIsEnabled(GL_TEXTURE_3D) was wrong 1999-08-19 13:24:27 +00:00
Brian Paul
cddc583aeb testing 1999-08-19 11:54:28 +00:00
267 changed files with 70583 additions and 4218 deletions

View File

@@ -1,8 +1,9 @@
# $Id: Make-config,v 1.1 1999/08/19 00:55:39 jtg Exp $
# $Id: Make-config,v 1.5 1999/09/15 17:02:06 brianp Exp $
MAJOR=3
MINOR=1
VERSION=$(MAJOR).$(MINOR)
MESA_MAJOR=3
MESA_MINOR=1
MESA_TINY=0
VERSION=$(MESA_MAJOR).$(MESA_MINOR)
# Mesa 3-D graphics library
#
@@ -28,8 +29,8 @@ VERSION=$(MAJOR).$(MINOR)
# The following variables are passed to each Makefile:
#
# GL_LIB the name of the Mesa "GL" library file (usually libMesaGL.a)
# GLU_LIB the name of the Mesa "GLU" library file (usually libMesaGLU.a)
# GL_LIB the name of the Mesa "GL" library file (usually libGL.a)
# GLU_LIB the name of the Mesa "GLU" library file (usually libGLU.a)
# GLUT_LIB the name of the GLUT library file (usually libglut.a)
# CC the C compiler (usually cc or gcc)
# CFLAGS flags to C compiler (usually -O)
@@ -590,6 +591,18 @@ linux-3dnow-glide:
FX/X86/fx_3dnow_fastpath.S"
# Contributed by C. Alex. North-Keys (erlkonig@talisman.org)
linux-386-pthread-shared-glide:
$(MAKE) $(MFLAGS) targets \
"GL_LIB = libGL.so" \
"GLU_LIB = libGLU.so" \
"GLUT_LIB = libglut.so" \
"CC = gcc" \
"CFLAGS = -O3 -fPIC -funroll-loops -ansi -pedantic -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DSHM -DUSE_X86_ASM -D_REENTRANT -DTHREADS -DPTHREADS -DFX -I/usr/include/glide -I/usr/local/glide/include" \
"MAKELIB = ../mklib.glide" \
"XLIBS = -L/usr/X11/lib -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lpthread" \
"ASM_SOURCES = asm_386.S"
# Contributed by Uwe_Maurer@t-online.de
linux-ggi:
$(MAKE) $(MFLAGS) -f Makefile.X11 targets \

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.1 1999/08/19 00:55:39 jtg Exp $
# $Id: Makefile.X11,v 1.9 1999/09/20 21:06:57 keithw Exp $
# Mesa 3-D graphics library
# Version: 3.1
@@ -84,6 +84,7 @@ default:
@echo " make linux-3dnow-glide for Linux on AMD w/ 3DNow! for Glide"
@echo " make linux-386-pthread for Linux w/ Intel assembly and linuxthreads"
@echo " make linux-386-pthread-shared for Linux w/ Intel assembly and linuxthreads"
@echo " make linux-386-pthread-shared-glide for Linux w/ Intel assembly, linuxthreads, and 3Dfx Glide driver"
@echo " make linux-sparc for Linux on Sparc systems"
@echo " make linux-sparc5-elf for Sparc5 systems, make ELF shared libs"
@echo " make linux-sparc-ultra for UltraSparc systems, make ELF shared libs"
@@ -137,7 +138,7 @@ default:
aix aix-sl amix bsdos bsdos4 dgux freebsd freebsd-386 gcc \
hpux9 hpux9-sl hpux9-gcc hpux9-gcc-sl \
hpux10 hpux10-sl hpux10-gcc hpux10-gcc-sl \
irix-debug irix4 irix5 irix5-gcc irix5-dso irix6-o32 irix6-o32-dso \
irix4 irix5 irix5-gcc irix5-dso irix6-o32 irix6-o32-dso \
linux linux-debug linux-prof linux-elf linux-elf-debug \
linux-glide linux-386-glide linux-386-opt-glide \
linux-386-opt-V2-glide \
@@ -145,7 +146,7 @@ linux-386 linux-386-elf \
linux-3dnow linux-3dnow-glide \
linux-alpha linux-alpha-elf \
linux-ppc linux-ppc-so \
linux-386-pthread linux-386-pthread-shared \
linux-386-pthread linux-386-pthread-shared linux-386-pthread-shared-glide \
linux-sparc \
linux-sparc5-elf \
linux-sparc-ultra \
@@ -169,7 +170,7 @@ sunos5-x11r6-gcc-sl ultrix-gcc unicos unixware uwin vistra:
if [ -d book ] ; then cd book ; $(MAKE) -f Makefile.X11 $@ ; fi
irix6-n32 irix6-n32-dso irix6-gcc-n32-sl:
irix6-n32 irix6-n32-dso irix6-gcc-n32-sl irix-debug:
-mkdir lib32
touch src/depend
touch src-glu/depend
@@ -313,8 +314,8 @@ realclean: clean
DIRECTORY = Mesa-3.1
LIB_NAME = MesaLib-3.1beta2
DEMO_NAME = MesaDemos-3.1beta2
LIB_NAME = MesaLib-3.1beta3
DEMO_NAME = MesaDemos-3.1beta3
LIB_FILES = \
@@ -334,18 +335,21 @@ LIB_FILES = \
$(DIRECTORY)/missing \
$(DIRECTORY)/mkinstalldirs \
$(DIRECTORY)/stamp-h.in \
$(DIRECTORY)/INSTALL \
$(DIRECTORY)/INSTALL.GNU \
$(DIRECTORY)/configure \
$(DIRECTORY)/docs/CONFIG \
$(DIRECTORY)/docs/CONFORM \
$(DIRECTORY)/docs/COPYING \
$(DIRECTORY)/docs/COPYRIGHT \
$(DIRECTORY)/docs/DEVINFO \
$(DIRECTORY)/docs/IAFA-PACKAGE \
$(DIRECTORY)/docs/LICENSE \
$(DIRECTORY)/docs/INSTALL \
$(DIRECTORY)/docs/INSTALL.GNU \
$(DIRECTORY)/docs/README \
$(DIRECTORY)/docs/README.* \
$(DIRECTORY)/docs/RELNOTES \
$(DIRECTORY)/docs/VERSIONS \
$(DIRECTORY)/docs/*.spec \
$(DIRECTORY)/bin/README \
$(DIRECTORY)/bin/mklib* \
$(DIRECTORY)/*.BAT \
$(DIRECTORY)/*.bat \
@@ -357,6 +361,8 @@ LIB_FILES = \
$(DIRECTORY)/Names.win \
$(DIRECTORY)/win32-openstep.sh \
$(DIRECTORY)/*.dja \
$(DIRECTORY)/include/GL/Makefile.in \
$(DIRECTORY)/include/GL/Makefile.am \
$(DIRECTORY)/include/GL/dosmesa.h \
$(DIRECTORY)/include/GL/foomesa.h \
$(DIRECTORY)/include/GL/fxmesa.h \
@@ -375,9 +381,12 @@ LIB_FILES = \
$(DIRECTORY)/include/GL/xmesa_x.h \
$(DIRECTORY)/include/GL/xmesa_xf86.h \
$(DIRECTORY)/include/GLView.h \
$(DIRECTORY)/include/Makefile.in \
$(DIRECTORY)/include/Makefile.am \
$(DIRECTORY)/src/Makefile* \
$(DIRECTORY)/src/descrip.mms \
$(DIRECTORY)/src/mms_depend \
$(DIRECTORY)/src/mesa.conf \
$(DIRECTORY)/src/*.def \
$(DIRECTORY)/src/depend \
$(DIRECTORY)/src/*.[chS] \
@@ -394,28 +403,53 @@ LIB_FILES = \
$(DIRECTORY)/src/D3D/*DEF \
$(DIRECTORY)/src/DOS/DEPEND.DOS \
$(DIRECTORY)/src/DOS/*.c \
$(DIRECTORY)/src/FX/Makefile.am \
$(DIRECTORY)/src/FX/Makefile.in \
$(DIRECTORY)/src/FX/*.[ch] \
$(DIRECTORY)/src/FX/*.def \
$(DIRECTORY)/src/GGI/*.[ch] \
$(DIRECTORY)/src/GGI/ggimesa.conf \
$(DIRECTORY)/src/GGI/default/*.c \
$(DIRECTORY)/src/GGI/default/Makefile \
$(DIRECTORY)/src/GGI/display/*.c \
$(DIRECTORY)/src/GGI/display/Makefile \
$(DIRECTORY)/src/FX/X86/Makefile.am \
$(DIRECTORY)/src/FX/X86/Makefile.in \
$(DIRECTORY)/src/FX/X86/*.[Shc] \
$(DIRECTORY)/src/GGI/Makefile.am \
$(DIRECTORY)/src/GGI/Makefile.in \
$(DIRECTORY)/src/GGI/*.[ch] \
$(DIRECTORY)/src/GGI/ggimesa.conf.in \
$(DIRECTORY)/src/GGI/default/*.c \
$(DIRECTORY)/src/GGI/default/Makefile.am \
$(DIRECTORY)/src/GGI/default/Makefile.in \
$(DIRECTORY)/src/GGI/default/genkgi.conf.in \
$(DIRECTORY)/src/GGI/display/*.c \
$(DIRECTORY)/src/GGI/display/Makefile.am \
$(DIRECTORY)/src/GGI/display/Makefile.in \
$(DIRECTORY)/src/GGI/display/fbdev.conf.in \
$(DIRECTORY)/src/GGI/include/Makefile.am \
$(DIRECTORY)/src/GGI/include/Makefile.in \
$(DIRECTORY)/src/GGI/include/ggi/Makefile.am \
$(DIRECTORY)/src/GGI/include/ggi/Makefile.in \
$(DIRECTORY)/src/GGI/include/ggi/mesa/Makefile.am \
$(DIRECTORY)/src/GGI/include/ggi/mesa/Makefile.in \
$(DIRECTORY)/src/GGI/include/ggi/mesa/*.h \
$(DIRECTORY)/src/KNOWN_BUGS \
$(DIRECTORY)/src/MGL/*.[ch] \
$(DIRECTORY)/src/MGL/*.txt \
$(DIRECTORY)/src/OSmesa/Makefile.am \
$(DIRECTORY)/src/OSmesa/Makefile.in \
$(DIRECTORY)/src/OSmesa/*.[ch] \
$(DIRECTORY)/src/S3/*.[ch] \
$(DIRECTORY)/src/S3/*.def \
$(DIRECTORY)/src/S3/*.mak \
$(DIRECTORY)/src/S3/*.rc \
$(DIRECTORY)/src/SVGA/Makefile.am \
$(DIRECTORY)/src/SVGA/Makefile.in \
$(DIRECTORY)/src/SVGA/*.[ch] \
$(DIRECTORY)/src/Windows/*.[ch] \
$(DIRECTORY)/src/Windows/*.def \
$(DIRECTORY)/src/X/Makefile.am \
$(DIRECTORY)/src/X/Makefile.in \
$(DIRECTORY)/src/X/*.[ch] \
$(DIRECTORY)/src/X86/*.[ch] \
$(DIRECTORY)/src/X86/Makefile \
$(DIRECTORY)/src/X86/Makefile.am \
$(DIRECTORY)/src/X86/Makefile.in \
$(DIRECTORY)/src/X86/*.m4 \
$(DIRECTORY)/src/X86/*.S \
$(DIRECTORY)/src/*.dja \
@@ -430,6 +464,8 @@ LIB_FILES = \
$(DIRECTORY)/widgets-mesa \
$(DIRECTORY)/widgets-sgi \
$(DIRECTORY)/util/README \
$(DIRECTORY)/util/Makefile.am \
$(DIRECTORY)/util/Makefile.in \
$(DIRECTORY)/util/*.[ch] \
$(DIRECTORY)/util/sampleMakefile \
$(DIRECTORY)/BeOS/Makefile \

153
bin/mklib.aix Executable file
View File

@@ -0,0 +1,153 @@
#!/bin/ksh
# Make an AIX shared library (tricky!!!)
# Based on a script from Athanasios G. Gaitatzes (gaitat@vnet.ibm.com)
# Improved by Greg Thompson <gregt@visix.com> -gt
#--identification------------------------------------------------------
# $Id: mklib.aix,v 1.2 1999/09/15 15:10:20 brianp Exp $
# $Log: mklib.aix,v $
# Revision 1.2 1999/09/15 15:10:20 brianp
# added third, tiny version number to arguments
#
# Revision 1.1 1999/08/19 13:52:56 brianp
# initial check-in (post-crash)
#
#--common--------------------------------------------------------------
LIBRARY=$1
shift 1
MAJOR=$1
shift 1
MINOR=$1
shift 1
TINY=$1
shift 1
OBJECTS=$*
#--platform------------------------------------------------------------
# BASENAME = LIBRARY without .a suffix
BASENAME=`echo ${LIBRARY} | sed "s/\.a//g"`
# Name of exports file
EXPFILE=${BASENAME}.exp
# Name of temporary shared lib file
OFILE=shr.o
####OFILE=${BASENAME}.o
# Remove any old files from previous make
rm -f ${LIBRARY} ${EXPFILE} ${OFILE}
# Pick a way to use nm -gt
NM=${NM-/bin/nm -eC}
# Determine which version of AIX this is
AIXVERSION=`uname -v`
# Pick a way to tell the linker there's no entrypoint -gt
case ${AIXVERSION}
{
3*)
ENTRY='-e _nostart'
;;
4*)
ENTRY=-bnoentry
;;
*)
echo "Error in mklib.aix!"
exit 1
;;
}
# Other libraries which we may be dependent on. Since we make the libraries
# in the order libGL.a, libaGLU.a, libglut.a just depends on its predecessor.
# modified to make otherlibs in the form of -lfoo -gt
OTHERLIBS=`ls ../lib/*.a | sed "s/..\/lib\/lib/-l/g" | sed "s/\.a//g"`
##echo OTHERLIBS are ${OTHERLIBS}
# Make exports (.exp) file header
echo "#! ${LIBRARY}" > ${EXPFILE}
# Append list of exported symbols to exports file -gt
case ${AIXVERSION}
{
3*)
${NM} ${OBJECTS} | awk -F'|' '{
if ($3 != "extern" || substr($7,1,1) == " ") continue
sub (" *", "", $1); sub (" *", "", $7)
if ( (($7 == ".text") || ($7 == ".data") || ($7 == ".bss")) \
&& ( substr($1,1,1) != ".")) {
if (substr ($1, 1, 7) != "__sinit" &&
substr ($1, 1, 7) != "__sterm") {
if (substr ($1, 1, 5) == "__tf1")
print (substr ($1, 7))
else if (substr ($1, 1, 5) == "__tf9")
print (substr ($1, 15))
else
print $1
}
}
}' | sort -u >> ${EXPFILE}
;;
4*)
${NM} ${OBJECTS} | awk '{
if ((($2 == "T") || ($2 == "D") || ($2 == "B")) \
&& ( substr($1,1,1) != ".")) {
if (substr ($1, 1, 7) != "__sinit" &&
substr ($1, 1, 7) != "__sterm") {
if (substr ($1, 1, 5) == "__tf1")
print (substr ($1, 7))
else if (substr ($1, 1, 5) == "__tf9")
print (substr ($1, 15))
else
print $1
}
}
}' | sort -u >> ${EXPFILE}
;;
}
# This next line is a hack to allow full compatibility with IBM's OpenGL
# libraries. IBM mistakenly exports glLoadIdentity from the libGLU.a
# library. We have to do the same thing. Problem reported by Yemi Adesanya
# (adesanya@afsmail.cern.ch) and Patrick Brown (pbrown@austin.ibm.com)
if [ "${BASENAME}" = libGLU ] ; then
echo "glLoadIdentity" >> ${EXPFILE}
fi
# Make the shared lib file
cc -o ${OFILE} ${OBJECTS} -L../lib ${OTHERLIBS} -lX11 -lXext -lXmu -lXi -lm -lc -bE:${EXPFILE} -bM:SRE ${ENTRY}
# Make the .a file
ar ruv ${LIBRARY} ${OFILE}
# Put exports file in Mesa lib directory
mv ${EXPFILE} ../lib
# Remove OFILE
rm -f ${OFILE}
#NOTES
# AIX 4.x /usr/bin/nm -B patch from ssclift@mach.me.queensu.ca (Simon Clift)
# Robustified symbol extraction for AIX 3 and 4
# Greg Thompson <gregt@visix.com>

38
bin/mklib.ar-ruv Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/sh
# Make a standard Unix .a library file with 'ar ruv'
#--identification------------------------------------------------------
# $Id: mklib.ar-ruv,v 1.2 1999/09/15 15:10:20 brianp Exp $
# $Log: mklib.ar-ruv,v $
# Revision 1.2 1999/09/15 15:10:20 brianp
# added third, tiny version number to arguments
#
# Revision 1.1 1999/08/19 13:52:57 brianp
# initial check-in (post-crash)
#
#--common--------------------------------------------------------------
LIBRARY=$1
shift 1
MAJOR=$1
shift 1
MINOR=$1
shift 1
TINY=$1
shift 1
OBJECTS=$*
#--platform-------------------------------------------------------------
#ar ruv $LIBRARY $OBJECTS
ar ru $LIBRARY $OBJECTS

52
bin/mklib.solaris Normal file
View File

@@ -0,0 +1,52 @@
#!/bin/sh
# Make a Solaris shared library
# contributed by Arno Hahma (arno@nitro.pp.utu.fi)
#--identification------------------------------------------------------
# $Id: mklib.solaris,v 1.2 1999/09/15 15:10:20 brianp Exp $
# $Log: mklib.solaris,v $
# Revision 1.2 1999/09/15 15:10:20 brianp
# added third, tiny version number to arguments
#
# Revision 1.1 1999/08/19 13:53:06 brianp
# initial check-in (post-crash)
#
#--common--------------------------------------------------------------
LIBRARY=$1
shift 1
MAJOR=$1
shift 1
MINOR=$1
shift 1
TINY=$1
shift 1
OBJECTS=$*
#--platform-------------------------------------------------------------
set -x
LIBRARY=`basename $LIBRARY .a`
VERSION=$MAJOR.$MINOR
echo "Building shared object $LIBRARY.so.$VERSION and the archive library $LIBRARY.a"
rm -f ${LIBRARY}.a ${LIBRARY}.so.${VERSION}
ar ruv ${LIBRARY}.a ${OBJECTS}
ld -G -o ${LIBRARY}.so.${VERSION} ${OBJECTS}
cp ${LIBRARY}.a ${LIBRARY}.so.${VERSION} ../lib
cd ../lib
ln -s ${LIBRARY}.so.${VERSION} ${LIBRARY}.so

View File

@@ -1,172 +1,26 @@
LibGGI driver for Mesa-3.0
by Uwe Maurer (uwe_maurer@t-online.de)
GGIMesa for LibGGI 2.x
Requirements:
-------------
LibGGI 2.0 or greater
Introduction
============
[from libggi.txt by Steve Cheng and Hartmut Niemann]
Installation:
-------------
To install GGIMesa, follow the instructions in INSTALL.GNU. If you
wish to install GGIGLUT as well, first install GGIMesa and then run
"LibGGI, the dynamic GGI (General Graphics Interface) library is a
flexible drawing library.
make
make install (must be root)
It provides an opaque interface to the display's acceleration
functions. It was originally intended to allow user programs to
interface with KGI, the kernel side of the GGI code, but other display
types can be easily used by loading the appropriate "display target"
(e.g. X, memory).
in ggi/ggiglut.
LibGGI consists of a main library (libggi.so) and a multitude of
dynamic drivers. The library then loads the necessary "drivers" for
the requested mode, taking hints from the graphics device if
necessary. LibGGI can also load extension libraries, e.g. to provide
enhanced 2D and 3D functions.
Notes:
------
It has been designed after having a look at several existing
libraries, and so far we have found porting to be quite simple from
and to most of them."
* Set the environment variables GGIMESA_DEBUG and/or GGIGLUT_DEBUG
to 255 to see lots of debugging output.
----------------------------------------------------------------------------
More information about the GGI project and LibGGI can be
obtained from the GGI website:
www.ggi-project.org
----------------------------------------------------------------------------
Installation
============
- Install LibGGI
- Unpack the Mesa archives
- In the Mesa directory type:
make linux-ggi
su
make linux-ggi-install
exit
- Now you can try some demos.
If they don't work, you can set the GGIMESA_DEBUG
variable to 255 and you will see some information from the
LibGGI-driver.
export GGIMESA_DEBUG=255
GLUT
====
You can change these default values in ggi/ggiglut.c:
#define WIDTH 640
#define HEIGHT 400
#define GRAPHTYPE_RGB GT_16BIT
#define GRAPHTYPE_INDEX GT_8BIT
Options:
-bpp x Set graphic mode with x bits per pixel
-size x y Screen (or window) is x*y pixels
Example:
demos/gears -size 320 200 -bpp 24
Updates
=======
You can find the latest LibGGI-driver and ggiglut on my
homepage:
http://home.t-online.de/home/uwe_maurer/ggimesa.htm
Uwe Maurer - uwe_maurer@t-online.de
LibGGI driver for Mesa-3.0
by Uwe Maurer (uwe_maurer@t-online.de)
Introduction
============
[from libggi.txt by Steve Cheng and Hartmut Niemann]
"LibGGI, the dynamic GGI (General Graphics Interface) library is a
flexible drawing library.
It provides an opaque interface to the display's acceleration
functions. It was originally intended to allow user programs to
interface with KGI, the kernel side of the GGI code, but other display
types can be easily used by loading the appropriate "display target"
(e.g. X, memory).
LibGGI consists of a main library (libggi.so) and a multitude of
dynamic drivers. The library then loads the necessary "drivers" for
the requested mode, taking hints from the graphics device if
necessary. LibGGI can also load extension libraries, e.g. to provide
enhanced 2D and 3D functions.
It has been designed after having a look at several existing
libraries, and so far we have found porting to be quite simple from
and to most of them."
----------------------------------------------------------------------------
More information about the GGI project and LibGGI can be
obtained from the GGI website:
www.ggi-project.org
----------------------------------------------------------------------------
Installation
============
- Install LibGGI
- Unpack the Mesa archives
- In the Mesa directory type:
make linux-ggi
su
make linux-ggi-install
exit
- Now you can try some demos.
If they don't work, you can set the GGIMESA_DEBUG
variable to 255 and you will see some information from the
LibGGI-driver.
export GGIMESA_DEBUG=255
GLUT
====
You can change these default values in ggi/ggiglut.c:
#define WIDTH 640
#define HEIGHT 400
#define GRAPHTYPE_RGB GT_16BIT
#define GRAPHTYPE_INDEX GT_8BIT
Options:
-bpp x Set graphic mode with x bits per pixel
-size x y Screen (or window) is x*y pixels
Example:
demos/gears -size 320 200 -bpp 24
Updates
=======
You can find the latest LibGGI-driver and ggiglut on my
homepage:
http://home.t-online.de/home/uwe_maurer/ggimesa.htm
Uwe Maurer - uwe_maurer@t-online.de
* GGIGLUT contains support for all of the GLUT 3.6 API except for the
high-level primitive drawing functions, but many of the functions (in
particular the menu drawing functions) are just stubs.

View File

@@ -1,15 +1,32 @@
Mesa/Readme.win32
Last Updated: Friday, July 9th, 1999 - tjump@tertius.com
Last Updated: Sunday, September 19th, 1999 - tjump@tertius.com
*** What's New
- Updated for Mesa 3.1beta2/CVS.
- Updated for Mesa 3.1beta3/CVS. Debug and Release command-line builds of
Mesa, fxMesa, GLU, GLUT and all sample programs DLL-based. Manual
executions tests with minimum requisite results (aka: things looked like
I expected them to).
What did you expect, complete regression testing maybe?
- NASM build support. Any file in the project coded as a .S file will
automatically be recognized and built as a NASM-source assember file.
To enable building using NASM, set the environment variable NASM to
indicate that command to execute to run nasm on a file. If NASM is in
your command search path then all this needs be set to is 'nasmw' -
otherwise you will need to include the complete drive and directory path.
NASM may be retrieved here: http://www.web-sites.co.uk/nasm/
- DevStudio projects suspended for compatability reasons: projects modified
by DevStudio 6 are not compatible with DevStudio 5.
These will slowly be rebuilt and put into CVS as I can.
- Build environment change: The Glide SDK is no longer assumed to be in
the global INCLUDE/LIB environment vars, it is required that you set the
value 'GLIDE2X' as either an environment variable pointing to your Glide

View File

@@ -40,16 +40,6 @@ Header and library files:
(actually, use "cp -d" on Linux to preserve symbolic links)
Create a few symbolic links so that compiling OpenGL applications is easy:
cd /usr/local/lib
IF USING STATIC (lib*.a) FILES THEN
ln -s libMesaGL.a libGL.a
ln -s libMesaGLU.a libGLU.a
ELSE
ln -s libMesaGL.so libGL.so
ln -s libMesaGLU.so libGLU.so
ENDIF
Xt/Motif widgets:
If you want to use Mesa or OpenGL in your Xt/Motif program you can build
@@ -108,8 +98,6 @@ Remote display of OpenGL/GLX programs:
in /usr/local/Mesa and using the C-shell:
% cd /usr/local/Mesa
% make irix5-dso
% cd lib
% ln -s libMesaGL.so libGL.so
% setenv _RLD_LIST "/usr/local/Mesa/lib/libGL.so:DEFAULT"
% /usr/demos/bin/ideas_ogl // this is a test
@@ -313,4 +301,4 @@ Summary of X-related environment variables:
----------------------------------------------------------------------
$Id: README.X11,v 3.2 1998/10/03 12:48:50 brianp Exp $
$Id: README.X11,v 3.3 1999/09/15 16:39:01 brianp Exp $

View File

@@ -1,4 +1,4 @@
$Id: VERSIONS,v 1.10 1999/07/30 18:58:30 brianp Exp $
$Id: VERSIONS,v 1.13 1999/09/19 20:09:00 tanner Exp $
Mesa Version History
@@ -644,12 +644,18 @@ Mesa Version History
- new copyright on core Mesa code
3.1 beta 3 August ??, 1999
3.1 beta 3 September 17, 1999
New:
- optimized glAccum function
- optimized 24bpp rendering in XMesa driver
- GLU 1.2 polygon tessellator
Bug Fixes:
- glGetTexLevelParameter wasn't fully implemented
- glXUseXFont now handles multi-byte fonts
- glIsEnabled(GL_TEXTURE_2D / 3D) returned wrong result
- alpha channel of blending points, lines was sometimes incorrect
Changes:
- New library names: libGL.so and libGLU.so
- New library names: "libGL" instead of "libMesaGL"
- New library numbering: libGL.so.1.2.310
- New subdirectories: docs/ and bin/
- New Makefile-system (autoconf,automake,libtool)

View File

@@ -22,9 +22,13 @@ if HAVE_X11
INC_X11 = glx.h glx_mangle.h xmesa.h xmesa_x.h xmesa_xf86.h
endif
if NEED_GLUT
INC_GLUT = glut.h
endif
EXTRA_DIST = fxmesa.h ggimesa.h osmesa.h svgamesa.h \
glx.h glx_mangle.h xmesa.h xmesa_x.h xmesa_xf86.h
GLinclude_HEADERS = gl.h gl_mangle.h glu.h glu_mangle.h \
$(INC_FX) $(INC_GGI) $(INC_OSMESA) $(INC_SVGA) $(INC_X11)
$(INC_FX) $(INC_GGI) $(INC_OSMESA) $(INC_SVGA) $(INC_X11) $(INC_GLUT)

View File

@@ -1,4 +1,4 @@
/* $Id: ggimesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: ggimesa.h,v 1.2 1999/08/23 22:34:08 jtaylor Exp $ */
/*
* Mesa 3-D graphics library
@@ -24,8 +24,11 @@
/*
* $Log: ggimesa.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.2 1999/08/23 22:34:08 jtaylor
* Misc small cleanups
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 1.2 1998/09/29 01:46:40 brianp
* applied Emmanuel Marty's patches for latest GGI
@@ -49,16 +52,16 @@ typedef struct ggi_mesa_context *GGIMesaContext;
extern GGIMesaContext GGIMesaCreateContext(void);
extern void GGIMesaDestroyContext( GGIMesaContext ctx );
extern void GGIMesaDestroyContext(GGIMesaContext ctx);
extern void GGIMesaMakeCurrent(GGIMesaContext ctx );
extern void GGIMesaMakeCurrent(GGIMesaContext ctx);
extern GGIMesaContext GGIMesaGetCurrentContext( void );
extern GGIMesaContext GGIMesaGetCurrentContext(void);
extern void GGIMesaSwapBuffers( void );
extern void GGIMesaSwapBuffers(void);
extern int GGIMesaSetVisual(GGIMesaContext ctx,ggi_visual_t vis,
GLboolean rgb_flag,GLboolean db_flag);
extern int GGIMesaSetVisual(GGIMesaContext ctx, ggi_visual_t vis,
GLboolean rgb_flag, GLboolean db_flag);
#ifdef __cplusplus
}

View File

@@ -1,4 +1,4 @@
/* $Id: gl.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: gl.h,v 1.8 1999/09/19 02:03:18 tjump Exp $ */
/*
* Mesa 3-D graphics library
@@ -57,10 +57,13 @@
# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */
# if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
# define GLAPI __declspec(dllexport)
# define WGLAPI __declspec(dllexport)
# elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
# define GLAPI __declspec(dllimport)
# define WGLAPI __declspec(dllimport)
# else /* for use with static link lib build of Win32 edition only */
# define GLAPI extern
# define WGLAPI __declspec(dllimport)
# endif /* _STATIC_MESA support */
# define GLAPIENTRY __stdcall
# define GLCALLBACK __stdcall
@@ -107,25 +110,8 @@ typedef unsigned long COLORREF;
# endif /* !UNICODE */
typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT;
GLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
GLAPI HGLRC GLAPIENTRY wglCreateContext(HDC);
GLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC, int);
GLAPI int GLAPIENTRY wglDeleteContext(HGLRC);
GLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
GLAPI HDC GLAPIENTRY wglGetCurrentDC(void);
GLAPI PROC GLAPIENTRY wglGetProcAddress(char*);
GLAPI int GLAPIENTRY wglMakeCurrent(HDC, HGLRC);
GLAPI int GLAPIENTRY wglShareLists(HGLRC, HGLRC);
GLAPI int GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, unsigned long);
GLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long);
GLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
GLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
GLAPI int GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR);
GLAPI int GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *);
GLAPI int GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *);
GLAPI int GLAPIENTRY wglRealizeLayerPalette(HDC, int, int);
GLAPI int GLAPIENTRY wglSwapLayerBuffers(HDC, unsigned int);
GLAPI int GLAPIENTRY SwapBuffers(HDC);
typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR;
#include <gl/mesa_wgl.h>
#endif
@@ -1859,7 +1845,7 @@ GLAPI void GLAPIENTRY glPopName( void );
/*
* 1.0 Extensions
* Extensions
*/
/* GL_EXT_blend_minmax */
@@ -2187,6 +2173,19 @@ GLAPI void GLAPIENTRY glLockArraysEXT( GLint first, GLsizei count );
GLAPI void GLAPIENTRY glUnlockArraysEXT( void );
/*
* GL_EXT_get_proc_address
*
* XXX this is a preliminary extension. It may change! Use at your
* own risk! Do not release code which uses this extension yet!
* If you want to try it out, #define GL_EXT_get_proc_address before
* #include <GL/gl.h>
*/
#define GL_EXT_get_proc_address 1
#ifdef GL_EXT_get_proc_address
GLAPI void (GLAPIENTRY *glGetProcAddressEXT(const GLubyte *procName))();
#endif
#if defined(__BEOS__) || defined(__QUICKDRAW__)
#pragma export off
#endif

View File

@@ -1,4 +1,4 @@
/* $Id: glu.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: glu.h,v 1.10 1999/09/19 10:04:01 tjump Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,8 +23,34 @@
/*
* $Log: glu.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.10 1999/09/19 10:04:01 tjump
* Changed name 'glGetProcAddressEXT' to 'gluGetProcAddressEXT'
*
* Revision 1.8 1999/09/17 12:21:36 brianp
* glGetProcAddressEXT changes to accomodate Win32 and non-Win32
*
* Revision 1.7 1999/09/17 02:44:19 tjump
* I changed the xxxGetProcAddressEXT function declarations to be more
* MSVC friendly. Brianp - could you verify that they describe and operate
* as intended on Linux/ETC platforms?
*
* Revision 1.6 1999/09/16 16:54:22 brianp
* GLU_EXT_get_proc_address clean-up
*
* Revision 1.5 1999/09/14 03:23:08 gareth
* Fixed GLUtriangulatorObj again (spelling).
*
* Revision 1.4 1999/09/14 01:32:58 gareth
* Fixed definition of GLUtriangluatorObj for 1.3 tessellator.
*
* Revision 1.3 1999/09/11 11:34:21 brianp
* added GLU_EXT_get_proc_address
*
* Revision 1.2 1999/09/10 02:08:18 gareth
* Added GLU 1.3 tessellation (except winding rule code).
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.6 1999/02/14 03:39:45 brianp
* updated for BeOS R4
@@ -88,6 +114,7 @@ extern "C" {
#define GLU_VERSION_1_1 1
#define GLU_VERSION_1_2 1
#define GLU_TRUE GL_TRUE
@@ -110,30 +137,42 @@ enum {
GLU_OUTSIDE = 100020,
GLU_INSIDE = 100021,
/* Tesselator */
GLU_BEGIN = 100100,
GLU_VERTEX = 100101,
GLU_END = 100102,
GLU_ERROR = 100103,
GLU_EDGE_FLAG = 100104,
/* Tessellator */
GLU_TESS_BEGIN = 100100,
GLU_TESS_VERTEX = 100101,
GLU_TESS_END = 100102,
GLU_TESS_ERROR = 100103,
GLU_TESS_EDGE_FLAG = 100104,
GLU_TESS_COMBINE = 100105,
/* Contour types */
GLU_CW = 100120,
GLU_CCW = 100121,
GLU_INTERIOR = 100122,
GLU_EXTERIOR = 100123,
GLU_UNKNOWN = 100124,
GLU_TESS_BEGIN_DATA = 100106,
GLU_TESS_VERTEX_DATA = 100107,
GLU_TESS_END_DATA = 100108,
GLU_TESS_ERROR_DATA = 100109,
GLU_TESS_EDGE_FLAG_DATA = 100110,
GLU_TESS_COMBINE_DATA = 100111,
/* Tesselation errors */
GLU_TESS_ERROR1 = 100151, /* missing gluEndPolygon */
GLU_TESS_ERROR2 = 100152, /* missing gluBeginPolygon */
GLU_TESS_ERROR3 = 100153, /* misoriented contour */
GLU_TESS_ERROR4 = 100154, /* vertex/edge intersection */
GLU_TESS_ERROR5 = 100155, /* misoriented or self-intersecting loops */
GLU_TESS_ERROR6 = 100156, /* coincident vertices */
GLU_TESS_ERROR7 = 100157, /* all vertices collinear */
GLU_TESS_ERROR8 = 100158, /* intersecting edges */
GLU_TESS_ERROR9 = 100159, /* not coplanar contours */
/* Winding rules */
GLU_TESS_WINDING_ODD = 100130,
GLU_TESS_WINDING_NONZERO = 100131,
GLU_TESS_WINDING_POSITIVE = 100132,
GLU_TESS_WINDING_NEGATIVE = 100133,
GLU_TESS_WINDING_ABS_GEQ_TWO = 100134,
/* Tessellation properties */
GLU_TESS_WINDING_RULE = 100140,
GLU_TESS_BOUNDARY_ONLY = 100141,
GLU_TESS_TOLERANCE = 100142,
/* Tessellation errors */
GLU_TESS_ERROR1 = 100151, /* Missing gluBeginPolygon */
GLU_TESS_ERROR2 = 100152, /* Missing gluBeginContour */
GLU_TESS_ERROR3 = 100153, /* Missing gluEndPolygon */
GLU_TESS_ERROR4 = 100154, /* Missing gluEndContour */
GLU_TESS_ERROR5 = 100155, /* */
GLU_TESS_ERROR6 = 100156, /* */
GLU_TESS_ERROR7 = 100157, /* */
GLU_TESS_ERROR8 = 100158, /* */
/* NURBS */
GLU_AUTO_LOAD_MATRIX = 100200,
@@ -201,21 +240,40 @@ enum {
/* New in GLU 1.1 */
GLU_VERSION = 100800,
GLU_EXTENSIONS = 100801
GLU_EXTENSIONS = 100801,
/*** GLU 1.0 tessellation - obsolete! ***/
/* Contour types */
GLU_CW = 100120,
GLU_CCW = 100121,
GLU_INTERIOR = 100122,
GLU_EXTERIOR = 100123,
GLU_UNKNOWN = 100124,
/* Tessellator */
GLU_BEGIN = GLU_TESS_BEGIN,
GLU_VERTEX = GLU_TESS_VERTEX,
GLU_END = GLU_TESS_END,
GLU_ERROR = GLU_TESS_ERROR,
GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG
};
/*
* These are the GLU 1.1 typedefs. GLU 1.2 has different ones!
* These are the GLU 1.1 typedefs. GLU 1.3 has different ones!
*/
#if defined(__BEOS__)
/* The BeOS does something funky and makes these typedefs in one
* of its system headers.
*/
/* The BeOS does something funky and makes these typedefs in one
* of its system headers.
*/
#else
typedef struct GLUquadric GLUquadricObj;
typedef struct GLUtesselator GLUtriangulatorObj;
typedef struct GLUnurbs GLUnurbsObj;
typedef struct GLUquadric GLUquadricObj;
typedef struct GLUnurbs GLUnurbsObj;
/* FIXME: We need to implement the other 1.3 typedefs - GH */
typedef struct GLUtesselator GLUtesselator;
typedef GLUtesselator GLUtriangulatorObj;
#endif
@@ -392,25 +450,49 @@ GLUAPI void GLAPIENTRY gluNurbsCallback( GLUnurbsObj *nobj, GLenum which,
/*
*
* Polygon tesselation
* Polygon tessellation
*
*/
GLUAPI GLUtriangulatorObj* GLAPIENTRY gluNewTess( void );
GLUAPI GLUtesselator* GLAPIENTRY gluNewTess( void );
GLUAPI void GLAPIENTRY gluTessCallback( GLUtriangulatorObj *tobj, GLenum which,
void (GLCALLBACK *fn)() );
GLUAPI void GLAPIENTRY gluDeleteTess( GLUtesselator *tobj );
GLUAPI void GLAPIENTRY gluDeleteTess( GLUtriangulatorObj *tobj );
GLUAPI void GLAPIENTRY gluTessBeginPolygon( GLUtesselator *tobj,
void *polygon_data );
GLUAPI void GLAPIENTRY gluBeginPolygon( GLUtriangulatorObj *tobj );
GLUAPI void GLAPIENTRY gluTessBeginContour( GLUtesselator *tobj );
GLUAPI void GLAPIENTRY gluEndPolygon( GLUtriangulatorObj *tobj );
GLUAPI void GLAPIENTRY gluTessVertex( GLUtesselator *tobj, GLdouble coords[3],
void *vertex_data );
GLUAPI void GLAPIENTRY gluNextContour( GLUtriangulatorObj *tobj, GLenum type );
GLUAPI void GLAPIENTRY gluTessEndContour( GLUtesselator *tobj );
GLUAPI void GLAPIENTRY gluTessVertex( GLUtriangulatorObj *tobj, GLdouble v[3],
void *data );
GLUAPI void GLAPIENTRY gluTessEndPolygon( GLUtesselator *tobj );
GLUAPI void GLAPIENTRY gluTessProperty( GLUtesselator *tobj, GLenum which,
GLdouble value );
GLUAPI void GLAPIENTRY gluTessNormal( GLUtesselator *tobj, GLdouble x,
GLdouble y, GLdouble z );
GLUAPI void GLAPIENTRY gluTessCallback( GLUtesselator *tobj, GLenum which,
void (GLCALLBACK *fn)() );
GLUAPI void GLAPIENTRY gluGetTessProperty( GLUtesselator *tobj, GLenum which,
GLdouble *value );
/*
*
* Obsolete 1.0 tessellation functions
*
*/
GLUAPI void GLAPIENTRY gluBeginPolygon( GLUtesselator *tobj );
GLUAPI void GLAPIENTRY gluNextContour( GLUtesselator *tobj, GLenum type );
GLUAPI void GLAPIENTRY gluEndPolygon( GLUtesselator *tobj );
@@ -423,6 +505,20 @@ GLUAPI void GLAPIENTRY gluTessVertex( GLUtriangulatorObj *tobj, GLdouble v[3],
GLUAPI const GLubyte* GLAPIENTRY gluGetString( GLenum name );
/*
* GLU_EXT_get_proc_address extension
*/
/*
* WARNING: this extension is not finalized yet! Do not release code
* which uses this extension yet! It may change!
*/
#define GLU_EXT_get_proc_address 1
#ifdef GLU_EXT_get_proc_address
GLUAPI void (GLAPIENTRY *gluGetProcAddressEXT(const GLubyte *procName))();
#endif
#if defined(__BEOS__) || defined(__QUICKDRAW__)
#pragma export off
#endif

View File

@@ -1,4 +1,4 @@
/* $Id: glu_mangle.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: glu_mangle.h,v 1.2 1999/09/10 02:08:19 gareth Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,8 +23,11 @@
/*
* $Log: glu_mangle.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.2 1999/09/10 02:08:19 gareth
* Added GLU 1.3 tessellation (except winding rule code).
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.1 1999/06/21 22:00:42 brianp
* added #ifndef GLU_MANGLE_H stuff
@@ -75,12 +78,19 @@
#define gluPwlCurve mgluPwlCurve
#define gluNurbsCallback mgluNurbsCallback
#define gluNewTess mgluNewTess
#define gluTessCallback mgluTessCallback
#define gluDeleteTess mgluDeleteTess
#define gluBeginPolygon mgluBeginPolygon
#define gluEndPolygon mgluEndPolygon
#define gluNextContour mgluNextContour
#define gluTessBeginPolygon mgluTessBeginPolygon
#define gluTessBeginContour mgluTessBeginContour
#define gluTessVertex mgluTessVertex
#define gluTessEndPolygon mgluTessEndPolygon
#define gluTessEndContour mgluTessEndContour
#define gluTessProperty mgluTessProperty
#define gluTessNormal mgluTessNormal
#define gluTessCallback mgluTessCallback
#define gluGetTessProperty mgluGetTessProperty
#define gluBeginPolygon mgluBeginPolygon
#define gluNextContour mgluNextContour
#define gluEndPolygon mgluEndPolygon
#define gluGetString mgluGetString
#endif

View File

@@ -1,4 +1,4 @@
/* $Id: glx.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: glx.h,v 1.3 1999/09/16 15:52:51 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -27,8 +27,14 @@
/*
* $Log: glx.h,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.3 1999/09/16 15:52:51 brianp
* added GLX_MESA_set_3dfx_mode. clean-up of glXGetProcAddress
*
* Revision 1.2 1999/09/11 11:33:45 brianp
* added GLX_EXT_get_proc_address
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.3 1999/02/14 03:39:09 brianp
* new copyright
@@ -154,13 +160,13 @@ enum _GLX_CONFIGS {
/*
* Compile-time extension tests
*/
#ifdef MESA
#define GLX_EXT_visual_info 1
#define GLX_EXT_get_proc_address 1
#define GLX_MESA_pixmap_colormap 1
#define GLX_MESA_release_buffers 1
#define GLX_MESA_copy_sub_buffer 1
#define GLX_MESA_set_3dfx_mode 1
#define GLX_SGI_video_sync 1
#endif
@@ -228,29 +234,35 @@ extern const char *glXGetClientString( Display *dpy, int name );
/*
* Mesa GLX Extensions
/* GLX_EXT_get_proc_address */
/* WARNING: this extension is not finalized yet! Do not release code
* which uses this extension yet! It may change!
*/
extern void (*glXGetProcAddressEXT(const GLubyte *procName))();
#ifdef GLX_MESA_pixmap_colormap
/* GLX_MESA_pixmap_colormap */
extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
Pixmap pixmap, Colormap cmap );
#endif
#ifdef GLX_MESA_release_buffers
/* GLX_MESA_release_buffers */
extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
#endif
#ifdef GLX_MESA_copy_sub_buffer
/* GLX_MESA_copy_sub_buffer */
extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
int x, int y, int width, int height );
#endif
#ifdef GLX_SGI_video_sync
/* GLX_MESA_set_3dfx_mode */
extern GLboolean glXSet3DfxModeMESA( GLint mode );
/* GLX_SGI_video_sync */
extern int glXGetVideoSyncSGI(unsigned int *count);
extern int glXWaitVideoSyncSGI(int divisor, int remainder,
unsigned int *count);
#endif

33
include/GL/mesa_wgl.h Normal file
View File

@@ -0,0 +1,33 @@
/* prototypes for the Mesa WGL functions */
/* relocated here so that I could make GLUT get them properly */
#ifndef GL_H
#include <gl/gl.h>
#endif
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC);
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC,HGLRC);
WGLAPI int GLAPIENTRY wglSetPixelFormat(HDC, int, const PIXELFORMATDESCRIPTOR *);
WGLAPI int GLAPIENTRY wglSwapBuffers(HDC hdc);
WGLAPI HDC GLAPIENTRY wglGetCurrentDC(void);
WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC);
WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int);
WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
WGLAPI PROC GLAPIENTRY wglGetProcAddress(const char*);
WGLAPI int GLAPIENTRY SwapBuffers(HDC);
WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *);
WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC);
WGLAPI int GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR);
WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR);
WGLAPI int GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *);
WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc);
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC, HGLRC);
WGLAPI int GLAPIENTRY wglRealizeLayerPalette(HDC, int, int);
WGLAPI int GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *);
WGLAPI int GLAPIENTRY wglShareLists(HGLRC, HGLRC);
WGLAPI int GLAPIENTRY wglSwapLayerBuffers(HDC, unsigned int);
WGLAPI int GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, unsigned long);
WGLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long);
WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);

View File

@@ -1,4 +1,4 @@
# $Id: Makefile,v 1.1 1999/08/19 00:55:40 jtg Exp $
# $Id: Makefile,v 1.2 1999/09/17 00:55:21 brianp Exp $
# Makefile for BeOS demos
@@ -11,7 +11,7 @@ CC = g++
# Use Mesa:
CFLAGS = -I../include -c -g
LFLAGS = -L../lib -Xlinker -rpath ../lib -lbe -lMesaGL
LFLAGS = -L../lib -Xlinker -rpath ../lib -lbe -lGL
# Use BeOS OpenGL:
#CFLAGS = -I/boot/develop/headers/be/opengl -c -g

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.BeOS-R4,v 1.1 1999/08/19 00:55:40 jtg Exp $
# $Id: Makefile.BeOS-R4,v 1.2 1999/09/17 00:07:26 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
@@ -23,8 +23,11 @@
# $Log: Makefile.BeOS-R4,v $
# Revision 1.1 1999/08/19 00:55:40 jtg
# Initial revision
# Revision 1.2 1999/09/17 00:07:26 brianp
# link with -lGLU -lGL instead of -lMesaGLU -lMesaGL
#
# Revision 1.1.1.1 1999/08/19 00:55:40 jtg
# Imported sources
#
# Revision 1.5 1999/06/22 12:50:11 brianp
# removed multitex demo
@@ -49,7 +52,7 @@
INCDIR = ../include
LIBDIR = ../lib
GL_LIBS = -L$(LIBDIR) -L/boot/home/config/lib -Xlinker -rpath $(LIBDIR) -lbe -lglut -lMesaGLU -lMesaGL $(XLIBS)
GL_LIBS = -L$(LIBDIR) -L/boot/home/config/lib -Xlinker -rpath $(LIBDIR) -lbe -lglut -lGLU -lGL $(XLIBS)
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)

View File

@@ -1,15 +1,34 @@
/* $Id: isosurf.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: isosurf.c,v 1.3 1999/09/08 22:14:31 brianp Exp $ */
/*
* Display an isosurface of 3-D wind speed volume. Use arrow keys to
* rotate, S toggles smooth shading, L toggles lighting
* Display an isosurface of 3-D wind speed volume.
*
* Brian Paul This file in public domain.
*/
/* Keys:
* =====
*
* - Arrow keys to rotate
* - 's' toggles smooth shading
* - 'l' toggles lighting
* - 'f' toggles fog
* - 'I' and 'i' zoom in and out
* - 'c' toggles a user clip plane
* - 'm' toggles colorful materials in GL_TRIANGLES modes.
* - '+' and '-' move the user clip plane
*
* Other options are available via the popup menu.
*/
/*
* $Log: isosurf.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.3 1999/09/08 22:14:31 brianp
* minor changes. always call compactify_arrays()
*
* Revision 1.2 1999/09/03 14:56:40 keithw
* Fog, displaylist and zoom operations
*
* Revision 3.4 1999/04/24 01:10:47 keithw
* clip planes, materials
@@ -44,11 +63,11 @@
#define NO_REFLECT 0x20
#define POINT_FILTER 0x40
#define LINEAR_FILTER 0x80
#define IMMEDIATE 0x100
#define GLVERTEX 0x100
#define DRAW_ARRAYS 0x200 /* or draw_elts, if compiled */
#define ARRAY_ELT 0x400
#define COMPILED 0x800
#define NOT_COMPILED 0x1000
#define IMMEDIATE 0x1000
#define SHADE_SMOOTH 0x2000
#define SHADE_FLAT 0x4000
#define TRIANGLES 0x8000
@@ -57,18 +76,22 @@
#define NO_USER_CLIP 0x40000
#define MATERIALS 0x80000
#define NO_MATERIALS 0x100000
#define FOG 0x200000
#define NO_FOG 0x400000
#define QUIT 0x800000
#define DISPLAYLIST 0x1000000
#define LIGHT_MASK (LIT|UNLIT)
#define TEXTURE_MASK (TEXTURE|NO_TEXTURE)
#define REFLECT_MASK (REFLECT|NO_REFLECT)
#define FILTER_MASK (POINT_FILTER|LINEAR_FILTER)
#define RENDER_STYLE_MASK (IMMEDIATE|DRAW_ARRAYS|ARRAY_ELT)
#define COMPILED_MASK (COMPILED|NOT_COMPILED)
#define RENDER_STYLE_MASK (GLVERTEX|DRAW_ARRAYS|ARRAY_ELT)
#define COMPILED_MASK (COMPILED|IMMEDIATE|DISPLAYLIST)
#define MATERIAL_MASK (MATERIALS|NO_MATERIALS)
#define PRIMITIVE_MASK (TRIANGLES|STRIPS)
#define CLIP_MASK (USER_CLIP|NO_USER_CLIP)
#define SHADE_MASK (SHADE_SMOOTH|SHADE_FLAT)
#define FOG_MASK (FOG|NO_FOG)
#define MAXVERTS 10000
static float data[MAXVERTS][6];
@@ -80,9 +103,14 @@ static GLint numverts, num_tri_verts, numuniq;
static GLfloat xrot;
static GLfloat yrot;
static GLfloat dist = -6;
static GLint state, allowed = ~0;
static GLboolean doubleBuffer = GL_TRUE;
static GLdouble plane[4] = {1.0, 0.0, -1.0, 0.0};
static GLuint surf1;
/* forward decl */
int BuildList( int mode );
static void read_surface( char *filename )
@@ -225,7 +253,7 @@ static void extract_indices1( const struct data_idx *in, unsigned int *out,
}
static void compactify_arrays()
static void compactify_arrays(void)
{
int i;
struct data_idx *ind;
@@ -290,11 +318,11 @@ static void make_tri_indices( void )
#define MIN(x,y) (x < y) ? x : y
static void draw_surface( void )
static void draw_surface( int with_state )
{
GLuint i, j;
switch (state & (COMPILED_MASK|RENDER_STYLE_MASK|PRIMITIVE_MASK)) {
switch (with_state & (COMPILED_MASK|RENDER_STYLE_MASK|PRIMITIVE_MASK)) {
#ifdef GL_EXT_vertex_array
case (COMPILED|DRAW_ARRAYS|STRIPS):
@@ -310,8 +338,8 @@ static void draw_surface( void )
break;
case (COMPILED|DRAW_ARRAYS|TRIANGLES):
case (NOT_COMPILED|DRAW_ARRAYS|TRIANGLES):
if (state & MATERIALS) {
case (IMMEDIATE|DRAW_ARRAYS|TRIANGLES):
if (with_state & MATERIALS) {
for (j = i = 0 ; i < num_tri_verts ; i += 600, j++) {
GLuint nr = MIN(num_tri_verts-i, 600);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, col[j]);
@@ -327,22 +355,22 @@ static void draw_surface( void )
/* Uses the original arrays (including duplicate elements):
*/
case (NOT_COMPILED|DRAW_ARRAYS|STRIPS):
case (IMMEDIATE|DRAW_ARRAYS|STRIPS):
glDrawArraysEXT( GL_TRIANGLE_STRIP, 0, numverts );
break;
/* Uses the original arrays (including duplicate elements):
*/
case (NOT_COMPILED|ARRAY_ELT|STRIPS):
case (IMMEDIATE|ARRAY_ELT|STRIPS):
glBegin( GL_TRIANGLE_STRIP );
for (i = 0 ; i < numverts ; i++)
glArrayElement( i );
glEnd();
break;
case (NOT_COMPILED|ARRAY_ELT|TRIANGLES):
case (IMMEDIATE|ARRAY_ELT|TRIANGLES):
case (COMPILED|ARRAY_ELT|TRIANGLES):
if (state & MATERIALS) {
if (with_state & MATERIALS) {
for (j = i = 0 ; i < num_tri_verts ; i += 600, j++) {
GLuint nr = MIN(num_tri_verts-i, 600);
GLuint k;
@@ -357,12 +385,13 @@ static void draw_surface( void )
glBegin( GL_TRIANGLES );
for (i = 0 ; i < num_tri_verts ; i++)
glArrayElement( tri_indices[i] );
glEnd();
}
break;
case (NOT_COMPILED|IMMEDIATE|TRIANGLES):
if (state & MATERIALS) {
case (IMMEDIATE|GLVERTEX|TRIANGLES):
if (with_state & MATERIALS) {
for (j = i = 0 ; i < num_tri_verts ; i += 600, j++) {
GLuint nr = MIN(num_tri_verts-i, 600);
GLuint k;
@@ -385,6 +414,13 @@ static void draw_surface( void )
}
break;
case (DISPLAYLIST|GLVERTEX|STRIPS):
if (!surf1)
surf1 = BuildList( GL_COMPILE_AND_EXECUTE );
else
glCallList(surf1);
break;
#endif
/* Uses the original arrays (including duplicate elements):
@@ -404,18 +440,27 @@ static void draw_surface( void )
static void Display(void)
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
draw_surface();
draw_surface( state );
glFlush();
if (doubleBuffer) glutSwapBuffers();
}
int BuildList( int mode )
{
int rv = glGenLists(1);
glNewList(rv, mode );
draw_surface( IMMEDIATE|GLVERTEX|STRIPS );
glEndList();
return rv;
}
/* KW: only do this when necessary, so CVA can re-use results.
*/
static void set_matrix( void )
{
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef( 0.0, 0.0, -6.0 );
glTranslatef( 0.0, 0.0, dist );
glRotatef( yrot, 0.0, 1.0, 0.0 );
glRotatef( xrot, 1.0, 0.0, 0.0 );
}
@@ -548,10 +593,23 @@ static void ModeMenu(int m)
}
}
if (CHANGED(state, m, FOG_MASK)) {
if (m & FOG)
{
glEnable(GL_FOG);
printf("FOG enable\n");
}
else
{
glDisable(GL_FOG);
printf("FOG disable\n");
}
}
#ifdef GL_EXT_vertex_array
if (CHANGED(state, m, (COMPILED_MASK|RENDER_STYLE_MASK|PRIMITIVE_MASK)))
{
if ((m & (COMPILED_MASK|PRIMITIVE_MASK)) == (NOT_COMPILED|STRIPS))
if ((m & (COMPILED_MASK|PRIMITIVE_MASK)) == (IMMEDIATE|STRIPS))
{
glVertexPointerEXT( 3, GL_FLOAT, sizeof(data[0]), numverts, data );
glNormalPointerEXT( GL_FLOAT, sizeof(data[0]), numverts, &data[0][3]);
@@ -588,6 +646,8 @@ static void ModeMenu(int m)
static void Init(void)
{
GLfloat fogColor[4] = {0.5,1.0,0.5,1.0};
glClearColor(0.0, 0.0, 0.0, 0.0);
glEnable( GL_DEPTH_TEST );
glEnable( GL_VERTEX_ARRAY_EXT );
@@ -616,20 +676,28 @@ static void Init(void)
exit(1);
}
if (allowed & COMPILED) {
compactify_arrays();
make_tri_indices();
}
/* Green fog is easy to see */
glFogi(GL_FOG_MODE,GL_EXP2);
glFogfv(GL_FOG_COLOR,fogColor);
glFogf(GL_FOG_DENSITY,0.15);
glHint(GL_FOG_HINT,GL_DONT_CARE);
compactify_arrays();
make_tri_indices();
surf1 = BuildList( GL_COMPILE );
ModeMenu(SHADE_SMOOTH|
LIT|
NO_TEXTURE|
NO_REFLECT|
POINT_FILTER|
NOT_COMPILED|
IMMEDIATE|
NO_USER_CLIP|
NO_MATERIALS|
IMMEDIATE);
NO_FOG|
GLVERTEX);
}
@@ -643,45 +711,60 @@ static void Reshape(int width, int height)
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
case 's':
ModeMenu((state ^ SHADE_MASK) & SHADE_MASK);
break;
case 'l':
ModeMenu((state ^ LIGHT_MASK) & LIGHT_MASK);
break;
case 'm':
ModeMenu((state ^ MATERIAL_MASK) & MATERIAL_MASK);
break;
case 'c':
ModeMenu((state ^ CLIP_MASK) & CLIP_MASK);
break;
case 'b':
Benchmark(5.0, 0);
break;
case 'B':
Benchmark(0, 5.0);
break;
case '-':
case '_':
plane[3] += 2.0;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClipPlane(GL_CLIP_PLANE0, plane);
set_matrix();
glutPostRedisplay();
break;
case '+':
case '=':
plane[3] -= 2.0;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClipPlane(GL_CLIP_PLANE0, plane);
set_matrix();
glutPostRedisplay();
break;
case 27:
exit(0);
case 'f':
ModeMenu((state ^ FOG_MASK) & FOG_MASK);
break;
case 's':
ModeMenu((state ^ SHADE_MASK) & SHADE_MASK);
break;
case 'l':
ModeMenu((state ^ LIGHT_MASK) & LIGHT_MASK);
break;
case 'm':
ModeMenu((state ^ MATERIAL_MASK) & MATERIAL_MASK);
break;
case 'c':
ModeMenu((state ^ CLIP_MASK) & CLIP_MASK);
break;
case 'b':
Benchmark(5.0, 0);
break;
case 'B':
Benchmark(0, 5.0);
break;
case 'i':
dist += .25;
set_matrix();
glutPostRedisplay();
break;
case 'I':
dist -= .25;
set_matrix();
glutPostRedisplay();
break;
case '-':
case '_':
plane[3] += 2.0;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClipPlane(GL_CLIP_PLANE0, plane);
set_matrix();
glutPostRedisplay();
break;
case '+':
case '=':
plane[3] -= 2.0;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClipPlane(GL_CLIP_PLANE0, plane);
set_matrix();
glutPostRedisplay();
break;
}
}
@@ -689,6 +772,8 @@ static void Key( unsigned char key, int x, int y )
static void SpecialKey( int key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_LEFT:
yrot -= 15.0;
@@ -782,21 +867,27 @@ int main(int argc, char **argv)
glutAddMenuEntry("Smooth", SHADE_SMOOTH);
glutAddMenuEntry("Flat", SHADE_FLAT);
glutAddMenuEntry("", 0);
glutAddMenuEntry("Fog", FOG);
glutAddMenuEntry("No Fog", NO_FOG);
glutAddMenuEntry("", 0);
glutAddMenuEntry("Point Filtered", POINT_FILTER);
glutAddMenuEntry("Linear Filtered", LINEAR_FILTER);
glutAddMenuEntry("", 0);
glutAddMenuEntry("Immediate (STRIPS)", NOT_COMPILED|IMMEDIATE|STRIPS);
glutAddMenuEntry("Immediate (TRIANGLES)", NOT_COMPILED|IMMEDIATE|TRIANGLES);
glutAddMenuEntry("glVertex (STRIPS)", IMMEDIATE|GLVERTEX|STRIPS);
glutAddMenuEntry("glVertex (TRIANGLES)", IMMEDIATE|GLVERTEX|TRIANGLES);
glutAddMenuEntry("", 0);
glutAddMenuEntry("glVertex display list (STRIPS)",
DISPLAYLIST|GLVERTEX|STRIPS);
glutAddMenuEntry("", 0);
if (allowed & DRAW_ARRAYS) {
glutAddMenuEntry("DrawArrays (STRIPS)",
NOT_COMPILED|DRAW_ARRAYS|STRIPS);
IMMEDIATE|DRAW_ARRAYS|STRIPS);
glutAddMenuEntry("ArrayElement (STRIPS)",
NOT_COMPILED|ARRAY_ELT|STRIPS);
IMMEDIATE|ARRAY_ELT|STRIPS);
glutAddMenuEntry("DrawElements (TRIANGLES)",
NOT_COMPILED|DRAW_ARRAYS|TRIANGLES);
IMMEDIATE|DRAW_ARRAYS|TRIANGLES);
glutAddMenuEntry("ArrayElement (TRIANGLES)",
NOT_COMPILED|ARRAY_ELT|TRIANGLES);
IMMEDIATE|ARRAY_ELT|TRIANGLES);
glutAddMenuEntry("", 0);
}
@@ -805,7 +896,9 @@ int main(int argc, char **argv)
COMPILED|DRAW_ARRAYS|TRIANGLES);
glutAddMenuEntry("Compiled DrawElements (STRIPS)",
COMPILED|DRAW_ARRAYS|STRIPS);
glutAddMenuEntry("Compiled ArrayElement",
glutAddMenuEntry("Compiled ArrayElement (TRIANGLES)",
COMPILED|ARRAY_ELT|TRIANGLES);
glutAddMenuEntry("Compiled ArrayElement (STRIPS)",
COMPILED|ARRAY_ELT|STRIPS);
glutAddMenuEntry("", 0);
}

View File

@@ -1,9 +1,12 @@
/* $Id: morph3d.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: morph3d.c,v 1.2 1999/09/17 12:27:01 brianp Exp $ */
/*
* $Log: morph3d.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.2 1999/09/17 12:27:01 brianp
* silenced some warnings
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.1 1998/06/29 02:37:30 brianp
* minor changes for Windows (Ted Jump)
@@ -717,6 +720,8 @@ static void pinit(void);
static void key( unsigned char k, int x, int y )
{
(void) x;
(void) y;
switch (k) {
case '1': object=1; break;
case '2': object=2; break;

View File

@@ -1,4 +1,4 @@
/* $Id: renormal.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: renormal.c,v 1.3 1999/09/17 12:27:01 brianp Exp $ */
/*
* Test GL_EXT_rescale_normal extension
@@ -6,7 +6,7 @@
*/
/*
* $Id: renormal.c,v 1.1 1999/08/19 00:55:40 jtg Exp $
* $Id: renormal.c,v 1.3 1999/09/17 12:27:01 brianp Exp $
*/
@@ -95,6 +95,20 @@ static void ModeMenu(int entry)
glutPostRedisplay();
}
static void
key(unsigned char k, int x, int y)
{
(void) x;
(void) y;
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
int main( int argc, char *argv[] )
{
@@ -110,6 +124,7 @@ int main( int argc, char *argv[] )
glutIdleFunc( Idle );
glutReshapeFunc( Reshape );
glutDisplayFunc( Display );
glutKeyboardFunc(key);
glutCreateMenu(ModeMenu);
glutAddMenuEntry("Unscaled", UNSCALED);

View File

@@ -1,4 +1,4 @@
/* $Id: stex3d.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: stex3d.c,v 1.2 1999/09/17 12:27:01 brianp Exp $ */
/*-----------------------------
* stex3d.c GL example of the mesa 3d-texture extention to simulate procedural
@@ -17,8 +17,11 @@
/*
* $Log: stex3d.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.2 1999/09/17 12:27:01 brianp
* silenced some warnings
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.1 1998/06/09 01:53:49 brianp
* main() should return an int
@@ -401,6 +404,8 @@ void cleanEverything(void)
void KeyHandler( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch(key) {
case 27:
case 'q':

View File

@@ -1,4 +1,4 @@
/* $Id: tessdemo.c,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
/* $Id: tessdemo.c,v 1.2 1999/09/19 20:09:00 tanner Exp $ */
/*
* A demo of the GLU polygon tesselation functions written by Bogdan Sikorski.
@@ -11,8 +11,12 @@
/*
* $Log: tessdemo.c,v $
* Revision 1.1 1999/08/19 00:55:40 jtg
* Initial revision
* Revision 1.2 1999/09/19 20:09:00 tanner
*
* lots of autoconf updates
*
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
* Imported sources
*
* Revision 3.5 1999/03/28 18:24:37 brianp
* minor clean-up
@@ -148,7 +152,7 @@ void set_screen_wh(GLsizei w, GLsizei h)
void tesse(void)
{
GLUtriangulatorObj *tobj;
GLUtesselator *tobj;
GLdouble data[3];
GLuint i,j,point_cnt;

377
progs/ggi/asc-view.c Normal file
View File

@@ -0,0 +1,377 @@
/*
test program for the ggi-mesa driver
Copyright (C) 1997,1998 Uwe Maurer - uwe_maurer@t-online.de
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <sys/time.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/ggimesa.h>
#include <ggi/ggi.h>
#include <stdlib.h>
ggi_visual_t vis,vis_mem;
GGIMesaContext ctx;
int screen_x=GGI_AUTO,screen_y=GGI_AUTO;
ggi_graphtype bpp=GT_AUTO;
//#define ZBUFFER
//#define SMOOTH_NORMALS
void Init()
{
GLfloat h=(GLfloat)3/4;
GLfloat pos[4]={5,5,-20,0};
GLfloat specular[4]={.4,.4,.4,1};
GLfloat diffuse[4]={.3,.3,.3,1};
GLfloat ambient[4]={.2,.2,.2,1};
int err;
if (ggiInit()<0)
{
printf("ggiInit() failed\n");
exit(1);
}
ctx=GGIMesaCreateContext();
if (ctx==NULL)
{
printf("Can't create Context!\n");
exit(1);
}
vis=ggiOpen(NULL);
vis_mem=ggiOpen("display-memory",NULL);
if (vis==NULL || vis_mem==NULL)
{
printf("Can't open ggi_visuals!\n");
exit(1);
}
err=ggiSetGraphMode(vis,screen_x,screen_y,screen_x,screen_y,bpp);
err+=ggiSetGraphMode(vis_mem,screen_x,screen_y,screen_x,screen_y,bpp);
if (err)
{
printf("Can't set %ix%i\n",screen_x,screen_y);
exit(1);
}
if (GGIMesaSetVisual(ctx,vis_mem,GL_TRUE,GL_FALSE)<0)
{
printf("GGIMesaSetVisual() failed!\n");
exit(1);
}
GGIMesaMakeCurrent(ctx);
glViewport(0,0,screen_x,screen_y);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1,1,-h,h,1,50);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0,0,-9);
glShadeModel(GL_FLAT);
glFrontFace(GL_CW);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0,GL_POSITION,pos);
glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuse);
glLightfv(GL_LIGHT0,GL_AMBIENT,ambient);
glLightfv(GL_LIGHT0,GL_SPECULAR,specular);
#ifdef ZBUFFER
glEnable(GL_DEPTH_TEST);
#endif
}
#define MAX_VERTS 1000
#define MAX_TRIS 2000
#define MAX_LEN 1024
#define MAX_F 100000000
void LoadAsc(GLuint *list,char *file)
{
FILE *fp;
GLfloat p[MAX_VERTS][3];
GLfloat normal[MAX_VERTS][3];
float ncount[MAX_VERTS];
int v[MAX_TRIS][3];
char line[MAX_LEN];
char *s;
int i,j;
int verts,faces;
GLuint v0,v1,v2;
GLfloat n[3];
GLfloat len,k;
GLfloat min[3]={MAX_F,MAX_F,MAX_F};
GLfloat max[3]={-MAX_F,-MAX_F,-MAX_F};
char *coord_str[]={"X","Z","Y"};
fp=fopen(file,"r");
if (!fp)
{
printf("Can't open %s!\n",file);
exit(1);
}
while (strncmp(fgets(line,MAX_LEN,fp),"Tri-mesh",8)) ;
s=strstr(line,":")+1;
verts=atoi(s);
s=strstr(s,":")+1;
faces=atoi(s);
if (verts>MAX_VERTS)
{
printf("Too many vertices..\n");
exit(1);
}
while (strncmp(fgets(line,MAX_LEN,fp),"Vertex list",11)) ;
for (i=0;i<verts;i++)
{
while (strncmp(fgets(line,MAX_LEN,fp),"Vertex",6)) ;
for (j=0;j<3;j++)
{
s=strstr(line,coord_str[j])+2;
k=atoi(s);
if (k>max[j]) max[j]=k;
if (k<min[j]) min[j]=k;
p[i][j]=k;
}
}
len=0;
for (i=0;i<3;i++)
{
k=max[i]-min[i];
if (k>len) {len=k;j=i;}
n[i]=(max[i]+min[i])/2;
}
len/=2;
for (i=0;i<verts;i++)
{
for (j=0;j<3;j++)
{
p[i][j]-=n[j];
p[i][j]/=len;
}
}
*list=glGenLists(1);
glNewList(*list,GL_COMPILE);
glBegin(GL_TRIANGLES);
memset(ncount,0,sizeof(ncount));
memset(normal,0,sizeof(normal));
while (strncmp(fgets(line,MAX_LEN,fp),"Face list",9)) ;
for (i=0;i<faces;i++)
{
while (strncmp(fgets(line,MAX_LEN,fp),"Face",4)) ;
s=strstr(line,"A")+2;
v0=v[i][0]=atoi(s);
s=strstr(line,"B")+2;
v1=v[i][1]=atoi(s);
s=strstr(line,"C")+2;
v2=v[i][2]=atoi(s);
n[0]=((p[v1][1]-p[v0][1])*(p[v2][2]-p[v0][2])
- (p[v1][2]-p[v0][2])*(p[v2][1]-p[v0][1]));
n[1]=((p[v1][2]-p[v0][2])*(p[v2][0]-p[v0][0])
- (p[v1][0]-p[v0][0])*(p[v2][2]-p[v0][2]));
n[2]=((p[v1][0]-p[v0][0])*(p[v2][1]-p[v0][1])
- (p[v1][1]-p[v0][1])*(p[v2][0]-p[v0][0]));
len=n[0]*n[0]+n[1]*n[1]+n[2]*n[2];
len=sqrt(len);
n[0]/=len;
n[1]/=len;
n[2]/=len;
#ifdef SMOOTH_NORMALS
for (j=0;j<3;j++){
normal[v[i][j]][0]+=n[0];
normal[v[i][j]][1]+=n[1];
normal[v[i][j]][2]+=n[2];
ncount[v[i][j]]++;
}
#else
glNormal3fv(n);
for (j=0;j<3;j++)
glVertex3fv(p[v[i][j]]);
#endif
}
#ifdef SMOOTH_NORMALS
for (i=0;i<verts;i++) {
for (j=0;j<3;j++) {
normal[i][j]/=ncount[i];
}
}
for (i=0;i<faces;i++) {
for (j=0;j<3;j++) {
glNormal3f(normal[v[i][j]][0],
normal[v[i][j]][1],
normal[v[i][j]][2]);
glVertex3fv(p[v[i][j]]);
}
}
#endif
glEnd();
glEndList();
fclose(fp);
}
double Display(GLuint l,int *maxframes)
{
int x,y;
GLfloat col[]={.25,0,.25,1};
int frames=0;
struct timeval start,stop;
double len;
GLfloat rotate=0;
gettimeofday(&start,NULL);
while(1)
{
glClearColor(0,0,0,0);
glClearIndex(0);
#ifdef ZBUFFER
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
#else
glClear(GL_COLOR_BUFFER_BIT);
#endif
glPushMatrix();
glRotatef(30,1,0,0);
glRotatef(rotate/10,0,0,1);
glTranslatef(-6,-4,0);
for (y=0;y<3;y++)
{
glPushMatrix();
for (x=0;x<5;x++)
{
glPushMatrix();
glRotatef(rotate,y+1,-x-1,0);
col[0]=(GLfloat)(x+1)/4;
col[1]=0;
col[2]=(GLfloat)(y+1)/2;
glMaterialfv(GL_FRONT,GL_AMBIENT,col);
glCallList(l);
glPopMatrix();
glTranslatef(3,0,0);
}
glPopMatrix();
glTranslatef(0,4,0);
}
glPopMatrix();
glFinish();
ggiPutBox(vis,0,0,screen_x,screen_y,ggiDBGetBuffer(vis,0)->read);
rotate+=10;
frames++;
if (frames==(*maxframes)) break;
if (ggiKbhit(vis))
{
*maxframes=frames;
break;
}
}
gettimeofday(&stop,NULL);
len=(double)(stop.tv_sec-start.tv_sec)+
(double)(stop.tv_usec-start.tv_usec)/1e6;
return len;
}
void visible(int vis)
{
if (vis == GLUT_VISIBLE)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutInitWindowPosition(0, 0);
glutInitWindowSize(300, 300);
glutCreateWindow("asc-view");
init();
glutDisplayFunc(draw);
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutVisibilityFunc(visible);
glutMainLoop();
#if 0
GLuint l;
char *file;
int maxframes=0;
double len;
Init();
file=(argc>1) ? argv[1] : "asc/box.asc";
if (argc>2) maxframes=atoi(argv[2]);
if (argc==1)
{
printf("usage: %s filename.asc\n",argv[0]);
}
LoadAsc(&l,file);
len=Display(l,&maxframes);
printf("\ttime: %.3f sec\n",len);
printf("\tframes: %i\n",maxframes);
printf("\tfps: %.3f \n",(double)maxframes/len);
GGIMesaDestroyContext(ctx);
ggiClose(vis);
ggiClose(vis_mem);
ggiExit();
#endif
return 0;
}

2
progs/ggi/blah Normal file
View File

@@ -0,0 +1,2 @@
Terminating on signal 11

7
progs/ggi/blat Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
function foobar() {
echo "foo!"
}
foobar

66
progs/ggi/box.asc Normal file
View File

@@ -0,0 +1,66 @@
Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
Named object: "Object01"
Tri-mesh, Vertices: 8 Faces: 12
Vertex list:
Vertex 0: X: -20 Y: -19.999998 Z: 20.000002
Vertex 1: X: 20 Y: -19.999998 Z: 20.000002
Vertex 2: X: 20 Y: 20.000002 Z: 19.999998
Vertex 3: X: -20 Y: 20.000002 Z: 19.999998
Vertex 4: X: -20 Y: -20.000002 Z: -19.999998
Vertex 5: X: 20 Y: -20.000002 Z: -19.999998
Vertex 6: X: 20 Y: 19.999998 Z: -20.000002
Vertex 7: X: -20 Y: 19.999998 Z: -20.000002
Face list:
Face 0: A:0 B:1 C:2 AB:1 BC:1 CA:0
Smoothing: 1
Face 1: A:0 B:2 C:3 AB:0 BC:1 CA:1
Smoothing: 1
Face 2: A:0 B:4 C:5 AB:1 BC:1 CA:0
Smoothing: 2
Face 3: A:0 B:5 C:1 AB:0 BC:1 CA:1
Smoothing: 2
Face 4: A:1 B:5 C:6 AB:1 BC:1 CA:0
Smoothing: 3
Face 5: A:1 B:6 C:2 AB:0 BC:1 CA:1
Smoothing: 3
Face 6: A:2 B:6 C:7 AB:1 BC:1 CA:0
Smoothing: 4
Face 7: A:2 B:7 C:3 AB:0 BC:1 CA:1
Smoothing: 4
Face 8: A:3 B:7 C:4 AB:1 BC:1 CA:0
Smoothing: 5
Face 9: A:3 B:4 C:0 AB:0 BC:1 CA:1
Smoothing: 5
Face 10: A:4 B:7 C:6 AB:1 BC:1 CA:0
Smoothing: 6
Face 11: A:4 B:6 C:5 AB:0 BC:1 CA:1
Smoothing: 6
Page 1

198
progs/ggi/cone.asc Normal file
View File

@@ -0,0 +1,198 @@
Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
Named object: "Object01"
Tri-mesh, Vertices: 34 Faces: 64
Vertex list:
Vertex 0: X: 60.167416 Y: -87.419525 Z: -53.3088
Vertex 1: X: 76.70787 Y: -87.419518 Z: -29.84565
Vertex 2: X: 83.0103 Y: -87.419518 Z: -1.838764
Vertex 3: X: 78.115204 Y: -87.419518 Z: 26.448057
Vertex 4: X: 62.767834 Y: -87.41951 Z: 50.708401
Vertex 5: X: 39.304672 Y: -87.41951 Z: 67.248848
Vertex 6: X: 11.297782 Y: -87.41951 Z: 73.551254
Vertex 7: X: -16.989004 Y: -87.41951 Z: 68.656158
Vertex 8: X: -41.249344 Y: -87.41951 Z: 53.308777
Vertex 9: X: -57.789783 Y: -87.419518 Z: 29.845612
Vertex 10: X: -64.092194 Y: -87.419518 Z: 1.838721
Vertex 11: X: -59.197079 Y: -87.419518 Z: -26.448097
Vertex 12: X: -43.849678 Y: -87.419525 Z: -50.708427
Vertex 13: X: -20.386503 Y: -87.419525 Z: -67.248856
Vertex 14: X: 7.62039 Y: -87.419525 Z: -73.551239
Vertex 15: X: 35.907204 Y: -87.419525 Z: -68.656105
Vertex 16: X: 101.684875 Y: 94.590591 Z: -96.955391
Vertex 17: X: 131.767838 Y: 94.590591 Z: -54.281792
Vertex 18: X: 143.230377 Y: 94.590599 Z: -3.344275
Vertex 19: X: 134.327423 Y: 94.590607 Z: 48.102379
Vertex 20: X: 106.414383 Y: 94.590607 Z: 92.225876
Vertex 21: X: 63.740765 Y: 94.590607 Z: 122.3088
Vertex 22: X: 12.803238 Y: 94.590614 Z: 133.771301
Vertex 23: X: -38.643349 Y: 94.590607 Z: 124.868355
Vertex 24: X: -82.766846 Y: 94.590607 Z: 96.955307
Vertex 25: X: -112.849762 Y: 94.590607 Z: 54.281677
Vertex 26: X: -124.312256 Y: 94.590599 Z: 3.344152
Vertex 27: X: -115.409271 Y: 94.590591 Z: -48.102493
Vertex 28: X: -87.496201 Y: 94.590591 Z: -92.225967
Vertex 29: X: -44.822552 Y: 94.590591 Z: -122.308861
Vertex 30: X: 6.114983 Y: 94.590584 Z: -133.771332
Vertex 31: X: 57.561623 Y: 94.590591 Z: -124.868301
Vertex 32: X: 9.459057 Y: -87.419518 Z: 0.000008
Vertex 33: X: 9.459057 Y: 94.590599 Z: -0.000008
Face list:
Face 0: A:0 B:1 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 1: A:1 B:2 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 2: A:2 B:3 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 3: A:3 B:4 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 4: A:4 B:5 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 5: A:5 B:6 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 6: A:6 B:7 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 7: A:7 B:8 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 8: A:8 B:9 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 9: A:9 B:10 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 10: A:10 B:11 C:32 AB:1 BC:0 CA:0
Page 1
Smoothing: 1
Face 11: A:11 B:12 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 12: A:12 B:13 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 13: A:13 B:14 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 14: A:14 B:15 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 15: A:15 B:0 C:32 AB:1 BC:0 CA:0
Smoothing: 1
Face 16: A:0 B:16 C:17 AB:1 BC:1 CA:0
Smoothing: 2
Face 17: A:0 B:17 C:1 AB:0 BC:1 CA:1
Smoothing: 2
Face 18: A:1 B:17 C:18 AB:1 BC:1 CA:0
Smoothing: 3
Face 19: A:1 B:18 C:2 AB:0 BC:1 CA:1
Smoothing: 3
Face 20: A:2 B:18 C:19 AB:1 BC:1 CA:0
Smoothing: 4
Face 21: A:2 B:19 C:3 AB:0 BC:1 CA:1
Smoothing: 4
Face 22: A:3 B:19 C:20 AB:1 BC:1 CA:0
Smoothing: 5
Face 23: A:3 B:20 C:4 AB:0 BC:1 CA:1
Smoothing: 5
Face 24: A:4 B:20 C:21 AB:1 BC:1 CA:0
Smoothing: 6
Face 25: A:4 B:21 C:5 AB:0 BC:1 CA:1
Smoothing: 6
Face 26: A:5 B:21 C:22 AB:1 BC:1 CA:0
Smoothing: 7
Face 27: A:5 B:22 C:6 AB:0 BC:1 CA:1
Smoothing: 7
Face 28: A:6 B:22 C:23 AB:1 BC:1 CA:0
Smoothing: 8
Face 29: A:6 B:23 C:7 AB:0 BC:1 CA:1
Smoothing: 8
Face 30: A:7 B:23 C:24 AB:1 BC:1 CA:0
Smoothing: 9
Face 31: A:7 B:24 C:8 AB:0 BC:1 CA:1
Smoothing: 9
Face 32: A:8 B:24 C:25 AB:1 BC:1 CA:0
Smoothing: 10
Face 33: A:8 B:25 C:9 AB:0 BC:1 CA:1
Smoothing: 10
Face 34: A:9 B:25 C:26 AB:1 BC:1 CA:0
Smoothing: 11
Face 35: A:9 B:26 C:10 AB:0 BC:1 CA:1
Smoothing: 11
Face 36: A:10 B:26 C:27 AB:1 BC:1 CA:0
Smoothing: 12
Face 37: A:10 B:27 C:11 AB:0 BC:1 CA:1
Smoothing: 12
Face 38: A:11 B:27 C:28 AB:1 BC:1 CA:0
Smoothing: 13
Face 39: A:11 B:28 C:12 AB:0 BC:1 CA:1
Smoothing: 13
Face 40: A:12 B:28 C:29 AB:1 BC:1 CA:0
Smoothing: 14
Page 2
Face 41: A:12 B:29 C:13 AB:0 BC:1 CA:1
Smoothing: 14
Face 42: A:13 B:29 C:30 AB:1 BC:1 CA:0
Smoothing: 15
Face 43: A:13 B:30 C:14 AB:0 BC:1 CA:1
Smoothing: 15
Face 44: A:14 B:30 C:31 AB:1 BC:1 CA:0
Smoothing: 16
Face 45: A:14 B:31 C:15 AB:0 BC:1 CA:1
Smoothing: 16
Face 46: A:15 B:31 C:16 AB:1 BC:1 CA:0
Smoothing: 17
Face 47: A:15 B:16 C:0 AB:0 BC:1 CA:1
Smoothing: 17
Face 48: A:16 B:33 C:17 AB:0 BC:0 CA:1
Smoothing: 18
Face 49: A:17 B:33 C:18 AB:0 BC:0 CA:1
Smoothing: 18
Face 50: A:18 B:33 C:19 AB:0 BC:0 CA:1
Smoothing: 18
Face 51: A:19 B:33 C:20 AB:0 BC:0 CA:1
Smoothing: 18
Face 52: A:20 B:33 C:21 AB:0 BC:0 CA:1
Smoothing: 18
Face 53: A:21 B:33 C:22 AB:0 BC:0 CA:1
Smoothing: 18
Face 54: A:22 B:33 C:23 AB:0 BC:0 CA:1
Smoothing: 18
Face 55: A:23 B:33 C:24 AB:0 BC:0 CA:1
Smoothing: 18
Face 56: A:24 B:33 C:25 AB:0 BC:0 CA:1
Smoothing: 18
Face 57: A:25 B:33 C:26 AB:0 BC:0 CA:1
Smoothing: 18
Face 58: A:26 B:33 C:27 AB:0 BC:0 CA:1
Smoothing: 18
Face 59: A:27 B:33 C:28 AB:0 BC:0 CA:1
Smoothing: 18
Face 60: A:28 B:33 C:29 AB:0 BC:0 CA:1
Smoothing: 18
Face 61: A:29 B:33 C:30 AB:0 BC:0 CA:1
Smoothing: 18
Face 62: A:30 B:33 C:31 AB:0 BC:0 CA:1
Smoothing: 18
Face 63: A:31 B:33 C:16 AB:0 BC:0 CA:1
Smoothing: 18
Page 3

340
progs/ggi/gears.c Normal file
View File

@@ -0,0 +1,340 @@
/* $Id: gears.c,v 1.3 1999/08/22 08:56:50 jtaylor Exp $ */
/*
* 3-D gear wheels. This program is in the public domain.
*
* Brian Paul
*/
/* Conversion to GLUT by Mark J. Kilgard */
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <GL/glut.h>
#ifndef M_PI
#define M_PI 3.14159265
#endif
static GLint T0 = 0;
static GLint Frames = 0;
/**
Draw a gear wheel. You'll probably want to call this function when
building a display list since we do a lot of trig here.
Input: inner_radius - radius of hole at center
outer_radius - radius at center of teeth
width - width of gear
teeth - number of teeth
tooth_depth - depth of tooth
**/
static void
gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
GLint teeth, GLfloat tooth_depth)
{
GLint i;
GLfloat r0, r1, r2;
GLfloat angle, da;
GLfloat u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0;
r2 = outer_radius + tooth_depth / 2.0;
da = 2.0 * M_PI / teeth / 4.0;
glShadeModel(GL_FLAT);
glNormal3f(0.0, 0.0, 1.0);
/* draw front face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
if (i < teeth) {
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
}
}
glEnd();
/* draw front sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
}
glEnd();
glNormal3f(0.0, 0.0, -1.0);
/* draw back face */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
if (i < teeth) {
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
}
}
glEnd();
/* draw back sides of teeth */
glBegin(GL_QUADS);
da = 2.0 * M_PI / teeth / 4.0;
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
}
glEnd();
/* draw outward faces of teeth */
glBegin(GL_QUAD_STRIP);
for (i = 0; i < teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
u = r2 * cos(angle + da) - r1 * cos(angle);
v = r2 * sin(angle + da) - r1 * sin(angle);
len = sqrt(u * u + v * v);
u /= len;
v /= len;
glNormal3f(v, -u, 0.0);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
glNormal3f(cos(angle), sin(angle), 0.0);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), width * 0.5);
glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), -width * 0.5);
u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
glNormal3f(v, -u, 0.0);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), width * 0.5);
glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), -width * 0.5);
glNormal3f(cos(angle), sin(angle), 0.0);
}
glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
glEnd();
glShadeModel(GL_SMOOTH);
/* draw inside radius cylinder */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= teeth; i++) {
angle = i * 2.0 * M_PI / teeth;
glNormal3f(-cos(angle), -sin(angle), 0.0);
glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
}
glEnd();
}
static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
static GLint gear1, gear2, gear3;
static GLfloat angle = 0.0;
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1.0, 0.0, 0.0);
glRotatef(view_roty, 0.0, 1.0, 0.0);
glRotatef(view_rotz, 0.0, 0.0, 1.0);
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
glRotatef(angle, 0.0, 0.0, 1.0);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1, -2.0, 0.0);
glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1, 4.2, 0.0);
glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
glCallList(gear3);
glPopMatrix();
glPopMatrix();
glutSwapBuffers();
Frames++;
{
GLint t = glutGet(GLUT_ELAPSED_TIME);
if (t - T0 >= 5000) {
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
printf("%d frames in %g seconds = %g FPS\n", Frames, seconds, fps);
T0 = t;
Frames = 0;
}
}
}
static void
idle(void)
{
angle += 2.0;
glutPostRedisplay();
}
/* change view angle, exit upon ESC */
/* ARGSUSED1 */
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 'z':
view_rotz += 5.0;
break;
case 'Z':
view_rotz -= 5.0;
break;
case 27: /* Escape */
exit(0); /* FIXME: Shutdown and free resources cleanly in ggiglut */
break;
default:
return;
}
glutPostRedisplay();
}
/* change view angle */
/* ARGSUSED1 */
static void
special(int k, int x, int y)
{
switch (k) {
case GLUT_KEY_UP:
view_rotx += 5.0;
break;
case GLUT_KEY_DOWN:
view_rotx -= 5.0;
break;
case GLUT_KEY_LEFT:
view_roty += 5.0;
break;
case GLUT_KEY_RIGHT:
view_roty -= 5.0;
break;
default:
return;
}
glutPostRedisplay();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
}
static void
init(void)
{
static GLfloat pos[4] =
{5.0, 5.0, 10.0, 0.0};
static GLfloat red[4] =
{0.8, 0.1, 0.0, 1.0};
static GLfloat green[4] =
{0.0, 0.8, 0.2, 1.0};
static GLfloat blue[4] =
{0.2, 0.2, 1.0, 1.0};
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
/* make the gears */
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
gear(1.0, 4.0, 1.0, 20, 0.7);
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
gear(0.5, 2.0, 2.0, 10, 0.7);
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
gear(1.3, 2.0, 0.5, 10, 0.7);
glEndList();
glEnable(GL_NORMALIZE);
}
void
visible(int vis)
{
if (vis == GLUT_VISIBLE)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
// glutInitWindowPosition(0, 0);
// glutInitWindowSize(300, 300);
glutCreateWindow("Gears");
init();
glutDisplayFunc(draw);
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutVisibilityFunc(visible);
glutMainLoop();
return 0;
}

359
progs/ggi/gears2.c Normal file
View File

@@ -0,0 +1,359 @@
/* gears.c */
/*
* 3-D gear wheels. This program is in the public domain.
*
* Brian Paul
* modified by Uwe Maurer (uwe_maurer@t-online.de)
*/
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <ggi/ggi.h>
#include <GL/ggimesa.h>
#ifndef M_PI
# define M_PI 3.14159265
#endif
ggi_visual_t vis;
char text[100];
/*
* Draw a gear wheel. You'll probably want to call this function when
* building a display list since we do a lot of trig here.
*
* Input: inner_radius - radius of hole at center
* outer_radius - radius at center of teeth
* width - width of gear
* teeth - number of teeth
* tooth_depth - depth of tooth
*/
static void gear( GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
GLint teeth, GLfloat tooth_depth )
{
GLint i;
GLfloat r0, r1, r2;
GLfloat angle, da;
GLfloat u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth/2.0;
r2 = outer_radius + tooth_depth/2.0;
da = 2.0*M_PI / teeth / 4.0;
glShadeModel( GL_FLAT );
glNormal3f( 0.0, 0.0, 1.0 );
/* draw front face */
glBegin( GL_QUAD_STRIP );
for (i=0;i<=teeth;i++) {
angle = i * 2.0*M_PI / teeth;
glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
}
glEnd();
/* draw front sides of teeth */
glBegin( GL_QUADS );
da = 2.0*M_PI / teeth / 4.0;
for (i=0;i<teeth;i++) {
angle = i * 2.0*M_PI / teeth;
glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
glVertex3f( r2*cos(angle+da), r2*sin(angle+da), width*0.5 );
glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 );
glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
}
glEnd();
glNormal3f( 0.0, 0.0, -1.0 );
/* draw back face */
glBegin( GL_QUAD_STRIP );
for (i=0;i<=teeth;i++) {
angle = i * 2.0*M_PI / teeth;
glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
}
glEnd();
/* draw back sides of teeth */
glBegin( GL_QUADS );
da = 2.0*M_PI / teeth / 4.0;
for (i=0;i<teeth;i++) {
angle = i * 2.0*M_PI / teeth;
glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
glVertex3f( r2*cos(angle+da), r2*sin(angle+da), -width*0.5 );
glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
}
glEnd();
/* draw outward faces of teeth */
glBegin( GL_QUAD_STRIP );
for (i=0;i<teeth;i++) {
angle = i * 2.0*M_PI / teeth;
glVertex3f( r1*cos(angle), r1*sin(angle), width*0.5 );
glVertex3f( r1*cos(angle), r1*sin(angle), -width*0.5 );
u = r2*cos(angle+da) - r1*cos(angle);
v = r2*sin(angle+da) - r1*sin(angle);
len = sqrt( u*u + v*v );
u /= len;
v /= len;
glNormal3f( v, -u, 0.0 );
glVertex3f( r2*cos(angle+da), r2*sin(angle+da), width*0.5 );
glVertex3f( r2*cos(angle+da), r2*sin(angle+da), -width*0.5 );
glNormal3f( cos(angle), sin(angle), 0.0 );
glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), width*0.5 );
glVertex3f( r2*cos(angle+2*da), r2*sin(angle+2*da), -width*0.5 );
u = r1*cos(angle+3*da) - r2*cos(angle+2*da);
v = r1*sin(angle+3*da) - r2*sin(angle+2*da);
glNormal3f( v, -u, 0.0 );
glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), width*0.5 );
glVertex3f( r1*cos(angle+3*da), r1*sin(angle+3*da), -width*0.5 );
glNormal3f( cos(angle), sin(angle), 0.0 );
}
glVertex3f( r1*cos(0), r1*sin(0), width*0.5 );
glVertex3f( r1*cos(0), r1*sin(0), -width*0.5 );
glEnd();
glShadeModel( GL_SMOOTH );
/* draw inside radius cylinder */
glBegin( GL_QUAD_STRIP );
for (i=0;i<=teeth;i++) {
angle = i * 2.0*M_PI / teeth;
glNormal3f( -cos(angle), -sin(angle), 0.0 );
glVertex3f( r0*cos(angle), r0*sin(angle), -width*0.5 );
glVertex3f( r0*cos(angle), r0*sin(angle), width*0.5 );
}
glEnd();
}
static GLfloat view_rotx=20.0, view_roty=30.0, view_rotz=0.0;
static GLint gear1, gear2, gear3;
static GLfloat angle = 0.0;
static GLuint limit;
static GLuint count = 1;
static void draw( void )
{
glClearColor(0,0,0,0);
glClearIndex(0);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();
glRotatef( view_rotx, 1.0, 0.0, 0.0 );
glRotatef( view_roty, 0.0, 1.0, 0.0 );
glRotatef( view_rotz, 0.0, 0.0, 1.0 );
glPushMatrix();
glTranslatef( -3.0, -2.0, 0.0 );
glRotatef( angle, 0.0, 0.0, 1.0 );
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef( 3.1, -2.0, 0.0 );
glRotatef( -2.0*angle-9.0, 0.0, 0.0, 1.0 );
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef( -3.1, 4.2, 0.0 );
glRotatef( -2.0*angle-25.0, 0.0, 0.0, 1.0 );
glCallList(gear3);
glPopMatrix();
glPopMatrix();
glFlush();
glFinish();
#if 0
ggiSetGCForeground(vis,255);
ggiPuts(vis,0,0,"Mesa -> GGI");
ggiPuts(vis,0,ggiGetInfo(vis)->mode->visible.y," Mesa -> GGI");
ggiPuts(vis,0,16,text);
ggiPuts(vis,0,ggiGetInfo(vis)->mode->visible.y+16,text);
#endif
GGIMesaSwapBuffers();
count++;
if (count==limit) {
exit(1);
}
}
static void idle( void )
{
angle += 2.0;
draw();
}
/* new window size or exposure */
static void reshape( int width, int height )
{
GLfloat h = (GLfloat) height / (GLfloat) width;
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum( -1.0, 1.0, -h, h, 5.0, 60.0 );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef( 0.0, 0.0, -40.0 );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
}
static void init( void )
{
static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0 };
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0 };
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0 };
static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0 };
glLightfv( GL_LIGHT0, GL_POSITION, pos );
glEnable( GL_CULL_FACE );
glEnable( GL_LIGHTING );
glEnable( GL_LIGHT0 );
glEnable( GL_DEPTH_TEST );
/* make the gears */
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red );
glIndexi(1);
gear( 1.0, 4.0, 1.0, 20, 0.7 );
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green );
glIndexi(2);
gear( 0.5, 2.0, 2.0, 10, 0.7 );
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue );
glIndexi(3);
gear( 1.3, 2.0, 0.5, 10, 0.7 );
glEndList();
glEnable( GL_NORMALIZE );
}
static void usage(char *s)
{
printf("%s visible_x visible_y virtual_x virtual_y bpp db_flag\n",s);
printf("example:\n");
printf("%s 320 200 320 400 8 1\n",s);
exit(1);
}
int main( int argc, char *argv[] )
{
GGIMesaContext ctx;
int vis_x,vis_y,vir_x,vir_y,bpp,db_flag,gt;
ggi_mode mode;
limit=0;
if (argc<7) usage(argv[0]);
vis_x=atoi(argv[1]);
vis_y=atoi(argv[2]);
vir_x=atoi(argv[3]);
vir_y=atoi(argv[4]);
bpp=atoi(argv[5]);
db_flag=atoi(argv[6]);
switch(bpp)
{
case 4: gt=GT_4BIT;break;
case 8: gt=GT_8BIT;break;
case 15:gt=GT_15BIT;break;
case 16:gt=GT_16BIT;break;
case 24:gt=GT_24BIT;break;
case 32:gt=GT_32BIT;break;
default:
printf("%i Bits per Pixel ???\n",bpp);
exit(1);
}
sprintf(text,"%sx%s %i colors, RGB mode, %s",
argv[1],argv[2],1<<bpp,
(db_flag) ? "doublebuffer" : "no doublebuffer");
if (ggiInit()<0)
{
printf("ggiInit() failed\n");
exit(1);
}
ctx=GGIMesaCreateContext();
if (ctx==NULL)
{
printf("GGIMesaCreateContext() failed\n");
exit(1);
}
vis=ggiOpen(NULL);
if (vis==NULL)
{
printf("ggiOpen() failed\n");
exit(1);
}
if (ggiSetGraphMode(vis,vis_x,vis_y,vir_x,vir_y,gt)<0)
{
printf("%s: can't set graphmode (%i %i %i %i) %i BPP\n",
argv[0],vis_x,vis_y,vir_x,vir_y,bpp);
exit(1);
}
if (GGIMesaSetVisual(ctx,vis,GL_TRUE,db_flag)<0)
{
printf ("GGIMesaSetVisual() failed\n");
exit(1);
}
GGIMesaMakeCurrent(ctx);
ggiGetMode(vis,&mode);
reshape(mode.visible.x,mode.visible.y);
init();
while (!ggiKbhit(vis)) idle();
GGIMesaDestroyContext(ctx);
ggiClose(vis);
printf("%s\n",text);
ggiExit();
return 0;
}

132
progs/ggi/sphere.asc Normal file
View File

@@ -0,0 +1,132 @@
Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
Named object: "Object01"
Tri-mesh, Vertices: 20 Faces: 36
Vertex list:
Vertex 0: X: -210 Y: -432.781738 Z: 180.000031
Vertex 1: X: -610.810303 Y: 144.260559 Z: 103.580154
Vertex 2: X: 56.586655 Y: 144.260544 Z: -128.902023
Vertex 3: X: -75.776352 Y: 144.260605 Z: 565.321838
Vertex 4: X: -462.815979 Y: -347.937683 Z: 131.797302
Vertex 5: X: -616.506042 Y: -126.67173 Z: 102.494209
Vertex 6: X: -41.847229 Y: -347.937683 Z: -14.843644
Vertex 7: X: 60.375015 Y: -126.671753 Z: -133.291641
Vertex 8: X: -125.336807 Y: -347.937653 Z: 423.046448
Vertex 9: X: -73.868958 Y: -126.671692 Z: 570.797424
Vertex 10: X: -448.353271 Y: 237.304672 Z: -92.34951
Vertex 11: X: -192.440964 Y: 237.304672 Z: -181.494431
Vertex 12: X: 145.038193 Y: 237.304672 Z: 109.754745
Vertex 13: X: 94.283768 Y: 237.304688 Z: 375.953766
Vertex 14: X: -326.684937 Y: 237.304733 Z: 522.594727
Vertex 15: X: -531.842834 Y: 237.304718 Z: 345.540588
Vertex 16: X: -331.419525 Y: -225.964966 Z: -168.564438
Vertex 17: X: 152.575485 Y: -225.964935 Z: 249.129868
Vertex 18: X: -451.155914 Y: -225.964905 Z: 459.434662
Vertex 19: X: -298.413483 Y: 423.31897 Z: 163.142761
Face list:
Face 0: A:0 B:4 C:6 AB:1 BC:1 CA:1
Face 1: A:4 B:5 C:16 AB:1 BC:1 CA:1
Face 2: A:4 B:16 C:6 AB:1 BC:1 CA:1
Face 3: A:6 B:16 C:7 AB:1 BC:1 CA:1
Face 4: A:5 B:1 C:10 AB:1 BC:1 CA:1
Face 5: A:5 B:10 C:16 AB:1 BC:1 CA:1
Face 6: A:16 B:10 C:11 AB:1 BC:1 CA:1
Face 7: A:16 B:11 C:7 AB:1 BC:1 CA:1
Face 8: A:7 B:11 C:2 AB:1 BC:1 CA:1
Face 9: A:0 B:6 C:8 AB:1 BC:1 CA:1
Face 10: A:6 B:7 C:17 AB:1 BC:1 CA:1
Face 11: A:6 B:17 C:8 AB:1 BC:1 CA:1
Face 12: A:8 B:17 C:9 AB:1 BC:1 CA:1
Face 13: A:7 B:2 C:12 AB:1 BC:1 CA:1
Face 14: A:7 B:12 C:17 AB:1 BC:1 CA:1
Face 15: A:17 B:12 C:13 AB:1 BC:1 CA:1
Face 16: A:17 B:13 C:9 AB:1 BC:1 CA:1
Face 17: A:9 B:13 C:3 AB:1 BC:1 CA:1
Face 18: A:0 B:8 C:4 AB:1 BC:1 CA:1
Face 19: A:8 B:9 C:18 AB:1 BC:1 CA:1
Face 20: A:8 B:18 C:4 AB:1 BC:1 CA:1
Face 21: A:4 B:18 C:5 AB:1 BC:1 CA:1
Face 22: A:9 B:3 C:14 AB:1 BC:1 CA:1
Face 23: A:9 B:14 C:18 AB:1 BC:1 CA:1
Face 24: A:18 B:14 C:15 AB:1 BC:1 CA:1
Face 25: A:18 B:15 C:5 AB:1 BC:1 CA:1
Face 26: A:5 B:15 C:1 AB:1 BC:1 CA:1
Face 27: A:1 B:15 C:10 AB:1 BC:1 CA:1
Face 28: A:15 B:14 C:19 AB:1 BC:1 CA:1
Face 29: A:15 B:19 C:10 AB:1 BC:1 CA:1
Face 30: A:10 B:19 C:11 AB:1 BC:1 CA:1
Face 31: A:14 B:3 C:13 AB:1 BC:1 CA:1
Face 32: A:14 B:13 C:19 AB:1 BC:1 CA:1
Face 33: A:19 B:13 C:12 AB:1 BC:1 CA:1
Face 34: A:19 B:12 C:11 AB:1 BC:1 CA:1
Page 1
Face 35: A:11 B:12 C:2 AB:1 BC:1 CA:1
Page 2

264
progs/ggi/torus.asc Normal file
View File

@@ -0,0 +1,264 @@
Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
Named object: "Object01"
Tri-mesh, Vertices: 40 Faces: 80
Vertex list:
Vertex 0: X: -50.170624 Y: -0.000026 Z: -240.147842
Vertex 1: X: -80.584503 Y: -63.958851 Z: -205.014572
Vertex 2: X: -129.795166 Y: -39.528744 Z: -148.16774
Vertex 3: X: -129.795166 Y: 39.528721 Z: -148.16774
Vertex 4: X: -80.584503 Y: 63.958797 Z: -205.014572
Vertex 5: X: 85.963654 Y: -0.000002 Z: 31.490465
Vertex 6: X: 39.614838 Y: -63.958828 Z: 34.827602
Vertex 7: X: -35.37915 Y: -39.528728 Z: 40.227196
Vertex 8: X: -35.37912 Y: 39.528736 Z: 40.227188
Vertex 9: X: 39.614838 Y: 63.95882 Z: 34.827595
Vertex 10: X: -9.852051 Y: 0.000023 Z: 319.829254
Vertex 11: X: -44.985352 Y: -63.958805 Z: 289.415405
Vertex 12: X: -101.832199 Y: -39.528709 Z: 240.204758
Vertex 13: X: -101.832184 Y: 39.528755 Z: 240.204773
Vertex 14: X: -44.985352 Y: 63.958843 Z: 289.415405
Vertex 15: X: -281.490326 Y: 0.000035 Z: 455.963654
Vertex 16: X: -284.827484 Y: -63.958794 Z: 409.614868
Vertex 17: X: -290.227112 Y: -39.528702 Z: 334.62085
Vertex 18: X: -290.227112 Y: 39.528763 Z: 334.62088
Vertex 19: X: -284.827484 Y: 63.958855 Z: 409.614838
Vertex 20: X: -569.829163 Y: 0.000026 Z: 360.14798
Vertex 21: X: -539.415344 Y: -63.958801 Z: 325.014709
Vertex 22: X: -490.204712 Y: -39.528709 Z: 268.167847
Vertex 23: X: -490.204712 Y: 39.528755 Z: 268.167847
Vertex 24: X: -539.415344 Y: 63.958847 Z: 325.014679
Vertex 25: X: -705.963684 Y: 0.000002 Z: 88.509598
Vertex 26: X: -659.614807 Y: -63.958824 Z: 85.172462
Vertex 27: X: -584.62085 Y: -39.528725 Z: 79.77285
Vertex 28: X: -584.62085 Y: 39.52874 Z: 79.77285
Vertex 29: X: -659.614868 Y: 63.958824 Z: 85.172447
Vertex 30: X: -610.147827 Y: -0.000023 Z: -199.829361
Vertex 31: X: -575.014587 Y: -63.958847 Z: -169.415497
Vertex 32: X: -518.167725 Y: -39.528744 Z: -120.204819
Vertex 33: X: -518.167725 Y: 39.528721 Z: -120.204834
Vertex 34: X: -575.014587 Y: 63.958801 Z: -169.415497
Vertex 35: X: -338.509338 Y: -0.000035 Z: -335.963745
Vertex 36: X: -335.172241 Y: -63.958858 Z: -289.614868
Vertex 37: X: -329.772675 Y: -39.528751 Z: -214.620865
Vertex 38: X: -329.772675 Y: 39.528713 Z: -214.620865
Vertex 39: X: -335.172241 Y: 63.95879 Z: -289.614899
Face list:
Face 0: A:0 B:6 C:1 AB:0 BC:1 CA:1
Smoothing: 1
Face 1: A:0 B:5 C:6 AB:1 BC:1 CA:0
Smoothing: 1
Face 2: A:1 B:7 C:2 AB:0 BC:1 CA:1
Smoothing: 2
Face 3: A:1 B:6 C:7 AB:1 BC:1 CA:0
Smoothing: 2
Face 4: A:2 B:8 C:3 AB:0 BC:1 CA:1
Smoothing: 3
Face 5: A:2 B:7 C:8 AB:1 BC:1 CA:0
Smoothing: 3
Face 6: A:3 B:9 C:4 AB:0 BC:1 CA:1
Smoothing: 4
Face 7: A:3 B:8 C:9 AB:1 BC:1 CA:0
Page 1
Smoothing: 4
Face 8: A:4 B:5 C:0 AB:0 BC:1 CA:1
Smoothing: 5
Face 9: A:4 B:9 C:5 AB:1 BC:1 CA:0
Smoothing: 5
Face 10: A:5 B:11 C:6 AB:0 BC:1 CA:1
Smoothing: 6
Face 11: A:5 B:10 C:11 AB:1 BC:1 CA:0
Smoothing: 6
Face 12: A:6 B:12 C:7 AB:0 BC:1 CA:1
Smoothing: 7
Face 13: A:6 B:11 C:12 AB:1 BC:1 CA:0
Smoothing: 7
Face 14: A:7 B:13 C:8 AB:0 BC:1 CA:1
Smoothing: 8
Face 15: A:7 B:12 C:13 AB:1 BC:1 CA:0
Smoothing: 8
Face 16: A:8 B:14 C:9 AB:0 BC:1 CA:1
Smoothing: 9
Face 17: A:8 B:13 C:14 AB:1 BC:1 CA:0
Smoothing: 9
Face 18: A:9 B:10 C:5 AB:0 BC:1 CA:1
Smoothing: 10
Face 19: A:9 B:14 C:10 AB:1 BC:1 CA:0
Smoothing: 10
Face 20: A:10 B:16 C:11 AB:0 BC:1 CA:1
Smoothing: 11
Face 21: A:10 B:15 C:16 AB:1 BC:1 CA:0
Smoothing: 11
Face 22: A:11 B:17 C:12 AB:0 BC:1 CA:1
Smoothing: 12
Face 23: A:11 B:16 C:17 AB:1 BC:1 CA:0
Smoothing: 12
Face 24: A:12 B:18 C:13 AB:0 BC:1 CA:1
Smoothing: 13
Face 25: A:12 B:17 C:18 AB:1 BC:1 CA:0
Smoothing: 13
Face 26: A:13 B:19 C:14 AB:0 BC:1 CA:1
Smoothing: 14
Face 27: A:13 B:18 C:19 AB:1 BC:1 CA:0
Smoothing: 14
Face 28: A:14 B:15 C:10 AB:0 BC:1 CA:1
Smoothing: 15
Face 29: A:14 B:19 C:15 AB:1 BC:1 CA:0
Smoothing: 15
Face 30: A:15 B:21 C:16 AB:0 BC:1 CA:1
Smoothing: 16
Face 31: A:15 B:20 C:21 AB:1 BC:1 CA:0
Smoothing: 16
Face 32: A:16 B:22 C:17 AB:0 BC:1 CA:1
Smoothing: 17
Face 33: A:16 B:21 C:22 AB:1 BC:1 CA:0
Smoothing: 17
Face 34: A:17 B:23 C:18 AB:0 BC:1 CA:1
Smoothing: 18
Face 35: A:17 B:22 C:23 AB:1 BC:1 CA:0
Smoothing: 18
Face 36: A:18 B:24 C:19 AB:0 BC:1 CA:1
Smoothing: 19
Face 37: A:18 B:23 C:24 AB:1 BC:1 CA:0
Smoothing: 19
Page 2
Face 38: A:19 B:20 C:15 AB:0 BC:1 CA:1
Smoothing: 20
Face 39: A:19 B:24 C:20 AB:1 BC:1 CA:0
Smoothing: 20
Face 40: A:20 B:26 C:21 AB:0 BC:1 CA:1
Smoothing: 21
Face 41: A:20 B:25 C:26 AB:1 BC:1 CA:0
Smoothing: 21
Face 42: A:21 B:27 C:22 AB:0 BC:1 CA:1
Smoothing: 22
Face 43: A:21 B:26 C:27 AB:1 BC:1 CA:0
Smoothing: 22
Face 44: A:22 B:28 C:23 AB:0 BC:1 CA:1
Smoothing: 23
Face 45: A:22 B:27 C:28 AB:1 BC:1 CA:0
Smoothing: 23
Face 46: A:23 B:29 C:24 AB:0 BC:1 CA:1
Smoothing: 24
Face 47: A:23 B:28 C:29 AB:1 BC:1 CA:0
Smoothing: 24
Face 48: A:24 B:25 C:20 AB:0 BC:1 CA:1
Smoothing: 25
Face 49: A:24 B:29 C:25 AB:1 BC:1 CA:0
Smoothing: 25
Face 50: A:25 B:31 C:26 AB:0 BC:1 CA:1
Smoothing: 26
Face 51: A:25 B:30 C:31 AB:1 BC:1 CA:0
Smoothing: 26
Face 52: A:26 B:32 C:27 AB:0 BC:1 CA:1
Smoothing: 27
Face 53: A:26 B:31 C:32 AB:1 BC:1 CA:0
Smoothing: 27
Face 54: A:27 B:33 C:28 AB:0 BC:1 CA:1
Smoothing: 28
Face 55: A:27 B:32 C:33 AB:1 BC:1 CA:0
Smoothing: 28
Face 56: A:28 B:34 C:29 AB:0 BC:1 CA:1
Smoothing: 29
Face 57: A:28 B:33 C:34 AB:1 BC:1 CA:0
Smoothing: 29
Face 58: A:29 B:30 C:25 AB:0 BC:1 CA:1
Smoothing: 30
Face 59: A:29 B:34 C:30 AB:1 BC:1 CA:0
Smoothing: 30
Face 60: A:30 B:36 C:31 AB:0 BC:1 CA:1
Smoothing: 31
Face 61: A:30 B:35 C:36 AB:1 BC:1 CA:0
Smoothing: 31
Face 62: A:31 B:37 C:32 AB:0 BC:1 CA:1
Smoothing: 32
Face 63: A:31 B:36 C:37 AB:1 BC:1 CA:0
Smoothing: 32
Face 64: A:32 B:38 C:33 AB:0 BC:1 CA:1
Smoothing: 1
Face 65: A:32 B:37 C:38 AB:1 BC:1 CA:0
Smoothing: 1
Face 66: A:33 B:39 C:34 AB:0 BC:1 CA:1
Smoothing: 2
Face 67: A:33 B:38 C:39 AB:1 BC:1 CA:0
Smoothing: 2
Face 68: A:34 B:35 C:30 AB:0 BC:1 CA:1
Page 3
Smoothing: 3
Face 69: A:34 B:39 C:35 AB:1 BC:1 CA:0
Smoothing: 3
Face 70: A:35 B:1 C:36 AB:0 BC:1 CA:1
Smoothing: 4
Face 71: A:35 B:0 C:1 AB:1 BC:1 CA:0
Smoothing: 4
Face 72: A:36 B:2 C:37 AB:0 BC:1 CA:1
Smoothing: 5
Face 73: A:36 B:1 C:2 AB:1 BC:1 CA:0
Smoothing: 5
Face 74: A:37 B:3 C:38 AB:0 BC:1 CA:1
Smoothing: 6
Face 75: A:37 B:2 C:3 AB:1 BC:1 CA:0
Smoothing: 6
Face 76: A:38 B:4 C:39 AB:0 BC:1 CA:1
Smoothing: 7
Face 77: A:38 B:3 C:4 AB:1 BC:1 CA:0
Smoothing: 7
Face 78: A:39 B:0 C:35 AB:0 BC:1 CA:1
Smoothing: 8
Face 79: A:39 B:4 C:0 AB:1 BC:1 CA:0
Smoothing: 8
Page 4

396
progs/ggi/tube.asc Normal file
View File

@@ -0,0 +1,396 @@
Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
Named object: "Object01"
Tri-mesh, Vertices: 64 Faces: 128
Vertex list:
Vertex 0: X: 61.483898 Y: 37.836231 Z: -70.94294
Vertex 1: X: 82.867447 Y: 37.836235 Z: -41.288902
Vertex 2: X: 91.275154 Y: 37.836239 Z: -5.70901
Vertex 3: X: 85.427025 Y: 37.836243 Z: 30.380013
Vertex 4: X: 66.213379 Y: 37.836243 Z: 61.483936
Vertex 5: X: 36.559322 Y: 37.836246 Z: 82.86747
Vertex 6: X: 0.979424 Y: 37.836246 Z: 91.275154
Vertex 7: X: -35.109554 Y: 37.836246 Z: 85.42701
Vertex 8: X: -66.213478 Y: 37.836246 Z: 66.213356
Vertex 9: X: -87.597 Y: 37.836243 Z: 36.559303
Vertex 10: X: -96.004677 Y: 37.836239 Z: 0.979406
Vertex 11: X: -90.156517 Y: 37.836235 Z: -35.109615
Vertex 12: X: -70.942848 Y: 37.836235 Z: -66.213516
Vertex 13: X: -41.288776 Y: 37.836231 Z: -87.597023
Vertex 14: X: -5.708872 Y: 37.836231 Z: -96.004692
Vertex 15: X: 30.380142 Y: 37.836231 Z: -90.156502
Vertex 16: X: 61.483898 Y: -38.14529 Z: -70.942932
Vertex 17: X: 82.867447 Y: -38.145287 Z: -41.288895
Vertex 18: X: 91.275154 Y: -38.145283 Z: -5.709003
Vertex 19: X: 85.427025 Y: -38.145279 Z: 30.38002
Vertex 20: X: 66.213379 Y: -38.145279 Z: 61.483944
Vertex 21: X: 36.559322 Y: -38.145275 Z: 82.867477
Vertex 22: X: 0.979424 Y: -38.145275 Z: 91.275162
Vertex 23: X: -35.109554 Y: -38.145275 Z: 85.427017
Vertex 24: X: -66.213478 Y: -38.145275 Z: 66.213364
Vertex 25: X: -87.597 Y: -38.145279 Z: 36.559311
Vertex 26: X: -96.004677 Y: -38.145283 Z: 0.979412
Vertex 27: X: -90.156517 Y: -38.145287 Z: -35.109608
Vertex 28: X: -70.942848 Y: -38.145287 Z: -66.213516
Vertex 29: X: -41.288776 Y: -38.14529 Z: -87.597015
Vertex 30: X: -5.708872 Y: -38.14529 Z: -96.004684
Vertex 31: X: 30.380142 Y: -38.14529 Z: -90.156494
Vertex 32: X: 29.53923 Y: 37.836235 Z: -36.632011
Vertex 33: X: 40.224194 Y: 37.836239 Z: -21.814436
Vertex 34: X: 44.425369 Y: 37.836239 Z: -4.035822
Vertex 35: X: 41.503166 Y: 37.836239 Z: 13.997195
Vertex 36: X: 31.902466 Y: 37.836243 Z: 29.539249
Vertex 37: X: 17.084883 Y: 37.836243 Z: 40.224201
Vertex 38: X: -0.693734 Y: 37.836243 Z: 44.425365
Vertex 39: X: -18.726728 Y: 37.836243 Z: 41.503159
Vertex 40: X: -34.26878 Y: 37.836243 Z: 31.902454
Vertex 41: X: -44.953732 Y: 37.836239 Z: 17.084871
Vertex 42: X: -49.154892 Y: 37.836239 Z: -0.693745
Vertex 43: X: -46.232677 Y: 37.836239 Z: -18.726759
Vertex 44: X: -36.631962 Y: 37.836235 Z: -34.268806
Vertex 45: X: -21.814371 Y: 37.836235 Z: -44.953747
Vertex 46: X: -4.035751 Y: 37.836235 Z: -49.1549
Vertex 47: X: 13.997261 Y: 37.836235 Z: -46.23267
Vertex 48: X: 29.53923 Y: -38.145287 Z: -36.632004
Vertex 49: X: 40.224194 Y: -38.145283 Z: -21.814428
Vertex 50: X: 44.425369 Y: -38.145283 Z: -4.035816
Vertex 51: X: 41.503166 Y: -38.145283 Z: 13.997201
Vertex 52: X: 31.902466 Y: -38.145279 Z: 29.539257
Vertex 53: X: 17.084883 Y: -38.145279 Z: 40.224209
Vertex 54: X: -0.693734 Y: -38.145279 Z: 44.425373
Vertex 55: X: -18.726728 Y: -38.145279 Z: 41.503166
Page 1
Vertex 56: X: -34.26878 Y: -38.145279 Z: 31.902462
Vertex 57: X: -44.953732 Y: -38.145283 Z: 17.084879
Vertex 58: X: -49.154892 Y: -38.145283 Z: -0.693738
Vertex 59: X: -46.232677 Y: -38.145283 Z: -18.726751
Vertex 60: X: -36.631962 Y: -38.145287 Z: -34.268799
Vertex 61: X: -21.814371 Y: -38.145287 Z: -44.953739
Vertex 62: X: -4.035751 Y: -38.145287 Z: -49.154892
Vertex 63: X: 13.997261 Y: -38.145287 Z: -46.232662
Face list:
Face 0: A:0 B:1 C:17 AB:1 BC:1 CA:0
Smoothing: 1
Face 1: A:0 B:17 C:16 AB:0 BC:1 CA:1
Smoothing: 1
Face 2: A:1 B:2 C:18 AB:1 BC:1 CA:0
Smoothing: 2
Face 3: A:1 B:18 C:17 AB:0 BC:1 CA:1
Smoothing: 2
Face 4: A:2 B:3 C:19 AB:1 BC:1 CA:0
Smoothing: 3
Face 5: A:2 B:19 C:18 AB:0 BC:1 CA:1
Smoothing: 3
Face 6: A:3 B:4 C:20 AB:1 BC:1 CA:0
Smoothing: 4
Face 7: A:3 B:20 C:19 AB:0 BC:1 CA:1
Smoothing: 4
Face 8: A:4 B:5 C:21 AB:1 BC:1 CA:0
Smoothing: 5
Face 9: A:4 B:21 C:20 AB:0 BC:1 CA:1
Smoothing: 5
Face 10: A:5 B:6 C:22 AB:1 BC:1 CA:0
Smoothing: 6
Face 11: A:5 B:22 C:21 AB:0 BC:1 CA:1
Smoothing: 6
Face 12: A:6 B:7 C:23 AB:1 BC:1 CA:0
Smoothing: 7
Face 13: A:6 B:23 C:22 AB:0 BC:1 CA:1
Smoothing: 7
Face 14: A:7 B:8 C:24 AB:1 BC:1 CA:0
Smoothing: 8
Face 15: A:7 B:24 C:23 AB:0 BC:1 CA:1
Smoothing: 8
Face 16: A:8 B:9 C:25 AB:1 BC:1 CA:0
Smoothing: 9
Face 17: A:8 B:25 C:24 AB:0 BC:1 CA:1
Smoothing: 9
Face 18: A:9 B:10 C:26 AB:1 BC:1 CA:0
Smoothing: 10
Face 19: A:9 B:26 C:25 AB:0 BC:1 CA:1
Smoothing: 10
Face 20: A:10 B:11 C:27 AB:1 BC:1 CA:0
Smoothing: 11
Face 21: A:10 B:27 C:26 AB:0 BC:1 CA:1
Smoothing: 11
Face 22: A:11 B:12 C:28 AB:1 BC:1 CA:0
Smoothing: 12
Face 23: A:11 B:28 C:27 AB:0 BC:1 CA:1
Smoothing: 12
Face 24: A:12 B:13 C:29 AB:1 BC:1 CA:0
Smoothing: 13
Face 25: A:12 B:29 C:28 AB:0 BC:1 CA:1
Smoothing: 13
Page 2
Face 26: A:13 B:14 C:30 AB:1 BC:1 CA:0
Smoothing: 14
Face 27: A:13 B:30 C:29 AB:0 BC:1 CA:1
Smoothing: 14
Face 28: A:14 B:15 C:31 AB:1 BC:1 CA:0
Smoothing: 15
Face 29: A:14 B:31 C:30 AB:0 BC:1 CA:1
Smoothing: 15
Face 30: A:15 B:0 C:16 AB:1 BC:1 CA:0
Smoothing: 16
Face 31: A:15 B:16 C:31 AB:0 BC:1 CA:1
Smoothing: 16
Face 32: A:32 B:49 C:33 AB:0 BC:1 CA:1
Smoothing: 17
Face 33: A:32 B:48 C:49 AB:1 BC:1 CA:0
Smoothing: 17
Face 34: A:33 B:50 C:34 AB:0 BC:1 CA:1
Smoothing: 18
Face 35: A:33 B:49 C:50 AB:1 BC:1 CA:0
Smoothing: 18
Face 36: A:34 B:51 C:35 AB:0 BC:1 CA:1
Smoothing: 19
Face 37: A:34 B:50 C:51 AB:1 BC:1 CA:0
Smoothing: 19
Face 38: A:35 B:52 C:36 AB:0 BC:1 CA:1
Smoothing: 20
Face 39: A:35 B:51 C:52 AB:1 BC:1 CA:0
Smoothing: 20
Face 40: A:36 B:53 C:37 AB:0 BC:1 CA:1
Smoothing: 21
Face 41: A:36 B:52 C:53 AB:1 BC:1 CA:0
Smoothing: 21
Face 42: A:37 B:54 C:38 AB:0 BC:1 CA:1
Smoothing: 22
Face 43: A:37 B:53 C:54 AB:1 BC:1 CA:0
Smoothing: 22
Face 44: A:38 B:55 C:39 AB:0 BC:1 CA:1
Smoothing: 23
Face 45: A:38 B:54 C:55 AB:1 BC:1 CA:0
Smoothing: 23
Face 46: A:39 B:56 C:40 AB:0 BC:1 CA:1
Smoothing: 24
Face 47: A:39 B:55 C:56 AB:1 BC:1 CA:0
Smoothing: 24
Face 48: A:40 B:57 C:41 AB:0 BC:1 CA:1
Smoothing: 25
Face 49: A:40 B:56 C:57 AB:1 BC:1 CA:0
Smoothing: 25
Face 50: A:41 B:58 C:42 AB:0 BC:1 CA:1
Smoothing: 26
Face 51: A:41 B:57 C:58 AB:1 BC:1 CA:0
Smoothing: 26
Face 52: A:42 B:59 C:43 AB:0 BC:1 CA:1
Smoothing: 27
Face 53: A:42 B:58 C:59 AB:1 BC:1 CA:0
Smoothing: 27
Face 54: A:43 B:60 C:44 AB:0 BC:1 CA:1
Smoothing: 28
Face 55: A:43 B:59 C:60 AB:1 BC:1 CA:0
Smoothing: 28
Face 56: A:44 B:61 C:45 AB:0 BC:1 CA:1
Page 3
Smoothing: 29
Face 57: A:44 B:60 C:61 AB:1 BC:1 CA:0
Smoothing: 29
Face 58: A:45 B:62 C:46 AB:0 BC:1 CA:1
Smoothing: 30
Face 59: A:45 B:61 C:62 AB:1 BC:1 CA:0
Smoothing: 30
Face 60: A:46 B:63 C:47 AB:0 BC:1 CA:1
Smoothing: 31
Face 61: A:46 B:62 C:63 AB:1 BC:1 CA:0
Smoothing: 31
Face 62: A:47 B:48 C:32 AB:0 BC:1 CA:1
Smoothing: 32
Face 63: A:47 B:63 C:48 AB:1 BC:1 CA:0
Smoothing: 32
Face 64: A:0 B:32 C:33 AB:0 BC:1 CA:0
Smoothing: 1
Face 65: A:0 B:33 C:1 AB:0 BC:0 CA:1
Smoothing: 1
Face 66: A:1 B:33 C:34 AB:0 BC:1 CA:0
Smoothing: 1
Face 67: A:1 B:34 C:2 AB:0 BC:0 CA:1
Smoothing: 1
Face 68: A:2 B:34 C:35 AB:0 BC:1 CA:0
Smoothing: 1
Face 69: A:2 B:35 C:3 AB:0 BC:0 CA:1
Smoothing: 1
Face 70: A:3 B:35 C:36 AB:0 BC:1 CA:0
Smoothing: 1
Face 71: A:3 B:36 C:4 AB:0 BC:0 CA:1
Smoothing: 1
Face 72: A:4 B:36 C:37 AB:0 BC:1 CA:0
Smoothing: 1
Face 73: A:4 B:37 C:5 AB:0 BC:0 CA:1
Smoothing: 1
Face 74: A:5 B:37 C:38 AB:0 BC:1 CA:0
Smoothing: 1
Face 75: A:5 B:38 C:6 AB:0 BC:0 CA:1
Smoothing: 1
Face 76: A:6 B:38 C:39 AB:0 BC:1 CA:0
Smoothing: 1
Face 77: A:6 B:39 C:7 AB:0 BC:0 CA:1
Smoothing: 1
Face 78: A:7 B:39 C:40 AB:0 BC:1 CA:0
Smoothing: 1
Face 79: A:7 B:40 C:8 AB:0 BC:0 CA:1
Smoothing: 1
Face 80: A:8 B:40 C:41 AB:0 BC:1 CA:0
Smoothing: 1
Face 81: A:8 B:41 C:9 AB:0 BC:0 CA:1
Smoothing: 1
Face 82: A:9 B:41 C:42 AB:0 BC:1 CA:0
Smoothing: 1
Face 83: A:9 B:42 C:10 AB:0 BC:0 CA:1
Smoothing: 1
Face 84: A:10 B:42 C:43 AB:0 BC:1 CA:0
Smoothing: 1
Face 85: A:10 B:43 C:11 AB:0 BC:0 CA:1
Smoothing: 1
Face 86: A:11 B:43 C:44 AB:0 BC:1 CA:0
Smoothing: 1
Page 4
Face 87: A:11 B:44 C:12 AB:0 BC:0 CA:1
Smoothing: 1
Face 88: A:12 B:44 C:45 AB:0 BC:1 CA:0
Smoothing: 1
Face 89: A:12 B:45 C:13 AB:0 BC:0 CA:1
Smoothing: 1
Face 90: A:13 B:45 C:46 AB:0 BC:1 CA:0
Smoothing: 1
Face 91: A:13 B:46 C:14 AB:0 BC:0 CA:1
Smoothing: 1
Face 92: A:14 B:46 C:47 AB:0 BC:1 CA:0
Smoothing: 1
Face 93: A:14 B:47 C:15 AB:0 BC:0 CA:1
Smoothing: 1
Face 94: A:15 B:47 C:32 AB:0 BC:1 CA:0
Smoothing: 1
Face 95: A:15 B:32 C:0 AB:0 BC:0 CA:1
Smoothing: 1
Face 96: A:16 B:17 C:49 AB:1 BC:0 CA:0
Smoothing: 2
Face 97: A:16 B:49 C:48 AB:0 BC:1 CA:0
Smoothing: 2
Face 98: A:17 B:18 C:50 AB:1 BC:0 CA:0
Smoothing: 2
Face 99: A:17 B:50 C:49 AB:0 BC:1 CA:0
Smoothing: 2
Face 100: A:18 B:19 C:51 AB:1 BC:0 CA:0
Smoothing: 2
Face 101: A:18 B:51 C:50 AB:0 BC:1 CA:0
Smoothing: 2
Face 102: A:19 B:20 C:52 AB:1 BC:0 CA:0
Smoothing: 2
Face 103: A:19 B:52 C:51 AB:0 BC:1 CA:0
Smoothing: 2
Face 104: A:20 B:21 C:53 AB:1 BC:0 CA:0
Smoothing: 2
Face 105: A:20 B:53 C:52 AB:0 BC:1 CA:0
Smoothing: 2
Face 106: A:21 B:22 C:54 AB:1 BC:0 CA:0
Smoothing: 2
Face 107: A:21 B:54 C:53 AB:0 BC:1 CA:0
Smoothing: 2
Face 108: A:22 B:23 C:55 AB:1 BC:0 CA:0
Smoothing: 2
Face 109: A:22 B:55 C:54 AB:0 BC:1 CA:0
Smoothing: 2
Face 110: A:23 B:24 C:56 AB:1 BC:0 CA:0
Smoothing: 2
Face 111: A:23 B:56 C:55 AB:0 BC:1 CA:0
Smoothing: 2
Face 112: A:24 B:25 C:57 AB:1 BC:0 CA:0
Smoothing: 2
Face 113: A:24 B:57 C:56 AB:0 BC:1 CA:0
Smoothing: 2
Face 114: A:25 B:26 C:58 AB:1 BC:0 CA:0
Smoothing: 2
Face 115: A:25 B:58 C:57 AB:0 BC:1 CA:0
Smoothing: 2
Face 116: A:26 B:27 C:59 AB:1 BC:0 CA:0
Smoothing: 2
Face 117: A:26 B:59 C:58 AB:0 BC:1 CA:0
Page 5
Smoothing: 2
Face 118: A:27 B:28 C:60 AB:1 BC:0 CA:0
Smoothing: 2
Face 119: A:27 B:60 C:59 AB:0 BC:1 CA:0
Smoothing: 2
Face 120: A:28 B:29 C:61 AB:1 BC:0 CA:0
Smoothing: 2
Face 121: A:28 B:61 C:60 AB:0 BC:1 CA:0
Smoothing: 2
Face 122: A:29 B:30 C:62 AB:1 BC:0 CA:0
Smoothing: 2
Face 123: A:29 B:62 C:61 AB:0 BC:1 CA:0
Smoothing: 2
Face 124: A:30 B:31 C:63 AB:1 BC:0 CA:0
Smoothing: 2
Face 125: A:30 B:63 C:62 AB:0 BC:1 CA:0
Smoothing: 2
Face 126: A:31 B:16 C:48 AB:1 BC:0 CA:0
Smoothing: 2
Face 127: A:31 B:48 C:63 AB:0 BC:1 CA:0
Smoothing: 2
Page 6

View File

@@ -1,12 +1,15 @@
# $Id: Makefile.BeOS-R4,v 1.1 1999/08/19 00:55:40 jtg Exp $
# $Id: Makefile.BeOS-R4,v 1.2 1999/09/17 00:08:31 brianp Exp $
# Makefile for OpenGL Programming Guide programs for BeOS R4
# This file is in the public domain.
# $Log: Makefile.BeOS-R4,v $
# Revision 1.1 1999/08/19 00:55:40 jtg
# Initial revision
# Revision 1.2 1999/09/17 00:08:31 brianp
# link with -lGLU -lGL instead of -lMesaGLU -lMesaGL
#
# Revision 1.1.1.1 1999/08/19 00:55:40 jtg
# Imported sources
#
# Revision 1.1 1999/02/25 02:13:06 brianp
# initial check-in
@@ -18,7 +21,7 @@
INCDIR = ../include
LIBDIR = ../lib
GL_LIBS = -L$(LIBDIR) -L/boot/home/config/lib -Xlinker -rpath $(LIBDIR) -lbe -lglut -lMesaGLU -lMesaGL $(XLIBS)
GL_LIBS = -L$(LIBDIR) -L/boot/home/config/lib -Xlinker -rpath $(LIBDIR) -lbe -lglut -lGLU -lGL $(XLIBS)
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -57,7 +57,7 @@ void myinit(void)
glMaterialf(GL_FRONT, GL_SHININESS, 50.0);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lm_ambient);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glDepthFunc(GL_LESS);
@@ -68,25 +68,25 @@ void myinit(void)
glClearAccum(0.0, 0.0, 0.0, 0.0);
}
void displayObjects(void)
void displayObjects(void)
{
GLfloat torus_diffuse[] = { 0.7, 0.7, 0.0, 1.0 };
GLfloat cube_diffuse[] = { 0.0, 0.7, 0.7, 1.0 };
GLfloat sphere_diffuse[] = { 0.7, 0.0, 0.7, 1.0 };
GLfloat octa_diffuse[] = { 0.7, 0.4, 0.4, 1.0 };
glPushMatrix ();
glRotatef (30.0, 1.0, 0.0, 0.0);
glPushMatrix ();
glTranslatef (-0.80, 0.35, 0.0);
glTranslatef (-0.80, 0.35, 0.0);
glRotatef (100.0, 1.0, 0.0, 0.0);
glMaterialfv(GL_FRONT, GL_DIFFUSE, torus_diffuse);
glutSolidTorus (0.275, 0.85, 16, 16);
glPopMatrix ();
glPushMatrix ();
glTranslatef (-0.75, -0.50, 0.0);
glTranslatef (-0.75, -0.50, 0.0);
glRotatef (45.0, 0.0, 0.0, 1.0);
glRotatef (45.0, 1.0, 0.0, 0.0);
glMaterialfv(GL_FRONT, GL_DIFFUSE, cube_diffuse);
@@ -94,14 +94,14 @@ void displayObjects(void)
glPopMatrix ();
glPushMatrix ();
glTranslatef (0.75, 0.60, 0.0);
glTranslatef (0.75, 0.60, 0.0);
glRotatef (30.0, 1.0, 0.0, 0.0);
glMaterialfv(GL_FRONT, GL_DIFFUSE, sphere_diffuse);
glutSolidSphere (1.0, 16, 16);
glPopMatrix ();
glPushMatrix ();
glTranslatef (0.70, -0.90, 0.25);
glTranslatef (0.70, -0.90, 0.25);
glMaterialfv(GL_FRONT, GL_DIFFUSE, octa_diffuse);
glutSolidOctahedron ();
glPopMatrix ();
@@ -124,7 +124,7 @@ void display(void)
glPushMatrix ();
/* Note that 4.5 is the distance in world space between
* left and right and bottom and top.
* This formula converts fractional pixel movement to
* This formula converts fractional pixel movement to
* world coordinates.
*/
glTranslatef (j8[jitter].x*4.5/viewport[2],
@@ -142,15 +142,28 @@ void myReshape(int w, int h)
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= h)
if (w <= h)
glOrtho (-2.25, 2.25, -2.25*h/w, 2.25*h/w, -10.0, 10.0);
else
else
glOrtho (-2.25*w/h, 2.25*w/h, -2.25, 2.25, -10.0, 10.0);
glMatrixMode(GL_MODELVIEW);
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
@@ -163,6 +176,7 @@ int main(int argc, char** argv)
myinit();
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -45,8 +45,8 @@
#include <stdio.h>
#include <GL/glut.h>
/* Initialize antialiasing for RGBA mode, including alpha
* blending, hint, and line width. Print out implementation
/* Initialize antialiasing for RGBA mode, including alpha
* blending, hint, and line width. Print out implementation
* specific info on line width granularity and width.
*/
void myinit(void)
@@ -56,7 +56,7 @@ void myinit(void)
printf ("GL_LINE_WIDTH_GRANULARITY value is %3.1f\n", values[0]);
glGetFloatv (GL_LINE_WIDTH_RANGE, values);
printf ("GL_LINE_WIDTH_RANGE values are %3.1f %3.1f\n",
printf ("GL_LINE_WIDTH_RANGE values are %3.1f %3.1f\n",
values[0], values[1]);
glEnable (GL_LINE_SMOOTH);
@@ -93,8 +93,21 @@ void myReshape(int w, int h)
glTranslatef (0.0, 0.0, -4.0); /* move object into view */
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
@@ -105,7 +118,7 @@ int main(int argc, char** argv)
myinit();
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/**
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -68,7 +68,7 @@ GLfloat ctrlpoints[4][4][3] =
{1.5, 1.5, -1.0}}
};
void
void
initlights(void)
{
GLfloat ambient[] =
@@ -93,7 +93,7 @@ initlights(void)
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
}
void
void
display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -104,7 +104,7 @@ display(void)
glFlush();
}
void
void
myinit(void)
{
glClearColor(0.0, 0.0, 0.0, 1.0);
@@ -118,7 +118,7 @@ myinit(void)
initlights(); /* for lighted version only */
}
void
void
myReshape(int w, int h)
{
glViewport(0, 0, w, h);
@@ -134,7 +134,20 @@ myReshape(int w, int h)
glLoadIdentity();
}
int
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
int
main(int argc, char **argv)
{
glutInit(&argc, argv);
@@ -143,6 +156,7 @@ main(int argc, char **argv)
myinit();
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -52,10 +52,10 @@ GLubyte checkImage[checkImageWidth][checkImageHeight][3];
void makeCheckImage(void)
{
int i, j, c;
for (i = 0; i < checkImageWidth; i++) {
for (j = 0; j < checkImageHeight; j++) {
c = ((((i&0x8)==0)^((j&0x8))==0))*255;
c = ((((i&0x8)==0)^((j&0x8)==0)))*255;
checkImage[i][j][0] = (GLubyte) c;
checkImage[i][j][1] = (GLubyte) c;
checkImage[i][j][2] = (GLubyte) c;
@@ -64,15 +64,15 @@ void makeCheckImage(void)
}
void myinit(void)
{
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
makeCheckImage();
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, 3, checkImageWidth,
checkImageHeight, 0, GL_RGB, GL_UNSIGNED_BYTE,
glTexImage2D(GL_TEXTURE_2D, 0, 3, checkImageWidth,
checkImageHeight, 0, GL_RGB, GL_UNSIGNED_BYTE,
&checkImage[0][0][0]);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
@@ -111,6 +111,19 @@ void myReshape(int w, int h)
glTranslatef(0.0, 0.0, -3.6);
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
int
main(int argc, char** argv)
{
@@ -120,6 +133,7 @@ main(int argc, char** argv)
myinit();
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -39,7 +39,7 @@
*/
/*
* depthcue.c
* This program draws a wireframe model, which uses
* This program draws a wireframe model, which uses
* intensity (brightness) to give clues to distance.
* Fog is used to achieve this effect.
*/
@@ -86,6 +86,19 @@ void myReshape(int w, int h)
glTranslatef (0.0, 0.0, -4.0); /* move object into view */
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
*/
int main(int argc, char** argv)
@@ -96,7 +109,7 @@ int main(int argc, char** argv)
myinit();
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -55,35 +55,35 @@
/* accFrustum()
* The first 6 arguments are identical to the glFrustum() call.
*
* pixdx and pixdy are anti-alias jitter in pixels.
*
* pixdx and pixdy are anti-alias jitter in pixels.
* Set both equal to 0.0 for no anti-alias jitter.
* eyedx and eyedy are depth-of field jitter in pixels.
* eyedx and eyedy are depth-of field jitter in pixels.
* Set both equal to 0.0 for no depth of field effects.
*
* focus is distance from eye to plane in focus.
* focus is distance from eye to plane in focus.
* focus must be greater than, but not equal to 0.0.
*
* Note that accFrustum() calls glTranslatef(). You will
* probably want to insure that your ModelView matrix has been
* Note that accFrustum() calls glTranslatef(). You will
* probably want to insure that your ModelView matrix has been
* initialized to identity before calling accFrustum().
*/
void accFrustum(GLdouble left, GLdouble right, GLdouble bottom,
GLdouble top, GLdouble nnear, GLdouble ffar, GLdouble pixdx,
void accFrustum(GLdouble left, GLdouble right, GLdouble bottom,
GLdouble top, GLdouble nnear, GLdouble ffar, GLdouble pixdx,
GLdouble pixdy, GLdouble eyedx, GLdouble eyedy, GLdouble focus)
{
GLdouble xwsize, ywsize;
GLdouble xwsize, ywsize;
GLdouble dx, dy;
GLint viewport[4];
glGetIntegerv (GL_VIEWPORT, viewport);
xwsize = right - left;
ywsize = top - bottom;
dx = -(pixdx*xwsize/(GLdouble) viewport[2] + eyedx*nnear/focus);
dy = -(pixdy*ywsize/(GLdouble) viewport[3] + eyedy*nnear/focus);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum (left + dx, right + dx, bottom + dy, top + dy, nnear, ffar);
@@ -93,20 +93,20 @@ void accFrustum(GLdouble left, GLdouble right, GLdouble bottom,
}
/* accPerspective()
*
*
* The first 4 arguments are identical to the gluPerspective() call.
* pixdx and pixdy are anti-alias jitter in pixels.
* pixdx and pixdy are anti-alias jitter in pixels.
* Set both equal to 0.0 for no anti-alias jitter.
* eyedx and eyedy are depth-of field jitter in pixels.
* eyedx and eyedy are depth-of field jitter in pixels.
* Set both equal to 0.0 for no depth of field effects.
*
* focus is distance from eye to plane in focus.
* focus is distance from eye to plane in focus.
* focus must be greater than, but not equal to 0.0.
*
* Note that accPerspective() calls accFrustum().
*/
void accPerspective(GLdouble fovy, GLdouble aspect,
GLdouble nnear, GLdouble ffar, GLdouble pixdx, GLdouble pixdy,
void accPerspective(GLdouble fovy, GLdouble aspect,
GLdouble nnear, GLdouble ffar, GLdouble pixdx, GLdouble pixdy,
GLdouble eyedx, GLdouble eyedy, GLdouble focus)
{
GLdouble fov2,left,right,bottom,top;
@@ -128,7 +128,7 @@ void myinit(void)
GLfloat ambient[] = { 0.0, 0.0, 0.0, 1.0 };
GLfloat diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat position[] = { 0.0, 3.0, 3.0, 0.0 };
GLfloat lmodel_ambient[] = { 0.2, 0.2, 0.2, 1.0 };
GLfloat local_view[] = { 0.0 };
@@ -138,7 +138,7 @@ void myinit(void)
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_LOCAL_VIEWER, local_view);
@@ -155,18 +155,18 @@ void myinit(void)
glClearAccum(0.0, 0.0, 0.0, 0.0);
}
void renderTeapot (GLfloat x, GLfloat y, GLfloat z,
GLfloat ambr, GLfloat ambg, GLfloat ambb,
GLfloat difr, GLfloat difg, GLfloat difb,
void renderTeapot (GLfloat x, GLfloat y, GLfloat z,
GLfloat ambr, GLfloat ambg, GLfloat ambb,
GLfloat difr, GLfloat difg, GLfloat difb,
GLfloat specr, GLfloat specg, GLfloat specb, GLfloat shine)
{
float mat[4];
glPushMatrix();
glTranslatef (x, y, z);
mat[0] = ambr; mat[1] = ambg; mat[2] = ambb; mat[3] = 1.0;
mat[0] = ambr; mat[1] = ambg; mat[2] = ambb; mat[3] = 1.0;
glMaterialfv (GL_FRONT, GL_AMBIENT, mat);
mat[0] = difr; mat[1] = difg; mat[2] = difb;
mat[0] = difr; mat[1] = difg; mat[2] = difb;
glMaterialfv (GL_FRONT, GL_DIFFUSE, mat);
mat[0] = specr; mat[1] = specg; mat[2] = specb;
glMaterialfv (GL_FRONT, GL_SPECULAR, mat);
@@ -175,9 +175,9 @@ void renderTeapot (GLfloat x, GLfloat y, GLfloat z,
glPopMatrix();
}
/* display() draws 5 teapots into the accumulation buffer
/* display() draws 5 teapots into the accumulation buffer
* several times; each time with a jittered perspective.
* The focal point is at z = 5.0, so the gold teapot will
* The focal point is at z = 5.0, so the gold teapot will
* stay in focus. The amount of jitter is adjusted by the
* magnitude of the accPerspective() jitter; in this example, 0.33.
* In this example, the teapots are drawn 8 times. See jitter.h
@@ -192,8 +192,8 @@ void display(void)
for (jitter = 0; jitter < 8; jitter++) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
accPerspective (45.0,
(GLdouble) viewport[2]/(GLdouble) viewport[3],
accPerspective (45.0,
(GLdouble) viewport[2]/(GLdouble) viewport[3],
1.0, 15.0, 0.0, 0.0,
0.33*j8[jitter].x, 0.33*j8[jitter].y, 5.0);
/* ruby, gold, silver, emerald, and cyan teapots */
@@ -203,9 +203,9 @@ void display(void)
0.75164, 0.60648, 0.22648, 0.628281, 0.555802, 0.366065, 0.4);
renderTeapot (0.2, -0.5, -5.5, 0.19225, 0.19225, 0.19225,
0.50754, 0.50754, 0.50754, 0.508273, 0.508273, 0.508273, 0.4);
renderTeapot (1.0, -0.5, -6.0, 0.0215, 0.1745, 0.0215,
renderTeapot (1.0, -0.5, -6.0, 0.0215, 0.1745, 0.0215,
0.07568, 0.61424, 0.07568, 0.633, 0.727811, 0.633, 0.6);
renderTeapot (1.8, -0.5, -6.5, 0.0, 0.1, 0.06, 0.0, 0.50980392,
renderTeapot (1.8, -0.5, -6.5, 0.0, 0.1, 0.06, 0.0, 0.50980392,
0.50980392, 0.50196078, 0.50196078, 0.50196078, .25);
glAccum (GL_ACCUM, 0.125);
}
@@ -219,8 +219,21 @@ void myReshape(int w, int h)
glViewport(0, 0, w, h);
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, depth buffer, and handle input events.
*/
int main(int argc, char** argv)
@@ -232,7 +245,7 @@ int main(int argc, char** argv)
myinit();
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -1,13 +1,13 @@
/*
* Copyright (c) 1993-1997, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -21,8 +21,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -66,7 +66,7 @@ void spinDisplay(void)
glutPostRedisplay();
}
void init(void)
void init(void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
@@ -83,7 +83,7 @@ void reshape(int w, int h)
}
/* ARGSUSED2 */
void mouse(int button, int state, int x, int y)
void mouse(int button, int state, int x, int y)
{
switch (button) {
case GLUT_LEFT_BUTTON:
@@ -98,8 +98,21 @@ void mouse(int button, int state, int x, int y)
break;
}
}
/*
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/*
* Request double buffer display mode.
* Register mouse input callback functions
*/
@@ -107,13 +120,14 @@ int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize (250, 250);
glutInitWindowSize (250, 250);
glutInitWindowPosition (100, 100);
glutCreateWindow (argv[0]);
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMouseFunc(mouse);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/**
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -39,11 +39,11 @@
*/
/*
* fog.c
* This program draws 5 red teapots, each at a different
* z distance from the eye, in different types of fog.
* Pressing the left mouse button chooses between 3 types of
* fog: exponential, exponential squared, and linear.
* In this program, there is a fixed density value, as well
* This program draws 5 red teapots, each at a different
* z distance from the eye, in different types of fog.
* Pressing the left mouse button chooses between 3 types of
* fog: exponential, exponential squared, and linear.
* In this program, there is a fixed density value, as well
* as fixed start and end values for the linear fog.
*/
#include <stdlib.h>
@@ -52,7 +52,7 @@
GLint fogMode;
void
void
selectFog(int mode)
{
switch(mode) {
@@ -70,10 +70,10 @@ selectFog(int mode)
}
}
/* Initialize z-buffer, projection matrix, light source,
/* Initialize z-buffer, projection matrix, light source,
* and lighting model. Do not specify a material property here.
*/
void
void
myinit(void)
{
GLfloat position[] =
@@ -106,7 +106,7 @@ myinit(void)
}
}
void
void
renderRedTeapot(GLfloat x, GLfloat y, GLfloat z)
{
float mat[4];
@@ -133,7 +133,7 @@ renderRedTeapot(GLfloat x, GLfloat y, GLfloat z)
/* display() draws 5 teapots at different z positions.
*/
void
void
display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -145,7 +145,7 @@ display(void)
glFlush();
}
void
void
myReshape(int w, int h)
{
glViewport(0, 0, w, h);
@@ -161,11 +161,24 @@ myReshape(int w, int h)
glLoadIdentity();
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, depth buffer, and handle input events.
*/
int
int
main(int argc, char **argv)
{
glutInit(&argc, argv);
@@ -181,6 +194,7 @@ main(int argc, char **argv)
glutAddMenuEntry("Fog LINEAR", GL_LINEAR);
glutAddMenuEntry("Quit", 0);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -39,21 +39,21 @@
*/
/*
* fogindex.c
* This program demonstrates fog in color index mode.
* Three cones are drawn at different z values in a linear
* fog. 32 contiguous colors (from 16 to 47) are loaded
* This program demonstrates fog in color index mode.
* Three cones are drawn at different z values in a linear
* fog. 32 contiguous colors (from 16 to 47) are loaded
* with a color ramp.
*/
#include <stdlib.h>
#include <GL/glut.h>
/* Initialize color map and fog. Set screen clear color
/* Initialize color map and fog. Set screen clear color
* to end of color ramp.
*/
#define NUM_COLORS 32
#define RAMPSTART 16
void
void
myinit(void)
{
int i;
@@ -77,7 +77,7 @@ myinit(void)
/* display() renders 3 cones at different z positions.
*/
void
void
display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -104,7 +104,7 @@ display(void)
glFlush();
}
void
void
myReshape(int w, int h)
{
glViewport(0, 0, w, h);
@@ -120,11 +120,24 @@ myReshape(int w, int h)
glLoadIdentity();
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, depth buffer, and handle input events.
*/
int
int
main(int argc, char **argv)
{
glutInit(&argc, argv);
@@ -133,6 +146,7 @@ main(int argc, char **argv)
myinit();
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -1,13 +1,13 @@
/*
* Copyright (c) 1993-1997, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -21,8 +21,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -47,7 +47,7 @@ void display(void)
glClear (GL_COLOR_BUFFER_BIT);
/* draw white polygon (rectangle) with corners at
* (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)
* (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)
*/
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
@@ -57,13 +57,13 @@ void display(void)
glVertex3f (0.25, 0.75, 0.0);
glEnd();
/* don't wait!
* start processing buffered OpenGL routines
/* don't wait!
* start processing buffered OpenGL routines
*/
glFlush ();
}
void init (void)
void init (void)
{
/* select clearing color */
glClearColor (0.0, 0.0, 0.0, 0.0);
@@ -74,7 +74,20 @@ void init (void)
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
/*
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/*
* Declare initial window size, position, and display mode
* (single buffer and RGBA). Open window with "hello"
* in its title bar. Call initialization routines.
@@ -85,11 +98,12 @@ int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (250, 250);
glutInitWindowSize (250, 250);
glutInitWindowPosition (100, 100);
glutCreateWindow ("hello");
init ();
glutDisplayFunc(display);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -64,7 +64,7 @@ void makeCheckImage(void)
for (i = 0; i < checkImageHeight; i++) {
for (j = 0; j < checkImageWidth; j++) {
c = ((((i&0x8)==0)^((j&0x8))==0))*255;
c = (((i&0x8)==0)^((j&0x8)==0))*255;
checkImage[i][j][0] = (GLubyte) c;
checkImage[i][j][1] = (GLubyte) c;
checkImage[i][j][2] = (GLubyte) c;

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -46,7 +46,7 @@
#include <stdlib.h>
#include <GL/glut.h>
/* Initialize z-buffer, projection matrix, light source,
/* Initialize z-buffer, projection matrix, light source,
* and lighting model. Do not specify a material property here.
*/
void myinit(void)
@@ -72,7 +72,7 @@ void myinit(void)
glClearColor(0.0, 0.1, 0.1, 0.0);
}
/* Draw twelve spheres in 3 rows with 4 columns.
/* Draw twelve spheres in 3 rows with 4 columns.
* The spheres in the first row have materials with no ambient reflection.
* The second row has materials with significant ambient reflection.
* The third row has materials with colored ambient reflection.
@@ -102,7 +102,7 @@ void display(void)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* draw sphere in first row, first column
* diffuse reflection only; no ambient or specular
* diffuse reflection only; no ambient or specular
*/
glPushMatrix();
glTranslatef (-3.75, 3.0, 0.0);
@@ -154,7 +154,7 @@ void display(void)
glPopMatrix();
/* draw sphere in second row, first column
* ambient and diffuse reflection; no specular
* ambient and diffuse reflection; no specular
*/
glPushMatrix();
glTranslatef (-3.75, 0.0, 0.0);
@@ -206,7 +206,7 @@ void display(void)
glPopMatrix();
/* draw sphere in third row, first column
* colored ambient and diffuse reflection; no specular
* colored ambient and diffuse reflection; no specular
*/
glPushMatrix();
glTranslatef (-3.75, -3.0, 0.0);
@@ -266,16 +266,29 @@ void myReshape(int w, int h)
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= (h * 2))
glOrtho (-6.0, 6.0, -3.0*((GLfloat)h*2)/(GLfloat)w,
glOrtho (-6.0, 6.0, -3.0*((GLfloat)h*2)/(GLfloat)w,
3.0*((GLfloat)h*2)/(GLfloat)w, -10.0, 10.0);
else
glOrtho (-6.0*(GLfloat)w/((GLfloat)h*2),
glOrtho (-6.0*(GLfloat)w/((GLfloat)h*2),
6.0*(GLfloat)w/((GLfloat)h*2), -3.0, 3.0, -10.0, 10.0);
glMatrixMode(GL_MODELVIEW);
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
@@ -287,7 +300,7 @@ int main(int argc, char** argv)
myinit();
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -57,7 +57,7 @@ GLubyte mipmapImage1[1][1][3];
void makeImages(void)
{
int i, j;
for (i = 0; i < 32; i++) {
for (j = 0; j < 32; j++) {
mipmapImage32[i][j][0] = 255;
@@ -99,7 +99,7 @@ void makeImages(void)
}
void myinit(void)
{
{
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glShadeModel(GL_FLAT);
@@ -122,7 +122,7 @@ void myinit(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,
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_NEAREST_MIPMAP_NEAREST);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glEnable(GL_TEXTURE_2D);
@@ -150,6 +150,19 @@ void myReshape(int w, int h)
glLoadIdentity();
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
@@ -159,7 +172,7 @@ int main(int argc, char** argv)
myinit();
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -46,10 +46,10 @@
#include <GL/glut.h>
#define S_NUMPOINTS 13
#define S_ORDER 3
#define S_ORDER 3
#define S_NUMKNOTS (S_NUMPOINTS + S_ORDER)
#define T_NUMPOINTS 3
#define T_ORDER 3
#define T_ORDER 3
#define T_NUMKNOTS (T_NUMPOINTS + T_ORDER)
#define SQRT2 1.41421356237309504880
@@ -86,7 +86,7 @@ GLfloat ctlpoints[S_NUMPOINTS][T_NUMPOINTS][4] = {
GLUnurbsObj *theNurb;
/* Initialize material property, light source, lighting model,
/* Initialize material property, light source, lighting model,
* and depth buffer.
*/
void myinit(void)
@@ -133,12 +133,12 @@ void display(void)
glTranslatef (-4., -4.5, -2.5);
gluBeginSurface(theNurb);
gluNurbsSurface(theNurb,
gluNurbsSurface(theNurb,
S_NUMKNOTS, sknots,
T_NUMKNOTS, tknots,
4 * T_NUMPOINTS,
4,
&ctlpoints[0][0][0],
&ctlpoints[0][0][0],
S_ORDER, T_ORDER,
GL_MAP2_VERTEX_4);
gluEndSurface(theNurb);
@@ -159,8 +159,21 @@ void myReshape(int w, int h)
gluLookAt(7.0,4.5,4.0, 4.5,4.5,2.0, 6.0,-3.0,2.0);
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
@@ -171,6 +184,7 @@ int main(int argc, char** argv)
myinit();
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -39,19 +39,19 @@
*/
/*
* pickdepth.c
* Picking is demonstrated in this program. In
* rendering mode, three overlapping rectangles are
* drawn. When the left mouse button is pressed,
* selection mode is entered with the picking matrix.
* Picking is demonstrated in this program. In
* rendering mode, three overlapping rectangles are
* drawn. When the left mouse button is pressed,
* selection mode is entered with the picking matrix.
* Rectangles which are drawn under the cursor position
* are "picked." Pay special attention to the depth
* are "picked." Pay special attention to the depth
* value range, which is returned.
*/
#include <stdlib.h>
#include <stdio.h>
#include <GL/glut.h>
void
void
myinit(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
@@ -61,11 +61,11 @@ myinit(void)
glDepthRange(0.0, 1.0); /* The default z mapping */
}
/* The three rectangles are drawn. In selection mode,
* each rectangle is given the same name. Note that
/* The three rectangles are drawn. In selection mode,
* each rectangle is given the same name. Note that
* each rectangle is drawn with a different z value.
*/
void
void
drawRects(GLenum mode)
{
if (mode == GL_SELECT)
@@ -97,10 +97,10 @@ drawRects(GLenum mode)
glEnd();
}
/* processHits() prints out the contents of the
/* processHits() prints out the contents of the
* selection array.
*/
void
void
processHits(GLint hits, GLuint buffer[])
{
unsigned int i, j;
@@ -125,13 +125,13 @@ processHits(GLint hits, GLuint buffer[])
}
}
/* pickRects() sets up selection mode, name stack,
* and projection matrix for picking. Then the objects
/* pickRects() sets up selection mode, name stack,
* and projection matrix for picking. Then the objects
* are drawn.
*/
#define BUFSIZE 512
void
void
pickRects(int button, int state, int x, int y)
{
GLuint selectBuf[BUFSIZE];
@@ -164,7 +164,7 @@ pickRects(int button, int state, int x, int y)
processHits(hits, selectBuf);
}
void
void
display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -172,7 +172,7 @@ display(void)
glutSwapBuffers();
}
void
void
myReshape(int w, int h)
{
glViewport(0, 0, w, h);
@@ -183,8 +183,21 @@ myReshape(int w, int h)
glLoadIdentity();
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, depth buffer, and handle input events.
*/
int
@@ -198,6 +211,7 @@ main(int argc, char **argv)
glutMouseFunc(pickRects);
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -39,7 +39,7 @@
*/
/*
* plane.c
* This program demonstrates the use of local versus
* This program demonstrates the use of local versus
* infinite lighting on a flat plane.
*/
#include <stdlib.h>
@@ -130,17 +130,30 @@ void myReshape(int w, int h)
glViewport (0, 0, w, h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
if (w <= h)
glOrtho (-1.5, 1.5, -1.5*(GLdouble)h/(GLdouble)w,
if (w <= h)
glOrtho (-1.5, 1.5, -1.5*(GLdouble)h/(GLdouble)w,
1.5*(GLdouble)h/(GLdouble)w, -10.0, 10.0);
else
glOrtho (-1.5*(GLdouble)w/(GLdouble)h,
else
glOrtho (-1.5*(GLdouble)w/(GLdouble)h,
1.5*(GLdouble)w/(GLdouble)h, -1.5, 1.5, -10.0, 10.0);
glMatrixMode (GL_MODELVIEW);
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
@@ -152,6 +165,7 @@ int main(int argc, char** argv)
myinit();
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -1,13 +1,13 @@
/*
* Copyright (c) 1993-1997, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -21,8 +21,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -89,7 +89,7 @@ void display (void)
}
/* specify initial properties
* create display list with sphere
* create display list with sphere
* initialize lighting and depth buffer
*/
void gfxinit (void)
@@ -137,7 +137,7 @@ void mouse(int button, int state, int x, int y) {
case GLUT_LEFT_BUTTON:
switch (state) {
case GLUT_DOWN:
spinx = (spinx + 5) % 360;
spinx = (spinx + 5) % 360;
glutPostRedisplay();
break;
default:
@@ -147,7 +147,7 @@ void mouse(int button, int state, int x, int y) {
case GLUT_MIDDLE_BUTTON:
switch (state) {
case GLUT_DOWN:
spiny = (spiny + 5) % 360;
spiny = (spiny + 5) % 360;
glutPostRedisplay();
break;
default:
@@ -209,8 +209,21 @@ void keyboard (unsigned char key, int x, int y)
}
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
@@ -223,6 +236,7 @@ int main(int argc, char** argv)
glutMouseFunc(mouse);
glutKeyboardFunc(keyboard);
gfxinit();
glutKeyboardFunc(key);
glutMainLoop();
return 0;
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -76,7 +76,7 @@ void display(void)
/* draw all polygons in white */
glColor3f (1.0, 1.0, 1.0);
/* draw one solid, unstippled rectangle, */
/* draw one solid, unstippled rectangle, */
/* then two stippled rectangles */
glRectf (25.0, 25.0, 125.0, 125.0);
glEnable (GL_POLYGON_STIPPLE);
@@ -89,11 +89,11 @@ void display(void)
glFlush ();
}
void myinit (void)
void myinit (void)
{
/* clear background to black */
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel (GL_FLAT);
glShadeModel (GL_FLAT);
}
static void reshape(GLsizei w, GLsizei h)
@@ -106,8 +106,21 @@ static void reshape(GLsizei w, GLsizei h)
glLoadIdentity();
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
@@ -119,6 +132,7 @@ int main(int argc, char** argv)
myinit ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -39,9 +39,9 @@
*/
/*
* sccolorlight.c
* This program demonstrates the use of a colored
* (magenta, in this example) light source. Objects
* are drawn using a grey material characteristic.
* This program demonstrates the use of a colored
* (magenta, in this example) light source. Objects
* are drawn using a grey material characteristic.
* A single light source illuminates the objects.
*/
#include <stdlib.h>
@@ -61,7 +61,7 @@ void myinit(void)
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glDepthFunc(GL_LESS);
@@ -75,19 +75,19 @@ void display(void)
glRotatef (20.0, 1.0, 0.0, 0.0);
glPushMatrix ();
glTranslatef (-0.75, 0.5, 0.0);
glTranslatef (-0.75, 0.5, 0.0);
glRotatef (90.0, 1.0, 0.0, 0.0);
glutSolidTorus (0.275, 0.85, 20, 20);
glPopMatrix ();
glPushMatrix ();
glTranslatef (-0.75, -0.5, 0.0);
glTranslatef (-0.75, -0.5, 0.0);
glRotatef (270.0, 1.0, 0.0, 0.0);
glutSolidCone (1.0, 2.0, 20, 20);
glPopMatrix ();
glPushMatrix ();
glTranslatef (0.75, 0.0, -1.0);
glTranslatef (0.75, 0.0, -1.0);
glutSolidSphere (1.0, 20, 20);
glPopMatrix ();
@@ -100,17 +100,30 @@ void myReshape(int w, int h)
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= h)
glOrtho (-2.5, 2.5, -2.5*(GLfloat)h/(GLfloat)w,
if (w <= h)
glOrtho (-2.5, 2.5, -2.5*(GLfloat)h/(GLfloat)w,
2.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0);
else
glOrtho (-2.5*(GLfloat)w/(GLfloat)h,
else
glOrtho (-2.5*(GLfloat)w/(GLfloat)h,
2.5*(GLfloat)w/(GLfloat)h, -2.5, 2.5, -10.0, 10.0);
glMatrixMode(GL_MODELVIEW);
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
@@ -122,6 +135,7 @@ int main(int argc, char** argv)
myinit();
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -40,7 +40,7 @@
/*
* scene.c
* This program demonstrates the use of the GL lighting model.
* Objects are drawn using a grey material characteristic.
* Objects are drawn using a grey material characteristic.
* A single light source illuminates the objects.
*/
#include <stdlib.h>
@@ -60,7 +60,7 @@ void myinit (void)
glLightfv (GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv (GL_LIGHT0, GL_SPECULAR, light_specular);
glLightfv (GL_LIGHT0, GL_POSITION, light_position);
glEnable (GL_LIGHTING);
glEnable (GL_LIGHT0);
glDepthFunc(GL_LESS);
@@ -75,19 +75,19 @@ void display (void)
glRotatef (20.0, 1.0, 0.0, 0.0);
glPushMatrix ();
glTranslatef (-0.75, 0.5, 0.0);
glTranslatef (-0.75, 0.5, 0.0);
glRotatef (90.0, 1.0, 0.0, 0.0);
glutSolidTorus (0.275, 0.85, 15, 15);
glPopMatrix ();
glPushMatrix ();
glTranslatef (-0.75, -0.5, 0.0);
glTranslatef (-0.75, -0.5, 0.0);
glRotatef (270.0, 1.0, 0.0, 0.0);
glutSolidCone (1.0, 2.0, 15, 15);
glPopMatrix ();
glPushMatrix ();
glTranslatef (0.75, 0.0, -1.0);
glTranslatef (0.75, 0.0, -1.0);
glutSolidSphere (1.0, 15, 15);
glPopMatrix ();
@@ -100,17 +100,30 @@ void myReshape(int w, int h)
glViewport (0, 0, w, h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
if (w <= h)
glOrtho (-2.5, 2.5, -2.5*(GLfloat)h/(GLfloat)w,
if (w <= h)
glOrtho (-2.5, 2.5, -2.5*(GLfloat)h/(GLfloat)w,
2.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0);
else
glOrtho (-2.5*(GLfloat)w/(GLfloat)h,
else
glOrtho (-2.5*(GLfloat)w/(GLfloat)h,
2.5*(GLfloat)w/(GLfloat)h, -2.5, 2.5, -10.0, 10.0);
glMatrixMode (GL_MODELVIEW);
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
@@ -122,6 +135,7 @@ int main(int argc, char** argv)
myinit ();
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -39,7 +39,7 @@
*/
/*
* scenebamb.c
* This program demonstrates use of a blue ambient light
* This program demonstrates use of a blue ambient light
* source.
*/
#include <stdlib.h>
@@ -59,7 +59,7 @@ void myinit(void)
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glDepthFunc(GL_LESS);
@@ -74,19 +74,19 @@ void display(void)
glRotatef (20.0, 1.0, 0.0, 0.0);
glPushMatrix ();
glTranslatef (-0.75, 0.5, 0.0);
glTranslatef (-0.75, 0.5, 0.0);
glRotatef (90.0, 1.0, 0.0, 0.0);
glutSolidTorus (0.275, 0.85, 15, 15);
glPopMatrix ();
glPushMatrix ();
glTranslatef (-0.75, -0.5, 0.0);
glTranslatef (-0.75, -0.5, 0.0);
glRotatef (270.0, 1.0, 0.0, 0.0);
glutSolidCone (1.0, 2.0, 15, 15);
glPopMatrix ();
glPushMatrix ();
glTranslatef (0.75, 0.0, -1.0);
glTranslatef (0.75, 0.0, -1.0);
glutSolidSphere (1.0, 15, 15);
glPopMatrix ();
@@ -99,17 +99,30 @@ void myReshape(int w, int h)
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= h)
glOrtho (-2.5, 2.5, -2.5*(GLfloat)h/(GLfloat)w,
if (w <= h)
glOrtho (-2.5, 2.5, -2.5*(GLfloat)h/(GLfloat)w,
2.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0);
else
glOrtho (-2.5*(GLfloat)w/(GLfloat)h,
else
glOrtho (-2.5*(GLfloat)w/(GLfloat)h,
2.5*(GLfloat)w/(GLfloat)h, -2.5, 2.5, -10.0, 10.0);
glMatrixMode(GL_MODELVIEW);
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
@@ -121,6 +134,7 @@ int main(int argc, char** argv)
myinit();
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -58,7 +58,7 @@ void myinit(void)
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glDepthFunc(GL_LESS);
@@ -74,19 +74,19 @@ void display(void)
glRotatef (20.0, 1.0, 0.0, 0.0);
glPushMatrix ();
glTranslatef (-0.75, 0.5, 0.0);
glTranslatef (-0.75, 0.5, 0.0);
glRotatef (90.0, 1.0, 0.0, 0.0);
glutSolidTorus (0.275, 0.85, 15, 15);
glPopMatrix ();
glPushMatrix ();
glTranslatef (-0.75, -0.5, 0.0);
glTranslatef (-0.75, -0.5, 0.0);
glRotatef (270.0, 1.0, 0.0, 0.0);
glutSolidCone (1.0, 2.0, 15, 15);
glPopMatrix ();
glPushMatrix ();
glTranslatef (0.75, 0.0, -1.0);
glTranslatef (0.75, 0.0, -1.0);
glutSolidSphere (1.0, 15, 15);
glPopMatrix ();
@@ -99,17 +99,30 @@ void myReshape(int w, int h)
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= h)
glOrtho (-2.5, 2.5, -2.5*(GLfloat)h/(GLfloat)w,
if (w <= h)
glOrtho (-2.5, 2.5, -2.5*(GLfloat)h/(GLfloat)w,
2.5*(GLfloat)h/(GLfloat)w, -10.0, 10.0);
else
glOrtho (-2.5*(GLfloat)w/(GLfloat)h,
else
glOrtho (-2.5*(GLfloat)w/(GLfloat)h,
2.5*(GLfloat)w/(GLfloat)h, -2.5, 2.5, -10.0, 10.0);
glMatrixMode(GL_MODELVIEW);
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
@@ -121,6 +134,7 @@ int main(int argc, char** argv)
myinit();
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -38,9 +38,9 @@
* OpenGL(TM) is a trademark of Silicon Graphics, Inc.
*/
/* stencil.c
* This program draws two rotated tori in a window.
* A diamond in the center of the window masks out part
* of the scene. Within this mask, a different model
* This program draws two rotated tori in a window.
* A diamond in the center of the window masks out part
* of the scene. Within this mask, a different model
* (a sphere) is drawn in a different color.
*/
#include <stdlib.h>
@@ -49,7 +49,7 @@
#define YELLOWMAT 1
#define BLUEMAT 2
void myinit (void)
void myinit (void)
{
GLfloat yellow_diffuse[] = { 0.7, 0.7, 0.0, 1.0 };
GLfloat yellow_specular[] = { 1.0, 1.0, 1.0, 1.0 };
@@ -112,7 +112,7 @@ void display(void)
glFlush();
}
/* Whenever the window is reshaped, redefine the
/* Whenever the window is reshaped, redefine the
* coordinate system and redraw the stencil area.
*/
void myReshape(int w, int h)
@@ -144,8 +144,21 @@ void myReshape(int w, int h)
glTranslatef(0.0, 0.0, -5.0);
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
@@ -157,6 +170,7 @@ int main(int argc, char** argv)
myinit ();
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -38,10 +38,10 @@
* OpenGL(TM) is a trademark of Silicon Graphics, Inc.
*/
/*
* stroke.c
* This program demonstrates some characters of a
* stroke.c
* This program demonstrates some characters of a
* stroke (vector) font. The characters are represented
* by display lists, which are given numbers which
* by display lists, which are given numbers which
* correspond to the ASCII values of the characters.
* Use of glCallLists() is demonstrated.
*/
@@ -59,7 +59,7 @@ typedef struct charpoint {
} CP;
CP Adata[] = {
{ 0, 0, PT}, {0, 9, PT}, {1, 10, PT}, {4, 10, PT},
{ 0, 0, PT}, {0, 9, PT}, {1, 10, PT}, {4, 10, PT},
{5, 9, PT}, {5, 0, STROKE}, {0, 5, PT}, {5, 5, END}
};
@@ -69,18 +69,18 @@ CP Edata[] = {
};
CP Pdata[] = {
{0, 0, PT}, {0, 10, PT}, {4, 10, PT}, {5, 9, PT}, {5, 6, PT},
{0, 0, PT}, {0, 10, PT}, {4, 10, PT}, {5, 9, PT}, {5, 6, PT},
{4, 5, PT}, {0, 5, END}
};
CP Rdata[] = {
{0, 0, PT}, {0, 10, PT}, {4, 10, PT}, {5, 9, PT}, {5, 6, PT},
{0, 0, PT}, {0, 10, PT}, {4, 10, PT}, {5, 9, PT}, {5, 6, PT},
{4, 5, PT}, {0, 5, STROKE}, {3, 5, PT}, {5, 0, END}
};
CP Sdata[] = {
{0, 1, PT}, {1, 0, PT}, {4, 0, PT}, {5, 1, PT}, {5, 4, PT},
{4, 5, PT}, {1, 5, PT}, {0, 6, PT}, {0, 9, PT}, {1, 10, PT},
{0, 1, PT}, {1, 0, PT}, {4, 0, PT}, {5, 1, PT}, {5, 4, PT},
{4, 5, PT}, {1, 5, PT}, {0, 6, PT}, {0, 9, PT}, {1, 10, PT},
{4, 10, PT}, {5, 9, END}
};
@@ -163,8 +163,21 @@ static void reshape(GLsizei w, GLsizei h)
glLoadIdentity();
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
@@ -176,6 +189,7 @@ int main(int argc, char** argv)
myinit ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -2,14 +2,14 @@
/**
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -23,8 +23,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -38,7 +38,7 @@
*/
/**
* surface.c
* This program draws a NURBS surface in the shape of a
* This program draws a NURBS surface in the shape of a
* symmetrical hill.
*/
#include <GL/glut.h>
@@ -65,9 +65,9 @@ void init_surface(void)
else
ctlpoints[u][v][2] = -3.0;
}
}
}
}
}
/* Initialize material property and depth buffer.
*/
void myinit(void)
@@ -111,12 +111,12 @@ void display(void)
glScalef (0.25, 0.25, 0.25);
gluBeginSurface(theNurb);
gluNurbsSurface(theNurb,
gluNurbsSurface(theNurb,
8, knots,
8, knots,
4 * 3,
3,
&ctlpoints[0][0][0],
&ctlpoints[0][0][0],
4, 4,
GL_MAP2_VERTEX_3);
gluEndSurface(theNurb);
@@ -134,7 +134,7 @@ void display(void)
glEnd();
glEnable(GL_LIGHTING);
}
glPopMatrix();
glutSwapBuffers();
}
@@ -194,6 +194,19 @@ mouse(int button, int state, int x, int y)
}
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop */
int
main(int argc, char** argv)
@@ -212,6 +225,7 @@ main(int argc, char** argv)
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMouseFunc(mouse);
glutMotionFunc(motion);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -3,14 +3,14 @@
/**
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -47,7 +47,7 @@
/* Initialize light source and lighting model.
*/
void
void
myinit(void)
{
GLfloat light_ambient[] =
@@ -78,7 +78,7 @@ myinit(void)
glEnable(GL_DEPTH_TEST);
}
void
void
display(void)
{
GLfloat low_ambient[] =
@@ -114,7 +114,7 @@ display(void)
glFlush();
}
void
void
myReshape(int w, int h)
{
glViewport(0, 0, w, h);
@@ -129,8 +129,21 @@ myReshape(int w, int h)
glMatrixMode(GL_MODELVIEW);
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* Main Loop
* Open window with initial window size, title bar,
* Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int
@@ -143,6 +156,7 @@ main(int argc, char **argv)
myinit();
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -188,6 +188,19 @@ myReshape(int w, int h)
glMatrixMode(GL_MODELVIEW);
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/*
* Main Loop Open window with initial window size, title bar, RGBA display
* mode, and handle input events.
@@ -201,6 +214,7 @@ main(int argc, char **argv)
myinit();
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -1,13 +1,13 @@
/*
* Copyright (c) 1993-1997, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -21,8 +21,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -45,7 +45,7 @@
* Note the exterior rectangle is drawn with its vertices
* in counter-clockwise order, but its interior clockwise.
* Note the combineCallback is needed for the self-intersecting
* star. Also note that removing the TessProperty for the
* star. Also note that removing the TessProperty for the
* star will make the interior unshaded (WINDING_ODD).
*/
#include <GL/glut.h>
@@ -102,7 +102,7 @@ void CALLBACK vertexCallback(GLvoid *vertex)
* but weight[4] may be used to average color, normal, or texture
* coordinate data. In this program, color is weighted.
*/
void CALLBACK combineCallback(GLdouble coords[3],
void CALLBACK combineCallback(GLdouble coords[3],
GLdouble *vertex_data[4],
GLfloat weight[4], GLdouble **dataOut )
{
@@ -114,15 +114,15 @@ void CALLBACK combineCallback(GLdouble coords[3],
vertex[0] = coords[0];
vertex[1] = coords[1];
vertex[2] = coords[2];
for (i = 3; i < 7; i++)
vertex[i] = weight[0] * vertex_data[0][i]
for (i = 3; i < 6; i++)
vertex[i] = weight[0] * vertex_data[0][i]
+ weight[1] * vertex_data[1][i]
+ weight[2] * vertex_data[2][i]
+ weight[2] * vertex_data[2][i]
+ weight[3] * vertex_data[3][i];
*dataOut = vertex;
}
void init (void)
void init (void)
{
GLUtesselator *tobj;
GLdouble rect[4][3] = {50.0, 50.0, 0.0,
@@ -143,18 +143,18 @@ void init (void)
startList = glGenLists(2);
tobj = gluNewTess();
gluTessCallback(tobj, GLU_TESS_VERTEX,
gluTessCallback(tobj, GLU_TESS_VERTEX,
(GLvoid (CALLBACK*) ()) &glVertex3dv);
gluTessCallback(tobj, GLU_TESS_BEGIN,
gluTessCallback(tobj, GLU_TESS_BEGIN,
(GLvoid (CALLBACK*) ()) &beginCallback);
gluTessCallback(tobj, GLU_TESS_END,
gluTessCallback(tobj, GLU_TESS_END,
(GLvoid (CALLBACK*) ()) &endCallback);
gluTessCallback(tobj, GLU_TESS_ERROR,
gluTessCallback(tobj, GLU_TESS_ERROR,
(GLvoid (CALLBACK*) ()) &errorCallback);
/* rectangle with triangular hole inside */
glNewList(startList, GL_COMPILE);
glShadeModel(GL_FLAT);
glShadeModel(GL_FLAT);
gluTessBeginPolygon(tobj, NULL);
gluTessBeginContour(tobj);
gluTessVertex(tobj, rect[0], rect[0]);
@@ -170,20 +170,20 @@ void init (void)
gluTessEndPolygon(tobj);
glEndList();
gluTessCallback(tobj, GLU_TESS_VERTEX,
gluTessCallback(tobj, GLU_TESS_VERTEX,
(GLvoid (CALLBACK*) ()) &vertexCallback);
gluTessCallback(tobj, GLU_TESS_BEGIN,
gluTessCallback(tobj, GLU_TESS_BEGIN,
(GLvoid (CALLBACK*) ()) &beginCallback);
gluTessCallback(tobj, GLU_TESS_END,
gluTessCallback(tobj, GLU_TESS_END,
(GLvoid (CALLBACK*) ()) &endCallback);
gluTessCallback(tobj, GLU_TESS_ERROR,
gluTessCallback(tobj, GLU_TESS_ERROR,
(GLvoid (CALLBACK*) ()) &errorCallback);
gluTessCallback(tobj, GLU_TESS_COMBINE,
gluTessCallback(tobj, GLU_TESS_COMBINE,
(GLvoid (CALLBACK*) ()) &combineCallback);
/* smooth shaded, self-intersecting star */
glNewList(startList + 1, GL_COMPILE);
glShadeModel(GL_SMOOTH);
glShadeModel(GL_SMOOTH);
gluTessProperty(tobj, GLU_TESS_WINDING_RULE,
GLU_TESS_WINDING_POSITIVE);
gluTessBeginPolygon(tobj, NULL);
@@ -228,7 +228,7 @@ int main(int argc, char** argv)
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutMainLoop();
return 0;
return 0;
}
#else

View File

@@ -1,13 +1,13 @@
/*
* Copyright (c) 1993-1997, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -21,8 +21,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -36,7 +36,7 @@
*/
/* texbind.c
* This program demonstrates using glBindTexture() by
* This program demonstrates using glBindTexture() by
* creating and managing two textures.
*/
#include <GL/glut.h>
@@ -55,15 +55,15 @@ static GLuint texName[2];
void makeCheckImages(void)
{
int i, j, c;
for (i = 0; i < checkImageHeight; i++) {
for (j = 0; j < checkImageWidth; j++) {
c = ((((i&0x8)==0)^((j&0x8))==0))*255;
c = ((((i&0x8)==0)^((j&0x8)==0)))*255;
checkImage[i][j][0] = (GLubyte) c;
checkImage[i][j][1] = (GLubyte) c;
checkImage[i][j][2] = (GLubyte) c;
checkImage[i][j][3] = (GLubyte) 255;
c = ((((i&0x10)==0)^((j&0x10))==0))*255;
c = ((((i&0x10)==0)^((j&0x10)==0)))*255;
otherImage[i][j][0] = (GLubyte) c;
otherImage[i][j][1] = (GLubyte) 0;
otherImage[i][j][2] = (GLubyte) 0;
@@ -73,7 +73,7 @@ void makeCheckImages(void)
}
void init(void)
{
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
@@ -85,9 +85,9 @@ void init(void)
glBindTexture(GL_TEXTURE_2D, texName[0]);
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_MAG_FILTER,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth,
checkImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE,
@@ -99,8 +99,8 @@ void init(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth,
checkImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE,
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth,
checkImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE,
otherImage);
glEnable(GL_TEXTURE_2D);
}
@@ -158,7 +158,7 @@ int main(int argc, char** argv)
glutDisplayFunc(display);
glutKeyboardFunc (keyboard);
glutMainLoop();
return 0;
return 0;
}
#else
int main(int argc, char** argv)
@@ -169,4 +169,3 @@ int main(int argc, char** argv)
return 0;
}
#endif

View File

@@ -1,13 +1,13 @@
/*
* Copyright (c) 1993-1997, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -21,8 +21,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -40,7 +40,7 @@
* two rectangles. This program clamps the texture, if
* the texture coordinates fall outside 0.0 and 1.0.
* If the s key is pressed, a texture subimage is used to
* alter the original texture. If the r key is pressed,
* alter the original texture. If the r key is pressed,
* the original texture is restored.
*/
#include <GL/glut.h>
@@ -61,10 +61,10 @@ static GLuint texName;
void makeCheckImages(void)
{
int i, j, c;
for (i = 0; i < checkImageHeight; i++) {
for (j = 0; j < checkImageWidth; j++) {
c = ((((i&0x8)==0)^((j&0x8))==0))*255;
c = ((((i&0x8)==0)^((j&0x8)==0)))*255;
checkImage[i][j][0] = (GLubyte) c;
checkImage[i][j][1] = (GLubyte) c;
checkImage[i][j][2] = (GLubyte) c;
@@ -73,7 +73,7 @@ void makeCheckImages(void)
}
for (i = 0; i < subImageHeight; i++) {
for (j = 0; j < subImageWidth; j++) {
c = ((((i&0x4)==0)^((j&0x4))==0))*255;
c = ((((i&0x4)==0)^((j&0x4)==0)))*255;
subImage[i][j][0] = (GLubyte) c;
subImage[i][j][1] = (GLubyte) 0;
subImage[i][j][2] = (GLubyte) 0;
@@ -83,7 +83,7 @@ void makeCheckImages(void)
}
void init(void)
{
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
@@ -98,7 +98,7 @@ void init(void)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth, checkImageHeight,
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth, checkImageHeight,
0, GL_RGBA, GL_UNSIGNED_BYTE, checkImage);
}
@@ -174,7 +174,7 @@ int main(int argc, char** argv)
glutReshapeFunc(reshape);
glutKeyboardFunc(keyboard);
glutMainLoop();
return 0;
return 0;
}
#else
int main(int argc, char** argv)

View File

@@ -3,14 +3,14 @@
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -24,8 +24,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -47,17 +47,17 @@
#include <math.h>
GLfloat ctrlpoints[4][4][3] = {
{{ -1.5, -1.5, 4.0}, { -0.5, -1.5, 2.0},
{0.5, -1.5, -1.0}, {1.5, -1.5, 2.0}},
{{ -1.5, -0.5, 1.0}, { -0.5, -0.5, 3.0},
{0.5, -0.5, 0.0}, {1.5, -0.5, -1.0}},
{{ -1.5, 0.5, 4.0}, { -0.5, 0.5, 0.0},
{0.5, 0.5, 3.0}, {1.5, 0.5, 4.0}},
{{ -1.5, 1.5, -2.0}, { -0.5, 1.5, -2.0},
{{ -1.5, -1.5, 4.0}, { -0.5, -1.5, 2.0},
{0.5, -1.5, -1.0}, {1.5, -1.5, 2.0}},
{{ -1.5, -0.5, 1.0}, { -0.5, -0.5, 3.0},
{0.5, -0.5, 0.0}, {1.5, -0.5, -1.0}},
{{ -1.5, 0.5, 4.0}, { -0.5, 0.5, 0.0},
{0.5, 0.5, 3.0}, {1.5, 0.5, 4.0}},
{{ -1.5, 1.5, -2.0}, { -0.5, 1.5, -2.0},
{0.5, 1.5, 0.0}, {1.5, 1.5, -1.0}}
};
GLfloat texpts[2][2][2] = {{{0.0, 0.0}, {0.0, 1.0}},
GLfloat texpts[2][2][2] = {{{0.0, 0.0}, {0.0, 1.0}},
{{1.0, 0.0}, {1.0, 1.0}}};
void display(void)
@@ -76,7 +76,7 @@ void makeImage(void)
{
int i, j;
float ti, tj;
for (i = 0; i < imageWidth; i++) {
ti = 2.0*3.14159265*i/imageWidth;
for (j = 0; j < imageHeight; j++) {
@@ -93,7 +93,7 @@ void myinit(void)
{
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4,
0, 1, 12, 4, &ctrlpoints[0][0][0]);
glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2,
glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2,
0, 1, 4, 2, &texpts[0][0][0]);
glEnable(GL_MAP2_TEXTURE_COORD_2);
glEnable(GL_MAP2_VERTEX_3);
@@ -118,16 +118,29 @@ void myReshape(int w, int h)
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= h)
glOrtho(-4.0, 4.0, -4.0*(GLfloat)h/(GLfloat)w,
glOrtho(-4.0, 4.0, -4.0*(GLfloat)h/(GLfloat)w,
4.0*(GLfloat)h/(GLfloat)w, -4.0, 4.0);
else
glOrtho(-4.0*(GLfloat)w/(GLfloat)h,
glOrtho(-4.0*(GLfloat)w/(GLfloat)h,
4.0*(GLfloat)w/(GLfloat)h, -4.0, 4.0, -4.0, 4.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glRotatef(85.0, 1.0, 1.0, 1.0);
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
@@ -136,6 +149,7 @@ int main(int argc, char** argv)
myinit();
glutReshapeFunc (myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.BeOS-R4,v 1.1 1999/08/19 00:55:41 jtg Exp $
# $Id: Makefile.BeOS-R4,v 1.2 1999/09/17 00:08:38 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
@@ -17,7 +17,7 @@
INCDIR = ../include
LIBDIR = ../lib
GL_LIBS = -L$(LIBDIR) -L/boot/home/config/lib -Xlinker -rpath $(LIBDIR) -lbe -lglut -lMesaGLU -lMesaGL $(XLIBS)
GL_LIBS = -L$(LIBDIR) -L/boot/home/config/lib -Xlinker -rpath $(LIBDIR) -lbe -lglut -lGLU -lGL $(XLIBS)
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)

View File

@@ -347,11 +347,11 @@ int main(int argc, char **argv)
if (!glutLayerGet(GLUT_OVERLAY_POSSIBLE))
{
fprintf(stderr, "Overlay not available\n");
return;
return(1);
}
if (Args(argc, argv) == GL_FALSE) {
exit(1);
return(1);
}
windW = 300;
@@ -363,7 +363,7 @@ int main(int argc, char **argv)
glutInitDisplayMode(type);
if (glutCreateWindow("Overlay Test") == GL_FALSE) {
exit(1);
return(1);
}
glutEstablishOverlay();

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.1 1999/08/19 00:55:43 jtg Exp $
# $Id: Makefile.X11,v 1.2 1999/09/16 16:41:03 brianp Exp $
# Mesa 3-D graphics library
# Version: 3.1
@@ -16,7 +16,7 @@ GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL -lm $(XLIBS)
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)
PROGS = glxdemo glxpixmap offset xdemo
PROGS = glxdemo glxpixmap offset xdemo glxinfo

99
progs/xdemos/glxinfo.c Normal file
View File

@@ -0,0 +1,99 @@
/* $Id: glxinfo.c,v 1.1 1999/09/16 16:40:46 brianp Exp $ */
/*
* Query GLX extensions, version, vendor, etc.
* This program is in the public domain.
* brian_paul@mesa3d.org
*/
#include <GL/gl.h>
#include <GL/glx.h>
#include <GL/glu.h>
#include <stdio.h>
#include <stdlib.h>
static void
query_glx( Display *dpy, int scr )
{
printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION));
printf("GL_EXTENSIONS: %s\n", (char *) glGetString(GL_EXTENSIONS));
printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VENDOR: %s\n", (char *) glGetString(GL_VENDOR));
printf("GLU_VERSION: %s\n", (char *) gluGetString(GLU_VERSION));
printf("GLU_EXTENSIONS: %s\n", (char *) gluGetString(GLU_EXTENSIONS));
printf("server GLX_VENDOR: %s\n", (char *) glXQueryServerString( dpy, scr, GLX_VENDOR));
printf("server GLX_VERSION: %s\n", (char *) glXQueryServerString( dpy, scr, GLX_VERSION));
printf("server GLX_EXTENSIONS: %s\n", (char *) glXQueryServerString( dpy, scr, GLX_EXTENSIONS));
printf("client GLX_VENDOR: %s\n", (char *) glXGetClientString( dpy, GLX_VENDOR));
printf("client GLX_VERSION: %s\n", (char *) glXGetClientString( dpy, GLX_VERSION));
printf("client GLX_EXTENSIONS: %s\n", (char *) glXGetClientString( dpy, GLX_EXTENSIONS));
printf("GLX extensions: %s\n", (char *) glXQueryExtensionsString(dpy, scr));
}
int
main( int argc, char *argv[] )
{
Display *dpy;
Window win;
int attrib[] = { GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
None };
int scrnum;
XSetWindowAttributes attr;
unsigned long mask;
Window root;
GLXContext ctx;
XVisualInfo *visinfo;
int width = 100, height = 100;
dpy = XOpenDisplay(NULL);
if (!dpy) {
fprintf(stderr, "Unable to open default display!\n");
return 1;
}
scrnum = DefaultScreen( dpy );
root = RootWindow( dpy, scrnum );
visinfo = glXChooseVisual( dpy, scrnum, attrib );
if (!visinfo) {
fprintf(stderr, "Error: couldn't find RGB GLX visual!\n");
return 1;
}
/* window attributes */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
attr.event_mask = StructureNotifyMask | ExposureMask;
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
win = XCreateWindow( dpy, root, 0, 0, width, height,
0, visinfo->depth, InputOutput,
visinfo->visual, mask, &attr );
ctx = glXCreateContext( dpy, visinfo, NULL, True );
glXMakeCurrent( dpy, win, ctx );
query_glx(dpy, scrnum);
glXDestroyContext(dpy, ctx);
XDestroyWindow(dpy, win);
XCloseDisplay(dpy);
return 0;
}

View File

@@ -29,7 +29,8 @@ INCDIR = ../include
LIBDIR = ../lib
SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \
project.c quadric.c tess.c tesselat.c polytest.c
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
tess_winding.c
OBJECTS = $(SOURCES:.c=.o)
@@ -54,7 +55,7 @@ targets: $(LIBDIR)/$(GLU_LIB)
# Make the library:
$(LIBDIR)/$(GLU_LIB): $(OBJECTS)
$(MAKELIB) $(GLU_LIB) 2 6 $(OBJECTS)
$(MAKELIB) $(GLU_LIB) $(MAJOR) $(MINOR) $(TINY) $(OBJECTS)
# $(RANLIB) $(GLU_LIB)
mv $(GLU_LIB)* $(LIBDIR)

View File

@@ -19,11 +19,23 @@
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# $Id: Makefile.BeOS-R4,v 1.1 1999/08/19 00:55:42 jtg Exp $
# $Id: Makefile.BeOS-R4,v 1.5 1999/10/03 00:53:38 gareth Exp $
# $Log: Makefile.BeOS-R4,v $
# Revision 1.1 1999/08/19 00:55:42 jtg
# Initial revision
# Revision 1.5 1999/10/03 00:53:38 gareth
# Added tessellation winding rule files.
#
# Revision 1.4 1999/09/17 00:06:57 brianp
# version symbol changes
#
# Revision 1.3 1999/09/15 15:11:01 brianp
# added third, tiny version number to mklib scripts
#
# Revision 1.2 1999/09/10 02:03:31 gareth
# Added GLU 1.3 tessellation (except winding rule code).
#
# Revision 1.1.1.1 1999/08/19 00:55:42 jtg
# Imported sources
#
# Revision 1.2 1999/02/02 04:44:40 brianp
# fixed some problems
@@ -36,13 +48,18 @@
##### MACROS #####
GLU_MAJOR = 1
GLU_MINOR = 2
GLU_TINY = $(MESA_MAJOR)$(MESA_MINOR)$(MESA_TINY)
VPATH = RCS
INCDIR = ../include
LIBDIR = ../lib
SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \
project.c quadric.c tess.c tesselat.c polytest.c
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
tess_winding.c
OBJECTS = $(SOURCES:.c=.o)
@@ -60,7 +77,7 @@ targets: $(LIBDIR)/$(GLU_LIB)
# Make the library:
$(LIBDIR)/$(GLU_LIB): $(OBJECTS)
$(MAKELIB) $(GLU_LIB) $(MAJOR) $(MINOR) -L$(LIBDIR) -lMesaGL $(OBJECTS)
$(MAKELIB) $(GLU_LIB) $(GLU_MAJOR) $(GLU_MINOR) $(GLU_TINY) -L$(LIBDIR) -lGL $(OBJECTS)
mv $(GLU_LIB)* $(LIBDIR)
include ../Make-config

View File

@@ -1,4 +1,4 @@
# $Id: Makefile.X11,v 1.1 1999/08/19 00:55:42 jtg Exp $
# $Id: Makefile.X11,v 1.6 1999/10/03 00:53:38 gareth Exp $
# Mesa 3-D graphics library
# Version: 3.1
@@ -9,13 +9,18 @@
##### MACROS #####
GLU_MAJOR = 1
GLU_MINOR = 2
GLU_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
VPATH = RCS
INCDIR = ../include
LIBDIR = ../lib
SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \
project.c quadric.c tess.c tesselat.c polytest.c
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
tess_winding.c
OBJECTS = $(SOURCES:.c=.o)
@@ -40,7 +45,7 @@ targets: $(LIBDIR)/$(GLU_LIB)
# Make the library:
$(LIBDIR)/$(GLU_LIB): $(OBJECTS)
$(MAKELIB) $(GLU_LIB) $(MAJOR) $(MINOR) $(OBJECTS)
$(MAKELIB) $(GLU_LIB) $(GLU_MAJOR) $(GLU_MINOR) $(GLU_TINY) $(OBJECTS)
mv $(GLU_LIB)* $(LIBDIR)
include ../Make-config

View File

@@ -1,4 +1,4 @@
LIBRARY MESAGLU
LIBRARY GLU32
DESCRIPTION 'GLU for Windows Mesa'
EXETYPE WINDOWS
CODE MOVEABLE DISCARDABLE
@@ -45,10 +45,17 @@ EXPORTS
gluPwlCurve
gluNurbsCallback
gluNewTess
gluTessCallback
gluDeleteTess
gluBeginPolygon
gluEndPolygon
gluNextContour
gluTessBeginPolygon
gluTessBeginContour
gluTessVertex
gluTessEndContour
gluTessEndPolygon
gluTessProperty
gluTessNormal
gluTessCallback
gluGetTessProperty
gluBeginPolygon
gluNextContour
gluEndPolygon
gluGetString

View File

@@ -15,10 +15,12 @@ LIBDIR = [-.lib]
CFLAGS = /include=$(INCDIR)/define=(FBIND=1)
SOURCES = glu.c mipmap.c nurbs.c nurbscrv.c nurbssrf.c nurbsutl.c \
project.c quadric.c tess.c tesselat.c polytest.c
project.c quadric.c tess.c tess_fist.c tess_hash.c tess_heap.c \
tess_winding.c
OBJECTS =glu.obj,mipmap.obj,nurbs.obj,nurbscrv.obj,nurbssrf.obj,nurbsutl.obj,\
project.obj,quadric.obj,tess.obj,tesselat.obj,polytest.obj
project.obj,quadric.obj,tess.obj,tess_fist.obj,tess_hash.obj,\
tess_heap.obj,tess_winding.obj

View File

@@ -1,4 +1,4 @@
/* $Id: glu.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: glu.c,v 1.15 1999/09/19 02:03:19 tjump Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,8 +23,51 @@
/*
* $Log: glu.c,v $
* Revision 1.1 1999/08/19 00:55:42 jtg
* Initial revision
* Revision 1.15 1999/09/19 02:03:19 tjump
* More Win32 build compliance fixups
*
* Revision 1.14 1999/09/17 12:21:53 brianp
* glGetProcAddressEXT changes to accomodate Win32 and non-Win32
*
* Revision 1.13 1999/09/17 03:17:18 tjump
* Patch error fixup
*
* Revision 1.12 1999/09/17 03:07:28 tjump
* Win32 build req't updates
*
* Revision 1.11 1999/09/17 01:00:38 brianp
* fixed typo
*
* Revision 1.10 1999/09/17 00:06:14 brianp
* gluGetProcAddressEXT change for C++ / BeOS
*
* Revision 1.9 1999/09/16 22:37:56 brianp
* added some casts in gluGetProcAddressEXT()
*
* Revision 1.8 1999/09/16 16:53:28 brianp
* clean-up of GLU_EXT_get_proc_address
*
* Revision 1.7 1999/09/14 00:11:40 brianp
* added gluCheckExtension()
*
* Revision 1.6 1999/09/13 14:31:32 joukj
*
* strcmp needs the string.h
*
* Revision 1.5 1999/09/11 12:04:54 brianp
* added 1.2 function to gluGetProcAddressEXT()
*
* Revision 1.4 1999/09/11 11:36:26 brianp
* added GLU_EXT_get_proc_address
*
* Revision 1.3 1999/09/10 04:32:10 gareth
* Fixed triangle output, recovery process termination.
*
* Revision 1.2 1999/09/10 02:03:31 gareth
* Added GLU 1.3 tessellation (except winding rule code).
*
* Revision 1.1.1.1 1999/08/19 00:55:42 jtg
* Imported sources
*
* Revision 1.13 1999/03/31 19:07:28 brianp
* added GL_EXT_abgr to extensions
@@ -71,9 +114,11 @@
#ifdef PC_HEADER
#include "all.h"
#else
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "gluP.h"
#endif
@@ -213,15 +258,14 @@ void GLAPIENTRY gluPickMatrix( GLdouble x, GLdouble y,
const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode )
{
static char *tess_error[] = {
"missing gluEndPolygon",
"missing gluBeginPolygon",
"misoriented contour",
"vertex/edge intersection",
"missing gluBeginContour",
"missing gluEndPolygon",
"missing gluEndContour",
"misoriented or self-intersecting loops",
"coincident vertices",
"colinear vertices",
"intersecting edges",
"not coplanar contours"
"FIST recovery process fatal error"
};
static char *nurbs_error[] = {
"spline order un-supported",
@@ -301,7 +345,7 @@ const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode )
else if (errorCode==GLU_INCOMPATIBLE_GL_VERSION) {
return (GLubyte *) "incompatible GL version";
}
else if (errorCode>=GLU_TESS_ERROR1 && errorCode<=GLU_TESS_ERROR9) {
else if (errorCode>=GLU_TESS_ERROR1 && errorCode<=GLU_TESS_ERROR8) {
return (GLubyte *) tess_error[errorCode-GLU_TESS_ERROR1];
}
else if (errorCode>=GLU_NURBS_ERROR1 && errorCode<=GLU_NURBS_ERROR37) {
@@ -320,8 +364,8 @@ const GLubyte* GLAPIENTRY gluErrorString( GLenum errorCode )
const GLubyte* GLAPIENTRY gluGetString( GLenum name )
{
static char *extensions = "GL_EXT_abgr";
static char *version = "1.1 Mesa 3.1";
static char *extensions = "GL_EXT_abgr GLU_EXT_get_proc_address";
static char *version = "1.2 Mesa 3.1";
switch (name) {
case GLU_EXTENSIONS:
@@ -333,3 +377,73 @@ const GLubyte* GLAPIENTRY gluGetString( GLenum name )
}
}
#ifdef GLU_EXT_get_proc_address
#ifdef __cplusplus
/* for BeOS R4.5 */
void GLAPIENTRY (*gluGetProcAddressEXT(const GLubyte *procName))(...)
#else
void (GLAPIENTRY *gluGetProcAddressEXT(const GLubyte *procName))()
#endif
{
struct proc {
const char *name;
void *address;
};
static struct proc procTable[] = {
{ "gluGetProcAddressEXT", (void *) gluGetProcAddressEXT }, /* me! */
/* new 1.1 functions */
{ "gluGetString", (void *) gluGetString },
/* new 1.2 functions */
{ "gluTessBeginPolygon", (void *) gluTessBeginPolygon },
{ "gluTessBeginContour", (void *) gluTessBeginContour },
{ "gluTessEndContour", (void *) gluTessEndContour },
{ "gluTessEndPolygon", (void *) gluTessEndPolygon },
{ "gluGetTessProperty", (void *) gluGetTessProperty },
/* new 1.3 functions */
{ NULL, NULL }
};
GLuint i;
for (i = 0; procTable[i].address; i++) {
if (strcmp((const char *) procName, procTable[i].name) == 0)
return (void (GLAPIENTRY *)()) procTable[i].address;
}
return NULL;
}
#endif
/*
* New in GLU 1.3
*/
GLboolean GLAPIENTRY
gluCheckExtension( const char *extName, const GLubyte *extString )
{
assert(extName);
assert(extString);
{
const int len = strlen(extName);
const char *start = (const char *) extString;
while (1) {
const char *c = strstr( start, extName );
if (!c)
return GL_FALSE;
if ((c == start || c[-1] == ' ') && (c[len] == ' ' || c[len] == 0))
return GL_TRUE;
start = c + len;
}
}
}

View File

@@ -1,4 +1,4 @@
/* $Id: mipmap.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: mipmap.c,v 1.2 1999/09/14 00:30:28 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,8 +23,11 @@
/*
* $Log: mipmap.c,v $
* Revision 1.1 1999/08/19 00:55:42 jtg
* Initial revision
* Revision 1.2 1999/09/14 00:30:28 brianp
* fixed pixel packing/unpacking code in gluBuild2DMipmaps()
*
* Revision 1.1.1.1 1999/08/19 00:55:42 jtg
* Imported sources
*
* Revision 1.13 1999/03/05 17:49:06 brianp
* added support for GL_EXT_abgr (devernay@istar.fr)
@@ -715,6 +718,10 @@ GLint GLAPIENTRY gluBuild2DMipmaps( GLenum target, GLint components,
void *image, *newimage;
GLint neww, newh, level, bpp;
int error;
GLboolean done;
GLint retval = 0;
GLint unpackrowlength, unpackalignment, unpackskiprows, unpackskippixels;
GLint packrowlength, packalignment, packskiprows, packskippixels;
if (width < 1 || height < 1)
return GLU_INVALID_VALUE;
@@ -736,6 +743,24 @@ GLint GLAPIENTRY gluBuild2DMipmaps( GLenum target, GLint components,
return GLU_INVALID_ENUM;
}
/* Get current glPixelStore values */
glGetIntegerv( GL_UNPACK_ROW_LENGTH, &unpackrowlength );
glGetIntegerv( GL_UNPACK_ALIGNMENT, &unpackalignment );
glGetIntegerv( GL_UNPACK_SKIP_ROWS, &unpackskiprows );
glGetIntegerv( GL_UNPACK_SKIP_PIXELS, &unpackskippixels );
glGetIntegerv( GL_PACK_ROW_LENGTH, &packrowlength );
glGetIntegerv( GL_PACK_ALIGNMENT, &packalignment );
glGetIntegerv( GL_PACK_SKIP_ROWS, &packskiprows );
glGetIntegerv( GL_PACK_SKIP_PIXELS, &packskippixels );
/* set pixel packing */
glPixelStorei( GL_PACK_ROW_LENGTH, 0 );
glPixelStorei( GL_PACK_ALIGNMENT, 1 );
glPixelStorei( GL_PACK_SKIP_ROWS, 0 );
glPixelStorei( GL_PACK_SKIP_PIXELS, 0 );
done = GL_FALSE;
if (w!=width || h!=height) {
/* must rescale image to get "top" mipmap texture image */
image = malloc( (w+4) * h * bpp );
@@ -745,7 +770,8 @@ GLint GLAPIENTRY gluBuild2DMipmaps( GLenum target, GLint components,
error = gluScaleImage( format, width, height, type, data,
w, h, type, image );
if (error) {
return error;
retval = error;
done = GL_TRUE;
}
}
else {
@@ -753,7 +779,15 @@ GLint GLAPIENTRY gluBuild2DMipmaps( GLenum target, GLint components,
}
level = 0;
while (1) {
while (!done) {
if (image != data) {
/* set pixel unpacking */
glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
glPixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
}
glTexImage2D( target, level, components, w, h, 0, format, type, image );
if (w==1 && h==1) break;
@@ -768,7 +802,8 @@ GLint GLAPIENTRY gluBuild2DMipmaps( GLenum target, GLint components,
error = gluScaleImage( format, w, h, type, image,
neww, newh, type, newimage );
if (error) {
return error;
retval = error;
done = GL_TRUE;
}
if (image!=data) {
@@ -785,6 +820,16 @@ GLint GLAPIENTRY gluBuild2DMipmaps( GLenum target, GLint components,
free( image );
}
return 0;
/* Restore original glPixelStore state */
glPixelStorei( GL_UNPACK_ROW_LENGTH, unpackrowlength );
glPixelStorei( GL_UNPACK_ALIGNMENT, unpackalignment );
glPixelStorei( GL_UNPACK_SKIP_ROWS, unpackskiprows );
glPixelStorei( GL_UNPACK_SKIP_PIXELS, unpackskippixels );
glPixelStorei( GL_PACK_ROW_LENGTH, packrowlength );
glPixelStorei( GL_PACK_ALIGNMENT, packalignment );
glPixelStorei( GL_PACK_SKIP_ROWS, packskiprows );
glPixelStorei( GL_PACK_SKIP_PIXELS, packskippixels );
return retval;
}

View File

@@ -9,5 +9,6 @@ nurbsutl.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h nurbs.h
project.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h
quadric.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h
tess.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h
tesselat.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h
polytest.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h
tess_fist.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h
tess_hash.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h
tess_heap.obj : gluP.h [-.include.gl]gl.h [-.include.gl]glu.h tess.h

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
/* $Id: project.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: project.c,v 1.2 1999/09/14 00:10:31 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -23,8 +23,11 @@
/*
* $Log: project.c,v $
* Revision 1.1 1999/08/19 00:55:42 jtg
* Initial revision
* Revision 1.2 1999/09/14 00:10:31 brianp
* added gluUnProject4()
*
* Revision 1.1.1.1 1999/08/19 00:55:42 jtg
* Imported sources
*
* Revision 1.7 1999/01/03 03:23:15 brianp
* now using GLAPIENTRY and GLCALLBACK keywords (Ted Jump)
@@ -123,14 +126,6 @@ static void matmul( GLdouble *product, const GLdouble *a, const GLdouble *b )
}
static GLdouble Identity[16] = {
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0
};
/*
* Compute inverse of 4x4 transformation matrix.
@@ -316,3 +311,41 @@ GLint GLAPIENTRY gluUnProject(GLdouble winx,GLdouble winy,GLdouble winz,
return GL_TRUE;
}
/*
* New in GLU 1.3
* This is like gluUnProject but also takes near and far DepthRange values.
*/
GLint GLAPIENTRY
gluUnProject4( GLdouble winx, GLdouble winy, GLdouble winz, GLdouble clipw,
const GLdouble modelMatrix[16],
const GLdouble projMatrix[16],
const GLint viewport[4],
GLclampd nearZ, GLclampd farZ,
GLdouble *objx, GLdouble *objy, GLdouble *objz, GLdouble *objw )
{
/* matrice de transformation */
GLdouble m[16], A[16];
GLdouble in[4],out[4];
GLdouble z = nearZ + winz * (farZ - nearZ);
/* transformation coordonnees normalisees entre -1 et 1 */
in[0] = (winx-viewport[0])*2/viewport[2] - 1.0;
in[1] = (winy-viewport[1])*2/viewport[3] - 1.0;
in[2] = 2.0 * z - 1.0;
in[3] = clipw;
/* calcul transformation inverse */
matmul(A,projMatrix,modelMatrix);
invert_matrix(A,m);
/* d'ou les coordonnees objets */
transform_point(out,m,in);
if (out[3]==0.0)
return GL_FALSE;
*objx=out[0]/out[3];
*objy=out[1]/out[3];
*objz=out[2]/out[3];
*objw=out[3];
return GL_TRUE;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,121 +1,138 @@
/* $Id: tess.h,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/* $Id: tess.h,v 1.9 1999/10/03 00:56:07 gareth Exp $ */
/*
* Mesa 3-D graphics library
* Version: 3.1
* Copyright (C) 1995-1998 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
* 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:
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* 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.
*/
/*
* $Log: tess.h,v $
* Revision 1.1 1999/08/19 00:55:42 jtg
* Initial revision
* Revision 1.9 1999/10/03 00:56:07 gareth
* Added tessellation winding rule support. Misc bug fixes.
*
* Revision 1.5 1999/02/27 13:55:31 brianp
* fixed BeOS-related GLU typedef problems
* Revision 1.8 1999/09/17 06:31:02 gareth
* Winding rule updates.
*
* Revision 1.4 1999/01/03 03:23:15 brianp
* now using GLAPIENTRY and GLCALLBACK keywords (Ted Jump)
* Revision 1.7 1999/09/16 06:42:01 gareth
* Misc winding rule bug fixes.
*
* Revision 1.3 1997/10/29 02:02:20 brianp
* various MS Windows compiler changes (David Bucciarelli, v20 3dfx driver)
* Revision 1.6 1999/09/15 02:12:16 gareth
* Added debugging pragma message.
*
* Revision 1.2 1997/05/24 13:30:58 brianp
* added TESS_H multi-inclusion prevention test
* Revision 1.5 1999/09/14 22:46:02 gareth
* Added debugging output.
*
* Revision 1.1 1996/09/27 01:19:39 brianp
* Initial revision
* Revision 1.4 1999/09/13 22:20:13 gareth
* Fixed file headers. Tracking down macro bugs.
*
*/
/*****************************************************************************
*
* GLU 1.3 Polygon Tessellation by Gareth Hughes <garethh@lucent.com>
*
*****************************************************************************/
/*
* This file is part of the polygon tesselation code contributed by
* Bogdan Sikorski
*/
#ifndef TESS_H
#define TESS_H
#ifndef __GLU_TESS_H__
#define __GLU_TESS_H__
#include <stdarg.h>
#include <stdio.h>
#include "gluP.h"
#define EPSILON 1e-06 /* epsilon for double precision compares */
#include "tess_typedefs.h"
#include "tess_hash.h"
#include "tess_heap.h"
#if 0
#include "tess_grid.h"
#endif
typedef enum
{
OXY,
OYZ,
OXZ
} projection_type;
typedef struct callbacks_str
{
void (GLCALLBACK *begin)( GLenum mode );
void (GLCALLBACK *edgeFlag)( GLboolean flag );
void (GLCALLBACK *vertex)( GLvoid *v );
void (GLCALLBACK *end)( void );
void (GLCALLBACK *error)( GLenum err );
} tess_callbacks;
typedef struct vertex_str
{
void *data;
GLdouble location[3];
GLdouble x,y;
GLboolean edge_flag;
struct vertex_str *shadow_vertex;
struct vertex_str *next,*previous;
} tess_vertex;
typedef struct contour_str
{
GLenum type;
GLuint vertex_cnt;
GLdouble area;
GLenum orientation;
struct vertex_str *vertices,*last_vertex;
struct contour_str *next,*previous;
} tess_contour;
typedef struct polygon_str
{
GLuint vertex_cnt;
GLdouble A,B,C,D;
GLdouble area;
GLenum orientation;
struct vertex_str *vertices,*last_vertex;
} tess_polygon;
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
* The GLUtesselator structure:
*****************************************************************************/
struct GLUtesselator
{
tess_contour *contours,*last_contour;
GLuint contour_cnt;
tess_callbacks callbacks;
tess_polygon *current_polygon;
GLenum error;
GLdouble A,B,C,D;
projection_type projection;
tess_callbacks_t callbacks;
GLboolean boundary_only;
GLenum winding_rule;
GLdouble tolerance;
tess_plane_t plane;
GLuint contour_count;
tess_contour_t *contours, *last_contour;
tess_contour_t *current_contour;
GLdouble mins[2], maxs[2];
GLuint vertex_count;
tess_vertex_t **sorted_vertices;
#if 0
tess_grid_t *grid; /* Not currently used... */
#endif
heap_t *ears;
hashtable_t *cvc_lists;
void *user_data;
GLuint label;
GLenum error;
};
extern void tess_call_user_error(GLUtriangulatorObj *,GLenum);
/*****************************************************************************
* Tessellation error handler:
*****************************************************************************/
extern void tess_error_callback( GLUtesselator *, GLenum );
/*****************************************************************************
* Debugging output: (to be removed...)
*****************************************************************************/
#ifdef DEBUG
extern int tess_debug_level;
int vdebugstr( char *format_str, ... );
#pragma message( "tess: using DEBUGP for debugging output" )
#define DEBUGP( level, body ) \
do { \
if ( tess_debug_level >= level ) { \
vdebugstr( "%11.11s:%-5d ", __FILE__, __LINE__, level ); \
vdebugstr body; \
fflush( stderr ); \
} \
} while ( 0 )
#define DEBUGIF( level ) do { if ( tess_debug_level >= level ) {
#define DEBUGENDIF } } while ( 0 )
#else
#define DEBUGP( level, body )
#define DEBUGIF( level ) while(0) {
#define DEBUGENDIF }
#endif
#ifdef __cplusplus
}
#endif
#endif /* __GLU_TESS_H__ */

View File

@@ -1,456 +0,0 @@
/* $Id: tesselat.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */
/*
* Mesa 3-D graphics library
* Version: 2.4
* Copyright (C) 1995-1997 Brian Paul
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* $Log: tesselat.c,v $
* Revision 1.1 1999/08/19 00:55:42 jtg
* Initial revision
*
* Revision 1.5 1997/07/24 01:28:44 brianp
* changed precompiled header symbol from PCH to PC_HEADER
*
* Revision 1.4 1997/05/28 02:29:38 brianp
* added support for precompiled headers (PCH), inserted APIENTRY keyword
*
* Revision 1.3 1997/02/17 17:24:58 brianp
* more tesselation changes (Randy Frank)
*
* Revision 1.2 1997/02/13 18:31:57 brianp
* fixed some numerical precision problems (Randy Frank)
*
* Revision 1.1 1996/09/27 01:19:39 brianp
* Initial revision
*
*/
/*
* This file is part of the polygon tesselation code contributed by
* Bogdan Sikorski
*/
#ifdef PC_HEADER
#include "all.h"
#else
#include <stdlib.h>
#include <math.h>
#include "tess.h"
#endif
static GLboolean edge_flag;
static void emit_triangle(GLUtriangulatorObj *, tess_vertex *,
tess_vertex *,tess_vertex *);
static void emit_triangle_with_edge_flag(GLUtriangulatorObj *,
tess_vertex *,GLboolean,tess_vertex *,GLboolean,
tess_vertex *,GLboolean);
static GLdouble twice_the_triangle_area(
tess_vertex *va,
tess_vertex *vb,
tess_vertex *vc)
{
return (vb->x - va->x)*(vc->y - va->y) - (vb->y - va->y)*(vc->x - va->x);
}
static GLboolean left(
GLdouble A,
GLdouble B,
GLdouble C,
GLdouble x,
GLdouble y)
{
if(A*x+B*y+C > -EPSILON)
return GL_TRUE;
else
return GL_FALSE;
}
static GLboolean right(
GLdouble A,
GLdouble B,
GLdouble C,
GLdouble x,
GLdouble y)
{
if(A*x+B*y+C < EPSILON)
return GL_TRUE;
else
return GL_FALSE;
}
static GLint convex_ccw(
tess_vertex *va,
tess_vertex *vb,
tess_vertex *vc,
GLUtriangulatorObj *tobj)
{
GLdouble d;
d = twice_the_triangle_area(va,vb,vc);
if (d > EPSILON ) {
return 1;
} else if (d < -EPSILON ) {
return 0;
} else {
return -1;
}
}
static GLint convex_cw(
tess_vertex *va,
tess_vertex *vb,
tess_vertex *vc,
GLUtriangulatorObj *tobj)
{
GLdouble d;
d = twice_the_triangle_area(va,vb,vc);
if (d < -EPSILON ) {
return 1;
} else if (d > EPSILON ) {
return 0;
} else {
return -1;
}
}
static GLboolean diagonal_ccw(
tess_vertex *va,
tess_vertex *vb,
GLUtriangulatorObj *tobj,
tess_contour *contour)
{
tess_vertex *vc=va->next , *vertex , *shadow_vertex;
struct
{
GLdouble A,B,C;
} ac,cb,ba;
GLdouble x,y;
GLint res = convex_ccw(va,vc,vb,tobj);
if (res == 0) return GL_FALSE;
if (res == -1) return GL_TRUE;
ba.A=vb->y - va->y;
ba.B=va->x - vb->x;
ba.C= -ba.A*va->x - ba.B*va->y;
ac.A=va->y - vc->y;
ac.B=vc->x - va->x;
ac.C= -ac.A*vc->x - ac.B*vc->y;
cb.A=vc->y - vb->y;
cb.B=vb->x - vc->x;
cb.C= -cb.A*vb->x - cb.B*vb->y;
for(vertex=vb->next;vertex!=va;vertex=vertex->next)
{
shadow_vertex=vertex->shadow_vertex;
if(shadow_vertex!=NULL &&
(shadow_vertex==va || shadow_vertex==vb || shadow_vertex==vc))
continue;
x=vertex->x;
y=vertex->y;
if(left(ba.A,ba.B,ba.C,x,y) &&
left(ac.A,ac.B,ac.C,x,y) &&
left(cb.A,cb.B,cb.C,x,y))
return GL_FALSE;
}
return GL_TRUE;
}
static GLboolean diagonal_cw(
tess_vertex *va,
tess_vertex *vb,
GLUtriangulatorObj *tobj,
tess_contour *contour)
{
tess_vertex *vc=va->next , *vertex , *shadow_vertex;
struct
{
GLdouble A,B,C;
} ac,cb,ba;
GLdouble x,y;
GLint res = convex_cw(va,vc,vb,tobj);
if (res == 0) return GL_FALSE;
if (res == -1) return GL_TRUE;
ba.A=vb->y - va->y;
ba.B=va->x - vb->x;
ba.C= -ba.A*va->x - ba.B*va->y;
ac.A=va->y - vc->y;
ac.B=vc->x - va->x;
ac.C= -ac.A*vc->x - ac.B*vc->y;
cb.A=vc->y - vb->y;
cb.B=vb->x - vc->x;
cb.C= -cb.A*vb->x - cb.B*vb->y;
for(vertex=vb->next;vertex!=va;vertex=vertex->next)
{
shadow_vertex=vertex->shadow_vertex;
if(shadow_vertex!=NULL &&
(shadow_vertex==va || shadow_vertex==vb || shadow_vertex==vc))
continue;
x=vertex->x;
y=vertex->y;
if(right(ba.A,ba.B,ba.C,x,y) &&
right(ac.A,ac.B,ac.C,x,y) &&
right(cb.A,cb.B,cb.C,x,y))
return GL_FALSE;
}
return GL_TRUE;
}
static void clip_ear(
GLUtriangulatorObj *tobj,
tess_vertex *v,
tess_contour *contour)
{
emit_triangle(tobj,v->previous,v,v->next);
/* the first in the list */
if(contour->vertices==v)
{
contour->vertices=v->next;
contour->last_vertex->next=v->next;
v->next->previous=contour->last_vertex;
}
else
/* the last ? */
if(contour->last_vertex==v)
{
contour->vertices->previous=v->previous;
v->previous->next=v->next;
contour->last_vertex=v->previous;
}
else
{
v->next->previous=v->previous;
v->previous->next=v->next;
}
free(v);
--(contour->vertex_cnt);
}
static void clip_ear_with_edge_flag(
GLUtriangulatorObj *tobj,
tess_vertex *v,
tess_contour *contour)
{
emit_triangle_with_edge_flag(tobj,v->previous,v->previous->edge_flag,
v,v->edge_flag,v->next,GL_FALSE);
v->previous->edge_flag=GL_FALSE;
/* the first in the list */
if(contour->vertices==v)
{
contour->vertices=v->next;
contour->last_vertex->next=v->next;
v->next->previous=contour->last_vertex;
}
else
/* the last ? */
if(contour->last_vertex==v)
{
contour->vertices->previous=v->previous;
v->previous->next=v->next;
contour->last_vertex=v->previous;
}
else
{
v->next->previous=v->previous;
v->previous->next=v->next;
}
free(v);
--(contour->vertex_cnt);
}
static void triangulate_ccw(
GLUtriangulatorObj *tobj,
tess_contour *contour)
{
tess_vertex *vertex;
GLuint vertex_cnt=contour->vertex_cnt;
while(vertex_cnt > 3)
{
vertex=contour->vertices;
while(diagonal_ccw(vertex,vertex->next->next,tobj,contour)==GL_FALSE &&
tobj->error==GLU_NO_ERROR)
vertex=vertex->next;
if(tobj->error!=GLU_NO_ERROR)
return;
clip_ear(tobj,vertex->next,contour);
--vertex_cnt;
}
}
static void triangulate_cw(
GLUtriangulatorObj *tobj,
tess_contour *contour)
{
tess_vertex *vertex;
GLuint vertex_cnt=contour->vertex_cnt;
while(vertex_cnt > 3)
{
vertex=contour->vertices;
while(diagonal_cw(vertex,vertex->next->next,tobj,contour)==GL_FALSE &&
tobj->error==GLU_NO_ERROR)
vertex=vertex->next;
if(tobj->error!=GLU_NO_ERROR)
return;
clip_ear(tobj,vertex->next,contour);
--vertex_cnt;
}
}
static void triangulate_ccw_with_edge_flag(
GLUtriangulatorObj *tobj,
tess_contour *contour)
{
tess_vertex *vertex;
GLuint vertex_cnt=contour->vertex_cnt;
while(vertex_cnt > 3)
{
vertex=contour->vertices;
while(diagonal_ccw(vertex,vertex->next->next,tobj,contour)==GL_FALSE &&
tobj->error==GLU_NO_ERROR)
vertex=vertex->next;
if(tobj->error!=GLU_NO_ERROR)
return;
clip_ear_with_edge_flag(tobj,vertex->next,contour);
--vertex_cnt;
}
}
static void triangulate_cw_with_edge_flag(
GLUtriangulatorObj *tobj,
tess_contour *contour)
{
tess_vertex *vertex;
GLuint vertex_cnt=contour->vertex_cnt;
while(vertex_cnt > 3)
{
vertex=contour->vertices;
while(diagonal_cw(vertex,vertex->next->next,tobj,contour)==GL_FALSE &&
tobj->error==GLU_NO_ERROR)
vertex=vertex->next;
if(tobj->error!=GLU_NO_ERROR)
return;
clip_ear_with_edge_flag(tobj,vertex->next,contour);
--vertex_cnt;
}
}
void tess_tesselate(GLUtriangulatorObj *tobj)
{
tess_contour *contour;
for(contour=tobj->contours;contour!=NULL;contour=contour->next)
{
if(contour->orientation==GLU_CCW) {
triangulate_ccw(tobj,contour);
} else {
triangulate_cw(tobj,contour);
}
if(tobj->error!=GLU_NO_ERROR)
return;
/* emit the last triangle */
emit_triangle(tobj,contour->vertices,contour->vertices->next,
contour->vertices->next->next);
}
}
void tess_tesselate_with_edge_flag(GLUtriangulatorObj *tobj)
{
tess_contour *contour;
edge_flag=GL_TRUE;
/* first callback with edgeFlag set to GL_TRUE */
(tobj->callbacks.edgeFlag)(GL_TRUE);
for(contour=tobj->contours;contour!=NULL;contour=contour->next)
{
if(contour->orientation==GLU_CCW)
triangulate_ccw_with_edge_flag(tobj,contour);
else
triangulate_cw_with_edge_flag(tobj,contour);
if(tobj->error!=GLU_NO_ERROR)
return;
/* emit the last triangle */
emit_triangle_with_edge_flag(tobj,contour->vertices,
contour->vertices->edge_flag,contour->vertices->next,
contour->vertices->next->edge_flag,contour->vertices->next->next,
contour->vertices->next->next->edge_flag);
}
}
static void emit_triangle(
GLUtriangulatorObj *tobj,
tess_vertex *v1,
tess_vertex *v2,
tess_vertex *v3)
{
(tobj->callbacks.begin)(GL_TRIANGLES);
(tobj->callbacks.vertex)(v1->data);
(tobj->callbacks.vertex)(v2->data);
(tobj->callbacks.vertex)(v3->data);
(tobj->callbacks.end)();
}
static void emit_triangle_with_edge_flag(
GLUtriangulatorObj *tobj,
tess_vertex *v1,
GLboolean edge_flag1,
tess_vertex *v2,
GLboolean edge_flag2,
tess_vertex *v3,
GLboolean edge_flag3)
{
(tobj->callbacks.begin)(GL_TRIANGLES);
if(edge_flag1!=edge_flag)
{
edge_flag = (edge_flag==GL_TRUE ? GL_FALSE : GL_TRUE);
(tobj->callbacks.edgeFlag)(edge_flag);
}
(tobj->callbacks.vertex)(v1->data);
if(edge_flag2!=edge_flag)
{
edge_flag = (edge_flag==GL_TRUE ? GL_FALSE : GL_TRUE);
(tobj->callbacks.edgeFlag)(edge_flag);
}
(tobj->callbacks.vertex)(v2->data);
if(edge_flag3!=edge_flag)
{
edge_flag = (edge_flag==GL_TRUE ? GL_FALSE : GL_TRUE);
(tobj->callbacks.edgeFlag)(edge_flag);
}
(tobj->callbacks.vertex)(v3->data);
(tobj->callbacks.end)();
}

106
src/glut/beos/Makefile Normal file
View File

@@ -0,0 +1,106 @@
## BeOS Generic Makefile v2.0 ##
## Modified by Brian Paul to work with Mesa 3.1
## Fill in this file to specify the project being created, and the referenced
## makefile-engine will do all of the hard work for you. This handles both
## Intel and PowerPC builds of the BeOS.
## Application Specific Settings ---------------------------------------------
# specify the name of the binary
NAME= libglut.so
# specify the type of binary
# APP: Application
# SHARED: Shared library or add-on
# STATIC: Static library archive
# DRIVER: Kernel Driver
TYPE= SHARED
# specify the source files to use
# full paths or paths relative to the makefile can be included
# all files, regardless of directory, will have their object
# files created in the common object directory.
# Note that this means this makefile will not work correctly
# if two source files with the same name (source.c or source.cpp)
# are included from different directories. Also note that spaces
# in folder names do not work well with this makefile.
SRCS= glut_util.cpp glutBlocker.cpp glutInit.cpp glutWindow.cpp \
glutEvent.cpp glutCallback.cpp glutOverlay.cpp glutGet.cpp glutColor.cpp \
glutCursor.cpp glutMenu.cpp glutDstr.cpp glut_bitmap.cpp glut_bwidth.cpp \
glut_8x13.cpp glut_9x15.cpp glut_hel10.cpp glut_hel12.cpp glut_hel18.cpp \
glut_tr10.cpp glut_tr24.cpp glut_mroman.cpp glut_roman.cpp glut_stroke.cpp \
glut_swidth.cpp glut_shapes.cpp glut_teapot.cpp beos_x11.cpp
# specify the resource files to use
# full path or a relative path to the resource file can be used.
RSRCS=
# specify additional libraries to link against
# there are two acceptable forms of library specifications
# - if your library follows the naming pattern of:
# libXXX.so or libXXX.a you can simply specify XXX
# library: libbe.so entry: be
#
# - if your library does not follow the standard library
# naming scheme you need to specify the path to the library
# and it's name
# library: my_lib.a entry: my_lib.a or path/my_lib.a
#LIBS= MesaGL MesaGLU be
LIBS= GL GLU be
# specify additional paths to directories following the standard
# libXXX.so or libXXX.a naming scheme. You can specify full paths
# or paths relative to the makefile. The paths included may not
# be recursive, so include all of the paths where libraries can
# be found. Directories where source files are found are
# automatically included.
LIBPATHS= ../lib
# additional paths to look for system headers
# thes use the form: #include <header>
# source file directories are NOT auto-included here
SYSTEM_INCLUDE_PATHS = ../../include /boot/develop/headers/be/opengl
# additional paths to look for local headers
# thes use the form: #include "header"
# source file directories are automatically included
LOCAL_INCLUDE_PATHS =
# specify the level of optimization that you desire
# NONE, SOME, FULL
OPTIMIZE= FULL
# specify any preprocessor symbols to be defined. The symbols
# will be set to a value of 1. For example specify DEBUG if you want
# DEBUG=1 to be set when compiling.
DEFINES=
# specify special warning levels
# if unspecified default warnings will be used
# NONE = supress all warnings
# ALL = enable all warnings
WARNINGS = ALL
# specify whether image symbols will be created
# so that stack crawls in the debugger are meaningful
# if TRUE symbols will be created
SYMBOLS =
# specify debug settings
# if TRUE will allow application to be run from
# a source-level debugger
DEBUGGER =
# specify additional compiler flags for all files
COMPILER_FLAGS =
# specify additional linker flags
LINKER_FLAGS =
## include the makefile-engine
include /boot/develop/etc/makefile-engine

102
src/glut/beos/Makefile.orig Normal file
View File

@@ -0,0 +1,102 @@
## BeOS Generic Makefile v2.0 ##
## Fill in this file to specify the project being created, and the referenced
## makefile-engine will do all of the hard work for you. This handles both
## Intel and PowerPC builds of the BeOS.
## Application Specific Settings ---------------------------------------------
# specify the name of the binary
NAME= libglut.so
# specify the type of binary
# APP: Application
# SHARED: Shared library or add-on
# STATIC: Static library archive
# DRIVER: Kernel Driver
TYPE= SHARED
# specify the source files to use
# full paths or paths relative to the makefile can be included
# all files, regardless of directory, will have their object
# files created in the common object directory.
# Note that this means this makefile will not work correctly
# if two source files with the same name (source.c or source.cpp)
# are included from different directories. Also note that spaces
# in folder names do not work well with this makefile.
SRCS= glut_util.cpp glutBlocker.cpp glutInit.cpp glutWindow.cpp \
glutEvent.cpp glutCallback.cpp glutOverlay.cpp glutGet.cpp glutColor.cpp \
glutCursor.cpp glutMenu.cpp glutDstr.cpp glut_bitmap.cpp glut_bwidth.cpp \
glut_8x13.cpp glut_9x15.cpp glut_hel10.cpp glut_hel12.cpp glut_hel18.cpp \
glut_tr10.cpp glut_tr24.cpp glut_mroman.cpp glut_roman.cpp glut_stroke.cpp \
glut_swidth.cpp glut_shapes.cpp glut_teapot.cpp beos_x11.cpp
# specify the resource files to use
# full path or a relative path to the resource file can be used.
RSRCS=
# specify additional libraries to link against
# there are two acceptable forms of library specifications
# - if your library follows the naming pattern of:
# libXXX.so or libXXX.a you can simply specify XXX
# library: libbe.so entry: be
#
# - if your library does not follow the standard library
# naming scheme you need to specify the path to the library
# and it's name
# library: my_lib.a entry: my_lib.a or path/my_lib.a
LIBS= GL be
# specify additional paths to directories following the standard
# libXXX.so or libXXX.a naming scheme. You can specify full paths
# or paths relative to the makefile. The paths included may not
# be recursive, so include all of the paths where libraries can
# be found. Directories where source files are found are
# automatically included.
LIBPATHS=
# additional paths to look for system headers
# thes use the form: #include <header>
# source file directories are NOT auto-included here
SYSTEM_INCLUDE_PATHS = ../../include /boot/develop/headers/be/opengl
# additional paths to look for local headers
# thes use the form: #include "header"
# source file directories are automatically included
LOCAL_INCLUDE_PATHS =
# specify the level of optimization that you desire
# NONE, SOME, FULL
OPTIMIZE= FULL
# specify any preprocessor symbols to be defined. The symbols
# will be set to a value of 1. For example specify DEBUG if you want
# DEBUG=1 to be set when compiling.
DEFINES=
# specify special warning levels
# if unspecified default warnings will be used
# NONE = supress all warnings
# ALL = enable all warnings
WARNINGS = ALL
# specify whether image symbols will be created
# so that stack crawls in the debugger are meaningful
# if TRUE symbols will be created
SYMBOLS =
# specify debug settings
# if TRUE will allow application to be run from
# a source-level debugger
DEBUGGER =
# specify additional compiler flags for all files
COMPILER_FLAGS =
# specify additional linker flags
LINKER_FLAGS =
## include the makefile-engine
include /boot/develop/etc/makefile-engine

176
src/glut/beos/beos_x11.cpp Normal file
View File

@@ -0,0 +1,176 @@
/* Copyright (c) Nate Robins, 1997. */
/* This program is freely distributable without licensing fees
and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
#include <Screen.h>
#include <stdio.h>
#include "beos_x11.h"
/* NOTE: These functions require a BApplication to be instantiated first */
int DisplayWidth() {
BScreen s;
return s.Frame().IntegerWidth() + 1;
}
int DisplayHeight() {
BScreen s;
return s.Frame().IntegerHeight() + 1;
}
/* the following function was stolen from the X sources as indicated. */
/* Copyright Massachusetts Institute of Technology 1985, 1986, 1987 */
/* $XConsortium: XParseGeom.c,v 11.18 91/02/21 17:23:05 rws Exp $ */
/*
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation, and that the name of M.I.T. not be used in advertising or
publicity pertaining to distribution of the software without specific,
written prior permission. M.I.T. makes no representations about the
suitability of this software for any purpose. It is provided "as is"
without express or implied warranty.
*/
/*
*Returns pointer to first char ins search which is also in what, else NULL.
*/
static char *strscan (char *search, char *what)
{
int i, len = strlen (what);
char c;
while ((c = *(search++)) != (int)NULL)
for (i = 0; i < len; i++)
if (c == what [i])
return (--search);
return (NULL);
}
/*
* XParseGeometry parses strings of the form
* "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
* width, height, xoffset, and yoffset are unsigned integers.
* Example: "=80x24+300-49"
* The equal sign is optional.
* It returns a bitmask that indicates which of the four values
* were actually found in the string. For each value found,
* the corresponding argument is updated; for each value
* not found, the corresponding argument is left unchanged.
*/
static int
ReadInteger(char *string, char **NextString)
{
register int Result = 0;
int Sign = 1;
if (*string == '+')
string++;
else if (*string == '-')
{
string++;
Sign = -1;
}
for (; (*string >= '0') && (*string <= '9'); string++)
{
Result = (Result * 10) + (*string - '0');
}
*NextString = string;
if (Sign >= 0)
return (Result);
else
return (-Result);
}
int XParseGeometry (char *string, int *x, int *y,
unsigned int *width, unsigned int *height)
{
int mask = NoValue;
register char *strind;
unsigned int tempWidth=0, tempHeight=0;
int tempX=0, tempY=0;
char *nextCharacter;
if ( (string == NULL) || (*string == '\0')) return(mask);
if (*string == '=')
string++; /* ignore possible '=' at beg of geometry spec */
strind = (char *)string;
if (*strind != '+' && *strind != '-' && *strind != 'x') {
tempWidth = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return (0);
strind = nextCharacter;
mask |= WidthValue;
}
if (*strind == 'x' || *strind == 'X') {
strind++;
tempHeight = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return (0);
strind = nextCharacter;
mask |= HeightValue;
}
if ((*strind == '+') || (*strind == '-')) {
if (*strind == '-') {
strind++;
tempX = -ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return (0);
strind = nextCharacter;
mask |= XNegative;
}
else
{ strind++;
tempX = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return(0);
strind = nextCharacter;
}
mask |= XValue;
if ((*strind == '+') || (*strind == '-')) {
if (*strind == '-') {
strind++;
tempY = -ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return(0);
strind = nextCharacter;
mask |= YNegative;
}
else
{
strind++;
tempY = ReadInteger(strind, &nextCharacter);
if (strind == nextCharacter)
return(0);
strind = nextCharacter;
}
mask |= YValue;
}
}
/* If strind isn't at the end of the string the it's an invalid
geometry specification. */
if (*strind != '\0') return (0);
if (mask & XValue)
*x = tempX;
if (mask & YValue)
*y = tempY;
if (mask & WidthValue)
*width = tempWidth;
if (mask & HeightValue)
*height = tempHeight;
return (mask);
}

33
src/glut/beos/beos_x11.h Normal file
View File

@@ -0,0 +1,33 @@
#ifndef __beos_x11_h__
#define __beos_x11_h__
/* Copyright (c) Nate Robins, 1997. */
/* This program is freely distributable without licensing fees
and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
/*
* Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
* value (x, y, width, height) was found in the parsed string.
*/
#define NoValue 0x0000
#define XValue 0x0001
#define YValue 0x0002
#define WidthValue 0x0004
#define HeightValue 0x0008
#define AllValues 0x000F
#define XNegative 0x0010
#define YNegative 0x0020
/* Function prototypes. */
extern int DisplayWidth();
extern int DisplayHeight();
extern int XParseGeometry(
char* string,
int* x, int* y,
unsigned int* width, unsigned int* height);
#endif /* __beos_x11_h__ */

View File

@@ -0,0 +1,65 @@
/***********************************************************
* Copyright (C) 1997, Be Inc. All rights reserved.
*
* FILE: glutBlocker.cpp
*
* DESCRIPTION: helper class for GLUT event loop.
* if a window receives an event, wake up the event loop.
***********************************************************/
/***********************************************************
* Headers
***********************************************************/
#include "glutBlocker.h"
/***********************************************************
* Global variable
***********************************************************/
GlutBlocker gBlock;
/***********************************************************
* Member functions
***********************************************************/
GlutBlocker::GlutBlocker() {
gSem = create_sem(1, "gSem");
eSem = create_sem(0, "eSem");
events = false;
sleeping = false;
}
GlutBlocker::~GlutBlocker() {
delete_sem(eSem);
delete_sem(gSem);
}
void GlutBlocker::WaitEvent() {
acquire_sem(gSem);
if(!events) { // wait for new event
sleeping = true;
release_sem(gSem);
acquire_sem(eSem); // next event will release eSem
} else {
release_sem(gSem);
}
}
void GlutBlocker::WaitEvent(bigtime_t usecs) {
acquire_sem(gSem);
if(!events) { // wait for new event
sleeping = true;
release_sem(gSem);
acquire_sem_etc(eSem, 1, B_TIMEOUT, usecs); // wait for next event or timeout
} else {
release_sem(gSem);
}
}
void GlutBlocker::NewEvent() {
acquire_sem(gSem);
events = true; // next call to WaitEvent returns immediately
if(sleeping) {
sleeping = false;
release_sem(eSem); // if event loop is blocking, wake it up
}
release_sem(gSem);
}

View File

@@ -0,0 +1,43 @@
/***********************************************************
* Copyright (C) 1997, Be Inc. All rights reserved.
*
* FILE: glutBlocker.h
*
* DESCRIPTION: helper class for GLUT event loop.
* if a window receives an event, wake up the event loop.
***********************************************************/
/***********************************************************
* Headers
***********************************************************/
#include <kernel/OS.h>
/***********************************************************
* CLASS: GlutBlocker
*
* DESCRIPTION: Fairly naive, but safe implementation.
* global semaphore controls access to state
* event semaphore blocks WaitEvent() call if necessary
* (this is basically a condition variable class)
***********************************************************/
class GlutBlocker {
public:
GlutBlocker();
~GlutBlocker();
void WaitEvent(); // wait for new event
void WaitEvent(bigtime_t usecs); // wait with timeout
void NewEvent(); // new event from a window (may need to wakeup main thread)
void QuickNewEvent() { events = true; } // new event from main thread
void ClearEvents() { events = false; } // clear counter at beginning of event loop
bool PendingEvent() { return events; } // XPending() equivalent
private:
sem_id gSem;
sem_id eSem;
bool events; // are there any new events?
bool sleeping; // is someone sleeping on eSem?
};
/***********************************************************
* Global variable
***********************************************************/
extern GlutBlocker gBlock;

View File

@@ -0,0 +1,147 @@
/***********************************************************
* Copyright (C) 1997, Be Inc. All rights reserved.
*
* FILE: glutCallback.cpp
*
* DESCRIPTION: put all the callback setting routines in
* one place
***********************************************************/
/***********************************************************
* Headers
***********************************************************/
#include <GL/glut.h>
#include "glutint.h"
#include "glutState.h"
/***********************************************************
* Window related callbacks
***********************************************************/
void APIENTRY
glutDisplayFunc(GLUTdisplayCB displayFunc)
{
/* XXX Remove the warning after GLUT 3.0. */
if (!displayFunc)
__glutFatalError("NULL display callback not allowed in GLUT 3.0; update your code.");
gState.currentWindow->display = displayFunc;
}
void APIENTRY
glutKeyboardFunc(GLUTkeyboardCB keyboardFunc)
{
gState.currentWindow->keyboard = keyboardFunc;
}
void APIENTRY
glutSpecialFunc(GLUTspecialCB specialFunc)
{
gState.currentWindow->special = specialFunc;
}
void APIENTRY
glutMouseFunc(GLUTmouseCB mouseFunc)
{
gState.currentWindow->mouse = mouseFunc;
}
void APIENTRY
glutMotionFunc(GLUTmotionCB motionFunc)
{
gState.currentWindow->motion = motionFunc;
}
void APIENTRY
glutPassiveMotionFunc(GLUTpassiveCB passiveMotionFunc)
{
gState.currentWindow->passive = passiveMotionFunc;
}
void APIENTRY
glutEntryFunc(GLUTentryCB entryFunc)
{
gState.currentWindow->entry = entryFunc;
if (!entryFunc) {
gState.currentWindow->entryState = -1;
}
}
void APIENTRY
glutVisibilityFunc(GLUTvisibilityCB visibilityFunc)
{
gState.currentWindow->visibility = visibilityFunc;
}
void APIENTRY
glutReshapeFunc(GLUTreshapeCB reshapeFunc)
{
if (reshapeFunc) {
gState.currentWindow->reshape = reshapeFunc;
} else {
gState.currentWindow->reshape = __glutDefaultReshape;
}
}
/***********************************************************
* General callbacks (timer callback in glutEvent.cpp)
***********************************************************/
/* DEPRICATED, use glutMenuStatusFunc instead. */
void APIENTRY
glutMenuStateFunc(GLUTmenuStateCB menuStateFunc)
{
gState.menuStatus = (GLUTmenuStatusCB) menuStateFunc;
}
void APIENTRY
glutMenuStatusFunc(GLUTmenuStatusCB menuStatusFunc)
{
gState.menuStatus = menuStatusFunc;
}
void APIENTRY
glutIdleFunc(GLUTidleCB idleFunc)
{
gState.idle = idleFunc;
}
/***********************************************************
* Unsupported callbacks
***********************************************************/
void APIENTRY
glutOverlayDisplayFunc(GLUTdisplayCB displayFunc)
{
}
void APIENTRY
glutSpaceballMotionFunc(GLUTspaceMotionCB spaceMotionFunc)
{
}
void APIENTRY
glutSpaceballRotateFunc(GLUTspaceRotateCB spaceRotateFunc)
{
}
void APIENTRY
glutSpaceballButtonFunc(GLUTspaceButtonCB spaceButtonFunc)
{
}
void APIENTRY
glutButtonBoxFunc(GLUTbuttonBoxCB buttonBoxFunc)
{
}
void APIENTRY
glutDialsFunc(GLUTdialsCB dialsFunc)
{
}
void APIENTRY
glutTabletMotionFunc(GLUTtabletMotionCB tabletMotionFunc)
{
}
void APIENTRY
glutTabletButtonFunc(GLUTtabletButtonCB tabletButtonFunc)
{
}

View File

@@ -0,0 +1,27 @@
/***********************************************************
* Copyright (C) 1997, Be Inc. All rights reserved.
*
* FILE: glutColor.cpp
*
* DESCRIPTION: we don't support indexed color, so this code is
* really simple
***********************************************************/
/***********************************************************
* Headers
***********************************************************/
#include <GL/glut.h>
#include "glutint.h"
void glutSetColor(int cell, GLfloat red, GLfloat green, GLfloat blue) {
__glutWarning("glutSetColor: current window is RGBA");
}
GLfloat glutGetColor(int cell, int component) {
__glutWarning("glutGetColor: current window is RGBA");
return -1.0;
}
void glutCopyColormap(int win) {
__glutWarning("glutCopyColormap: color index not supported in BeOS");
}

View File

@@ -0,0 +1,85 @@
/***********************************************************
* Copyright (C) 1997, Be Inc. All rights reserved.
*
* FILE: glutCursor.cpp
*
* DESCRIPTION: code for handling custom mouse cursors
***********************************************************/
/***********************************************************
* Headers
***********************************************************/
#include <GL/glut.h>
#include "glutint.h"
#include "glutState.h"
#include "glutCursors.h"
static const unsigned char *cursorTable[] = {
XC_arrow, /* GLUT_CURSOR_RIGHT_ARROW */
XC_top_left_arrow, /* GLUT_CURSOR_LEFT_ARROW */
XC_hand1, /* GLUT_CURSOR_INFO */
XC_pirate, /* GLUT_CURSOR_DESTROY */
XC_question_arrow, /* GLUT_CURSOR_HELP */
XC_exchange, /* GLUT_CURSOR_CYCLE */
XC_spraycan, /* GLUT_CURSOR_SPRAY */
XC_watch, /* GLUT_CURSOR_WAIT */
XC_xterm, /* GLUT_CURSOR_TEXT */
XC_crosshair, /* GLUT_CURSOR_CROSSHAIR */
XC_sb_v_double_arrow, /* GLUT_CURSOR_UP_DOWN */
XC_sb_h_double_arrow, /* GLUT_CURSOR_LEFT_RIGHT */
XC_top_side, /* GLUT_CURSOR_TOP_SIDE */
XC_bottom_side, /* GLUT_CURSOR_BOTTOM_SIDE */
XC_left_side, /* GLUT_CURSOR_LEFT_SIDE */
XC_right_side, /* GLUT_CURSOR_RIGHT_SIDE */
XC_top_left_corner, /* GLUT_CURSOR_TOP_LEFT_CORNER */
XC_top_right_corner, /* GLUT_CURSOR_TOP_RIGHT_CORNER */
XC_bottom_right_corner, /* GLUT_CURSOR_BOTTOM_RIGHT_CORNER */
XC_bottom_left_corner, /* GLUT_CURSOR_BOTTOM_LEFT_CORNER */
};
/***********************************************************
* FUNCTION: glutSetCursor (4.13)
*
* DESCRIPTION: set a new mouse cursor for current window
***********************************************************/
void glutSetCursor(int cursor) {
gState.currentWindow->Window()->Lock();
gState.currentWindow->cursor = cursor;
__glutSetCursor(cursor);
gState.currentWindow->Window()->Unlock();
}
/***********************************************************
* FUNCTION: __glutSetCursor
*
* DESCRIPTION: the actual cursor changing routine
***********************************************************/
void __glutSetCursor(int cursor) {
int realcursor = cursor;
if (cursor < 0 || cursor > GLUT_CURSOR_BOTTOM_LEFT_CORNER) {
switch(cursor) {
case GLUT_CURSOR_INHERIT:
return; // don't change cursor
case GLUT_CURSOR_NONE:
// this hides the cursor until the user moves the mouse
// change it to HideCursor() AT YOUR OWN RISK!
be_app->ObscureCursor();
return;
case GLUT_CURSOR_FULL_CROSSHAIR:
realcursor = GLUT_CURSOR_CROSSHAIR;
break;
default:
__glutWarning("unknown cursor\n");
return;
}
}
be_app->SetCursor(cursorTable[realcursor]);
}
/***********************************************************
* FUNCTION: glutWarpPointer (x.xx)
*
* DESCRIPTION: move the mouse pointer to a new location
* (note: can't do this in BeOS!)
***********************************************************/
void glutWarpPointer(int x, int y) { }

3083
src/glut/beos/glutCursors.h Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,79 @@
/***********************************************************
* Copyright (C) 1997, Be Inc. All rights reserved.
*
* FILE: glutDstr.cpp
*
* DESCRIPTION: convert display string into a Be options variable
***********************************************************/
/***********************************************************
* Headers
***********************************************************/
#include <GL/glut.h>
#include <string.h>
#include <stdlib.h>
#include "glutint.h"
#include "glutState.h"
/***********************************************************
* FUNCTION: glutInitDisplayString
*
* DESCRIPTION: sets the display string variable
***********************************************************/
void APIENTRY
glutInitDisplayString(const char *string)
{
if (gState.displayString) {
free(gState.displayString);
}
if (string) {
gState.displayString = strdup(string);
if (!gState.displayString)
__glutFatalError("out of memory.");
} else
gState.displayString = NULL;
}
/***********************************************************
* FUNCTION: __glutConvertDisplayModeFromString
*
* DESCRIPTION: converts the current display mode into a BGLView
* display mode, printing warnings as appropriate.
*
* PARAMETERS: if options is non-NULL, the current display mode is
* returned in it.
*
* RETURNS: 1 if the current display mode is possible, else 0
***********************************************************/
int __glutConvertDisplayModeFromString(unsigned long *options) {
ulong newoptions = BGL_DOUBLE;
gState.swapHack = true; // assume single buffered
char *word = strtok(gState.displayString, " \t");
do {
char *cstr = strpbrk(word, "=><!~");
if(cstr)
*cstr = '\0';
// this is the most minimal possible parser. scan for
// options that we support, and add them to newoptions
// this will certainly cause it to accept things that we
// don't actually support, but if we don't support it, the
// program's probably not going to work anyway.
if(!strcmp(word, "alpha")) {
newoptions |= BGL_ALPHA;
} else if((!strcmp(word, "acc")) || (!strcmp(word, "acca"))) {
newoptions |= BGL_ACCUM;
} else if(!strcmp(word, "depth")) {
newoptions |= BGL_DEPTH;
} else if(!strcmp(word, "double")) {
gState.swapHack = false;
} else if(!strcmp(word, "stencil")) {
newoptions |= BGL_STENCIL;
}
} while((word = strtok(0, " \t")) != 0);
if (options)
*options = newoptions;
return 1; // assume we support it
}

721
src/glut/beos/glutEvent.cpp Normal file
View File

@@ -0,0 +1,721 @@
/***********************************************************
* Copyright (C) 1997, Be Inc. All rights reserved.
*
* FILE: glutEvent.cpp
*
* DESCRIPTION: here it is, the BeOS GLUT event loop
***********************************************************/
/***********************************************************
* Headers
***********************************************************/
#include <GL/glut.h>
#include "glutint.h"
#include "glutState.h"
#include "glutBlocker.h"
/***********************************************************
* CLASS: GLUTtimer
*
* DESCRIPTION: list of timer callbacks
***********************************************************/
struct GLUTtimer {
GLUTtimer *next; // list of timers
bigtime_t timeout; // time to be called
GLUTtimerCB func; // function to call
int value; // value
};
/***********************************************************
* Private variables
***********************************************************/
static GLUTtimer *__glutTimerList = 0; // list of timer callbacks
static GLUTtimer *freeTimerList = 0;
/***********************************************************
* FUNCTION: glutTimerFunc (7.19)
*
* DESCRIPTION: register a new timer callback
***********************************************************/
void APIENTRY
glutTimerFunc(unsigned int interval, GLUTtimerCB timerFunc, int value)
{
GLUTtimer *timer, *other;
GLUTtimer **prevptr;
if (!timerFunc)
return;
if (freeTimerList) {
timer = freeTimerList;
freeTimerList = timer->next;
} else {
timer = new GLUTtimer();
if (!timer)
__glutFatalError("out of memory.");
}
timer->func = timerFunc;
timer->value = value;
timer->next = NULL;
timer->timeout = system_time() + (interval*1000); // 1000 ticks in a millisecond
prevptr = &__glutTimerList;
other = *prevptr;
while (other && (other->timeout < timer->timeout)) {
prevptr = &other->next;
other = *prevptr;
}
timer->next = other;
*prevptr = timer;
}
/***********************************************************
* FUNCTION: handleTimeouts
*
* DESCRIPTION: private function to handle outstanding timeouts
***********************************************************/
static void
handleTimeouts(void)
{
bigtime_t now;
GLUTtimer *timer;
/* Assumption is that __glutTimerList is already determined
to be non-NULL. */
now = system_time();
while (__glutTimerList->timeout <= now) {
timer = __glutTimerList;
if(gState.currentWindow)
gState.currentWindow->LockGL();
timer->func(timer->value);
if(gState.currentWindow)
gState.currentWindow->UnlockGL();
__glutTimerList = timer->next;
timer->next = freeTimerList;
freeTimerList = timer;
if (!__glutTimerList)
break;
}
}
/***********************************************************
* FUNCTION: processEventsAndTimeouts
*
* DESCRIPTION: clear gBlock, then check all windows for events
***********************************************************/
static void
processEventsAndTimeouts(void)
{
gBlock.WaitEvent(); // if there is already an event, returns
// immediately, otherwise wait forever
gBlock.ClearEvents();
if (gState.currentWindow)
gState.currentWindow->LockGL();
for(int i=0; i<gState.windowListSize; i++) {
if (gState.windowList[i]) {
GlutWindow *win = gState.windowList[i];
win->Window()->Lock();
// NOTE: we can use win as a shortcut for gState.windowList[i]
// in callbacks, EXCEPT we need to check the original variable
// after each callback to make sure the window hasn't been destroyed
if (win->anyevents) {
win->anyevents = false;
if (win->reshapeEvent) {
win->reshapeEvent = false;
__glutSetWindow(win);
win->reshape(win->m_width, win->m_height);
}
if (!gState.windowList[i])
continue; // window was destroyed by callback!
if (win->displayEvent) {
win->displayEvent = false;
__glutSetWindow(win);
win->display();
if (gState.windowList[i] && win->swapHack) {
// fake single buffering by swapping buffers
__glutSetWindow(win);
win->SwapBuffers();
}
}
if (!gState.windowList[i])
continue; // window was destroyed by callback!
if (win->mouseEvent) {
win->mouseEvent = false;
__glutSetWindow(win);
if (win->mouse) {
gState.modifierKeys = win->modifierKeys;
win->mouse(win->button, win->mouseState, win->mouseX, win->mouseY);
gState.modifierKeys = ~0;
}
}
if (!gState.windowList[i])
continue; // window was destroyed by callback!
if (win->menuEvent) {
win->menuEvent = false;
__glutSetWindow(win);
GlutMenu *menu = __glutGetMenuByNum(win->menuNumber);
if (menu) {
gState.currentMenu = menu;
menu->select(win->menuValue);
}
}
if (!gState.windowList[i])
continue; // window was destroyed by callback!
if (win->statusEvent) {
win->statusEvent = false;
__glutSetWindow(win);
if (gState.menuStatus) {
gState.currentMenu = __glutGetMenuByNum(win->menuNumber);
gState.menuStatus(win->menuStatus, win->statusX, win->statusY);
}
}
if (!gState.windowList[i])
continue; // window was destroyed by callback!
if (win->motionEvent) {
win->motionEvent = false;
__glutSetWindow(win);
if (win->motion)
win->motion(win->motionX, win->motionY);
}
if (!gState.windowList[i])
continue; // window was destroyed by callback!
if (win->passiveEvent) {
win->passiveEvent = false;
__glutSetWindow(win);
if (win->passive)
win->passive(win->passiveX, win->passiveY);
}
if (!gState.windowList[i])
continue; // window was destroyed by callback!
if (win->keybEvent) {
win->keybEvent = false;
__glutSetWindow(win);
if (win->keyboard) {
gState.modifierKeys = win->modifierKeys;
win->keyboard(win->key, win->keyX, win->keyY);
gState.modifierKeys = ~0;
}
}
if (!gState.windowList[i])
continue; // window was destroyed by callback!
if (win->specialEvent) {
win->specialEvent = false;
__glutSetWindow(win);
if (win->special) {
gState.modifierKeys = win->modifierKeys;
win->special(win->specialKey, win->specialX, win->specialY);
gState.modifierKeys = ~0;
}
}
if (!gState.windowList[i])
continue; // window was destroyed by callback!
if (win->entryEvent) {
win->entryEvent = false;
__glutSetWindow(win);
if (win->entry)
win->entry(win->entryState);
}
if (!gState.windowList[i])
continue; // window was destroyed by callback!
if (win->visEvent) {
win->visEvent = false;
__glutSetWindow(win);
if (win->visibility)
win->visibility(win->visState);
}
if (!gState.windowList[i])
continue; // window was destroyed by callback!
}
if(gState.windowList[i]) // window hasn't been destroyed
win->Window()->Unlock();
}
}
if (gState.currentWindow)
gState.currentWindow->UnlockGL();
// This code isn't necessary since BGLView automatically traps errors
#if 0
if(gState.debug) {
for(int i=0; i<gState.windowListSize; i++) {
if (gState.windowList[i]) {
gState.windowList[i]->LockGL();
glutReportErrors();
gState.windowList[i]->UnlockGL();
}
}
}
#endif
if (__glutTimerList) {
handleTimeouts();
}
}
/***********************************************************
* FUNCTION: waitForSomething
*
* DESCRIPTION: use gBlock to wait for a new event or timeout
***********************************************************/
static void
waitForSomething(void)
{
bigtime_t timeout = __glutTimerList->timeout;
bigtime_t now = system_time();
if (gBlock.PendingEvent())
goto immediatelyHandleEvent;
if(timeout>now)
gBlock.WaitEvent(timeout-now);
if (gBlock.PendingEvent()) {
immediatelyHandleEvent:
processEventsAndTimeouts();
} else {
if (__glutTimerList)
handleTimeouts();
}
}
/***********************************************************
* FUNCTION: idleWait
*
* DESCRIPTION: check for events, then call idle function
***********************************************************/
static void
idleWait(void)
{
if (gBlock.PendingEvent()) {
processEventsAndTimeouts();
} else {
if (__glutTimerList)
handleTimeouts();
}
/* Make sure idle func still exists! */
if(gState.currentWindow)
gState.currentWindow->LockGL();
if (gState.idle)
gState.idle();
if(gState.currentWindow)
gState.currentWindow->UnlockGL();
}
/***********************************************************
* FUNCTION: glutMainLoop (3.1)
*
* DESCRIPTION: enter the event processing loop
***********************************************************/
void glutMainLoop()
{
if (!gState.windowListSize)
__glutFatalUsage("main loop entered with no windows created.");
if(gState.currentWindow)
gState.currentWindow->UnlockGL();
for (;;) {
if (gState.idle) {
idleWait();
} else {
if (__glutTimerList) {
waitForSomething();
} else {
processEventsAndTimeouts();
}
}
}
}
/***********************************************************
* CLASS: GlutWindow
*
* FUNCTION: KeyDown
*
* DESCRIPTION: handles keyboard and special events
***********************************************************/
void GlutWindow::KeyDown(const char *s, int32 slen)
{
ulong aChar = s[0];
BGLView::KeyDown(s,slen);
BPoint p;
switch (aChar) {
case B_FUNCTION_KEY:
switch(Window()->CurrentMessage()->FindInt32("key")) {
case B_F1_KEY:
aChar = GLUT_KEY_F1;
goto specialLabel;
case B_F2_KEY:
aChar = GLUT_KEY_F2;
goto specialLabel;
case B_F3_KEY:
aChar = GLUT_KEY_F3;
goto specialLabel;
case B_F4_KEY:
aChar = GLUT_KEY_F4;
goto specialLabel;
case B_F5_KEY:
aChar = GLUT_KEY_F5;
goto specialLabel;
case B_F6_KEY:
aChar = GLUT_KEY_F6;
goto specialLabel;
case B_F7_KEY:
aChar = GLUT_KEY_F7;
goto specialLabel;
case B_F8_KEY:
aChar = GLUT_KEY_F8;
goto specialLabel;
case B_F9_KEY:
aChar = GLUT_KEY_F9;
goto specialLabel;
case B_F10_KEY:
aChar = GLUT_KEY_F10;
goto specialLabel;
case B_F11_KEY:
aChar = GLUT_KEY_F11;
goto specialLabel;
case B_F12_KEY:
aChar = GLUT_KEY_F12;
goto specialLabel;
default:
return;
}
case B_LEFT_ARROW:
aChar = GLUT_KEY_LEFT;
goto specialLabel;
case B_UP_ARROW:
aChar = GLUT_KEY_UP;
goto specialLabel;
case B_RIGHT_ARROW:
aChar = GLUT_KEY_RIGHT;
goto specialLabel;
case B_DOWN_ARROW:
aChar = GLUT_KEY_DOWN;
goto specialLabel;
case B_PAGE_UP:
aChar = GLUT_KEY_PAGE_UP;
goto specialLabel;
case B_PAGE_DOWN:
aChar = GLUT_KEY_PAGE_DOWN;
goto specialLabel;
case B_HOME:
aChar = GLUT_KEY_HOME;
goto specialLabel;
case B_END:
aChar = GLUT_KEY_END;
goto specialLabel;
case B_INSERT:
aChar = GLUT_KEY_INSERT;
specialLabel:
if (special) {
anyevents = specialEvent = true;
GetMouse(&p,&m_buttons);
specialKey = aChar;
specialX = (int)p.x;
specialY = (int)p.y;
goto setModifiers; // set the modifier variable
}
return;
default:
break;
}
if (keyboard) {
anyevents = keybEvent = true;
GetMouse(&p,&m_buttons);
key = aChar;
keyX = (int)p.x;
keyY = (int)p.y;
setModifiers:
modifierKeys = 0;
uint32 beMod = Window()->CurrentMessage()->FindInt32("modifiers");
if(beMod & B_SHIFT_KEY)
modifierKeys |= GLUT_ACTIVE_SHIFT;
if(beMod & B_CONTROL_KEY)
modifierKeys |= GLUT_ACTIVE_CTRL;
if(beMod & B_OPTION_KEY) {
// since the window traps B_COMMAND_KEY, we'll have to settle
// for the option key.. but we need to get the raw character,
// not the Unicode-enhanced version
key = Window()->CurrentMessage()->FindInt32("raw_char");
modifierKeys |= GLUT_ACTIVE_ALT;
}
gBlock.NewEvent();
}
}
/***********************************************************
* CLASS: GlutWindow
*
* FUNCTION: MouseDown
*
* DESCRIPTION: handles mouse and menustatus events
***********************************************************/
void GlutWindow::MouseDown(BPoint point)
{
BGLView::MouseDown(point);
MouseCheck();
}
/***********************************************************
* CLASS: GlutWindow
*
* FUNCTION: MouseCheck
*
* DESCRIPTION: checks for button state changes
***********************************************************/
void GlutWindow::MouseCheck()
{
if (mouseEvent)
return; // we already have an outstanding mouse event
BPoint point;
uint32 newButtons;
GetMouse(&point, &newButtons);
if (m_buttons != newButtons) {
if (newButtons&B_PRIMARY_MOUSE_BUTTON && !(m_buttons&B_PRIMARY_MOUSE_BUTTON)) {
button = GLUT_LEFT_BUTTON;
mouseState = GLUT_DOWN;
} else if (m_buttons&B_PRIMARY_MOUSE_BUTTON && !(newButtons&B_PRIMARY_MOUSE_BUTTON)) {
button = GLUT_LEFT_BUTTON;
mouseState = GLUT_UP;
} else if (newButtons&B_SECONDARY_MOUSE_BUTTON && !(m_buttons&B_SECONDARY_MOUSE_BUTTON)) {
button = GLUT_RIGHT_BUTTON;
mouseState = GLUT_DOWN;
} else if (m_buttons&B_SECONDARY_MOUSE_BUTTON && !(newButtons&B_SECONDARY_MOUSE_BUTTON)) {
button = GLUT_RIGHT_BUTTON;
mouseState = GLUT_UP;
} else if (newButtons&B_TERTIARY_MOUSE_BUTTON && !(m_buttons&B_TERTIARY_MOUSE_BUTTON)) {
button = GLUT_MIDDLE_BUTTON;
mouseState = GLUT_DOWN;
} else if (m_buttons&B_TERTIARY_MOUSE_BUTTON && !(newButtons&B_TERTIARY_MOUSE_BUTTON)) {
button = GLUT_MIDDLE_BUTTON;
mouseState = GLUT_UP;
}
} else {
return; // no change, return
}
m_buttons = newButtons;
if (mouseState == GLUT_DOWN) {
BWindow *w = Window();
GlutMenu *m = __glutGetMenuByNum(menu[button]);
if (m) {
if (gState.menuStatus) {
anyevents = statusEvent = true;
menuNumber = menu[button];
menuStatus = GLUT_MENU_IN_USE;
statusX = (int)point.x;
statusY = (int)point.y;
gBlock.NewEvent();
}
BRect bounds = w->Frame();
point.x += bounds.left;
point.y += bounds.top;
GlutPopUp *bmenu = static_cast<GlutPopUp*>(m->CreateBMenu()); // start menu
bmenu->point = point;
bmenu->win = this;
thread_id menu_thread = spawn_thread(MenuThread, "menu thread", B_NORMAL_PRIORITY, bmenu);
resume_thread(menu_thread);
return;
}
}
if (mouse) {
anyevents = mouseEvent = true;
mouseX = (int)point.x;
mouseY = (int)point.y;
modifierKeys = 0;
uint32 beMod = modifiers();
if(beMod & B_SHIFT_KEY)
modifierKeys |= GLUT_ACTIVE_SHIFT;
if(beMod & B_CONTROL_KEY)
modifierKeys |= GLUT_ACTIVE_CTRL;
if(beMod & B_OPTION_KEY) {
modifierKeys |= GLUT_ACTIVE_ALT;
}
gBlock.NewEvent();
}
}
/***********************************************************
* CLASS: GlutWindow
*
* FUNCTION: MouseMoved
*
* DESCRIPTION: handles entry, motion, and passive events
***********************************************************/
void GlutWindow::MouseMoved(BPoint point,
ulong transit, const BMessage *msg)
{
BGLView::MouseMoved(point,transit,msg);
if(transit != B_INSIDE_VIEW) {
if (entry) {
anyevents = entryEvent = true;
gBlock.NewEvent();
}
if (transit == B_ENTERED_VIEW) {
entryState = GLUT_ENTERED;
MakeFocus(); // make me the current focus
__glutSetCursor(cursor);
} else
entryState = GLUT_LEFT;
}
MouseCheck();
if(m_buttons) {
if(motion) {
anyevents = motionEvent = true;
motionX = (int)point.x;
motionY = (int)point.y;
gBlock.NewEvent();
}
} else {
if(passive) {
anyevents = passiveEvent = true;
passiveX = (int)point.x;
passiveY = (int)point.y;
gBlock.NewEvent();
}
}
}
/***********************************************************
* CLASS: GlutWindow
*
* FUNCTION: FrameResized
*
* DESCRIPTION: handles reshape event
***********************************************************/
void GlutWindow::FrameResized(float width, float height)
{
BGLView::FrameResized(width, height);
if (visState == GLUT_VISIBLE) {
anyevents = reshapeEvent = true;
m_width = (int)(width)+1;
m_height = (int)(height)+1;
gBlock.NewEvent();
}
}
/***********************************************************
* CLASS: GlutWindow
*
* FUNCTION: Draw
*
* DESCRIPTION: handles reshape and display events
***********************************************************/
void GlutWindow::Draw(BRect updateRect)
{
BGLView::Draw(updateRect);
BRect frame = Frame();
if (m_width != (frame.Width()+1) || m_height != (frame.Height()+1)) {
FrameResized(frame.Width(), frame.Height());
}
if (visState == GLUT_VISIBLE) {
anyevents = displayEvent = true;
gBlock.NewEvent();
}
}
/***********************************************************
* CLASS: GlutWindow
*
* FUNCTION: Hide
* Show
*
* DESCRIPTION: handles visibility event
***********************************************************/
void GlutWindow::Hide()
{
BGLView::Hide();
if (visibility) {
anyevents = visEvent = true;
visState = GLUT_NOT_VISIBLE;
displayEvent = false; // display callbacks not allowed when hidden
gBlock.NewEvent();
}
}
void GlutWindow::Show()
{
BGLView::Show();
if (visibility) {
anyevents = visEvent = true;
visState = GLUT_VISIBLE;
gBlock.NewEvent();
}
}
/***********************************************************
* CLASS: GlutWindow
*
* FUNCTION: Pulse
*
* DESCRIPTION: handles mouse up event (MouseUp is broken)
***********************************************************/
void GlutWindow::Pulse()
{
BGLView::Pulse();
if (m_buttons) { // if there are buttons pressed
MouseCheck();
}
}
/***********************************************************
* CLASS: GlutWindow
*
* FUNCTION: ErrorCallback
*
* DESCRIPTION: handles GL error messages
***********************************************************/
void GlutWindow::ErrorCallback(GLenum errorCode) {
__glutWarning("GL error: %s", gluErrorString(errorCode));
}
/***********************************************************
* CLASS: GlutWindow
*
* FUNCTION: MenuThread
*
* DESCRIPTION: a new thread to launch popup menu, wait
* wait for response, then clean up afterwards and
* send appropriate messages
***********************************************************/
long GlutWindow::MenuThread(void *m) {
GlutPopUp *bmenu = static_cast<GlutPopUp*>(m);
GlutWindow *win = bmenu->win; // my window
GlutBMenuItem *result = (GlutBMenuItem*)bmenu->Go(bmenu->point);
win->Window()->Lock();
win->anyevents = win->statusEvent = true;
win->menuStatus = GLUT_MENU_NOT_IN_USE;
win->menuNumber = bmenu->menu;
BPoint cursor;
uint32 buttons;
win->GetMouse(&cursor, &buttons);
win->statusX = (int)cursor.x;
win->statusY = (int)cursor.y;
if(result && result->menu) {
win->menuEvent = true;
win->menuNumber = result->menu; // in case it was a submenu
win->menuValue = result->value;
}
win->Window()->Unlock();
gBlock.NewEvent();
delete bmenu;
return 0;
}

240
src/glut/beos/glutGet.cpp Normal file
View File

@@ -0,0 +1,240 @@
/***********************************************************
* Copyright (C) 1997, Be Inc. All rights reserved.
*
* FILE: glutGet.cpp
*
* DESCRIPTION: get state information from GL
***********************************************************/
/***********************************************************
* Headers
***********************************************************/
#include <GL/glut.h>
#include <string.h>
#include <Autolock.h>
#include "glutint.h"
#include "glutState.h"
/***********************************************************
* Global variables
***********************************************************/
// rough guess, since we don't know how big the monitor really is
const float dots_per_mm = (72/25.4); // dots per millimeter
/***********************************************************
* FUNCTION: glutGet (9.1)
*
* DESCRIPTION: retrieve window and GL state
***********************************************************/
int glutGet(GLenum state) {
switch(state) {
case GLUT_WINDOW_X:
{BAutolock winlock(gState.currentWindow->Window()); // need to lock the window
if (gState.currentWindow->parent)
return (int)gState.currentWindow->Frame().left;
else
return (int)gState.currentWindow->Window()->Frame().left;
}
case GLUT_WINDOW_Y:
{BAutolock winlock(gState.currentWindow->Window());
if (gState.currentWindow->parent)
return (int)gState.currentWindow->Frame().top;
else
return (int)gState.currentWindow->Window()->Frame().top;
}
case GLUT_WINDOW_WIDTH:
{BAutolock winlock(gState.currentWindow->Window());
return gState.currentWindow->m_width;
}
case GLUT_WINDOW_HEIGHT:
{BAutolock winlock(gState.currentWindow->Window());
return gState.currentWindow->m_height;
}
case GLUT_WINDOW_PARENT:
{BAutolock winlock(gState.currentWindow->Window());
if(gState.currentWindow->parent)
return gState.currentWindow->parent->num + 1;
else
return 0;
}
case GLUT_WINDOW_NUM_CHILDREN:
{BAutolock winlock(gState.currentWindow->Window());
int num = 0;
GlutWindow *children = gState.currentWindow->children;
while (children) {
num++;
children = children->siblings;
}
return num;
}
case GLUT_WINDOW_BUFFER_SIZE: // best guesses
case GLUT_WINDOW_DEPTH_SIZE:
return 32;
case GLUT_WINDOW_STENCIL_SIZE:
case GLUT_WINDOW_RED_SIZE: // always 24-bit color
case GLUT_WINDOW_GREEN_SIZE:
case GLUT_WINDOW_BLUE_SIZE:
case GLUT_WINDOW_ALPHA_SIZE:
case GLUT_WINDOW_ACCUM_RED_SIZE:
case GLUT_WINDOW_ACCUM_GREEN_SIZE:
case GLUT_WINDOW_ACCUM_BLUE_SIZE:
case GLUT_WINDOW_ACCUM_ALPHA_SIZE:
return 8;
case GLUT_WINDOW_DOUBLEBUFFER: // always double-buffered RGBA
case GLUT_WINDOW_RGBA:
return 1;
case GLUT_WINDOW_COLORMAP_SIZE: // don't support these
case GLUT_WINDOW_NUM_SAMPLES:
case GLUT_WINDOW_STEREO:
return 0;
case GLUT_WINDOW_CURSOR:
return gState.currentWindow->cursor; // don't need to lock window since it won't change
case GLUT_SCREEN_WIDTH:
return (int)(BScreen().Frame().Width()) + 1;
case GLUT_SCREEN_HEIGHT:
return (int)(BScreen().Frame().Height()) + 1;
case GLUT_SCREEN_WIDTH_MM:
return (int)((BScreen().Frame().Width() + 1) / dots_per_mm);
case GLUT_SCREEN_HEIGHT_MM:
return (int)((BScreen().Frame().Height() + 1) / dots_per_mm);
case GLUT_MENU_NUM_ITEMS:
return gState.currentMenu->num;
case GLUT_DISPLAY_MODE_POSSIBLE:
return __glutConvertDisplayMode(0); // returns 1 if possible
case GLUT_INIT_DISPLAY_MODE:
return gState.displayMode;
case GLUT_INIT_WINDOW_X:
return gState.initX;
case GLUT_INIT_WINDOW_Y:
return gState.initY;
case GLUT_INIT_WINDOW_WIDTH:
return gState.initWidth;
case GLUT_INIT_WINDOW_HEIGHT:
return gState.initHeight;
case GLUT_ELAPSED_TIME:
bigtime_t elapsed, beginning, now;
__glutInitTime(&beginning);
now = system_time();
elapsed = now - beginning;
return (int) (elapsed / 1000); // 1000 ticks in a millisecond
default:
__glutWarning("invalid glutGet parameter: %d", state);
return -1;
}
}
/***********************************************************
* FUNCTION: glutLayerGet (9.2)
*
* DESCRIPTION: since we don't support layers, this is easy
***********************************************************/
int glutLayerGet(GLenum info) {
switch(info) {
case GLUT_OVERLAY_POSSIBLE:
case GLUT_HAS_OVERLAY:
return 0;
case GLUT_LAYER_IN_USE:
return GLUT_NORMAL;
case GLUT_TRANSPARENT_INDEX:
return -1;
case GLUT_NORMAL_DAMAGED:
return gState.currentWindow->displayEvent;
case GLUT_OVERLAY_DAMAGED:
return -1;
default:
__glutWarning("invalid glutLayerGet param: %d", info);
return -1;
}
}
/***********************************************************
* FUNCTION: glutDeviceGet (9.3)
*
* DESCRIPTION: get info about I/O devices we support
* easy, since BeOS only supports a keyboard and mouse now
***********************************************************/
int glutDeviceGet(GLenum info) {
switch(info) {
case GLUT_HAS_KEYBOARD:
case GLUT_HAS_MOUSE:
return 1;
case GLUT_HAS_SPACEBALL:
case GLUT_HAS_DIAL_AND_BUTTON_BOX:
case GLUT_HAS_TABLET:
case GLUT_NUM_SPACEBALL_BUTTONS:
case GLUT_NUM_BUTTON_BOX_BUTTONS:
case GLUT_NUM_DIALS:
case GLUT_NUM_TABLET_BUTTONS:
return 0;
case GLUT_NUM_MOUSE_BUTTONS:
{
int32 mouseButtons = 3; // good guess
if(get_mouse_type(&mouseButtons) != B_OK) {
__glutWarning("error getting number of mouse buttons");
}
return mouseButtons;
}
default:
__glutWarning("invalid glutDeviceGet parameter: %d", info);
return -1;
}
}
/***********************************************************
* FUNCTION: glutGetModifiers (9.4)
*
* DESCRIPTION: get the modifier key state for the current window
***********************************************************/
int glutGetModifiers() {
if(gState.modifierKeys == (int) ~0) {
__glutWarning(
"glutCurrentModifiers: do not call outside core input callback.");
return 0;
}
return gState.modifierKeys;
}
/***********************************************************
* FUNCTION: glutExtensionSupported (9.5)
*
* DESCRIPTION: is an OpenGL extension supported (from glut_ext.c)
***********************************************************/
int glutExtensionSupported(const char *extension) {
static const GLubyte *extensions = NULL;
const GLubyte *start;
GLubyte *where, *terminator;
/* Extension names should not have spaces. */
where = (GLubyte *) strchr(extension, ' ');
if (where || *extension == '\0')
return 0;
if (!extensions)
extensions = glGetString(GL_EXTENSIONS);
/* It takes a bit of care to be fool-proof about parsing the
OpenGL extensions string. Don't be fooled by sub-strings,
etc. */
start = extensions;
for (;;) {
where = (GLubyte *) strstr((const char *) start, extension);
if (!where)
break;
terminator = where + strlen(extension);
if (where == start || *(where - 1) == ' ') {
if (*terminator == ' ' || *terminator == '\0') {
return 1;
}
}
start = terminator;
}
return 0;
}

238
src/glut/beos/glutInit.cpp Normal file
View File

@@ -0,0 +1,238 @@
/***********************************************************
* Copyright (C) 1997, Be Inc. All rights reserved.
*
* FILE: glutInit.cpp
*
* DESCRIPTION: initialize GLUT state
***********************************************************/
/***********************************************************
* Headers
***********************************************************/
#include <GL/glut.h>
#include <string.h>
#include <stdlib.h>
#include "glutint.h"
#include "glutState.h"
#include "beos_x11.h"
/***********************************************************
* Global variables
***********************************************************/
GlutState gState;
/***********************************************************
* Private variables
***********************************************************/
static int __glutArgc;
static char **__glutArgv;
/***********************************************************
* FUNCTION: __glutInitTime
*
* DESCRIPTION: set up start time variable
***********************************************************/
void __glutInitTime(bigtime_t *beginning)
{
static int beenhere = 0;
static bigtime_t genesis;
if (!beenhere) {
genesis = system_time();
beenhere = 1;
}
*beginning = genesis;
}
/***********************************************************
* FUNCTION: removeArgs
*
* DESCRIPTION: helper function for glutInit to remove args
* from argv variable passed in
***********************************************************/
static void
removeArgs(int *argcp, char **argv, int numToRemove)
{
int i, j;
for (i = 0, j = numToRemove; argv[j]; i++, j++) {
argv[i] = argv[j];
}
argv[i] = NULL;
*argcp -= numToRemove;
}
/***********************************************************
* FUNCTION: bAppThread
*
* DESCRIPTION: starts the BApplication message loop running
***********************************************************/
static int32 bAppThread(void *arg) {
be_app->Lock();
return be_app->Run();
}
/***********************************************************
* FUNCTION: glutInit (2.1)
*
* DESCRIPTION: create BApplication, parse cmd-line arguments,
* and set up gState structure.
***********************************************************/
void glutInit(int *argcp, char **argv) {
char *str, *geometry = NULL;
int i;
if (gState.display) {
__glutWarning("glutInit being called a second time.");
return;
}
/* Determine temporary program name. */
str = strrchr(argv[0], '/');
if (str == NULL) {
gState.programName = argv[0];
} else {
gState.programName = str + 1;
}
/* Make private copy of command line arguments. */
__glutArgc = *argcp;
__glutArgv = (char **) malloc(__glutArgc * sizeof(char *));
if (!__glutArgv)
__glutFatalError("out of memory.");
for (i = 0; i < __glutArgc; i++) {
__glutArgv[i] = strdup(argv[i]);
if (!__glutArgv[i])
__glutFatalError("out of memory.");
}
/* determine permanent program name */
str = strrchr(__glutArgv[0], '/');
if (str == NULL) {
gState.programName = __glutArgv[0];
} else {
gState.programName = str + 1;
}
/* parse arguments for standard options */
for (i = 1; i < __glutArgc; i++) {
if (!strcmp(__glutArgv[i], "-display")) {
__glutWarning("-display option only valid for X glut.");
if (++i >= __glutArgc) {
__glutFatalError(
"follow -display option with X display name.");
}
removeArgs(argcp, &argv[1], 2);
} else if (!strcmp(__glutArgv[i], "-geometry")) {
if (++i >= __glutArgc) {
__glutFatalError(
"follow -geometry option with geometry parameter.");
}
geometry = __glutArgv[i];
removeArgs(argcp, &argv[1], 2);
} else if (!strcmp(__glutArgv[i], "-direct")) {
__glutWarning("-direct option only valid for X glut.");
removeArgs(argcp, &argv[1], 1);
} else if (!strcmp(__glutArgv[i], "-indirect")) {
__glutWarning("-indirect option only valid for X glut.");
removeArgs(argcp, &argv[1], 1);
} else if (!strcmp(__glutArgv[i], "-iconic")) {
__glutWarning("-iconic option doesn't make sense in BeOS.");
removeArgs(argcp, &argv[1], 1);
} else if (!strcmp(__glutArgv[i], "-gldebug")) {
gState.debug = true;
removeArgs(argcp, &argv[1], 1);
} else if (!strcmp(__glutArgv[i], "-sync")) {
__glutWarning("-sync option only valid for X glut.");
removeArgs(argcp, &argv[1], 1);
} else {
/* Once unknown option encountered, stop command line
processing. */
break;
}
}
__glutInit(); /* Create BApplication first so DisplayWidth() works */
if (geometry) {
int flags, x, y, width, height;
/* Fix bogus "{width|height} may be used before set"
warning */
width = 0;
height = 0;
flags = XParseGeometry(geometry, &x, &y,
(unsigned int *) &width, (unsigned int *) &height);
if (WidthValue & flags) {
/* Careful because X does not allow zero or negative
width windows */
if (width > 0)
gState.initWidth = width;
}
if (HeightValue & flags) {
/* Careful because X does not allow zero or negative
height windows */
if (height > 0)
gState.initHeight = height;
}
if (XValue & flags) {
if (XNegative & flags)
x = DisplayWidth() + x - gState.initWidth;
/* Play safe: reject negative X locations */
if (x >= 0)
gState.initX = x;
}
if (YValue & flags) {
if (YNegative & flags)
y = DisplayHeight() + y - gState.initHeight;
/* Play safe: reject negative Y locations */
if (y >= 0)
gState.initY = y;
}
}
}
/***********************************************************
* FUNCTION: __glutInit
*
* DESCRIPTION: create BApplication, parse cmd-line arguments,
* and set up gState structure.
***********************************************************/
void __glutInit() {
// open BApplication
gState.display = new BApplication("application/x-glut-demo");
be_app->Unlock();
thread_id appthread = spawn_thread(bAppThread, "BApplication", B_NORMAL_PRIORITY, 0);
resume_thread(appthread);
bigtime_t unused;
__glutInitTime(&unused);
}
/***********************************************************
* FUNCTION: glutInitWindowPosition (2.2)
*
* DESCRIPTION: set initial window position
***********************************************************/
void glutInitWindowPosition(int x, int y) {
gState.initX = x;
gState.initY = y;
}
/***********************************************************
* FUNCTION: glutInitWindowSize (2.2)
*
* DESCRIPTION: set initial window size
***********************************************************/
void glutInitWindowSize(int width, int height) {
gState.initWidth = width;
gState.initHeight = height;
}
/***********************************************************
* FUNCTION: glutInitDisplayMode (2.3)
*
* DESCRIPTION: set initial display mode
***********************************************************/
void glutInitDisplayMode(unsigned int mode) {
gState.displayMode = mode;
}

322
src/glut/beos/glutMenu.cpp Normal file
View File

@@ -0,0 +1,322 @@
/***********************************************************
* Copyright (C) 1997, Be Inc. All rights reserved.
*
* FILE: glutMenu.cpp
*
* DESCRIPTION: code for popup menu handling
***********************************************************/
/***********************************************************
* Headers
***********************************************************/
#include <GL/glut.h>
#include <stdlib.h>
#include <string.h>
#include "glutint.h"
#include "glutState.h"
/***********************************************************
* Private variables
***********************************************************/
static GlutMenu **menuList = 0;
static int menuListSize = 0;
/***********************************************************
* FUNCTION: getUnusedMenuSlot
*
* DESCRIPTION: helper function to get a new menu slot
***********************************************************/
GlutMenu *__glutGetMenuByNum(int menunum)
{
if (menunum < 1 || menunum > menuListSize) {
return NULL;
}
return menuList[menunum - 1];
}
/***********************************************************
* FUNCTION: getUnusedMenuSlot
*
* DESCRIPTION: helper function to get a new menu slot
***********************************************************/
static int
getUnusedMenuSlot(void)
{
int i;
/* Look for allocated, unused slot. */
for (i = 0; i < menuListSize; i++) {
if (!menuList[i]) {
return i;
}
}
/* Allocate a new slot. */
menuListSize++;
menuList = (GlutMenu **)
realloc(menuList, menuListSize * sizeof(GlutMenu *));
if (!menuList)
__glutFatalError("out of memory.");
menuList[menuListSize - 1] = NULL;
return menuListSize - 1;
}
/***********************************************************
* FUNCTION: glutCreateMenu (6.1)
*
* DESCRIPTION: create a new menu
***********************************************************/
int APIENTRY
glutCreateMenu(GLUTselectCB selectFunc)
{
GlutMenu *menu;
int menuid;
menuid = getUnusedMenuSlot();
menu = new GlutMenu(menuid, selectFunc); // constructor sets up members
menuList[menuid] = menu;
gState.currentMenu = menu;
return menuid + 1;
}
/***********************************************************
* FUNCTION: glutSetMenu (6.2)
* glutGetMenu
*
* DESCRIPTION: set and get the current menu
***********************************************************/
int APIENTRY
glutGetMenu(void)
{
if (gState.currentMenu) {
return gState.currentMenu->id + 1;
} else {
return 0;
}
}
void APIENTRY
glutSetMenu(int menuid)
{
GlutMenu *menu;
if (menuid < 1 || menuid > menuListSize) {
__glutWarning("glutSetMenu attempted on bogus menu.");
return;
}
menu = menuList[menuid - 1];
if (!menu) {
__glutWarning("glutSetMenu attempted on bogus menu.");
return;
}
gState.currentMenu = menu;
}
/***********************************************************
* FUNCTION: glutDestroyMenu (6.3)
*
* DESCRIPTION: destroy the specified menu
***********************************************************/
void APIENTRY
glutDestroyMenu(int menunum)
{
GlutMenu *menu = __glutGetMenuByNum(menunum);
menuList[menunum - 1] = 0;
if (gState.currentMenu == menu) {
gState.currentMenu = 0;
}
delete menu;
}
/***********************************************************
* FUNCTION: glutAddMenuEntry (6.4)
*
* DESCRIPTION: add a new menu item
***********************************************************/
void
glutAddMenuEntry(const char *label, int value)
{
new GlutMenuItem(gState.currentMenu, false, value, label);
}
/***********************************************************
* FUNCTION: glutAddSubMenu (6.5)
*
* DESCRIPTION: add a new submenu
***********************************************************/
void
glutAddSubMenu(const char *label, int menu)
{
new GlutMenuItem(gState.currentMenu, true, menu-1, label);
}
/***********************************************************
* FUNCTION: glutChangeToMenuEntry (6.6)
*
* DESCRIPTION: change menuitem into a menu entry
***********************************************************/
void
glutChangeToMenuEntry(int num, const char *label, int value)
{
GlutMenuItem *item;
int i;
i = gState.currentMenu->num;
item = gState.currentMenu->list;
while (item) {
if (i == num) {
free(item->label);
item->label = strdup(label);
item->isTrigger = false;
item->value = value;
return;
}
i--;
item = item->next;
}
__glutWarning("Current menu has no %d item.", num);
}
/***********************************************************
* FUNCTION: glutChangeToSubMenu (6.7)
*
* DESCRIPTION: change menuitem into a submenu
***********************************************************/
void
glutChangeToSubMenu(int num, const char *label, int menu)
{
GlutMenuItem *item;
int i;
i = gState.currentMenu->num;
item = gState.currentMenu->list;
while (item) {
if (i == num) {
free(item->label);
item->label = strdup(label);
item->isTrigger = true;
item->value = menu-1;
return;
}
i--;
item = item->next;
}
__glutWarning("Current menu has no %d item.", num);
}
/***********************************************************
* FUNCTION: glutRemoveMenuItem (6.8)
*
* DESCRIPTION: remove a menu item
***********************************************************/
void
glutRemoveMenuItem(int num)
{
GlutMenuItem *item, **prev;
int i;
i = gState.currentMenu->num;
prev = &gState.currentMenu->list;
item = gState.currentMenu->list;
while (item) {
if (i == num) {
gState.currentMenu->num--;
/* Patch up menu's item list. */
*prev = item->next;
free(item->label);
delete item;
return;
}
i--;
prev = &item->next;
item = item->next;
}
__glutWarning("Current menu has no %d item.", num);
}
/***********************************************************
* FUNCTION: glutAttachMenu (6.9)
* glutDetachMenu
*
* DESCRIPTION: attach and detach menu from view
***********************************************************/
void
glutAttachMenu(int button)
{
gState.currentWindow->menu[button] = gState.currentMenu->id + 1;
}
void
glutDetachMenu(int button)
{
gState.currentWindow->menu[button] = 0;
}
/***********************************************************
* CLASS: GlutMenu
*
* FUNCTION: CreateBMenu
*
* DESCRIPTION: construct a BPopupMenu for this menu
***********************************************************/
BMenu *GlutMenu::CreateBMenu(bool toplevel) {
BMenu *bpopup;
if(toplevel) {
bpopup = new GlutPopUp(id+1);
} else {
bpopup = new BMenu("");
}
GlutMenuItem *item = list;
while (item) {
GlutBMenuItem *bitem;
if(item->isTrigger) {
// recursively call CreateBMenu
bitem = new GlutBMenuItem(menuList[item->value]->CreateBMenu(false));
bitem->SetLabel(item->label);
bitem->menu = 0; // real menu items start at 1
bitem->value = 0;
} else {
bitem = new GlutBMenuItem(item->label);
bitem->menu = id + 1;
bitem->value = item->value;
}
bpopup->AddItem(bitem, 0);
item = item->next;
}
return bpopup;
}
/***********************************************************
* CLASS: GlutMenu
*
* FUNCTION: (destructor)
*
* DESCRIPTION: destroy the menu and its items (but not submenus!)
***********************************************************/
GlutMenu::~GlutMenu() {
while (list) {
GlutMenuItem *next = list->next;
delete list;
list = next;
}
}
/***********************************************************
* CLASS: GlutMenuItem
*
* FUNCTION: (constructor)
*
* DESCRIPTION: construct the new menu item and add to parent
***********************************************************/
GlutMenuItem::GlutMenuItem(GlutMenu *n_menu, bool n_trig, int n_value, const char *n_label)
{
menu = n_menu;
isTrigger = n_trig;
value = n_value;
label = strdup(n_label);
next = menu->list;
menu->list = this;
menu->num++;
}

79
src/glut/beos/glutMenu.h Normal file
View File

@@ -0,0 +1,79 @@
/***********************************************************
* Copyright (C) 1997, Be Inc. All rights reserved.
*
* FILE: glutMenu.h
*
* DESCRIPTION: the GlutMenu class is a simple popup menu
***********************************************************/
/***********************************************************
* Headers
***********************************************************/
#include <GL/glut.h>
#include <Menu.h>
#include <MenuItem.h>
/***********************************************************
* Definitions
***********************************************************/
const int32 MENU_ITEM = 'menu';
/***********************************************************
* CLASS: GlutMenu
***********************************************************/
class GlutMenuItem;
class GlutPopUp;
class GlutMenu {
public:
GlutMenu(int n_id, GLUTselectCB n_select) {
id = n_id;
select = n_select;
list = 0;
num = 0;
}
~GlutMenu();
BMenu *CreateBMenu(bool toplevel=true); // construct BPopUpMenu
// public data
int id;
GLUTselectCB select; // callback function
GlutMenuItem *list; // list of menu items
int num; // number of items
};
/***********************************************************
* CLASS: GlutMenuItem
***********************************************************/
class GlutMenuItem {
public:
GlutMenuItem(GlutMenu *n_menu, bool n_trig, int n_value, const char *n_label);
// public data
GlutMenu *menu; // parent menu
bool isTrigger; // are we a submenu?
int value; // value to send, or submenu id if isTrigger
char *label; // strdup'ed label string
GlutMenuItem *next; // next menu entry on list
};
/***********************************************************
* CLASS: GlutPopUp
***********************************************************/
class GlutPopUp : public BPopUpMenu {
public:
GlutPopUp(int m) : BPopUpMenu(0, false, false) { menu = m;}
BPoint point; // point to start menu
GlutWindow *win; // pointer to my window
int menu; // my menu number
};
/***********************************************************
* CLASS: GlutBMenuItem
***********************************************************/
class GlutBMenuItem : public BMenuItem {
public:
GlutBMenuItem(const char *name) : BMenuItem(name, 0) {}
GlutBMenuItem(BMenu* menu) : BMenuItem(menu) {}
int menu, value;
};

View File

@@ -0,0 +1,38 @@
/***********************************************************
* Copyright (C) 1997, Be Inc. All rights reserved.
*
* FILE: glutOverlay.cpp
*
* DESCRIPTION: we don't support overlays, so this code is
* really simple
***********************************************************/
/***********************************************************
* Headers
***********************************************************/
#include <GL/glut.h>
#include "glutint.h"
void glutEstablishOverlay() {
__glutFatalError("BeOS lacks overlay support.");
}
void glutUseLayer(GLenum layer) {
// ignore
}
void glutRemoveOverlay() {
// ignore
}
void glutPostOverlayRedisplay() {
// ignore
}
void glutShowOverlay() {
// ignore
}
void glutHideOverlay() {
// ignore
}

65
src/glut/beos/glutState.h Normal file
View File

@@ -0,0 +1,65 @@
/***********************************************************
* Copyright (C) 1997, Be Inc. All rights reserved.
*
* FILE: glutState.h
*
* DESCRIPTION: the global state for GLUT
* (takes the place of glutint.h in the C version)
***********************************************************/
/***********************************************************
* Headers
***********************************************************/
#include <GL/glut.h>
#include <Application.h>
#include "glutWindow.h"
#include "glutMenu.h"
/***********************************************************
* CLASS: GlutState
*
* DESCRIPTION: all the global state variables
***********************************************************/
struct GlutState {
BApplication *display;
char *programName; // used in error messages
int initX, initY; // initial window position
int initWidth, initHeight; // initial window size
unsigned int displayMode; // initial display mode
char *displayString; // verbose display mode
GlutWindow *currentWindow; // current window
GlutMenu *currentMenu; // current menu
GlutWindow **windowList; // array of pointers to windows
int windowListSize; // size of window list
GLUTidleCB idle; // idle callback
GLUTmenuStatusCB menuStatus; // menu status callback
int modifierKeys; // only valid during keyboard callback
bool debug; // call glGetError
bool swapHack;
GlutState() {
display = 0;
programName = 0;
initX = initY = -1;
initWidth = initHeight = 300;
displayMode = GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH;
displayString = 0;
currentWindow = 0;
currentMenu = 0;
windowList = 0;
windowListSize = 0;
idle = 0;
menuStatus = 0;
modifierKeys = ~0;
debug = swapHack = false;
}
};
/***********************************************************
* Global variable (declared in glutInit.cpp)
***********************************************************/
extern GlutState gState;

Some files were not shown because too many files have changed in this diff Show More