Remove demos that have moved to git+ssh://git.freedesktop.org/git/mesa/demos.

The remaining programs are ones I've had difficulty finding a build
environment for to make the build system or are unit tests that should
probably live next to their code instead.  Hopefully people can bring
over the build for remaining pieces they care about.
This commit is contained in:
Eric Anholt
2010-05-21 09:32:38 -07:00
parent e4f4489e3f
commit 68fc4b415e
873 changed files with 2 additions and 947072 deletions
+2 -18
View File
@@ -524,12 +524,7 @@ dnl If $with_demos is yes, directories will be added as libs available
PROGRAM_DIRS=""
case "$with_demos" in
no) ;;
yes)
# If the driver isn't osmesa, we have libGL and can build xdemos
if test "$mesa_driver" != osmesa; then
PROGRAM_DIRS="xdemos"
fi
;;
yes) ;;
*)
# verify the requested demos directories exist
demos=`IFS=,; echo $with_demos`
@@ -1026,7 +1021,7 @@ if test "x$enable_egl" = xyes; then
fi
if test "$with_demos" = yes; then
PROGRAM_DIRS="$PROGRAM_DIRS egl/eglut egl/opengl"
PROGRAM_DIRS="$PROGRAM_DIRS egl/eglut"
fi
fi
AC_SUBST([EGL_LIB_DEPS])
@@ -1045,12 +1040,6 @@ if test "x$enable_glu" = xyes; then
case "$mesa_driver" in
osmesa)
# If GLU is available and we have libOSMesa (not 16 or 32),
# we can build the osdemos
if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
fi
# Link libGLU to libOSMesa instead of libGL
GLU_LIB_DEPS=""
GLU_PC_REQ="osmesa"
@@ -1201,11 +1190,6 @@ if test "x$enable_glut" = xyes; then
GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
# If glut is available, we can build most programs
if test "$with_demos" = yes; then
PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
fi
# If static, empty GLUT_LIB_DEPS and add libs for programs to link
if test "$enable_static" = no; then
GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
-68
View File
@@ -1,68 +0,0 @@
arbfplight
arbfslight
arbocclude
arbocclude2
bounce
clearspd
copypix
cubemap
dinoshade
dissolve
drawpix
engine
extfuncs.h
fbo_firecube
fbotexture
fire
fogcoord
fplight
fslight
gamma
gearbox
gears
geartrain
glinfo
gloss
glslnoise
gltestperf
glutfx
ipers
isosurf
lodbias
morph3d
multiarb
paltex
pointblast
projtex
rain
ray
readpix
readtex.c
readtex.h
reflect
renormal
shadowtex
showbuffer.c
showbuffer.h
singlebuffer
spectex
spriteblast
stex3d
streaming_rect
teapot
terrain
tessdemo
texcyl
texdown
texenv
texobj
textures
trackball.c
trackball.h
trispd
tunnel
tunnel2
vao_demo
Windows
winpos
*.rgb
-173
View File
@@ -1,173 +0,0 @@
# progs/demos/Makefile
TOP = ../..
include $(TOP)/configs/current
INCDIR = $(TOP)/include
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) \
$(APP_LIB_DEPS)
PROGS = \
arbfplight \
arbfslight \
arbocclude \
arbocclude2 \
bounce \
clearspd \
copypix \
cubemap \
dinoshade \
dissolve \
drawpix \
engine \
fbo_firecube \
fbotexture \
fire \
fogcoord \
fplight \
fslight \
gamma \
gearbox \
gears \
geartrain \
glinfo \
gloss \
gltestperf \
isosurf \
ipers \
lodbias \
morph3d \
multiarb \
paltex \
pointblast \
projtex \
rain \
ray \
readpix \
reflect \
renormal \
shadowtex \
singlebuffer \
spectex \
spriteblast \
stex3d \
teapot \
terrain \
tessdemo \
texcyl \
texenv \
textures \
trispd \
tunnel \
tunnel2 \
vao_demo \
winpos
##### RULES #####
.SUFFIXES:
.SUFFIXES: .c
.SUFFIXES: .cxx
# make executable from .c file:
.c: $(LIB_DEP) readtex.o
$(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) $< readtex.o $(LIBS) -o $@
##### TARGETS #####
default: $(PROGS)
$(PROGS): readtex.o
readtex.c: $(TOP)/progs/util/readtex.c
cp $< .
readtex.h: $(TOP)/progs/util/readtex.h
cp $< .
readtex.o: readtex.c readtex.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) readtex.c
showbuffer.c: $(TOP)/progs/util/showbuffer.c
cp $< .
showbuffer.h: $(TOP)/progs/util/showbuffer.h
cp $< .
showbuffer.o: showbuffer.c showbuffer.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) showbuffer.c
trackball.c: $(TOP)/progs/util/trackball.c
cp $< .
trackball.h: $(TOP)/progs/util/trackball.h
cp $< .
trackball.o: trackball.c trackball.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) trackball.c
extfuncs.h: $(TOP)/progs/util/extfuncs.h
cp $< .
reflect: reflect.o showbuffer.o readtex.o
$(APP_CC) $(CFLAGS) $(LDFLAGS) reflect.o showbuffer.o readtex.o $(LIBS) -o $@
reflect.o: reflect.c showbuffer.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) reflect.c
gloss: gloss.o trackball.o readtex.o
$(APP_CC) $(CFLAGS) $(LDFLAGS) gloss.o trackball.o readtex.o $(LIBS) -o $@
gloss.o: gloss.c trackball.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) gloss.c
engine: engine.o trackball.o readtex.o
$(APP_CC) $(CFLAGS) $(LDFLAGS) engine.o trackball.o readtex.o $(LIBS) -o $@
engine.o: engine.c trackball.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) engine.c
fbotexture: fbotexture.o
$(APP_CC) $(CFLAGS) $(LDFLAGS) fbotexture.o $(LIBS) -o $@
fbotexture.o: fbotexture.c extfuncs.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) fbotexture.c
fslight: fslight.o
$(APP_CC) $(CFLAGS) $(LDFLAGS) fslight.o $(LIBS) -o $@
fslight.o: fslight.c extfuncs.h
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) fslight.c
rain: particles.o rain.o readtex.o
$(CXX) $(CXXFLAGS) $(LDFLAGS) $^ $(LIBS) -o $@
rain.o: rain.cxx readtex.h
$(CXX) -c -I$(INCDIR) $(CXXFLAGS) $<
particles.o: particles.cxx
$(CXX) -c -I$(INCDIR) $(CXXFLAGS) $<
viewdds: viewdds.c
$(CC) -I$(INCDIR) $(CFLAGS) $< readtex.o $(LIBS) -L. -lgltc -o $@
clean:
-rm -f $(PROGS)
-rm -f *.o *~
-rm -f readtex.[ch] showbuffer.[ch]
-87
View File
@@ -1,87 +0,0 @@
# Mesa 3-D graphics library
# Version: 3.3
# Copyright (C) 1995-2000 Brian Paul
# Makefile for demo programs for cygnus
# Stephane Rehel (rehel@worldnet.fr) April 13 1997
##### MACROS #####
INCDIR = ../include
LIBDIR = ../lib
GL_LIBS = -L$(LIBDIR) -lglut -lMesaGLU -lMesaGL -lm $(WLIBS)
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)
PROGS = bounce \
clearspd \
cubemap \
drawpix \
fire \
gamma \
gears \
geartrain \
glinfo \
gloss \
gltestperf \
glutfx \
isosurf \
ipers \
lodbias \
morph3d \
multiarb \
occlude \
osdemo \
paltex \
pixeltex \
pointblast \
ray \
readpix \
reflect \
renormal \
spectex \
stex3d \
teapot \
terrain \
tessdemo \
texcyl \
texdown \
texenv \
texobj \
trispd \
tunnel \
tunnel2 \
winpos
##### RULES #####
.SUFFIXES:
.SUFFIXES: .c
.c: $(LIB_DEP)
$(CC) -I$(INCDIR) -I../util $(CFLAGS) $< $(GL_LIBS) -o $@
##### TARGETS #####
default:
@echo "Specify a target configuration"
clean:
-rm *.o *~
realclean:
-rm $(PROGS:=.exe)
-rm *.o *~
targets: $(PROGS)
include ../Make-config
-131
View File
@@ -1,131 +0,0 @@
# Mesa 3-D graphics library
# Version: 6.5
# Copyright (C) 1995-2006 Brian Paul
# Makefile for GLUT-based demo programs for Windows
# Build the Mesa and GLUT libraries by using the Visual Studio
# Workspaces in this distribution before running this Makefile.
# Invocation: nmake -f Makefile.win
NODEBUG=1
!include <win32.mak>
##### MACROS #####
TOP = ..\..
INCDIR = ..\..\include
LIBDIR = ..\..\lib
LIBS = GLUT32.LIB OPENGL32.LIB
all: OPENGL32.DLL GLU32.DLL GLUT32.DLL \
readtex.h readtex.c showbuffer.h showbuffer.c \
extfuncs.h trackball.h trackball.c \
arbfplight.exe arbfslight.exe arbocclude.exe bounce.exe \
clearspd.exe cubemap.exe drawpix.exe engine.exe \
fire.exe fogcoord.exe \
fplight.exe fslight.exe gamma.exe gearbox.exe \
gears.exe geartrain.exe gloss.exe \
glinfo.exe glslnoise.exe \
gltestperf.exe glutfx.exe ipers.exe isosurf.exe lodbias.exe \
morph3d.exe multiarb.exe occlude.exe paltex.exe pointblast.exe \
ray.exe readpix.exe reflect.exe renormal.exe \
shadowtex.exe singlebuffer.exe spectex.exe spriteblast.exe \
stex3d.exe teapot.exe terrain.exe tessdemo.exe texcyl.exe \
texdown.exe texenv.exe texobj.exe trispd.exe tunnel.exe tunnel2.exe \
winpos.exe
arbfplight.exe: arbfplight.obj
arbfslight.exe: arbfslight.obj
arbocclude.exe: arbocclude.obj
bounce.exe: bounce.obj
clearspd.exe: clearspd.obj
cubemap.exe: cubemap.obj readtex.obj
drawpix.exe: drawpix.obj readtex.obj
engine.exe: engine.obj readtex.obj trackball.obj
fire.exe: fire.obj readtex.obj
fogcoord.exe: fogcoord.obj readtex.obj
fplight.exe: fplight.obj
fslight.exe: fslight.obj
gamma.exe: gamma.obj
gearbox.exe: gearbox.obj
gears.exe: gears.obj
geartrain.exe: geartrain.obj
gloss.exe: gloss.obj readtex.obj trackball.obj
glinfo.exe: glinfo.obj
glslnoise.exe: glslnoise.obj
gltestperf.exe: gltestperf.obj
glutfx.exe: glutfx.obj
ipers.exe: ipers.obj readtex.obj
isosurf.exe: isosurf.obj readtex.obj
lodbias.exe: lodbias.obj readtex.obj
morph3d.exe: morph3d.obj
multiarb.exe: multiarb.obj readtex.obj
occlude.exe: occlude.obj
paltex.exe: paltex.obj
pointblast.exe: pointblast.obj
ray.exe: ray.obj
readpix.exe: readpix.obj readtex.obj
reflect.exe: reflect.obj readtex.obj showbuffer.obj
renormal.exe: renormal.obj
shadowtex.exe: shadowtex.obj showbuffer.obj
singlebuffer.exe: singlebuffer.obj
spectex.exe: spectex.obj
spriteblast.exe: spriteblast.obj
stex3d.exe: stex3d.obj
teapot.exe: teapot.obj readtex.obj
terrain.exe: terrain.obj
tessdemo.exe: tessdemo.obj
texcyl.exe: texcyl.obj readtex.obj
texdown.exe: texdown.obj
texenv.exe: texenv.obj
texobj.exe: texobj.obj
trispd.exe: trispd.obj
tunnel.exe: tunnel.obj readtex.obj
tunnel2.exe: tunnel2.obj readtex.obj
winpos.exe: winpos.obj readtex.obj
OPENGL32.DLL: $(LIBDIR)\OPENGL32.DLL
copy $? .
GLU32.DLL: $(LIBDIR)\GLU32.DLL
copy $? .
GLUT32.DLL: $(LIBDIR)\GLUT32.DLL
copy $? .
readtex.c: $(TOP)\progs\util\readtex.c
copy $** .
readtex.h: $(TOP)\progs\util\readtex.h
copy $** .
showbuffer.c: $(TOP)\progs\util\showbuffer.c
copy $** .
showbuffer.h: $(TOP)\progs\util\showbuffer.h
copy $** .
trackball.c: $(TOP)\progs\util\trackball.c
copy $** .
trackball.h: $(TOP)\progs\util\trackball.h
copy $** .
extfuncs.h: $(TOP)\progs\util\extfuncs.h
copy $** .
.obj.exe:
$(link) $(ldebug) -out:$@ $** /LIBPATH:$(LIBDIR) $(LIBS)
.c.obj:
$(cc) $(cdebug) $(cflags) $(cvars) -D_USE_MATH_DEFINES /I$(INCDIR) $*.c
clean::
del *.obj *.exe readtex.* showbuffer.* trackball.*
clobber::
-230
View File
@@ -1,230 +0,0 @@
INTRODUCTION
------------
This directory is usually included in the Mesa demos distribution or
in the GLUT distribution.
I have written the demos included in this directory mainly for showing
the capabilities of the Mesa library when using the Voodoo driver.
However all the demos are written using the GLUT and OpenGL so they
work with any GLUT/OpenGL platform (tested: Linux+Mesa+Voodoo driver,
Linux+Mesa+X11 driver, Win95+Mesa+Voodoo driver and SGI Onyx IR thanks
to Mark Kilgard).
All the demos make an heavy use of texture mapping, blending, etc. so
you _need_ some kind of hardware support for the OpenGL otherwise they
will run at ~1fps. You need also a OpenGL 1.1 compliant library.
You can find some screenshot of these demos at
http://www-hmw.caribel.pisa.it/fxmesa/fxdemos.hmtl
Write me if you find some bug in the demos.
David Bucciarelli (tech.hmw@plus.it)
Humanware s.r.l.
Via XXIV Maggio 62
Pisa, Italy
Tel./Fax +39-50-554108
email: info.hmw@plus.it
www: www-hmw.caribel.pisa.it
A BRIEF DESCRIPTION OF THE DEMOS
--------------------------------
IPERS
-----
Sources: ipers.c image.c
A nice spinning fractal object.
RAY
---
Sources: ray.c
I'm using ray tracing to dynamically generate texture maps with
specular, diffuse, shadows, and mirror colors. Each frame the texture
maps of the plane and of the sphere are partially updated. With this
technique you can obtain true mirrors, shadows, specular highlights,
bump mapping, etc. in realtime. This demo is really CPU intensive
(~25fps on a PentiumII@300MHz with a Pure3D). Support on-the-fly
switching between fullscreen and in-window rendering under Linux/Mesa
(start your X server in 16 bpp mode and press the spacebar).
TUNNEL
------
Sources: tunnel.c image.c sources.c
Data: bw.rgb tile.rgb
The model was designed and prelighted with Alias|Wavefront
PowerAnimator V8. Triangle strips were built with a tool written by me
and then statically included in the sources. This demo doesn't
require the ZBuffer and use antialiased polygons. Support on-the-fly
switching between fullscreen and in-window rendering under Linux/Mesa
(start your X server in 16 bpp mode and press the spacebar).
TUNNEL2
------
Sources: tunnel2.c image.c sources.c
Data: bw.rgb tile.rgb
The some tunnel demo but with two output channels. A nice
example of the Mesa/Voodoo support for multiple boards in
the some PC.
TEAPOT
------
Sources: teapot.c image.c dteapot.c shadow.c
Data: bw.rgb tile.rgb
The shadow is drawn projecting the teapot geometry over the plane. All
other light effects are drawn using the standard OpenGL capabilities.
Support on-the-fly switching between fullscreen and in-window
rendering under Linux/Mesa (start your X server in 16 bpp mode and
press the spacebar).
FIRE
----
Sources: fire.c image.c
Data: s128.rgb tree2.rgb
The demo use a small particle system to draw some nice visual effect.
You can interactively change many parameters of the particle system
and you can choose the number of particles at the startup ('fire
4000'). This demo should be called fountain. Support on-the-fly
switching between fullscreen and in-window rendering under Linux/Mesa
(start your X server in 16 bpp mode and press the spacebar).
TERRAIN
-------
Sources: mesaland.c
This demo is base on another demo written by Mikael SkiZoWalker. I
have added the capabilities to freely fly around, view culling and
some nice color. Support on-the-fly switching between fullscreen and
in-window rendering under Linux/Mesa (start your X server in 16 bpp
mode and press the spacebar).
GLTEST
------
Sources: gltest.c
This is a simple benchmark suite that I'm using in the development of
the Mesa/Voodoo driver. Type 'gltest >my.res' and you will get some
data about the performances of your OpenGL. Follow the results with my
PC (Linux+Mesa-2.6+PentiumII@300MHz+Pure3D):
Simple Points
587900.080674 Pnts/sec
Smooth Lines
SIZE=480 => 39007.426183 Lins/sec
SIZE=250 => 74575.016485 Lins/sec
SIZE=100 => 179734.882409 Lins/sec
SIZE=050 => 183987.795297 Lins/sec
SIZE=025 => 183820.086309 Lins/sec
ZSmooth Triangles
SIZE=480 => 784.954997 Tris/sec
SIZE=250 => 2862.325889 Tris/sec
SIZE=100 => 17779.492938 Tris/sec
SIZE=050 => 159339.829844 Tris/sec
SIZE=025 => 428602.984008 Tris/sec
ZSmooth Tex Blend Triangles
SIZE=480 => 784.473931 Tris/sec
SIZE=250 => 2853.781513 Tris/sec
SIZE=100 => 17598.252146 Tris/sec
SIZE=050 => 152632.578337 Tris/sec
SIZE=025 => 377584.760048 Tris/sec
ZSmooth Tex Blend TMesh Triangles
SIZE=400 => 563.900695 Tris/sec, MPixel Fill/sec: 45.112056
SIZE=250 => 1449.777225 Tris/sec, MPixel Fill/sec: 45.305538
SIZE=100 => 8702.869121 Tris/sec, MPixel Fill/sec: 43.514346
SIZE=050 => 31896.867466 Tris/sec, MPixel Fill/sec: 39.871084
SIZE=025 => 114037.262894 Tris/sec, MPixel Fill/sec: 35.636645
SIZE=010 => 220494.235839 Tris/sec, MPixel Fill/sec: 11.024712
SIZE=005 => 225615.506651 Tris/sec, MPixel Fill/sec: 2.820194
SIZE=002 => 225607.681439 Tris/sec, MPixel Fill/sec: 0.451215
Color/Depth Buffer Clears
295.042474 Clrs/sec, MPixel Fill/sec: 90.553256
Follow the results with my
PC (Linux+Mesa-3.0beta5+PentiumII@300MHz+Voodoo2):
Simple Points
1620113.525130 Pnts/sec
Smooth Lines
SIZE=480 => 73841.166065 Lins/sec
SIZE=250 => 140794.035316 Lins/sec
SIZE=100 => 344185.242157 Lins/sec
SIZE=050 => 420399.008289 Lins/sec
SIZE=025 => 420261.389773 Lins/sec
ZSmooth Triangles
SIZE=480 => 1434.668506 Tris/sec
SIZE=250 => 5228.449614 Tris/sec
SIZE=100 => 46603.815842 Tris/sec
SIZE=050 => 325757.045961 Tris/sec
SIZE=025 => 589022.403336 Tris/sec
ZSmooth Tex Blend Triangles
SIZE=480 => 1414.900041 Tris/sec
SIZE=250 => 5006.055235 Tris/sec
SIZE=100 => 43602.252031 Tris/sec
SIZE=050 => 303497.092692 Tris/sec
SIZE=025 => 517087.428669 Tris/sec
ZSmooth Tex Blend TMesh Triangles
SIZE=400 => 1023.273112 Tris/sec, MPixel Fill/sec: 81.861849
SIZE=250 => 2595.692121 Tris/sec, MPixel Fill/sec: 81.115379
SIZE=100 => 15788.198912 Tris/sec, MPixel Fill/sec: 78.940995
SIZE=050 => 58784.121300 Tris/sec, MPixel Fill/sec: 73.480152
SIZE=025 => 244233.873481 Tris/sec, MPixel Fill/sec: 76.323085
SIZE=010 => 474995.004191 Tris/sec, MPixel Fill/sec: 23.749750
SIZE=005 => 475124.354163 Tris/sec, MPixel Fill/sec: 5.939054
SIZE=002 => 474959.089503 Tris/sec, MPixel Fill/sec: 0.949918
Color/Depth Buffer Clears
478.654830 Clrs/sec, MPixel Fill/sec: 146.906826
PALTEX and GLBPALTX
-------------------
Sources: paltex.c and glbpaltx.c
The PALTEX example was written by Brian Paul and it shows the
capabilities of the GL_EXT_paletted_texture extension. I have written
the other example in order to show the capabilities of the
gl3DfxSetPaletteEXT() (it used only by GLQuake and Quake2).
-71
View File
@@ -1,71 +0,0 @@
Import('*')
progs = [
'arbfplight',
'arbfslight',
'arbocclude',
'arbocclude2',
'bounce',
'clearspd',
'copypix',
'cubemap',
'dinoshade',
'dissolve',
'drawpix',
'engine',
'fbo_firecube',
'fbotexture',
'fire',
'fogcoord',
'fplight',
'fslight',
'gamma',
'gearbox',
'gears',
'geartrain',
'glinfo',
'gloss',
'gltestperf',
'ipers',
'isosurf',
'lodbias',
'morph3d',
'multiarb',
'paltex',
'pointblast',
'projtex',
'ray',
'readpix',
'reflect',
'renormal',
'shadowtex',
'singlebuffer',
'spectex',
'spriteblast',
'stex3d',
'teapot',
'terrain',
'tessdemo',
'texcyl',
'texenv',
'textures',
'trispd',
'tunnel',
'tunnel2',
'vao_demo',
'winpos',
]
for prog in progs:
progs_env.Program(
target = prog,
source = prog + '.c',
)
progs_env.Program(
target = 'rain',
source = [
'rain.cxx',
'particles.cxx',
]
)
-101
View File
@@ -1,101 +0,0 @@
# Microsoft Developer Studio Project File - Name="all" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=all - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "all.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "all.mak" CFG="all - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "all - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "all - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "all - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "all - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "all - Win32 Release"
# Name "all - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="bounce" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=bounce - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "bounce.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "bounce.mak" CFG="bounce - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "bounce - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "bounce - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "bounce - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../bounce.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "bounce - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../bounce.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "bounce - Win32 Release"
# Name "bounce - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\bounce.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="clearspd" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=clearspd - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "clearspd.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "clearspd.mak" CFG="clearspd - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "clearspd - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "clearspd - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "clearspd - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../clearspd.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "clearspd - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../clearspd.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "clearspd - Win32 Release"
# Name "clearspd - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\clearspd.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="cubemap" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=cubemap - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "cubemap.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "cubemap.mak" CFG="cubemap - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "cubemap - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "cubemap - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "cubemap - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../cubemap.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "cubemap - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../cubemap.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "cubemap - Win32 Release"
# Name "cubemap - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\cubemap.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-782
View File
@@ -1,782 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "all"=".\all.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name bounce
End Project Dependency
Begin Project Dependency
Project_Dep_Name clearspd
End Project Dependency
Begin Project Dependency
Project_Dep_Name cubemap
End Project Dependency
Begin Project Dependency
Project_Dep_Name drawpix
End Project Dependency
Begin Project Dependency
Project_Dep_Name fire
End Project Dependency
Begin Project Dependency
Project_Dep_Name gears
End Project Dependency
Begin Project Dependency
Project_Dep_Name geartrain
End Project Dependency
Begin Project Dependency
Project_Dep_Name glinfo
End Project Dependency
Begin Project Dependency
Project_Dep_Name gloss
End Project Dependency
Begin Project Dependency
Project_Dep_Name gltestperf
End Project Dependency
Begin Project Dependency
Project_Dep_Name glutfx
End Project Dependency
Begin Project Dependency
Project_Dep_Name ipers
End Project Dependency
Begin Project Dependency
Project_Dep_Name isosurf
End Project Dependency
Begin Project Dependency
Project_Dep_Name lodbias
End Project Dependency
Begin Project Dependency
Project_Dep_Name morph3d
End Project Dependency
Begin Project Dependency
Project_Dep_Name multiarb
End Project Dependency
Begin Project Dependency
Project_Dep_Name occlude
End Project Dependency
Begin Project Dependency
Project_Dep_Name osdemo
End Project Dependency
Begin Project Dependency
Project_Dep_Name paltex
End Project Dependency
Begin Project Dependency
Project_Dep_Name pixeltex
End Project Dependency
Begin Project Dependency
Project_Dep_Name pointblast
End Project Dependency
Begin Project Dependency
Project_Dep_Name rain
End Project Dependency
Begin Project Dependency
Project_Dep_Name ray
End Project Dependency
Begin Project Dependency
Project_Dep_Name readpix
End Project Dependency
Begin Project Dependency
Project_Dep_Name reflect
End Project Dependency
Begin Project Dependency
Project_Dep_Name renormal
End Project Dependency
Begin Project Dependency
Project_Dep_Name shadowtex
End Project Dependency
Begin Project Dependency
Project_Dep_Name spectex
End Project Dependency
Begin Project Dependency
Project_Dep_Name stex3d
End Project Dependency
Begin Project Dependency
Project_Dep_Name teapot
End Project Dependency
Begin Project Dependency
Project_Dep_Name terrain
End Project Dependency
Begin Project Dependency
Project_Dep_Name tessdemo
End Project Dependency
Begin Project Dependency
Project_Dep_Name texcyl
End Project Dependency
Begin Project Dependency
Project_Dep_Name texdown
End Project Dependency
Begin Project Dependency
Project_Dep_Name texenv
End Project Dependency
Begin Project Dependency
Project_Dep_Name texobj
End Project Dependency
Begin Project Dependency
Project_Dep_Name trispd
End Project Dependency
Begin Project Dependency
Project_Dep_Name tunnel
End Project Dependency
Begin Project Dependency
Project_Dep_Name tunnel2
End Project Dependency
Begin Project Dependency
Project_Dep_Name winpos
End Project Dependency
Begin Project Dependency
Project_Dep_Name spriteblast
End Project Dependency
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "bounce"=".\bounce.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "clearspd"=".\clearspd.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "cubemap"=".\cubemap.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "drawpix"=".\drawpix.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "fire"=".\fire.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "gears"=".\gears.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "geartrain"=".\geartrain.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "glinfo"=".\glinfo.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "gloss"=".\gloss.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "gltestperf"=".\gltestperf.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "glut"="..\..\..\src\glut\glx\glut.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "glutfx"=".\glutfx.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "ipers"=".\ipers.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "isosurf"=".\isosurf.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "lodbias"=".\loadbias.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "morph3d"=".\morph3d.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "multiarb"=".\multiarb.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "occlude"=".\occlude.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "osdemo"=".\osdemo.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "paltex"=".\paltex.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "pixeltex"=".\pixeltex.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "pointblast"=".\pointblast.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "rain"=".\rain.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "ray"=".\ray.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "readpix"=".\readpix.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "reflect"=".\reflect.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "renormal"=".\renormal.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "shadowtex"=".\shadowtex.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "spectex"=".\spectex.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "spriteblast"=".\spriteblast.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "stex3d"=".\stex3d.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "teapot"=".\teapot.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "terrain"=".\terrain.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "tessdemo"=".\tessdemo.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "texcyl"=".\texcyl.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "texdown"=".\texdown.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "texenv"=".\texenv.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "texobj"=".\texobj.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "trispd"=".\trispd.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "tunnel"=".\tunnel.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "tunnel2"=".\tunnel2.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Project: "winpos"=".\winpos.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name glut
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="drawpix" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=drawpix - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "drawpix.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "drawpix.mak" CFG="drawpix - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "drawpix - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "drawpix - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "drawpix - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../" /I "../../../include" /I "../../util" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../drawpix.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "drawpix - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../drawpix.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "drawpix - Win32 Release"
# Name "drawpix - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\drawpix.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="fire" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=fire - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "fire.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "fire.mak" CFG="fire - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "fire - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "fire - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "fire - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../fire.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "fire - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../fire.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "fire - Win32 Release"
# Name "fire - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\fire.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="gears" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=gears - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "gears.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "gears.mak" CFG="gears - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "gears - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "gears - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "gears - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../gears.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "gears - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../gears.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "gears - Win32 Release"
# Name "gears - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\gears.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="geartrain" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=geartrain - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "geartrain.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "geartrain.mak" CFG="geartrain - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "geartrain - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "geartrain - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "geartrain - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../geartrain.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "geartrain - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../geartrain.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "geartrain - Win32 Release"
# Name "geartrain - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\geartrain.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="glinfo" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=glinfo - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "glinfo.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "glinfo.mak" CFG="glinfo - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "glinfo - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "glinfo - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "glinfo - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../glinfo.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "glinfo - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../glinfo.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "glinfo - Win32 Release"
# Name "glinfo - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\glinfo.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="gloss" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=gloss - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "gloss.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "gloss.mak" CFG="gloss - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "gloss - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "gloss - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "gloss - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../gloss.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "gloss - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../gloss.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "gloss - Win32 Release"
# Name "gloss - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\gloss.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="gltestperf" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=gltestperf - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "gltestperf.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "gltestperf.mak" CFG="gltestperf - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "gltestperf - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "gltestperf - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "gltestperf - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../gltestperf.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "gltestperf - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../gltestperf.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "gltestperf - Win32 Release"
# Name "gltestperf - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\gltestperf.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="glutfx" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=glutfx - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "glutfx.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "glutfx.mak" CFG="glutfx - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "glutfx - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "glutfx - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "glutfx - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../glutfx.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "glutfx - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../glutfx.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "glutfx - Win32 Release"
# Name "glutfx - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\glutfx.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="ipers" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=ipers - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "ipers.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ipers.mak" CFG="ipers - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ipers - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "ipers - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "ipers - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../ipers.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "ipers - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../ipers.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "ipers - Win32 Release"
# Name "ipers - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\ipers.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="isosurf" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=isosurf - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "isosurf.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "isosurf.mak" CFG="isosurf - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "isosurf - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "isosurf - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "isosurf - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../isosurf.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "isosurf - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../isosurf.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "isosurf - Win32 Release"
# Name "isosurf - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\isosurf.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="lodbias" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=lodbias - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "lodbias.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "lodbias.mak" CFG="lodbias - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "lodbias - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "lodbias - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "lodbias - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../lodbias.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "lodbias - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../lodbias.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "lodbias - Win32 Release"
# Name "lodbias - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\lodbias.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="morph3d" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=morph3d - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "morph3d.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "morph3d.mak" CFG="morph3d - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "morph3d - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "morph3d - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "morph3d - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../morph3d.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "morph3d - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../morph3d.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "morph3d - Win32 Release"
# Name "morph3d - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\morph3d.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="multiarb" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=multiarb - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "multiarb.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "multiarb.mak" CFG="multiarb - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "multiarb - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "multiarb - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "multiarb - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../multiarb.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "multiarb - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../multiarb.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "multiarb - Win32 Release"
# Name "multiarb - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\multiarb.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="occlude" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=occlude - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "occlude.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "occlude.mak" CFG="occlude - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "occlude - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "occlude - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "occlude - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../occlude.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "occlude - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../occlude.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "occlude - Win32 Release"
# Name "occlude - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\occlude.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="osdemo" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=osdemo - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "osdemo.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "osdemo.mak" CFG="osdemo - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "osdemo - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "osdemo - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "osdemo - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB ../../../lib/OSMESA32.LIB /nologo /subsystem:console /machine:I386 /out:"../osdemo.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "osdemo - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB ../../../lib/OSMESA32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../osdemo.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "osdemo - Win32 Release"
# Name "osdemo - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\osdemo.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="paltex" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=paltex - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "paltex.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "paltex.mak" CFG="paltex - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "paltex - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "paltex - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "paltex - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../paltex.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "paltex - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../paltex.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "paltex - Win32 Release"
# Name "paltex - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\paltex.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="pixeltex" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=pixeltex - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "pixeltex.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "pixeltex.mak" CFG="pixeltex - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "pixeltex - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "pixeltex - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "pixeltex - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../pixeltex.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "pixeltex - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../pixeltex.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "pixeltex - Win32 Release"
# Name "pixeltex - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\pixeltex.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="pointblast" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=pointblast - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "pointblast.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "pointblast.mak" CFG="pointblast - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "pointblast - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "pointblast - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "pointblast - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../pointblast.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "pointblast - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../pointblast.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "pointblast - Win32 Release"
# Name "pointblast - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\pointblast.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="rain" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=rain - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "rain.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "rain.mak" CFG="rain - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "rain - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "rain - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "rain - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../rain.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "rain - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../rain.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "rain - Win32 Release"
# Name "rain - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\rain.cxx
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="ray" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=ray - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "ray.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ray.mak" CFG="ray - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "ray - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "ray - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "ray - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../ray.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "ray - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../ray.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "ray - Win32 Release"
# Name "ray - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\ray.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="readpix" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=readpix - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "readpix.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "readpix.mak" CFG="readpix - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "readpix - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "readpix - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "readpix - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../readpix.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "readpix - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../readpix.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "readpix - Win32 Release"
# Name "readpix - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\readpix.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="reflect" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=reflect - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "reflect.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "reflect.mak" CFG="reflect - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "reflect - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "reflect - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "reflect - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../reflect.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "reflect - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../reflect.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "reflect - Win32 Release"
# Name "reflect - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\reflect.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="renormal" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=renormal - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "renormal.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "renormal.mak" CFG="bounce - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "renormal - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "renormal - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "renormal - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../renormal.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "renormal - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../renormal.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "renormal - Win32 Release"
# Name "renormal - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\renormal.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="shadowtex" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=shadowtex - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "shadowtex.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "shadowtex.mak" CFG="bounce - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "shadowtex - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "shadowtex - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "shadowtex - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../shadowtex.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "shadowtex - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../shadowtex.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "shadowtex - Win32 Release"
# Name "shadowtex - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\shadowtex.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="spectex" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=spectex - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "spectex.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "spectex.mak" CFG="bounce - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "spectex - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "spectex - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "spectex - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../spectex.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "spectex - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../spectex.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "spectex - Win32 Release"
# Name "spectex - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\spectex.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="spriteblast" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=spriteblast - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "spriteblast.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "spriteblast.mak" CFG="bounce - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "spriteblast - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "spriteblast - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "spriteblast - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../spriteblast.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "spriteblast - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../spriteblast.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "spriteblast - Win32 Release"
# Name "spriteblast - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\spriteblast.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="stex3d" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=stex3d - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "stex3d.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "stex3d.mak" CFG="bounce - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "stex3d - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "stex3d - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "stex3d - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../stex3d.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "stex3d - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../stex3d.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "stex3d - Win32 Release"
# Name "stex3d - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\stex3d.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="teapot" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=teapot - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "teapot.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "teapot.mak" CFG="gloss - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "teapot - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "teapot - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "teapot - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../teapot.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "teapot - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../teapot.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "teapot - Win32 Release"
# Name "teapot - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\teapot.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="terrain" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=terrain - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "terrain.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "terrain.mak" CFG="bounce - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "terrain - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "terrain - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "terrain - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../terrain.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "terrain - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../terrain.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "terrain - Win32 Release"
# Name "terrain - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\terrain.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="tessdemo" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=tessdemo - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "tessdemo.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "tessdemo.mak" CFG="bounce - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "tessdemo - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "tessdemo - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "tessdemo - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../tessdemo.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "tessdemo - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../tessdemo.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "tessdemo - Win32 Release"
# Name "tessdemo - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\tessdemo.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="texcyl" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=texcyl - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "texcyl.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "texcyl.mak" CFG="gloss - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "texcyl - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "texcyl - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "texcyl - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../texcyl.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "texcyl - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../texcyl.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "texcyl - Win32 Release"
# Name "texcyl - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\texcyl.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="texdown" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=texdown - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "texdown.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "texdown.mak" CFG="bounce - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "texdown - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "texdown - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "texdown - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../texdown.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "texdown - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../texdown.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "texdown - Win32 Release"
# Name "texdown - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\texdown.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="texenv" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=texenv - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "texenv.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "texenv.mak" CFG="bounce - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "texenv - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "texenv - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "texenv - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../texenv.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "texenv - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../texenv.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "texenv - Win32 Release"
# Name "texenv - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\texenv.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="texobj" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=texobj - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "texobj.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "texobj.mak" CFG="bounce - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "texobj - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "texobj - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "texobj - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../texobj.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "texobj - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../texobj.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "texobj - Win32 Release"
# Name "texobj - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\texobj.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="trispd" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=trispd - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "trispd.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "trispd.mak" CFG="bounce - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "trispd - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "trispd - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "trispd - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../trispd.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "trispd - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../trispd.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "trispd - Win32 Release"
# Name "trispd - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\trispd.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="tunnel" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=tunnel - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "tunnel.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "tunnel.mak" CFG="gloss - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "tunnel - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "tunnel - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "tunnel - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../tunnel.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "tunnel - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../tunnel.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "tunnel - Win32 Release"
# Name "tunnel - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\tunnel.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="tunnel2" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=tunnel2 - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "tunnel2.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "tunnel2.mak" CFG="gloss - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "tunnel2 - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "tunnel2 - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "tunnel2 - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../tunnel2.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "tunnel2 - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../tunnel2.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "tunnel2 - Win32 Release"
# Name "tunnel2 - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\tunnel2.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-112
View File
@@ -1,112 +0,0 @@
# Microsoft Developer Studio Project File - Name="winpos" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=winpos - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "winpos.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "winpos.mak" CFG="gloss - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "winpos - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "winpos - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "winpos - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../../util" /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /machine:I386 /out:"../winpos.exe"
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ELSEIF "$(CFG)" == "winpos - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../../util" /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../lib/GLUT32.LIB ../../../lib/GLU32.LIB ../../../lib/OPENGL32.LIB /nologo /subsystem:console /debug /machine:I386 /out:"../winpos.exe" /pdbtype:sept
# Begin Special Build Tool
SOURCE="$(InputPath)"
PostBuild_Desc=Copy DLLs
PostBuild_Cmds=copy ..\..\..\lib\*.dll ..
# End Special Build Tool
!ENDIF
# Begin Target
# Name "winpos - Win32 Release"
# Name "winpos - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\winpos.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project
-404
View File
@@ -1,404 +0,0 @@
/*
* Use GL_ARB_fragment_program and GL_ARB_vertex_program to implement
* simple per-pixel lighting.
*
* Brian Paul
* 17 April 2003
*/
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>
static GLfloat Diffuse[4] = { 0.5, 0.5, 1.0, 1.0 };
static GLfloat Specular[4] = { 0.8, 0.8, 0.8, 1.0 };
static GLfloat LightPos[4] = { 0.0, 10.0, 20.0, 1.0 };
static GLfloat Delta = 1.0;
static GLuint FragProg;
static GLuint VertProg;
static GLboolean Anim = GL_TRUE;
static GLboolean Wire = GL_FALSE;
static GLboolean PixelLight = GL_TRUE;
static GLint Win;
static GLint T0 = 0;
static GLint Frames = 0;
static GLfloat Xrot = 0, Yrot = 0;
static PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB_func;
static PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB_func;
static PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB_func;
static PFNGLGENPROGRAMSARBPROC glGenProgramsARB_func;
static PFNGLPROGRAMSTRINGARBPROC glProgramStringARB_func;
static PFNGLBINDPROGRAMARBPROC glBindProgramARB_func;
static PFNGLISPROGRAMARBPROC glIsProgramARB_func;
static PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB_func;
/* These must match the indexes used in the fragment program */
#define LIGHTPOS 3
/* Set to one to test ARB_fog_linear program option */
#define DO_FRAGMENT_FOG 0
static void normalize (GLfloat *dst, const GLfloat *src)
{
GLfloat len = sqrt (src[0] * src[0] + src[1] * src[1] + src[2] * src[2]);
dst[0] = src[0] / len;
dst[1] = src[1] / len;
dst[2] = src[2] / len;
}
static void Redisplay( void )
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
if (PixelLight) {
GLfloat pos[4];
normalize( pos, LightPos );
pos[3] = LightPos[3];
glProgramLocalParameter4fvARB_func(GL_FRAGMENT_PROGRAM_ARB,
LIGHTPOS, pos);
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glEnable(GL_VERTEX_PROGRAM_ARB);
glDisable(GL_LIGHTING);
}
else {
glLightfv(GL_LIGHT0, GL_POSITION, LightPos);
glDisable(GL_FRAGMENT_PROGRAM_ARB);
glDisable(GL_VERTEX_PROGRAM_ARB);
glEnable(GL_LIGHTING);
}
glPushMatrix();
glRotatef(Xrot, 1, 0, 0);
glRotatef(Yrot, 0, 1, 0);
glutSolidSphere(2.0, 10, 5);
glPopMatrix();
glutSwapBuffers();
Frames++;
if (Anim) {
GLint t = glutGet(GLUT_ELAPSED_TIME);
if (t - T0 >= 5000) {
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
fflush(stdout);
T0 = t;
Frames = 0;
}
}
}
static void Idle(void)
{
LightPos[0] += Delta;
if (LightPos[0] > 25.0)
Delta = -1.0;
else if (LightPos[0] <- 25.0)
Delta = 1.0;
glutPostRedisplay();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -15.0 );
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case ' ':
case 'a':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
case 'x':
LightPos[0] -= 1.0;
break;
case 'X':
LightPos[0] += 1.0;
break;
case 'w':
Wire = !Wire;
if (Wire)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
else
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
break;
case 'p':
PixelLight = !PixelLight;
if (PixelLight) {
printf("Per-pixel lighting\n");
}
else {
printf("Conventional lighting\n");
}
break;
case 27:
glDeleteProgramsARB_func(1, &VertProg);
glDeleteProgramsARB_func(1, &FragProg);
glutDestroyWindow(Win);
exit(0);
break;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
const GLfloat step = 3.0;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
Xrot -= step;
break;
case GLUT_KEY_DOWN:
Xrot += step;
break;
case GLUT_KEY_LEFT:
Yrot -= step;
break;
case GLUT_KEY_RIGHT:
Yrot += step;
break;
}
glutPostRedisplay();
}
/* A helper for finding errors in program strings */
static int FindLine( const char *program, int position )
{
int i, line = 1;
for (i = 0; i < position; i++) {
if (program[i] == '\n')
line++;
}
return line;
}
static void Init( void )
{
GLint errorPos;
/* Yes, this could be expressed more efficiently */
static const char *fragProgramText =
"!!ARBfp1.0\n"
#if DO_FRAGMENT_FOG
"OPTION ARB_fog_linear; \n"
#endif
"PARAM Diffuse = state.material.diffuse; \n"
"PARAM Specular = state.material.specular; \n"
"PARAM LightPos = program.local[3]; \n"
"TEMP normal, len; \n"
"TEMP dotProd, specAtten; \n"
"TEMP diffuseColor, specularColor; \n"
"# Compute normalized normal \n"
"DP3 len.x, fragment.texcoord[0], fragment.texcoord[0]; \n"
"RSQ len.y, len.x; \n"
"MUL normal.xyz, fragment.texcoord[0], len.y; \n"
"# Compute dot product of light direction and normal vector\n"
"DP3_SAT dotProd.x, LightPos, normal; # limited to [0,1]\n"
"MUL diffuseColor.xyz, Diffuse, dotProd.x; # diffuse attenuation\n"
"POW specAtten.x, dotProd.x, {20.0}.x; # specular exponent\n"
"MUL specularColor.xyz, Specular, specAtten.x; # specular attenuation\n"
"MOV result.color.w, Diffuse; \n"
#if DO_FRAGMENT_FOG
"# need to clamp color to [0,1] before fogging \n"
"ADD_SAT result.color.xyz, diffuseColor, specularColor; # add colors\n"
#else
"# clamping will be done after program's finished \n"
"ADD result.color.xyz, diffuseColor, specularColor; # add colors\n"
#endif
"END \n"
;
static const char *vertProgramText =
"!!ARBvp1.0\n"
"ATTRIB pos = vertex.position; \n"
"ATTRIB norm = vertex.normal; \n"
"PARAM modelview[4] = { state.matrix.modelview }; \n"
"PARAM modelviewProj[4] = { state.matrix.mvp }; \n"
"PARAM invModelview[4] = { state.matrix.modelview.invtrans }; \n"
"# typical modelview/projection transform \n"
"DP4 result.position.x, pos, modelviewProj[0]; \n"
"DP4 result.position.y, pos, modelviewProj[1]; \n"
"DP4 result.position.z, pos, modelviewProj[2]; \n"
"DP4 result.position.w, pos, modelviewProj[3]; \n"
"# transform normal by inv transpose of modelview, put in tex0 \n"
"DP3 result.texcoord[0].x, norm, invModelview[0]; \n"
"DP3 result.texcoord[0].y, norm, invModelview[1]; \n"
"DP3 result.texcoord[0].z, norm, invModelview[2]; \n"
"DP3 result.texcoord[0].w, norm, invModelview[3]; \n"
#if DO_FRAGMENT_FOG
"# compute fog coordinate = vertex eye-space Z coord (negated)\n"
"DP4 result.fogcoord, -pos, modelview[2]; \n"
#endif
"END\n";
;
if (!glutExtensionSupported("GL_ARB_vertex_program")) {
printf("Sorry, this demo requires GL_ARB_vertex_program\n");
exit(1);
}
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
printf("Sorry, this demo requires GL_ARB_fragment_program\n");
exit(1);
}
/*
* Get extension function pointers.
*/
glProgramLocalParameter4fvARB_func = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) glutGetProcAddress("glProgramLocalParameter4fvARB");
assert(glProgramLocalParameter4fvARB_func);
glProgramLocalParameter4dARB_func = (PFNGLPROGRAMLOCALPARAMETER4DARBPROC) glutGetProcAddress("glProgramLocalParameter4dARB");
assert(glProgramLocalParameter4dARB_func);
glGetProgramLocalParameterdvARB_func = (PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) glutGetProcAddress("glGetProgramLocalParameterdvARB");
assert(glGetProgramLocalParameterdvARB_func);
glGenProgramsARB_func = (PFNGLGENPROGRAMSARBPROC) glutGetProcAddress("glGenProgramsARB");
assert(glGenProgramsARB_func);
glProgramStringARB_func = (PFNGLPROGRAMSTRINGARBPROC) glutGetProcAddress("glProgramStringARB");
assert(glProgramStringARB_func);
glBindProgramARB_func = (PFNGLBINDPROGRAMARBPROC) glutGetProcAddress("glBindProgramARB");
assert(glBindProgramARB_func);
glIsProgramARB_func = (PFNGLISPROGRAMARBPROC) glutGetProcAddress("glIsProgramARB");
assert(glIsProgramARB_func);
glDeleteProgramsARB_func = (PFNGLDELETEPROGRAMSARBPROC) glutGetProcAddress("glDeleteProgramsARB");
assert(glDeleteProgramsARB_func);
/*
* Fragment program
*/
glGenProgramsARB_func(1, &FragProg);
assert(FragProg > 0);
glBindProgramARB_func(GL_FRAGMENT_PROGRAM_ARB, FragProg);
glProgramStringARB_func(GL_FRAGMENT_PROGRAM_ARB,
GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(fragProgramText),
(const GLubyte *) fragProgramText);
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
if (glGetError() != GL_NO_ERROR || errorPos != -1) {
int l = FindLine(fragProgramText, errorPos);
printf("Fragment Program Error (pos=%d line=%d): %s\n", errorPos, l,
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
exit(0);
}
assert(glIsProgramARB_func(FragProg));
/*
* Do some sanity tests
*/
{
GLdouble v[4];
glProgramLocalParameter4dARB_func(GL_FRAGMENT_PROGRAM_ARB, 8,
10.0, 20.0, 30.0, 40.0);
glGetProgramLocalParameterdvARB_func(GL_FRAGMENT_PROGRAM_ARB, 8, v);
assert(v[0] == 10.0);
assert(v[1] == 20.0);
assert(v[2] == 30.0);
assert(v[3] == 40.0);
}
/*
* Vertex program
*/
glGenProgramsARB_func(1, &VertProg);
assert(VertProg > 0);
glBindProgramARB_func(GL_VERTEX_PROGRAM_ARB, VertProg);
glProgramStringARB_func(GL_VERTEX_PROGRAM_ARB,
GL_PROGRAM_FORMAT_ASCII_ARB,
strlen(vertProgramText),
(const GLubyte *) vertProgramText);
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
if (glGetError() != GL_NO_ERROR || errorPos != -1) {
int l = FindLine(vertProgramText, errorPos);
printf("Vertex Program Error (pos=%d line=%d): %s\n", errorPos, l,
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
exit(0);
}
assert(glIsProgramARB_func(VertProg));
/*
* Misc init
*/
glClearColor(0.3, 0.3, 0.3, 0.0);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, Diffuse);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Specular);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 20.0);
#if DO_FRAGMENT_FOG
{
/* Green-ish fog color */
static const GLfloat fogColor[4] = {0.5, 1.0, 0.5, 0};
glFogfv(GL_FOG_COLOR, fogColor);
glFogf(GL_FOG_START, 5.0);
glFogf(GL_FOG_END, 25.0);
}
#endif
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("Press p to toggle between per-pixel and per-vertex lighting\n");
}
int main( int argc, char *argv[] )
{
glutInitWindowSize( 200, 200 );
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
Win = glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Redisplay );
if (Anim)
glutIdleFunc(Idle);
Init();
glutMainLoop();
return 0;
}
-328
View File
@@ -1,328 +0,0 @@
/*
* Use GL_ARB_fragment_shader and GL_ARB_vertex_shader to implement
* simple per-pixel lighting.
*
* Michal Krol
* 20 February 2006
*
* Based on the original demo by:
* Brian Paul
* 17 April 2003
*/
#ifdef WIN32
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#ifdef WIN32
#define GETPROCADDRESS wglGetProcAddress
#else
#define GETPROCADDRESS glutGetProcAddress
#endif
static GLfloat diffuse[4] = { 0.5f, 0.5f, 1.0f, 1.0f };
static GLfloat specular[4] = { 0.8f, 0.8f, 0.8f, 1.0f };
static GLfloat lightPos[4] = { 0.0f, 10.0f, 20.0f, 1.0f };
static GLfloat delta = 1.0f;
static GLhandleARB fragShader;
static GLhandleARB vertShader;
static GLhandleARB program;
static GLint uLightPos;
static GLint uDiffuse;
static GLint uSpecular;
static GLboolean anim = GL_TRUE;
static GLboolean wire = GL_FALSE;
static GLboolean pixelLight = GL_TRUE;
static GLint t0 = 0;
static GLint frames = 0;
static GLfloat xRot = 0.0f, yRot = 0.0f;
static PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL;
static PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL;
static PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL;
static PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL;
static PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL;
static PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL;
static PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL;
static PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL;
static PFNGLUNIFORM3FVARBPROC glUniform3fvARB = NULL;
static PFNGLUNIFORM3FVARBPROC glUniform4fvARB = NULL;
static void normalize (GLfloat *dst, const GLfloat *src)
{
GLfloat len = sqrt (src[0] * src[0] + src[1] * src[1] + src[2] * src[2]);
dst[0] = src[0] / len;
dst[1] = src[1] / len;
dst[2] = src[2] / len;
}
static void Redisplay (void)
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (pixelLight)
{
GLfloat vec[3];
glUseProgramObjectARB (program);
normalize (vec, lightPos);
glUniform3fvARB (uLightPos, 1, vec);
glDisable(GL_LIGHTING);
}
else
{
glUseProgramObjectARB (0);
glLightfv (GL_LIGHT0, GL_POSITION, lightPos);
glEnable(GL_LIGHTING);
}
glPushMatrix ();
glRotatef (xRot, 1.0f, 0.0f, 0.0f);
glRotatef (yRot, 0.0f, 1.0f, 0.0f);
glutSolidSphere (2.0, 10, 5);
glPopMatrix ();
glutSwapBuffers();
frames++;
if (anim)
{
GLint t = glutGet (GLUT_ELAPSED_TIME);
if (t - t0 >= 5000)
{
GLfloat seconds = (GLfloat) (t - t0) / 1000.0f;
GLfloat fps = frames / seconds;
printf ("%d frames in %6.3f seconds = %6.3f FPS\n", frames, seconds, fps);
fflush(stdout);
t0 = t;
frames = 0;
}
}
}
static void Idle (void)
{
lightPos[0] += delta;
if (lightPos[0] > 25.0f || lightPos[0] < -25.0f)
delta = -delta;
glutPostRedisplay ();
}
static void Reshape (int width, int height)
{
glViewport (0, 0, width, height);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glFrustum (-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
glTranslatef (0.0f, 0.0f, -15.0f);
}
static void Key (unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch (key)
{
case ' ':
case 'a':
anim = !anim;
if (anim)
glutIdleFunc (Idle);
else
glutIdleFunc (NULL);
break;
case 'x':
lightPos[0] -= 1.0f;
break;
case 'X':
lightPos[0] += 1.0f;
break;
case 'w':
wire = !wire;
if (wire)
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
else
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
break;
case 'p':
pixelLight = !pixelLight;
if (pixelLight)
printf ("Per-pixel lighting\n");
else
printf ("Conventional lighting\n");
break;
case 27:
exit(0);
break;
}
glutPostRedisplay ();
}
static void SpecialKey (int key, int x, int y)
{
const GLfloat step = 3.0f;
(void) x;
(void) y;
switch (key)
{
case GLUT_KEY_UP:
xRot -= step;
break;
case GLUT_KEY_DOWN:
xRot += step;
break;
case GLUT_KEY_LEFT:
yRot -= step;
break;
case GLUT_KEY_RIGHT:
yRot += step;
break;
}
glutPostRedisplay ();
}
static void Init (void)
{
static const char *fragShaderText =
"uniform vec3 lightPos;\n"
"uniform vec4 diffuse;\n"
"uniform vec4 specular;\n"
"varying vec3 normal;\n"
"void main () {\n"
" // Compute dot product of light direction and normal vector\n"
" float dotProd = max (dot (lightPos, normalize (normal)), 0.0);\n"
" // Compute diffuse and specular contributions\n"
#if 1
" gl_FragColor = diffuse * dotProd + specular * pow (dotProd, 20.0);\n"
#elif 1 /* test IF/ELSE/ENDIF */
" if (normal.y > 0.0) { \n"
" gl_FragColor = diffuse * dotProd + specular * pow (dotProd, 20.0);\n"
" } \n"
" else { \n"
" if (normal.x < 0.0) { \n"
" gl_FragColor = vec4(1, 0, 0, 0); \n"
" } \n"
" else { \n"
" gl_FragColor = vec4(1, 1, 0, 0); \n"
" } \n"
" } \n"
#elif 1 /* test LOOP */
" while (1) { \n"
" if (normal.y >= 0.0) { \n"
" gl_FragColor = vec4(1, 0, 0, 0); \n"
" break; \n"
" } else { \n"
" gl_FragColor = diffuse * dotProd + specular * pow (dotProd, 20.0);\n"
" break; \n"
" } \n"
" } \n"
#endif
"}\n"
;
static const char *vertShaderText =
"varying vec3 normal;\n"
"void main () {\n"
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
" normal = gl_NormalMatrix * gl_Normal;\n"
"}\n"
;
if (!glutExtensionSupported ("GL_ARB_fragment_shader"))
{
printf ("Sorry, this demo requires GL_ARB_fragment_shader\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_shader_objects"))
{
printf ("Sorry, this demo requires GL_ARB_shader_objects\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_shading_language_100"))
{
printf ("Sorry, this demo requires GL_ARB_shading_language_100\n");
exit(1);
}
if (!glutExtensionSupported ("GL_ARB_vertex_shader"))
{
printf ("Sorry, this demo requires GL_ARB_vertex_shader\n");
exit(1);
}
glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) GETPROCADDRESS ("glCreateShaderObjectARB");
glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) GETPROCADDRESS ("glShaderSourceARB");
glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) GETPROCADDRESS ("glCompileShaderARB");
glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) GETPROCADDRESS ("glCreateProgramObjectARB");
glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) GETPROCADDRESS ("glAttachObjectARB");
glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) GETPROCADDRESS ("glLinkProgramARB");
glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) GETPROCADDRESS ("glUseProgramObjectARB");
glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) GETPROCADDRESS ("glGetUniformLocationARB");
glUniform3fvARB = (PFNGLUNIFORM3FVARBPROC) GETPROCADDRESS ("glUniform3fvARB");
glUniform4fvARB = (PFNGLUNIFORM3FVARBPROC) GETPROCADDRESS ("glUniform4fvARB");
fragShader = glCreateShaderObjectARB (GL_FRAGMENT_SHADER_ARB);
glShaderSourceARB (fragShader, 1, &fragShaderText, NULL);
glCompileShaderARB (fragShader);
vertShader = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB);
glShaderSourceARB (vertShader, 1, &vertShaderText, NULL);
glCompileShaderARB (vertShader);
program = glCreateProgramObjectARB ();
glAttachObjectARB (program, fragShader);
glAttachObjectARB (program, vertShader);
glLinkProgramARB (program);
glUseProgramObjectARB (program);
uLightPos = glGetUniformLocationARB (program, "lightPos");
uDiffuse = glGetUniformLocationARB (program, "diffuse");
uSpecular = glGetUniformLocationARB (program, "specular");
glUniform4fvARB (uDiffuse, 1, diffuse);
glUniform4fvARB (uSpecular, 1, specular);
glClearColor (0.3f, 0.3f, 0.3f, 0.0f);
glEnable (GL_DEPTH_TEST);
glEnable (GL_LIGHT0);
glEnable (GL_LIGHTING);
glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse);
glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, specular);
glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 20.0f);
printf ("GL_RENDERER = %s\n", (const char *) glGetString (GL_RENDERER));
printf ("Press p to toggle between per-pixel and per-vertex lighting\n");
}
int main (int argc, char *argv[])
{
glutInitWindowSize (200, 200);
glutInit (&argc, argv);
glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow (argv[0]);
glutReshapeFunc (Reshape);
glutKeyboardFunc (Key);
glutSpecialFunc (SpecialKey);
glutDisplayFunc (Redisplay);
if (anim)
glutIdleFunc (Idle);
Init ();
glutMainLoop ();
return 0;
}
-287
View File
@@ -1,287 +0,0 @@
/*
* GL_ARB_occlusion_query demo
*
* Brian Paul
* 12 June 2003
*
* Copyright (C) 2003 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/glut.h>
#define NUM_OCC 10
static GLboolean Anim = GL_TRUE;
static GLfloat Xpos[NUM_OCC], Ypos[NUM_OCC];
static GLfloat Sign[NUM_OCC];
static GLuint OccQuery[NUM_OCC];
static GLint Win = 0;
static void
PrintString(const char *s)
{
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
}
static void Idle(void)
{
static int lastTime = 0;
int time = glutGet(GLUT_ELAPSED_TIME);
float step;
int i;
if (lastTime == 0)
lastTime = time;
else if (time - lastTime < 20) /* 50Hz update */
return;
for (i = 0; i < NUM_OCC; i++) {
step = (time - lastTime) / 1000.0 * Sign[i];
Xpos[i] += step;
if (Xpos[i] > 2.5) {
Xpos[i] = 2.5;
Sign[i] = -1;
}
else if (Xpos[i] < -2.5) {
Xpos[i] = -2.5;
Sign[i] = +1;
}
}
lastTime = time;
glutPostRedisplay();
}
static void Display( void )
{
int i;
glClearColor(0.25, 0.25, 0.25, 0.0);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -15.0 );
/* draw the occluding polygons */
glColor3f(0, 0.4, 0.6);
glBegin(GL_QUADS);
glVertex2f(-1.6, -2.5);
glVertex2f(-0.4, -2.5);
glVertex2f(-0.4, 2.5);
glVertex2f(-1.6, 2.5);
glVertex2f( 0.4, -2.5);
glVertex2f( 1.6, -2.5);
glVertex2f( 1.6, 2.5);
glVertex2f( 0.4, 2.5);
glEnd();
glColorMask(0, 0, 0, 0);
glDepthMask(GL_FALSE);
/* draw the test polygons with occlusion testing */
for (i = 0; i < NUM_OCC; i++) {
glPushMatrix();
glTranslatef(Xpos[i], Ypos[i], -0.5);
glScalef(0.2, 0.2, 1.0);
glRotatef(-90.0 * Xpos[i], 0, 0, 1);
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery[i]);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 0);
glVertex3f( 1, -1, 0);
glVertex3f( 1, 1, 0);
glVertex3f(-1, 1, 0);
glEnd();
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
glPopMatrix();
}
glColorMask(1, 1, 1, 1);
glDepthMask(GL_TRUE);
/* Draw the rectangles now.
* Draw orange if result was ready
* Draw red if result was not ready.
*/
for (i = 0; i < NUM_OCC; i++) {
GLuint passed;
GLint ready;
glGetQueryObjectivARB(OccQuery[i], GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
glGetQueryObjectuivARB(OccQuery[i], GL_QUERY_RESULT_ARB, &passed);
if (!ready)
glColor3f(1, 0, 0);
else
glColor3f(0.8, 0.5, 0);
if (!ready || passed) {
glPushMatrix();
glTranslatef(Xpos[i], Ypos[i], -0.5);
glScalef(0.2, 0.2, 1.0);
glRotatef(-90.0 * Xpos[i], 0, 0, 1);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 0);
glVertex3f( 1, -1, 0);
glVertex3f( 1, 1, 0);
glVertex3f(-1, 1, 0);
glEnd();
glPopMatrix();
}
{
char s[10];
glRasterPos3f(0.45, Ypos[i], 1.0);
sprintf(s, "%4d", passed);
PrintString(s);
}
}
glutSwapBuffers();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
glutDestroyWindow(Win);
exit(0);
break;
case ' ':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
const GLfloat step = 0.1;
int i;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_LEFT:
for (i = 0; i < NUM_OCC; i++)
Xpos[i] -= step;
break;
case GLUT_KEY_RIGHT:
for (i = 0; i < NUM_OCC; i++)
Xpos[i] += step;
break;
}
glutPostRedisplay();
}
static void Init( void )
{
const char *ext = (const char *) glGetString(GL_EXTENSIONS);
GLint bits;
int i;
if (!strstr(ext, "GL_ARB_occlusion_query")) {
printf("Sorry, this demo requires the GL_ARB_occlusion_query extension\n");
exit(-1);
}
glGetQueryivARB(GL_SAMPLES_PASSED_ARB, GL_QUERY_COUNTER_BITS_ARB, &bits);
if (!bits) {
printf("Hmmm, GL_QUERY_COUNTER_BITS_ARB is zero!\n");
exit(-1);
}
glGetIntegerv(GL_DEPTH_BITS, &bits);
printf("Depthbits: %d\n", bits);
glGenQueriesARB(NUM_OCC, OccQuery);
glEnable(GL_DEPTH_TEST);
for (i = 0; i < NUM_OCC; i++) {
float t = (float) i / (NUM_OCC - 1);
Xpos[i] = 2.5 * t;
Ypos[i] = 4.0 * (t - 0.5);
Sign[i] = 1.0;
}
}
int main( int argc, char *argv[] )
{
glutInitWindowSize( 400, 400 );
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}
-314
View File
@@ -1,314 +0,0 @@
/*
* GL_ARB_occlusion_query demo
*
* Brian Paul
* 12 June 2003
*
* Copyright (C) 2003 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/glut.h>
static GLboolean Anim = GL_TRUE;
static GLfloat Xpos = 0;
static GLuint OccQuery1;
static GLuint OccQuery2;
static GLint Win = 0;
static void
PrintString(const char *s)
{
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
}
static void Idle(void)
{
static int lastTime = 0;
static int sign = +1;
int time = glutGet(GLUT_ELAPSED_TIME);
float step;
if (lastTime == 0)
lastTime = time;
else if (time - lastTime < 20) /* 50Hz update */
return;
step = (time - lastTime) / 1000.0 * sign;
lastTime = time;
Xpos += step;
if (Xpos > 2.5) {
Xpos = 2.5;
sign = -1;
}
else if (Xpos < -2.5) {
Xpos = -2.5;
sign = +1;
}
glutPostRedisplay();
}
static void Display( void )
{
GLuint passed1, passed2;
GLint ready;
char s[100];
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -15.0 );
/* draw the occluding polygons */
glColor3f(0, 0.6, 0.8);
glBegin(GL_QUADS);
glVertex2f(-1.6, -1.5);
glVertex2f(-0.4, -1.5);
glVertex2f(-0.4, 1.5);
glVertex2f(-1.6, 1.5);
glVertex2f( 0.4, -1.5);
glVertex2f( 1.6, -1.5);
glVertex2f( 1.6, 1.5);
glVertex2f( 0.4, 1.5);
glEnd();
#if defined(GL_ARB_occlusion_query)
glColorMask(0, 0, 0, 0);
glDepthMask(GL_FALSE);
/* draw the first polygon with occlusion testing */
glPushMatrix();
glTranslatef(Xpos, 0.4, -0.5);
glScalef(0.3, 0.3, 1.0);
glRotatef(-90.0 * Xpos, 0, 0, 1);
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery1);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 0);
glVertex3f( 1, -1, 0);
glVertex3f( 1, 1, 0);
glVertex3f(-1, 1, 0);
glEnd();
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
/* draw the second polygon with occlusion testing */
glPopMatrix();
glPushMatrix();
glTranslatef(Xpos, -0.4, -0.5);
glScalef(0.3, 0.3, 1.0);
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery2);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 0);
glVertex3f( 1, -1, 0);
glVertex3f( 1, 1, 0);
glVertex3f(-1, 1, 0);
glEnd();
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
/* turn off occlusion testing */
glColorMask(1, 1, 1, 1);
glDepthMask(GL_TRUE);
do {
/* do useful work here, if any */
glGetQueryObjectivARB(OccQuery1, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
} while (!ready);
glGetQueryObjectuivARB(OccQuery1, GL_QUERY_RESULT_ARB, &passed1);
do {
/* do useful work here, if any */
glGetQueryObjectivARB(OccQuery2, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
} while (!ready);
glGetQueryObjectuivARB(OccQuery2, GL_QUERY_RESULT_ARB, &passed2);
#endif /* GL_ARB_occlusion_query */
/* draw the second rect, so we can see what's going on */
glColor3f(0.8, 0.5, 0);
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 0);
glVertex3f( 1, -1, 0);
glVertex3f( 1, 1, 0);
glVertex3f(-1, 1, 0);
glEnd();
glPopMatrix();
glPushMatrix();
glTranslatef(Xpos, 0.4, -0.5);
glScalef(0.3, 0.3, 1.0);
glRotatef(-90.0 * Xpos, 0, 0, 1);
/* draw the first rect, so we can see what's going on */
glBegin(GL_POLYGON);
glVertex3f(-1, -1, 0);
glVertex3f( 1, -1, 0);
glVertex3f( 1, 1, 0);
glVertex3f(-1, 1, 0);
glEnd();
glPopMatrix();
/* Print result message */
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glColor3f(1, 1, 1);
#if defined(GL_ARB_occlusion_query)
sprintf(s, " %4d Fragments Visible", passed1);
glRasterPos3f(-0.50, -0.6, 0);
PrintString(s);
if (!passed1) {
glRasterPos3f(-0.25, -0.7, 0);
PrintString("Fully Occluded");
}
sprintf(s, " %4d Fragments Visible", passed2);
glRasterPos3f(-0.50, -0.8, 0);
PrintString(s);
if (!passed2) {
glRasterPos3f(-0.25, -0.9, 0);
PrintString("Fully Occluded");
}
#else
glRasterPos3f(-0.25, -0.8, 0);
PrintString("GL_ARB_occlusion_query not available at compile time");
#endif /* GL_ARB_occlusion_query */
glutSwapBuffers();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
glutDestroyWindow(Win);
exit(0);
break;
case ' ':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
const GLfloat step = 0.1;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_LEFT:
Xpos -= step;
break;
case GLUT_KEY_RIGHT:
Xpos += step;
break;
}
glutPostRedisplay();
}
static void Init( void )
{
const char *ext = (const char *) glGetString(GL_EXTENSIONS);
GLint bits;
if (!strstr(ext, "GL_ARB_occlusion_query")) {
printf("Sorry, this demo requires the GL_ARB_occlusion_query extension\n");
exit(-1);
}
#if defined(GL_ARB_occlusion_query)
glGetQueryivARB(GL_SAMPLES_PASSED_ARB, GL_QUERY_COUNTER_BITS_ARB, &bits);
if (!bits) {
printf("Hmmm, GL_QUERY_COUNTER_BITS_ARB is zero!\n");
exit(-1);
}
#endif /* GL_ARB_occlusion_query */
glGetIntegerv(GL_DEPTH_BITS, &bits);
printf("Depthbits: %d\n", bits);
#if defined(GL_ARB_occlusion_query)
glGenQueriesARB(1, &OccQuery1);
assert(OccQuery1 > 0);
glGenQueriesARB(1, &OccQuery2);
assert(OccQuery2 > 0);
#endif /* GL_ARB_occlusion_query */
glEnable(GL_DEPTH_TEST);
}
int main( int argc, char *argv[] )
{
glutInitWindowSize( 400, 400 );
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutIdleFunc( Idle );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}
-224
View File
@@ -1,224 +0,0 @@
/*
* Bouncing ball demo.
*
* This program is in the public domain
*
* Brian Paul
*
* Conversion to GLUT by Mark J. Kilgard
*/
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glut.h>
#define COS(X) cos( (X) * 3.14159/180.0 )
#define SIN(X) sin( (X) * 3.14159/180.0 )
#define RED 1
#define WHITE 2
#define CYAN 3
GLboolean IndexMode = GL_FALSE;
GLuint Ball;
GLenum Mode;
GLfloat Zrot = 0.0, Zstep = 180.0;
GLfloat Xpos = 0.0, Ypos = 1.0;
GLfloat Xvel = 2.0, Yvel = 0.0;
GLfloat Xmin = -4.0, Xmax = 4.0;
GLfloat Ymin = -3.8, Ymax = 4.0;
GLfloat G = -9.8;
static GLuint
make_ball(void)
{
GLuint list;
GLfloat a, b;
GLfloat da = 18.0, db = 18.0;
GLfloat radius = 1.0;
GLuint color;
GLfloat x, y, z;
list = glGenLists(1);
glNewList(list, GL_COMPILE);
color = 0;
for (a = -90.0; a + da <= 90.0; a += da) {
glBegin(GL_QUAD_STRIP);
for (b = 0.0; b <= 360.0; b += db) {
if (color) {
glIndexi(RED);
glColor3f(1, 0, 0);
} else {
glIndexi(WHITE);
glColor3f(1, 1, 1);
}
x = radius * COS(b) * COS(a);
y = radius * SIN(b) * COS(a);
z = radius * SIN(a);
glVertex3f(x, y, z);
x = radius * COS(b) * COS(a + da);
y = radius * SIN(b) * COS(a + da);
z = radius * SIN(a + da);
glVertex3f(x, y, z);
color = 1 - color;
}
glEnd();
}
glEndList();
return list;
}
static void
reshape(int width, int height)
{
float aspect = (float) width / (float) height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-6.0 * aspect, 6.0 * aspect, -6.0, 6.0, -6.0, 6.0);
glMatrixMode(GL_MODELVIEW);
}
/* ARGSUSED1 */
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27: /* Escape */
exit(0);
}
}
static void
draw(void)
{
GLint i;
glClear(GL_COLOR_BUFFER_BIT);
glIndexi(CYAN);
glColor3f(0, 1, 1);
glBegin(GL_LINES);
for (i = -5; i <= 5; i++) {
glVertex2i(i, -5);
glVertex2i(i, 5);
}
for (i = -5; i <= 5; i++) {
glVertex2i(-5, i);
glVertex2i(5, i);
}
for (i = -5; i <= 5; i++) {
glVertex2i(i, -5);
glVertex2f(i * 1.15, -5.9);
}
glVertex2f(-5.3, -5.35);
glVertex2f(5.3, -5.35);
glVertex2f(-5.75, -5.9);
glVertex2f(5.75, -5.9);
glEnd();
glPushMatrix();
glTranslatef(Xpos, Ypos, 0.0);
glScalef(2.0, 2.0, 2.0);
glRotatef(8.0, 0.0, 0.0, 1.0);
glRotatef(90.0, 1.0, 0.0, 0.0);
glRotatef(Zrot, 0.0, 0.0, 1.0);
glCallList(Ball);
glPopMatrix();
glFlush();
glutSwapBuffers();
}
static void
idle(void)
{
static float vel0 = -100.0;
static double t0 = -1.;
double t, dt;
t = glutGet(GLUT_ELAPSED_TIME) / 1000.;
if (t0 < 0.)
t0 = t;
dt = t - t0;
t0 = t;
Zrot += Zstep*dt;
Xpos += Xvel*dt;
if (Xpos >= Xmax) {
Xpos = Xmax;
Xvel = -Xvel;
Zstep = -Zstep;
}
if (Xpos <= Xmin) {
Xpos = Xmin;
Xvel = -Xvel;
Zstep = -Zstep;
}
Ypos += Yvel*dt;
Yvel += G*dt;
if (Ypos < Ymin) {
Ypos = Ymin;
if (vel0 == -100.0)
vel0 = fabs(Yvel);
Yvel = vel0;
}
glutPostRedisplay();
}
static void
visible(int vis)
{
if (vis == GLUT_VISIBLE)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
}
int main(int argc, char *argv[])
{
glutInitWindowSize(600, 450);
glutInit(&argc, argv);
IndexMode = argc > 1 && strcmp(argv[1], "-ci") == 0;
if (IndexMode)
glutInitDisplayMode(GLUT_INDEX | GLUT_DOUBLE);
else
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow("Bounce");
Ball = make_ball();
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glDisable(GL_DITHER);
glShadeModel(GL_FLAT);
glutDisplayFunc(draw);
glutReshapeFunc(reshape);
glutVisibilityFunc(visible);
glutKeyboardFunc(key);
if (IndexMode) {
glutSetColor(RED, 1.0, 0.0, 0.0);
glutSetColor(WHITE, 1.0, 1.0, 1.0);
glutSetColor(CYAN, 0.0, 1.0, 1.0);
}
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}
-217
View File
@@ -1,217 +0,0 @@
/*
* Simple GLUT program to measure glClear() and glutSwapBuffers() speed.
* Brian Paul February 15, 1997 This file in public domain.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <GL/glut.h>
static float MinPeriod = 2.0; /* 2 seconds */
static int ColorMode = GLUT_RGB;
static int Width = 400.0;
static int Height = 400.0;
static int Loops = 100;
static float ClearColor = 0.0;
static GLbitfield BufferMask = GL_COLOR_BUFFER_BIT;
static GLboolean SwapFlag = GL_FALSE;
static void Idle( void )
{
glutPostRedisplay();
}
static void Display( void )
{
double t0, t1;
double clearRate;
double pixelRate;
int i;
glClearColor( ClearColor, ClearColor, ClearColor, 0.0 );
ClearColor += 0.1;
if (ClearColor>1.0)
ClearColor = 0.0;
if (SwapFlag) {
t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
for (i=0;i<Loops;i++) {
glClear( BufferMask );
glutSwapBuffers();
}
glFinish();
t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
}
else {
t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
for (i=0;i<Loops;i++) {
glClear( BufferMask );
}
glFinish();
t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
glutSwapBuffers();
}
/* NOTE: If clearspd doesn't map it's window immediately on
* starting, swaps will be istantaneous, so this will send Loops
* towards infinity. When a window is finally mapped, it may be
* minutes before the first call to glutSwapBuffers, making it look
* like there's a driver bug.
*/
if (t1-t0 < MinPeriod) {
/* Next time do more clears to get longer elapsed time */
Loops *= 2;
return;
}
clearRate = Loops / (t1-t0);
pixelRate = clearRate * Width * Height;
if (SwapFlag) {
printf("Rate: %d clears+swaps in %gs = %g clears+swaps/s %g pixels/s\n",
Loops, t1-t0, clearRate, pixelRate );
}
else {
printf("Rate: %d clears in %gs = %g clears/s %g pixels/s\n",
Loops, t1-t0, clearRate, pixelRate);
}
}
static void Reshape( int width, int height )
{
Width = width;
Height = height;
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(0.0, width, 0.0, height, -1.0, 1.0);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void Init( int argc, char *argv[] )
{
int i;
for (i=1; i<argc; i++) {
if (strcmp(argv[i],"+rgb")==0)
ColorMode = GLUT_RGB;
else if (strcmp(argv[i],"+ci")==0)
ColorMode = GLUT_INDEX;
else if (strcmp(argv[i],"-color")==0)
BufferMask = 0;
else if (strcmp(argv[i],"+depth")==0)
BufferMask |= GL_DEPTH_BUFFER_BIT;
else if (strcmp(argv[i],"+alpha")==0)
ColorMode = GLUT_RGB | GLUT_ALPHA;
else if (strcmp(argv[i],"+stencil")==0)
BufferMask |= GL_STENCIL_BUFFER_BIT;
else if (strcmp(argv[i],"+accum")==0)
BufferMask |= GL_ACCUM_BUFFER_BIT;
else if (strcmp(argv[i],"-width")==0) {
Width = atoi(argv[i+1]);
i++;
}
else if (strcmp(argv[i],"-height")==0) {
Height = atoi(argv[i+1]);
i++;
}
else if (strcmp(argv[i],"+swap")==0) {
SwapFlag = GL_TRUE;
}
else if (strcmp(argv[i],"-swap")==0) {
SwapFlag = GL_FALSE;
}
else
printf("Unknown option: %s\n", argv[i]);
}
if (ColorMode & GLUT_ALPHA)
printf("Mode: RGB + Alpha\n");
else if (ColorMode==GLUT_RGB)
printf("Mode: RGB\n");
else
printf("Mode: Color Index\n");
printf("SwapBuffers: %s\n", SwapFlag ? "yes" : "no" );
printf("Size: %d x %d\n", Width, Height);
printf("Buffers: ");
if (BufferMask & GL_COLOR_BUFFER_BIT) printf("color ");
if (BufferMask & GL_DEPTH_BUFFER_BIT) printf("depth ");
if (BufferMask & GL_STENCIL_BUFFER_BIT) printf("stencil ");
if (BufferMask & GL_ACCUM_BUFFER_BIT) printf("accum ");
printf("\n");
}
static void Help( const char *program )
{
printf("%s options:\n", program);
printf(" +rgb RGB mode\n");
printf(" +ci color index mode\n");
printf(" -color don't clear color buffer\n");
printf(" +alpha clear alpha buffer\n");
printf(" +depth clear depth buffer\n");
printf(" +stencil clear stencil buffer\n");
printf(" +accum clear accum buffer\n");
printf(" +swap also do SwapBuffers\n");
printf(" -swap don't do SwapBuffers\n");
}
int main( int argc, char *argv[] )
{
GLint mode;
printf("For options: %s -help\n", argv[0]);
Init( argc, argv );
glutInitWindowSize( (int) Width, (int) Height );
glutInit( &argc, argv );
mode = ColorMode | GLUT_DOUBLE;
if (BufferMask & GL_STENCIL_BUFFER_BIT)
mode |= GLUT_STENCIL;
if (BufferMask & GL_ACCUM_BUFFER_BIT)
mode |= GLUT_ACCUM;
if (BufferMask & GL_DEPTH_BUFFER_BIT)
mode |= GLUT_DEPTH;
glutInitDisplayMode(mode);
glutCreateWindow( argv[0] );
if (argc==2 && strcmp(argv[1],"-help")==0) {
Help(argv[0]);
return 0;
}
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
glutIdleFunc( Idle );
glutMainLoop();
return 0;
}
-269
View File
@@ -1,269 +0,0 @@
/**
* glCopyPixels test
*
* Brian Paul
* 14 Sep 2007
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include "readtex.h"
#define IMAGE_FILE "../images/arch.rgb"
static int ImgWidth, ImgHeight;
static GLenum ImgFormat;
static GLubyte *Image = NULL;
static int WinWidth = 800, WinHeight = 800;
static int Xpos, Ypos;
static int Scissor = 0;
static float Xzoom, Yzoom;
static GLboolean DrawFront = GL_FALSE;
static GLboolean Dither = GL_TRUE;
static GLboolean Invert = GL_FALSE;
static void Reset( void )
{
Xpos = Ypos = 20;
Scissor = 0;
Xzoom = Yzoom = 1.0;
}
static void Display( void )
{
const int dx = (WinWidth - ImgWidth) / 2;
const int dy = (WinHeight - ImgHeight) / 2;
if (DrawFront) {
glDrawBuffer(GL_FRONT);
glReadBuffer(GL_FRONT);
}
else {
glDrawBuffer(GL_BACK);
glReadBuffer(GL_BACK);
}
glClear( GL_COLOR_BUFFER_BIT );
/* draw original image */
glWindowPos2iARB(dx, dy);
glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
if (Scissor)
glEnable(GL_SCISSOR_TEST);
if (Invert) {
glPixelTransferf(GL_RED_SCALE, -1.0);
glPixelTransferf(GL_GREEN_SCALE, -1.0);
glPixelTransferf(GL_BLUE_SCALE, -1.0);
glPixelTransferf(GL_RED_BIAS, 1.0);
glPixelTransferf(GL_GREEN_BIAS, 1.0);
glPixelTransferf(GL_BLUE_BIAS, 1.0);
}
/* draw copy */
glPixelZoom(Xzoom, Yzoom);
glWindowPos2iARB(Xpos, Ypos);
glCopyPixels(dx, dy, ImgWidth, ImgHeight, GL_COLOR);
glPixelZoom(1, 1);
glDisable(GL_SCISSOR_TEST);
if (Invert) {
glPixelTransferf(GL_RED_SCALE, 1.0);
glPixelTransferf(GL_GREEN_SCALE, 1.0);
glPixelTransferf(GL_BLUE_SCALE, 1.0);
glPixelTransferf(GL_RED_BIAS, 0.0);
glPixelTransferf(GL_GREEN_BIAS, 0.0);
glPixelTransferf(GL_BLUE_BIAS, 0.0);
}
if (DrawFront)
glFinish();
else
glutSwapBuffers();
}
static void Reshape( int width, int height )
{
WinWidth = width;
WinHeight = height;
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( 0.0, width, 0.0, height, 0.0, 2.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glScissor(width/4, height/4, width/2, height/2);
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case ' ':
Reset();
break;
case 'd':
Dither = !Dither;
if (Dither)
glEnable(GL_DITHER);
else
glDisable(GL_DITHER);
break;
case 'i':
Invert = !Invert;
break;
case 's':
Scissor = !Scissor;
break;
case 'x':
Xzoom -= 0.1;
break;
case 'X':
Xzoom += 0.1;
break;
case 'y':
Yzoom -= 0.1;
break;
case 'Y':
Yzoom += 0.1;
break;
case 'f':
DrawFront = !DrawFront;
printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK");
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
const int step = (glutGetModifiers() & GLUT_ACTIVE_SHIFT) ? 10 : 1;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
Ypos += step;
break;
case GLUT_KEY_DOWN:
Ypos -= step;
break;
case GLUT_KEY_LEFT:
Xpos -= step;
break;
case GLUT_KEY_RIGHT:
Xpos += step;
break;
}
glutPostRedisplay();
}
static void Init( GLboolean ciMode, const char *filename )
{
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
Image = LoadRGBImage( filename, &ImgWidth, &ImgHeight, &ImgFormat );
if (!Image) {
printf("Couldn't read %s\n", filename);
exit(0);
}
if (ciMode) {
/* Convert RGB image to grayscale */
GLubyte *indexImage = (GLubyte *) malloc( ImgWidth * ImgHeight );
GLint i;
for (i=0; i<ImgWidth*ImgHeight; i++) {
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];
indexImage[i] = gray / 3;
}
free(Image);
Image = indexImage;
ImgFormat = GL_COLOR_INDEX;
for (i=0;i<255;i++) {
float g = i / 255.0;
glutSetColor(i, g, g, g);
}
}
printf("Loaded %d by %d image\n", ImgWidth, ImgHeight );
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth);
Reset();
}
static void Usage(void)
{
printf("Keys:\n");
printf(" SPACE Reset Parameters\n");
printf(" Up/Down Move image up/down (SHIFT for large step)\n");
printf(" Left/Right Move image left/right (SHIFT for large step)\n");
printf(" x Decrease X-axis PixelZoom\n");
printf(" X Increase X-axis PixelZoom\n");
printf(" y Decrease Y-axis PixelZoom\n");
printf(" Y Increase Y-axis PixelZoom\n");
printf(" s Toggle GL_SCISSOR_TEST\n");
printf(" f Toggle front/back buffer drawing\n");
printf(" ESC Exit\n");
}
int main( int argc, char *argv[] )
{
GLboolean ciMode = GL_FALSE;
const char *filename = IMAGE_FILE;
int i = 1;
glutInitWindowSize( WinWidth, WinHeight );
glutInit( &argc, argv );
if (argc > i && strcmp(argv[i], "-ci")==0) {
ciMode = GL_TRUE;
i++;
}
if (argc > i) {
filename = argv[i];
}
if (ciMode)
glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE );
else
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
glutCreateWindow(argv[0]);
glewInit();
Init(ciMode, filename);
Usage();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
glutMainLoop();
return 0;
}
-631
View File
@@ -1,631 +0,0 @@
/*
* GL_ARB_texture_cube_map demo
*
* Brian Paul
* May 2000
*
*
* Copyright (C) 2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* This is a pretty minimalistic demo for now. Eventually, use some
* interesting cube map textures and 3D objects.
* For now, we use 6 checkerboard "walls" and a sphere (good for
* verification purposes).
*/
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glew.h>
#include "GL/glut.h"
#include "readtex.h"
#ifndef GL_TEXTURE_CUBE_MAP_SEAMLESS
#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
#endif
static GLfloat Xrot = 0, Yrot = 0;
static GLfloat EyeDist = 10;
static GLboolean use_vertex_arrays = GL_FALSE;
static GLboolean anim = GL_TRUE;
static GLboolean NoClear = GL_FALSE;
static GLint FrameParity = 0;
static GLenum FilterIndex = 0;
static GLint ClampIndex = 0;
static GLboolean supportFBO = GL_FALSE;
static GLboolean supportSeamless = GL_FALSE;
static GLboolean seamless = GL_FALSE;
static GLuint TexObj = 0;
static GLint T0 = 0;
static GLint Frames = 0;
static struct {
GLenum mode;
const char *name;
} ClampModes[] = {
{ GL_CLAMP_TO_EDGE, "GL_CLAMP_TO_EDGE" },
{ GL_CLAMP_TO_BORDER, "GL_CLAMP_TO_BORDER" },
{ GL_CLAMP, "GL_CLAMP" },
{ GL_REPEAT, "GL_REPEAT" }
};
#define NUM_CLAMP_MODES (sizeof(ClampModes) / sizeof(ClampModes[0]))
static struct {
GLenum mag_mode, min_mode;
const char *name;
} FilterModes[] = {
{ GL_NEAREST, GL_NEAREST, "GL_NEAREST, GL_NEAREST" },
{ GL_NEAREST, GL_LINEAR, "GL_NEAREST, GL_LINEAR" },
{ GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST, "GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST" },
{ GL_NEAREST, GL_NEAREST_MIPMAP_LINEAR, "GL_NEAREST, GL_NEAREST_MIPMAP_LINEAR" },
{ GL_NEAREST, GL_LINEAR_MIPMAP_NEAREST, "GL_NEAREST, GL_LINEAR_MIPMAP_NEAREST" },
{ GL_NEAREST, GL_LINEAR_MIPMAP_LINEAR, "GL_NEAREST, GL_LINEAR_MIPMAP_LINEAR" },
{ GL_LINEAR, GL_NEAREST, "GL_LINEAR, GL_NEAREST" },
{ GL_LINEAR, GL_LINEAR, "GL_LINEAR, GL_LINEAR" },
{ GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST, "GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST" },
{ GL_LINEAR, GL_NEAREST_MIPMAP_LINEAR, "GL_LINEAR, GL_NEAREST_MIPMAP_LINEAR" },
{ GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, "GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST" },
{ GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR, "GL_LINEAR, GL_LINEAR_MIPMAP_LINEAR" }
};
#define NUM_FILTER_MODES (sizeof(FilterModes) / sizeof(FilterModes[0]))
/* The effects of GL_ARB_seamless_cube_map don't show up unless eps1 is 1.0.
*/
#define eps1 1.0 /*0.99*/
#define br 20.0 /* box radius */
static const GLfloat tex_coords[] = {
/* +X side */
1.0, -eps1, -eps1,
1.0, -eps1, eps1,
1.0, eps1, eps1,
1.0, eps1, -eps1,
/* -X side */
-1.0, eps1, -eps1,
-1.0, eps1, eps1,
-1.0, -eps1, eps1,
-1.0, -eps1, -eps1,
/* +Y side */
-eps1, 1.0, -eps1,
-eps1, 1.0, eps1,
eps1, 1.0, eps1,
eps1, 1.0, -eps1,
/* -Y side */
-eps1, -1.0, -eps1,
-eps1, -1.0, eps1,
eps1, -1.0, eps1,
eps1, -1.0, -eps1,
/* +Z side */
eps1, -eps1, 1.0,
-eps1, -eps1, 1.0,
-eps1, eps1, 1.0,
eps1, eps1, 1.0,
/* -Z side */
eps1, eps1, -1.0,
-eps1, eps1, -1.0,
-eps1, -eps1, -1.0,
eps1, -eps1, -1.0,
};
static const GLfloat vtx_coords[] = {
/* +X side */
br, -br, -br,
br, -br, br,
br, br, br,
br, br, -br,
/* -X side */
-br, br, -br,
-br, br, br,
-br, -br, br,
-br, -br, -br,
/* +Y side */
-br, br, -br,
-br, br, br,
br, br, br,
br, br, -br,
/* -Y side */
-br, -br, -br,
-br, -br, br,
br, -br, br,
br, -br, -br,
/* +Z side */
br, -br, br,
-br, -br, br,
-br, br, br,
br, br, br,
/* -Z side */
br, br, -br,
-br, br, -br,
-br, -br, -br,
br, -br, -br,
};
static void draw_skybox( void )
{
if ( use_vertex_arrays ) {
glTexCoordPointer( 3, GL_FLOAT, 0, tex_coords );
glVertexPointer( 3, GL_FLOAT, 0, vtx_coords );
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
glEnableClientState( GL_VERTEX_ARRAY );
glDrawArrays( GL_QUADS, 0, 24 );
glDisableClientState( GL_TEXTURE_COORD_ARRAY );
glDisableClientState( GL_VERTEX_ARRAY );
}
else {
unsigned i;
glBegin(GL_QUADS);
for ( i = 0 ; i < 24 ; i++ ) {
glTexCoord3fv( & tex_coords[ i * 3 ] );
glVertex3fv ( & vtx_coords[ i * 3 ] );
}
glEnd();
}
}
static void draw( void )
{
GLenum wrap;
if (NoClear) {
/* This demonstrates how we can avoid calling glClear.
* This method only works if every pixel in the window is painted for
* every frame.
* We can simply skip clearing of the color buffer in this case.
* For the depth buffer, we alternately use a different subrange of
* the depth buffer for each frame. For the odd frame use the range
* [0, 0.5] with GL_LESS. For the even frames, use the range [1, 0.5]
* with GL_GREATER.
*/
FrameParity = 1 - FrameParity;
if (FrameParity) {
glDepthRange(0.0, 0.5);
glDepthFunc(GL_LESS);
}
else {
glDepthRange(1.0, 0.5);
glDepthFunc(GL_GREATER);
}
}
else {
/* ordinary clearing */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER,
FilterModes[FilterIndex].min_mode);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER,
FilterModes[FilterIndex].mag_mode);
if (supportSeamless) {
if (seamless) {
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
} else {
glDisable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
}
}
wrap = ClampModes[ClampIndex].mode;
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, wrap);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, wrap);
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, wrap);
glPushMatrix(); /*MODELVIEW*/
glTranslatef( 0.0, 0.0, -EyeDist );
/* skybox */
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_GEN_R);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glRotatef(Xrot, 1, 0, 0);
glRotatef(Yrot, 0, 1, 0);
draw_skybox();
glPopMatrix();
/* sphere */
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glRotatef(-Yrot, 0, 1, 0);
glRotatef(-Xrot, 1, 0, 0);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);
glutSolidSphere(2.0, 20, 20);
glLoadIdentity(); /* texture */
glMatrixMode(GL_MODELVIEW);
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 %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
fflush(stdout);
T0 = t;
Frames = 0;
}
}
}
static void idle(void)
{
GLfloat t = 0.05 * glutGet(GLUT_ELAPSED_TIME);
Yrot = t;
glutPostRedisplay();
}
static void set_mode(GLuint mode)
{
if (mode == 0) {
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
printf("GL_REFLECTION_MAP_ARB mode\n");
}
else if (mode == 1) {
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_ARB);
printf("GL_NORMAL_MAP_ARB mode\n");
}
}
static void key(unsigned char k, int x, int y)
{
static GLuint mode = 0;
(void) x;
(void) y;
switch (k) {
case ' ':
anim = !anim;
if (anim)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
break;
case 'f':
FilterIndex = (FilterIndex + 1) % NUM_FILTER_MODES;
printf("Tex filter: %s\n", FilterModes[FilterIndex].name);
break;
case 'c':
ClampIndex = (ClampIndex + 1) % NUM_CLAMP_MODES;
printf("Tex wrap mode: %s\n", ClampModes[ClampIndex].name);
break;
case 'm':
mode = !mode;
set_mode(mode);
break;
case 's':
seamless = ! seamless;
printf("Seamless cube map filtering is %sabled\n",
(seamless) ? "en" : "dis" );
break;
case 'v':
use_vertex_arrays = ! use_vertex_arrays;
printf( "Vertex arrays are %sabled\n",
(use_vertex_arrays) ? "en" : "dis" );
break;
case 'z':
EyeDist -= 0.5;
if (EyeDist < 6.0)
EyeDist = 6.0;
break;
case 'Z':
EyeDist += 0.5;
if (EyeDist > 90.0)
EyeDist = 90;
break;
case 27:
exit(0);
}
glutPostRedisplay();
}
static void specialkey(int key, int x, int y)
{
GLfloat step = 5;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
Xrot += step;
break;
case GLUT_KEY_DOWN:
Xrot -= step;
break;
case GLUT_KEY_LEFT:
Yrot -= step;
break;
case GLUT_KEY_RIGHT:
Yrot += step;
break;
}
glutPostRedisplay();
}
/* new window size or exposure */
static void reshape(int width, int height)
{
GLfloat ar = (float) width / (float) height;
glViewport(0, 0, (GLint)width, (GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum( -2.0*ar, 2.0*ar, -2.0, 2.0, 4.0, 100.0 );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static void init_checkers( void )
{
#define CUBE_TEX_SIZE 64
GLubyte image[CUBE_TEX_SIZE][CUBE_TEX_SIZE][4];
static const GLubyte colors[6][3] = {
{ 255, 0, 0 }, /* face 0 - red */
{ 0, 255, 255 }, /* face 1 - cyan */
{ 0, 255, 0 }, /* face 2 - green */
{ 255, 0, 255 }, /* face 3 - purple */
{ 0, 0, 255 }, /* face 4 - blue */
{ 255, 255, 0 } /* face 5 - yellow */
};
static const GLenum targets[6] = {
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB,
GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB,
GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
};
GLint i, j, f;
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if (!supportFBO)
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
/* make colored checkerboard cube faces */
for (f = 0; f < 6; f++) {
for (i = 0; i < CUBE_TEX_SIZE; i++) {
for (j = 0; j < CUBE_TEX_SIZE; j++) {
if ((i/4 + j/4) & 1) {
image[i][j][0] = colors[f][2];
image[i][j][1] = colors[f][1];
image[i][j][2] = colors[f][0];
image[i][j][3] = 255;
}
else {
image[i][j][0] = 255;
image[i][j][1] = 255;
image[i][j][2] = 255;
image[i][j][3] = 255;
}
}
}
glTexImage2D(targets[f], 0, GL_RGBA8, CUBE_TEX_SIZE, CUBE_TEX_SIZE, 0,
GL_BGRA, GL_UNSIGNED_BYTE, image);
}
if (supportFBO)
glGenerateMipmapEXT(GL_TEXTURE_CUBE_MAP_ARB);
}
static void load(GLenum target, const char *filename,
GLboolean flipTB, GLboolean flipLR)
{
GLint w, h;
GLenum format;
GLubyte *img = LoadRGBImage( filename, &w, &h, &format );
if (!img) {
printf("Error: couldn't load texture image %s\n", filename);
exit(1);
}
assert(format == GL_RGB);
/* <sigh> the way the texture cube mapping works, we have to flip
* images to make things look right.
*/
if (flipTB) {
const int stride = 3 * w;
GLubyte temp[3*1024];
int i;
for (i = 0; i < h / 2; i++) {
memcpy(temp, img + i * stride, stride);
memcpy(img + i * stride, img + (h - i - 1) * stride, stride);
memcpy(img + (h - i - 1) * stride, temp, stride);
}
}
if (flipLR) {
const int stride = 3 * w;
GLubyte temp[3];
GLubyte *row;
int i, j;
for (i = 0; i < h; i++) {
row = img + i * stride;
for (j = 0; j < w / 2; j++) {
int k = w - j - 1;
temp[0] = row[j*3+0];
temp[1] = row[j*3+1];
temp[2] = row[j*3+2];
row[j*3+0] = row[k*3+0];
row[j*3+1] = row[k*3+1];
row[j*3+2] = row[k*3+2];
row[k*3+0] = temp[0];
row[k*3+1] = temp[1];
row[k*3+2] = temp[2];
}
}
}
gluBuild2DMipmaps(target, GL_RGB, w, h, format, GL_UNSIGNED_BYTE, img);
free(img);
}
static void load_envmaps(void)
{
load(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, "right.rgb", GL_TRUE, GL_FALSE);
load(GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, "left.rgb", GL_TRUE, GL_FALSE);
load(GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, "top.rgb", GL_FALSE, GL_TRUE);
load(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, "bottom.rgb", GL_FALSE, GL_TRUE);
load(GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, "front.rgb", GL_TRUE, GL_FALSE);
load(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, "back.rgb", GL_TRUE, GL_FALSE);
}
static void init( GLboolean useImageFiles )
{
/* check for extensions */
if (!GLEW_ARB_texture_cube_map) {
printf("Sorry, this demo requires GL_ARB_texture_cube_map\n");
exit(0);
}
/* Needed for glGenerateMipmapEXT / auto mipmapping
*/
supportFBO = GLEW_EXT_framebuffer_object;
if (!supportFBO && !GLEW_SGIS_generate_mipmap) {
printf("Sorry, this demo requires GL_EXT_framebuffer_object or "
"GL_SGIS_generate_mipmap\n");
exit(0);
}
/* GLEW doesn't know about this extension yet, so use the old GLUT function
* to check for availability.
*/
supportSeamless = glutExtensionSupported("GL_ARB_seamless_cube_map");
printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
glGenTextures(1, &TexObj);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, TexObj);
if (useImageFiles) {
load_envmaps();
}
else {
init_checkers();
}
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
glEnable(GL_DEPTH_TEST);
glClearColor(.3, .3, .3, 0);
glColor3f( 1.0, 1.0, 1.0 );
set_mode(0);
}
static void usage(void)
{
printf("keys:\n");
printf(" SPACE - toggle animation\n");
printf(" CURSOR KEYS - rotation\n");
printf(" c - toggle texture clamp/wrap mode\n");
printf(" f - toggle texture filter mode\n");
printf(" m - toggle texgen reflection mode\n");
printf(" z/Z - change viewing distance\n");
}
static void parse_args(int argc, char *argv[])
{
int initFlag = 0;
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-i") == 0)
initFlag = 1;
else if (strcmp(argv[i], "--noclear") == 0)
NoClear = GL_TRUE;
else {
fprintf(stderr, "Bad option: %s\n", argv[i]);
exit(1);
}
}
init (initFlag);
}
int main( int argc, char *argv[] )
{
glutInitWindowSize(600, 500);
glutInit(&argc, argv);
glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
glutCreateWindow("Texture Cube Mapping");
glewInit();
glutReshapeFunc( reshape );
glutKeyboardFunc( key );
glutSpecialFunc( specialkey );
glutDisplayFunc( draw );
if (anim)
glutIdleFunc(idle);
parse_args(argc, argv);
usage();
glutMainLoop();
return 0;
}
-90
View File
@@ -1,90 +0,0 @@
# Makefile for GLUT-based demo programs for VMS
# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
# Last update : 30 November 2007
.first
define gl [--.include.gl]
.include [--]mms-config.
##### MACROS #####
INCDIR = ([--.include],[-.util])
CFLAGS =/include=$(INCDIR)/prefix=all/name=(as_is,short)/float=ieee/ieee=denorm
.ifdef SHARE
GL_LIBS = $(XLIBS)
LIB_DEP = [--.lib]$(GL_SHAR) [--.lib]$(GLU_SHAR) [--.lib]$(GLUT_SHAR)
.else
GL_LIBS = [--.lib]libGLUT/l,libMesaGLU/l,libMesaGL/l,$(XLIBS)
LIB_DEP = [--.lib]$(GL_LIB) [--.lib]$(GLU_LIB) [--.lib]$(GLUT_LIB)
.endif
PROGS = bounce.exe,clearspd.exe,drawpix.exe,gamma.exe,gears.exe,\
glinfo.exe,glutfx.exe,isosurf.exe,morph3d.exe,\
paltex.exe,pointblast.exe,reflect.exe,spectex.exe,stex3d.exe,\
tessdemo.exe,texcyl.exe,texobj.exe,trispd.exe,winpos.exe
##### RULES #####
.obj.exe :
cxxlink $(MMS$TARGET_NAME),$(GL_LIBS)
##### TARGETS #####
default :
$(MMS)$(MMSQUALIFIERS) $(PROGS)
clean :
delete *.obj;*
realclean :
delete *.exe;*
delete *.obj;*
bounce.exe : bounce.obj $(LIB_DEP)
clearspd.exe : clearspd.obj $(LIB_DEP)
drawpix.exe : drawpix.obj $(LIB_DEP) [-.util]readtex.obj
cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS)
gamma.exe : gamma.obj $(LIB_DEP)
gears.exe : gears.obj $(LIB_DEP)
glinfo.exe : glinfo.obj $(LIB_DEP)
glutfx.exe : glutfx.obj $(LIB_DEP)
isosurf.exe : isosurf.obj $(LIB_DEP) [-.util]readtex.obj
cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS)
morph3d.exe : morph3d.obj $(LIB_DEP)
paltex.exe : paltex.obj $(LIB_DEP)
pointblast.exe : pointblast.obj $(LIB_DEP)
reflect.exe : reflect.obj [-.util]readtex.obj [-.util]showbuffer.obj\
$(LIB_DEP)
cxxlink $(MMS$TARGET_NAME),[-.util]readtex,showbuffer,$(GL_LIBS)
spectex.exe : spectex.obj $(LIB_DEP)
stex3d.exe : stex3d.obj $(LIB_DEP)
tessdemo.exe : tessdemo.obj $(LIB_DEP)
texcyl.exe : texcyl.obj [-.util]readtex.obj $(LIB_DEP)
cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS)
texobj.exe : texobj.obj $(LIB_DEP)
trispd.exe : trispd.obj $(LIB_DEP)
winpos.exe : winpos.obj [-.util]readtex.obj $(LIB_DEP)
cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS)
bounce.obj : bounce.c
clearspd.obj : clearspd.c
drawpix.obj : drawpix.c
gamma.obj : gamma.c
gears.obj : gears.c
glinfo.obj : glinfo.c
glutfx.obj : glutfx.c
isosurf.obj : isosurf.c
morph3d.obj : morph3d.c
paltex.obj : paltex.c
pointblast.obj : pointblast.c
reflect.obj : reflect.c
spectex.obj : spectex.c
stex3d.obj : stex3d.c
tessdemo.obj : tessdemo.c
texcyl.obj : texcyl.c
texobj.obj : texobj.c
trispd.obj : trispd.c
winpos.obj : winpos.c
-914
View File
@@ -1,914 +0,0 @@
/* Copyright (c) Mark J. Kilgard, 1994, 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. */
/* Example for PC game developers to show how to *combine* texturing,
reflections, and projected shadows all in real-time with OpenGL.
Robust reflections use stenciling. Robust projected shadows
use both stenciling and polygon offset. PC game programmers
should realize that neither stenciling nor polygon offset are
supported by Direct3D, so these real-time rendering algorithms
are only really viable with OpenGL.
The program has modes for disabling the stenciling and polygon
offset uses. It is worth running this example with these features
toggled off so you can see the sort of artifacts that result.
Notice that the floor texturing, reflections, and shadowing
all co-exist properly. */
/* When you run this program: Left mouse button controls the
view. Middle mouse button controls light position (left &
right rotates light around dino; up & down moves light
position up and down). Right mouse button pops up menu. */
/* Check out the comments in the "redraw" routine to see how the
reflection blending and surface stenciling is done. You can
also see in "redraw" how the projected shadows are rendered,
including the use of stenciling and polygon offset. */
/* This program is derived from glutdino.c */
/* Compile: cc -o dinoshade dinoshade.c -lglut -lGLU -lGL -lXmu -lXext -lX11 -lm */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h> /* for cos(), sin(), and sqrt() */
#include <stddef.h> /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */
#ifdef _WIN32
#include <windows.h>
#endif
#define GL_GLEXT_LEGACY
#include <GL/glew.h> /* OpenGL Utility Toolkit header */
#include <GL/glut.h> /* OpenGL Utility Toolkit header */
/* Some <math.h> files do not define M_PI... */
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
/* Variable controlling various rendering modes. */
static int stencilReflection = 1, stencilShadow = 1, offsetShadow = 1;
static int renderShadow = 1, renderDinosaur = 1, renderReflection = 1;
static int linearFiltering = 0, useMipmaps = 0, useTexture = 1;
static int reportSpeed = 0;
static int animation = 1;
static GLboolean lightSwitch = GL_TRUE;
static int directionalLight = 1;
static int forceExtension = 0;
/* Time varying or user-controled variables. */
static float jump = 0.0;
static float lightAngle = 0.0, lightHeight = 20;
GLfloat angle = -150; /* in degrees */
GLfloat angle2 = 30; /* in degrees */
int moving, startx, starty;
int lightMoving = 0, lightStartX, lightStartY;
enum {
MISSING, EXTENSION, ONE_DOT_ONE
};
int polygonOffsetVersion;
static GLdouble bodyWidth = 3.0;
/* *INDENT-OFF* */
static GLfloat body[][2] = { {0, 3}, {1, 1}, {5, 1}, {8, 4}, {10, 4}, {11, 5},
{11, 11.5}, {13, 12}, {13, 13}, {10, 13.5}, {13, 14}, {13, 15}, {11, 16},
{8, 16}, {7, 15}, {7, 13}, {8, 12}, {7, 11}, {6, 6}, {4, 3}, {3, 2},
{1, 2} };
static GLfloat arm[][2] = { {8, 10}, {9, 9}, {10, 9}, {13, 8}, {14, 9}, {16, 9},
{15, 9.5}, {16, 10}, {15, 10}, {15.5, 11}, {14.5, 10}, {14, 11}, {14, 10},
{13, 9}, {11, 11}, {9, 11} };
static GLfloat leg[][2] = { {8, 6}, {8, 4}, {9, 3}, {9, 2}, {8, 1}, {8, 0.5}, {9, 0},
{12, 0}, {10, 1}, {10, 2}, {12, 4}, {11, 6}, {10, 7}, {9, 7} };
static GLfloat eye[][2] = { {8.75, 15}, {9, 14.7}, {9.6, 14.7}, {10.1, 15},
{9.6, 15.25}, {9, 15.25} };
static GLfloat lightPosition[4];
static GLfloat lightColor[] = {0.8, 1.0, 0.8, 1.0}; /* green-tinted */
static GLfloat skinColor[] = {0.1, 1.0, 0.1, 1.0}, eyeColor[] = {1.0, 0.2, 0.2, 1.0};
/* *INDENT-ON* */
/* Nice floor texture tiling pattern. */
static char *circles[] = {
"....xxxx........",
"..xxxxxxxx......",
".xxxxxxxxxx.....",
".xxx....xxx.....",
"xxx......xxx....",
"xxx......xxx....",
"xxx......xxx....",
"xxx......xxx....",
".xxx....xxx.....",
".xxxxxxxxxx.....",
"..xxxxxxxx......",
"....xxxx........",
"................",
"................",
"................",
"................",
};
static void
makeFloorTexture(void)
{
GLubyte floorTexture[16][16][3];
GLubyte *loc;
int s, t;
/* Setup RGB image for the texture. */
loc = (GLubyte*) floorTexture;
for (t = 0; t < 16; t++) {
for (s = 0; s < 16; s++) {
if (circles[t][s] == 'x') {
/* Nice green. */
loc[0] = 0x1f;
loc[1] = 0x8f;
loc[2] = 0x1f;
} else {
/* Light gray. */
loc[0] = 0xaa;
loc[1] = 0xaa;
loc[2] = 0xaa;
}
loc += 3;
}
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if (useMipmaps) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 16, 16,
GL_RGB, GL_UNSIGNED_BYTE, floorTexture);
} else {
if (linearFiltering) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
} else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
glTexImage2D(GL_TEXTURE_2D, 0, 3, 16, 16, 0,
GL_RGB, GL_UNSIGNED_BYTE, floorTexture);
}
}
enum {
X, Y, Z, W
};
enum {
A, B, C, D
};
/* Create a matrix that will project the desired shadow. */
static void
shadowMatrix(GLfloat shadowMat[4][4],
GLfloat groundplane[4],
GLfloat lightpos[4])
{
GLfloat dot;
/* Find dot product between light position vector and ground plane normal. */
dot = groundplane[X] * lightpos[X] +
groundplane[Y] * lightpos[Y] +
groundplane[Z] * lightpos[Z] +
groundplane[W] * lightpos[W];
shadowMat[0][0] = dot - lightpos[X] * groundplane[X];
shadowMat[1][0] = 0.f - lightpos[X] * groundplane[Y];
shadowMat[2][0] = 0.f - lightpos[X] * groundplane[Z];
shadowMat[3][0] = 0.f - lightpos[X] * groundplane[W];
shadowMat[X][1] = 0.f - lightpos[Y] * groundplane[X];
shadowMat[1][1] = dot - lightpos[Y] * groundplane[Y];
shadowMat[2][1] = 0.f - lightpos[Y] * groundplane[Z];
shadowMat[3][1] = 0.f - lightpos[Y] * groundplane[W];
shadowMat[X][2] = 0.f - lightpos[Z] * groundplane[X];
shadowMat[1][2] = 0.f - lightpos[Z] * groundplane[Y];
shadowMat[2][2] = dot - lightpos[Z] * groundplane[Z];
shadowMat[3][2] = 0.f - lightpos[Z] * groundplane[W];
shadowMat[X][3] = 0.f - lightpos[W] * groundplane[X];
shadowMat[1][3] = 0.f - lightpos[W] * groundplane[Y];
shadowMat[2][3] = 0.f - lightpos[W] * groundplane[Z];
shadowMat[3][3] = dot - lightpos[W] * groundplane[W];
}
/* Find the plane equation given 3 points. */
static void
findPlane(GLfloat plane[4],
GLfloat v0[3], GLfloat v1[3], GLfloat v2[3])
{
GLfloat vec0[3], vec1[3];
/* Need 2 vectors to find cross product. */
vec0[X] = v1[X] - v0[X];
vec0[Y] = v1[Y] - v0[Y];
vec0[Z] = v1[Z] - v0[Z];
vec1[X] = v2[X] - v0[X];
vec1[Y] = v2[Y] - v0[Y];
vec1[Z] = v2[Z] - v0[Z];
/* find cross product to get A, B, and C of plane equation */
plane[A] = vec0[Y] * vec1[Z] - vec0[Z] * vec1[Y];
plane[B] = -(vec0[X] * vec1[Z] - vec0[Z] * vec1[X]);
plane[C] = vec0[X] * vec1[Y] - vec0[Y] * vec1[X];
plane[D] = -(plane[A] * v0[X] + plane[B] * v0[Y] + plane[C] * v0[Z]);
}
static void
extrudeSolidFromPolygon(GLfloat data[][2], unsigned int dataSize,
GLdouble thickness, GLuint side, GLuint edge, GLuint whole)
{
static GLUtriangulatorObj *tobj = NULL;
GLdouble vertex[3], dx, dy, len;
int i;
int count = (int) (dataSize / (2 * sizeof(GLfloat)));
if (tobj == NULL) {
tobj = gluNewTess(); /* create and initialize a GLU
polygon tesselation object */
gluTessCallback(tobj, GLU_BEGIN, glBegin);
gluTessCallback(tobj, GLU_VERTEX, glVertex2fv); /* semi-tricky */
gluTessCallback(tobj, GLU_END, glEnd);
}
glNewList(side, GL_COMPILE);
glShadeModel(GL_SMOOTH); /* smooth minimizes seeing
tessellation */
gluBeginPolygon(tobj);
for (i = 0; i < count; i++) {
vertex[0] = data[i][0];
vertex[1] = data[i][1];
vertex[2] = 0;
gluTessVertex(tobj, vertex, data[i]);
}
gluEndPolygon(tobj);
glEndList();
glNewList(edge, GL_COMPILE);
glShadeModel(GL_FLAT); /* flat shade keeps angular hands
from being "smoothed" */
glBegin(GL_QUAD_STRIP);
for (i = 0; i <= count; i++) {
#if 1 /* weird, but seems to be legal */
/* mod function handles closing the edge */
glVertex3f(data[i % count][0], data[i % count][1], 0.0);
glVertex3f(data[i % count][0], data[i % count][1], thickness);
/* Calculate a unit normal by dividing by Euclidean
distance. We * could be lazy and use
glEnable(GL_NORMALIZE) so we could pass in * arbitrary
normals for a very slight performance hit. */
dx = data[(i + 1) % count][1] - data[i % count][1];
dy = data[i % count][0] - data[(i + 1) % count][0];
len = sqrt(dx * dx + dy * dy);
glNormal3f(dx / len, dy / len, 0.0);
#else /* the nice way of doing it */
/* Calculate a unit normal by dividing by Euclidean
distance. We * could be lazy and use
glEnable(GL_NORMALIZE) so we could pass in * arbitrary
normals for a very slight performance hit. */
dx = data[i % count][1] - data[(i - 1 + count) % count][1];
dy = data[(i - 1 + count) % count][0] - data[i % count][0];
len = sqrt(dx * dx + dy * dy);
glNormal3f(dx / len, dy / len, 0.0);
/* mod function handles closing the edge */
glVertex3f(data[i % count][0], data[i % count][1], 0.0);
glVertex3f(data[i % count][0], data[i % count][1], thickness);
#endif
}
glEnd();
glEndList();
glNewList(whole, GL_COMPILE);
glFrontFace(GL_CW);
glCallList(edge);
glNormal3f(0.0, 0.0, -1.0); /* constant normal for side */
glCallList(side);
glPushMatrix();
glTranslatef(0.0, 0.0, thickness);
glFrontFace(GL_CCW);
glNormal3f(0.0, 0.0, 1.0); /* opposite normal for other side */
glCallList(side);
glPopMatrix();
glEndList();
}
/* Enumerants for refering to display lists. */
typedef enum {
RESERVED, BODY_SIDE, BODY_EDGE, BODY_WHOLE, ARM_SIDE, ARM_EDGE, ARM_WHOLE,
LEG_SIDE, LEG_EDGE, LEG_WHOLE, EYE_SIDE, EYE_EDGE, EYE_WHOLE
} displayLists;
static void
makeDinosaur(void)
{
extrudeSolidFromPolygon(body, sizeof(body), bodyWidth,
BODY_SIDE, BODY_EDGE, BODY_WHOLE);
extrudeSolidFromPolygon(arm, sizeof(arm), bodyWidth / 4,
ARM_SIDE, ARM_EDGE, ARM_WHOLE);
extrudeSolidFromPolygon(leg, sizeof(leg), bodyWidth / 2,
LEG_SIDE, LEG_EDGE, LEG_WHOLE);
extrudeSolidFromPolygon(eye, sizeof(eye), bodyWidth + 0.2,
EYE_SIDE, EYE_EDGE, EYE_WHOLE);
}
static void
drawDinosaur(void)
{
glPushMatrix();
/* Translate the dinosaur to be at (0,8,0). */
glTranslatef(-8, 0, -bodyWidth / 2);
glTranslatef(0.0, jump, 0.0);
glMaterialfv(GL_FRONT, GL_DIFFUSE, skinColor);
glCallList(BODY_WHOLE);
glTranslatef(0.0, 0.0, bodyWidth);
glCallList(ARM_WHOLE);
glCallList(LEG_WHOLE);
glTranslatef(0.0, 0.0, -bodyWidth - bodyWidth / 4);
glCallList(ARM_WHOLE);
glTranslatef(0.0, 0.0, -bodyWidth / 4);
glCallList(LEG_WHOLE);
glTranslatef(0.0, 0.0, bodyWidth / 2 - 0.1);
glMaterialfv(GL_FRONT, GL_DIFFUSE, eyeColor);
glCallList(EYE_WHOLE);
glPopMatrix();
}
static GLfloat floorVertices[4][3] = {
{ -20.0, 0.0, 20.0 },
{ 20.0, 0.0, 20.0 },
{ 20.0, 0.0, -20.0 },
{ -20.0, 0.0, -20.0 },
};
/* Draw a floor (possibly textured). */
static void
drawFloor(void)
{
glDisable(GL_LIGHTING);
if (useTexture) {
glEnable(GL_TEXTURE_2D);
}
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3fv(floorVertices[0]);
glTexCoord2f(0.0, 16.0);
glVertex3fv(floorVertices[1]);
glTexCoord2f(16.0, 16.0);
glVertex3fv(floorVertices[2]);
glTexCoord2f(16.0, 0.0);
glVertex3fv(floorVertices[3]);
glEnd();
if (useTexture) {
glDisable(GL_TEXTURE_2D);
}
glEnable(GL_LIGHTING);
}
static GLfloat floorPlane[4];
static GLfloat floorShadow[4][4];
static void
redraw(void)
{
int start = 0, end = 0;
if (reportSpeed) {
start = glutGet(GLUT_ELAPSED_TIME);
}
/* Clear; default stencil clears to zero. */
if ((stencilReflection && renderReflection) || (stencilShadow && renderShadow)) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
} else {
/* Avoid clearing stencil when not using it. */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
/* Reposition the light source. */
lightPosition[0] = 12*cos(lightAngle);
lightPosition[1] = lightHeight;
lightPosition[2] = 12*sin(lightAngle);
if (directionalLight) {
lightPosition[3] = 0.0;
} else {
lightPosition[3] = 1.0;
}
shadowMatrix(floorShadow, floorPlane, lightPosition);
glPushMatrix();
/* Perform scene rotations based on user mouse input. */
glRotatef(angle2, 1.0, 0.0, 0.0);
glRotatef(angle, 0.0, 1.0, 0.0);
/* Tell GL new light source position. */
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
if (renderReflection) {
if (stencilReflection) {
/* We can eliminate the visual "artifact" of seeing the "flipped"
dinosaur underneath the floor by using stencil. The idea is
draw the floor without color or depth update but so that
a stencil value of one is where the floor will be. Later when
rendering the dinosaur reflection, we will only update pixels
with a stencil value of 1 to make sure the reflection only
lives on the floor, not below the floor. */
/* Don't update color or depth. */
glDisable(GL_DEPTH_TEST);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
/* Draw 1 into the stencil buffer. */
glEnable(GL_STENCIL_TEST);
glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
glStencilFunc(GL_ALWAYS, 1, 0xffffffff);
/* Now render floor; floor pixels just get their stencil set to 1. */
drawFloor();
/* Re-enable update of color and depth. */
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glEnable(GL_DEPTH_TEST);
/* Now, only render where stencil is set to 1. */
glStencilFunc(GL_EQUAL, 1, 0xffffffff); /* draw if ==1 */
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
}
glPushMatrix();
/* The critical reflection step: Reflect dinosaur through the floor
(the Y=0 plane) to make a relection. */
glScalef(1.0, -1.0, 1.0);
/* Reflect the light position. */
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
/* To avoid our normals getting reversed and hence botched lighting
on the reflection, turn on normalize. */
glEnable(GL_NORMALIZE);
glCullFace(GL_FRONT);
/* Draw the reflected dinosaur. */
drawDinosaur();
/* Disable noramlize again and re-enable back face culling. */
glDisable(GL_NORMALIZE);
glCullFace(GL_BACK);
glPopMatrix();
/* Switch back to the unreflected light position. */
glLightfv(GL_LIGHT0, GL_POSITION, lightPosition);
if (stencilReflection) {
glDisable(GL_STENCIL_TEST);
}
}
/* Back face culling will get used to only draw either the top or the
bottom floor. This let's us get a floor with two distinct
appearances. The top floor surface is reflective and kind of red.
The bottom floor surface is not reflective and blue. */
/* Draw "bottom" of floor in blue. */
glFrontFace(GL_CW); /* Switch face orientation. */
glColor4f(0.1, 0.1, 0.7, 1.0);
drawFloor();
glFrontFace(GL_CCW);
if (renderShadow) {
if (stencilShadow) {
/* Draw the floor with stencil value 3. This helps us only
draw the shadow once per floor pixel (and only on the
floor pixels). */
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS, 3, 0xffffffff);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
}
}
/* Draw "top" of floor. Use blending to blend in reflection. */
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.7, 0.0, 0.0, 0.3);
glColor4f(1.0, 1.0, 1.0, 0.3);
drawFloor();
glDisable(GL_BLEND);
if (renderDinosaur) {
/* Draw "actual" dinosaur, not its reflection. */
drawDinosaur();
}
if (renderShadow) {
/* Render the projected shadow. */
if (stencilShadow) {
/* Now, only render where stencil is set above 2 (ie, 3 where
the top floor is). Update stencil with 2 where the shadow
gets drawn so we don't redraw (and accidently reblend) the
shadow). */
glStencilFunc(GL_LESS, 2, 0xffffffff); /* draw if ==1 */
glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
}
/* To eliminate depth buffer artifacts, we use polygon offset
to raise the depth of the projected shadow slightly so
that it does not depth buffer alias with the floor. */
if (offsetShadow) {
switch (polygonOffsetVersion) {
case EXTENSION:
#ifdef GL_EXT_polygon_offset
glEnable(GL_POLYGON_OFFSET_EXT);
break;
#endif
#ifdef GL_VERSION_1_1
case ONE_DOT_ONE:
glEnable(GL_POLYGON_OFFSET_FILL);
break;
#endif
case MISSING:
/* Oh well. */
break;
}
}
/* Render 50% black shadow color on top of whatever the
floor appareance is. */
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_LIGHTING); /* Force the 50% black. */
glColor4f(0.0, 0.0, 0.0, 0.5);
glPushMatrix();
/* Project the shadow. */
glMultMatrixf((GLfloat *) floorShadow);
drawDinosaur();
glPopMatrix();
glDisable(GL_BLEND);
glEnable(GL_LIGHTING);
if (offsetShadow) {
switch (polygonOffsetVersion) {
#ifdef GL_EXT_polygon_offset
case EXTENSION:
glDisable(GL_POLYGON_OFFSET_EXT);
break;
#endif
#ifdef GL_VERSION_1_1
case ONE_DOT_ONE:
glDisable(GL_POLYGON_OFFSET_FILL);
break;
#endif
case MISSING:
/* Oh well. */
break;
}
}
if (stencilShadow) {
glDisable(GL_STENCIL_TEST);
}
}
glPushMatrix();
glDisable(GL_LIGHTING);
glColor3f(1.0, 1.0, 0.0);
if (directionalLight) {
/* Draw an arrowhead. */
glDisable(GL_CULL_FACE);
glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]);
glRotatef(lightAngle * -180.0 / M_PI, 0, 1, 0);
glRotatef(atan(lightHeight/12) * 180.0 / M_PI, 0, 0, 1);
glBegin(GL_TRIANGLE_FAN);
glVertex3f(0, 0, 0);
glVertex3f(2, 1, 1);
glVertex3f(2, -1, 1);
glVertex3f(2, -1, -1);
glVertex3f(2, 1, -1);
glVertex3f(2, 1, 1);
glEnd();
/* Draw a white line from light direction. */
glColor3f(1.0, 1.0, 1.0);
glBegin(GL_LINES);
glVertex3f(0, 0, 0);
glVertex3f(5, 0, 0);
glEnd();
glEnable(GL_CULL_FACE);
} else {
/* Draw a yellow ball at the light source. */
glTranslatef(lightPosition[0], lightPosition[1], lightPosition[2]);
glutSolidSphere(1.0, 5, 5);
}
glEnable(GL_LIGHTING);
glPopMatrix();
glPopMatrix();
if (reportSpeed) {
glFinish();
end = glutGet(GLUT_ELAPSED_TIME);
printf("Speed %.3g frames/sec (%d ms)\n", 1000.0/(end-start), end-start);
fflush(stdout);
}
glutSwapBuffers();
}
/* ARGSUSED2 */
static void
mouse(int button, int state, int x, int y)
{
if (button == GLUT_LEFT_BUTTON) {
if (state == GLUT_DOWN) {
moving = 1;
startx = x;
starty = y;
}
if (state == GLUT_UP) {
moving = 0;
}
}
if (button == GLUT_MIDDLE_BUTTON) {
if (state == GLUT_DOWN) {
lightMoving = 1;
lightStartX = x;
lightStartY = y;
}
if (state == GLUT_UP) {
lightMoving = 0;
}
}
}
/* ARGSUSED1 */
static void
motion(int x, int y)
{
if (moving) {
angle = angle + (x - startx);
angle2 = angle2 + (y - starty);
startx = x;
starty = y;
glutPostRedisplay();
}
if (lightMoving) {
lightAngle += (x - lightStartX)/40.0;
lightHeight += (lightStartY - y)/20.0;
lightStartX = x;
lightStartY = y;
glutPostRedisplay();
}
}
/* Advance time varying state when idle callback registered. */
static void
idle(void)
{
static float time = 0.0;
time = glutGet(GLUT_ELAPSED_TIME) / 500.0;
jump = 4.0 * fabs(sin(time)*0.5);
if (!lightMoving) {
lightAngle += 0.03;
}
glutPostRedisplay();
}
enum {
M_NONE, M_MOTION, M_LIGHT, M_TEXTURE, M_SHADOWS, M_REFLECTION, M_DINOSAUR,
M_STENCIL_REFLECTION, M_STENCIL_SHADOW, M_OFFSET_SHADOW,
M_POSITIONAL, M_DIRECTIONAL, M_PERFORMANCE
};
static void
controlLights(int value)
{
switch (value) {
case M_NONE:
return;
case M_MOTION:
animation = 1 - animation;
if (animation) {
glutIdleFunc(idle);
} else {
glutIdleFunc(NULL);
}
break;
case M_LIGHT:
lightSwitch = !lightSwitch;
if (lightSwitch) {
glEnable(GL_LIGHT0);
} else {
glDisable(GL_LIGHT0);
}
break;
case M_TEXTURE:
useTexture = !useTexture;
break;
case M_SHADOWS:
renderShadow = 1 - renderShadow;
break;
case M_REFLECTION:
renderReflection = 1 - renderReflection;
break;
case M_DINOSAUR:
renderDinosaur = 1 - renderDinosaur;
break;
case M_STENCIL_REFLECTION:
stencilReflection = 1 - stencilReflection;
break;
case M_STENCIL_SHADOW:
stencilShadow = 1 - stencilShadow;
break;
case M_OFFSET_SHADOW:
offsetShadow = 1 - offsetShadow;
break;
case M_POSITIONAL:
directionalLight = 0;
break;
case M_DIRECTIONAL:
directionalLight = 1;
break;
case M_PERFORMANCE:
reportSpeed = 1 - reportSpeed;
break;
}
glutPostRedisplay();
}
/* When not visible, stop animating. Restart when visible again. */
static void
visible(int vis)
{
if (vis == GLUT_VISIBLE) {
if (animation)
glutIdleFunc(idle);
} else {
if (!animation)
glutIdleFunc(NULL);
}
}
/* Press any key to redraw; good when motion stopped and
performance reporting on. */
/* ARGSUSED */
static void
key(unsigned char c, int x, int y)
{
if (c == 27) {
exit(0); /* IRIS GLism, Escape quits. */
}
glutPostRedisplay();
}
/* Press any key to redraw; good when motion stopped and
performance reporting on. */
/* ARGSUSED */
static void
special(int k, int x, int y)
{
glutPostRedisplay();
}
static int
supportsOneDotOne(void)
{
const char *version;
int major, minor;
version = (char *) glGetString(GL_VERSION);
if (sscanf(version, "%d.%d", &major, &minor) == 2)
return major * 10 + minor >= 11;
return 0; /* OpenGL version string malformed! */
}
int
main(int argc, char **argv)
{
int i;
glutInit(&argc, argv);
for (i=1; i<argc; i++) {
if (!strcmp("-linear", argv[i])) {
linearFiltering = 1;
} else if (!strcmp("-mipmap", argv[i])) {
useMipmaps = 1;
} else if (!strcmp("-ext", argv[i])) {
forceExtension = 1;
}
}
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL);
#if 0
/* In GLUT 4.0, you'll be able to do this an be sure to
get 2 bits of stencil if the machine has it for you. */
glutInitDisplayString("samples stencil>=2 rgb double depth");
#endif
glutCreateWindow("Shadowy Leapin' Lizards");
glewInit();
if (glutGet(GLUT_WINDOW_STENCIL_SIZE) <= 1) {
printf("dinoshade: Sorry, I need at least 2 bits of stencil.\n");
exit(1);
}
/* Register GLUT callbacks. */
glutDisplayFunc(redraw);
glutMouseFunc(mouse);
glutMotionFunc(motion);
glutVisibilityFunc(visible);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutCreateMenu(controlLights);
glutAddMenuEntry("Toggle motion", M_MOTION);
glutAddMenuEntry("-----------------------", M_NONE);
glutAddMenuEntry("Toggle light", M_LIGHT);
glutAddMenuEntry("Toggle texture", M_TEXTURE);
glutAddMenuEntry("Toggle shadows", M_SHADOWS);
glutAddMenuEntry("Toggle reflection", M_REFLECTION);
glutAddMenuEntry("Toggle dinosaur", M_DINOSAUR);
glutAddMenuEntry("-----------------------", M_NONE);
glutAddMenuEntry("Toggle reflection stenciling", M_STENCIL_REFLECTION);
glutAddMenuEntry("Toggle shadow stenciling", M_STENCIL_SHADOW);
glutAddMenuEntry("Toggle shadow offset", M_OFFSET_SHADOW);
glutAddMenuEntry("----------------------", M_NONE);
glutAddMenuEntry("Positional light", M_POSITIONAL);
glutAddMenuEntry("Directional light", M_DIRECTIONAL);
glutAddMenuEntry("-----------------------", M_NONE);
glutAddMenuEntry("Toggle performance", M_PERFORMANCE);
glutAttachMenu(GLUT_RIGHT_BUTTON);
makeDinosaur();
#ifdef GL_VERSION_1_1
if (supportsOneDotOne() && !forceExtension) {
polygonOffsetVersion = ONE_DOT_ONE;
glPolygonOffset(-2.0, -9.0);
} else
#endif
{
#ifdef GL_EXT_polygon_offset
/* check for the polygon offset extension */
if (glutExtensionSupported("GL_EXT_polygon_offset")) {
polygonOffsetVersion = EXTENSION;
glPolygonOffsetEXT(-2.0, -0.002);
} else
#endif
{
polygonOffsetVersion = MISSING;
printf("\ndinoshine: Missing polygon offset.\n");
printf(" Expect shadow depth aliasing artifacts.\n\n");
fflush(stdout);
}
}
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glLineWidth(3.0);
glMatrixMode(GL_PROJECTION);
gluPerspective( /* field of view in degree */ 40.0,
/* aspect ratio */ 1.0,
/* Z near */ 20.0, /* Z far */ 100.0);
glMatrixMode(GL_MODELVIEW);
gluLookAt(0.0, 8.0, 60.0, /* eye is at (0,8,60) */
0.0, 8.0, 0.0, /* center is at (0,8,0) */
0.0, 1.0, 0.); /* up is in postivie Y direction */
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor);
glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.1);
glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.05);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
makeFloorTexture();
/* Setup floor plane for projected shadow calculations. */
findPlane(floorPlane, floorVertices[1], floorVertices[2], floorVertices[3]);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}
-283
View File
@@ -1,283 +0,0 @@
/**
* Dissolve between two images using randomized/patterned stencil buffer
* and varying stencil ref.
*
* Brian Paul
* 29 Jan 2010
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <GL/glut.h>
#include "readtex.h"
#define FILE1 "../images/bw.rgb"
#define FILE2 "../images/arch.rgb"
static int Win;
static int WinWidth = 400, WinHeight = 400;
static GLboolean Anim = GL_TRUE;
static int ImgWidth[2], ImgHeight[2];
static GLenum ImgFormat[2];
static GLubyte *Image[2];
static GLfloat ScaleX[2], ScaleY[2];
static GLubyte StencilRef = 0;
static int Mode = 0;
static void
Idle(void)
{
StencilRef = (GLint) (glutGet(GLUT_ELAPSED_TIME) / 10);
glutPostRedisplay();
}
static void
FillRandomPixels(GLubyte *b)
{
int i;
for (i = 0; i < WinWidth * WinHeight; i++) {
b[i] = rand() & 0xff;
}
}
static void
FillRandomRects(GLubyte *b)
{
int i;
memset(b, 0, WinWidth * WinHeight);
for (i = 0; i < 256; i++) {
int x = rand() % WinWidth;
int y = rand() % WinHeight;
int w = rand() % 60;
int h = rand() % 60;
int ix, iy;
if (x + w > WinWidth)
w = WinWidth - x;
if (y + h > WinHeight)
h = WinHeight - y;
for (iy = 0; iy < h; iy++) {
for (ix = 0; ix < w; ix++) {
int p = (y + iy) * WinWidth + x + ix;
b[p] = i;
}
}
}
}
static void
FillWipe(GLubyte *b)
{
int iy, ix;
memset(b, 0, WinWidth * WinHeight);
for (iy = 0; iy < WinHeight; iy++) {
for (ix = 0; ix < WinWidth; ix++) {
int p = iy * WinWidth + ix;
b[p] = 2 * ix + iy / 2;
}
}
}
static void
FillMoire(GLubyte *b)
{
int iy, ix;
memset(b, 0, WinWidth * WinHeight);
for (iy = 0; iy < WinHeight; iy++) {
for (ix = 0; ix < WinWidth; ix++) {
int p = iy * WinWidth + ix;
b[p] = (ix / 2) * (ix / 2) - (iy / 2) * (iy / 2);
}
}
}
static void
FillWaves(GLubyte *b)
{
int iy, ix;
memset(b, 0, WinWidth * WinHeight);
for (iy = 0; iy < WinHeight; iy++) {
for (ix = 0; ix < WinWidth; ix++) {
int p = iy * WinWidth + ix;
float x = 8.0 * 3.1415 * ix / (float) WinWidth;
b[p] = (int) (25.0 * sin(x) ) - iy*2;
}
}
}
typedef void (*FillFunc)(GLubyte *b);
static FillFunc Funcs[] = {
FillRandomPixels,
FillRandomRects,
FillWipe,
FillMoire,
FillWaves
};
#define NUM_MODES (sizeof(Funcs) / sizeof(Funcs[0]))
static void
InitStencilBuffer(void)
{
GLubyte *b = malloc(WinWidth * WinHeight);
Funcs[Mode](b);
glStencilFunc(GL_ALWAYS, 0, ~0);
glPixelZoom(1.0, 1.0);
glDrawPixels(WinWidth, WinHeight, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, b);
free(b);
}
static void
Draw(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glPixelZoom(ScaleX[0], ScaleY[0]);
glStencilFunc(GL_LESS, StencilRef, ~0);
glDrawPixels(ImgWidth[0], ImgHeight[0], ImgFormat[0], GL_UNSIGNED_BYTE, Image[0]);
glPixelZoom(ScaleX[1], ScaleY[1]);
glStencilFunc(GL_GEQUAL, StencilRef, ~0);
glDrawPixels(ImgWidth[1], ImgHeight[1], ImgFormat[1], GL_UNSIGNED_BYTE, Image[1]);
glutSwapBuffers();
}
static void
Reshape(int width, int height)
{
WinWidth = width;
WinHeight = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -15.0);
InitStencilBuffer();
ScaleX[0] = (float) width / ImgWidth[0];
ScaleY[0] = (float) height / ImgHeight[0];
ScaleX[1] = (float) width / ImgWidth[1];
ScaleY[1] = (float) height / ImgHeight[1];
}
static void
Key(unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch (key) {
case 'a':
case ' ':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
case 'i':
InitStencilBuffer();
break;
case '-':
StencilRef--;
break;
case '+':
StencilRef++;
break;
case 'm':
Mode = (Mode + 1) % NUM_MODES;
InitStencilBuffer();
break;
case 27:
glutDestroyWindow(Win);
exit(0);
break;
}
glutPostRedisplay();
}
static void
Init(void)
{
Image[0] = LoadRGBImage(FILE1, &ImgWidth[0], &ImgHeight[0], &ImgFormat[0]);
if (!Image[0]) {
printf("Couldn't read %s\n", FILE1);
exit(0);
}
Image[1] = LoadRGBImage(FILE2, &ImgWidth[1], &ImgHeight[1], &ImgFormat[1]);
if (!Image[1]) {
printf("Couldn't read %s\n", FILE2);
exit(0);
}
glEnable(GL_STENCIL_TEST);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
}
int
main(int argc, char *argv[])
{
glutInitWindowSize(WinWidth, WinHeight);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL);
Win = glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Draw);
if (Anim)
glutIdleFunc(Idle);
Init();
printf("Keys:\n");
printf(" a/SPACE toggle animation\n");
printf(" +/- single step\n");
printf(" i re-init pattern\n");
printf(" m change pattern/dissolve mode\n");
printf(" ESC exit\n");
glutMainLoop();
return 0;
}
-359
View File
@@ -1,359 +0,0 @@
/*
* glDrawPixels demo/test/benchmark
*
* Brian Paul September 25, 1997 This file is in the public domain.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <GL/glut.h>
#include "readtex.h"
#define IMAGE_FILE "../images/girl.rgb"
static int ImgWidth, ImgHeight;
static GLenum ImgFormat;
static GLubyte *Image = NULL;
static int Xpos, Ypos;
static int SkipPixels, SkipRows;
static int DrawWidth, DrawHeight;
static int Scissor = 0;
static int Fog = 0;
static GLfloat Zpos = -1.0;
static float Xzoom, Yzoom;
static GLboolean DrawFront = GL_FALSE;
static GLboolean Dither = GL_TRUE;
static int win = 0;
static void Reset( void )
{
Xpos = Ypos = 20;
DrawWidth = ImgWidth;
DrawHeight = ImgHeight;
SkipPixels = SkipRows = 0;
Scissor = 0;
Fog = 0;
Zpos = -1.0;
Xzoom = Yzoom = 1.0;
}
static void Display( void )
{
glClear( GL_COLOR_BUFFER_BIT );
#if 0
glRasterPos2i(Xpos, Ypos);
#else
/* This allows negative raster positions: */
glRasterPos3f(0, 0, Zpos);
glBitmap(0, 0, 0, 0, Xpos, Ypos, NULL);
#endif
glPixelStorei(GL_UNPACK_SKIP_PIXELS, SkipPixels);
glPixelStorei(GL_UNPACK_SKIP_ROWS, SkipRows);
glPixelZoom( Xzoom, Yzoom );
if (Scissor)
glEnable(GL_SCISSOR_TEST);
if (Fog)
glEnable(GL_FOG);
glDrawPixels(DrawWidth, DrawHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
glDisable(GL_SCISSOR_TEST);
glDisable(GL_FOG);
if (DrawFront)
glFinish();
else
glutSwapBuffers();
}
static void Benchmark( void )
{
int startTime, endTime;
int draws = 500;
double seconds, pixelsPerSecond;
printf("Benchmarking...\n");
/* GL set-up */
glPixelStorei(GL_UNPACK_SKIP_PIXELS, SkipPixels);
glPixelStorei(GL_UNPACK_SKIP_ROWS, SkipRows);
glPixelZoom( Xzoom, Yzoom );
if (Scissor)
glEnable(GL_SCISSOR_TEST);
if (Fog)
glEnable(GL_FOG);
if (DrawFront)
glDrawBuffer(GL_FRONT);
else
glDrawBuffer(GL_BACK);
/* Run timing test */
draws = 0;
startTime = glutGet(GLUT_ELAPSED_TIME);
do {
glDrawPixels(DrawWidth, DrawHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
draws++;
endTime = glutGet(GLUT_ELAPSED_TIME);
} while (endTime - startTime < 4000); /* 4 seconds */
/* GL clean-up */
glDisable(GL_SCISSOR_TEST);
glDisable(GL_FOG);
/* Results */
seconds = (double) (endTime - startTime) / 1000.0;
pixelsPerSecond = draws * DrawWidth * DrawHeight / seconds;
printf("Result: %d draws in %f seconds = %f pixels/sec\n",
draws, seconds, pixelsPerSecond);
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( 0.0, width, 0.0, height, 0.0, 2.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glScissor(width/4, height/4, width/2, height/2);
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case ' ':
Reset();
break;
case 'd':
Dither = !Dither;
if (Dither)
glEnable(GL_DITHER);
else
glDisable(GL_DITHER);
break;
case 'w':
if (DrawWidth > 0)
DrawWidth--;
break;
case 'W':
DrawWidth++;
break;
case 'h':
if (DrawHeight > 0)
DrawHeight--;
break;
case 'H':
DrawHeight++;
break;
case 'p':
if (SkipPixels > 0)
SkipPixels--;
break;
case 'P':
SkipPixels++;
break;
case 'r':
if (SkipRows > 0)
SkipRows--;
break;
case 'R':
SkipRows++;
break;
case 's':
Scissor = !Scissor;
break;
case 'x':
Xzoom -= 0.1;
break;
case 'X':
Xzoom += 0.1;
break;
case 'y':
Yzoom -= 0.1;
break;
case 'Y':
Yzoom += 0.1;
break;
case 'z':
Zpos -= 0.1;
printf("RasterPos Z = %g\n", Zpos);
break;
case 'Z':
Zpos += 0.1;
printf("RasterPos Z = %g\n", Zpos);
break;
case 'b':
Benchmark();
break;
case 'F':
Fog = !Fog;
printf("Fog %d\n", Fog);
break;
case 'f':
DrawFront = !DrawFront;
if (DrawFront)
glDrawBuffer(GL_FRONT);
else
glDrawBuffer(GL_BACK);
printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK");
break;
case 27:
glutDestroyWindow(win);
exit(0);
break;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
Ypos += 1;
break;
case GLUT_KEY_DOWN:
Ypos -= 1;
break;
case GLUT_KEY_LEFT:
Xpos -= 1;
break;
case GLUT_KEY_RIGHT:
Xpos += 1;
break;
}
glutPostRedisplay();
}
static void Init( GLboolean ciMode, const char *filename )
{
static const GLfloat fogColor[4] = {0, 1, 0, 0};
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
Image = LoadRGBImage( filename, &ImgWidth, &ImgHeight, &ImgFormat );
if (!Image) {
printf("Couldn't read %s\n", filename);
exit(0);
}
if (ciMode) {
/* Convert RGB image to grayscale */
GLubyte *indexImage = (GLubyte *) malloc( ImgWidth * ImgHeight );
GLint i;
for (i=0; i<ImgWidth*ImgHeight; i++) {
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];
indexImage[i] = gray / 3;
}
free(Image);
Image = indexImage;
ImgFormat = GL_COLOR_INDEX;
for (i=0;i<255;i++) {
float g = i / 255.0;
glutSetColor(i, g, g, g);
}
}
printf("Loaded %d by %d image\n", ImgWidth, ImgHeight );
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth);
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogf(GL_FOG_START, 0);
glFogf(GL_FOG_END, 2);
glFogfv(GL_FOG_COLOR, fogColor);
Reset();
}
static void Usage(void)
{
printf("Keys:\n");
printf(" SPACE Reset Parameters\n");
printf(" Up/Down Move image up/down\n");
printf(" Left/Right Move image left/right\n");
printf(" x Decrease X-axis PixelZoom\n");
printf(" X Increase X-axis PixelZoom\n");
printf(" y Decrease Y-axis PixelZoom\n");
printf(" Y Increase Y-axis PixelZoom\n");
printf(" w Decrease glDrawPixels width*\n");
printf(" W Increase glDrawPixels width*\n");
printf(" h Decrease glDrawPixels height*\n");
printf(" H Increase glDrawPixels height*\n");
printf(" p Decrease GL_UNPACK_SKIP_PIXELS*\n");
printf(" P Increase GL_UNPACK_SKIP_PIXELS*\n");
printf(" r Decrease GL_UNPACK_SKIP_ROWS*\n");
printf(" R Increase GL_UNPACK_SKIP_ROWS*\n");
printf(" s Toggle GL_SCISSOR_TEST\n");
printf(" F Toggle GL_FOG\n");
printf(" z Decrease RasterPos Z\n");
printf(" Z Increase RasterPos Z\n");
printf(" f Toggle front/back buffer drawing\n");
printf(" b Benchmark test\n");
printf(" ESC Exit\n");
printf("* Warning: no limits are imposed on these parameters so it's\n");
printf(" possible to cause a segfault if you go too far.\n");
}
int main( int argc, char *argv[] )
{
GLboolean ciMode = GL_FALSE;
const char *filename = IMAGE_FILE;
int i = 1;
glutInitWindowSize( 500, 400 );
glutInit( &argc, argv );
if (argc > i && strcmp(argv[i], "-ci")==0) {
ciMode = GL_TRUE;
i++;
}
if (argc > i) {
filename = argv[i];
}
if (ciMode)
glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE );
else
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
win = glutCreateWindow(argv[0]);
Init(ciMode, filename);
Usage();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
glutMainLoop();
return 0;
}
-1343
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-672
View File
@@ -1,672 +0,0 @@
/*
* Test GL_EXT_framebuffer_object render-to-texture
*
* Draw a teapot into a texture image with stenciling.
* Then draw a textured quad using that texture.
*
* Brian Paul
* 18 Apr 2005
*/
#include <GL/glut.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "extfuncs.h"
/* For debug */
#define DEPTH 1
#define STENCIL 1
#define DRAW 1
static int Win = 0;
static int Width = 400, Height = 400;
#if 1
static GLenum TexTarget = GL_TEXTURE_2D;
static int TexWidth = 512, TexHeight = 512;
static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */
#else
static GLenum TexTarget = GL_TEXTURE_RECTANGLE_ARB;
static int TexWidth = 200, TexHeight = 200;
static GLenum TexIntFormat = GL_RGB5; /* either GL_RGB or GL_RGBA */
#endif
static GLuint TextureLevel = 0; /* which texture level to render to */
static GLuint MyFB;
static GLuint TexObj;
static GLuint DepthRB = 0, StencilRB = 0;
static GLboolean Anim = GL_FALSE;
static GLfloat Rot = 0.0;
static GLboolean UsePackedDepthStencil = GL_FALSE;
static GLboolean UsePackedDepthStencilBoth = GL_FALSE;
static GLboolean Use_ARB_fbo = GL_FALSE;
static GLboolean Cull = GL_FALSE;
static GLboolean Wireframe = GL_FALSE;
static void
CheckError(int line)
{
GLenum err = glGetError();
if (err) {
printf("GL Error 0x%x at line %d\n", (int) err, line);
}
}
static void
Idle(void)
{
Rot = glutGet(GLUT_ELAPSED_TIME) * 0.1;
glutPostRedisplay();
}
static void
RenderTexture(void)
{
GLenum status;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -15.0);
/* draw to texture image */
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, MyFB);
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
printf("Framebuffer incomplete!!!\n");
}
glViewport(0, 0, TexWidth, TexHeight);
glClearColor(0.5, 0.5, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
CheckError(__LINE__);
#if DEPTH
glEnable(GL_DEPTH_TEST);
#endif
#if STENCIL
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_NEVER, 1, ~0);
glStencilOp(GL_REPLACE, GL_KEEP, GL_REPLACE);
#endif
CheckError(__LINE__);
#if DEPTH || STENCIL
/* draw diamond-shaped stencil pattern */
glColor3f(0, 1, 0);
glBegin(GL_POLYGON);
glVertex2f(-0.2, 0.0);
glVertex2f( 0.0, -0.2);
glVertex2f( 0.2, 0.0);
glVertex2f( 0.0, 0.2);
glEnd();
#endif
/* draw teapot where stencil != 1 */
#if STENCIL
glStencilFunc(GL_NOTEQUAL, 1, ~0);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
#endif
CheckError(__LINE__);
if (Wireframe) {
glPolygonMode(GL_FRONT, GL_LINE);
}
else {
glPolygonMode(GL_FRONT, GL_FILL);
}
if (Cull) {
/* cull back */
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
}
else {
glDisable(GL_CULL_FACE);
}
#if 0
glBegin(GL_POLYGON);
glColor3f(1, 0, 0);
glVertex2f(-1, -1);
glColor3f(0, 1, 0);
glVertex2f(1, -1);
glColor3f(0, 0, 1);
glVertex2f(0, 1);
glEnd();
#else
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glPushMatrix();
glRotatef(0.5 * Rot, 1.0, 0.0, 0.0);
glFrontFace(GL_CW); /* Teapot patches backward */
glutSolidTeapot(0.5);
glFrontFace(GL_CCW);
glPopMatrix();
glDisable(GL_LIGHTING);
/*
PrintStencilHistogram(TexWidth, TexHeight);
*/
#endif
glDisable(GL_DEPTH_TEST);
glDisable(GL_STENCIL_TEST);
glDisable(GL_CULL_FACE);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
#if DRAW
/* Bind normal framebuffer */
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, 0);
#endif
CheckError(__LINE__);
}
static void
Display(void)
{
float ar = (float) Width / (float) Height;
RenderTexture();
/* draw textured quad in the window */
#if DRAW
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -7.0);
glViewport(0, 0, Width, Height);
glClearColor(0.25, 0.25, 0.25, 0);
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glRotatef(Rot, 0, 1, 0);
glEnable(TexTarget);
glBindTexture(TexTarget, TexObj);
glBegin(GL_POLYGON);
glColor3f(0.25, 0.25, 0.25);
if (TexTarget == GL_TEXTURE_2D) {
glTexCoord2f(0, 0);
glVertex2f(-1, -1);
glTexCoord2f(1, 0);
glVertex2f(1, -1);
glColor3f(1.0, 1.0, 1.0);
glTexCoord2f(1, 1);
glVertex2f(1, 1);
glTexCoord2f(0, 1);
glVertex2f(-1, 1);
}
else {
assert(TexTarget == GL_TEXTURE_RECTANGLE_ARB);
glTexCoord2f(0, 0);
glVertex2f(-1, -1);
glTexCoord2f(TexWidth, 0);
glVertex2f(1, -1);
glColor3f(1.0, 1.0, 1.0);
glTexCoord2f(TexWidth, TexHeight);
glVertex2f(1, 1);
glTexCoord2f(0, TexHeight);
glVertex2f(-1, 1);
}
glEnd();
glPopMatrix();
glDisable(TexTarget);
#endif
glutSwapBuffers();
CheckError(__LINE__);
}
static void
Reshape(int width, int height)
{
glViewport(0, 0, width, height);
Width = width;
Height = height;
}
static void
CleanUp(void)
{
#if DEPTH
glDeleteRenderbuffers_func(1, &DepthRB);
#endif
#if STENCIL
glDeleteRenderbuffers_func(1, &StencilRB);
#endif
glDeleteFramebuffers_func(1, &MyFB);
glDeleteTextures(1, &TexObj);
glutDestroyWindow(Win);
exit(0);
}
static void
Key(unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch (key) {
case 'a':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
case 'c':
Cull = !Cull;
break;
case 'w':
Wireframe = !Wireframe;
break;
case 's':
Rot += 2.0;
break;
case 'S':
Rot -= 2.0;
break;
case 27:
CleanUp();
break;
}
glutPostRedisplay();
}
/**
* Attach depth and stencil renderbuffer(s) to the given framebuffer object.
* \param tryDepthStencil if true, try to use a combined depth+stencil buffer
* \param bindDepthStencil if true, and tryDepthStencil is true, bind with
* the GL_DEPTH_STENCIL_ATTACHMENT target.
* \return GL_TRUE for success, GL_FALSE for failure
*/
static GLboolean
AttachDepthAndStencilBuffers(GLuint fbo,
GLsizei width, GLsizei height,
GLboolean tryDepthStencil,
GLboolean bindDepthStencil,
GLuint *depthRbOut, GLuint *stencilRbOut)
{
GLenum status;
*depthRbOut = *stencilRbOut = 0;
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, fbo);
if (tryDepthStencil) {
GLuint rb;
glGenRenderbuffers_func(1, &rb);
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
GL_DEPTH24_STENCIL8_EXT,
width, height);
if (glGetError())
return GL_FALSE;
if (bindDepthStencil) {
/* attach to both depth and stencil at once */
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_DEPTH_STENCIL_ATTACHMENT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
return GL_FALSE;
}
else {
/* attach to depth attachment point */
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
return GL_FALSE;
/* and attach to stencil attachment point */
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_STENCIL_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
return GL_FALSE;
}
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
return GL_FALSE;
*depthRbOut = *stencilRbOut = rb;
return GL_TRUE;
}
/* just depth renderbuffer */
{
GLuint rb;
glGenRenderbuffers_func(1, &rb);
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
GL_DEPTH_COMPONENT,
width, height);
if (glGetError())
return GL_FALSE;
/* attach to depth attachment point */
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
return GL_FALSE;
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
return GL_FALSE;
*depthRbOut = rb;
}
/* just stencil renderbuffer */
{
GLuint rb;
glGenRenderbuffers_func(1, &rb);
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
GL_STENCIL_INDEX,
width, height);
if (glGetError())
return GL_FALSE;
/* attach to depth attachment point */
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
GL_STENCIL_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, rb);
if (glGetError())
return GL_FALSE;
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
glDeleteRenderbuffers_func(1, depthRbOut);
*depthRbOut = 0;
glDeleteRenderbuffers_func(1, &rb);
return GL_FALSE;
}
*stencilRbOut = rb;
}
return GL_TRUE;
}
static void
ParseArgs(int argc, char *argv[])
{
GLint i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-ds") == 0) {
if (!glutExtensionSupported("GL_EXT_packed_depth_stencil")) {
printf("GL_EXT_packed_depth_stencil not found!\n");
exit(0);
}
UsePackedDepthStencil = GL_TRUE;
printf("Using GL_EXT_packed_depth_stencil\n");
}
else if (strcmp(argv[i], "-ds2") == 0) {
if (!glutExtensionSupported("GL_EXT_packed_depth_stencil")) {
printf("GL_EXT_packed_depth_stencil not found!\n");
exit(0);
}
if (!glutExtensionSupported("GL_ARB_framebuffer_object")) {
printf("GL_ARB_framebuffer_object not found!\n");
exit(0);
}
UsePackedDepthStencilBoth = GL_TRUE;
printf("Using GL_EXT_packed_depth_stencil and GL_DEPTH_STENCIL attachment point\n");
}
else if (strcmp(argv[i], "-arb") == 0) {
if (!glutExtensionSupported("GL_ARB_framebuffer_object")) {
printf("Sorry, GL_ARB_framebuffer object not supported!\n");
}
else {
Use_ARB_fbo = GL_TRUE;
}
}
else {
printf("Unknown option: %s\n", argv[i]);
}
}
}
static void
SetupFunctionPointers(void)
{
GetExtensionFuncs();
if (Use_ARB_fbo) {
/* no-op: use the ARB functions as-is */
}
else {
/* set the ARB-flavor function pointers to point to the EXT functions */
glIsRenderbuffer_func = glIsRenderbufferEXT_func;
glBindRenderbuffer_func = glBindRenderbufferEXT_func;
glDeleteRenderbuffers_func = glDeleteRenderbuffersEXT_func;
glGenRenderbuffers_func = glGenRenderbuffersEXT_func;
glRenderbufferStorage_func = glRenderbufferStorageEXT_func;
glGetRenderbufferParameteriv_func = glGetRenderbufferParameterivEXT_func;
glIsFramebuffer_func = glIsFramebufferEXT_func;
glBindFramebuffer_func = glBindFramebufferEXT_func;
glDeleteFramebuffers_func = glDeleteFramebuffersEXT_func;
glGenFramebuffers_func = glGenFramebuffersEXT_func;
glCheckFramebufferStatus_func = glCheckFramebufferStatusEXT_func;
glFramebufferTexture1D_func = glFramebufferTexture1DEXT_func;
glFramebufferTexture2D_func = glFramebufferTexture2DEXT_func;
glFramebufferTexture3D_func = glFramebufferTexture3DEXT_func;
glFramebufferRenderbuffer_func = glFramebufferRenderbufferEXT_func;
glGetFramebufferAttachmentParameteriv_func = glGetFramebufferAttachmentParameterivEXT_func;
glGenerateMipmap_func = glGenerateMipmapEXT_func;
}
}
/*
* Make FBO to render into given texture.
*/
static GLuint
MakeFBO_RenderTexture(GLuint texObj)
{
GLuint fb;
GLint sizeFudge = 0;
glGenFramebuffers_func(1, &fb);
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, fb);
/* Render color to texture */
glFramebufferTexture2D_func(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
TexTarget, texObj, TextureLevel);
if (Use_ARB_fbo) {
/* use a smaller depth buffer to see what happens */
sizeFudge = 90;
}
/* Setup depth and stencil buffers */
{
GLboolean b;
b = AttachDepthAndStencilBuffers(fb,
TexWidth - sizeFudge,
TexHeight - sizeFudge,
UsePackedDepthStencil,
UsePackedDepthStencilBoth,
&DepthRB, &StencilRB);
if (!b) {
/* try !UsePackedDepthStencil */
b = AttachDepthAndStencilBuffers(fb,
TexWidth - sizeFudge,
TexHeight - sizeFudge,
!UsePackedDepthStencil,
UsePackedDepthStencilBoth,
&DepthRB, &StencilRB);
}
if (!b) {
printf("Unable to create/attach depth and stencil renderbuffers "
" to FBO!\n");
exit(1);
}
}
/* queries */
{
GLint bits, w, h, name;
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, DepthRB);
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_WIDTH_EXT, &w);
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_HEIGHT_EXT, &h);
printf("Color/Texture size: %d x %d\n", TexWidth, TexHeight);
printf("Depth buffer size: %d x %d\n", w, h);
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_DEPTH_SIZE_EXT, &bits);
printf("Depth renderbuffer size = %d bits\n", bits);
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, StencilRB);
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_STENCIL_SIZE_EXT, &bits);
printf("Stencil renderbuffer size = %d bits\n", bits);
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0,
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
&name);
printf("Render to texture name: %d\n", texObj);
printf("Color attachment[0] name: %d\n", name);
assert(texObj == name);
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
GL_STENCIL_ATTACHMENT,
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
&name);
printf("Stencil attachment name: %d\n", name);
glGetFramebufferAttachmentParameteriv_func(GL_FRAMEBUFFER_EXT,
GL_DEPTH_ATTACHMENT,
GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT,
&name);
printf("Depth attachment name: %d\n", name);
}
/* bind the regular framebuffer */
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, 0);
return fb;
}
static void
Init(void)
{
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
printf("GL_EXT_framebuffer_object not found!\n");
exit(0);
}
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
SetupFunctionPointers();
/* lighting */
{
static const GLfloat mat[4] = { 1.0, 0.5, 0.5, 1.0 };
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat);
}
/*
* Make texture object/image (we'll render into this texture)
*/
{
glGenTextures(1, &TexObj);
glBindTexture(TexTarget, TexObj);
/* make two image levels */
glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
if (TexTarget == GL_TEXTURE_2D) {
glTexImage2D(TexTarget, 1, TexIntFormat, TexWidth/2, TexHeight/2, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
TexWidth = TexWidth >> TextureLevel;
TexHeight = TexHeight >> TextureLevel;
glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel);
}
glTexParameteri(TexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(TexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(TexTarget, GL_TEXTURE_BASE_LEVEL, TextureLevel);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
MyFB = MakeFBO_RenderTexture(TexObj);
}
static void
Usage(void)
{
printf("Usage:\n");
printf(" -ds Use combined depth/stencil renderbuffer\n");
printf(" -arb Try GL_ARB_framebuffer_object's mismatched buffer sizes\n");
printf(" -ds2 Try GL_ARB_framebuffer_object's GL_DEPTH_STENCIL_ATTACHMENT\n");
printf("Keys:\n");
printf(" a Toggle animation\n");
printf(" s/s Step/rotate\n");
printf(" c Toggle back-face culling\n");
printf(" w Toggle wireframe mode (front-face only)\n");
printf(" Esc Exit\n");
}
int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowPosition(0, 0);
glutInitWindowSize(Width, Height);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
Win = glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutDisplayFunc(Display);
if (Anim)
glutIdleFunc(Idle);
ParseArgs(argc, argv);
Init();
Usage();
glutMainLoop();
return 0;
}
-784
View File
@@ -1,784 +0,0 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (tech.hmw@plus.it)
* Humanware s.r.l.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#ifdef WIN32
#include <windows.h>
#include <mmsystem.h>
#endif
#include <GL/glut.h>
#include "readtex.h"
#ifdef XMESA
#include "GL/xmesa.h"
static int fullscreen = 1;
#endif
#ifndef M_PI
#define M_PI 3.1415926535
#endif
#define vinit(a,i,j,k) {\
(a)[0]=i;\
(a)[1]=j;\
(a)[2]=k;\
}
#define vinit4(a,i,j,k,w) {\
(a)[0]=i;\
(a)[1]=j;\
(a)[2]=k;\
(a)[3]=w;\
}
#define vadds(a,dt,b) {\
(a)[0]+=(dt)*(b)[0];\
(a)[1]+=(dt)*(b)[1];\
(a)[2]+=(dt)*(b)[2];\
}
#define vequ(a,b) {\
(a)[0]=(b)[0];\
(a)[1]=(b)[1];\
(a)[2]=(b)[2];\
}
#define vinter(a,dt,b,c) {\
(a)[0]=(dt)*(b)[0]+(1.0-dt)*(c)[0];\
(a)[1]=(dt)*(b)[1]+(1.0-dt)*(c)[1];\
(a)[2]=(dt)*(b)[2]+(1.0-dt)*(c)[2];\
}
#define clamp(a) ((a) < 0.0 ? 0.0 : ((a) < 1.0 ? (a) : 1.0))
#define vclamp(v) {\
(v)[0]=clamp((v)[0]);\
(v)[1]=clamp((v)[1]);\
(v)[2]=clamp((v)[2]);\
}
static int WIDTH = 640;
static int HEIGHT = 480;
static GLint T0 = 0;
static GLint Frames = 0;
static GLint NiceFog = 1;
#define DIMP 20.0
#define DIMTP 16.0
#define RIDCOL 0.4
#define NUMTREE 50
#define TREEINR 2.5
#define TREEOUTR 8.0
#define AGRAV -9.8
typedef struct
{
int age;
float p[3][3];
float v[3];
float c[3][4];
}
part;
static float treepos[NUMTREE][3];
static float black[3] = { 0.0, 0.0, 0.0 };
static float blu[3] = { 1.0, 0.2, 0.0 };
static float blu2[3] = { 1.0, 1.0, 0.0 };
static float fogcolor[4] = { 1.0, 1.0, 1.0, 1.0 };
static float q[4][3] = {
{-DIMP, 0.0, -DIMP},
{DIMP, 0.0, -DIMP},
{DIMP, 0.0, DIMP},
{-DIMP, 0.0, DIMP}
};
static float qt[4][2] = {
{-DIMTP, -DIMTP},
{DIMTP, -DIMTP},
{DIMTP, DIMTP},
{-DIMTP, DIMTP}
};
static int win = 0;
static int np;
static float eject_r, dt, maxage, eject_vy, eject_vl;
static short shadows;
static float ridtri;
static int fog = 1;
static int help = 1;
static int joyavailable = 0;
static int joyactive = 0;
static part *p;
static GLuint groundid;
static GLuint treeid;
static float obs[3] = { 2.0, 1.0, 0.0 };
static float dir[3];
static float v = 0.0;
static float alpha = -84.0;
static float beta = 90.0;
static float
vrnd(void)
{
return (((float) rand()) / RAND_MAX);
}
static void
setnewpart(part * p)
{
float a, v[3], *c;
p->age = 0;
a = vrnd() * 3.14159265359 * 2.0;
vinit(v, sin(a) * eject_r * vrnd(), 0.15, cos(a) * eject_r * vrnd());
vinit(p->p[0], v[0] + vrnd() * ridtri, v[1] + vrnd() * ridtri,
v[2] + vrnd() * ridtri);
vinit(p->p[1], v[0] + vrnd() * ridtri, v[1] + vrnd() * ridtri,
v[2] + vrnd() * ridtri);
vinit(p->p[2], v[0] + vrnd() * ridtri, v[1] + vrnd() * ridtri,
v[2] + vrnd() * ridtri);
vinit(p->v, v[0] * eject_vl / (eject_r / 2),
vrnd() * eject_vy + eject_vy / 2, v[2] * eject_vl / (eject_r / 2));
c = blu;
vinit4(p->c[0], c[0] * ((1.0 - RIDCOL) + vrnd() * RIDCOL),
c[1] * ((1.0 - RIDCOL) + vrnd() * RIDCOL),
c[2] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), 1.0);
vinit4(p->c[1], c[0] * ((1.0 - RIDCOL) + vrnd() * RIDCOL),
c[1] * ((1.0 - RIDCOL) + vrnd() * RIDCOL),
c[2] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), 1.0);
vinit4(p->c[2], c[0] * ((1.0 - RIDCOL) + vrnd() * RIDCOL),
c[1] * ((1.0 - RIDCOL) + vrnd() * RIDCOL),
c[2] * ((1.0 - RIDCOL) + vrnd() * RIDCOL), 1.0);
}
static void
setpart(part * p)
{
float fact;
if (p->p[0][1] < 0.1) {
setnewpart(p);
return;
}
p->v[1] += AGRAV * dt;
vadds(p->p[0], dt, p->v);
vadds(p->p[1], dt, p->v);
vadds(p->p[2], dt, p->v);
p->age++;
if ((p->age) > maxage) {
vequ(p->c[0], blu2);
vequ(p->c[1], blu2);
vequ(p->c[2], blu2);
}
else {
fact = 1.0 / maxage;
vadds(p->c[0], fact, blu2);
vclamp(p->c[0]);
p->c[0][3] = fact * (maxage - p->age);
vadds(p->c[1], fact, blu2);
vclamp(p->c[1]);
p->c[1][3] = fact * (maxage - p->age);
vadds(p->c[2], fact, blu2);
vclamp(p->c[2]);
p->c[2][3] = fact * (maxage - p->age);
}
}
static void
drawtree(float x, float y, float z)
{
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3f(x - 1.5, y + 0.0, z);
glTexCoord2f(1.0, 0.0);
glVertex3f(x + 1.5, y + 0.0, z);
glTexCoord2f(1.0, 1.0);
glVertex3f(x + 1.5, y + 3.0, z);
glTexCoord2f(0.0, 1.0);
glVertex3f(x - 1.5, y + 3.0, z);
glTexCoord2f(0.0, 0.0);
glVertex3f(x, y + 0.0, z - 1.5);
glTexCoord2f(1.0, 0.0);
glVertex3f(x, y + 0.0, z + 1.5);
glTexCoord2f(1.0, 1.0);
glVertex3f(x, y + 3.0, z + 1.5);
glTexCoord2f(0.0, 1.0);
glVertex3f(x, y + 3.0, z - 1.5);
glEnd();
}
static void
calcposobs(void)
{
dir[0] = sin(alpha * M_PI / 180.0);
dir[2] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0);
dir[1] = cos(beta * M_PI / 180.0);
if (dir[0] < 1.0e-5 && dir[0] > -1.0e-5)
dir[0] = 0;
if (dir[1] < 1.0e-5 && dir[1] > -1.0e-5)
dir[1] = 0;
if (dir[2] < 1.0e-5 && dir[2] > -1.0e-5)
dir[2] = 0;
obs[0] += v * dir[0];
obs[1] += v * dir[1];
obs[2] += v * dir[2];
}
static void
printstring(void *font, char *string)
{
int len, i;
len = (int) strlen(string);
for (i = 0; i < len; i++)
glutBitmapCharacter(font, string[i]);
}
static void
reshape(int width, int height)
{
WIDTH = width;
HEIGHT = height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(70.0, width / (float) height, 0.1, 30.0);
glMatrixMode(GL_MODELVIEW);
}
static void
printhelp(void)
{
glColor4f(0.0, 0.0, 0.0, 0.5);
glRecti(40, 40, 600, 440);
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(300, 420);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help");
glRasterPos2i(60, 360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Increase particle size");
glRasterPos2i(60, 330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "T - Decrease particle size");
glRasterPos2i(60, 300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "r - Increase emission radius");
glRasterPos2i(60, 270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "R - Decrease emission radius");
glRasterPos2i(60, 240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog");
glRasterPos2i(60, 210);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "s - Toggle shadows");
glRasterPos2i(60, 180);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate");
glRasterPos2i(60, 150);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity");
glRasterPos2i(60, 120);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity");
glRasterPos2i(60, 90);
if (joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"j - Toggle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"(No Joystick control available)");
}
static void
dojoy(void)
{
#ifdef WIN32
static UINT max[2] = { 0, 0 };
static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2];
MMRESULT res;
JOYINFO joy;
res = joyGetPos(JOYSTICKID1, &joy);
if (res == JOYERR_NOERROR) {
joyavailable = 1;
if (max[0] < joy.wXpos)
max[0] = joy.wXpos;
if (min[0] > joy.wXpos)
min[0] = joy.wXpos;
center[0] = (max[0] + min[0]) / 2;
if (max[1] < joy.wYpos)
max[1] = joy.wYpos;
if (min[1] > joy.wYpos)
min[1] = joy.wYpos;
center[1] = (max[1] + min[1]) / 2;
if (joyactive) {
if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0]))
alpha +=
2.5 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]);
if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1]))
beta += 2.5 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]);
if (joy.wButtons & JOY_BUTTON1)
v += 0.01;
if (joy.wButtons & JOY_BUTTON2)
v -= 0.01;
}
}
else
joyavailable = 0;
#endif
}
static void
drawfire(void)
{
static char frbuf[80] = "";
int j;
static double t0 = -1.;
double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = (t - t0) * 1.0;
t0 = t;
dojoy();
if (NiceFog)
glHint(GL_FOG_HINT, GL_NICEST);
else
glHint(GL_FOG_HINT, GL_DONT_CARE);
glEnable(GL_DEPTH_TEST);
if (fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glDepthMask(GL_TRUE);
glClearColor(1.0, 1.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
calcposobs();
gluLookAt(obs[0], obs[1], obs[2],
obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2],
0.0, 1.0, 0.0);
glColor4f(1.0, 1.0, 1.0, 1.0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, groundid);
#if 1
glBegin(GL_QUADS);
glTexCoord2fv(qt[0]);
glVertex3fv(q[0]);
glTexCoord2fv(qt[1]);
glVertex3fv(q[1]);
glTexCoord2fv(qt[2]);
glVertex3fv(q[2]);
glTexCoord2fv(qt[3]);
glVertex3fv(q[3]);
glEnd();
#else
/* Subdivide the ground into a bunch of quads. This improves fog
* if GL_FOG_HINT != GL_NICEST
*/
{
float x, y;
float dx = 1.0, dy = 1.0;
glBegin(GL_QUADS);
for (y = -DIMP; y < DIMP; y += 1.0) {
for (x = -DIMP; x < DIMP; x += 1.0) {
glTexCoord2f(0, 0); glVertex3f(x, 0, y);
glTexCoord2f(1, 0); glVertex3f(x+dx, 0, y);
glTexCoord2f(1, 1); glVertex3f(x+dx, 0, y+dy);
glTexCoord2f(0, 1); glVertex3f(x, 0, y+dy);
}
}
glEnd();
}
#endif
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GEQUAL, 0.9);
glBindTexture(GL_TEXTURE_2D, treeid);
for (j = 0; j < NUMTREE; j++)
drawtree(treepos[j][0], treepos[j][1], treepos[j][2]);
glDisable(GL_TEXTURE_2D);
glDepthMask(GL_FALSE);
glDisable(GL_ALPHA_TEST);
if (shadows) {
glBegin(GL_TRIANGLES);
for (j = 0; j < np; j++) {
glColor4f(black[0], black[1], black[2], p[j].c[0][3]);
glVertex3f(p[j].p[0][0], 0.1, p[j].p[0][2]);
glColor4f(black[0], black[1], black[2], p[j].c[1][3]);
glVertex3f(p[j].p[1][0], 0.1, p[j].p[1][2]);
glColor4f(black[0], black[1], black[2], p[j].c[2][3]);
glVertex3f(p[j].p[2][0], 0.1, p[j].p[2][2]);
}
glEnd();
}
glBegin(GL_TRIANGLES);
for (j = 0; j < np; j++) {
glColor4fv(p[j].c[0]);
glVertex3fv(p[j].p[0]);
glColor4fv(p[j].c[1]);
glVertex3fv(p[j].p[1]);
glColor4fv(p[j].c[2]);
glVertex3fv(p[j].p[2]);
setpart(&p[j]);
}
glEnd();
glDisable(GL_TEXTURE_2D);
glDisable(GL_ALPHA_TEST);
glDisable(GL_DEPTH_TEST);
glDisable(GL_FOG);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(10, 10);
printstring(GLUT_BITMAP_HELVETICA_18, frbuf);
glRasterPos2i(370, 470);
printstring(GLUT_BITMAP_HELVETICA_10,
"Fire V1.5 Written by David Bucciarelli (tech.hmw@plus.it)");
if (help)
printhelp();
reshape(WIDTH, HEIGHT);
glPopMatrix();
glutSwapBuffers();
Frames++;
{
GLint t = glutGet(GLUT_ELAPSED_TIME);
if (t - T0 >= 2000) {
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
sprintf(frbuf, "Frame rate: %f", fps);
T0 = t;
Frames = 0;
}
}
}
static void
idle(void)
{
glutPostRedisplay();
}
static void
special(int key, int x, int y)
{
switch (key) {
case GLUT_KEY_LEFT:
alpha += 2.0;
break;
case GLUT_KEY_RIGHT:
alpha -= 2.0;
break;
case GLUT_KEY_DOWN:
beta -= 2.0;
break;
case GLUT_KEY_UP:
beta += 2.0;
break;
}
glutPostRedisplay();
}
static void
key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(0);
break;
case 'a':
v += 0.0005;
break;
case 'z':
v -= 0.0005;
break;
case 'j':
joyactive = (!joyactive);
break;
case 'h':
help = (!help);
break;
case 'f':
fog = (!fog);
break;
case 's':
shadows = !shadows;
break;
case 'R':
eject_r -= 0.03;
break;
case 'r':
eject_r += 0.03;
break;
case 't':
ridtri += 0.005;
break;
case 'T':
ridtri -= 0.005;
break;
#ifdef XMESA
case ' ':
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
fullscreen = (!fullscreen);
break;
#endif
case 'n':
NiceFog = !NiceFog;
printf("NiceFog %d\n", NiceFog);
break;
}
glutPostRedisplay();
}
static void
inittextures(void)
{
GLenum gluerr;
GLubyte tex[128][128][4];
glGenTextures(1, &groundid);
glBindTexture(GL_TEXTURE_2D, groundid);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
if (!LoadRGBMipmaps("../images/s128.rgb", GL_RGB)) {
fprintf(stderr, "Error reading a texture.\n");
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glGenTextures(1, &treeid);
glBindTexture(GL_TEXTURE_2D, treeid);
if (1)
{
int w, h;
GLenum format;
int x, y;
GLubyte *image = LoadRGBImage("../images/tree3.rgb", &w, &h, &format);
if (!image) {
fprintf(stderr, "Error reading a texture.\n");
exit(-1);
}
for (y = 0; y < 128; y++)
for (x = 0; x < 128; x++) {
tex[x][y][0] = image[(y + x * 128) * 3];
tex[x][y][1] = image[(y + x * 128) * 3 + 1];
tex[x][y][2] = image[(y + x * 128) * 3 + 2];
if ((tex[x][y][0] == tex[x][y][1]) &&
(tex[x][y][1] == tex[x][y][2]) && (tex[x][y][2] == 255))
tex[x][y][3] = 0;
else
tex[x][y][3] = 255;
}
if ((gluerr = gluBuild2DMipmaps(GL_TEXTURE_2D, 4, 128, 128, GL_RGBA,
GL_UNSIGNED_BYTE, (GLvoid *) (tex)))) {
fprintf(stderr, "GLULib%s\n", (char *) gluErrorString(gluerr));
exit(-1);
}
}
else {
if (!LoadRGBMipmaps("../images/tree2.rgba", GL_RGBA)) {
fprintf(stderr, "Error reading a texture.\n");
exit(-1);
}
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
static void
inittree(void)
{
int i;
float dist;
for (i = 0; i < NUMTREE; i++)
do {
treepos[i][0] = vrnd() * TREEOUTR * 2.0 - TREEOUTR;
treepos[i][1] = 0.0;
treepos[i][2] = vrnd() * TREEOUTR * 2.0 - TREEOUTR;
dist =
sqrt(treepos[i][0] * treepos[i][0] +
treepos[i][2] * treepos[i][2]);
} while ((dist < TREEINR) || (dist > TREEOUTR));
}
int
main(int ac, char **av)
{
int i;
fprintf(stderr,
"Fire V1.5\nWritten by David Bucciarelli (tech.hmw@plus.it)\n");
/* Default settings */
np = 800;
eject_r = -0.65;
dt = 0.015;
eject_vy = 4;
eject_vl = 1;
shadows = 1;
ridtri = 0.25;
maxage = 1.0 / dt;
if (ac == 2) {
np = atoi(av[1]);
if (np <= 0 || np > 1000000) {
fprintf(stderr, "Invalid input.\n");
exit(-1);
}
}
if (ac == 4) {
WIDTH = atoi(av[2]);
HEIGHT = atoi(av[3]);
}
glutInitWindowSize(WIDTH, HEIGHT);
glutInit(&ac, av);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
if (!(win = glutCreateWindow("Fire"))) {
fprintf(stderr, "Error opening a window.\n");
exit(-1);
}
reshape(WIDTH, HEIGHT);
inittextures();
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP);
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.1);
assert(np > 0);
p = (part *) malloc(sizeof(part) * np);
assert(p);
for (i = 0; i < np; i++)
setnewpart(&p[i]);
inittree();
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutDisplayFunc(drawfire);
glutIdleFunc(idle);
glutReshapeFunc(reshape);
glutMainLoop();
return (0);
}
-418
View File
@@ -1,418 +0,0 @@
/*
* EXT_fog_coord.
*
* Based on glutskel.c by Brian Paul
* and NeHe's Volumetric fog tutorial!
*
* Daniel Borca
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/glut.h>
#define DEPTH 5.0f
static GLfloat camz;
static GLint fogMode;
static GLboolean fogCoord;
static GLfloat fogDensity = 0.75;
static GLfloat fogStart = 1.0, fogEnd = DEPTH;
static GLfloat fogColor[4] = {0.6f, 0.3f, 0.0f, 1.0f};
static const char *ModeStr = NULL;
static GLboolean Arrays = GL_FALSE;
static GLboolean Texture = GL_TRUE;
static void
Reset(void)
{
fogMode = 1;
fogCoord = 1;
fogDensity = 0.75;
fogStart = 1.0;
fogEnd = DEPTH;
Arrays = GL_FALSE;
Texture = GL_TRUE;
}
static void
glFogCoordf_ext (GLfloat f)
{
if (fogCoord)
glFogCoordfEXT(f);
}
static void
PrintString(const char *s)
{
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
}
static void
PrintInfo(void)
{
char s[100];
glDisable(GL_FOG);
glColor3f(0, 1, 1);
sprintf(s, "Mode(m): %s Start(s/S): %g End(e/E): %g Density(d/D): %g",
ModeStr, fogStart, fogEnd, fogDensity);
glWindowPos2iARB(5, 20);
PrintString(s);
sprintf(s, "Arrays(a): %s glFogCoord(c): %s EyeZ(z/z): %g",
(Arrays ? "Yes" : "No"),
(fogCoord ? "Yes" : "No"),
camz);
glWindowPos2iARB(5, 5);
PrintString(s);
}
static int
SetFogMode(GLint fogMode)
{
fogMode &= 3;
switch (fogMode) {
case 0:
ModeStr = "Off";
glDisable(GL_FOG);
break;
case 1:
ModeStr = "GL_LINEAR";
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogf(GL_FOG_START, fogStart);
glFogf(GL_FOG_END, fogEnd);
break;
case 2:
ModeStr = "GL_EXP";
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP);
glFogf(GL_FOG_DENSITY, fogDensity);
break;
case 3:
ModeStr = "GL_EXP2";
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP2);
glFogf(GL_FOG_DENSITY, fogDensity);
break;
}
return fogMode;
}
static GLboolean
SetFogCoord(GLboolean fogCoord)
{
if (!GLEW_EXT_fog_coord) {
return GL_FALSE;
}
if (fogCoord) {
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
}
else {
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
}
return fogCoord;
}
/* could reuse vertices */
static GLuint vertex_index[] = {
/* Back */
0, 1, 2, 3,
/* Floor */
4, 5, 6, 7,
/* Roof */
8, 9, 10, 11,
/* Right */
12, 13, 14, 15,
/* Left */
16, 17, 18, 19
};
static GLfloat vertex_pointer[][3] = {
/* Back */
{-1.0f,-1.0f,-DEPTH}, { 1.0f,-1.0f,-DEPTH}, { 1.0f, 1.0f,-DEPTH}, {-1.0f, 1.0f,-DEPTH},
/* Floor */
{-1.0f,-1.0f,-DEPTH}, { 1.0f,-1.0f,-DEPTH}, { 1.0f,-1.0f, 0.0}, {-1.0f,-1.0f, 0.0},
/* Roof */
{-1.0f, 1.0f,-DEPTH}, { 1.0f, 1.0f,-DEPTH}, { 1.0f, 1.0f, 0.0}, {-1.0f, 1.0f, 0.0},
/* Right */
{ 1.0f,-1.0f, 0.0}, { 1.0f, 1.0f, 0.0}, { 1.0f, 1.0f,-DEPTH}, { 1.0f,-1.0f,-DEPTH},
/* Left */
{-1.0f,-1.0f, 0.0}, {-1.0f, 1.0f, 0.0}, {-1.0f, 1.0f,-DEPTH}, {-1.0f,-1.0f,-DEPTH}
};
static GLfloat texcoord_pointer[][2] = {
/* Back */
{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f},
/* Floor */
{0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, DEPTH}, {0.0f, DEPTH},
/* Roof */
{1.0f, 0.0f}, {0.0f, 0.0f}, {0.0f, DEPTH}, {1.0f, DEPTH},
/* Right */
{0.0f, 1.0f}, {0.0f, 0.0f}, {DEPTH, 0.0f}, {DEPTH, 1.0f},
/* Left */
{0.0f, 0.0f}, {0.0f, 1.0f}, {DEPTH, 1.0f}, {DEPTH, 0.0f}
};
static GLfloat fogcoord_pointer[] = {
/* Back */
DEPTH, DEPTH, DEPTH, DEPTH,
/* Floor */
DEPTH, DEPTH, 0.0, 0.0,
/* Roof */
DEPTH, DEPTH, 0.0, 0.0,
/* Right */
0.0, 0.0, DEPTH, DEPTH,
/* Left */
0.0, 0.0, DEPTH, DEPTH
};
static void
Display( void )
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity ();
glTranslatef(0.0f, 0.0f, -camz);
SetFogMode(fogMode);
glColor3f(1, 1, 1);
if (Texture)
glEnable(GL_TEXTURE_2D);
if (Arrays) {
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glDrawElements(GL_QUADS, sizeof(vertex_index) / sizeof(vertex_index[0]),
GL_UNSIGNED_INT, vertex_index);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
}
else {
/* Back */
glBegin(GL_QUADS);
glFogCoordf_ext(DEPTH); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,-1.0f,-DEPTH);
glFogCoordf_ext(DEPTH); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,-1.0f,-DEPTH);
glFogCoordf_ext(DEPTH); glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f,-DEPTH);
glFogCoordf_ext(DEPTH); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f,-DEPTH);
glEnd();
/* Floor */
glBegin(GL_QUADS);
glFogCoordf_ext(DEPTH); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,-1.0f,-DEPTH);
glFogCoordf_ext(DEPTH); glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f,-1.0f,-DEPTH);
glFogCoordf_ext(0.0f); glTexCoord2f(1.0f, DEPTH); glVertex3f( 1.0f,-1.0f,0.0);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, DEPTH); glVertex3f(-1.0f,-1.0f,0.0);
glEnd();
/* Roof */
glBegin(GL_QUADS);
glFogCoordf_ext(DEPTH); glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, 1.0f,-DEPTH);
glFogCoordf_ext(DEPTH); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f,-DEPTH);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, DEPTH); glVertex3f( 1.0f, 1.0f,0.0);
glFogCoordf_ext(0.0f); glTexCoord2f(1.0f, DEPTH); glVertex3f(-1.0f, 1.0f,0.0);
glEnd();
/* Right */
glBegin(GL_QUADS);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f,-1.0f,0.0);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, 1.0f,0.0);
glFogCoordf_ext(DEPTH); glTexCoord2f(DEPTH, 0.0f); glVertex3f( 1.0f, 1.0f,-DEPTH);
glFogCoordf_ext(DEPTH); glTexCoord2f(DEPTH, 1.0f); glVertex3f( 1.0f,-1.0f,-DEPTH);
glEnd();
/* Left */
glBegin(GL_QUADS);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f,-1.0f,0.0);
glFogCoordf_ext(0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f,0.0);
glFogCoordf_ext(DEPTH); glTexCoord2f(DEPTH, 1.0f); glVertex3f(-1.0f, 1.0f,-DEPTH);
glFogCoordf_ext(DEPTH); glTexCoord2f(DEPTH, 0.0f); glVertex3f(-1.0f,-1.0f,-DEPTH);
glEnd();
}
glDisable(GL_TEXTURE_2D);
PrintInfo();
glutSwapBuffers();
}
static void
Reshape( int width, int height )
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1, 1, -1, 1, 1.0, 100);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static void
Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 'a':
Arrays = !Arrays;
break;
case 'f':
case 'm':
fogMode = SetFogMode(fogMode + 1);
break;
case 'D':
fogDensity += 0.05;
SetFogMode(fogMode);
break;
case 'd':
if (fogDensity > 0.0) {
fogDensity -= 0.05;
}
SetFogMode(fogMode);
break;
case 's':
if (fogStart > 0.0) {
fogStart -= 0.25;
}
SetFogMode(fogMode);
break;
case 'S':
if (fogStart < 100.0) {
fogStart += 0.25;
}
SetFogMode(fogMode);
break;
case 'e':
if (fogEnd > 0.0) {
fogEnd -= 0.25;
}
SetFogMode(fogMode);
break;
case 'E':
if (fogEnd < 100.0) {
fogEnd += 0.25;
}
SetFogMode(fogMode);
break;
case 'c':
fogCoord = SetFogCoord(fogCoord ^ GL_TRUE);
break;
case 't':
Texture = !Texture;
break;
case 'z':
camz -= 0.1;
break;
case 'Z':
camz += 0.1;
break;
case 'r':
Reset();
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void
Init(void)
{
static const GLubyte teximage[2][2][4] = {
{ { 255, 255, 255, 255}, { 128, 128, 128, 255} },
{ { 128, 128, 128, 255}, { 255, 255, 255, 255} }
};
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
if (!GLEW_EXT_fog_coord) {
printf("GL_EXT_fog_coord not supported!\n");
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0,
GL_RGBA, GL_UNSIGNED_BYTE, teximage);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glClearColor(0.1f, 0.1f, 0.1f, 0.0f);
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glFogfv(GL_FOG_COLOR, fogColor);
glHint(GL_FOG_HINT, GL_NICEST);
fogCoord = SetFogCoord(GL_TRUE); /* try to enable fog_coord */
fogMode = SetFogMode(1);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertex_pointer);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, texcoord_pointer);
if (GLEW_EXT_fog_coord) {
glEnableClientState(GL_FOG_COORDINATE_ARRAY_EXT);
glFogCoordPointerEXT(GL_FLOAT, 0, fogcoord_pointer);
}
Reset();
}
int
main( int argc, char *argv[] )
{
glutInitWindowSize( 600, 600 );
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
Init();
glutMainLoop();
return 0;
}
-285
View File
@@ -1,285 +0,0 @@
/*
* Use GL_NV_fragment_program to implement per-pixel lighting.
*
* Brian Paul
* 7 April 2003
*/
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/glut.h>
static GLfloat Diffuse[4] = { 0.5, 0.5, 1.0, 1.0 };
static GLfloat Specular[4] = { 0.8, 0.8, 0.8, 1.0 };
static GLfloat LightPos[4] = { 0.0, 10.0, 20.0, 1.0 };
static GLfloat Delta = 1.0;
static GLuint FragProg;
static GLuint VertProg;
static GLboolean Anim = GL_TRUE;
static GLboolean Wire = GL_FALSE;
static GLboolean PixelLight = GL_TRUE;
static GLint Win;
static GLfloat Xrot = 0, Yrot = 0;
#define NAMED_PARAMETER4FV(prog, name, v) \
glProgramNamedParameter4fvNV(prog, strlen(name), (const GLubyte *) name, v)
static void Display( void )
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
if (PixelLight) {
#if defined(GL_NV_fragment_program)
NAMED_PARAMETER4FV(FragProg, "LightPos", LightPos);
glEnable(GL_FRAGMENT_PROGRAM_NV);
glEnable(GL_VERTEX_PROGRAM_NV);
#endif
glDisable(GL_LIGHTING);
}
else {
glLightfv(GL_LIGHT0, GL_POSITION, LightPos);
#if defined(GL_NV_fragment_program)
glDisable(GL_FRAGMENT_PROGRAM_NV);
glDisable(GL_VERTEX_PROGRAM_NV);
#endif
glEnable(GL_LIGHTING);
}
glPushMatrix();
glRotatef(Xrot, 1, 0, 0);
glRotatef(Yrot, 0, 1, 0);
#if 1
glutSolidSphere(2.0, 10, 5);
#else
{
GLUquadricObj *q = gluNewQuadric();
gluQuadricNormals(q, GL_SMOOTH);
gluQuadricTexture(q, GL_TRUE);
glRotatef(90, 1, 0, 0);
glTranslatef(0, 0, -1);
gluCylinder(q, 1.0, 1.0, 2.0, 24, 1);
gluDeleteQuadric(q);
}
#endif
glPopMatrix();
glutSwapBuffers();
}
static void Idle(void)
{
LightPos[0] += Delta;
if (LightPos[0] > 25.0)
Delta = -1.0;
else if (LightPos[0] <- 25.0)
Delta = 1.0;
glutPostRedisplay();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
/*glOrtho( -2.0, 2.0, -2.0, 2.0, 5.0, 25.0 );*/
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -15.0 );
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case ' ':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
case 'x':
LightPos[0] -= 1.0;
break;
case 'X':
LightPos[0] += 1.0;
break;
case 'w':
Wire = !Wire;
if (Wire)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
else
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
break;
case 'p':
PixelLight = !PixelLight;
if (PixelLight) {
printf("Per-pixel lighting\n");
}
else {
printf("Conventional lighting\n");
}
break;
case 27:
glutDestroyWindow(Win);
exit(0);
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
const GLfloat step = 3.0;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
Xrot -= step;
break;
case GLUT_KEY_DOWN:
Xrot += step;
break;
case GLUT_KEY_LEFT:
Yrot -= step;
break;
case GLUT_KEY_RIGHT:
Yrot += step;
break;
}
glutPostRedisplay();
}
static void Init( void )
{
static const char *fragProgramText =
"!!FP1.0\n"
"DECLARE Diffuse; \n"
"DECLARE Specular; \n"
"DECLARE LightPos; \n"
"# Compute normalized LightPos, put it in R0\n"
"DP3 R0.x, LightPos, LightPos;\n"
"RSQ R0.y, R0.x;\n"
"MUL R0, LightPos, R0.y;\n"
"# Compute normalized normal, put it in R1\n"
"DP3 R1, f[TEX0], f[TEX0]; \n"
"RSQ R1.y, R1.x;\n"
"MUL R1, f[TEX0], R1.y;\n"
"# Compute dot product of light direction and normal vector\n"
"DP3_SAT R2, R0, R1;"
"MUL R3, Diffuse, R2; # diffuse attenuation\n"
"POW R4, R2.x, {20.0}.x; # specular exponent\n"
"MUL R5, Specular, R4; # specular attenuation\n"
"ADD o[COLR], R3, R5; # add diffuse and specular colors\n"
"END \n"
;
static const char *vertProgramText =
"!!VP1.0\n"
"# typical modelview/projection transform\n"
"DP4 o[HPOS].x, c[0], v[OPOS] ;\n"
"DP4 o[HPOS].y, c[1], v[OPOS] ;\n"
"DP4 o[HPOS].z, c[2], v[OPOS] ;\n"
"DP4 o[HPOS].w, c[3], v[OPOS] ;\n"
"# transform normal by inv transpose of modelview, put in tex0\n"
"DP3 o[TEX0].x, c[4], v[NRML] ;\n"
"DP3 o[TEX0].y, c[5], v[NRML] ;\n"
"DP3 o[TEX0].z, c[6], v[NRML] ;\n"
"DP3 o[TEX0].w, c[7], v[NRML] ;\n"
"END\n";
;
if (!glutExtensionSupported("GL_NV_vertex_program")) {
printf("Sorry, this demo requires GL_NV_vertex_program\n");
exit(1);
}
if (!glutExtensionSupported("GL_NV_fragment_program")) {
printf("Sorry, this demo requires GL_NV_fragment_program\n");
exit(1);
}
#if defined(GL_NV_fragment_program)
glGenProgramsNV(1, &FragProg);
assert(FragProg > 0);
glGenProgramsNV(1, &VertProg);
assert(VertProg > 0);
/*
* Fragment program
*/
glLoadProgramNV(GL_FRAGMENT_PROGRAM_NV, FragProg,
strlen(fragProgramText),
(const GLubyte *) fragProgramText);
assert(glIsProgramNV(FragProg));
glBindProgramNV(GL_FRAGMENT_PROGRAM_NV, FragProg);
NAMED_PARAMETER4FV(FragProg, "Diffuse", Diffuse);
NAMED_PARAMETER4FV(FragProg, "Specular", Specular);
/*
* Vertex program
*/
glLoadProgramNV(GL_VERTEX_PROGRAM_NV, VertProg,
strlen(vertProgramText),
(const GLubyte *) vertProgramText);
assert(glIsProgramNV(VertProg));
glBindProgramNV(GL_VERTEX_PROGRAM_NV, VertProg);
glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 0, GL_MODELVIEW_PROJECTION_NV, GL_IDENTITY_NV);
glTrackMatrixNV(GL_VERTEX_PROGRAM_NV, 4, GL_MODELVIEW, GL_INVERSE_TRANSPOSE_NV);
#endif
/*
* Misc init
*/
glClearColor(0.3, 0.3, 0.3, 0.0);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, Diffuse);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Specular);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 20.0);
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("Press p to toggle between per-pixel and per-vertex lighting\n");
}
int main( int argc, char *argv[] )
{
glutInitWindowSize( 200, 200 );
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
Win = glutCreateWindow(argv[0]);
glewInit();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
if (Anim)
glutIdleFunc(Idle);
Init();
glutMainLoop();
return 0;
}
-619
View File
@@ -1,619 +0,0 @@
/**
* Test OpenGL 2.0 vertex/fragment shaders.
* Brian Paul
* 1 November 2006
*
* Based on ARB version by:
* Michal Krol
* 20 February 2006
*
* Based on the original demo by:
* Brian Paul
* 17 April 2003
*/
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "extfuncs.h"
#define TEXTURE 0
static GLint CoordAttrib = 0;
static char *FragProgFile = NULL;
static char *VertProgFile = NULL;
static GLfloat diffuse[4] = { 0.5f, 0.5f, 1.0f, 1.0f };
static GLfloat specular[4] = { 0.8f, 0.8f, 0.8f, 1.0f };
static GLfloat lightPos[4] = { 0.0f, 10.0f, 20.0f, 0.0f };
static GLfloat delta = 1.0f;
static GLuint fragShader;
static GLuint vertShader;
static GLuint program;
static GLint uDiffuse;
static GLint uSpecular;
static GLint uTexture;
static GLuint SphereList, RectList, CurList;
static GLint win = 0;
static GLboolean anim = GL_TRUE;
static GLboolean wire = GL_FALSE;
static GLboolean pixelLight = GL_TRUE;
static GLint t0 = 0;
static GLint frames = 0;
static GLfloat xRot = 90.0f, yRot = 0.0f;
static void
normalize(GLfloat *dst, const GLfloat *src)
{
GLfloat len = sqrt(src[0] * src[0] + src[1] * src[1] + src[2] * src[2]);
dst[0] = src[0] / len;
dst[1] = src[1] / len;
dst[2] = src[2] / len;
dst[3] = src[3];
}
static void
Redisplay(void)
{
GLfloat vec[4];
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* update light position */
normalize(vec, lightPos);
glLightfv(GL_LIGHT0, GL_POSITION, vec);
if (pixelLight) {
glUseProgram_func(program);
glDisable(GL_LIGHTING);
}
else {
glUseProgram_func(0);
glEnable(GL_LIGHTING);
}
glPushMatrix();
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
glRotatef(yRot, 0.0f, 1.0f, 0.0f);
/*
glutSolidSphere(2.0, 10, 5);
*/
glCallList(CurList);
glPopMatrix();
glutSwapBuffers();
frames++;
if (anim) {
GLint t = glutGet(GLUT_ELAPSED_TIME);
if (t - t0 >= 5000) {
GLfloat seconds =(GLfloat)(t - t0) / 1000.0f;
GLfloat fps = frames / seconds;
printf("%d frames in %6.3f seconds = %6.3f FPS\n",
frames, seconds, fps);
fflush(stdout);
t0 = t;
frames = 0;
}
}
}
static void
Idle(void)
{
lightPos[0] += delta;
if (lightPos[0] > 25.0f || lightPos[0] < -25.0f)
delta = -delta;
glutPostRedisplay();
}
static void
Reshape(int width, int height)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -15.0f);
}
static void
CleanUp(void)
{
glDeleteShader_func(fragShader);
glDeleteShader_func(vertShader);
glDeleteProgram_func(program);
glutDestroyWindow(win);
}
static void
Key(unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch(key) {
case ' ':
case 'a':
anim = !anim;
if (anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
case 'x':
lightPos[0] -= 1.0f;
break;
case 'X':
lightPos[0] += 1.0f;
break;
case 'w':
wire = !wire;
if (wire)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
else
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
break;
case 'o':
if (CurList == SphereList)
CurList = RectList;
else
CurList = SphereList;
break;
case 'p':
pixelLight = !pixelLight;
if (pixelLight)
printf("Per-pixel lighting\n");
else
printf("Conventional lighting\n");
break;
case 27:
CleanUp();
exit(0);
break;
}
glutPostRedisplay();
}
static void
SpecialKey(int key, int x, int y)
{
const GLfloat step = 3.0f;
(void) x;
(void) y;
switch(key) {
case GLUT_KEY_UP:
xRot -= step;
break;
case GLUT_KEY_DOWN:
xRot += step;
break;
case GLUT_KEY_LEFT:
yRot -= step;
break;
case GLUT_KEY_RIGHT:
yRot += step;
break;
}
glutPostRedisplay();
}
static void
TestFunctions(void)
{
printf("Error 0x%x at line %d\n", glGetError(), __LINE__);
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
/* attached shaders */
{
GLuint shaders[20];
GLsizei count;
int i;
glGetAttachedShaders_func(program, 20, &count, shaders);
for (i = 0; i < count; i++) {
printf("Attached: %u\n", shaders[i]);
assert(shaders[i] == fragShader ||
shaders[i] == vertShader);
}
}
{
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(vertShader, 1000, &len, log);
printf("Vert Shader Info Log: %s\n", log);
glGetShaderInfoLog_func(fragShader, 1000, &len, log);
printf("Frag Shader Info Log: %s\n", log);
glGetProgramInfoLog_func(program, 1000, &len, log);
printf("Program Info Log: %s\n", log);
}
/* active uniforms */
{
GLint n, max, i;
glGetProgramiv_func(program, GL_ACTIVE_UNIFORMS, &n);
glGetProgramiv_func(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max);
printf("Num uniforms: %d Max name length: %d\n", n, max);
for (i = 0; i < n; i++) {
GLint size, len;
GLenum type;
char name[100];
glGetActiveUniform_func(program, i, 100, &len, &size, &type, name);
printf(" %d: %s nameLen=%d size=%d type=0x%x\n",
i, name, len, size, type);
}
}
}
#if TEXTURE
static void
MakeTexture(void)
{
#define SZ0 64
#define SZ1 32
GLubyte image0[SZ0][SZ0][SZ0][4];
GLubyte image1[SZ1][SZ1][SZ1][4];
GLuint i, j, k;
/* level 0: two-tone gray checkboard */
for (i = 0; i < SZ0; i++) {
for (j = 0; j < SZ0; j++) {
for (k = 0; k < SZ0; k++) {
if ((i/8 + j/8 + k/8) & 1) {
image0[i][j][k][0] =
image0[i][j][k][1] =
image0[i][j][k][2] = 200;
}
else {
image0[i][j][k][0] =
image0[i][j][k][1] =
image0[i][j][k][2] = 100;
}
image0[i][j][k][3] = 255;
}
}
}
/* level 1: two-tone green checkboard */
for (i = 0; i < SZ1; i++) {
for (j = 0; j < SZ1; j++) {
for (k = 0; k < SZ1; k++) {
if ((i/8 + j/8 + k/8) & 1) {
image1[i][j][k][0] = 0;
image1[i][j][k][1] = 250;
image1[i][j][k][2] = 0;
}
else {
image1[i][j][k][0] = 0;
image1[i][j][k][1] = 200;
image1[i][j][k][2] = 0;
}
image1[i][j][k][3] = 255;
}
}
}
glActiveTexture(GL_TEXTURE2); /* unit 2 */
glBindTexture(GL_TEXTURE_2D, 42);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ0, SZ0, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image0);
glTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, SZ1, SZ1, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glActiveTexture(GL_TEXTURE4); /* unit 4 */
glBindTexture(GL_TEXTURE_3D, 43);
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, SZ0, SZ0, SZ0, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image0);
glTexImage3D(GL_TEXTURE_3D, 1, GL_RGBA, SZ1, SZ1, SZ1, 0,
GL_RGBA, GL_UNSIGNED_BYTE, image1);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAX_LEVEL, 1);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
#endif
static void
MakeSphere(void)
{
GLUquadricObj *obj = gluNewQuadric();
SphereList = glGenLists(1);
gluQuadricTexture(obj, GL_TRUE);
glNewList(SphereList, GL_COMPILE);
gluSphere(obj, 2.0f, 10, 5);
glEndList();
gluDeleteQuadric(obj);
}
static void
VertAttrib(GLint index, float x, float y)
{
#if 1
glVertexAttrib2f_func(index, x, y);
#else
glTexCoord2f(x, y);
#endif
}
static void
MakeRect(void)
{
RectList = glGenLists(1);
glNewList(RectList, GL_COMPILE);
glNormal3f(0, 0, 1);
glBegin(GL_POLYGON);
VertAttrib(CoordAttrib, 0, 0); glVertex2f(-2, -2);
VertAttrib(CoordAttrib, 1, 0); glVertex2f( 2, -2);
VertAttrib(CoordAttrib, 1, 1); glVertex2f( 2, 2);
VertAttrib(CoordAttrib, 0, 1); glVertex2f(-2, 2);
glEnd(); /* XXX omit this and crash! */
glEndList();
}
static void
LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
glCompileShader_func(shader);
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetShaderInfoLog_func(shader, 1000, &len, log);
fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
exit(1);
}
}
/**
* Read a shader from a file.
*/
static void
ReadShader(GLuint shader, const char *filename)
{
const int max = 100*1000;
int n;
char *buffer = (char*) malloc(max);
FILE *f = fopen(filename, "r");
if (!f) {
fprintf(stderr, "fslight: Unable to open shader file %s\n", filename);
exit(1);
}
n = fread(buffer, 1, max, f);
printf("fslight: read %d bytes from shader file %s\n", n, filename);
if (n > 0) {
buffer[n] = 0;
LoadAndCompileShader(shader, buffer);
}
fclose(f);
free(buffer);
}
static void
CheckLink(GLuint prog)
{
GLint stat;
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
glGetProgramInfoLog_func(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
}
static void
Init(void)
{
static const char *fragShaderText =
"uniform vec4 diffuse;\n"
"uniform vec4 specular;\n"
"varying vec3 normal;\n"
"void main() {\n"
" // Compute dot product of light direction and normal vector\n"
" float dotProd = max(dot(gl_LightSource[0].position.xyz, \n"
" normalize(normal)), 0.0);\n"
" // Compute diffuse and specular contributions\n"
" gl_FragColor = diffuse * dotProd + specular * pow(dotProd, 20.0);\n"
"}\n";
static const char *vertShaderText =
"varying vec3 normal;\n"
"void main() {\n"
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
" normal = gl_NormalMatrix * gl_Normal;\n"
"}\n";
const char *version;
version = (const char *) glGetString(GL_VERSION);
if (version[0] == '1') {
printf("This program requires OpenGL 2.x or higher, found %s\n", version);
exit(1);
}
GetExtensionFuncs();
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
if (FragProgFile)
ReadShader(fragShader, FragProgFile);
else
LoadAndCompileShader(fragShader, fragShaderText);
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
if (VertProgFile)
ReadShader(vertShader, VertProgFile);
else
LoadAndCompileShader(vertShader, vertShaderText);
program = glCreateProgram_func();
glAttachShader_func(program, fragShader);
glAttachShader_func(program, vertShader);
glLinkProgram_func(program);
CheckLink(program);
glUseProgram_func(program);
uDiffuse = glGetUniformLocation_func(program, "diffuse");
uSpecular = glGetUniformLocation_func(program, "specular");
uTexture = glGetUniformLocation_func(program, "texture");
printf("DiffusePos %d SpecularPos %d TexturePos %d\n",
uDiffuse, uSpecular, uTexture);
glUniform4fv_func(uDiffuse, 1, diffuse);
glUniform4fv_func(uSpecular, 1, specular);
/* assert(glGetError() == 0);*/
#if TEXTURE
glUniform1i_func(uTexture, 2); /* use texture unit 2 */
#endif
/*assert(glGetError() == 0);*/
if (CoordAttrib) {
int i;
glBindAttribLocation_func(program, CoordAttrib, "coord");
i = glGetAttribLocation_func(program, "coord");
assert(i >= 0);
if (i != CoordAttrib) {
printf("Hmmm, NVIDIA bug?\n");
CoordAttrib = i;
}
else {
printf("Mesa bind attrib: coord = %d\n", i);
}
}
/*assert(glGetError() == 0);*/
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 20.0f);
MakeSphere();
MakeRect();
CurList = SphereList;
#if TEXTURE
MakeTexture();
#endif
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
printf("Press p to toggle between per-pixel and per-vertex lighting\n");
/* test glGetShaderSource() */
if (0) {
GLsizei len = strlen(fragShaderText) + 1;
GLsizei lenOut;
GLchar *src =(GLchar *) malloc(len * sizeof(GLchar));
glGetShaderSource_func(fragShader, 0, NULL, src);
glGetShaderSource_func(fragShader, len, &lenOut, src);
assert(len == lenOut + 1);
assert(strcmp(src, fragShaderText) == 0);
free(src);
}
assert(glIsProgram_func(program));
assert(glIsShader_func(fragShader));
assert(glIsShader_func(vertShader));
glColor3f(1, 0, 0);
/* for testing state vars */
{
static GLfloat fc[4] = { 1, 1, 0, 0 };
static GLfloat amb[4] = { 1, 0, 1, 0 };
glFogfv(GL_FOG_COLOR, fc);
glLightfv(GL_LIGHT1, GL_AMBIENT, amb);
}
#if 0
TestFunctions();
#else
(void) TestFunctions;
#endif
}
static void
ParseOptions(int argc, char *argv[])
{
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-fs") == 0) {
FragProgFile = argv[++i];
}
else if (strcmp(argv[i], "-vs") == 0) {
VertProgFile = argv[++i];
}
else {
fprintf(stderr, "unknown option %s\n", argv[i]);
break;
}
}
}
int
main(int argc, char *argv[])
{
glutInitWindowSize(200, 200);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Redisplay);
if (anim)
glutIdleFunc(Idle);
ParseOptions(argc, argv);
Init();
glutMainLoop();
return 0;
}
-159
View File
@@ -1,159 +0,0 @@
/* Draw test patterns to help determine correct gamma value for a display.
When the intensities of the inner squares nearly match the intensities
of their frames (from some distance the borders should disappear) then
you've found the right gamma value.
You can set Mesa's gamma values (for red, green and blue) with the
MESA_GAMMA environment variable. But only on X windows!
For example:
setenv MESA_GAMMA 1.5 1.6 1.4
Sets the red gamma value to 1.5, green to 1.6 and blue to 1.4.
See the main README file for more information.
For more info about gamma correction see:
http://www.inforamp.net/~poynton/notes/colour_and_gamma/GammaFAQ.html
This program is in the public domain
Brian Paul 19 Oct 1995
Kai Schuetz 05 Jun 1999 */
/* Conversion to GLUT by Mark J. Kilgard */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <GL/glut.h>
static void
Reshape(int width, int height)
{
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_FLAT);
}
/* ARGSUSED1 */
static void
key_esc(unsigned char key, int x, int y)
{
if(key == 27) exit(0); /* Exit on Escape */
}
static GLubyte p25[] = {
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
};
static GLubyte p50[] = {
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
};
static GLubyte p75[] = {
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
0xaa, 0xaa, 0xaa, 0xaa, 0xff, 0xff, 0xff, 0xff,
};
static GLubyte *stippletab[4] = {NULL, p25, p50, p75};
static void
gamma_ramp(GLfloat yoffs, GLfloat r, GLfloat g, GLfloat b)
{
GLint d;
glColor3f(0.0, 0.0, 0.0); /* solid black, no stipple */
glRectf(-1.0, yoffs, -0.6, yoffs + 0.5);
for(d = 1; d < 4; d++) { /* increasing density from 25% to 75% */
GLfloat xcoord = (-1.0 + d*0.4);
GLfloat t = d * 0.25;
glColor3f(r*t, g*t, b*t); /* draw outer rect */
glRectf(xcoord, yoffs, xcoord+0.4, yoffs + 0.5);
glColor3f(0.0, 0.0, 0.0); /* "clear" inner rect */
glRectf(xcoord + 0.1, yoffs + 0.125, xcoord + 0.3, yoffs + 0.375);
glColor3f(r, g, b); /* draw stippled inner rect */
glEnable(GL_POLYGON_STIPPLE);
glPolygonStipple(stippletab[d]);
glRectf(xcoord + 0.1, yoffs + 0.125, xcoord + 0.3, yoffs + 0.375);
glDisable(GL_POLYGON_STIPPLE);
}
glColor3f(r, g, b); /* solid color, no stipple */
glRectf(0.6, yoffs, 1.0, yoffs + 0.5);
}
static void
display(void)
{
gamma_ramp( 0.5, 1.0, 1.0, 1.0); /* white ramp */
gamma_ramp( 0.0, 1.0, 0.0, 0.0); /* red ramp */
gamma_ramp(-0.5, 0.0, 1.0, 0.0); /* green ramp */
gamma_ramp(-1.0, 0.0, 0.0, 1.0); /* blue ramp */
glFlush();
}
int
main(int argc, char **argv)
{
glutInitWindowSize(500, 400);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutCreateWindow("gamma test patterns");
glutReshapeFunc(Reshape);
glutDisplayFunc(display);
glutKeyboardFunc(key_esc);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}
-492
View File
@@ -1,492 +0,0 @@
/*
* Use glCopyTexSubImage2D to draw animated gears on the sides of a box.
*
* Brian Paul
* 27 January 2006
*/
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GL/glut.h>
#ifndef M_PI
#define M_PI 3.14159265
#endif
static GLint WinWidth = 800, WinHeight = 500;
static GLint TexWidth, TexHeight;
static GLuint TexObj = 1;
static GLenum IntFormat = GL_RGB;
static GLboolean WireFrame = GL_FALSE;
static GLint T0 = 0;
static GLint Frames = 0;
static GLint Win = 0;
static GLfloat ViewRotX = 20.0, ViewRotY = 30.0, ViewRotZ = 0.0;
static GLint Gear1, Gear2, Gear3;
static GLfloat GearRot = 0.0;
static GLfloat CubeRot = 0.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 void
cleanup(void)
{
glDeleteTextures(1, &TexObj);
glDeleteLists(Gear1, 1);
glDeleteLists(Gear2, 1);
glDeleteLists(Gear3, 1);
glutDestroyWindow(Win);
}
static void
DrawGears(void)
{
if (WireFrame) {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
}
glPushMatrix();
glRotatef(20/*ViewRotX*/, 1.0, 0.0, 0.0);
glRotatef(ViewRotY, 0.0, 1.0, 0.0);
glRotatef(ViewRotZ, 0.0, 0.0, 1.0);
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
glRotatef(GearRot, 0.0, 0.0, 1.0);
glCallList(Gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1, -2.0, 0.0);
glRotatef(-2.0 * GearRot - 9.0, 0.0, 0.0, 1.0);
glCallList(Gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1, 4.2, 0.0);
glRotatef(-2.0 * GearRot - 25.0, 0.0, 0.0, 1.0);
glCallList(Gear3);
glPopMatrix();
glPopMatrix();
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
static void
DrawCube(void)
{
static const GLfloat texcoords[4][2] = {
{ 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 }
};
static const GLfloat vertices[4][2] = {
{ -1, -1 }, { 1, -1 }, { 1, 1 }, { -1, 1 }
};
static const GLfloat xforms[6][4] = {
{ 0, 0, 1, 0 },
{ 90, 0, 1, 0 },
{ 180, 0, 1, 0 },
{ 270, 0, 1, 0 },
{ 90, 1, 0, 0 },
{ -90, 1, 0, 0 }
};
static const GLfloat mat[4] = { 1.0, 1.0, 0.5, 1.0 };
GLint i, j;
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat);
glEnable(GL_TEXTURE_2D);
glPushMatrix();
glRotatef(ViewRotX, 1.0, 0.0, 0.0);
glRotatef(15, 1, 0, 0);
glRotatef(CubeRot, 0, 1, 0);
glScalef(4, 4, 4);
for (i = 0; i < 6; i++) {
glPushMatrix();
glRotatef(xforms[i][0], xforms[i][1], xforms[i][2], xforms[i][3]);
glTranslatef(0, 0, 1.1);
glBegin(GL_POLYGON);
glNormal3f(0, 0, 1);
for (j = 0; j < 4; j++) {
glTexCoord2fv(texcoords[j]);
glVertex2fv(vertices[j]);
}
glEnd();
glPopMatrix();
}
glPopMatrix();
glDisable(GL_TEXTURE_2D);
}
static void
draw(void)
{
float ar;
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
/* clear whole depth buffer */
glDisable(GL_SCISSOR_TEST);
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_SCISSOR_TEST);
/* clear upper-left corner of color buffer (unused space) */
glScissor(0, TexHeight, TexWidth, WinHeight - TexHeight);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* clear lower-left corner of color buffer */
glViewport(0, 0, TexWidth, TexHeight);
glScissor(0, 0, TexWidth, TexHeight);
glClearColor(1, 1, 1, 0);
glClear(GL_COLOR_BUFFER_BIT);
/* draw gears in lower-left corner */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
DrawGears();
/* copy color buffer to texture */
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, TexWidth, TexHeight);
/* clear right half of color buffer */
glViewport(TexWidth, 0, WinWidth - TexWidth, WinHeight);
glScissor(TexWidth, 0, WinWidth - TexWidth, WinHeight);
glClearColor(0.5, 0.5, 0.8, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
/* draw textured cube in right half of window */
ar = (float) (WinWidth - TexWidth) / WinHeight;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ar, ar, -1.0, 1.0, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
DrawCube();
/* finish up */
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 %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
fflush(stdout);
T0 = t;
Frames = 0;
}
}
}
static void
idle(void)
{
static double t0 = -1.;
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
/* fmod to prevent overflow */
GearRot = fmod(GearRot + 70.0 * dt, 360.0); /* 70 deg/sec */
CubeRot = fmod(CubeRot + 15.0 * dt, 360.0); /* 15 deg/sec */
glutPostRedisplay();
}
/* change view angle, exit upon ESC */
static void
key(unsigned char k, int x, int y)
{
(void) x;
(void) y;
switch (k) {
case 'w':
WireFrame = !WireFrame;
break;
case 'z':
ViewRotZ += 5.0;
break;
case 'Z':
ViewRotZ -= 5.0;
break;
case 27: /* Escape */
cleanup();
exit(0);
break;
default:
return;
}
glutPostRedisplay();
}
/* change view angle */
static void
special(int k, int x, int y)
{
(void) x;
(void) y;
switch (k) {
case GLUT_KEY_UP:
ViewRotX += 5.0;
break;
case GLUT_KEY_DOWN:
ViewRotX -= 5.0;
break;
case GLUT_KEY_LEFT:
ViewRotY += 5.0;
break;
case GLUT_KEY_RIGHT:
ViewRotY -= 5.0;
break;
default:
return;
}
glutPostRedisplay();
}
/* new window size or exposure */
static void
reshape(int width, int height)
{
WinWidth = width;
WinHeight = height;
}
static void
init(int argc, char *argv[])
{
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};
GLint i;
glLightfv(GL_LIGHT0, GL_POSITION, pos);
#if 0
glEnable(GL_CULL_FACE);
#endif
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);
/* xxx make size dynamic */
TexWidth = 256;
TexHeight = 256;
glBindTexture(GL_TEXTURE_2D, TexObj);
glTexImage2D(GL_TEXTURE_2D, 0, IntFormat, TexWidth, TexHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
for ( i=1; i<argc; i++ ) {
if (strcmp(argv[i], "-info")==0) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
}
}
static void
visible(int vis)
{
if (vis == GLUT_VISIBLE)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
}
int
main(int argc, char *argv[])
{
glutInitWindowSize(WinWidth, WinHeight);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
Win = glutCreateWindow("gearbox");
init(argc, argv);
glutDisplayFunc(draw);
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutVisibilityFunc(visible);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}
-403
View File
@@ -1,403 +0,0 @@
/*
* 3-D gear wheels. This program is in the public domain.
*
* Command line options:
* -info print GL implementation information
* -exit automatically exit after 30 seconds
*
*
* Brian Paul
*/
/* Conversion to GLUT by Mark J. Kilgard */
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GL/glut.h>
#ifndef M_PI
#define M_PI 3.14159265
#endif
static GLint T0 = 0;
static GLint Frames = 0;
static GLint autoexit = 0;
static GLint win = 0;
static GLboolean Visible = GL_TRUE;
static GLboolean Animate = GL_TRUE;
static GLfloat viewDist = 40.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
cleanup(void)
{
glDeleteLists(gear1, 1);
glDeleteLists(gear2, 1);
glDeleteLists(gear3, 1);
glutDestroyWindow(win);
}
static void
draw(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glTranslatef(0.0, 0.0, -viewDist);
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 %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
fflush(stdout);
T0 = t;
Frames = 0;
if ((t >= 999.0 * autoexit) && (autoexit)) {
cleanup();
exit(0);
}
}
}
}
static void
idle(void)
{
static double t0 = -1.;
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
angle += 70.0 * dt; /* 70 degrees per second */
angle = fmod(angle, 360.0); /* prevents eventual overflow */
glutPostRedisplay();
}
static void
update_idle_func(void)
{
if (Visible && Animate)
glutIdleFunc(idle);
else
glutIdleFunc(NULL);
}
/* 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 'd':
viewDist += 1.0;
break;
case 'D':
viewDist -= 1.0;
break;
case 'a':
Animate = !Animate;
update_idle_func();
break;
case 27: /* Escape */
cleanup();
exit(0);
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, 200.0);
glMatrixMode(GL_MODELVIEW);
}
static void
init(int argc, char *argv[])
{
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};
GLint i;
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);
for ( i=1; i<argc; i++ ) {
if (strcmp(argv[i], "-info")==0) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
else if ( strcmp(argv[i], "-exit")==0) {
autoexit = 30;
printf("Auto Exit after %i seconds.\n", autoexit );
}
}
}
static void
visible(int vis)
{
Visible = vis;
update_idle_func();
}
int main(int argc, char *argv[])
{
glutInitWindowSize(300, 300);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
win = glutCreateWindow("Gears");
init(argc, argv);
glutDisplayFunc(draw);
glutReshapeFunc(reshape);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutVisibilityFunc(visible);
update_idle_func();
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}
File diff suppressed because it is too large Load Diff
-119
View File
@@ -1,119 +0,0 @@
BACKGROUND = 0.000 0.500 0.700
ANAME = AXLE1
ARADIUS = 1.000
AAXIS = 2
APOSITION = -7.000 0.000 0.000
ACOLOR = 0.800 0.500 0.200
ALENGTH = 6.000
AMOTORED = 1
AANGULARVELOCITY = 90.000
ADIRECTION = 1
ANAME = AXLE2
ARADIUS = 1.000
AAXIS = 2
APOSITION = -3.000 0.000 0.000
ACOLOR = 0.800 0.500 0.200
ALENGTH = 12.000
AMOTORED = 0
ANAME = AXLE3
ARADIUS = 1.000
AAXIS = 2
APOSITION = 1.000 0.000 0.000
ACOLOR = 0.800 0.500 0.200
ALENGTH = 6.000
AMOTORED = 0
ANAME = AXLE4
ARADIUS = 1.000
AAXIS = 2
APOSITION = 8.000 0.000 0.000
ACOLOR = 0.800 0.500 0.200
ALENGTH = 18.000
AMOTORED = 0
ANAME = AXLE5
ARADIUS = 1.000
AAXIS = 1
APOSITION = 8.000 -8.200 -7.400
ACOLOR = 0.800 0.500 0.200
ALENGTH = 12.000
AMOTORED = 0
GNAME = GEAR1
GTYPE = NORMAL
GRADIUS = 2.200
GWIDTH = 3.000
GTEETH = 40
GTOOTHDEPTH = 0.500
GCOLOR = 0.500 0.500 0.500
GAXLE = AXLE1
GPOSITION = 0.000
GNAME = GEAR2
GTYPE = NORMAL
GRADIUS = 2.200
GWIDTH = 3.000
GTEETH = 30
GTOOTHDEPTH = 0.500
GCOLOR = 0.500 0.500 0.500
GAXLE = AXLE2
GPOSITION = 0.000
GNAME = GEAR3
GTYPE = NORMAL
GRADIUS = 2.200
GWIDTH = 3.000
GTEETH = 20
GTOOTHDEPTH = 0.500
GCOLOR = 0.500 0.500 0.500
GAXLE = AXLE3
GPOSITION = 0.000
GNAME = GEAR4
GTYPE = NORMAL
GRADIUS = 1.700
GWIDTH = 1.000
GTEETH = 20
GTOOTHDEPTH = 0.500
GCOLOR = 0.500 0.500 0.500
GAXLE = AXLE2
GPOSITION = 5.000
GNAME = GEAR5
GTYPE = NORMAL
GRADIUS = 3.000
GWIDTH = 1.000
GTEETH = 20
GTOOTHDEPTH = 0.500
GCOLOR = 0.500 0.500 0.500
GAXLE = AXLE4
GPOSITION = 5.000
GNAME = GEAR6
GTYPE = BEVEL
GFACE = 0
GRADIUS = 4.000
GWIDTH = 1.000
GTEETH = 20
GTOOTHDEPTH = 1.700
GCOLOR = 0.500 0.500 0.500
GAXLE = AXLE4
GPOSITION = -4.000
GNAME = GEAR7
GTYPE = BEVEL
GFACE = 0
GRADIUS = 4.000
GWIDTH = 1.000
GTEETH = 20
GTOOTHDEPTH = 1.700
GCOLOR = 0.500 0.500 0.500
GAXLE = AXLE5
GPOSITION = 5.000
BELTNAME = BELT1
GEAR1NAME = GEAR5
GEAR2NAME = GEAR4
-32
View File
@@ -1,32 +0,0 @@
/*
* Print GL, GLU and GLUT version and extension info
*
* Brian Paul This file in public domain.
* October 3, 1997
*/
#include <stdio.h>
#include <GL/glut.h>
int main( int argc, char *argv[] )
{
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGB );
glutCreateWindow(argv[0]);
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("GLUT_API_VERSION: %d\n", GLUT_API_VERSION);
#ifdef GLUT_XLIB_IMPLEMENTATION
printf("GLUT_XLIB_IMPLEMENTATION: %d\n", GLUT_XLIB_IMPLEMENTATION);
#endif
return 0;
}
-475
View File
@@ -1,475 +0,0 @@
/*
* Specular reflection demo. The specular highlight is modulated by
* a sphere-mapped texture. The result is a high-gloss surface.
* NOTE: you really need hardware acceleration for this.
* Also note, this technique can't be implemented with multi-texture
* and separate specular color interpolation because there's no way
* to indicate that the second texture unit (the reflection map)
* should modulate the specular color and not the base color.
* A future multi-texture extension could fix that.
*
* Command line options:
* -info print GL implementation information
*
*
* Brian Paul October 22, 1999 This program is in the public domain.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include "readtex.h"
#include "trackball.h"
#define SPECULAR_TEXTURE_FILE "../images/reflect.rgb"
#define BASE_TEXTURE_FILE "../images/tile.rgb"
/* Menu items */
#define DO_SPEC_TEXTURE 1
#define OBJECT 2
#define ANIMATE 3
#define QUIT 100
/* for convolution */
#define FILTER_SIZE 7
static GLint Win;
static GLint WinWidth = 500, WinHeight = 500;
static GLuint CylinderObj = 0;
static GLuint TeapotObj = 0;
static GLuint Object = 0;
static GLboolean Animate = GL_TRUE;
static float CurQuat[4] = { 0, 0, 0, 1 };
static GLfloat Black[4] = { 0, 0, 0, 0 };
static GLfloat White[4] = { 1, 1, 1, 1 };
static GLfloat Diffuse[4] = { .3, .3, 1.0, 1.0 }; /* blue */
static GLfloat Shininess = 6;
static GLuint BaseTexture, SpecularTexture;
static GLboolean DoSpecTexture = GL_TRUE;
static GLboolean ButtonDown = GL_FALSE;
static GLint ButtonX, ButtonY;
/* performance info */
static GLint T0 = 0;
static GLint Frames = 0;
static void Idle( void )
{
static const float yAxis[3] = {0, 1, 0};
static double t0 = -1.;
float quat[4];
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
axis_to_quat(yAxis, 2.0 * dt, quat);
add_quats(quat, CurQuat, CurQuat);
glutPostRedisplay();
}
static void Display( void )
{
GLfloat rot[4][4];
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();
build_rotmatrix(rot, CurQuat);
glMultMatrixf(&rot[0][0]);
/* First pass: diffuse lighting with base texture */
glMaterialfv(GL_FRONT, GL_DIFFUSE, Diffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, Black);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, BaseTexture);
glCallList(Object);
/* Second pass: specular lighting with reflection texture */
glEnable(GL_POLYGON_OFFSET_FILL);
glBlendFunc(GL_ONE, GL_ONE); /* add */
glEnable(GL_BLEND);
glMaterialfv(GL_FRONT, GL_DIFFUSE, Black);
glMaterialfv(GL_FRONT, GL_SPECULAR, White);
if (DoSpecTexture) {
glBindTexture(GL_TEXTURE_2D, SpecularTexture);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
}
else {
glDisable(GL_TEXTURE_2D);
}
glCallList(Object);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_BLEND);
glDisable(GL_POLYGON_OFFSET_FILL);
glPopMatrix();
glutSwapBuffers();
if (Animate) {
GLint t = glutGet(GLUT_ELAPSED_TIME);
Frames++;
if (t - T0 >= 5000) {
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
printf("%d frames in %g seconds = %g FPS\n", Frames, seconds, fps);
fflush(stdout);
T0 = t;
Frames = 0;
}
}
}
static void Reshape( int width, int height )
{
GLfloat h = 30.0;
GLfloat w = h * width / height;
WinWidth = width;
WinHeight = height;
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -w, w, -h, h, 150.0, 500.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -380.0 );
}
static void ToggleAnimate(void)
{
Animate = !Animate;
if (Animate) {
glutIdleFunc( Idle );
T0 = glutGet(GLUT_ELAPSED_TIME);
Frames = 0;
}
else {
glutIdleFunc( NULL );
}
}
static void ModeMenu(int entry)
{
if (entry==ANIMATE) {
ToggleAnimate();
}
else if (entry==DO_SPEC_TEXTURE) {
DoSpecTexture = !DoSpecTexture;
}
else if (entry==OBJECT) {
if (Object == TeapotObj)
Object = CylinderObj;
else
Object = TeapotObj;
}
else if (entry==QUIT) {
exit(0);
}
glutPostRedisplay();
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 's':
Shininess--;
if (Shininess < 0.0)
Shininess = 0.0;
glMaterialf(GL_FRONT, GL_SHININESS, Shininess);
printf("Shininess = %g\n", Shininess);
break;
case 'S':
Shininess++;
if (Shininess > 128.0)
Shininess = 128.0;
glMaterialf(GL_FRONT, GL_SHININESS, Shininess);
printf("Shininess = %g\n", Shininess);
break;
case 'a':
case ' ':
ToggleAnimate();
break;
case 'n':
Idle();
break;
case 27:
glutDestroyWindow(Win);
exit(0);
break;
}
glutPostRedisplay();
}
static void
MouseMotion(int x, int y)
{
if (ButtonDown) {
float x0 = (2.0 * ButtonX - WinWidth) / WinWidth;
float y0 = (WinHeight - 2.0 * ButtonY) / WinHeight;
float x1 = (2.0 * x - WinWidth) / WinWidth;
float y1 = (WinHeight - 2.0 * y) / WinHeight;
float q[4];
trackball(q, x0, y0, x1, y1);
ButtonX = x;
ButtonY = y;
add_quats(q, CurQuat, CurQuat);
glutPostRedisplay();
}
}
static void
MouseButton(int button, int state, int x, int y)
{
if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) {
ButtonDown = GL_TRUE;
ButtonX = x;
ButtonY = y;
}
else if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) {
ButtonDown = GL_FALSE;
}
}
static void Init( int argc, char *argv[] )
{
GLboolean convolve = GL_FALSE;
GLboolean fullscreen = GL_FALSE;
int i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-info")==0) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
else if (strcmp(argv[i], "-c")==0) {
convolve = GL_TRUE;
}
else if (strcmp(argv[i], "-f")==0) {
fullscreen = GL_TRUE;
}
}
if (convolve && !glutExtensionSupported("GL_ARB_imaging")) {
fprintf(stderr,
"GL_ARB_imaging is not supported, disabling convolution.\n");
exit(1);
}
if (fullscreen)
glutFullScreen();
/* Cylinder object */
{
static GLfloat height = 100.0;
static GLfloat radius = 40.0;
static GLint slices = 24; /* pie slices around Z axis */
static GLint stacks = 10; /* subdivisions along length of cylinder */
static GLint rings = 4; /* rings in the end disks */
GLUquadricObj *q = gluNewQuadric();
assert(q);
gluQuadricTexture(q, GL_TRUE);
CylinderObj = glGenLists(1);
glNewList(CylinderObj, GL_COMPILE);
glPushMatrix();
glTranslatef(0.0, 0.0, -0.5 * height);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
/*glScalef(8.0, 4.0, 2.0);*/
glMatrixMode(GL_MODELVIEW);
/* cylinder */
gluQuadricNormals(q, GL_SMOOTH);
gluQuadricTexture(q, GL_TRUE);
gluCylinder(q, radius, radius, height, slices, stacks);
/* end cap */
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glScalef(3.0, 3.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glTranslatef(0.0, 0.0, height);
gluDisk(q, 0.0, radius, slices, rings);
/* other end cap */
glTranslatef(0.0, 0.0, -height);
gluQuadricOrientation(q, GLU_INSIDE);
gluDisk(q, 0.0, radius, slices, rings);
glPopMatrix();
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glEndList();
gluDeleteQuadric(q);
}
/* Teapot */
{
TeapotObj = glGenLists(1);
glNewList(TeapotObj, GL_COMPILE);
glFrontFace(GL_CW);
glutSolidTeapot(40.0);
glFrontFace(GL_CCW);
glEndList();
}
/* show cylinder by default */
Object = CylinderObj;
/* lighting */
glEnable(GL_LIGHTING);
{
GLfloat pos[4] = { 3, 3, 3, 1 };
glLightfv(GL_LIGHT0, GL_AMBIENT, Black);
glLightfv(GL_LIGHT0, GL_DIFFUSE, White);
glLightfv(GL_LIGHT0, GL_SPECULAR, White);
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_LIGHT0);
glMaterialfv(GL_FRONT, GL_AMBIENT, Black);
glMaterialf(GL_FRONT, GL_SHININESS, Shininess);
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
}
/* Base texture */
glGenTextures(1, &BaseTexture);
glBindTexture(GL_TEXTURE_2D, BaseTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
if (!LoadRGBMipmaps(BASE_TEXTURE_FILE, GL_RGB)) {
printf("Error: couldn't load texture image file %s\n", BASE_TEXTURE_FILE);
exit(1);
}
/* Specular texture */
glGenTextures(1, &SpecularTexture);
glBindTexture(GL_TEXTURE_2D, SpecularTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
if (convolve) {
/* use convolution to blur the texture to simulate a dull finish
* on the object.
*/
GLubyte *img;
GLenum format;
GLint w, h;
GLfloat filter[FILTER_SIZE][FILTER_SIZE][4];
for (h = 0; h < FILTER_SIZE; h++) {
for (w = 0; w < FILTER_SIZE; w++) {
const GLfloat k = 1.0 / (FILTER_SIZE * FILTER_SIZE);
filter[h][w][0] = k;
filter[h][w][1] = k;
filter[h][w][2] = k;
filter[h][w][3] = k;
}
}
glEnable(GL_CONVOLUTION_2D);
glConvolutionParameteri(GL_CONVOLUTION_2D,
GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER);
glConvolutionFilter2D(GL_CONVOLUTION_2D, GL_RGBA,
FILTER_SIZE, FILTER_SIZE,
GL_RGBA, GL_FLOAT, filter);
img = LoadRGBImage(SPECULAR_TEXTURE_FILE, &w, &h, &format);
if (!img) {
printf("Error: couldn't load texture image file %s\n",
SPECULAR_TEXTURE_FILE);
exit(1);
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0,
format, GL_UNSIGNED_BYTE, img);
free(img);
}
else {
/* regular path */
if (!LoadRGBMipmaps(SPECULAR_TEXTURE_FILE, GL_RGB)) {
printf("Error: couldn't load texture image file %s\n",
SPECULAR_TEXTURE_FILE);
exit(1);
}
}
/* misc */
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glPolygonOffset( -1, -1 );
}
int main( int argc, char *argv[] )
{
glutInitWindowSize(WinWidth, WinHeight);
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
Win = glutCreateWindow(argv[0] );
glewInit();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
glutMotionFunc(MouseMotion);
glutMouseFunc(MouseButton);
if (Animate)
glutIdleFunc( Idle );
glutCreateMenu(ModeMenu);
glutAddMenuEntry("Toggle Highlight", DO_SPEC_TEXTURE);
glutAddMenuEntry("Toggle Object", OBJECT);
glutAddMenuEntry("Toggle Animate", ANIMATE);
glutAddMenuEntry("Quit", QUIT);
glutAttachMenu(GLUT_RIGHT_BUTTON);
Init(argc, argv);
glutMainLoop();
return 0;
}
-580
View File
@@ -1,580 +0,0 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (tech.hmw@plus.it)
* Humanware s.r.l.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <GL/glut.h>
typedef struct
{
char *name;
char *unit;
void (*init) (void);
int (*run) (int, int);
int type;
int numsize;
int size[10];
}
benchmark;
static int frontbuffer = 1;
/***************************************************************************/
static void
init_test01(void)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-0.5, 639.5, -0.5, 479.5);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_FLAT);
glDisable(GL_DEPTH_TEST);
glClearColor(0.0, 0.1, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 0.0, 0.0);
}
static int
test01(int size, int num)
{
int x, y;
glBegin(GL_POINTS);
for (y = 0; y < num; y++)
for (x = 0; x < 480; x++)
glVertex2i(x, x);
glEnd();
return 480 * num;
}
/***************************************************************************/
static void
init_test02(void)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-0.5, 639.5, -0.5, 479.5);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_SMOOTH);
glDisable(GL_DEPTH_TEST);
glClearColor(0.0, 0.1, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
}
static int
test02(int size, int num)
{
int x, y;
glBegin(GL_LINES);
for (y = 0; y < num; y++)
for (x = 0; x < size; x++) {
glColor3f(0.0, 1.0, y / (float) num);
glVertex2i(0, size - 1);
glColor3f(1.0, 0.0, x / (float) size);
glVertex2i(x, x);
}
glEnd();
return num * size;
}
/***************************************************************************/
static void
init_test03(void)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, 1.0, -1000.0 * 480.0);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glClearColor(0.0, 0.1, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
static int
test03(int size, int num)
{
int x, y, z;
glBegin(GL_TRIANGLES);
for (y = 0; y < num; y++)
for (x = 0; x < size; x += 5) {
z = num * size - (y * size + x);
glColor3f(0.0, 1.0, 0.0);
glVertex3i(0, x, z);
glColor3f(1.0, 0.0, x / (float) size);
glVertex3i(size - 1 - x, 0, z);
glColor3f(1.0, x / (float) size, 0.0);
glVertex3i(x, size - 1 - x, z);
}
glEnd();
return size * num / 5;
}
/***************************************************************************/
static void
init_test04(void)
{
int x, y;
GLubyte tex[128 * 128 * 3];
GLenum gluerr;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, 1.0, -1000.0 * 480.0);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
for (y = 0; y < 128; y++)
for (x = 0; x < 128; x++) {
tex[(x + y * 128) * 3 + 0] = ((x % (128 / 4)) < (128 / 8)) ? 255 : 0;
tex[(x + y * 128) * 3 + 1] = ((y % (128 / 4)) < (128 / 8)) ? 255 : 0;
tex[(x + y * 128) * 3 + 2] = x;
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if ((gluerr = gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 128, 128, GL_RGB,
GL_UNSIGNED_BYTE, (GLvoid *) (&tex[0])))) {
fprintf(stderr, "GLULib%s\n", (char *) gluErrorString(gluerr));
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_TEXTURE_2D);
glClearColor(0.0, 0.1, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
static int
test04(int size, int num)
{
int x, y, z;
glBegin(GL_TRIANGLES);
for (y = 0; y < num; y++)
for (x = 0; x < size; x += 5) {
z = num * size - (y * size + x);
glTexCoord2f(1.0, 1.0);
glColor3f(1.0, 0.0, 0.0);
glVertex3i(0, x, z);
glTexCoord2f(0.0, 1.0);
glColor3f(0.0, 1.0, 0.0);
glVertex3i(size - 1 - x, 0, z);
glTexCoord2f(1.0, 0.0);
glColor3f(0.0, 0.0, 1.0);
glVertex3i(x, size - 1 - x, z);
}
glEnd();
return num * size / 5;
}
/***************************************************************************/
static void
init_test05(void)
{
int x, y;
GLubyte tex[128 * 128 * 3];
GLenum gluerr;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
for (y = 0; y < 128; y++)
for (x = 0; x < 128; x++) {
tex[(x + y * 128) * 3 + 0] = ((x % (128 / 4)) < (128 / 8)) ? 255 : 0;
tex[(x + y * 128) * 3 + 1] = ((y % (128 / 4)) < (128 / 8)) ? 255 : 0;
tex[(x + y * 128) * 3 + 2] = x;
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if ((gluerr = gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 128, 128, GL_RGB,
GL_UNSIGNED_BYTE, (GLvoid *) (&tex[0])))) {
fprintf(stderr, "GLULib%s\n", (char *) gluErrorString(gluerr));
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_TEXTURE_2D);
glDepthFunc(GL_ALWAYS);
glClearColor(0.0, 0.1, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
static int
test05(int size, int num)
{
int y;
float v0[3], v1[3], v2[3], v3[3];
float cv0[3], cv1[3], cv2[3], cv3[3];
float tv0[3], tv1[3], tv2[3], tv3[3];
v0[0] = 320 - size / 2;
v0[1] = 240 - size / 2;
v0[2] = 0.0;
v1[0] = 320 + size / 2;
v1[1] = 240 - size / 2;
v1[2] = 0.0;
v2[0] = 320 - size / 2;
v2[1] = 240 + size / 2;
v2[2] = 0.0;
v3[0] = 320 + size / 2;
v3[1] = 240 + size / 2;
v3[2] = 0.0;
cv0[0] = 1.0;
cv0[1] = 0.0;
cv0[2] = 0.0;
cv1[0] = 1.0;
cv1[1] = 1.0;
cv1[2] = 0.0;
cv2[0] = 1.0;
cv2[1] = 0.0;
cv2[2] = 1.0;
cv3[0] = 1.0;
cv3[1] = 1.0;
cv3[2] = 1.0;
tv0[0] = 0.0;
tv0[1] = 0.0;
tv0[2] = 0.0;
tv1[0] = 1.0;
tv1[1] = 0.0;
tv1[2] = 0.0;
tv2[0] = 0.0;
tv2[1] = 1.0;
tv2[2] = 0.0;
tv3[0] = 1.0;
tv3[1] = 1.0;
tv3[2] = 0.0;
glBegin(GL_TRIANGLE_STRIP);
for (y = 0; y < num; y++) {
glColor3fv(cv0);
glTexCoord2fv(tv0);
glVertex3fv(v0);
glColor3fv(cv1);
glTexCoord2fv(tv1);
glVertex3fv(v1);
glColor3fv(cv2);
glTexCoord2fv(tv2);
glVertex3fv(v2);
glColor3fv(cv3);
glTexCoord2fv(tv3);
glVertex3fv(v3);
}
glEnd();
return 4 * num - 2;
}
/***************************************************************************/
static void
init_test06(void)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(-0.5, 639.5, -0.5, 479.5);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glClearColor(0.0, 0.1, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
static int
test06(int size, int num)
{
int y;
for (y = 0; y < num; y++) {
glClearColor(y / (float) num, 0.1, 1.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
return num;
}
/***************************************************************************/
#define BMARKS_TIME 5.0
#define NUM_BMARKS 6
/* 554 ~= sqrt(640*480) */
static benchmark bmarks[NUM_BMARKS] = {
{"Simple Points", "Pnts", init_test01, test01, 0, 0,
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}},
{"Smooth Lines", "Lins", init_test02, test02, 1, 5,
{480, 250, 100, 50, 25, 0, 0, 0, 0, 0}},
{"ZSmooth Triangles", "Tris", init_test03, test03, 1, 5,
{480, 250, 100, 50, 25, 0, 0, 0, 0, 0}},
{"ZSmooth Tex Blend Triangles", "Tris", init_test04, test04, 1, 5,
{480, 250, 100, 50, 25, 0, 0, 0, 0, 0}},
{"ZSmooth Tex Blend TMesh Triangles", "Tris", init_test05, test05, 2, 8,
{400, 250, 100, 50, 25, 10, 5, 2, 0, 0}},
{"Color/Depth Buffer Clears", "Clrs", init_test06, test06, 3, 0,
{554, 0, 0, 0, 0, 0, 0, 0, 0, 0}}
};
/***************************************************************************/
static void
dotest0param(benchmark * bmark)
{
float stime, etime, dtime, tottime, maxtime, mintime;
int num, numelem, calibnum, j;
glPushAttrib(GL_ALL_ATTRIB_BITS);
bmark->init();
stime = glutGet(GLUT_ELAPSED_TIME);
dtime = 0.0;
calibnum = 0;
while (dtime < 2.0) {
bmark->run(0, 1);
glFinish();
etime = glutGet(GLUT_ELAPSED_TIME);
dtime = (etime - stime) / 1000.0;
calibnum++;
}
glPopAttrib();
fprintf(stderr, "Elapsed time for the calibration test (%d): %f\n",
calibnum, dtime);
num = (int) ((BMARKS_TIME / dtime) * calibnum);
if (num < 1)
num = 1;
fprintf(stderr, "Selected number of benchmark iterations: %d\n", num);
mintime = HUGE_VAL;
maxtime = -HUGE_VAL;
for (tottime = 0.0, j = 0; j < 5; j++) {
glPushAttrib(GL_ALL_ATTRIB_BITS);
bmark->init();
stime = glutGet(GLUT_ELAPSED_TIME);
numelem = bmark->run(0, num);
glFinish();
etime = glutGet(GLUT_ELAPSED_TIME);
glPopAttrib();
dtime = (etime - stime) / 1000.0;
tottime += dtime;
fprintf(stderr, "Elapsed time for run %d: %f\n", j, dtime);
if (dtime < mintime)
mintime = dtime;
if (dtime > maxtime)
maxtime = dtime;
}
tottime -= mintime + maxtime;
fprintf(stdout, "%s\n%f %s/sec", bmark->name, numelem / (tottime / 3.0),
bmark->unit);
if (bmark->type == 3)
fprintf(stdout, ", MPixel Fill/sec: %f\n\n",
(numelem * bmark->size[0] * (float) bmark->size[0]) /
(1000000.0 * tottime / 3.0));
else
fprintf(stdout, "\n\n");
}
/***************************************************************************/
static void
dotest1param(benchmark * bmark)
{
float stime, etime, dtime, tottime, maxtime, mintime;
int num, numelem, calibnum, j, k;
fprintf(stdout, "%s\n", bmark->name);
for (j = 0; j < bmark->numsize; j++) {
fprintf(stderr, "Current size: %d\n", bmark->size[j]);
glPushAttrib(GL_ALL_ATTRIB_BITS);
bmark->init();
stime = glutGet(GLUT_ELAPSED_TIME);
dtime = 0.0;
calibnum = 0;
while (dtime < 2.0) {
bmark->run(bmark->size[j], 1);
glFinish();
etime = glutGet(GLUT_ELAPSED_TIME);
dtime = (etime - stime) / 1000.0;
calibnum++;
}
glPopAttrib();
fprintf(stderr, "Elapsed time for the calibration test (%d): %f\n",
calibnum, dtime);
num = (int) ((BMARKS_TIME / dtime) * calibnum);
if (num < 1)
num = 1;
fprintf(stderr, "Selected number of benchmark iterations: %d\n", num);
mintime = HUGE_VAL;
maxtime = -HUGE_VAL;
for (numelem = 1, tottime = 0.0, k = 0; k < 5; k++) {
glPushAttrib(GL_ALL_ATTRIB_BITS);
bmark->init();
stime = glutGet(GLUT_ELAPSED_TIME);
numelem = bmark->run(bmark->size[j], num);
glFinish();
etime = glutGet(GLUT_ELAPSED_TIME);
glPopAttrib();
dtime = (etime - stime) / 1000.0;
tottime += dtime;
fprintf(stderr, "Elapsed time for run %d: %f\n", k, dtime);
if (dtime < mintime)
mintime = dtime;
if (dtime > maxtime)
maxtime = dtime;
}
tottime -= mintime + maxtime;
fprintf(stdout, "SIZE=%03d => %f %s/sec", bmark->size[j],
numelem / (tottime / 3.0), bmark->unit);
if (bmark->type == 2)
fprintf(stdout, ", MPixel Fill/sec: %f\n",
(numelem * bmark->size[j] * bmark->size[j] / 2) /
(1000000.0 * tottime / 3.0));
else
fprintf(stdout, "\n");
}
fprintf(stdout, "\n\n");
}
/***************************************************************************/
static void
display(void)
{
int i;
if (frontbuffer)
glDrawBuffer(GL_FRONT);
else
glDrawBuffer(GL_BACK);
for (i = 0; i < NUM_BMARKS; i++) {
fprintf(stderr, "Benchmark: %d\n", i);
switch (bmarks[i].type) {
case 0:
case 3:
dotest0param(&bmarks[i]);
break;
case 1:
case 2:
dotest1param(&bmarks[i]);
break;
}
}
exit(0);
}
int
main(int ac, char **av)
{
fprintf(stderr, "GLTest v1.0\nWritten by David Bucciarelli\n");
if (ac == 2)
frontbuffer = 0;
glutInitWindowSize(640, 480);
glutInit(&ac, av);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutCreateWindow("OpenGL/Mesa Performances");
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
-731
View File
@@ -1,731 +0,0 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (tech.hmw@plus.it)
* Humanware s.r.l.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#if defined (WIN32)|| defined(_WIN32)
#include <windows.h>
#include <mmsystem.h>
#endif
#include <GL/glut.h>
#include "readtex.h"
#ifdef XMESA
#include "GL/xmesa.h"
static int fullscreen = 1;
#endif
static int WIDTH = 640;
static int HEIGHT = 480;
static GLint T0;
static GLint Frames;
#define MAX_LOD 9
#define TEX_SKY_WIDTH 256
#define TEX_SKY_HEIGHT TEX_SKY_WIDTH
#ifndef M_PI
#define M_PI 3.1415926535
#endif
#define FROM_NONE 0
#define FROM_DOWN 1
#define FROM_UP 2
#define FROM_LEFT 3
#define FROM_RIGHT 4
#define FROM_FRONT 5
#define FROM_BACK 6
static int win = 0;
static float obs[3] = { 3.8, 0.0, 0.0 };
static float dir[3];
static float v = 0.0;
static float alpha = -90.0;
static float beta = 90.0;
static int fog = 1;
static int bfcull = 1;
static int usetex = 1;
static int help = 1;
static int poutline = 0;
static int normext = 1;
static int joyavailable = 0;
static int joyactive = 0;
static int LODbias = 3;
static int maxdepth = MAX_LOD;
static unsigned int totpoly = 0;
static GLuint t1id, t2id;
static GLuint skydlist, LODdlist[MAX_LOD], LODnumpoly[MAX_LOD];
static void
initlight(void)
{
GLfloat lspec[4] = { 1.0, 1.0, 1.0, 1.0 };
static GLfloat lightpos[4] = { 30, 15.0, 30.0, 1.0 };
glLightfv(GL_LIGHT0, GL_POSITION, lightpos);
glLightfv(GL_LIGHT0, GL_SPECULAR, lspec);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 32.0);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, lspec);
}
static void
initdlists(void)
{
static int slicetable[MAX_LOD][2] = {
{21, 10},
{18, 9},
{15, 8},
{12, 7},
{9, 6},
{7, 5},
{5, 4},
{4, 3},
{3, 2}
};
GLUquadricObj *obj;
int i, xslices, yslices;
obj = gluNewQuadric();
skydlist = glGenLists(1);
glNewList(skydlist, GL_COMPILE);
glBindTexture(GL_TEXTURE_2D, t2id);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glColor3f(1.0f, 1.0f, 1.0f);
gluQuadricDrawStyle(obj, GLU_FILL);
gluQuadricNormals(obj, GLU_NONE);
gluQuadricTexture(obj, GL_TRUE);
gluQuadricOrientation(obj, GLU_INSIDE);
gluSphere(obj, 40.0f, 18, 9);
glEndList();
for (i = 0; i < MAX_LOD; i++) {
LODdlist[i] = glGenLists(1);
glNewList(LODdlist[i], GL_COMPILE);
gluQuadricDrawStyle(obj, GLU_FILL);
gluQuadricNormals(obj, GLU_SMOOTH);
gluQuadricTexture(obj, GL_TRUE);
gluQuadricOrientation(obj, GLU_OUTSIDE);
xslices = slicetable[i][0];
yslices = slicetable[i][1];
gluSphere(obj, 1.0f, xslices, yslices);
LODnumpoly[i] = xslices * (yslices - 2) + 2 * (xslices - 1);
glEndList();
}
gluDeleteQuadric(obj);
}
static void
inittextures(void)
{
GLubyte tsky[TEX_SKY_HEIGHT][TEX_SKY_WIDTH][3];
GLuint x, y;
GLfloat fact;
GLenum gluerr;
/* Brick */
glGenTextures(1, &t1id);
glBindTexture(GL_TEXTURE_2D, t1id);
if (!LoadRGBMipmaps("../images/bw.rgb", 3)) {
fprintf(stderr, "Error reading a texture.\n");
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
/* Sky */
glGenTextures(1, &t2id);
glBindTexture(GL_TEXTURE_2D, t2id);
for (y = 0; y < TEX_SKY_HEIGHT; y++)
for (x = 0; x < TEX_SKY_WIDTH; x++)
if (y < TEX_SKY_HEIGHT / 2) {
fact = y / (GLfloat) (TEX_SKY_HEIGHT / 2);
tsky[y][x][0] =
(GLubyte) (255.0f * (0.1f * fact + 0.3f * (1.0f - fact)));
tsky[y][x][1] =
(GLubyte) (255.0f * (0.2f * fact + 1.0f * (1.0f - fact)));
tsky[y][x][2] = 255;
}
else {
tsky[y][x][0] = tsky[TEX_SKY_HEIGHT - y - 1][x][0];
tsky[y][x][1] = tsky[TEX_SKY_HEIGHT - y - 1][x][1];
tsky[y][x][2] = 255;
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if (
(gluerr =
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TEX_SKY_WIDTH, TEX_SKY_HEIGHT,
GL_RGB, GL_UNSIGNED_BYTE, (GLvoid *) (tsky)))) {
fprintf(stderr, "GLULib%s\n", (char *) gluErrorString(gluerr));
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
static void
calcposobs(void)
{
dir[0] = sin(alpha * M_PI / 180.0);
dir[1] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0);
dir[2] = cos(beta * M_PI / 180.0);
if (dir[0] < 1.0e-5 && dir[0] > -1.0e-5)
dir[0] = 0;
if (dir[1] < 1.0e-5 && dir[1] > -1.0e-5)
dir[1] = 0;
if (dir[2] < 1.0e-5 && dir[2] > -1.0e-5)
dir[2] = 0;
obs[0] += v * dir[0];
obs[1] += v * dir[1];
obs[2] += v * dir[2];
}
static void
special(int k, int x, int y)
{
switch (k) {
case GLUT_KEY_LEFT:
alpha -= 2.0;
break;
case GLUT_KEY_RIGHT:
alpha += 2.0;
break;
case GLUT_KEY_DOWN:
beta -= 2.0;
break;
case GLUT_KEY_UP:
beta += 2.0;
break;
}
}
static void
cleanup(void)
{
int i;
glDeleteTextures(1, &t1id);
glDeleteTextures(1, &t2id);
glDeleteLists(skydlist, 1);
for (i = 0; i < MAX_LOD; i++) {
glDeleteLists(LODdlist[i], 1);
glDeleteLists(LODnumpoly[i], 1);
}
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27:
cleanup();
exit(0);
break;
case 'a':
v += 0.01;
break;
case 'z':
v -= 0.01;
break;
#ifdef XMESA
case ' ':
fullscreen = (!fullscreen);
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
break;
#endif
case '+':
LODbias--;
break;
case '-':
LODbias++;
break;
case 'j':
joyactive = (!joyactive);
break;
case 'h':
help = (!help);
break;
case 'f':
fog = (!fog);
break;
case 't':
usetex = (!usetex);
break;
case 'n':
normext = (!normext);
break;
case 'b':
if (bfcull) {
glDisable(GL_CULL_FACE);
bfcull = 0;
}
else {
glEnable(GL_CULL_FACE);
bfcull = 1;
}
break;
case 'p':
if (poutline) {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
poutline = 0;
usetex = 1;
}
else {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
poutline = 1;
usetex = 0;
}
break;
}
}
static void
reshape(int w, int h)
{
WIDTH = w;
HEIGHT = h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.0, w / (float) h, 0.8, 100.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0, 0, w, h);
}
static void
printstring(void *font, char *string)
{
int len, i;
len = (int) strlen(string);
for (i = 0; i < len; i++)
glutBitmapCharacter(font, string[i]);
}
static void
printhelp(void)
{
glEnable(GL_BLEND);
glColor4f(0.5, 0.5, 0.5, 0.5);
glRecti(40, 40, 600, 440);
glDisable(GL_BLEND);
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(300, 420);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help");
glRasterPos2i(60, 360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Toggle Textures");
glRasterPos2i(60, 330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog");
glRasterPos2i(60, 300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Toggle Back face culling");
glRasterPos2i(60, 270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate");
glRasterPos2i(60, 240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity");
glRasterPos2i(60, 210);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity");
glRasterPos2i(60, 180);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "p - Toggle Wire frame");
glRasterPos2i(60, 150);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"n - Toggle GL_EXT_rescale_normal extension");
glRasterPos2i(60, 120);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"+/- - Increase/decrease the Object maximum LOD");
glRasterPos2i(60, 90);
if (joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"j - Toggle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"(No Joystick control available)");
}
static void
dojoy(void)
{
#ifdef _WIN32
static UINT max[2] = { 0, 0 };
static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2];
MMRESULT res;
JOYINFO joy;
res = joyGetPos(JOYSTICKID1, &joy);
if (res == JOYERR_NOERROR) {
joyavailable = 1;
if (max[0] < joy.wXpos)
max[0] = joy.wXpos;
if (min[0] > joy.wXpos)
min[0] = joy.wXpos;
center[0] = (max[0] + min[0]) / 2;
if (max[1] < joy.wYpos)
max[1] = joy.wYpos;
if (min[1] > joy.wYpos)
min[1] = joy.wYpos;
center[1] = (max[1] + min[1]) / 2;
if (joyactive) {
if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0]))
alpha -=
2.0 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]);
if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1]))
beta += 2.0 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]);
if (joy.wButtons & JOY_BUTTON1)
v += 0.01;
if (joy.wButtons & JOY_BUTTON2)
v -= 0.01;
}
}
else
joyavailable = 0;
#endif
}
static void
drawipers(int depth, int from)
{
int lod;
if (depth == maxdepth)
return;
lod = depth + LODbias;
if (lod < 0)
lod = 0;
if (lod >= MAX_LOD)
return;
switch (from) {
case FROM_NONE:
glCallList(LODdlist[lod]);
depth++;
drawipers(depth, FROM_DOWN);
drawipers(depth, FROM_UP);
drawipers(depth, FROM_FRONT);
drawipers(depth, FROM_BACK);
drawipers(depth, FROM_LEFT);
drawipers(depth, FROM_RIGHT);
break;
case FROM_FRONT:
glPushMatrix();
glTranslatef(0.0f, -1.5f, 0.0f);
glScalef(0.5f, 0.5f, 0.5f);
glCallList(LODdlist[lod]);
depth++;
drawipers(depth, FROM_DOWN);
drawipers(depth, FROM_UP);
drawipers(depth, FROM_FRONT);
drawipers(depth, FROM_LEFT);
drawipers(depth, FROM_RIGHT);
glPopMatrix();
break;
case FROM_BACK:
glPushMatrix();
glTranslatef(0.0f, 1.5f, 0.0f);
glScalef(0.5f, 0.5f, 0.5f);
glCallList(LODdlist[lod]);
depth++;
drawipers(depth, FROM_DOWN);
drawipers(depth, FROM_UP);
drawipers(depth, FROM_BACK);
drawipers(depth, FROM_LEFT);
drawipers(depth, FROM_RIGHT);
glPopMatrix();
break;
case FROM_LEFT:
glPushMatrix();
glTranslatef(-1.5f, 0.0f, 0.0f);
glScalef(0.5f, 0.5f, 0.5f);
glCallList(LODdlist[lod]);
depth++;
drawipers(depth, FROM_DOWN);
drawipers(depth, FROM_UP);
drawipers(depth, FROM_FRONT);
drawipers(depth, FROM_BACK);
drawipers(depth, FROM_LEFT);
glPopMatrix();
break;
case FROM_RIGHT:
glPushMatrix();
glTranslatef(1.5f, 0.0f, 0.0f);
glScalef(0.5f, 0.5f, 0.5f);
glCallList(LODdlist[lod]);
depth++;
drawipers(depth, FROM_DOWN);
drawipers(depth, FROM_UP);
drawipers(depth, FROM_FRONT);
drawipers(depth, FROM_BACK);
drawipers(depth, FROM_RIGHT);
glPopMatrix();
break;
case FROM_DOWN:
glPushMatrix();
glTranslatef(0.0f, 0.0f, 1.5f);
glScalef(0.5f, 0.5f, 0.5f);
glCallList(LODdlist[lod]);
depth++;
drawipers(depth, FROM_DOWN);
drawipers(depth, FROM_FRONT);
drawipers(depth, FROM_BACK);
drawipers(depth, FROM_LEFT);
drawipers(depth, FROM_RIGHT);
glPopMatrix();
break;
case FROM_UP:
glPushMatrix();
glTranslatef(0.0f, 0.0f, -1.5f);
glScalef(0.5f, 0.5f, 0.5f);
glCallList(LODdlist[lod]);
depth++;
drawipers(depth, FROM_UP);
drawipers(depth, FROM_FRONT);
drawipers(depth, FROM_BACK);
drawipers(depth, FROM_LEFT);
drawipers(depth, FROM_RIGHT);
glPopMatrix();
break;
}
totpoly += LODnumpoly[lod];
}
static void
draw(void)
{
static char frbuf[80] = "";
static GLfloat alpha = 0.0f;
static GLfloat beta = 0.0f;
static float fr = 0.0;
static double t0 = -1.;
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
dojoy();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (usetex)
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
if (fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glPushMatrix();
calcposobs();
gluLookAt(obs[0], obs[1], obs[2],
obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2],
0.0, 0.0, 1.0);
/* Scene */
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
glBindTexture(GL_TEXTURE_2D, t1id);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor3f(1.0f, 1.0f, 1.0f);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
if (normext)
glEnable(GL_RESCALE_NORMAL_EXT);
else
glEnable(GL_NORMALIZE);
glPushMatrix();
glRotatef(alpha, 0.0f, 0.0f, 1.0f);
glRotatef(beta, 1.0f, 0.0f, 0.0f);
totpoly = 0;
drawipers(0, FROM_NONE);
glPopMatrix();
alpha += 4.f * dt;
beta += 2.4f * dt;
glDisable(GL_LIGHTING);
glDisable(GL_LIGHT0);
glShadeModel(GL_FLAT);
if (normext)
glDisable(GL_RESCALE_NORMAL_EXT);
else
glDisable(GL_NORMALIZE);
glCallList(skydlist);
glPopMatrix();
/* Help Screen */
sprintf(frbuf,
"Frame rate: %0.2f LOD: %d Tot. poly.: %d Poly/sec: %.1f",
fr, LODbias, totpoly, totpoly * fr);
glDisable(GL_TEXTURE_2D);
glDisable(GL_FOG);
glShadeModel(GL_FLAT);
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(10, 10);
printstring(GLUT_BITMAP_HELVETICA_18, frbuf);
glRasterPos2i(350, 470);
printstring(GLUT_BITMAP_HELVETICA_10,
"IperS V1.0 Written by David Bucciarelli (tech.hmw@plus.it)");
if (help)
printhelp();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glutSwapBuffers();
Frames++;
{
GLint t = glutGet(GLUT_ELAPSED_TIME);
if (t - T0 >= 2000) {
GLfloat seconds = (t - T0) / 1000.0;
fr = Frames / seconds;
T0 = t;
Frames = 0;
}
}
}
int
main(int ac, char **av)
{
float fogcolor[4] = { 0.7, 0.7, 0.7, 1.0 };
fprintf(stderr,
"IperS V1.0\nWritten by David Bucciarelli (tech.hmw@plus.it)\n");
glutInitWindowSize(WIDTH, HEIGHT);
glutInit(&ac, av);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
if (!(win = glutCreateWindow("IperS"))) {
fprintf(stderr, "Error, couldn't open window\n");
exit(-1);
}
reshape(WIDTH, HEIGHT);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP2);
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.006);
glHint(GL_FOG_HINT, GL_NICEST);
inittextures();
initdlists();
initlight();
glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]);
glClear(GL_COLOR_BUFFER_BIT);
calcposobs();
glutReshapeFunc(reshape);
glutDisplayFunc(draw);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutIdleFunc(draw);
glutMainLoop();
cleanup();
return 0;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-298
View File
@@ -1,298 +0,0 @@
/*
* GL_EXT_texture_lod_bias demo
*
* Thanks to Michael Vance for implementing this extension in Mesa.
*
* Brian Paul
* 20 March 2000
*
* Copyright (C) 2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <GL/glut.h>
#include <GL/glext.h>
#include "readtex.h"
#define TEXTURE_FILE "../images/girl.rgb"
static GLfloat Xrot = 0, Yrot = -30, Zrot = 0;
static GLboolean Anim = GL_TRUE;
static GLint Bias = 0, BiasStepSign = +1; /* ints avoid fp precision problem */
static GLint BiasMin = -400, BiasMax = 400;
static int win = 0;
static GLuint TexObj = 0;
static void
PrintString(const char *s)
{
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
}
static void Idle( void )
{
static int lastTime = 0;
int time = glutGet(GLUT_ELAPSED_TIME);
int step;
if (lastTime == 0)
lastTime = time;
else if (time - lastTime < 10)
return;
step = (time - lastTime) / 10 * BiasStepSign;
lastTime = time;
Bias += step;
if (Bias < BiasMin) {
Bias = BiasMin;
BiasStepSign = +1;
}
else if (Bias > BiasMax) {
Bias = BiasMax;
BiasStepSign = -1;
}
glutPostRedisplay();
}
static void Display( void )
{
char str[100];
glClear( GL_COLOR_BUFFER_BIT );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1, 1, -1, 1, -1, 1);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glDisable(GL_TEXTURE_2D);
glColor3f(1,1,1);
glRasterPos3f(-0.9, -0.9, 0.0);
sprintf(str, "Texture LOD Bias = %4.1f", Bias * 0.01);
PrintString(str);
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -8.0 );
glPushMatrix();
glRotatef(Xrot, 1, 0, 0);
glRotatef(Yrot, 0, 1, 0);
glRotatef(Zrot, 0, 0, 1);
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0.01 * Bias);
glBegin(GL_POLYGON);
glTexCoord2f(0, 0); glVertex2f(-1, -1);
glTexCoord2f(2, 0); glVertex2f( 1, -1);
glTexCoord2f(2, 2); glVertex2f( 1, 1);
glTexCoord2f(0, 2); glVertex2f(-1, 1);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
}
static void Key( unsigned char key, int x, int y )
{
const GLfloat step = 3.0;
(void) x;
(void) y;
switch (key) {
case 'a':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
case 'z':
Zrot -= step;
break;
case 'Z':
Zrot += step;
break;
case 'b':
Bias -= 10;
break;
case 'B':
Bias += 10;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
Bias = 100.0 * (key - '0');
break;
case 27:
glutDestroyWindow(win);
exit(0);
break;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
const GLfloat step = 3.0;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
Xrot -= step;
break;
case GLUT_KEY_DOWN:
Xrot += step;
break;
case GLUT_KEY_LEFT:
Yrot -= step;
break;
case GLUT_KEY_RIGHT:
Yrot += step;
break;
}
glutPostRedisplay();
}
static void Init( void )
{
GLfloat maxBias;
if (!glutExtensionSupported("GL_EXT_texture_lod_bias")) {
printf("Sorry, GL_EXT_texture_lod_bias not supported by this renderer.\n");
exit(1);
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1, &TexObj);
glBindTexture(GL_TEXTURE_2D, TexObj);
if (glutExtensionSupported("GL_SGIS_generate_mipmap")) {
/* test auto mipmap generation */
GLint width, height, i;
GLenum format;
GLubyte *image = LoadRGBImage(TEXTURE_FILE, &width, &height, &format);
if (!image) {
printf("Error: could not load texture image %s\n", TEXTURE_FILE);
exit(1);
}
/* resize to 256 x 256 */
if (width != 256 || height != 256) {
GLubyte *newImage = malloc(256 * 256 * 4);
gluScaleImage(format, width, height, GL_UNSIGNED_BYTE, image,
256, 256, GL_UNSIGNED_BYTE, newImage);
free(image);
image = newImage;
}
printf("Using GL_SGIS_generate_mipmap\n");
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
glTexImage2D(GL_TEXTURE_2D, 0, format, 256, 256, 0,
format, GL_UNSIGNED_BYTE, image);
free(image);
/* make sure mipmap was really generated correctly */
width = height = 256;
for (i = 0; i < 9; i++) {
GLint w, h;
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_WIDTH, &w);
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_HEIGHT, &h);
printf("Level %d size: %d x %d\n", i, w, h);
assert(w == width);
assert(h == height);
width /= 2;
height /= 2;
}
}
else if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB)) {
printf("Error: could not load texture image %s\n", TEXTURE_FILE);
exit(1);
}
/* mipmapping required for this extension */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glGetFloatv(GL_MAX_TEXTURE_LOD_BIAS_EXT, &maxBias);
printf("LOD bias range: [%g, %g]\n", -maxBias, maxBias);
BiasMin = -100 * maxBias;
BiasMax = 100 * maxBias;
/* Since we have (about) 8 mipmap levels, no need to bias beyond
* the range [-1, +8].
*/
if (BiasMin < -100)
BiasMin = -100;
if (BiasMax > 800)
BiasMax = 800;
}
int main( int argc, char *argv[] )
{
glutInitWindowSize( 350, 350 );
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
win = glutCreateWindow(argv[0]);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
if (Anim)
glutIdleFunc(Idle);
Init();
glutMainLoop();
return 0;
}
-890
View File
@@ -1,890 +0,0 @@
/*-
* morph3d.c - Shows 3D morphing objects
*
* Converted to GLUT by brianp on 1/1/98
*
* This program was inspired on a WindowsNT(R)'s screen saver. It was written
* from scratch and it was not based on any other source code.
*
* Porting it to xlock (the final objective of this code since the moment I
* decided to create it) was possible by comparing the original Mesa's gear
* demo with it's ported version, so thanks for Danny Sung for his indirect
* help (look at gear.c in xlock source tree). NOTE: At the moment this code
* was sent to Brian Paul for package inclusion, the XLock Version was not
* available. In fact, I'll wait it to appear on the next Mesa release (If you
* are reading this, it means THIS release) to send it for xlock package
* inclusion). It will probably there be a GLUT version too.
*
* Thanks goes also to Brian Paul for making it possible and inexpensive
* to use OpenGL at home.
*
* Since I'm not a native english speaker, my apologies for any gramatical
* mistake.
*
* My e-mail addresses are
*
* vianna@cat.cbpf.br
* and
* marcelo@venus.rdc.puc-rio.br
*
* Marcelo F. Vianna (Feb-13-1997)
*/
/*
This document is VERY incomplete, but tries to describe the mathematics used
in the program. At this moment it just describes how the polyhedra are
generated. On futhurer versions, this document will be probabbly improved.
Since I'm not a native english speaker, my apologies for any gramatical
mistake.
Marcelo Fernandes Vianna
- Undergraduate in Computer Engeneering at Catholic Pontifical University
- of Rio de Janeiro (PUC-Rio) Brasil.
- e-mail: vianna@cat.cbpf.br or marcelo@venus.rdc.puc-rio.br
- Feb-13-1997
POLYHEDRA GENERATION
For the purpose of this program it's not sufficient to know the polyhedra
vertexes coordinates. Since the morphing algorithm applies a nonlinear
transformation over the surfaces (faces) of the polyhedron, each face has
to be divided into smaller ones. The morphing algorithm needs to transform
each vertex of these smaller faces individually. It's a very time consoming
task.
In order to reduce calculation overload, and since all the macro faces of
the polyhedron are transformed by the same way, the generation is made by
creating only one face of the polyhedron, morphing it and then rotating it
around the polyhedron center.
What we need to know is the face radius of the polyhedron (the radius of
the inscribed sphere) and the angle between the center of two adjacent
faces using the center of the sphere as the angle's vertex.
The face radius of the regular polyhedra are known values which I decided
to not waste my time calculating. Following is a table of face radius for
the regular polyhedra with edge length = 1:
TETRAHEDRON : 1/(2*sqrt(2))/sqrt(3)
CUBE : 1/2
OCTAHEDRON : 1/sqrt(6)
DODECAHEDRON : T^2 * sqrt((T+2)/5) / 2 -> where T=(sqrt(5)+1)/2
ICOSAHEDRON : (3*sqrt(3)+sqrt(15))/12
I've not found any reference about the mentioned angles, so I needed to
calculate them, not a trivial task until I figured out how :)
Curiously these angles are the same for the tetrahedron and octahedron.
A way to obtain this value is inscribing the tetrahedron inside the cube
by matching their vertexes. So you'll notice that the remaining unmatched
vertexes are in the same straight line starting in the cube/tetrahedron
center and crossing the center of each tetrahedron's face. At this point
it's easy to obtain the bigger angle of the isosceles triangle formed by
the center of the cube and two opposite vertexes on the same cube face.
The edges of this triangle have the following lenghts: sqrt(2) for the base
and sqrt(3)/2 for the other two other edges. So the angle we want is:
+-----------------------------------------------------------+
| 2*ARCSIN(sqrt(2)/sqrt(3)) = 109.47122063449069174 degrees |
+-----------------------------------------------------------+
For the cube this angle is obvious, but just for formality it can be
easily obtained because we also know it's isosceles edge lenghts:
sqrt(2)/2 for the base and 1/2 for the other two edges. So the angle we
want is:
+-----------------------------------------------------------+
| 2*ARCSIN((sqrt(2)/2)/1) = 90.000000000000000000 degrees |
+-----------------------------------------------------------+
For the octahedron we use the same idea used for the tetrahedron, but now
we inscribe the cube inside the octahedron so that all cubes's vertexes
matches excatly the center of each octahedron's face. It's now clear that
this angle is the same of the thetrahedron one:
+-----------------------------------------------------------+
| 2*ARCSIN(sqrt(2)/sqrt(3)) = 109.47122063449069174 degrees |
+-----------------------------------------------------------+
For the dodecahedron it's a little bit harder because it's only relationship
with the cube is useless to us. So we need to solve the problem by another
way. The concept of Face radius also exists on 2D polygons with the name
Edge radius:
Edge Radius For Pentagon (ERp)
ERp = (1/2)/TAN(36 degrees) * VRp = 0.6881909602355867905
(VRp is the pentagon's vertex radio).
Face Radius For Dodecahedron
FRd = T^2 * sqrt((T+2)/5) / 2 = 1.1135163644116068404
Why we need ERp? Well, ERp and FRd segments forms a 90 degrees angle,
completing this triangle, the lesser angle is a half of the angle we are
looking for, so this angle is:
+-----------------------------------------------------------+
| 2*ARCTAN(ERp/FRd) = 63.434948822922009981 degrees |
+-----------------------------------------------------------+
For the icosahedron we can use the same method used for dodecahedron (well
the method used for dodecahedron may be used for all regular polyhedra)
Edge Radius For Triangle (this one is well known: 1/3 of the triangle height)
ERt = sin(60)/3 = sqrt(3)/6 = 0.2886751345948128655
Face Radius For Icosahedron
FRi= (3*sqrt(3)+sqrt(15))/12 = 0.7557613140761707538
So the angle is:
+-----------------------------------------------------------+
| 2*ARCTAN(ERt/FRi) = 41.810314895778596167 degrees |
+-----------------------------------------------------------+
*/
#include <stdio.h>
#include <stdlib.h>
#ifndef _WIN32
#include <unistd.h>
#endif
#include <GL/glut.h>
#include <math.h>
#define Scale 0.3
#define VectMul(X1,Y1,Z1,X2,Y2,Z2) (Y1)*(Z2)-(Z1)*(Y2),(Z1)*(X2)-(X1)*(Z2),(X1)*(Y2)-(Y1)*(X2)
#define sqr(A) ((A)*(A))
/* Increasing this values produces better image quality, the price is speed. */
/* Very low values produces erroneous/incorrect plotting */
#define tetradivisions 23
#define cubedivisions 20
#define octadivisions 21
#define dodecadivisions 10
#define icodivisions 15
#define tetraangle 109.47122063449069174
#define cubeangle 90.000000000000000000
#define octaangle 109.47122063449069174
#define dodecaangle 63.434948822922009981
#define icoangle 41.810314895778596167
#ifndef Pi
#define Pi 3.1415926535897932385
#endif
#define SQRT2 1.4142135623730951455
#define SQRT3 1.7320508075688771932
#define SQRT5 2.2360679774997898051
#define SQRT6 2.4494897427831778813
#define SQRT15 3.8729833462074170214
#define cossec36_2 0.8506508083520399322
#define cos72 0.3090169943749474241
#define sin72 0.9510565162951535721
#define cos36 0.8090169943749474241
#define sin36 0.5877852522924731292
/*************************************************************************/
static int mono=0;
static int smooth=1;
static int anim=1;
static GLint WindH, WindW;
static GLfloat step=0;
static GLfloat seno;
static int object;
static int edgedivisions;
static void (*draw_object)( void );
static float Magnitude;
static float *MaterialColor[20];
static float front_shininess[] = {60.0};
static float front_specular[] = { 0.7, 0.7, 0.7, 1.0 };
static float ambient[] = { 0.0, 0.0, 0.0, 1.0 };
static float diffuse[] = { 1.0, 1.0, 1.0, 1.0 };
static float position0[] = { 1.0, 1.0, 1.0, 0.0 };
static float position1[] = {-1.0,-1.0, 1.0, 0.0 };
static float lmodel_ambient[] = { 0.5, 0.5, 0.5, 1.0 };
static float lmodel_twoside[] = {GL_TRUE};
static float MaterialRed[] = { 0.7, 0.0, 0.0, 1.0 };
static float MaterialGreen[] = { 0.1, 0.5, 0.2, 1.0 };
static float MaterialBlue[] = { 0.0, 0.0, 0.7, 1.0 };
static float MaterialCyan[] = { 0.2, 0.5, 0.7, 1.0 };
static float MaterialYellow[] = { 0.7, 0.7, 0.0, 1.0 };
static float MaterialMagenta[] = { 0.6, 0.2, 0.5, 1.0 };
static float MaterialWhite[] = { 0.7, 0.7, 0.7, 1.0 };
static float MaterialGray[] = { 0.2, 0.2, 0.2, 1.0 };
#define TRIANGLE(Edge, Amp, Divisions, Z) \
{ \
GLfloat Xf,Yf,Xa,Yb,Xf2,Yf2; \
GLfloat Factor,Factor1,Factor2; \
GLfloat VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ; \
GLfloat Ax,Ay,Bx; \
int Ri,Ti; \
GLfloat Vr=(Edge)*SQRT3/3; \
GLfloat AmpVr2=(Amp)/sqr(Vr); \
GLfloat Zf=(Edge)*(Z); \
\
Ax=(Edge)*(+0.5/(Divisions)), Ay=(Edge)*(-SQRT3/(2*Divisions)); \
Bx=(Edge)*(-0.5/(Divisions)); \
\
for (Ri=1; Ri<=(Divisions); Ri++) { \
glBegin(GL_TRIANGLE_STRIP); \
for (Ti=0; Ti<Ri; Ti++) { \
Xf=(float)(Ri-Ti)*Ax + (float)Ti*Bx; \
Yf=Vr+(float)(Ri-Ti)*Ay + (float)Ti*Ay; \
Xa=Xf+0.001; Yb=Yf+0.001; \
Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
glVertex3f(VertX, VertY, VertZ); \
\
Xf=(float)(Ri-Ti-1)*Ax + (float)Ti*Bx; \
Yf=Vr+(float)(Ri-Ti-1)*Ay + (float)Ti*Ay; \
Xa=Xf+0.001; Yb=Yf+0.001; \
Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
glVertex3f(VertX, VertY, VertZ); \
\
} \
Xf=(float)Ri*Bx; \
Yf=Vr+(float)Ri*Ay; \
Xa=Xf+0.001; Yb=Yf+0.001; \
Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
glVertex3f(VertX, VertY, VertZ); \
glEnd(); \
} \
}
#define SQUARE(Edge, Amp, Divisions, Z) \
{ \
int Xi,Yi; \
GLfloat Xf,Yf,Y,Xf2,Yf2,Y2,Xa,Yb; \
GLfloat Factor,Factor1,Factor2; \
GLfloat VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ; \
GLfloat Zf=(Edge)*(Z); \
GLfloat AmpVr2=(Amp)/sqr((Edge)*SQRT2/2); \
\
for (Yi=0; Yi<(Divisions); Yi++) { \
Yf=-((Edge)/2.0) + ((float)Yi)/(Divisions)*(Edge); \
Yf2=sqr(Yf); \
Y=Yf+1.0/(Divisions)*(Edge); \
Y2=sqr(Y); \
glBegin(GL_QUAD_STRIP); \
for (Xi=0; Xi<=(Divisions); Xi++) { \
Xf=-((Edge)/2.0) + ((float)Xi)/(Divisions)*(Edge); \
Xf2=sqr(Xf); \
\
Xa=Xf+0.001; Yb=Y+0.001; \
Factor=1-((Xf2+Y2)*AmpVr2); \
Factor1=1-((sqr(Xa)+Y2)*AmpVr2); \
Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
VertX=Factor*Xf; VertY=Factor*Y; VertZ=Factor*Zf; \
NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Y-VertY; NeiAZ=Factor1*Zf-VertZ; \
NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
glVertex3f(VertX, VertY, VertZ); \
\
Xa=Xf+0.001; Yb=Yf+0.001; \
Factor=1-((Xf2+Yf2)*AmpVr2); \
Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
glVertex3f(VertX, VertY, VertZ); \
} \
glEnd(); \
} \
}
#define PENTAGON(Edge, Amp, Divisions, Z) \
{ \
int Ri,Ti,Fi; \
GLfloat Xf,Yf,Xa,Yb,Xf2,Yf2; \
GLfloat x[6],y[6]; \
GLfloat Factor,Factor1,Factor2; \
GLfloat VertX,VertY,VertZ,NeiAX,NeiAY,NeiAZ,NeiBX,NeiBY,NeiBZ; \
GLfloat Zf=(Edge)*(Z); \
GLfloat AmpVr2=(Amp)/sqr((Edge)*cossec36_2); \
\
for(Fi=0;Fi<6;Fi++) { \
x[Fi]=-cos( Fi*2*Pi/5 + Pi/10 )/(Divisions)*cossec36_2*(Edge); \
y[Fi]=sin( Fi*2*Pi/5 + Pi/10 )/(Divisions)*cossec36_2*(Edge); \
} \
\
for (Ri=1; Ri<=(Divisions); Ri++) { \
for (Fi=0; Fi<5; Fi++) { \
glBegin(GL_TRIANGLE_STRIP); \
for (Ti=0; Ti<Ri; Ti++) { \
Xf=(float)(Ri-Ti)*x[Fi] + (float)Ti*x[Fi+1]; \
Yf=(float)(Ri-Ti)*y[Fi] + (float)Ti*y[Fi+1]; \
Xa=Xf+0.001; Yb=Yf+0.001; \
Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
glVertex3f(VertX, VertY, VertZ); \
\
Xf=(float)(Ri-Ti-1)*x[Fi] + (float)Ti*x[Fi+1]; \
Yf=(float)(Ri-Ti-1)*y[Fi] + (float)Ti*y[Fi+1]; \
Xa=Xf+0.001; Yb=Yf+0.001; \
Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
glVertex3f(VertX, VertY, VertZ); \
\
} \
Xf=(float)Ri*x[Fi+1]; \
Yf=(float)Ri*y[Fi+1]; \
Xa=Xf+0.001; Yb=Yf+0.001; \
Factor=1-(((Xf2=sqr(Xf))+(Yf2=sqr(Yf)))*AmpVr2); \
Factor1=1-((sqr(Xa)+Yf2)*AmpVr2); \
Factor2=1-((Xf2+sqr(Yb))*AmpVr2); \
VertX=Factor*Xf; VertY=Factor*Yf; VertZ=Factor*Zf; \
NeiAX=Factor1*Xa-VertX; NeiAY=Factor1*Yf-VertY; NeiAZ=Factor1*Zf-VertZ; \
NeiBX=Factor2*Xf-VertX; NeiBY=Factor2*Yb-VertY; NeiBZ=Factor2*Zf-VertZ; \
glNormal3f(VectMul(NeiAX, NeiAY, NeiAZ, NeiBX, NeiBY, NeiBZ)); \
glVertex3f(VertX, VertY, VertZ); \
glEnd(); \
} \
} \
}
static void draw_tetra( void )
{
GLuint list;
list = glGenLists( 1 );
glNewList( list, GL_COMPILE );
TRIANGLE(2,seno,edgedivisions,0.5/SQRT6);
glEndList();
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
glCallList(list);
glPushMatrix();
glRotatef(180,0,0,1);
glRotatef(-tetraangle,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
glCallList(list);
glPopMatrix();
glPushMatrix();
glRotatef(180,0,1,0);
glRotatef(-180+tetraangle,0.5,SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
glCallList(list);
glPopMatrix();
glRotatef(180,0,1,0);
glRotatef(-180+tetraangle,0.5,-SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
glCallList(list);
glDeleteLists(list,1);
}
static void draw_cube( void )
{
GLuint list;
list = glGenLists( 1 );
glNewList( list, GL_COMPILE );
SQUARE(2, seno, edgedivisions, 0.5)
glEndList();
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
glCallList(list);
glRotatef(cubeangle,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
glCallList(list);
glRotatef(cubeangle,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
glCallList(list);
glRotatef(cubeangle,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
glCallList(list);
glRotatef(cubeangle,0,1,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
glCallList(list);
glRotatef(2*cubeangle,0,1,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
glCallList(list);
glDeleteLists(list,1);
}
static void draw_octa( void )
{
GLuint list;
list = glGenLists( 1 );
glNewList( list, GL_COMPILE );
TRIANGLE(2,seno,edgedivisions,1/SQRT6);
glEndList();
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
glCallList(list);
glPushMatrix();
glRotatef(180,0,0,1);
glRotatef(-180+octaangle,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
glCallList(list);
glPopMatrix();
glPushMatrix();
glRotatef(180,0,1,0);
glRotatef(-octaangle,0.5,SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
glCallList(list);
glPopMatrix();
glPushMatrix();
glRotatef(180,0,1,0);
glRotatef(-octaangle,0.5,-SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
glCallList(list);
glPopMatrix();
glRotatef(180,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
glCallList(list);
glPushMatrix();
glRotatef(180,0,0,1);
glRotatef(-180+octaangle,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
glCallList(list);
glPopMatrix();
glPushMatrix();
glRotatef(180,0,1,0);
glRotatef(-octaangle,0.5,SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]);
glCallList(list);
glPopMatrix();
glRotatef(180,0,1,0);
glRotatef(-octaangle,0.5,-SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]);
glCallList(list);
glDeleteLists(list,1);
}
static void draw_dodeca( void )
{
GLuint list;
#define TAU ((SQRT5+1)/2)
list = glGenLists( 1 );
glNewList( list, GL_COMPILE );
PENTAGON(1,seno,edgedivisions,sqr(TAU) * sqrt((TAU+2)/5) / 2);
glEndList();
glPushMatrix();
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
glCallList(list);
glRotatef(180,0,0,1);
glPushMatrix();
glRotatef(-dodecaangle,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
glCallList(list);
glPopMatrix();
glPushMatrix();
glRotatef(-dodecaangle,cos72,sin72,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
glCallList(list);
glPopMatrix();
glPushMatrix();
glRotatef(-dodecaangle,cos72,-sin72,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
glCallList(list);
glPopMatrix();
glPushMatrix();
glRotatef(dodecaangle,cos36,-sin36,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
glCallList(list);
glPopMatrix();
glRotatef(dodecaangle,cos36,sin36,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
glCallList(list);
glPopMatrix();
glRotatef(180,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]);
glCallList(list);
glRotatef(180,0,0,1);
glPushMatrix();
glRotatef(-dodecaangle,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]);
glCallList(list);
glPopMatrix();
glPushMatrix();
glRotatef(-dodecaangle,cos72,sin72,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[8]);
glCallList(list);
glPopMatrix();
glPushMatrix();
glRotatef(-dodecaangle,cos72,-sin72,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[9]);
glCallList(list);
glPopMatrix();
glPushMatrix();
glRotatef(dodecaangle,cos36,-sin36,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[10]);
glCallList(list);
glPopMatrix();
glRotatef(dodecaangle,cos36,sin36,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[11]);
glCallList(list);
glDeleteLists(list,1);
}
static void draw_ico( void )
{
GLuint list;
list = glGenLists( 1 );
glNewList( list, GL_COMPILE );
TRIANGLE(1.5,seno,edgedivisions,(3*SQRT3+SQRT15)/12);
glEndList();
glPushMatrix();
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[0]);
glCallList(list);
glPushMatrix();
glRotatef(180,0,0,1);
glRotatef(-icoangle,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[1]);
glCallList(list);
glPushMatrix();
glRotatef(180,0,1,0);
glRotatef(-180+icoangle,0.5,SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[2]);
glCallList(list);
glPopMatrix();
glRotatef(180,0,1,0);
glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[3]);
glCallList(list);
glPopMatrix();
glPushMatrix();
glRotatef(180,0,1,0);
glRotatef(-180+icoangle,0.5,SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[4]);
glCallList(list);
glPushMatrix();
glRotatef(180,0,1,0);
glRotatef(-180+icoangle,0.5,SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[5]);
glCallList(list);
glPopMatrix();
glRotatef(180,0,0,1);
glRotatef(-icoangle,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[6]);
glCallList(list);
glPopMatrix();
glRotatef(180,0,1,0);
glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[7]);
glCallList(list);
glPushMatrix();
glRotatef(180,0,1,0);
glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[8]);
glCallList(list);
glPopMatrix();
glRotatef(180,0,0,1);
glRotatef(-icoangle,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[9]);
glCallList(list);
glPopMatrix();
glRotatef(180,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[10]);
glCallList(list);
glPushMatrix();
glRotatef(180,0,0,1);
glRotatef(-icoangle,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[11]);
glCallList(list);
glPushMatrix();
glRotatef(180,0,1,0);
glRotatef(-180+icoangle,0.5,SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[12]);
glCallList(list);
glPopMatrix();
glRotatef(180,0,1,0);
glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[13]);
glCallList(list);
glPopMatrix();
glPushMatrix();
glRotatef(180,0,1,0);
glRotatef(-180+icoangle,0.5,SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[14]);
glCallList(list);
glPushMatrix();
glRotatef(180,0,1,0);
glRotatef(-180+icoangle,0.5,SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[15]);
glCallList(list);
glPopMatrix();
glRotatef(180,0,0,1);
glRotatef(-icoangle,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[16]);
glCallList(list);
glPopMatrix();
glRotatef(180,0,1,0);
glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[17]);
glCallList(list);
glPushMatrix();
glRotatef(180,0,1,0);
glRotatef(-180+icoangle,0.5,-SQRT3/2,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[18]);
glCallList(list);
glPopMatrix();
glRotatef(180,0,0,1);
glRotatef(-icoangle,1,0,0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, MaterialColor[19]);
glCallList(list);
glDeleteLists(list,1);
}
static void draw ( void ) {
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glPushMatrix();
glTranslatef( 0.0, 0.0, -10.0 );
glScalef( Scale*WindH/WindW, Scale, Scale );
glTranslatef(2.5*WindW/WindH*sin(step*1.11),2.5*cos(step*1.25*1.11),0);
glRotatef(step*100,1,0,0);
glRotatef(step*95,0,1,0);
glRotatef(step*90,0,0,1);
seno=(sin(step)+1.0/3.0)*(4.0/5.0)*Magnitude;
draw_object();
glPopMatrix();
glFlush();
glutSwapBuffers();
}
static void idle_( void )
{
static double t0 = -1.;
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
step += dt;
glutPostRedisplay();
}
static void reshape( int width, int height )
{
glViewport(0, 0, WindW=(GLint)width, WindH=(GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 );
glMatrixMode(GL_MODELVIEW);
}
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;
case '3': object=3; break;
case '4': object=4; break;
case '5': object=5; break;
case ' ': mono^=1; break;
case 's': smooth^=1; break;
case 'a':
anim^=1;
if (anim)
glutIdleFunc( idle_ );
else
glutIdleFunc(NULL);
break;
case 27:
exit(0);
}
pinit();
glutPostRedisplay();
}
static void pinit(void)
{
switch(object) {
case 1:
draw_object=draw_tetra;
MaterialColor[0]=MaterialRed;
MaterialColor[1]=MaterialGreen;
MaterialColor[2]=MaterialBlue;
MaterialColor[3]=MaterialWhite;
edgedivisions=tetradivisions;
Magnitude=2.5;
break;
case 2:
draw_object=draw_cube;
MaterialColor[0]=MaterialRed;
MaterialColor[1]=MaterialGreen;
MaterialColor[2]=MaterialCyan;
MaterialColor[3]=MaterialMagenta;
MaterialColor[4]=MaterialYellow;
MaterialColor[5]=MaterialBlue;
edgedivisions=cubedivisions;
Magnitude=2.0;
break;
case 3:
draw_object=draw_octa;
MaterialColor[0]=MaterialRed;
MaterialColor[1]=MaterialGreen;
MaterialColor[2]=MaterialBlue;
MaterialColor[3]=MaterialWhite;
MaterialColor[4]=MaterialCyan;
MaterialColor[5]=MaterialMagenta;
MaterialColor[6]=MaterialGray;
MaterialColor[7]=MaterialYellow;
edgedivisions=octadivisions;
Magnitude=2.5;
break;
case 4:
draw_object=draw_dodeca;
MaterialColor[ 0]=MaterialRed;
MaterialColor[ 1]=MaterialGreen;
MaterialColor[ 2]=MaterialCyan;
MaterialColor[ 3]=MaterialBlue;
MaterialColor[ 4]=MaterialMagenta;
MaterialColor[ 5]=MaterialYellow;
MaterialColor[ 6]=MaterialGreen;
MaterialColor[ 7]=MaterialCyan;
MaterialColor[ 8]=MaterialRed;
MaterialColor[ 9]=MaterialMagenta;
MaterialColor[10]=MaterialBlue;
MaterialColor[11]=MaterialYellow;
edgedivisions=dodecadivisions;
Magnitude=2.0;
break;
case 5:
draw_object=draw_ico;
MaterialColor[ 0]=MaterialRed;
MaterialColor[ 1]=MaterialGreen;
MaterialColor[ 2]=MaterialBlue;
MaterialColor[ 3]=MaterialCyan;
MaterialColor[ 4]=MaterialYellow;
MaterialColor[ 5]=MaterialMagenta;
MaterialColor[ 6]=MaterialRed;
MaterialColor[ 7]=MaterialGreen;
MaterialColor[ 8]=MaterialBlue;
MaterialColor[ 9]=MaterialWhite;
MaterialColor[10]=MaterialCyan;
MaterialColor[11]=MaterialYellow;
MaterialColor[12]=MaterialMagenta;
MaterialColor[13]=MaterialRed;
MaterialColor[14]=MaterialGreen;
MaterialColor[15]=MaterialBlue;
MaterialColor[16]=MaterialCyan;
MaterialColor[17]=MaterialYellow;
MaterialColor[18]=MaterialMagenta;
MaterialColor[19]=MaterialGray;
edgedivisions=icodivisions;
Magnitude=2.5;
break;
}
if (mono) {
int loop;
for (loop=0; loop<20; loop++) MaterialColor[loop]=MaterialGray;
}
if (smooth) {
glShadeModel( GL_SMOOTH );
} else {
glShadeModel( GL_FLAT );
}
}
int main(int argc, char **argv)
{
printf("Morph 3D - Shows morphing platonic polyhedra\n");
printf("Author: Marcelo Fernandes Vianna (vianna@cat.cbpf.br)\n\n");
printf(" [1] - Tetrahedron\n");
printf(" [2] - Hexahedron (Cube)\n");
printf(" [3] - Octahedron\n");
printf(" [4] - Dodecahedron\n");
printf(" [5] - Icosahedron\n");
printf("[SPACE] - Toggle colored faces\n");
printf("[RETURN] - Toggle smooth/flat shading\n");
printf(" [ESC] - Quit\n");
object=1;
glutInitWindowSize(640,480);
glutInit(&argc, argv);
glutInitDisplayMode( GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB );
if (glutCreateWindow("Morph 3D - Shows morphing platonic polyhedra") <= 0) {
exit(0);
}
glClearDepth(1.0);
glClearColor( 0.0, 0.0, 0.0, 1.0 );
glColor3f( 1.0, 1.0, 1.0 );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glFlush();
glutSwapBuffers();
glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT0, GL_POSITION, position0);
glLightfv(GL_LIGHT1, GL_AMBIENT, ambient);
glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse);
glLightfv(GL_LIGHT1, GL_POSITION, position1);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHT1);
glEnable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, front_shininess);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, front_specular);
glHint(GL_FOG_HINT, GL_FASTEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
pinit();
glutReshapeFunc( reshape );
glutKeyboardFunc( key );
glutIdleFunc( idle_ );
glutDisplayFunc( draw );
glutMainLoop();
return 0;
}
-369
View File
@@ -1,369 +0,0 @@
/*
* GL_ARB_multitexture demo
*
* Command line options:
* -info print GL implementation information
*
*
* Brian Paul November 1998 This program is in the public domain.
* Modified on 12 Feb 2002 for > 2 texture units.
*/
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <GL/glew.h>
#include <GL/glut.h>
#include "readtex.h"
#define TEXTURE_1_FILE "../images/girl.rgb"
#define TEXTURE_2_FILE "../images/reflect.rgb"
#define TEX0 1
#define TEX7 8
#define ANIMATE 10
#define QUIT 100
static GLint T0 = 0;
static GLint Frames = 0;
static GLboolean Animate = GL_TRUE;
static GLint NumUnits = 1;
static GLboolean TexEnabled[8];
static GLfloat Drift = 0.0;
static GLfloat Xrot = 20.0, Yrot = 30.0, Zrot = 0.0;
static void Idle( void )
{
if (Animate) {
GLint i;
Drift = glutGet(GLUT_ELAPSED_TIME) * 0.001;
for (i = 0; i < NumUnits; i++) {
glActiveTextureARB(GL_TEXTURE0_ARB + i);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
if (i == 0) {
glTranslatef(Drift, 0.0, 0.0);
glScalef(2, 2, 1);
}
else if (i == 1) {
glTranslatef(0.0, Drift, 0.0);
}
else {
float tx = 0.5, ty = 0.5;
glTranslatef(tx, ty, 0.0);
glRotatef(180.0 * Drift, 0, 0, 1);
glScalef(1.0/i, 1.0/i, 1.0/i);
glTranslatef(-tx, -ty + i * 0.1, 0.0);
}
}
glMatrixMode(GL_MODELVIEW);
glutPostRedisplay();
}
}
static void DrawObject(void)
{
static const GLfloat tex_coords[] = { 0.0, 0.0, 1.0, 1.0, 0.0 };
static const GLfloat vtx_coords[] = { -1.0, -1.0, 1.0, 1.0, -1.0 };
GLint i, j;
if (!TexEnabled[0] && !TexEnabled[1])
glColor3f(0.1, 0.1, 0.1); /* add onto this */
else
glColor3f(1, 1, 1); /* modulate this */
glBegin(GL_QUADS);
for (j = 0; j < 4; j++ ) {
for (i = 0; i < NumUnits; i++) {
if (TexEnabled[i])
glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i,
tex_coords[j], tex_coords[j+1]);
}
glVertex2f( vtx_coords[j], vtx_coords[j+1] );
}
glEnd();
}
static void Display( void )
{
glClear( GL_COLOR_BUFFER_BIT );
glPushMatrix();
glRotatef(Xrot, 1.0, 0.0, 0.0);
glRotatef(Yrot, 0.0, 1.0, 0.0);
glRotatef(Zrot, 0.0, 0.0, 1.0);
glScalef(5.0, 5.0, 5.0);
DrawObject();
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 %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
fflush(stdout);
T0 = t;
Frames = 0;
}
}
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 );
/*glOrtho( -6.0, 6.0, -6.0, 6.0, 10.0, 100.0 );*/
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -70.0 );
}
static void ToggleUnit(int unit)
{
TexEnabled[unit] = !TexEnabled[unit];
glActiveTextureARB(GL_TEXTURE0_ARB + unit);
if (TexEnabled[unit])
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
printf("Enabled: ");
for (unit = 0; unit < NumUnits; unit++)
printf("%d ", (int) TexEnabled[unit]);
printf("\n");
}
static void ModeMenu(int entry)
{
if (entry >= TEX0 && entry <= TEX7) {
/* toggle */
GLint i = entry - TEX0;
ToggleUnit(i);
}
else if (entry==ANIMATE) {
Animate = !Animate;
if (Animate)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
}
else if (entry==QUIT) {
exit(0);
}
glutPostRedisplay();
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 'a':
Animate = !Animate;
break;
case '0':
ToggleUnit(0);
break;
case '1':
ToggleUnit(1);
break;
case '2':
ToggleUnit(2);
break;
case '3':
ToggleUnit(3);
break;
case '4':
ToggleUnit(4);
break;
case '5':
ToggleUnit(5);
break;
case '6':
ToggleUnit(6);
break;
case '7':
ToggleUnit(7);
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
float step = 3.0;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
Xrot += step;
break;
case GLUT_KEY_DOWN:
Xrot -= step;
break;
case GLUT_KEY_LEFT:
Yrot += step;
break;
case GLUT_KEY_RIGHT:
Yrot -= step;
break;
}
glutPostRedisplay();
}
static void Init( int argc, char *argv[] )
{
GLuint texObj[8];
GLint size, i;
const char *exten = (const char *) glGetString(GL_EXTENSIONS);
if (!strstr(exten, "GL_ARB_multitexture")) {
printf("Sorry, GL_ARB_multitexture not supported by this renderer.\n");
exit(1);
}
glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &NumUnits);
printf("%d texture units supported\n", NumUnits);
if (NumUnits > 8)
NumUnits = 8;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size);
printf("%d x %d max texture size\n", size, size);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
for (i = 0; i < NumUnits; i++) {
if (i < 2)
TexEnabled[i] = GL_TRUE;
else
TexEnabled[i] = GL_FALSE;
}
/* allocate two texture objects */
glGenTextures(NumUnits, texObj);
/* setup the texture objects */
for (i = 0; i < NumUnits; i++) {
glActiveTextureARB(GL_TEXTURE0_ARB + i);
glBindTexture(GL_TEXTURE_2D, texObj[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (i == 0) {
if (!LoadRGBMipmaps(TEXTURE_1_FILE, GL_RGB)) {
printf("Error: couldn't load texture image\n");
exit(1);
}
}
else if (i == 1) {
if (!LoadRGBMipmaps(TEXTURE_2_FILE, GL_RGB)) {
printf("Error: couldn't load texture image\n");
exit(1);
}
}
else {
/* checker */
GLubyte image[8][8][3];
GLint i, j;
for (i = 0; i < 8; i++) {
for (j = 0; j < 8; j++) {
if ((i + j) & 1) {
image[i][j][0] = 50;
image[i][j][1] = 50;
image[i][j][2] = 50;
}
else {
image[i][j][0] = 25;
image[i][j][1] = 25;
image[i][j][2] = 25;
}
}
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0,
GL_RGB, GL_UNSIGNED_BYTE, (GLvoid *) image);
}
/* Bind texObj[i] to ith texture unit */
if (i < 2)
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
else
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
if (TexEnabled[i])
glEnable(GL_TEXTURE_2D);
}
glShadeModel(GL_FLAT);
glClearColor(0.3, 0.3, 0.4, 1.0);
if (argc > 1 && strcmp(argv[1], "-info")==0) {
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
}
}
int main( int argc, char *argv[] )
{
GLint i;
glutInitWindowSize( 300, 300 );
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutCreateWindow(argv[0] );
glewInit();
Init( argc, argv );
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
if (Animate)
glutIdleFunc(Idle);
glutCreateMenu(ModeMenu);
for (i = 0; i < NumUnits; i++) {
char s[100];
sprintf(s, "Toggle Texture %d", i);
glutAddMenuEntry(s, TEX0 + i);
}
glutAddMenuEntry("Toggle Animation", ANIMATE);
glutAddMenuEntry("Quit", QUIT);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMainLoop();
return 0;
}
-268
View File
@@ -1,268 +0,0 @@
/*
* Paletted texture demo. Written by Brian Paul.
* This program is in the public domain.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#ifdef _WIN32
#include <windows.h>
#endif
#include <GL/glew.h>
#include <GL/glut.h>
static float Rot = 0.0;
static GLboolean Anim = 1;
static void Idle( void )
{
float t = glutGet(GLUT_ELAPSED_TIME) * 0.001; /* in seconds */
Rot = t * 360 / 4; /* 1 rotation per 4 seconds */
glutPostRedisplay();
}
static void Display( void )
{
/* draw background gradient */
glDisable(GL_TEXTURE_2D);
glBegin(GL_POLYGON);
glColor3f(1.0, 0.0, 0.2); glVertex2f(-1.5, -1.0);
glColor3f(1.0, 0.0, 0.2); glVertex2f( 1.5, -1.0);
glColor3f(0.0, 0.0, 1.0); glVertex2f( 1.5, 1.0);
glColor3f(0.0, 0.0, 1.0); glVertex2f(-1.5, 1.0);
glEnd();
glPushMatrix();
glRotatef(Rot, 0, 0, 1);
glEnable(GL_TEXTURE_2D);
glBegin(GL_POLYGON);
glTexCoord2f(0, 1); glVertex2f(-1, -0.5);
glTexCoord2f(1, 1); glVertex2f( 1, -0.5);
glTexCoord2f(1, 0); glVertex2f( 1, 0.5);
glTexCoord2f(0, 0); glVertex2f(-1, 0.5);
glEnd();
glPopMatrix();
glutSwapBuffers();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( -1.5, 1.5, -1.0, 1.0, -1.0, 1.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
case 's':
Rot += 0.5;
break;
case ' ':
Anim = !Anim;
if (Anim)
glutIdleFunc( Idle );
else
glutIdleFunc( NULL );
break;
}
glutPostRedisplay();
}
static void Init( void )
{
#define HEIGHT 8
#define WIDTH 32
/* 257 = HEIGHT * WIDTH + 1 (for trailing '\0') */
static char texture[257] = {"\
\
MMM EEEE SSS AAA \
M M M E S S A A \
M M M EEEE SS A A \
M M M E SS AAAAA \
M M E S S A A \
M M EEEE SSS A A \
"
};
GLubyte table[256][4];
if (!glutExtensionSupported("GL_EXT_paletted_texture")) {
printf("Sorry, GL_EXT_paletted_texture not supported\n");
exit(0);
}
/* load the color table for each texel-index */
memset(table, 0, 256*4);
table[' '][0] = 255;
table[' '][1] = 255;
table[' '][2] = 255;
table[' '][3] = 64;
table['M'][0] = 255;
table['M'][1] = 0;
table['M'][2] = 0;
table['M'][3] = 255;
table['E'][0] = 0;
table['E'][1] = 255;
table['E'][2] = 0;
table['E'][3] = 255;
table['S'][0] = 0;
table['S'][1] = 0;
table['S'][2] = 255;
table['S'][3] = 255;
table['A'][0] = 255;
table['A'][1] = 255;
table['A'][2] = 0;
table['A'][3] = 255;
#ifdef GL_EXT_paletted_texture
#if defined(GL_EXT_shared_texture_palette) && defined(USE_SHARED_PALETTE)
printf("Using shared palette\n");
glColorTableEXT(GL_SHARED_TEXTURE_PALETTE_EXT, /* target */
GL_RGBA, /* internal format */
256, /* table size */
GL_RGBA, /* table format */
GL_UNSIGNED_BYTE, /* table type */
table); /* the color table */
glEnable(GL_SHARED_TEXTURE_PALETTE_EXT);
#else
glColorTableEXT(GL_TEXTURE_2D, /* target */
GL_RGBA, /* internal format */
256, /* table size */
GL_RGBA, /* table format */
GL_UNSIGNED_BYTE, /* table type */
table); /* the color table */
#endif
glTexImage2D(GL_TEXTURE_2D, /* target */
0, /* level */
GL_COLOR_INDEX8_EXT, /* internal format */
WIDTH, HEIGHT, /* width, height */
0, /* border */
GL_COLOR_INDEX, /* texture format */
GL_UNSIGNED_BYTE, /* texture type */
texture); /* the texture */
#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
#undef HEIGHT
#undef WIDTH
}
/*
* Color ramp test
*/
static void Init2( void )
{
#define HEIGHT 32
#define WIDTH 256
static char texture[HEIGHT][WIDTH];
GLubyte table[256][4];
int i, j;
if (!glutExtensionSupported("GL_EXT_paletted_texture")) {
printf("Sorry, GL_EXT_paletted_texture not supported\n");
exit(0);
}
for (j = 0; j < HEIGHT; j++) {
for (i = 0; i < WIDTH; i++) {
texture[j][i] = i;
}
}
for (i = 0; i < 255; i++) {
table[i][0] = i;
table[i][1] = 0;
table[i][2] = 0;
table[i][3] = 255;
}
#ifdef GL_EXT_paletted_texture
#if defined(GL_EXT_shared_texture_palette) && defined(USE_SHARED_PALETTE)
printf("Using shared palette\n");
glColorTableEXT(GL_SHARED_TEXTURE_PALETTE_EXT, /* target */
GL_RGBA, /* internal format */
256, /* table size */
GL_RGBA, /* table format */
GL_UNSIGNED_BYTE, /* table type */
table); /* the color table */
glEnable(GL_SHARED_TEXTURE_PALETTE_EXT);
#else
glColorTableEXT(GL_TEXTURE_2D, /* target */
GL_RGBA, /* internal format */
256, /* table size */
GL_RGBA, /* table format */
GL_UNSIGNED_BYTE, /* table type */
table); /* the color table */
#endif
glTexImage2D(GL_TEXTURE_2D, /* target */
0, /* level */
GL_COLOR_INDEX8_EXT, /* internal format */
WIDTH, HEIGHT, /* width, height */
0, /* border */
GL_COLOR_INDEX, /* texture format */
GL_UNSIGNED_BYTE, /* texture type */
texture); /* teh texture */
#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
int main( int argc, char *argv[] )
{
glutInitWindowSize( 400, 300 );
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutCreateWindow(argv[0]);
glewInit();
Init();
(void) Init2; /* silence warning */
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
if (Anim)
glutIdleFunc( Idle );
glutMainLoop();
return 0;
}
-219
View File
@@ -1,219 +0,0 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (humanware@plus.it)
* Humanware s.r.l.
*/
#include <stdlib.h>
#include "particles.h"
#define vinit(a,i,j,k) {\
(a)[0]=i;\
(a)[1]=j;\
(a)[2]=k;\
}
#define vadds(a,dt,b) {\
(a)[0]+=(dt)*(b)[0];\
(a)[1]+=(dt)*(b)[1];\
(a)[2]+=(dt)*(b)[2];\
}
#define vequ(a,b) {\
(a)[0]=(b)[0];\
(a)[1]=(b)[1];\
(a)[2]=(b)[2];\
}
#define vinter(a,dt,b,c) {\
(a)[0]=(dt)*(b)[0]+(1.0-dt)*(c)[0];\
(a)[1]=(dt)*(b)[1]+(1.0-dt)*(c)[1];\
(a)[2]=(dt)*(b)[2]+(1.0-dt)*(c)[2];\
}
#define clamp(a) ((a) < 0.0 ? 0.0 : ((a) < 1.0 ? (a) : 1.0))
#define vclamp(v) {\
(v)[0]=clamp((v)[0]);\
(v)[1]=clamp((v)[1]);\
(v)[2]=clamp((v)[2]);\
}
float rainParticle::min[3];
float rainParticle::max[3];
float rainParticle::partLength=0.2f;
static float vrnd(void)
{
return(((float)rand())/RAND_MAX);
}
particle::particle()
{
age=0.0f;
vinit(acc,0.0f,0.0f,0.0f);
vinit(vel,0.0f,0.0f,0.0f);
vinit(pos,0.0f,0.0f,0.0f);
}
void particle::elapsedTime(float dt)
{
age+=dt;
vadds(vel,dt,acc);
vadds(pos,dt,vel);
}
/////////////////////////////////////////
// Particle System
/////////////////////////////////////////
particleSystem::particleSystem()
{
t=0.0f;
part=NULL;
particleNum=0;
}
particleSystem::~particleSystem()
{
if(part)
free(part);
}
void particleSystem::addParticle(particle *p)
{
if(!part) {
part=(particle **)calloc(1,sizeof(particle *));
part[0]=p;
particleNum=1;
} else {
particleNum++;
part=(particle **)realloc(part,sizeof(particle *)*particleNum);
part[particleNum-1]=p;
}
}
void particleSystem::reset(void)
{
if(part)
free(part);
t=0.0f;
part=NULL;
particleNum=0;
}
void particleSystem::draw(void)
{
if(!part)
return;
part[0]->beginDraw();
for(unsigned int i=0;i<particleNum;i++)
part[i]->draw();
part[0]->endDraw();
}
void particleSystem::addTime(float dt)
{
if(!part)
return;
for(unsigned int i=0;i<particleNum;i++) {
part[i]->elapsedTime(dt);
part[i]->checkAge();
}
}
/////////////////////////////////////////
// Rain
/////////////////////////////////////////
void rainParticle::init(void)
{
age=0.0f;
acc[0]=0.0f;
acc[1]=-0.98f;
acc[2]=0.0f;
vel[0]=0.0f;
vel[1]=0.0f;
vel[2]=0.0f;
oldpos[0]=pos[0]=min[0]+(max[0]-min[0])*vrnd();
oldpos[1]=pos[1]=max[1]+0.2f*max[1]*vrnd();
oldpos[2]=pos[2]=min[2]+(max[2]-min[2])*vrnd();
vadds(oldpos,-partLength,vel);
}
rainParticle::rainParticle()
{
init();
}
void rainParticle::setRainingArea(float minx, float miny, float minz,
float maxx, float maxy, float maxz)
{
vinit(min,minx,miny,minz);
vinit(max,maxx,maxy,maxz);
}
void rainParticle::setLength(float l)
{
partLength=l;
}
void rainParticle::draw(void)
{
glColor4f(0.7f,0.95f,1.0f,0.0f);
glVertex3fv(oldpos);
glColor4f(0.3f,0.7f,1.0f,1.0f);
glVertex3fv(pos);
}
void rainParticle::checkAge(void)
{
if(pos[1]<min[1])
init();
}
void rainParticle::elapsedTime(float dt)
{
particle::elapsedTime(dt);
if(pos[0]<min[0])
pos[0]=max[0]-(min[0]-pos[0]);
if(pos[2]<min[2])
pos[2]=max[2]-(min[2]-pos[2]);
if(pos[0]>max[0])
pos[0]=min[0]+(pos[0]-max[0]);
if(pos[2]>max[2])
pos[2]=min[2]+(pos[2]-max[2]);
vequ(oldpos,pos);
vadds(oldpos,-partLength,vel);
}
void rainParticle::randomHeight(void)
{
pos[1]=(max[1]-min[1])*vrnd()+min[1];
oldpos[1]=pos[1]-partLength*vel[1];
}
-81
View File
@@ -1,81 +0,0 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (humanware@plus.it)
* Humanware s.r.l.
*/
#ifndef PARTICLES_H
#define PARTICLES_H
#include <GL/gl.h>
class particle {
protected:
float age; // in seconds
float acc[3];
float vel[3];
float pos[3];
public:
particle();
virtual ~particle() {};
virtual void beginDraw(void) {};
virtual void draw(void)=0;
virtual void endDraw(void) {};
virtual void elapsedTime(float);
virtual void checkAge(void) {};
};
class particleSystem {
protected:
particle **part;
float t;
unsigned long particleNum;
public:
particleSystem();
~particleSystem();
void addParticle(particle *);
void reset(void);
void draw(void);
void addTime(float);
};
class rainParticle : public particle {
protected:
static float min[3];
static float max[3];
static float partLength;
float oldpos[3];
void init(void);
public:
rainParticle();
static void setRainingArea(float, float, float,
float, float, float);
static void setLength(float);
static float getLength(void) { return partLength; };
void beginDraw(void) { glBegin(GL_LINES); };
void draw(void);
void endDraw(void) { glEnd(); };
void elapsedTime(float);
void checkAge(void);
void randomHeight(void);
};
#endif
-504
View File
@@ -1,504 +0,0 @@
/* Copyright (c) Mark J. Kilgard, 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. */
/* This example demonstrates how to render particle effects
with OpenGL. A cloud of pinkish/orange particles explodes with the
particles bouncing off the ground. When the EXT_point_parameters
is present , the particle size is attenuated based on eye distance. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h> /* for cos(), sin(), and sqrt() */
#ifdef _WIN32
#include <windows.h>
#endif
#include <GL/glew.h>
#include <GL/glut.h>
/* Some <math.h> files do not define M_PI... */
#ifndef M_PI
#define M_PI 3.14159265
#endif
#if 0 /* For debugging. */
#undef GL_EXT_point_parameters
#endif
static GLfloat angle = -150; /* in degrees */
static int spin = 0;
static int moving, begin;
static int newModel = 1;
static float theTime;
static int repeat = 1;
static int blend = 1;
int useMipmaps = 1;
int linearFiltering = 1;
static GLfloat constant[3] = { 1/5.0, 0.0, 0.0 };
static GLfloat linear[3] = { 0.0, 1/5.0, 0.0 };
static GLfloat theQuad[3] = { 0.25, 0.0, 1/60.0 };
#define MAX_POINTS 2000
static int numPoints = 200;
static GLfloat pointList[MAX_POINTS][3];
static GLfloat pointTime[MAX_POINTS];
static GLfloat pointVelocity[MAX_POINTS][2];
static GLfloat pointDirection[MAX_POINTS][2];
static int colorList[MAX_POINTS];
static int animate = 1, motion = 0;
static GLfloat colorSet[][4] = {
/* Shades of red. */
{ 0.7, 0.2, 0.4, 0.5 },
{ 0.8, 0.0, 0.7, 0.5 },
{ 1.0, 0.0, 0.0, 0.5 },
{ 0.9, 0.3, 0.6, 0.5 },
{ 1.0, 0.4, 0.0, 0.5 },
{ 1.0, 0.0, 0.5, 0.5 },
};
#define NUM_COLORS (sizeof(colorSet)/sizeof(colorSet[0]))
#define DEAD (NUM_COLORS+1)
#if 0 /* drand48 might be better on Unix machines */
#define RANDOM_RANGE(lo, hi) ((lo) + (hi - lo) * drand48())
#else
static float float_rand(void) { return rand() / (float) RAND_MAX; }
#define RANDOM_RANGE(lo, hi) ((lo) + (hi - lo) * float_rand())
#endif
#define MEAN_VELOCITY 3.0
#define GRAVITY 2.0
/* Modeling units of ground extent in each X and Z direction. */
#define EDGE 12
static void
makePointList(void)
{
float angle, velocity, direction;
int i;
motion = 1;
for (i=0; i<numPoints; i++) {
pointList[i][0] = 0.0;
pointList[i][1] = 0.0;
pointList[i][2] = 0.0;
pointTime[i] = 0.0;
angle = (RANDOM_RANGE(60.0, 70.0)) * M_PI/180.0;
direction = RANDOM_RANGE(0.0, 360.0) * M_PI/180.0;
pointDirection[i][0] = cos(direction);
pointDirection[i][1] = sin(direction);
velocity = MEAN_VELOCITY + RANDOM_RANGE(-0.8, 1.0);
pointVelocity[i][0] = velocity * cos(angle);
pointVelocity[i][1] = velocity * sin(angle);
colorList[i] = rand() % NUM_COLORS;
}
theTime = 0.0;
}
static void
updatePointList(void)
{
float distance;
int i;
static double t0 = -1.;
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
motion = 0;
for (i=0; i<numPoints; i++) {
distance = pointVelocity[i][0] * theTime;
/* X and Z */
pointList[i][0] = pointDirection[i][0] * distance;
pointList[i][2] = pointDirection[i][1] * distance;
/* Z */
pointList[i][1] =
(pointVelocity[i][1] - 0.5 * GRAVITY * pointTime[i])*pointTime[i];
/* If we hit the ground, bounce the point upward again. */
if (pointList[i][1] <= 0.0) {
if (distance > EDGE) {
/* Particle has hit ground past the distance duration of
the particles. Mark particle as dead. */
colorList[i] = NUM_COLORS; /* Not moving. */
continue;
}
pointVelocity[i][1] *= 0.8; /* 80% of previous up velocity. */
pointTime[i] = 0.0; /* Reset the particles sense of up time. */
}
motion = 1;
pointTime[i] += dt;
}
theTime += dt;
if (!motion && !spin) {
if (repeat) {
makePointList();
} else {
glutIdleFunc(NULL);
}
}
}
static void
idle(void)
{
updatePointList();
if (spin) {
angle += 0.3;
newModel = 1;
}
glutPostRedisplay();
}
static void
visible(int vis)
{
if (vis == GLUT_VISIBLE) {
if (animate && (motion || spin)) {
glutIdleFunc(idle);
}
} else {
glutIdleFunc(NULL);
}
}
static void
recalcModelView(void)
{
glPopMatrix();
glPushMatrix();
glRotatef(angle, 0.0, 1.0, 0.0);
newModel = 0;
}
static void
redraw(void)
{
int i;
glDepthMask(GL_TRUE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (newModel)
recalcModelView();
/* Draw the floor. */
/* glEnable(GL_TEXTURE_2D);*/
glColor3f(0.5, 1.0, 0.5);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3f(-EDGE, -0.05, -EDGE);
glTexCoord2f(20.0, 0.0);
glVertex3f(EDGE, -0.05, -EDGE);
glTexCoord2f(20.0, 20.0);
glVertex3f(EDGE, -0.05, EDGE);
glTexCoord2f(0.0, 20.0);
glVertex3f(-EDGE, -0.05, EDGE);
glEnd();
/* Allow particles to blend with each other. */
glDepthMask(GL_FALSE);
if (blend)
glEnable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glBegin(GL_POINTS);
for (i=0; i<numPoints; i++) {
/* Draw alive particles. */
if (colorList[i] != DEAD) {
glColor4fv(colorSet[colorList[i]]);
glVertex3fv(pointList[i]);
}
}
glEnd();
glDisable(GL_BLEND);
glutSwapBuffers();
}
/* ARGSUSED2 */
static void
mouse(int button, int state, int x, int y)
{
/* Scene can be spun around Y axis using left
mouse button movement. */
if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) {
moving = 1;
begin = x;
}
if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) {
moving = 0;
}
}
/* ARGSUSED1 */
static void
mouseMotion(int x, int y)
{
if (moving) {
angle = angle + (x - begin);
begin = x;
newModel = 1;
glutPostRedisplay();
}
}
static void
menu(int option)
{
switch (option) {
case 0:
makePointList();
break;
#ifdef GL_ARB_point_parameters
case 1:
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, constant);
break;
case 2:
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, linear);
break;
case 3:
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
break;
#endif
case 4:
blend = 1;
break;
case 5:
blend = 0;
break;
#ifdef GL_ARB_point_parameters
case 6:
glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 1.0);
break;
case 7:
glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 10.0);
break;
#endif
case 8:
glEnable(GL_POINT_SMOOTH);
break;
case 9:
glDisable(GL_POINT_SMOOTH);
break;
case 10:
glPointSize(2.0);
break;
case 11:
glPointSize(4.0);
break;
case 12:
glPointSize(8.0);
break;
case 13:
spin = 1 - spin;
if (animate && (spin || motion)) {
glutIdleFunc(idle);
} else {
glutIdleFunc(NULL);
}
break;
case 14:
numPoints = 200;
break;
case 15:
numPoints = 500;
break;
case 16:
numPoints = 1000;
break;
case 17:
numPoints = 2000;
break;
case 666:
exit(0);
}
glutPostRedisplay();
}
/* ARGSUSED1 */
static void
key(unsigned char c, int x, int y)
{
switch (c) {
case 13:
animate = 1 - animate; /* toggle. */
if (animate && (motion || spin)) {
glutIdleFunc(idle);
} else {
glutIdleFunc(NULL);
}
break;
case ' ':
animate = 1;
makePointList();
glutIdleFunc(idle);
break;
case 27:
exit(0);
}
}
/* Nice floor texture tiling pattern. */
static char *circles[] = {
"....xxxx........",
"..xxxxxxxx......",
".xxxxxxxxxx.....",
".xxx....xxx.....",
"xxx......xxx....",
"xxx......xxx....",
"xxx......xxx....",
"xxx......xxx....",
".xxx....xxx.....",
".xxxxxxxxxx.....",
"..xxxxxxxx......",
"....xxxx........",
"................",
"................",
"................",
"................",
};
static void
makeFloorTexture(void)
{
GLubyte floorTexture[16][16][3];
GLubyte *loc;
int s, t;
/* Setup RGB image for the texture. */
loc = (GLubyte*) floorTexture;
for (t = 0; t < 16; t++) {
for (s = 0; s < 16; s++) {
if (circles[t][s] == 'x') {
/* Nice blue. */
loc[0] = 0x1f;
loc[1] = 0x1f;
loc[2] = 0x8f;
} else {
/* Light gray. */
loc[0] = 0xca;
loc[1] = 0xca;
loc[2] = 0xca;
}
loc += 3;
}
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if (useMipmaps) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 16, 16,
GL_RGB, GL_UNSIGNED_BYTE, floorTexture);
} else {
if (linearFiltering) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
} else {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
glTexImage2D(GL_TEXTURE_2D, 0, 3, 16, 16, 0,
GL_RGB, GL_UNSIGNED_BYTE, floorTexture);
}
}
int
main(int argc, char **argv)
{
int i;
glutInitWindowSize(300, 300);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE);
for (i=1; i<argc; i++) {
if(!strcmp("-noms", argv[i])) {
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
printf("forcing no multisampling\n");
} else if(!strcmp("-nomipmaps", argv[i])) {
useMipmaps = 0;
} else if(!strcmp("-nearest", argv[i])) {
linearFiltering = 0;
}
}
glutCreateWindow("point burst");
glewInit();
glutDisplayFunc(redraw);
glutMouseFunc(mouse);
glutMotionFunc(mouseMotion);
glutVisibilityFunc(visible);
glutKeyboardFunc(key);
glutCreateMenu(menu);
glutAddMenuEntry("Reset time", 0);
glutAddMenuEntry("Constant", 1);
glutAddMenuEntry("Linear", 2);
glutAddMenuEntry("Quadratic", 3);
glutAddMenuEntry("Blend on", 4);
glutAddMenuEntry("Blend off", 5);
glutAddMenuEntry("Threshold 1", 6);
glutAddMenuEntry("Threshold 10", 7);
glutAddMenuEntry("Point smooth on", 8);
glutAddMenuEntry("Point smooth off", 9);
glutAddMenuEntry("Point size 2", 10);
glutAddMenuEntry("Point size 4", 11);
glutAddMenuEntry("Point size 8", 12);
glutAddMenuEntry("Toggle spin", 13);
glutAddMenuEntry("200 points ", 14);
glutAddMenuEntry("500 points ", 15);
glutAddMenuEntry("1000 points ", 16);
glutAddMenuEntry("2000 points ", 17);
glutAddMenuEntry("Quit", 666);
glutAttachMenu(GLUT_RIGHT_BUTTON);
if (!glutExtensionSupported("GL_ARB_point_parameters")) {
fprintf(stderr, "Sorry, GL_ARB_point_parameters is not supported.\n");
return -1;
}
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_POINT_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPointSize(8.0);
#if GL_ARB_point_parameters
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
#endif
glMatrixMode(GL_PROJECTION);
gluPerspective( /* field of view in degree */ 40.0,
/* aspect ratio */ 1.0,
/* Z near */ 0.5, /* Z far */ 40.0);
glMatrixMode(GL_MODELVIEW);
gluLookAt(0.0, 1.0, 8.0, /* eye location */
0.0, 1.0, 0.0, /* center is at (0,0,0) */
0.0, 1.0, 0.); /* up is in postivie Y direction */
glPushMatrix(); /* dummy push so we can pop on model
recalc */
makePointList();
makeFloorTexture();
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}
File diff suppressed because it is too large Load Diff
-393
View File
@@ -1,393 +0,0 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (humanware@plus.it)
* Humanware s.r.l.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <GL/glut.h>
#ifndef M_PI
#define M_PI 3.14159265
#endif
#include "particles.h"
extern "C" {
#include "readtex.h"
}
#ifdef _WIN32
#include <windows.h>
#include <mmsystem.h>
#endif
#ifdef XMESA
#include "GL/xmesa.h"
static int fullscreen=1;
#endif
static int WIDTH=640;
static int HEIGHT=480;
static int NUMPART=7500;
#define FRAME 50
static float fogcolor[4]={1.0,1.0,1.0,1.0};
#define DIMP 40.0
#define DIMTP 32.0
static float q[4][3]={
{-DIMP,0.0,-DIMP},
{DIMP,0.0,-DIMP},
{DIMP,0.0,DIMP},
{-DIMP,0.0,DIMP}
};
static float qt[4][2]={
{-DIMTP,-DIMTP},
{DIMTP,-DIMTP},
{DIMTP,DIMTP},
{-DIMTP,DIMTP}
};
static int win=0;
static int fog=1;
static int help=1;
static GLuint groundid;
static float obs[3]={2.0,1.0,0.0};
static float dir[3];
static float v=0.0;
static float alpha=-90.0;
static float beta=90.0;
static particleSystem *ps;
static float gettime()
{
static clock_t told=0;
clock_t tnew,ris;
tnew=clock();
ris=tnew-told;
told=tnew;
return(ris/(float)CLOCKS_PER_SEC);
}
static float gettimerain()
{
static clock_t told=0;
clock_t tnew,ris;
tnew=clock();
ris=tnew-told;
told=tnew;
return(ris/(float)CLOCKS_PER_SEC);
}
static void calcposobs(void)
{
dir[0]=sin(alpha*M_PI/180.0);
dir[2]=cos(alpha*M_PI/180.0)*sin(beta*M_PI/180.0);
dir[1]=cos(beta*M_PI/180.0);
obs[0]+=v*dir[0];
obs[1]+=v*dir[1];
obs[2]+=v*dir[2];
rainParticle::setRainingArea(obs[0]-7.0f,-0.2f,obs[2]-7.0f,obs[0]+7.0f,8.0f,obs[2]+7.0f);
}
static void printstring(void *font, const char *string)
{
int len,i;
len=(int)strlen(string);
for(i=0;i<len;i++)
glutBitmapCharacter(font,string[i]);
}
static void reshape(int width, int height)
{
WIDTH=width;
HEIGHT=height;
glViewport(0,0,(GLint)width,(GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(70.0,width/(float)height,0.1,30.0);
glMatrixMode(GL_MODELVIEW);
}
static void printhelp(void)
{
glEnable(GL_BLEND);
glColor4f(0.0,0.0,0.0,0.5);
glRecti(40,40,600,440);
glDisable(GL_BLEND);
glColor3f(1.0,0.0,0.0);
glRasterPos2i(300,420);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Help");
glRasterPos2i(60,390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Toggle Help");
glRasterPos2i(60,360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Toggle Fog");
glRasterPos2i(60,330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Arrow Keys - Rotate");
glRasterPos2i(60,300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"a - Increase velocity");
glRasterPos2i(60,270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"z - Decrease velocity");
glRasterPos2i(60,240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"l - Increase rain length");
glRasterPos2i(60,210);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"k - Decrease rain length");
}
static void drawrain(void)
{
static int count=0;
static char frbuf[80];
float fr;
glEnable(GL_DEPTH_TEST);
if(fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glDepthMask(GL_TRUE);
glClearColor(1.0,1.0,1.0,1.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glPushMatrix();
calcposobs();
gluLookAt(obs[0],obs[1],obs[2],
obs[0]+dir[0],obs[1]+dir[1],obs[2]+dir[2],
0.0,1.0,0.0);
glColor4f(1.0,1.0,1.0,1.0);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D,groundid);
glBegin(GL_QUADS);
glTexCoord2fv(qt[0]);
glVertex3fv(q[0]);
glTexCoord2fv(qt[1]);
glVertex3fv(q[1]);
glTexCoord2fv(qt[2]);
glVertex3fv(q[2]);
glTexCoord2fv(qt[3]);
glVertex3fv(q[3]);
glEnd();
// Particle System
glDisable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH);
glEnable(GL_BLEND);
ps->draw();
ps->addTime(gettimerain());
glShadeModel(GL_FLAT);
if((count % FRAME)==0) {
fr=gettime();
sprintf(frbuf,"Frame rate: %f",FRAME/fr);
}
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_FOG);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5,639.5,-0.5,479.5,-1.0,1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0,0.0,0.0);
glRasterPos2i(10,10);
printstring(GLUT_BITMAP_HELVETICA_18,frbuf);
glRasterPos2i(350,470);
printstring(GLUT_BITMAP_HELVETICA_10,"Rain V1.0 Written by David Bucciarelli (humanware@plus.it)");
if(help)
printhelp();
reshape(WIDTH,HEIGHT);
glPopMatrix();
glutSwapBuffers();
count++;
}
static void special(int key, int x, int y)
{
switch (key) {
case GLUT_KEY_LEFT:
alpha+=2.0;
break;
case GLUT_KEY_RIGHT:
alpha-=2.0;
break;
case GLUT_KEY_DOWN:
beta-=2.0;
break;
case GLUT_KEY_UP:
beta+=2.0;
break;
}
}
static void key(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(0);
break;
case 'a':
v+=0.01;
break;
case 'z':
v-=0.01;
break;
case 'l':
rainParticle::setLength(rainParticle::getLength()+0.025f);
break;
case 'k':
rainParticle::setLength(rainParticle::getLength()-0.025f);
break;
case 'h':
help=(!help);
break;
case 'f':
fog=(!fog);
break;
#ifdef XMESA
case ' ':
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
fullscreen=(!fullscreen);
break;
#endif
}
}
static void inittextures(void)
{
GLubyte *img;
GLint width,height;
GLenum format;
GLenum gluerr;
glGenTextures(1,&groundid);
glBindTexture(GL_TEXTURE_2D,groundid);
if(!(img=LoadRGBImage("../images/s128.rgb",&width,&height,&format))){
fprintf(stderr,"Error reading a texture.\n");
exit(-1);
}
glPixelStorei(GL_UNPACK_ALIGNMENT,4);
if((gluerr=(GLenum)gluBuild2DMipmaps(GL_TEXTURE_2D, 3, width, height,GL_RGB,
GL_UNSIGNED_BYTE, (GLvoid *)(img)))) {
fprintf(stderr,"GLULib%s\n",gluErrorString(gluerr));
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DECAL);
}
static void initparticle(void)
{
ps=new particleSystem;
rainParticle::setRainingArea(-7.0f,-0.2f,-7.0f,7.0f,8.0f,7.0f);
for(int i=0;i<NUMPART;i++) {
rainParticle *p=new rainParticle;
p->randomHeight();
ps->addParticle((particle *)p);
}
}
int main(int ac,char **av)
{
fprintf(stderr,"Rain V1.0\nWritten by David Bucciarelli (humanware@plus.it)\n");
/* Default settings */
WIDTH=640;
HEIGHT=480;
glutInitWindowPosition(0,0);
glutInitWindowSize(WIDTH,HEIGHT);
glutInit(&ac,av);
glutInitDisplayMode(GLUT_RGB|GLUT_DEPTH|GLUT_DOUBLE);
if(!(win=glutCreateWindow("Rain"))) {
fprintf(stderr,"Error opening a window.\n");
exit(-1);
}
reshape(WIDTH,HEIGHT);
inittextures();
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_FOG);
glFogi(GL_FOG_MODE,GL_EXP);
glFogfv(GL_FOG_COLOR,fogcolor);
glFogf(GL_FOG_DENSITY,0.1);
#ifdef FX
glHint(GL_FOG_HINT,GL_NICEST);
#endif
initparticle();
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutDisplayFunc(drawrain);
glutIdleFunc(drawrain);
glutReshapeFunc(reshape);
glutMainLoop();
return(0);
}
-905
View File
@@ -1,905 +0,0 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (tech.hmw@plus.it)
* Humanware s.r.l.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#ifdef WIN32
#include <windows.h>
#endif
#include <GL/glut.h>
#ifdef XMESA
#include "GL/xmesa.h"
static int fullscreen = 1;
#endif
static int WIDTH = 640;
static int HEIGHT = 480;
static GLint T0 = 0;
static GLint Frames = 0;
#define BASESIZE 7.5f
#define SPHERE_RADIUS 0.75f
#define TEX_CHECK_WIDTH 256
#define TEX_CHECK_HEIGHT 256
#define TEX_CHECK_SLOT_SIZE (TEX_CHECK_HEIGHT/16)
#define TEX_CHECK_NUMSLOT (TEX_CHECK_HEIGHT/TEX_CHECK_SLOT_SIZE)
#define TEX_REFLECT_WIDTH 256
#define TEX_REFLECT_HEIGHT 256
#define TEX_REFLECT_SLOT_SIZE (TEX_REFLECT_HEIGHT/16)
#define TEX_REFLECT_NUMSLOT (TEX_REFLECT_HEIGHT/TEX_REFLECT_SLOT_SIZE)
#ifndef M_PI
#define M_PI 3.1415926535
#endif
#define EPSILON 0.0001
#define clamp255(a) ( (a)<(0.0f) ? (0.0f) : ((a)>(255.0f) ? (255.0f) : (a)) )
#ifndef fabs
#define fabs(x) ((x)<0.0f?-(x):(x))
#endif
#define vequ(a,b) { (a)[0]=(b)[0]; (a)[1]=(b)[1]; (a)[2]=(b)[2]; }
#define vsub(a,b,c) { (a)[0]=(b)[0]-(c)[0]; (a)[1]=(b)[1]-(c)[1]; (a)[2]=(b)[2]-(c)[2]; }
#define dprod(a,b) ((a)[0]*(b)[0]+(a)[1]*(b)[1]+(a)[2]*(b)[2])
#define vnormalize(a,b) { \
register float m_norm; \
m_norm=sqrt((double)dprod((a),(a))); \
(a)[0] /=m_norm; \
(a)[1] /=m_norm; \
(a)[2] /=m_norm; }
static GLubyte checkmap[TEX_CHECK_HEIGHT][TEX_CHECK_WIDTH][3];
static GLuint checkid;
static int checkmap_currentslot = 0;
static GLubyte reflectmap[TEX_REFLECT_HEIGHT][TEX_REFLECT_WIDTH][3];
static GLuint reflectid;
static int reflectmap_currentslot = 0;
static GLuint lightdlist;
static GLuint objdlist;
static float lightpos[3] = { 2.1, 2.1, 2.8 };
static float objpos[3] = { 0.0, 0.0, 1.0 };
static float sphere_pos[TEX_CHECK_HEIGHT][TEX_REFLECT_WIDTH][3];
static int win = 0;
static float fogcolor[4] = { 0.05, 0.05, 0.05, 1.0 };
static float obs[3] = { 7.0, 0.0, 2.0 };
static float dir[3];
static float v = 0.0;
static float alpha = -90.0;
static float beta = 90.0;
static int fog = 1;
static int bfcull = 1;
static int poutline = 0;
static int help = 1;
static int showcheckmap = 1;
static int showreflectmap = 1;
static int joyavailable = 0;
static int joyactive = 0;
static void
calcposobs(void)
{
dir[0] = sin(alpha * M_PI / 180.0);
dir[1] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0);
dir[2] = cos(beta * M_PI / 180.0);
if (dir[0] < 1.0e-5 && dir[0] > -1.0e-5)
dir[0] = 0;
if (dir[1] < 1.0e-5 && dir[1] > -1.0e-5)
dir[1] = 0;
if (dir[2] < 1.0e-5 && dir[2] > -1.0e-5)
dir[2] = 0;
obs[0] += v * dir[0];
obs[1] += v * dir[1];
obs[2] += v * dir[2];
}
static void
special(int k, int x, int y)
{
switch (k) {
case GLUT_KEY_LEFT:
alpha -= 2.0;
break;
case GLUT_KEY_RIGHT:
alpha += 2.0;
break;
case GLUT_KEY_DOWN:
beta -= 2.0;
break;
case GLUT_KEY_UP:
beta += 2.0;
break;
}
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27:
exit(0);
break;
case 's':
lightpos[1] -= 0.1;
break;
case 'd':
lightpos[1] += 0.1;
break;
case 'e':
lightpos[0] -= 0.1;
break;
case 'x':
lightpos[0] += 0.1;
break;
case 'w':
lightpos[2] -= 0.1;
break;
case 'r':
lightpos[2] += 0.1;
break;
case 'j':
objpos[1] -= 0.1;
break;
case 'k':
objpos[1] += 0.1;
break;
case 'i':
objpos[0] -= 0.1;
break;
case 'm':
objpos[0] += 0.1;
break;
case 'u':
objpos[2] -= 0.1;
break;
case 'o':
objpos[2] += 0.1;
break;
case 'a':
v += 0.005;
break;
case 'z':
v -= 0.005;
break;
case 'g':
joyactive = (!joyactive);
break;
case 'h':
help = (!help);
break;
case 'f':
fog = (!fog);
break;
case '1':
showcheckmap = (!showcheckmap);
break;
case '2':
showreflectmap = (!showreflectmap);
break;
case 'b':
if (bfcull) {
glDisable(GL_CULL_FACE);
bfcull = 0;
}
else {
glEnable(GL_CULL_FACE);
bfcull = 1;
}
break;
case 'p':
if (poutline) {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
poutline = 0;
}
else {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
poutline = 1;
}
break;
#ifdef XMESA
case ' ':
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
fullscreen = (!fullscreen);
break;
#endif
}
}
static void
reshape(int w, int h)
{
WIDTH = w;
HEIGHT = h;
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0, w / (float) h, 0.8, 40.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static void
printstring(void *font, char *string)
{
int len, i;
len = (int) strlen(string);
for (i = 0; i < len; i++)
glutBitmapCharacter(font, string[i]);
}
static void
printhelp(void)
{
glEnable(GL_BLEND);
glColor4f(0.5, 0.5, 0.5, 0.5);
glRecti(40, 40, 600, 440);
glDisable(GL_BLEND);
glColor3f(0.0, 0.0, 1.0);
glRasterPos2i(300, 420);
printstring(GLUT_BITMAP_HELVETICA_18, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_HELVETICA_12, "h - Toggle Help");
glRasterPos2i(60, 370);
printstring(GLUT_BITMAP_HELVETICA_12, "f - Toggle Fog");
glRasterPos2i(60, 350);
printstring(GLUT_BITMAP_HELVETICA_12, "b - Toggle Back face culling");
glRasterPos2i(60, 330);
printstring(GLUT_BITMAP_HELVETICA_12, "p - Toggle Wire frame");
glRasterPos2i(60, 310);
printstring(GLUT_BITMAP_HELVETICA_12, "Arrow Keys - Rotate");
glRasterPos2i(60, 290);
printstring(GLUT_BITMAP_HELVETICA_12, "a - Increase velocity");
glRasterPos2i(60, 270);
printstring(GLUT_BITMAP_HELVETICA_12, "z - Decrease velocity");
glRasterPos2i(60, 250);
if (joyavailable)
printstring(GLUT_BITMAP_HELVETICA_12,
"j - Toggle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_HELVETICA_12,
"(No Joystick control available)");
glRasterPos2i(60, 230);
printstring(GLUT_BITMAP_HELVETICA_12,
"To move the light source: s - left, d - right, e - far, x - near, w - down r - up");
glRasterPos2i(60, 210);
printstring(GLUT_BITMAP_HELVETICA_12,
"To move the mirror sphere: j - left, k - right, i - far, m - near, u - down o - up");
glRasterPos2i(60, 190);
printstring(GLUT_BITMAP_HELVETICA_12,
"1 - Toggle the plane texture map window");
glRasterPos2i(60, 170);
printstring(GLUT_BITMAP_HELVETICA_12,
"2 - Toggle the sphere texture map window");
}
static GLboolean
seelight(float p[3], float dir[3])
{
float c[3], b, a, d, t, dist[3];
vsub(c, p, objpos);
b = -dprod(c, dir);
a = dprod(c, c) - SPHERE_RADIUS * SPHERE_RADIUS;
if ((d = b * b - a) < 0.0 || (b < 0.0 && a > 0.0))
return GL_FALSE;
d = sqrt(d);
t = b - d;
if (t < EPSILON) {
t = b + d;
if (t < EPSILON)
return GL_FALSE;
}
vsub(dist, lightpos, p);
if (dprod(dist, dist) < t * t)
return GL_FALSE;
return GL_TRUE;
}
static int
colorcheckmap(float ppos[3], float c[3])
{
static float norm[3] = { 0.0f, 0.0f, 1.0f };
float ldir[3], vdir[3], h[3], dfact, kfact, r, g, b;
int x, y;
x = (int) ((ppos[0] + BASESIZE / 2) * (10.0f / BASESIZE));
if ((x < 0) || (x > 10))
return GL_FALSE;
y = (int) ((ppos[1] + BASESIZE / 2) * (10.0f / BASESIZE));
if ((y < 0) || (y > 10))
return GL_FALSE;
r = 255.0f;
if (y & 1) {
if (x & 1)
g = 255.0f;
else
g = 0.0f;
}
else {
if (x & 1)
g = 0.0f;
else
g = 255.0f;
}
b = 0.0f;
vsub(ldir, lightpos, ppos);
vnormalize(ldir, ldir);
if (seelight(ppos, ldir)) {
c[0] = r * 0.05f;
c[1] = g * 0.05f;
c[2] = b * 0.05f;
return GL_TRUE;
}
dfact = dprod(ldir, norm);
if (dfact < 0.0f)
dfact = 0.0f;
vsub(vdir, obs, ppos);
vnormalize(vdir, vdir);
h[0] = 0.5f * (vdir[0] + ldir[0]);
h[1] = 0.5f * (vdir[1] + ldir[1]);
h[2] = 0.5f * (vdir[2] + ldir[2]);
kfact = dprod(h, norm);
kfact = pow(kfact, 6.0) * 7.0 * 255.0;
r = r * dfact + kfact;
g = g * dfact + kfact;
b = b * dfact + kfact;
c[0] = clamp255(r);
c[1] = clamp255(g);
c[2] = clamp255(b);
return GL_TRUE;
}
static void
updatecheckmap(int slot)
{
float c[3], ppos[3];
int x, y;
glBindTexture(GL_TEXTURE_2D, checkid);
ppos[2] = 0.0f;
for (y = slot * TEX_CHECK_SLOT_SIZE; y < (slot + 1) * TEX_CHECK_SLOT_SIZE;
y++) {
ppos[1] = (y / (float) TEX_CHECK_HEIGHT) * BASESIZE - BASESIZE / 2;
for (x = 0; x < TEX_CHECK_WIDTH; x++) {
ppos[0] = (x / (float) TEX_CHECK_WIDTH) * BASESIZE - BASESIZE / 2;
colorcheckmap(ppos, c);
checkmap[y][x][0] = (GLubyte) c[0];
checkmap[y][x][1] = (GLubyte) c[1];
checkmap[y][x][2] = (GLubyte) c[2];
}
}
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, slot * TEX_CHECK_SLOT_SIZE,
TEX_CHECK_WIDTH, TEX_CHECK_SLOT_SIZE, GL_RGB,
GL_UNSIGNED_BYTE,
&checkmap[slot * TEX_CHECK_SLOT_SIZE][0][0]);
}
static void
updatereflectmap(int slot)
{
float rf, r, g, b, t, dfact, kfact, rdir[3];
float rcol[3], ppos[3], norm[3], ldir[3], h[3], vdir[3], planepos[3];
int x, y;
glBindTexture(GL_TEXTURE_2D, reflectid);
for (y = slot * TEX_REFLECT_SLOT_SIZE;
y < (slot + 1) * TEX_REFLECT_SLOT_SIZE; y++)
for (x = 0; x < TEX_REFLECT_WIDTH; x++) {
ppos[0] = sphere_pos[y][x][0] + objpos[0];
ppos[1] = sphere_pos[y][x][1] + objpos[1];
ppos[2] = sphere_pos[y][x][2] + objpos[2];
vsub(norm, ppos, objpos);
vnormalize(norm, norm);
vsub(ldir, lightpos, ppos);
vnormalize(ldir, ldir);
vsub(vdir, obs, ppos);
vnormalize(vdir, vdir);
rf = 2.0f * dprod(norm, vdir);
if (rf > EPSILON) {
rdir[0] = rf * norm[0] - vdir[0];
rdir[1] = rf * norm[1] - vdir[1];
rdir[2] = rf * norm[2] - vdir[2];
t = -objpos[2] / rdir[2];
if (t > EPSILON) {
planepos[0] = objpos[0] + t * rdir[0];
planepos[1] = objpos[1] + t * rdir[1];
planepos[2] = 0.0f;
if (!colorcheckmap(planepos, rcol))
rcol[0] = rcol[1] = rcol[2] = 0.0f;
}
else
rcol[0] = rcol[1] = rcol[2] = 0.0f;
}
else
rcol[0] = rcol[1] = rcol[2] = 0.0f;
dfact = 0.1f * dprod(ldir, norm);
if (dfact < 0.0f) {
dfact = 0.0f;
kfact = 0.0f;
}
else {
h[0] = 0.5f * (vdir[0] + ldir[0]);
h[1] = 0.5f * (vdir[1] + ldir[1]);
h[2] = 0.5f * (vdir[2] + ldir[2]);
kfact = dprod(h, norm);
kfact = pow(kfact, 4.0);
if (kfact < 1.0e-10)
kfact = 0.0;
}
r = dfact + kfact;
g = dfact + kfact;
b = dfact + kfact;
r *= 255.0f;
g *= 255.0f;
b *= 255.0f;
r += rcol[0];
g += rcol[1];
b += rcol[2];
r = clamp255(r);
g = clamp255(g);
b = clamp255(b);
reflectmap[y][x][0] = (GLubyte) r;
reflectmap[y][x][1] = (GLubyte) g;
reflectmap[y][x][2] = (GLubyte) b;
}
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, slot * TEX_REFLECT_SLOT_SIZE,
TEX_REFLECT_WIDTH, TEX_REFLECT_SLOT_SIZE, GL_RGB,
GL_UNSIGNED_BYTE,
&reflectmap[slot * TEX_REFLECT_SLOT_SIZE][0][0]);
}
static void
drawbase(void)
{
glColor3f(0.0, 0.0, 0.0);
glBindTexture(GL_TEXTURE_2D, checkid);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-BASESIZE / 2.0f, -BASESIZE / 2.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f);
glVertex3f(BASESIZE / 2.0f, -BASESIZE / 2.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f);
glVertex3f(BASESIZE / 2.0f, BASESIZE / 2.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(-BASESIZE / 2.0f, BASESIZE / 2.0f, 0.0f);
glEnd();
}
static void
drawobj(void)
{
glColor3f(0.0, 0.0, 0.0);
glBindTexture(GL_TEXTURE_2D, reflectid);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glPushMatrix();
glTranslatef(objpos[0], objpos[1], objpos[2]);
glCallList(objdlist);
glPopMatrix();
}
static void
dojoy(void)
{
#ifdef WIN32
static UINT max[2] = { 0, 0 };
static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2];
MMRESULT res;
JOYINFO joy;
res = joyGetPos(JOYSTICKID1, &joy);
if (res == JOYERR_NOERROR) {
joyavailable = 1;
if (max[0] < joy.wXpos)
max[0] = joy.wXpos;
if (min[0] > joy.wXpos)
min[0] = joy.wXpos;
center[0] = (max[0] + min[0]) / 2;
if (max[1] < joy.wYpos)
max[1] = joy.wYpos;
if (min[1] > joy.wYpos)
min[1] = joy.wYpos;
center[1] = (max[1] + min[1]) / 2;
if (joyactive) {
if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0]))
alpha -=
2.5 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]);
if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1]))
beta += 2.5 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]);
if (joy.wButtons & JOY_BUTTON1)
v += 0.005;
if (joy.wButtons & JOY_BUTTON2)
v -= 0.005;
}
}
else
joyavailable = 0;
#endif
}
static void
updatemaps(void)
{
updatecheckmap(checkmap_currentslot);
checkmap_currentslot = (checkmap_currentslot + 1) % TEX_CHECK_NUMSLOT;
updatereflectmap(reflectmap_currentslot);
reflectmap_currentslot =
(reflectmap_currentslot + 1) % TEX_REFLECT_NUMSLOT;
}
static void
draw(void)
{
static char frbuf[80] = "";
dojoy();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
glEnable(GL_DEPTH_TEST);
if (fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glPushMatrix();
calcposobs();
gluLookAt(obs[0], obs[1], obs[2],
obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2],
0.0, 0.0, 1.0);
drawbase();
drawobj();
glColor3f(1.0, 1.0, 1.0);
glDisable(GL_TEXTURE_2D);
glPushMatrix();
glTranslatef(lightpos[0], lightpos[1], lightpos[2]);
glCallList(lightdlist);
glPopMatrix();
glPopMatrix();
glDisable(GL_DEPTH_TEST);
glDisable(GL_FOG);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glColor3f(0.0f, 0.3f, 1.0f);
if (showcheckmap) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, checkid);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBegin(GL_QUADS);
glTexCoord2f(1.0f, 0.0f);
glVertex2i(10, 30);
glTexCoord2f(1.0f, 1.0f);
glVertex2i(10 + 90, 30);
glTexCoord2f(0.0f, 1.0f);
glVertex2i(10 + 90, 30 + 90);
glTexCoord2f(0.0f, 0.0f);
glVertex2i(10, 30 + 90);
glEnd();
glDisable(GL_TEXTURE_2D);
glBegin(GL_LINE_LOOP);
glVertex2i(10, 30);
glVertex2i(10 + 90, 30);
glVertex2i(10 + 90, 30 + 90);
glVertex2i(10, 30 + 90);
glEnd();
glRasterPos2i(105, 65);
printstring(GLUT_BITMAP_HELVETICA_18, "Plane Texture Map");
}
if (showreflectmap) {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, reflectid);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBegin(GL_QUADS);
glTexCoord2f(1.0f, 0.0f);
glVertex2i(540, 30);
glTexCoord2f(1.0f, 1.0f);
glVertex2i(540 + 90, 30);
glTexCoord2f(0.0f, 1.0f);
glVertex2i(540 + 90, 30 + 90);
glTexCoord2f(0.0f, 0.0f);
glVertex2i(540, 30 + 90);
glEnd();
glDisable(GL_TEXTURE_2D);
glBegin(GL_LINE_LOOP);
glVertex2i(540, 30);
glVertex2i(540 + 90, 30);
glVertex2i(540 + 90, 30 + 90);
glVertex2i(540, 30 + 90);
glEnd();
glRasterPos2i(360, 65);
printstring(GLUT_BITMAP_HELVETICA_18, "Sphere Texture Map");
}
glDisable(GL_TEXTURE_2D);
glRasterPos2i(10, 10);
printstring(GLUT_BITMAP_HELVETICA_18, frbuf);
glRasterPos2i(360, 470);
printstring(GLUT_BITMAP_HELVETICA_10,
"Ray V1.0 Written by David Bucciarelli (tech.hmw@plus.it)");
if (help)
printhelp();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
updatemaps();
glutSwapBuffers();
Frames++;
{
GLint t = glutGet(GLUT_ELAPSED_TIME);
if (t - T0 >= 2000) {
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
sprintf(frbuf, "Frame rate: %f", fps);
T0 = t;
Frames = 0;
}
}
}
static void
inittextures(void)
{
int y;
glGenTextures(1, &checkid);
glBindTexture(GL_TEXTURE_2D, checkid);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TEX_CHECK_WIDTH, TEX_CHECK_HEIGHT,
0, GL_RGB, GL_UNSIGNED_BYTE, checkmap);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
for (y = 0; y < TEX_CHECK_NUMSLOT; y++)
updatecheckmap(y);
glGenTextures(1, &reflectid);
glBindTexture(GL_TEXTURE_2D, reflectid);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TEX_REFLECT_WIDTH, TEX_REFLECT_HEIGHT,
0, GL_RGB, GL_UNSIGNED_BYTE, reflectmap);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
for (y = 0; y < TEX_REFLECT_NUMSLOT; y++)
updatereflectmap(y);
}
static void
initspherepos(void)
{
float alpha, beta, sa, ca, sb, cb;
int x, y;
for (y = 0; y < TEX_REFLECT_HEIGHT; y++) {
beta = M_PI - y * (M_PI / TEX_REFLECT_HEIGHT);
for (x = 0; x < TEX_REFLECT_WIDTH; x++) {
alpha = -x * (2.0f * M_PI / TEX_REFLECT_WIDTH);
sa = sin(alpha);
ca = cos(alpha);
sb = sin(beta);
cb = cos(beta);
sphere_pos[y][x][0] = SPHERE_RADIUS * sa * sb;
sphere_pos[y][x][1] = SPHERE_RADIUS * ca * sb;
sphere_pos[y][x][2] = SPHERE_RADIUS * cb;
}
}
}
static void
initdlists(void)
{
GLUquadricObj *obj;
obj = gluNewQuadric();
lightdlist = glGenLists(1);
glNewList(lightdlist, GL_COMPILE);
gluQuadricDrawStyle(obj, GLU_FILL);
gluQuadricNormals(obj, GLU_NONE);
gluQuadricTexture(obj, GL_TRUE);
gluSphere(obj, 0.25f, 6, 6);
glEndList();
objdlist = glGenLists(1);
glNewList(objdlist, GL_COMPILE);
gluQuadricDrawStyle(obj, GLU_FILL);
gluQuadricNormals(obj, GLU_NONE);
gluQuadricTexture(obj, GL_TRUE);
gluSphere(obj, SPHERE_RADIUS, 16, 16);
glEndList();
gluDeleteQuadric(obj);
}
int
main(int ac, char **av)
{
fprintf(stderr,
"Ray V1.0\nWritten by David Bucciarelli (tech.hmw@plus.it)\n");
/*
if(!SetPriorityClass(GetCurrentProcess(),REALTIME_PRIORITY_CLASS)) {
fprintf(stderr,"Error setting the process class.\n");
return 0;
}
if(!SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL)) {
fprintf(stderr,"Error setting the process priority.\n");
return 0;
}
*/
glutInitWindowSize(WIDTH, HEIGHT);
glutInit(&ac, av);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
if (!(win = glutCreateWindow("Ray"))) {
fprintf(stderr, "Error, couldn't open window\n");
return -1;
}
reshape(WIDTH, HEIGHT);
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP2);
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.01);
#ifdef FX
glHint(GL_FOG_HINT, GL_NICEST);
#endif
calcposobs();
initspherepos();
inittextures();
initdlists();
glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]);
glutReshapeFunc(reshape);
glutDisplayFunc(draw);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutIdleFunc(draw);
glutMainLoop();
return 0;
}
-402
View File
@@ -1,402 +0,0 @@
/*
* glReadPixels and glCopyPixels test
*
* Brian Paul March 1, 2000 This file is in the public domain.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <GL/glut.h>
#include "readtex.h"
#define IMAGE_FILE "../images/girl.rgb"
static int ImgWidth, ImgHeight;
static int WinWidth, WinHeight;
static GLenum ImgFormat;
static GLubyte *Image = NULL;
static int APosX, APosY; /* simple drawpixels */
static int BPosX, BPosY; /* read/draw pixels */
static int CPosX, CPosY; /* copypixels */
static GLboolean DrawFront = GL_FALSE;
static GLboolean ScaleAndBias = GL_FALSE;
static GLboolean Benchmark = GL_FALSE;
static GLboolean Triangle = GL_FALSE;
static GLubyte *TempImage = NULL;
#define COMBO 1
#if COMBO == 0
#define ReadFormat ImgFormat
#define ReadType GL_UNSIGNED_BYTE
#elif COMBO == 1
static GLenum ReadFormat = GL_RGBA;
static GLenum ReadType = GL_UNSIGNED_BYTE;
#elif COMBO == 2
static GLenum ReadFormat = GL_RGB;
static GLenum ReadType = GL_UNSIGNED_BYTE;
#elif COMBO == 3
static GLenum ReadFormat = GL_RGB;
static GLenum ReadType = GL_UNSIGNED_SHORT_5_6_5;
#elif COMBO == 4
static GLenum ReadFormat = GL_RGBA;
static GLenum ReadType = GL_UNSIGNED_SHORT_1_5_5_5_REV;
#elif COMBO == 5
static GLenum ReadFormat = GL_BGRA;
static GLenum ReadType = GL_UNSIGNED_SHORT_5_5_5_1;
#elif COMBO == 6
static GLenum ReadFormat = GL_BGRA;
static GLenum ReadType = GL_UNSIGNED_SHORT_4_4_4_4_REV;
#elif COMBO == 7
static GLenum ReadFormat = GL_RGBA;
static GLenum ReadType = GL_HALF_FLOAT_ARB;
#undef GL_OES_read_format
#endif
static void
Reset( void )
{
APosX = 5; APosY = 20;
BPosX = APosX + ImgWidth + 5; BPosY = 20;
CPosX = BPosX + ImgWidth + 5; CPosY = 20;
}
static void
PrintString(const char *s)
{
while (*s) {
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
s++;
}
}
static void
SetupPixelTransfer(GLboolean invert)
{
if (invert) {
glPixelTransferf(GL_RED_SCALE, -1.0);
glPixelTransferf(GL_RED_BIAS, 1.0);
glPixelTransferf(GL_GREEN_SCALE, -1.0);
glPixelTransferf(GL_GREEN_BIAS, 1.0);
glPixelTransferf(GL_BLUE_SCALE, -1.0);
glPixelTransferf(GL_BLUE_BIAS, 1.0);
}
else {
glPixelTransferf(GL_RED_SCALE, 1.0);
glPixelTransferf(GL_RED_BIAS, 0.0);
glPixelTransferf(GL_GREEN_SCALE, 1.0);
glPixelTransferf(GL_GREEN_BIAS, 0.0);
glPixelTransferf(GL_BLUE_SCALE, 1.0);
glPixelTransferf(GL_BLUE_BIAS, 0.0);
}
}
/**
* Exercise Pixel Pack parameters by reading the image in four pieces.
*/
static void
ComplexReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type, GLvoid *pixels)
{
const GLsizei width0 = width / 2;
const GLsizei width1 = width - width0;
const GLsizei height0 = height / 2;
const GLsizei height1 = height - height0;
glPixelStorei(GL_PACK_ROW_LENGTH, width);
/* lower-left quadrant */
glReadPixels(x, y, width0, height0, format, type, pixels);
/* lower-right quadrant */
glPixelStorei(GL_PACK_SKIP_PIXELS, width0);
glReadPixels(x + width0, y, width1, height0, format, type, pixels);
/* upper-left quadrant */
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
glPixelStorei(GL_PACK_SKIP_ROWS, height0);
glReadPixels(x, y + height0, width0, height1, format, type, pixels);
/* upper-right quadrant */
glPixelStorei(GL_PACK_SKIP_PIXELS, width0);
glPixelStorei(GL_PACK_SKIP_ROWS, height0);
glReadPixels(x + width0, y + height0, width1, height1, format, type, pixels);
/* restore defaults */
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
glPixelStorei(GL_PACK_SKIP_ROWS, 0);
glPixelStorei(GL_PACK_ROW_LENGTH, ImgWidth);
}
static void
Display( void )
{
glClearColor(.3, .3, .3, 1);
glClear( GL_COLOR_BUFFER_BIT );
glRasterPos2i(5, ImgHeight+25);
PrintString("f = toggle front/back s = toggle scale/bias b = benchmark");
/* draw original image */
glRasterPos2i(APosX, 5);
PrintString("Original");
if (!Triangle) {
glRasterPos2i(APosX, APosY);
glEnable(GL_DITHER);
SetupPixelTransfer(GL_FALSE);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
}
else {
float z = 0;
glViewport(APosX, APosY, ImgWidth, ImgHeight);
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);
glDisable(GL_CULL_FACE);
/* Red should never be seen
*/
glBegin(GL_POLYGON);
glColor3f(1,0,0);
glVertex3f(-2, -2, z);
glVertex3f(-2, 2, z);
glVertex3f(2, 2, z);
glVertex3f(2, -2, z);
glEnd();
/* Blue background
*/
glBegin(GL_POLYGON);
glColor3f(.5,.5,1);
glVertex3f(-1, -1, z);
glVertex3f(-1, 1, z);
glVertex3f(1, 1, z);
glVertex3f(1, -1, z);
glEnd();
/* Triangle
*/
glBegin(GL_TRIANGLES);
glColor3f(.8,0,0);
glVertex3f(-0.9, -0.9, z);
glColor3f(0,.9,0);
glVertex3f( 0.9, -0.9, z);
glColor3f(0,0,.7);
glVertex3f( 0.0, 0.9, z);
glEnd();
glColor3f(1,1,1);
glViewport( 0, 0, WinWidth, WinHeight );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( 0.0, WinWidth, 0.0, WinHeight, -1.0, 1.0 );
}
/* might try alignment=4 here for testing */
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
/* do readpixels, drawpixels */
glRasterPos2i(BPosX, 5);
PrintString("Read/DrawPixels");
SetupPixelTransfer(ScaleAndBias);
if (Benchmark) {
GLint reads = 0;
GLint endTime;
GLint startTime = glutGet(GLUT_ELAPSED_TIME);
GLdouble seconds, mpixels, mpixelsPerSecond;
printf("Benchmarking...\n");
do {
glReadPixels(APosX, APosY, ImgWidth, ImgHeight,
ReadFormat, ReadType, TempImage);
reads++;
endTime = glutGet(GLUT_ELAPSED_TIME);
} while (endTime - startTime < 4000); /* 4 seconds */
seconds = (double) (endTime - startTime) / 1000.0;
mpixels = reads * (ImgWidth * ImgHeight / (1000.0 * 1000.0));
mpixelsPerSecond = mpixels / seconds;
printf("Result: %d reads in %f seconds = %f Mpixels/sec\n",
reads, seconds, mpixelsPerSecond);
Benchmark = GL_FALSE;
}
else {
/* clear the temporary image to white (helpful for debugging */
memset(TempImage, 255, ImgWidth * ImgHeight * 4);
#if 1
glReadPixels(APosX, APosY, ImgWidth, ImgHeight,
ReadFormat, ReadType, TempImage);
(void) ComplexReadPixels;
#else
/* you might use this when debugging */
ComplexReadPixels(APosX, APosY, ImgWidth, ImgHeight,
ReadFormat, ReadType, TempImage);
#endif
}
glRasterPos2i(BPosX, BPosY);
glDisable(GL_DITHER);
SetupPixelTransfer(GL_FALSE);
glDrawPixels(ImgWidth, ImgHeight, ReadFormat, ReadType, TempImage);
/* do copypixels */
glRasterPos2i(CPosX, 5);
PrintString("CopyPixels");
glRasterPos2i(CPosX, CPosY);
glDisable(GL_DITHER);
SetupPixelTransfer(ScaleAndBias);
glCopyPixels(APosX, APosY, ImgWidth, ImgHeight, GL_COLOR);
if (!DrawFront)
glutSwapBuffers();
else
glFinish();
}
static void
Reshape( int width, int height )
{
WinWidth = width;
WinHeight = height;
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glOrtho( 0.0, width, 0.0, height, -1.0, 1.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
}
static void
Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 'b':
Benchmark = GL_TRUE;
break;
case 't':
Triangle = !Triangle;
break;
case 's':
ScaleAndBias = !ScaleAndBias;
break;
case 'f':
DrawFront = !DrawFront;
if (DrawFront) {
glDrawBuffer(GL_FRONT);
glReadBuffer(GL_FRONT);
}
else {
glDrawBuffer(GL_BACK);
glReadBuffer(GL_BACK);
}
printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK");
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void
Init( GLboolean ciMode )
{
GLboolean have_read_format = GL_FALSE;
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
Image = LoadRGBImage( IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat );
if (!Image) {
printf("Couldn't read %s\n", IMAGE_FILE);
exit(0);
}
if (ciMode) {
/* Convert RGB image to grayscale */
GLubyte *indexImage = (GLubyte *) malloc( ImgWidth * ImgHeight );
GLint i;
for (i=0; i<ImgWidth*ImgHeight; i++) {
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];
indexImage[i] = gray / 3;
}
free(Image);
Image = indexImage;
ImgFormat = GL_COLOR_INDEX;
for (i=0;i<255;i++) {
float g = i / 255.0;
glutSetColor(i, g, g, g);
}
}
#ifdef GL_OES_read_format
if ( glutExtensionSupported( "GL_OES_read_format" ) ) {
glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES, (GLint *) &ReadType);
glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES, (GLint *) &ReadFormat);
have_read_format = GL_TRUE;
}
#endif
printf( "GL_OES_read_format %ssupported. "
"Using type / format = 0x%04x / 0x%04x\n",
(have_read_format) ? "" : "not ",
ReadType, ReadFormat );
printf("Loaded %d by %d image\n", ImgWidth, ImgHeight );
glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth);
glPixelStorei(GL_PACK_ROW_LENGTH, ImgWidth);
Reset();
/* allocate large TempImage to store and image data type, plus an
* extra 1KB in case we're tinkering with pack alignment.
*/
TempImage = (GLubyte *) malloc(ImgWidth * ImgHeight * 4 * 4
+ 1000);
assert(TempImage);
}
int
main( int argc, char *argv[] )
{
GLboolean ciMode = GL_FALSE;
glutInitWindowSize( 750, 250 );
glutInit( &argc, argv );
if (argc > 1 && strcmp(argv[1], "-ci")==0) {
ciMode = GL_TRUE;
}
if (ciMode)
glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE );
else
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutCreateWindow(argv[0]);
Init(ciMode);
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
glutMainLoop();
return 0;
}
-591
View File
@@ -1,591 +0,0 @@
/*
* Demo of a reflective, texture-mapped surface with OpenGL.
* Brian Paul August 14, 1995 This file is in the public domain.
*
* Hardware texture mapping is highly recommended!
*
* The basic steps are:
* 1. Render the reflective object (a polygon) from the normal viewpoint,
* setting the stencil planes = 1.
* 2. Render the scene from a special viewpoint: the viewpoint which
* is on the opposite side of the reflective plane. Only draw where
* stencil = 1. This draws the objects in the reflective surface.
* 3. Render the scene from the original viewpoint. This draws the
* objects in the normal fashion. Use blending when drawing
* the reflective, textured surface.
*
* This is a very crude demo. It could be much better.
*/
/*
* Authors:
* Brian Paul
* Dirk Reiners (reiners@igd.fhg.de) made some modifications to this code.
* Mark Kilgard (April 1997)
* Brian Paul (April 2000 - added keyboard d/s options)
* Brian Paul (August 2005 - added multi window feature)
*/
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "GL/glut.h"
#include "showbuffer.h"
#include "readtex.h"
#define DEG2RAD (3.14159/180.0)
#define TABLE_TEXTURE "../images/tile.rgb"
#define MAX_OBJECTS 2
#define INIT_WIDTH 400
#define INIT_HEIGHT 300
#ifdef _WIN32
#undef CreateWindowA
#endif
struct window {
int id; /* returned by glutCreateWindow() */
int width, height;
GLboolean anim;
GLfloat xrot, yrot;
GLfloat spin;
GLenum showBuffer;
GLenum drawBuffer;
GLuint table_list;
GLuint objects_list[MAX_OBJECTS];
double t0;
struct window *next;
};
static struct window *FirstWindow = NULL;
static void
CreateWindow(void);
static struct window *
CurrentWindow(void)
{
int id = glutGetWindow();
struct window *w;
for (w = FirstWindow; w; w = w->next) {
if (w->id == id)
return w;
}
return NULL;
}
static GLboolean
AnyAnimating(void)
{
struct window *w;
for (w = FirstWindow; w; w = w->next) {
if (w->anim)
return 1;
}
return 0;
}
static void
KillWindow(struct window *w)
{
struct window *win, *prev = NULL;
for (win = FirstWindow; win; win = win->next) {
if (win == w) {
if (prev) {
prev->next = win->next;
}
else {
FirstWindow = win->next;
}
glutDestroyWindow(win->id);
win->next = NULL;
free(win);
return;
}
prev = win;
}
}
static void
KillAllWindows(void)
{
while (FirstWindow)
KillWindow(FirstWindow);
}
static GLuint
MakeTable(void)
{
static GLfloat table_mat[] = { 1.0, 1.0, 1.0, 0.6 };
static GLfloat gray[] = { 0.4, 0.4, 0.4, 1.0 };
GLuint table_list;
table_list = glGenLists(1);
glNewList( table_list, GL_COMPILE );
/* load table's texture */
glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, table_mat );
/*glMaterialfv( GL_FRONT, GL_EMISSION, gray );*/
glMaterialfv( GL_FRONT, GL_DIFFUSE, table_mat );
glMaterialfv( GL_FRONT, GL_AMBIENT, gray );
/* draw textured square for the table */
glPushMatrix();
glScalef( 4.0, 4.0, 4.0 );
glBegin( GL_POLYGON );
glNormal3f( 0.0, 1.0, 0.0 );
glTexCoord2f( 0.0, 0.0 ); glVertex3f( -1.0, 0.0, 1.0 );
glTexCoord2f( 1.0, 0.0 ); glVertex3f( 1.0, 0.0, 1.0 );
glTexCoord2f( 1.0, 1.0 ); glVertex3f( 1.0, 0.0, -1.0 );
glTexCoord2f( 0.0, 1.0 ); glVertex3f( -1.0, 0.0, -1.0 );
glEnd();
glPopMatrix();
glDisable( GL_TEXTURE_2D );
glEndList();
return table_list;
}
static void
MakeObjects(GLuint *objects_list)
{
GLUquadricObj *q;
static GLfloat cyan[] = { 0.0, 1.0, 1.0, 1.0 };
static GLfloat green[] = { 0.2, 1.0, 0.2, 1.0 };
static GLfloat black[] = { 0.0, 0.0, 0.0, 0.0 };
q = gluNewQuadric();
gluQuadricDrawStyle( q, GLU_FILL );
gluQuadricNormals( q, GLU_SMOOTH );
objects_list[0] = glGenLists(1);
glNewList( objects_list[0], GL_COMPILE );
glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, cyan );
glMaterialfv( GL_FRONT, GL_EMISSION, black );
gluCylinder( q, 0.5, 0.5, 1.0, 15, 1 );
glEndList();
objects_list[1] = glGenLists(1);
glNewList( objects_list[1], GL_COMPILE );
glMaterialfv( GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green );
glMaterialfv( GL_FRONT, GL_EMISSION, black );
gluCylinder( q, 1.5, 0.0, 2.5, 15, 1 );
glEndList();
gluDeleteQuadric(q);
}
static void
InitWindow(struct window *w)
{
GLint imgWidth, imgHeight;
GLenum imgFormat;
GLubyte *image = NULL;
w->table_list = MakeTable();
MakeObjects(w->objects_list);
image = LoadRGBImage( TABLE_TEXTURE, &imgWidth, &imgHeight, &imgFormat );
if (!image) {
printf("Couldn't read %s\n", TABLE_TEXTURE);
exit(0);
}
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, imgWidth, imgHeight,
imgFormat, GL_UNSIGNED_BYTE, image);
free(image);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glShadeModel( GL_FLAT );
glEnable( GL_LIGHT0 );
glEnable( GL_LIGHTING );
glClearColor( 0.5, 0.5, 0.9, 0.0 );
glEnable( GL_NORMALIZE );
}
static void
Reshape(int width, int height)
{
struct window *w = CurrentWindow();
GLfloat yAspect = 2.5;
GLfloat xAspect = yAspect * (float) width / (float) height;
w->width = width;
w->height = height;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum( -xAspect, xAspect, -yAspect, yAspect, 10.0, 30.0 );
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static void
DrawObjects(struct window *w, GLfloat eyex, GLfloat eyey, GLfloat eyez)
{
(void) eyex;
(void) eyey;
(void) eyez;
#ifndef USE_ZBUFFER
if (eyex<0.5) {
#endif
glPushMatrix();
glTranslatef( 1.0, 1.5, 0.0 );
glRotatef( w->spin, 1.0, 0.5, 0.0 );
glRotatef( 0.5*w->spin, 0.0, 0.5, 1.0 );
glCallList( w->objects_list[0] );
glPopMatrix();
glPushMatrix();
glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*w->spin) ), 0.0 );
glRotatef( 0.5*w->spin, 0.0, 0.5, 1.0 );
glRotatef( w->spin, 1.0, 0.5, 0.0 );
glScalef( 0.5, 0.5, 0.5 );
glCallList( w->objects_list[1] );
glPopMatrix();
#ifndef USE_ZBUFFER
}
else {
glPushMatrix();
glTranslatef( -1.0, 0.85+3.0*fabs( cos(0.01*w->spin) ), 0.0 );
glRotatef( 0.5*w->spin, 0.0, 0.5, 1.0 );
glRotatef( w->spin, 1.0, 0.5, 0.0 );
glScalef( 0.5, 0.5, 0.5 );
glCallList( w->objects_list[1] );
glPopMatrix();
glPushMatrix();
glTranslatef( 1.0, 1.5, 0.0 );
glRotatef( w->spin, 1.0, 0.5, 0.0 );
glRotatef( 0.5*w->spin, 0.0, 0.5, 1.0 );
glCallList( w->objects_list[0] );
glPopMatrix();
}
#endif
}
static void
DrawTable(struct window *w)
{
glCallList(w->table_list);
}
static void
DrawWindow(void)
{
struct window *w = CurrentWindow();
static GLfloat light_pos[] = { 0.0, 20.0, 0.0, 1.0 };
GLfloat dist = 20.0;
GLfloat eyex, eyey, eyez;
if (w->drawBuffer == GL_NONE) {
glDrawBuffer(GL_BACK);
glReadBuffer(GL_BACK);
}
else {
glDrawBuffer(w->drawBuffer);
glReadBuffer(w->drawBuffer);
}
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
if (w->drawBuffer == GL_NONE) {
glDrawBuffer(GL_NONE);
}
eyex = dist * cos(w->yrot * DEG2RAD) * cos(w->xrot * DEG2RAD);
eyez = dist * sin(w->yrot * DEG2RAD) * cos(w->xrot * DEG2RAD);
eyey = dist * sin(w->xrot * DEG2RAD);
/* view from top */
glPushMatrix();
gluLookAt( eyex, eyey, eyez, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 );
glLightfv( GL_LIGHT0, GL_POSITION, light_pos );
/* draw table into stencil planes */
glDisable( GL_DEPTH_TEST );
glEnable( GL_STENCIL_TEST );
glStencilFunc( GL_ALWAYS, 1, 0xffffffff );
glStencilOp( GL_REPLACE, GL_REPLACE, GL_REPLACE );
glColorMask( GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE );
DrawTable(w);
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
glEnable( GL_DEPTH_TEST );
/* render view from below (reflected viewport) */
/* only draw where stencil==1 */
if (eyey>0.0) {
glPushMatrix();
glStencilFunc( GL_EQUAL, 1, 0xffffffff ); /* draw if ==1 */
glStencilOp( GL_KEEP, GL_KEEP, GL_KEEP );
glScalef( 1.0, -1.0, 1.0 );
/* Reposition light in reflected space. */
glLightfv(GL_LIGHT0, GL_POSITION, light_pos);
DrawObjects(w, eyex, eyey, eyez);
glPopMatrix();
/* Restore light's original unreflected position. */
glLightfv(GL_LIGHT0, GL_POSITION, light_pos);
}
glDisable( GL_STENCIL_TEST );
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glEnable( GL_TEXTURE_2D );
DrawTable(w);
glDisable( GL_TEXTURE_2D );
glDisable( GL_BLEND );
/* view from top */
glPushMatrix();
DrawObjects(w, eyex, eyey, eyez);
glPopMatrix();
glPopMatrix();
if (w->showBuffer == GL_DEPTH) {
ShowDepthBuffer(w->width, w->height, 1.0, 0.0);
}
else if (w->showBuffer == GL_STENCIL) {
ShowStencilBuffer(w->width, w->height, 255.0, 0.0);
}
else if (w->showBuffer == GL_ALPHA) {
ShowAlphaBuffer(w->width, w->height);
}
if (w->drawBuffer == GL_FRONT)
glFinish();
else
glutSwapBuffers();
/* calc/show frame rate */
{
static GLint t0 = 0;
static GLint frames = 0;
GLint t = glutGet(GLUT_ELAPSED_TIME);
frames++;
if (t - t0 >= 5000) {
GLfloat seconds = (t - t0) / 1000.0;
GLfloat fps = frames / seconds;
printf("%d frames in %g seconds = %g FPS\n", frames, seconds, fps);
fflush(stdout);
t0 = t;
frames = 0;
}
}
}
static void
Idle(void)
{
double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
struct window *w;
for (w = FirstWindow; w; w = w->next) {
if (w->anim) {
double dt;
if (w->t0 < 0.0)
w->t0 = t;
dt = t - w->t0;
w->t0 = t;
w->spin += 60.0 * dt;
w->yrot += 90.0 * dt;
assert(w->id);
glutSetWindow(w->id);
glutPostRedisplay();
}
}
}
static void
UpdateIdleFunc(void)
{
if (AnyAnimating())
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
}
static void
Key(unsigned char key, int x, int y)
{
struct window *w = CurrentWindow();
(void) x;
(void) y;
switch (key) {
case 'd':
w->showBuffer = GL_DEPTH;
glutPostRedisplay();
break;
case 's':
w->showBuffer = GL_STENCIL;
glutPostRedisplay();
break;
case 'a':
w->showBuffer = GL_ALPHA;
glutPostRedisplay();
break;
case 'c':
w->showBuffer = GL_NONE;
glutPostRedisplay();
break;
case 'f':
if (w->drawBuffer == GL_FRONT)
w->drawBuffer = GL_BACK;
else
w->drawBuffer = GL_FRONT;
glutPostRedisplay();
break;
case '0':
w->drawBuffer = GL_NONE;
glutPostRedisplay();
break;
case ' ':
w->anim = !w->anim;
w->t0 = -1;
UpdateIdleFunc();
glutPostRedisplay();
break;
case 'n':
CreateWindow();
UpdateIdleFunc();
break;
case 'k':
KillWindow(w);
if (FirstWindow == NULL)
exit(0);
break;
case 27:
KillAllWindows();
exit(0);
break;
default:
;
}
}
static void
SpecialKey(int key, int x, int y)
{
struct window *w = CurrentWindow();
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
w->xrot += 3.0;
if (w->xrot > 85)
w->xrot = 85;
break;
case GLUT_KEY_DOWN:
w->xrot -= 3.0;
if (w->xrot < 5)
w->xrot = 5;
break;
case GLUT_KEY_LEFT:
w->yrot += 3.0;
break;
case GLUT_KEY_RIGHT:
w->yrot -= 3.0;
break;
}
glutPostRedisplay();
}
static void
CreateWindow(void)
{
char title[1000];
struct window *w = (struct window *) calloc(1, sizeof(struct window));
glutInitWindowSize(INIT_WIDTH, INIT_HEIGHT);
w->id = glutCreateWindow("foo");
sprintf(title, "reflect window %d", w->id);
glutSetWindowTitle(title);
assert(w->id);
w->width = INIT_WIDTH;
w->height = INIT_HEIGHT;
w->anim = GL_TRUE;
w->xrot = 30.0;
w->yrot = 50.0;
w->spin = 0.0;
w->showBuffer = GL_NONE;
w->drawBuffer = GL_BACK;
InitWindow(w);
glutReshapeFunc(Reshape);
glutDisplayFunc(DrawWindow);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
/* insert at head of list */
w->next = FirstWindow;
FirstWindow = w;
}
static void
Usage(void)
{
printf("Keys:\n");
printf(" a - show alpha buffer\n");
printf(" d - show depth buffer\n");
printf(" s - show stencil buffer\n");
printf(" c - show color buffer\n");
printf(" f - toggle rendering to front/back color buffer\n");
printf(" n - create new window\n");
printf(" k - kill window\n");
printf(" SPACE - toggle animation\n");
printf(" ARROWS - rotate scene\n");
}
int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH |
GLUT_STENCIL | GLUT_ALPHA);
CreateWindow();
glutIdleFunc(Idle);
Usage();
glutMainLoop();
return 0;
}
-136
View File
@@ -1,136 +0,0 @@
/*
* Test GL_EXT_rescale_normal extension
* Brian Paul January 1998 This program is in the public domain.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>
static GLfloat Phi = 0.0;
static void Idle( void )
{
static double t0 = -1.;
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
Phi += 3.0 * dt;
glutPostRedisplay();
}
static void Display( void )
{
GLfloat scale = 0.6 + 0.5 * sin(Phi);
glClear( GL_COLOR_BUFFER_BIT );
glPushMatrix();
glScalef(scale, scale, scale);
glutSolidSphere(2.0, 20, 20);
glPopMatrix();
glutSwapBuffers();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -15.0 );
}
static void Init( void )
{
static GLfloat mat[4] = { 0.8, 0.8, 0.0, 1.0 };
static GLfloat pos[4] = { -1.0, 1.0, 1.0, 0.0 };
/* setup lighting, etc */
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat);
glLightfv(GL_LIGHT0, GL_POSITION, pos);
glEnable(GL_CULL_FACE);
glDisable(GL_RESCALE_NORMAL_EXT);
glDisable(GL_NORMALIZE);
}
#define UNSCALED 1
#define NORMALIZE 2
#define RESCALE 3
#define QUIT 4
static void ModeMenu(int entry)
{
if (entry==UNSCALED) {
glDisable(GL_RESCALE_NORMAL_EXT);
glDisable(GL_NORMALIZE);
}
else if (entry==NORMALIZE) {
glEnable(GL_NORMALIZE);
glDisable(GL_RESCALE_NORMAL_EXT);
}
else if (entry==RESCALE) {
glDisable(GL_NORMALIZE);
glEnable(GL_RESCALE_NORMAL_EXT);
}
else if (entry==QUIT) {
exit(0);
}
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[] )
{
glutInitWindowSize( 400, 400 );
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutCreateWindow(argv[0]);
Init();
glutIdleFunc( Idle );
glutReshapeFunc( Reshape );
glutDisplayFunc( Display );
glutKeyboardFunc(key);
glutCreateMenu(ModeMenu);
glutAddMenuEntry("Unscaled", UNSCALED);
glutAddMenuEntry("Normalize", NORMALIZE);
glutAddMenuEntry("Rescale EXT", RESCALE);
glutAddMenuEntry("Quit", QUIT);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMainLoop();
return 0;
}
File diff suppressed because it is too large Load Diff
-269
View File
@@ -1,269 +0,0 @@
/*
* Demo of (nearly) flicker-free drawing with a single color buffer.
*
* Basically, draw the scene into the Z buffer first, then draw the
* scene into the color buffer. Finally, "clear" the background by
* setting the fragments we didn't hit earlier.
*
* This won't work if you need blending. The technique works best
* when the scene is relatively simple and can be rendered quickly
* (i.e. with hardware), and when the objects don't move too much from
* one frame to the next.
*
* Brian Paul
* 25 August 2005
*
* See Mesa license for terms.
*/
#include <stdio.h>
#include <stdlib.h>
#include <GL/glut.h>
#define FLICKER 0
#define NO_FLICKER 1
static GLint Mode = NO_FLICKER;
static GLfloat Xrot = 0, Yrot = 0, Zrot = 0;
static GLboolean Anim = GL_TRUE;
static GLfloat ClearColor[4] = {0.2, 0.2, 0.9, 0.0};
static GLfloat NearClip = 5.0, FarClip = 25.0, ViewDist = 7.0;
static double PrevTime = -1;
struct box {
float tx, ty, tz;
float rx, ry, rz, ra;
float sx, sy, sz;
float color[4];
};
#define NUM_BOXES 25
struct box Boxes[NUM_BOXES];
/* Return random float in [0,1] */
static float
Random(void)
{
int i = rand();
return (float) (i % 1000) / 1000.0;
}
static void
MakeBoxes(void)
{
int i;
for (i = 0; i < NUM_BOXES; i++) {
Boxes[i].tx = -1.0 + 2.0 * Random();
Boxes[i].ty = -1.0 + 2.0 * Random();
Boxes[i].tz = -1.0 + 2.0 * Random();
Boxes[i].sx = 0.1 + Random() * 0.4;
Boxes[i].sy = 0.1 + Random() * 0.4;
Boxes[i].sz = 0.1 + Random() * 0.4;
Boxes[i].rx = Random();
Boxes[i].ry = Random();
Boxes[i].rz = Random();
Boxes[i].ra = Random() * 360.0;
Boxes[i].color[0] = Random();
Boxes[i].color[1] = Random();
Boxes[i].color[2] = Random();
Boxes[i].color[3] = 1.0;
}
}
static void
DrawBoxes(void)
{
int i;
for (i = 0; i < NUM_BOXES; i++) {
glPushMatrix();
glTranslatef(Boxes[i].tx, Boxes[i].ty, Boxes[i].tz);
glRotatef(Boxes[i].ra, Boxes[i].rx, Boxes[i].ry, Boxes[i].rz);
glScalef(Boxes[i].sx, Boxes[i].sy, Boxes[i].sz);
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, Boxes[i].color);
glutSolidCube(1.0);
glPopMatrix();
}
}
static void
Idle(void)
{
double dt, t = glutGet(GLUT_ELAPSED_TIME) * 0.001;
if (PrevTime < 0.0)
PrevTime = t;
dt = t - PrevTime;
PrevTime = t;
Xrot += 16.0 * dt;
Yrot += 12.0 * dt;
Zrot += 8.0 * dt;
glutPostRedisplay();
}
static void
Draw(void)
{
if (Mode == FLICKER) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
else {
/* don't clear color buffer */
glClear(GL_DEPTH_BUFFER_BIT);
/* update Z buffer only */
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
}
glPushMatrix();
glRotatef(Xrot, 1, 0, 0);
glRotatef(Yrot, 0, 1, 0);
glRotatef(Zrot, 0, 0, 1);
DrawBoxes();
if (Mode == NO_FLICKER) {
/* update color buffer now */
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glDepthFunc(GL_EQUAL);
DrawBoxes();
glDepthFunc(GL_LESS);
}
glPopMatrix();
if (Mode == NO_FLICKER) {
/* "clear" the untouched pixels now.
* Note: if you comment-out this code you'll see something interesting.
*/
GLfloat x = FarClip / NearClip;
GLfloat z = -(FarClip - ViewDist - 1.0);
glDisable(GL_LIGHTING);
glColor4fv(ClearColor);
glBegin(GL_POLYGON);
glVertex3f(-x, -x, z);
glVertex3f( x, -x, z);
glVertex3f( x, x, z);
glVertex3f(-x, x, z);
glEnd();
glEnable(GL_LIGHTING);
}
/* This is where you'd normally do SwapBuffers */
glFinish();
}
static void
Reshape(int width, int height)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, NearClip, FarClip);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -ViewDist);
}
static void
Key(unsigned char key, int x, int y)
{
(void) x;
(void) y;
switch (key) {
case 'a':
Anim = !Anim;
if (Anim)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
PrevTime = -1;
break;
case 'm':
Mode = !Mode;
break;
case 'b':
MakeBoxes();
break;
case 27:
exit(0);
break;
}
glutPostRedisplay();
}
static void
SpecialKey(int key, int x, int y)
{
const GLfloat step = 3.0;
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
Xrot -= step;
break;
case GLUT_KEY_DOWN:
Xrot += step;
break;
case GLUT_KEY_LEFT:
Yrot -= step;
break;
case GLUT_KEY_RIGHT:
Yrot += step;
break;
}
glutPostRedisplay();
}
static void
Init(void)
{
glClearColor(ClearColor[0], ClearColor[1], ClearColor[2], ClearColor[3]);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_CULL_FACE);
glEnable(GL_NORMALIZE);
MakeBoxes();
}
static void
Usage(void)
{
printf("Keys:\n");
printf(" m - toggle drawing mode (flicker vs. no flicker)\n");
printf(" a - toggle animation\n");
printf(" b - generate new boxes\n");
printf(" ARROWS - rotate scene\n");
printf(" ESC - exit\n");
}
int
main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitWindowSize(800, 800);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH);
glutCreateWindow(argv[0]);
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
glutDisplayFunc(Draw);
if (Anim)
glutIdleFunc(Idle);
Init();
Usage();
glutMainLoop();
return 0;
}
-268
View File
@@ -1,268 +0,0 @@
/*
* GLUT demonstration of texturing with specular highlights.
*
* When drawing a lit, textured surface one usually wants the specular
* highlight to override the texture colors. However, OpenGL applies
* texturing after lighting so the specular highlight is modulated by
* the texture.
*
* The solution here shown here is a two-pass algorithm:
* 1. Draw the textured surface without specular lighting.
* 2. Enable blending to add the next pass:
* 3. Redraw the surface with a matte white material and only the
* specular components of light sources enabled.
*
* Brian Paul February 1997
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glut.h>
static GLUquadricObj *Quadric;
static GLuint Sphere;
static GLfloat LightPos[4] = {10.0, 10.0, 10.0, 1.0};
static GLfloat Delta = 20.0;
static GLint Mode = 4;
/*static GLfloat Blue[4] = {0.0, 0.0, 1.0, 1.0};*/
/*static GLfloat Gray[4] = {0.5, 0.5, 0.5, 1.0};*/
static GLfloat Black[4] = {0.0, 0.0, 0.0, 1.0};
static GLfloat White[4] = {1.0, 1.0, 1.0, 1.0};
static GLboolean smooth = 1;
static void
Idle(void)
{
static double t0 = -1.;
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
LightPos[0] += Delta * dt;
if (LightPos[0]>15.0 || LightPos[0]<-15.0)
Delta = -Delta;
glutPostRedisplay();
}
static void Display( void )
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glLightfv(GL_LIGHT0, GL_POSITION, LightPos);
glPushMatrix();
glRotatef(90.0, 1.0, 0.0, 0.0);
if (Mode==0) {
/* Typical method: diffuse + specular + texture */
glEnable(GL_TEXTURE_2D);
glLightfv(GL_LIGHT0, GL_DIFFUSE, White); /* enable diffuse */
glLightfv(GL_LIGHT0, GL_SPECULAR, White); /* enable specular */
#ifdef GL_VERSION_1_2
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
#endif
glCallList(Sphere);
}
else if (Mode==1) {
/* just specular highlight */
glDisable(GL_TEXTURE_2D);
glLightfv(GL_LIGHT0, GL_DIFFUSE, Black); /* disable diffuse */
glLightfv(GL_LIGHT0, GL_SPECULAR, White); /* enable specular */
#ifdef GL_VERSION_1_2
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
#endif
glCallList(Sphere);
}
else if (Mode==2) {
/* diffuse textured */
glEnable(GL_TEXTURE_2D);
glLightfv(GL_LIGHT0, GL_DIFFUSE, White); /* enable diffuse */
glLightfv(GL_LIGHT0, GL_SPECULAR, Black); /* disable specular */
#ifdef GL_VERSION_1_2
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
#endif
glCallList(Sphere);
}
else if (Mode==3) {
/* 2-pass: diffuse textured then add specular highlight*/
glEnable(GL_TEXTURE_2D);
glLightfv(GL_LIGHT0, GL_DIFFUSE, White); /* enable diffuse */
glLightfv(GL_LIGHT0, GL_SPECULAR, Black); /* disable specular */
#ifdef GL_VERSION_1_2
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
#endif
glCallList(Sphere);
/* specular highlight */
glDepthFunc(GL_EQUAL); /* redraw same pixels */
glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND); /* add */
glLightfv(GL_LIGHT0, GL_DIFFUSE, Black); /* disable diffuse */
glLightfv(GL_LIGHT0, GL_SPECULAR, White); /* enable specular */
glCallList(Sphere);
glDepthFunc(GL_LESS);
glDisable(GL_BLEND);
}
else if (Mode==4) {
/* OpenGL 1.2's separate diffuse and specular color */
glEnable(GL_TEXTURE_2D);
glLightfv(GL_LIGHT0, GL_DIFFUSE, White); /* enable diffuse */
glLightfv(GL_LIGHT0, GL_SPECULAR, White); /* enable specular */
#ifdef GL_VERSION_1_2
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
#endif
glCallList(Sphere);
}
glPopMatrix();
glutSwapBuffers();
}
static void Reshape( int width, int height )
{
glViewport( 0, 0, width, height );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -12.0 );
}
static void Key( unsigned char key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case 27:
exit(0);
break;
case 's':
smooth = !smooth;
if (smooth)
glShadeModel(GL_SMOOTH);
else
glShadeModel(GL_FLAT);
break;
}
glutPostRedisplay();
}
static void SpecialKey( int key, int x, int y )
{
(void) x;
(void) y;
switch (key) {
case GLUT_KEY_UP:
break;
case GLUT_KEY_DOWN:
break;
}
glutPostRedisplay();
}
static void Init( void )
{
int i, j;
GLubyte texImage[64][64][3];
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 0);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, Black);
glShadeModel(GL_SMOOTH);
glMaterialfv(GL_FRONT, GL_DIFFUSE, White);
glMaterialfv(GL_FRONT, GL_SPECULAR, White);
glMaterialf(GL_FRONT, GL_SHININESS, 20.0);
/* Actually, these are set again later */
glLightfv(GL_LIGHT0, GL_DIFFUSE, White);
glLightfv(GL_LIGHT0, GL_SPECULAR, White);
Quadric = gluNewQuadric();
gluQuadricTexture( Quadric, GL_TRUE );
Sphere= glGenLists(1);
glNewList( Sphere, GL_COMPILE );
gluSphere( Quadric, 1.0, 24, 24 );
glEndList();
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
for (i=0;i<64;i++) {
for (j=0;j<64;j++) {
int k = ((i>>3)&1) ^ ((j>>3)&1);
texImage[i][j][0] = 255*k;
texImage[i][j][1] = 255*(1-k);
texImage[i][j][2] = 0;
}
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D( GL_TEXTURE_2D,
0,
3,
64, 64,
0,
GL_RGB, GL_UNSIGNED_BYTE,
texImage );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_ONE, GL_ONE);
}
static void ModeMenu(int entry)
{
if (entry==99)
exit(0);
Mode = entry;
}
int main( int argc, char *argv[] )
{
glutInitWindowSize( 300, 300 );
glutInit( &argc, argv );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow( "spectex" );
Init();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutSpecialFunc( SpecialKey );
glutDisplayFunc( Display );
glutIdleFunc( Idle );
glutCreateMenu( ModeMenu );
glutAddMenuEntry("1-pass lighting + texturing", 0);
glutAddMenuEntry("specular lighting", 1);
glutAddMenuEntry("diffuse lighting + texturing", 2);
glutAddMenuEntry("2-pass lighting + texturing", 3);
#ifdef GL_VERSION_1_2
glutAddMenuEntry("OpenGL 1.2 separate specular", 4);
#endif
glutAddMenuEntry("Quit", 99);
glutAttachMenu(GLUT_RIGHT_BUTTON);
glutMainLoop();
return 0;
}
-555
View File
@@ -1,555 +0,0 @@
/* Copyright (c) Mark J. Kilgard, 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. */
/* This example demonstrates how to render particle effects
with OpenGL. A cloud of pinkish/orange particles explodes with the
particles bouncing off the ground. When the EXT_point_parameters
is present , the particle size is attenuated based on eye distance. */
/* Modified by Brian Paul to test GL_ARB_point_sprite */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h> /* for cos(), sin(), and sqrt() */
#ifdef _WIN32
#include <windows.h>
#endif
#include <GL/glew.h>
#include <GL/glut.h>
/* Some <math.h> files do not define M_PI... */
#ifndef M_PI
#define M_PI 3.14159265
#endif
#if 0 /* For debugging. */
#undef GL_EXT_point_parameters
#endif
static GLfloat angle = -150; /* in degrees */
static int spin = 0;
static int moving, begin;
static float theTime;
static int repeat = 1;
static int blend = 1;
int useMipmaps = 1;
int linearFiltering = 1;
static GLfloat constant[3] = { .2, 0.0, 0.0 };
static GLfloat linear[3] = { .0, .1, 0.0 };
static GLfloat theQuad[3] = { .005, 0.1, 1/600.0 };
#define MAX_POINTS 2000
static int numPoints = 200;
static GLfloat pointList[MAX_POINTS][3];
static GLfloat pointTime[MAX_POINTS];
static GLfloat pointVelocity[MAX_POINTS][2];
static GLfloat pointDirection[MAX_POINTS][2];
static int colorList[MAX_POINTS];
static int animate = 1, motion = 0, org = 0, sprite = 1, smooth = 1;
static GLfloat colorSet[][4] = {
/* Shades of red. */
{ 0.7, 0.2, 0.4, 0.5 },
{ 0.8, 0.0, 0.7, 0.5 },
{ 1.0, 0.0, 0.0, 0.5 },
{ 0.9, 0.3, 0.6, 0.5 },
{ 1.0, 0.4, 0.0, 0.5 },
{ 1.0, 0.0, 0.5, 0.5 },
};
#define NUM_COLORS (sizeof(colorSet)/sizeof(colorSet[0]))
#define DEAD (NUM_COLORS+1)
/* GL */
static GLint spritePattern[16][16] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0 },
{ 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
{ 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 },
{ 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0 },
{ 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0 },
{ 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0 },
{ 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
#if 0 /* drand48 might be better on Unix machines */
#define RANDOM_RANGE(lo, hi) ((lo) + (hi - lo) * drand48())
#else
static float float_rand(void) { return rand() / (float) RAND_MAX; }
#define RANDOM_RANGE(lo, hi) ((lo) + (hi - lo) * float_rand())
#endif
#define MEAN_VELOCITY 3.0
#define GRAVITY 2.0
/* Modeling units of ground extent in each X and Z direction. */
#define EDGE 12
static void
makePointList(void)
{
float angle, velocity, direction;
int i;
motion = 1;
for (i=0; i<numPoints; i++) {
pointList[i][0] = 0.0;
pointList[i][1] = 0.0;
pointList[i][2] = 0.0;
pointTime[i] = 0.0;
angle = (RANDOM_RANGE(60.0, 70.0)) * M_PI/180.0;
direction = RANDOM_RANGE(0.0, 360.0) * M_PI/180.0;
pointDirection[i][0] = cos(direction);
pointDirection[i][1] = sin(direction);
velocity = MEAN_VELOCITY + RANDOM_RANGE(-0.8, 1.0);
pointVelocity[i][0] = velocity * cos(angle);
pointVelocity[i][1] = velocity * sin(angle);
colorList[i] = rand() % NUM_COLORS;
}
theTime = 0.0;
}
static void
updatePointList(void)
{
float distance;
int i;
static double t0 = -1.;
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
motion = 0;
for (i=0; i<numPoints; i++) {
distance = pointVelocity[i][0] * theTime;
/* X and Z */
pointList[i][0] = pointDirection[i][0] * distance;
pointList[i][2] = pointDirection[i][1] * distance;
/* Z */
pointList[i][1] =
(pointVelocity[i][1] - 0.5 * GRAVITY * pointTime[i])*pointTime[i];
/* If we hit the ground, bounce the point upward again. */
if (pointList[i][1] <= 0.0) {
if (distance > EDGE) {
/* Particle has hit ground past the distance duration of
the particles. Mark particle as dead. */
colorList[i] = NUM_COLORS; /* Not moving. */
continue;
}
pointVelocity[i][1] *= 0.8; /* 80% of previous up velocity. */
pointTime[i] = 0.0; /* Reset the particles sense of up time. */
}
motion = 1;
pointTime[i] += dt;
}
theTime += dt;
if (!motion && !spin) {
if (repeat) {
makePointList();
} else {
glutIdleFunc(NULL);
}
}
}
static void
idle(void)
{
updatePointList();
if (spin) {
angle += 0.3;
}
glutPostRedisplay();
}
static void
visible(int vis)
{
if (vis == GLUT_VISIBLE) {
if (animate && (motion || spin)) {
glutIdleFunc(idle);
}
} else {
glutIdleFunc(NULL);
}
}
static void
redraw(void)
{
int i;
glDepthMask(GL_TRUE);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(15.0, 1.0, 0.0, 0.0);
glRotatef(angle, 0.0, 1.0, 0.0);
/* Draw the floor. */
/* glEnable(GL_TEXTURE_2D);*/
glColor3f(0.1, 0.5, 1.0);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0);
glVertex3f(-EDGE, -0.05, -EDGE);
glTexCoord2f(20.0, 0.0);
glVertex3f(EDGE, -0.05, -EDGE);
glTexCoord2f(20.0, 20.0);
glVertex3f(EDGE, -0.05, EDGE);
glTexCoord2f(0.0, 20.0);
glVertex3f(-EDGE, -0.05, EDGE);
glEnd();
/* Allow particles to blend with each other. */
glDepthMask(GL_FALSE);
if (blend)
glEnable(GL_BLEND);
if (sprite) {
glEnable(GL_TEXTURE_2D);
#ifdef GL_ARB_point_sprite
glEnable(GL_POINT_SPRITE_ARB);
#endif
}
glColor3f(1,1,1);
glBegin(GL_POINTS);
for (i=0; i<numPoints; i++) {
/* Draw alive particles. */
if (colorList[i] != DEAD) {
if (!sprite) glColor4fv(colorSet[colorList[i]]);
glVertex3fv(pointList[i]);
}
}
glEnd();
glDisable(GL_TEXTURE_2D);
#ifdef GL_ARB_point_sprite
glDisable(GL_POINT_SPRITE_ARB);
#endif
glDisable(GL_BLEND);
glPopMatrix();
glutSwapBuffers();
}
/* ARGSUSED2 */
static void
mouse(int button, int state, int x, int y)
{
/* Scene can be spun around Y axis using left
mouse button movement. */
if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) {
moving = 1;
begin = x;
}
if (button == GLUT_LEFT_BUTTON && state == GLUT_UP) {
moving = 0;
}
}
/* ARGSUSED1 */
static void
mouseMotion(int x, int y)
{
if (moving) {
angle = angle + (x - begin);
begin = x;
glutPostRedisplay();
}
}
static void
menu(int option)
{
switch (option) {
case 0:
makePointList();
break;
#ifdef GL_ARB_point_parameters
case 1:
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, constant);
break;
case 2:
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, linear);
break;
case 3:
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
break;
#endif
case 4:
blend = 1;
break;
case 5:
blend = 0;
break;
#ifdef GL_ARB_point_parameters
case 6:
glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 1.0);
break;
case 7:
glPointParameterfARB(GL_POINT_FADE_THRESHOLD_SIZE_ARB, 10.0);
break;
#endif
case 8:
glEnable(GL_POINT_SMOOTH);
smooth = 1;
break;
case 9:
glDisable(GL_POINT_SMOOTH);
smooth = 0;
break;
case 10:
glPointSize(16.0);
break;
case 11:
glPointSize(32.0);
break;
case 12:
glPointSize(64.0);
break;
case 13:
spin = 1 - spin;
if (animate && (spin || motion)) {
glutIdleFunc(idle);
} else {
glutIdleFunc(NULL);
}
break;
case 14:
numPoints = 200;
break;
case 15:
numPoints = 500;
break;
case 16:
numPoints = 1000;
break;
case 17:
numPoints = 2000;
break;
case 666:
exit(0);
}
glutPostRedisplay();
}
/* ARGSUSED1 */
static void
key(unsigned char c, int x, int y)
{
switch (c) {
case 13:
animate = 1 - animate; /* toggle. */
if (animate && (motion || spin)) {
glutIdleFunc(idle);
} else {
glutIdleFunc(NULL);
}
break;
case ' ':
animate = 1;
makePointList();
glutIdleFunc(idle);
break;
case 'o':
case 'O':
org ^= 1;
#ifdef GL_VERSION_2_0
#ifdef GL_ARB_point_parameters
glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN,
org ? GL_LOWER_LEFT : GL_UPPER_LEFT);
#endif
#endif
glutPostRedisplay();
break;
case 't':
case 'T':
sprite ^= 1;
glutPostRedisplay();
break;
case 's':
case 'S':
(smooth ^= 1) ? glEnable(GL_POINT_SMOOTH) : glDisable(GL_POINT_SMOOTH);
glutPostRedisplay();
break;
case '0':
glPointSize(1.0);
glutPostRedisplay();
break;
case '1':
glPointSize(16.0);
glutPostRedisplay();
break;
case '2':
glPointSize(32.0);
glutPostRedisplay();
break;
case '3':
glPointSize(64.0);
glutPostRedisplay();
break;
case '4':
glPointSize(128.0);
glutPostRedisplay();
break;
case 27:
exit(0);
}
}
static void
makeSprite(void)
{
GLubyte texture[16][16][4];
int i, j;
if (!glutExtensionSupported("GL_ARB_point_sprite")) {
printf("Sorry, this demo requires GL_ARB_point_sprite.\n");
exit(0);
}
if (!glutExtensionSupported("GL_ARB_point_parameters")) {
printf("Sorry, this demo requires GL_ARB_point_parameters.\n");
exit(0);
}
for (i = 0; i < 16; i++) {
for (j = 0; j < 16; j++) {
if (spritePattern[i][j]) {
texture[i][j][0] = 255;
texture[i][j][1] = 255;
texture[i][j][2] = 255;
texture[i][j][3] = 255;
}
else {
texture[i][j][0] = 255;
texture[i][j][1] = 0;
texture[i][j][2] = 0;
texture[i][j][3] = 0;
}
}
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE,
texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
#ifdef GL_ARB_point_sprite
glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);
#endif
}
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, 2.0, 30.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -10.0);
}
int
main(int argc, char **argv)
{
int i;
glutInitWindowSize(600,300);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_MULTISAMPLE);
for (i=1; i<argc; i++) {
if(!strcmp("-noms", argv[i])) {
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
printf("forcing no multisampling\n");
} else if(!strcmp("-nomipmaps", argv[i])) {
useMipmaps = 0;
} else if(!strcmp("-nearest", argv[i])) {
linearFiltering = 0;
}
}
glutCreateWindow("sprite blast");
glewInit();
glutReshapeFunc(reshape);
glutDisplayFunc(redraw);
glutMouseFunc(mouse);
glutMotionFunc(mouseMotion);
glutVisibilityFunc(visible);
glutKeyboardFunc(key);
glutCreateMenu(menu);
glutAddMenuEntry("Reset time", 0);
glutAddMenuEntry("Constant", 1);
glutAddMenuEntry("Linear", 2);
glutAddMenuEntry("Quadratic", 3);
glutAddMenuEntry("Blend on", 4);
glutAddMenuEntry("Blend off", 5);
glutAddMenuEntry("Threshold 1", 6);
glutAddMenuEntry("Threshold 10", 7);
glutAddMenuEntry("Point smooth on", 8);
glutAddMenuEntry("Point smooth off", 9);
glutAddMenuEntry("Point size 16", 10);
glutAddMenuEntry("Point size 32", 11);
glutAddMenuEntry("Point size 64", 12);
glutAddMenuEntry("Toggle spin", 13);
glutAddMenuEntry("200 points ", 14);
glutAddMenuEntry("500 points ", 15);
glutAddMenuEntry("1000 points ", 16);
glutAddMenuEntry("2000 points ", 17);
glutAddMenuEntry("Quit", 666);
glutAttachMenu(GLUT_RIGHT_BUTTON);
makePointList();
makeSprite();
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST);
glEnable(GL_POINT_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPointSize(32.0);
#ifdef GL_ARB_point_parameters
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
#endif
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}
-687
View File
@@ -1,687 +0,0 @@
/*-----------------------------
* stex3d.c GL example of the mesa 3d-texture extention to simulate procedural
* texturing, it uses a perlin noise and turbulence functions.
*
* Author: Daniel Barrero
* barrero@irit.fr
* dbarrero@pegasus.uniandes.edu.co
*
* Converted to GLUT by brianp on 1/1/98
* Massive clean-up on 2002/10/23 by brianp
*
*
* cc stex3d.c -o stex3d -lglut -lMesaGLU -lMesaGL -lX11 -lXext -lm
*
*---------------------------- */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <GL/glew.h>
#include <GL/glut.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#define NOISE_TEXTURE 1
#define GRADIENT_TEXTURE 2
#define TORUS 1
#define SPHERE 2
static int tex_width=64, tex_height=64, tex_depth=64;
static float angx=0, angy=0, angz=0;
static int texgen = 2, animate = 1, smooth = 1, wireframe = 0;
static int CurTexture = NOISE_TEXTURE, CurObject = TORUS;
static GLenum Filter = GL_LINEAR;
static void
BuildTorus(void)
{
GLint i, j;
float theta1, phi1, theta2, phi2, rings, sides;
float v0[03], v1[3], v2[3], v3[3];
float t0[03], t1[3], t2[3], t3[3];
float n0[3], n1[3], n2[3], n3[3];
float innerRadius = 0.25;
float outerRadius = 0.5;
float scalFac;
rings = 16;
sides = 12;
scalFac = 1 / (outerRadius * 2);
glNewList(TORUS, GL_COMPILE);
for (i = 0; i < rings; i++) {
theta1 = (float) i *2.0 * M_PI / rings;
theta2 = (float) (i + 1) * 2.0 * M_PI / rings;
for (j = 0; j < sides; j++) {
phi1 = (float) j *2.0 * M_PI / sides;
phi2 = (float) (j + 1) * 2.0 * M_PI / sides;
v0[0] = cos(theta1) * (outerRadius + innerRadius * cos(phi1));
v0[1] = -sin(theta1) * (outerRadius + innerRadius * cos(phi1));
v0[2] = innerRadius * sin(phi1);
v1[0] = cos(theta2) * (outerRadius + innerRadius * cos(phi1));
v1[1] = -sin(theta2) * (outerRadius + innerRadius * cos(phi1));
v1[2] = innerRadius * sin(phi1);
v2[0] = cos(theta2) * (outerRadius + innerRadius * cos(phi2));
v2[1] = -sin(theta2) * (outerRadius + innerRadius * cos(phi2));
v2[2] = innerRadius * sin(phi2);
v3[0] = cos(theta1) * (outerRadius + innerRadius * cos(phi2));
v3[1] = -sin(theta1) * (outerRadius + innerRadius * cos(phi2));
v3[2] = innerRadius * sin(phi2);
n0[0] = cos(theta1) * (cos(phi1));
n0[1] = -sin(theta1) * (cos(phi1));
n0[2] = sin(phi1);
n1[0] = cos(theta2) * (cos(phi1));
n1[1] = -sin(theta2) * (cos(phi1));
n1[2] = sin(phi1);
n2[0] = cos(theta2) * (cos(phi2));
n2[1] = -sin(theta2) * (cos(phi2));
n2[2] = sin(phi2);
n3[0] = cos(theta1) * (cos(phi2));
n3[1] = -sin(theta1) * (cos(phi2));
n3[2] = sin(phi2);
t0[0] = v0[0] * scalFac + 0.5;
t0[1] = v0[1] * scalFac + 0.5;
t0[2] = v0[2] * scalFac + 0.5;
t1[0] = v1[0] * scalFac + 0.5;
t1[1] = v1[1] * scalFac + 0.5;
t1[2] = v1[2] * scalFac + 0.5;
t2[0] = v2[0] * scalFac + 0.5;
t2[1] = v2[1] * scalFac + 0.5;
t2[2] = v2[2] * scalFac + 0.5;
t3[0] = v3[0] * scalFac + 0.5;
t3[1] = v3[1] * scalFac + 0.5;
t3[2] = v3[2] * scalFac + 0.5;
glBegin(GL_POLYGON);
glNormal3fv(n3);
glTexCoord3fv(t3);
glVertex3fv(v3);
glNormal3fv(n2);
glTexCoord3fv(t2);
glVertex3fv(v2);
glNormal3fv(n1);
glTexCoord3fv(t1);
glVertex3fv(v1);
glNormal3fv(n0);
glTexCoord3fv(t0);
glVertex3fv(v0);
glEnd();
}
}
glEndList();
}
/*--------------------------------------------------------------------
noise function over R3 - implemented by a pseudorandom tricubic spline
EXCERPTED FROM SIGGRAPH 92, COURSE 23
PROCEDURAL MODELING
Ken Perlin
New York University
----------------------------------------------------------------------*/
#define DOT(a,b) (a[0] * b[0] + a[1] * b[1] + a[2] * b[2])
#define B 128
static int p[B + B + 2];
static float g[B + B + 2][3];
#define setup(i,b0,b1,r0,r1) \
t = vec[i] + 10000.; \
b0 = ((int)t) & (B-1); \
b1 = (b0+1) & (B-1); \
r0 = t - (int)t; \
r1 = r0 - 1.;
static float
noise3(float vec[3])
{
int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
float rx0, rx1, ry0, ry1, rz0, rz1, *q, sx, sy, sz, a, b, c, d, t, u, v;
register int i, j;
setup(0, bx0, bx1, rx0, rx1);
setup(1, by0, by1, ry0, ry1);
setup(2, bz0, bz1, rz0, rz1);
i = p[bx0];
j = p[bx1];
b00 = p[i + by0];
b10 = p[j + by0];
b01 = p[i + by1];
b11 = p[j + by1];
#define at(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] )
#define surve(t) ( t * t * (3. - 2. * t) )
#define lerp(t, a, b) ( a + t * (b - a) )
sx = surve(rx0);
sy = surve(ry0);
sz = surve(rz0);
q = g[b00 + bz0];
u = at(rx0, ry0, rz0);
q = g[b10 + bz0];
v = at(rx1, ry0, rz0);
a = lerp(sx, u, v);
q = g[b01 + bz0];
u = at(rx0, ry1, rz0);
q = g[b11 + bz0];
v = at(rx1, ry1, rz0);
b = lerp(sx, u, v);
c = lerp(sy, a, b); /* interpolate in y at lo x */
q = g[b00 + bz1];
u = at(rx0, ry0, rz1);
q = g[b10 + bz1];
v = at(rx1, ry0, rz1);
a = lerp(sx, u, v);
q = g[b01 + bz1];
u = at(rx0, ry1, rz1);
q = g[b11 + bz1];
v = at(rx1, ry1, rz1);
b = lerp(sx, u, v);
d = lerp(sy, a, b); /* interpolate in y at hi x */
return 1.5 * lerp(sz, c, d); /* interpolate in z */
}
static void
initNoise(void)
{
/*long random(); */
int i, j, k;
float v[3], s;
/* Create an array of random gradient vectors uniformly on the unit sphere */
/*srandom(1); */
srand(1);
for (i = 0; i < B; i++) {
do { /* Choose uniformly in a cube */
for (j = 0; j < 3; j++)
v[j] = (float) ((rand() % (B + B)) - B) / B;
s = DOT(v, v);
} while (s > 1.0); /* If not in sphere try again */
s = sqrt(s);
for (j = 0; j < 3; j++) /* Else normalize */
g[i][j] = v[j] / s;
}
/* Create a pseudorandom permutation of [1..B] */
for (i = 0; i < B; i++)
p[i] = i;
for (i = B; i > 0; i -= 2) {
k = p[i];
p[i] = p[j = rand() % B];
p[j] = k;
}
/* Extend g and p arrays to allow for faster indexing */
for (i = 0; i < B + 2; i++) {
p[B + i] = p[i];
for (j = 0; j < 3; j++)
g[B + i][j] = g[i][j];
}
}
static float
turbulence(float point[3], float lofreq, float hifreq)
{
float freq, t, p[3];
p[0] = point[0] + 123.456;
p[1] = point[1];
p[2] = point[2];
t = 0;
for (freq = lofreq; freq < hifreq; freq *= 2.) {
t += fabs(noise3(p)) / freq;
p[0] *= 2.;
p[1] *= 2.;
p[2] *= 2.;
}
return t - 0.3; /* readjust to make mean value = 0.0 */
}
static void
create3Dtexture(void)
{
unsigned char *voxels = NULL;
int i, j, k;
unsigned char *vp;
float vec[3];
int tmp;
printf("creating 3d textures...\n");
voxels =
(unsigned char *)
malloc((size_t) (4 * tex_width * tex_height * tex_depth));
vp = voxels;
for (i = 0; i < tex_width; i++) {
vec[0] = i;
for (j = 0; j < tex_height; j++) {
vec[1] = j;
for (k = 0; k < tex_depth; k++) {
vec[2] = k;
tmp = (sin(k * i * j + turbulence(vec, 0.01, 1)) + 1) * 127.5;
*vp++ = 0;
*vp++ = 0;
*vp++ = tmp;
*vp++ = tmp + 128;
}
}
}
printf("setting up 3d texture...\n");
glBindTexture(GL_TEXTURE_3D, NOISE_TEXTURE);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA,
tex_width, tex_height, tex_depth,
0, GL_RGBA, GL_UNSIGNED_BYTE, voxels);
free(voxels);
printf("finished setting up 3d texture image.\n");
}
static void
printHelp(void)
{
printf("\nUsage: stex3d <cmd line options>\n");
printf(" cmd line options:\n");
printf(" -wxxx Width of the texture (Default=64)\n");
printf(" -hxxx Height of the texture (Default=64)\n");
printf(" -dxxx Depth of the texture (Default=64)\n");
printf(" Keyboard Options:\n");
printf(" up/down rotate around X\n");
printf(" left/right rotate around Y\n");
printf(" z/Z rotate around Z\n");
printf(" a toggle animation\n");
printf(" s toggle smooth shading\n");
printf(" t toggle texgen mode\n");
printf(" o toggle object: torus/sphere\n");
printf(" i toggle texture image: noise/gradient\n");
}
static GLenum
parseCmdLine(int argc, char **argv)
{
GLint i;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-help") == 0) {
printHelp();
return GL_FALSE;
}
else if (strstr(argv[i], "-w") != NULL) {
tex_width = atoi((argv[i]) + 2);
}
else if (strstr(argv[i], "-h") != NULL) {
tex_height = atoi((argv[i]) + 2);
}
else if (strstr(argv[i], "-d") != NULL) {
tex_depth = atoi((argv[i]) + 2);
}
else {
printf("%s (Bad option).\n", argv[i]);
printHelp();
return GL_FALSE;
}
}
if (tex_width == 0 || tex_height == 0 || tex_depth == 0) {
printf("%s (Bad option).\n", "size parameters can't be 0");
printHelp();
return GL_FALSE;
}
return GL_TRUE;
}
static void
drawScene(void)
{
static const GLfloat sPlane[4] = { 0.5, 0, 0, -.5 };
static const GLfloat tPlane[4] = { 0, 0.5, 0, -.5 };
static const GLfloat rPlane[4] = { 0, 0, 0.5, -.5 };
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
if (texgen == 2) {
glTexGenfv(GL_S, GL_EYE_PLANE, sPlane);
glTexGenfv(GL_T, GL_EYE_PLANE, tPlane);
glTexGenfv(GL_R, GL_EYE_PLANE, rPlane);
}
glRotatef(angx, 1.0, 0.0, 0.0);
glRotatef(angy, 0.0, 1.0, 0.0);
glRotatef(angz, 0.0, 0.0, 1.0);
if (texgen == 1) {
glTexGenfv(GL_S, GL_EYE_PLANE, sPlane);
glTexGenfv(GL_T, GL_EYE_PLANE, tPlane);
glTexGenfv(GL_R, GL_EYE_PLANE, rPlane);
}
if (texgen) {
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);
}
else {
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_GEN_R);
}
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, Filter);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, Filter);
glCallList(CurObject);
glPopMatrix();
glutSwapBuffers();
}
static void
resize(int w, int h)
{
float ar = (float) w / (float) h;
float ax = 0.6 * ar;
float ay = 0.6;
glViewport(0, 0, (GLint) w, (GLint) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-ax, ax, -ay, ay, 2, 20);
/*glOrtho(-2, 2, -2, 2, -10, 10);*/
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, -4);
}
static void
Idle(void)
{
float t = glutGet(GLUT_ELAPSED_TIME);
angx = 0.01 * t;
angy = 0.03 * t;
angz += 0;
glutPostRedisplay();
}
static void
SpecialKey(int k, int x, int y)
{
switch (k) {
case GLUT_KEY_UP:
angx += 5.0;
break;
case GLUT_KEY_DOWN:
angx -= 5.0;
break;
case GLUT_KEY_LEFT:
angy += 5.0;
break;
case GLUT_KEY_RIGHT:
angy -= 5.0;
break;
default:
return;
}
glutPostRedisplay();
}
static void
KeyHandler(unsigned char key, int x, int y)
{
static const char *mode[] = {
"glTexCoord3f (no texgen)",
"texgen fixed to object coords",
"texgen fixed to eye coords"
};
(void) x;
(void) y;
switch (key) {
case 27:
case 'q':
case 'Q': /* quit game. */
exit(0);
break;
case 'z':
angz += 10;
break;
case 'Z':
angz -= 10;
break;
case 's':
smooth = !smooth;
if (smooth)
glShadeModel(GL_SMOOTH);
else
glShadeModel(GL_FLAT);
break;
case 't':
texgen++;
if (texgen > 2)
texgen = 0;
printf("Texgen: %s\n", mode[texgen]);
break;
case 'o':
if (CurObject == TORUS)
CurObject = SPHERE;
else
CurObject = TORUS;
break;
case 'f':
if (Filter == GL_LINEAR)
Filter = GL_NEAREST;
else
Filter = GL_LINEAR;
break;
case 'i':
if (CurTexture == NOISE_TEXTURE)
CurTexture = GRADIENT_TEXTURE;
else
CurTexture = NOISE_TEXTURE;
glBindTexture(GL_TEXTURE_3D, CurTexture);
break;
case 'a':
case ' ':
animate = !animate;
if (animate)
glutIdleFunc(Idle);
else
glutIdleFunc(NULL);
break;
case 'w':
wireframe = !wireframe;
if (wireframe)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
else
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
break;
default:
break;
}
glutPostRedisplay();
}
static void
create3Dgradient(void)
{
unsigned char *v;
int i, j, k;
unsigned char *voxels = NULL;
voxels = (unsigned char *) malloc(4 * tex_width * tex_height * tex_depth);
v = voxels;
for (i = 0; i < tex_depth; i++) {
for (j = 0; j < tex_height; j++) {
for (k = 0; k < tex_width; k++) {
GLint r = (255 * i) / (tex_depth - 1);
GLint g = (255 * j) / (tex_height - 1);
GLint b = (255 * k) / (tex_width - 1);
*v++ = r;
*v++ = g;
*v++ = b;
*v++ = 255;
}
}
}
glBindTexture(GL_TEXTURE_3D, GRADIENT_TEXTURE);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA,
tex_width, tex_height, tex_depth,
0, GL_RGBA, GL_UNSIGNED_BYTE, voxels);
free(voxels);
}
static void
init(void)
{
static const GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
static const GLfloat mat_shininess[] = { 25.0 };
static const GLfloat gray[] = { 0.6, 0.6, 0.6, 0.0 };
static const GLfloat white[] = { 1.0, 1.0, 1.0, 0.0 };
static const GLfloat light_position[] = { 0.0, 1.0, 1.0, 0.0 };
int max;
/* see if we have OpenGL 1.2 or later, for 3D texturing */
{
const char *version = (const char *) glGetString(GL_VERSION);
if (strncmp(version, "1.0", 3) == 0 || strncmp(version, "1.1", 3) == 0) {
printf("Sorry, OpenGL 1.2 or later is required\n");
exit(1);
}
}
printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &max);
printf("GL_MAX_3D_TEXTURE_SIZE: %d\n", max);
printf("Current 3D texture size: %d x %d x %d\n",
tex_width, tex_height, tex_depth);
/* init light */
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
glLightfv(GL_LIGHT1, GL_POSITION, light_position);
glLightfv(GL_LIGHT1, GL_AMBIENT, gray);
glLightfv(GL_LIGHT1, GL_DIFFUSE, white);
glLightfv(GL_LIGHT1, GL_SPECULAR, white);
glColorMaterial(GL_FRONT, GL_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT1);
glClearColor(.5, .5, .5, 0);
{
GLUquadricObj *q;
q = gluNewQuadric();
gluQuadricTexture( q, GL_TRUE );
glNewList(SPHERE, GL_COMPILE);
gluSphere( q, 0.95, 30, 15 );
glEndList();
gluDeleteQuadric(q);
}
BuildTorus();
create3Dgradient();
initNoise();
create3Dtexture();
glEnable(GL_TEXTURE_3D);
/*
glBlendFunc(GL_SRC_COLOR, GL_SRC_ALPHA);
glEnable(GL_BLEND);
*/
glEnable(GL_DEPTH_TEST);
glColor3f(0.6, 0.7, 0.8);
}
int
main(int argc, char **argv)
{
glutInit(&argc, argv);
if (parseCmdLine(argc, argv) == GL_FALSE) {
exit(0);
}
glutInitWindowPosition(0, 0);
glutInitWindowSize(400, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
if (glutCreateWindow("stex3d") <= 0) {
exit(0);
}
glewInit();
init();
printHelp();
glutReshapeFunc(resize);
glutKeyboardFunc(KeyHandler);
glutSpecialFunc(SpecialKey);
glutDisplayFunc(drawScene);
if (animate)
glutIdleFunc(Idle);
glutMainLoop();
return 0;
}
-685
View File
@@ -1,685 +0,0 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (tech.hmw@plus.it)
* Humanware s.r.l.
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#ifdef WIN32
#include <windows.h>
#endif
#include <GL/glut.h>
#include "readtex.h"
#ifdef XMESA
#include "GL/xmesa.h"
static int fullscreen=1;
#endif
static int WIDTH=640;
static int HEIGHT=480;
static GLint T0 = 0;
static GLint Frames = 0;
#define BASESIZE 10.0
#define BASERES 12
#define TEAPOTRES 3
#ifndef M_PI
#define M_PI 3.1415926535
#endif
extern void shadowmatrix(GLfloat [4][4], GLfloat [4], GLfloat [4]);
extern void findplane(GLfloat [4], GLfloat [3], GLfloat [3], GLfloat [3]);
static int win=0;
static float obs[3]={5.0,0.0,1.0};
static float dir[3];
static float v=0.0;
static float alpha=-90.0;
static float beta=90.0;
static GLfloat baseshadow[4][4];
static GLfloat lightpos[4]={2.3,0.0,3.0,1.0};
static GLfloat lightdir[3]={-2.3,0.0,-3.0};
static GLfloat lightalpha=0.0;
static int fog=1;
static int bfcull=1;
static int usetex=1;
static int help=1;
static int joyavailable=0;
static int joyactive=0;
static GLuint t1id,t2id;
static GLuint teapotdlist,basedlist,lightdlist;
/******************** begin shadow code ********************/
/* Taken from the projshadow.c - by Tom McReynolds, SGI */
/* Modified by David Bucciarelli */
enum {
X, Y, Z, W
};
enum {
A, B, C, D
};
/* create a matrix that will project the desired shadow */
void
shadowmatrix(GLfloat shadowMat[4][4],
GLfloat groundplane[4],
GLfloat lightpos[4])
{
GLfloat dot;
/* find dot product between light position vector and ground plane normal */
dot = groundplane[X] * lightpos[X] +
groundplane[Y] * lightpos[Y] +
groundplane[Z] * lightpos[Z] +
groundplane[W] * lightpos[W];
shadowMat[0][0] = dot - lightpos[X] * groundplane[X];
shadowMat[1][0] = 0.f - lightpos[X] * groundplane[Y];
shadowMat[2][0] = 0.f - lightpos[X] * groundplane[Z];
shadowMat[3][0] = 0.f - lightpos[X] * groundplane[W];
shadowMat[X][1] = 0.f - lightpos[Y] * groundplane[X];
shadowMat[1][1] = dot - lightpos[Y] * groundplane[Y];
shadowMat[2][1] = 0.f - lightpos[Y] * groundplane[Z];
shadowMat[3][1] = 0.f - lightpos[Y] * groundplane[W];
shadowMat[X][2] = 0.f - lightpos[Z] * groundplane[X];
shadowMat[1][2] = 0.f - lightpos[Z] * groundplane[Y];
shadowMat[2][2] = dot - lightpos[Z] * groundplane[Z];
shadowMat[3][2] = 0.f - lightpos[Z] * groundplane[W];
shadowMat[X][3] = 0.f - lightpos[W] * groundplane[X];
shadowMat[1][3] = 0.f - lightpos[W] * groundplane[Y];
shadowMat[2][3] = 0.f - lightpos[W] * groundplane[Z];
shadowMat[3][3] = dot - lightpos[W] * groundplane[W];
}
/* find the plane equation given 3 points */
void
findplane(GLfloat plane[4],
GLfloat v0[3], GLfloat v1[3], GLfloat v2[3])
{
GLfloat vec0[3], vec1[3];
/* need 2 vectors to find cross product */
vec0[X] = v1[X] - v0[X];
vec0[Y] = v1[Y] - v0[Y];
vec0[Z] = v1[Z] - v0[Z];
vec1[X] = v2[X] - v0[X];
vec1[Y] = v2[Y] - v0[Y];
vec1[Z] = v2[Z] - v0[Z];
/* find cross product to get A, B, and C of plane equation */
plane[A] = vec0[Y] * vec1[Z] - vec0[Z] * vec1[Y];
plane[B] = -(vec0[X] * vec1[Z] - vec0[Z] * vec1[X]);
plane[C] = vec0[X] * vec1[Y] - vec0[Y] * vec1[X];
plane[D] = -(plane[A] * v0[X] + plane[B] * v0[Y] + plane[C] * v0[Z]);
}
/******************** end shadow code ********************/
static void calcposobs(void)
{
dir[0]=sin(alpha*M_PI/180.0);
dir[1]=cos(alpha*M_PI/180.0)*sin(beta*M_PI/180.0);
dir[2]=cos(beta*M_PI/180.0);
obs[0]+=v*dir[0];
obs[1]+=v*dir[1];
obs[2]+=v*dir[2];
}
static void special(int k, int x, int y)
{
switch(k) {
case GLUT_KEY_LEFT:
alpha-=2.0;
break;
case GLUT_KEY_RIGHT:
alpha+=2.0;
break;
case GLUT_KEY_DOWN:
beta-=2.0;
break;
case GLUT_KEY_UP:
beta+=2.0;
break;
}
}
static void cleanup(void)
{
glDeleteTextures(1, &t1id);
glDeleteTextures(1, &t2id);
glDeleteLists(teapotdlist, 1);
glDeleteLists(basedlist, 1);
glDeleteLists(lightdlist, 1);
}
static void key(unsigned char k, int x, int y)
{
switch(k) {
case 27:
cleanup();
exit(0);
break;
case 'a':
v+=0.005;
break;
case 'z':
v-=0.005;
break;
case 'j':
joyactive=(!joyactive);
break;
case 'h':
help=(!help);
break;
case 'f':
fog=(!fog);
break;
case 't':
usetex=(!usetex);
break;
case 'b':
if(bfcull) {
glDisable(GL_CULL_FACE);
bfcull=0;
} else {
glEnable(GL_CULL_FACE);
bfcull=1;
}
break;
#ifdef XMESA
case ' ':
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
fullscreen=(!fullscreen);
break;
#endif
}
}
static void reshape(int w, int h)
{
WIDTH=w;
HEIGHT=h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0,w/(float)h,0.2,40.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0,0,w,h);
}
static void printstring(void *font, char *string)
{
int len,i;
len=(int)strlen(string);
for(i=0;i<len;i++)
glutBitmapCharacter(font,string[i]);
}
static void printhelp(void)
{
glEnable(GL_BLEND);
glColor4f(0.5,0.5,0.5,0.5);
glRecti(40,40,600,440);
glDisable(GL_BLEND);
glColor3f(1.0,0.0,0.0);
glRasterPos2i(300,420);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Help");
glRasterPos2i(60,390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"h - Toggle Help");
glRasterPos2i(60,360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"t - Toggle Textures");
glRasterPos2i(60,330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"f - Toggle Fog");
glRasterPos2i(60,300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"b - Toggle Back face culling");
glRasterPos2i(60,270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"Arrow Keys - Rotate");
glRasterPos2i(60,240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"a - Increase velocity");
glRasterPos2i(60,210);
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"z - Decrease velocity");
glRasterPos2i(60,180);
if(joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"j - Toggle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"(No Joystick control available)");
}
static void drawbase(void)
{
static const GLfloat amb[4] = { 1, .5, 0.2, 1 };
static const GLfloat diff[4] = { 1, .4, 0.2, 1 };
int i,j;
float x,y,dx,dy;
glBindTexture(GL_TEXTURE_2D,t1id);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, amb);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diff);
dx=BASESIZE/BASERES;
dy=-BASESIZE/BASERES;
for(y=BASESIZE/2.0,j=0;j<BASERES;y+=dy,j++) {
glBegin(GL_QUAD_STRIP);
glColor3f(1.0,1.0,1.0);
glNormal3f(0.0,0.0,1.0);
for(x=-BASESIZE/2.0,i=0;i<BASERES;x+=dx,i++) {
glTexCoord2f(x,y);
glVertex3f(x,y,0.0);
glTexCoord2f(x,y+dy);
glVertex3f(x,y+dy,0.0);
}
glEnd();
}
}
static void drawteapot(void)
{
static const GLfloat amb[4] = { 0.2, 0.2, 0.2, 1 };
static const GLfloat diff[4] = { 0.8, 0.3, 0.5, 1 };
static float xrot=0.0;
static float zrot=0.0;
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, amb);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diff);
glPushMatrix();
glRotatef(lightalpha,0.0,0.0,1.0);
glMultMatrixf((GLfloat *)baseshadow);
glRotatef(-lightalpha,0.0,0.0,1.0);
glTranslatef(0.0,0.0,1.0);
glRotatef(xrot,1.0,0.0,0.0);
glRotatef(zrot,0.0,0.0,1.0);
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glColor3f(0.0,0.0,0.0);
glCallList(teapotdlist);
glEnable(GL_DEPTH_TEST);
glEnable(GL_LIGHTING);
if(usetex)
glEnable(GL_TEXTURE_2D);
glPopMatrix();
glPushMatrix();
glTranslatef(0.0,0.0,1.0);
glRotatef(xrot,1.0,0.0,0.0);
glRotatef(zrot,0.0,0.0,1.0);
glCallList(teapotdlist);
glPopMatrix();
xrot+=2.0;
zrot+=1.0;
}
static void drawlight1(void)
{
glPushMatrix();
glRotatef(lightalpha,0.0,0.0,1.0);
glLightfv(GL_LIGHT0,GL_POSITION,lightpos);
glLightfv(GL_LIGHT0,GL_SPOT_DIRECTION,lightdir);
glPopMatrix();
}
static void drawlight2(void)
{
glPushMatrix();
glRotatef(lightalpha,0.0,0.0,1.0);
glTranslatef(lightpos[0],lightpos[1],lightpos[2]);
glDisable(GL_TEXTURE_2D);
glCallList(lightdlist);
if(usetex)
glEnable(GL_TEXTURE_2D);
glPopMatrix();
lightalpha+=1.0;
}
static void dojoy(void)
{
#ifdef WIN32
static UINT max[2]={0,0};
static UINT min[2]={0xffffffff,0xffffffff},center[2];
MMRESULT res;
JOYINFO joy;
res=joyGetPos(JOYSTICKID1,&joy);
if(res==JOYERR_NOERROR) {
joyavailable=1;
if(max[0]<joy.wXpos)
max[0]=joy.wXpos;
if(min[0]>joy.wXpos)
min[0]=joy.wXpos;
center[0]=(max[0]+min[0])/2;
if(max[1]<joy.wYpos)
max[1]=joy.wYpos;
if(min[1]>joy.wYpos)
min[1]=joy.wYpos;
center[1]=(max[1]+min[1])/2;
if(joyactive) {
if(fabs(center[0]-(float)joy.wXpos)>0.1*(max[0]-min[0]))
alpha-=2.5*(center[0]-(float)joy.wXpos)/(max[0]-min[0]);
if(fabs(center[1]-(float)joy.wYpos)>0.1*(max[1]-min[1]))
beta+=2.5*(center[1]-(float)joy.wYpos)/(max[1]-min[1]);
if(joy.wButtons & JOY_BUTTON1)
v+=0.005;
if(joy.wButtons & JOY_BUTTON2)
v-=0.005;
}
} else
joyavailable=0;
#endif
}
static void draw(void)
{
static char frbuf[80] = "";
dojoy();
glEnable(GL_DEPTH_TEST);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
if(usetex)
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
if(fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glEnable(GL_LIGHTING);
glShadeModel(GL_SMOOTH);
glPushMatrix();
calcposobs();
gluLookAt(obs[0],obs[1],obs[2],
obs[0]+dir[0],obs[1]+dir[1],obs[2]+dir[2],
0.0,0.0,1.0);
drawlight1();
glCallList(basedlist);
drawteapot();
drawlight2();
glPopMatrix();
glDisable(GL_LIGHTING);
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_FOG);
glShadeModel(GL_FLAT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5,639.5,-0.5,479.5,-1.0,1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0,0.0,0.0);
glRasterPos2i(10,10);
printstring(GLUT_BITMAP_HELVETICA_18,frbuf);
glRasterPos2i(350,470);
printstring(GLUT_BITMAP_HELVETICA_10,"Teapot V1.2 Written by David Bucciarelli (tech.hmw@plus.it)");
if(help)
printhelp();
reshape(WIDTH,HEIGHT);
glutSwapBuffers();
Frames++;
{
GLint t = glutGet(GLUT_ELAPSED_TIME);
if (t - T0 >= 2000) {
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
sprintf(frbuf, "Frame rate: %f", fps);
T0 = t;
Frames = 0;
}
}
}
static void inittextures(void)
{
glGenTextures(1,&t1id);
glBindTexture(GL_TEXTURE_2D,t1id);
glPixelStorei(GL_UNPACK_ALIGNMENT,4);
if (!LoadRGBMipmaps("../images/tile.rgb", GL_RGB)) {
fprintf(stderr,"Error reading a texture.\n");
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
glGenTextures(1,&t2id);
glBindTexture(GL_TEXTURE_2D,t2id);
glPixelTransferf(GL_RED_SCALE, 0.75);
glPixelTransferf(GL_RED_BIAS, 0.25);
glPixelTransferf(GL_GREEN_SCALE, 0.75);
glPixelTransferf(GL_GREEN_BIAS, 0.25);
glPixelTransferf(GL_BLUE_SCALE, 0.75);
glPixelTransferf(GL_BLUE_BIAS, 0.25);
if (!LoadRGBMipmaps("../images/bw.rgb", GL_RGB)) {
fprintf(stderr,"Error reading a texture.\n");
exit(-1);
}
glPixelTransferf(GL_RED_SCALE, 1.0);
glPixelTransferf(GL_RED_BIAS, 0.0);
glPixelTransferf(GL_GREEN_SCALE, 1.0);
glPixelTransferf(GL_GREEN_BIAS, 0.0);
glPixelTransferf(GL_BLUE_SCALE, 1.0);
glPixelTransferf(GL_BLUE_BIAS, 0.0);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
}
static void initlight(void)
{
float matamb[4] ={0.5, 0.5, 0.5, 1.0};
float matdiff[4]={0.9, 0.2, 0.2, 1.0};
float matspec[4]={1.0,1.0,1.0,1.0};
float lamb[4] ={1.5, 1.5, 1.5, 1.0};
float ldiff[4]={1.0, 1.0, 1.0, 1.0};
float lspec[4]={1.0, 1.0, 1.0, 1.0};
glLightf(GL_LIGHT0,GL_SPOT_CUTOFF,70.0);
glLightf(GL_LIGHT0,GL_SPOT_EXPONENT,20.0);
glLightfv(GL_LIGHT0,GL_AMBIENT,lamb);
glLightfv(GL_LIGHT0,GL_DIFFUSE,ldiff);
glLightfv(GL_LIGHT0,GL_SPECULAR,lspec);
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 15.0);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, matdiff);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, matspec);
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, matamb);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lamb);
glEnable(GL_LIGHT0);
}
static void initdlists(void)
{
GLUquadricObj *lcone,*lbase;
GLfloat plane[4];
GLfloat v0[3]={0.0,0.0,0.0};
GLfloat v1[3]={1.0,0.0,0.0};
GLfloat v2[3]={0.0,1.0,0.0};
findplane(plane,v0,v1,v2);
shadowmatrix(baseshadow,plane,lightpos);
teapotdlist=glGenLists(1);
glNewList(teapotdlist,GL_COMPILE);
glRotatef(90.0,1.0,0.0,0.0);
glCullFace(GL_FRONT);
glBindTexture(GL_TEXTURE_2D,t2id);
glutSolidTeapot(0.75);
glCullFace(GL_BACK);
glEndList();
basedlist=glGenLists(1);
glNewList(basedlist,GL_COMPILE);
drawbase();
glEndList();
lightdlist=glGenLists(1);
glNewList(lightdlist,GL_COMPILE);
glDisable(GL_LIGHTING);
lcone=gluNewQuadric();
lbase=gluNewQuadric();
glRotatef(45.0,0.0,1.0,0.0);
glColor3f(1.0,1.0,1.0);
glCullFace(GL_FRONT);
gluDisk(lbase,0.0,0.2,12.0,1.0);
glCullFace(GL_BACK);
glColor3f(0.5,0.0,0.0);
gluCylinder(lcone,0.2,0.0,0.5,12,1);
gluDeleteQuadric(lcone);
gluDeleteQuadric(lbase);
glEnable(GL_LIGHTING);
glEndList();
}
int main(int ac, char **av)
{
float fogcolor[4]={0.025,0.025,0.025,1.0};
fprintf(stderr,"Teapot V1.2\nWritten by David Bucciarelli (tech.hmw@plus.it)\n");
/*
if(!SetPriorityClass(GetCurrentProcess(),REALTIME_PRIORITY_CLASS)) {
fprintf(stderr,"Error setting the process class.\n");
return 0;
}
if(!SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL)) {
fprintf(stderr,"Error setting the process priority.\n");
return 0;
}
*/
glutInitWindowSize(WIDTH,HEIGHT);
glutInit(&ac,av);
glutInitDisplayMode(GLUT_RGB|GLUT_DEPTH|GLUT_DOUBLE);
if(!(win=glutCreateWindow("Teapot"))) {
fprintf(stderr,"Error, couldn't open window\n");
return -1;
}
reshape(WIDTH,HEIGHT);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glEnable(GL_FOG);
glFogi(GL_FOG_MODE,GL_EXP2);
glFogfv(GL_FOG_COLOR,fogcolor);
glFogf(GL_FOG_DENSITY,0.04);
glHint(GL_FOG_HINT,GL_NICEST);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
calcposobs();
inittextures();
initlight();
initdlists();
glClearColor(fogcolor[0],fogcolor[1],fogcolor[2],fogcolor[3]);
glutReshapeFunc(reshape);
glutDisplayFunc(draw);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutIdleFunc(draw);
glutMainLoop();
cleanup();
return 0;
}
-658
View File
@@ -1,658 +0,0 @@
/*
* This program is under the GNU GPL.
* Use at your own risk.
*
* written by David Bucciarelli (tech.hmw@plus.it)
* Humanware s.r.l.
*
* based on a Mikael SkiZoWalker's (MoDEL) / France (Skizo@Hol.Fr) demo
*/
#include <assert.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifdef WIN32
#include <windows.h>
#endif
#include <GL/glut.h>
#ifdef XMESA
#include "GL/xmesa.h"
static int fullscreen = 1;
#endif
#ifndef M_PI
#define M_PI 3.14159265
#endif
#define heightMnt 450
#define lenghtXmnt 62
#define lenghtYmnt 62
#define stepXmnt 96.0
#define stepYmnt 96.0
#define WIDTH 640
#define HEIGHT 480
static GLint T0 = 0;
static GLint Frames = 0;
#define TSCALE 4
#define FOV 85
static GLfloat terrain[256 * 256];
static GLfloat terraincolor[256 * 256][3];
static int win = 0;
static int fog = 1;
static int bfcull = 1;
static int usetex = 1;
static int poutline = 0;
static int help = 1;
static int joyavailable = 0;
static int joyactive = 0;
static float ModZMnt;
static long GlobalMnt = 0;
static int scrwidth = WIDTH;
static int scrheight = HEIGHT;
#define OBSSTARTX 992.0
#define OBSSTARTY 103.0
static float obs[3] = { OBSSTARTX, heightMnt * 1.3, OBSSTARTY };
static float dir[3], v1[2], v2[2];
static float v = 900.0;
static float alpha = 75.0;
static float beta = 90.0;
static void
calcposobs(void)
{
float alpha1, alpha2;
static double t0 = -1.;
double dt, t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
if (t0 < 0.0)
t0 = t;
dt = t - t0;
t0 = t;
dir[0] = sin(alpha * M_PI / 180.0);
dir[2] = cos(alpha * M_PI / 180.0) * sin(beta * M_PI / 180.0);
dir[1] = cos(beta * M_PI / 180.0);
if (dir[0] < 1.0e-5 && dir[0] > -1.0e-5)
dir[0] = 0;
if (dir[1] < 1.0e-5 && dir[1] > -1.0e-5)
dir[1] = 0;
if (dir[2] < 1.0e-5 && dir[2] > -1.0e-5)
dir[2] = 0;
alpha1 = alpha + FOV / 2.0;
v1[0] = sin(alpha1 * M_PI / 180.0);
v1[1] = cos(alpha1 * M_PI / 180.0);
alpha2 = alpha - FOV / 2.0;
v2[0] = sin(alpha2 * M_PI / 180.0);
v2[1] = cos(alpha2 * M_PI / 180.0);
obs[0] += v * dir[0] * dt;
obs[1] += v * dir[1] * dt;
obs[2] += v * dir[2] * dt;
if (obs[1] < 0.0)
obs[1] = 0.0;
}
static void
reshape(int width, int height)
{
scrwidth = width;
scrheight = height;
glViewport(0, 0, (GLint) width, (GLint) height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(50.0, ((GLfloat) width / (GLfloat) height),
lenghtXmnt * stepYmnt * 0.01, lenghtXmnt * stepYmnt * 0.7);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
static int
clipstrip(float y, float *start, float *end)
{
float x1, x2, t1, t2, tmp;
if (v1[1] == 0.0) {
t1 = 0.0;
x1 = -HUGE_VAL;
}
else {
t1 = y / v1[1];
x1 = t1 * v1[0];
}
if (v2[1] == 0.0) {
t2 = 0.0;
x2 = HUGE_VAL;
}
else {
t2 = y / v2[1];
x2 = t2 * v2[0];
}
if (((x1 < -(lenghtXmnt * stepXmnt) / 2) && (t2 <= 0.0)) ||
((t1 <= 0.0) && (x2 > (lenghtXmnt * stepXmnt) / 2)) ||
((t1 < 0.0) && (t2 < 0.0)))
return 0;
if ((t1 == 0.0) && (t2 == 0.0)) {
if ((v1[0] < 0.0) && (v1[1] > 0.0) && (v2[0] < 0.0) && (v2[1] < 0.0)) {
*start = -(lenghtXmnt * stepXmnt) / 2;
*end = stepXmnt;
return 1;
}
else {
if ((v1[0] > 0.0) && (v1[1] < 0.0) && (v2[0] > 0.0) && (v2[1] > 0.0)) {
*start = -stepXmnt;
*end = (lenghtXmnt * stepXmnt) / 2;
return 1;
}
else
return 0;
}
}
else {
if (t2 < 0.0) {
if (x1 < 0.0)
x2 = -(lenghtXmnt * stepXmnt) / 2;
else
x2 = (lenghtXmnt * stepXmnt) / 2;
}
if (t1 < 0.0) {
if (x2 < 0.0)
x1 = -(lenghtXmnt * stepXmnt) / 2;
else
x1 = (lenghtXmnt * stepXmnt) / 2;
}
}
if (x1 > x2) {
tmp = x1;
x1 = x2;
x2 = tmp;
}
x1 -= stepXmnt;
if (x1 < -(lenghtXmnt * stepXmnt) / 2)
x1 = -(lenghtXmnt * stepXmnt) / 2;
x2 += stepXmnt;
if (x2 > (lenghtXmnt * stepXmnt) / 2)
x2 = (lenghtXmnt * stepXmnt) / 2;
*start = ((int) (x1 / stepXmnt)) * stepXmnt;
*end = ((int) (x2 / stepXmnt)) * stepXmnt;
return 1;
}
static void
printstring(void *font, char *string)
{
int len, i;
len = (int) strlen(string);
for (i = 0; i < len; i++)
glutBitmapCharacter(font, string[i]);
}
static void
printhelp(void)
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(0.0, 0.0, 0.0, 0.5);
glRecti(40, 40, 600, 440);
glDisable(GL_BLEND);
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(300, 420);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Help");
glRasterPos2i(60, 390);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "h - Toggle Help");
glRasterPos2i(60, 360);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "t - Toggle Textures");
glRasterPos2i(60, 330);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "f - Toggle Fog");
glRasterPos2i(60, 300);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "p - Wire frame");
glRasterPos2i(60, 270);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "b - Toggle Back face culling");
glRasterPos2i(60, 240);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "Arrow Keys - Rotate");
glRasterPos2i(60, 210);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "a - Increase velocity");
glRasterPos2i(60, 180);
printstring(GLUT_BITMAP_TIMES_ROMAN_24, "z - Decrease velocity");
glRasterPos2i(60, 150);
if (joyavailable)
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"j - Toggle jostick control (Joystick control available)");
else
printstring(GLUT_BITMAP_TIMES_ROMAN_24,
"(No Joystick control available)");
}
static void
drawterrain(void)
{
int h, i, idx, ox, oy;
float j, k, start, end;
ox = (int) (obs[0] / stepXmnt);
oy = (int) (obs[2] / stepYmnt);
GlobalMnt = ((ox * TSCALE) & 255) + ((oy * TSCALE) & 255) * 256;
glPushMatrix();
glTranslatef((float) ox * stepXmnt, 0, (float) oy * stepYmnt);
for (h = 0, k = -(lenghtYmnt * stepYmnt) / 2; h < lenghtYmnt;
k += stepYmnt, h++) {
if (!clipstrip(k, &start, &end))
continue;
glBegin(GL_TRIANGLE_STRIP); /* I hope that the optimizer will be able to improve this code */
for (i = (int) (lenghtXmnt / 2 + start / stepXmnt), j = start; j <= end;
j += stepXmnt, i++) {
idx = (i * TSCALE + h * 256 * TSCALE + GlobalMnt) & 65535;
glColor3fv(terraincolor[idx]);
glTexCoord2f((ox + i) / 8.0, (oy + h) / 8.0);
glVertex3f(j, terrain[idx], k);
idx =
(i * TSCALE + h * 256 * TSCALE + 256 * TSCALE +
GlobalMnt) & 65535;
glColor3fv(terraincolor[idx]);
glTexCoord2f((ox + i) / 8.0, (oy + h + 1) / 8.0);
glVertex3f(j, terrain[idx], k + stepYmnt);
}
glEnd();
}
glDisable(GL_CULL_FACE);
glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBegin(GL_QUADS);
glColor4f(0.1, 0.7, 1.0, 0.4);
glVertex3f(-(lenghtXmnt * stepXmnt) / 2.0, heightMnt * 0.6,
-(lenghtYmnt * stepYmnt) / 2.0);
glVertex3f(-(lenghtXmnt * stepXmnt) / 2.0, heightMnt * 0.6,
(lenghtYmnt * stepYmnt) / 2.0);
glVertex3f((lenghtXmnt * stepXmnt) / 2.0, heightMnt * 0.6,
(lenghtYmnt * stepYmnt) / 2.0);
glVertex3f((lenghtXmnt * stepXmnt) / 2.0, heightMnt * 0.6,
-(lenghtYmnt * stepYmnt) / 2.0);
glEnd();
glDisable(GL_BLEND);
if (bfcull)
glEnable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
glPopMatrix();
}
static void
dojoy(void)
{
#ifdef WIN32
static UINT max[2] = { 0, 0 };
static UINT min[2] = { 0xffffffff, 0xffffffff }, center[2];
MMRESULT res;
JOYINFO joy;
res = joyGetPos(JOYSTICKID1, &joy);
if (res == JOYERR_NOERROR) {
joyavailable = 1;
if (max[0] < joy.wXpos)
max[0] = joy.wXpos;
if (min[0] > joy.wXpos)
min[0] = joy.wXpos;
center[0] = (max[0] + min[0]) / 2;
if (max[1] < joy.wYpos)
max[1] = joy.wYpos;
if (min[1] > joy.wYpos)
min[1] = joy.wYpos;
center[1] = (max[1] + min[1]) / 2;
if (joyactive) {
if (fabs(center[0] - (float) joy.wXpos) > 0.1 * (max[0] - min[0]))
alpha +=
2.5 * (center[0] - (float) joy.wXpos) / (max[0] - min[0]);
if (fabs(center[1] - (float) joy.wYpos) > 0.1 * (max[1] - min[1]))
beta += 2.5 * (center[1] - (float) joy.wYpos) / (max[1] - min[1]);
if (joy.wButtons & JOY_BUTTON1)
v += 0.5;
if (joy.wButtons & JOY_BUTTON2)
v -= 0.5;
}
}
else
joyavailable = 0;
#endif
}
static void
drawscene(void)
{
static char frbuf[80] = "";
dojoy();
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
if (usetex)
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
if (fog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
calcposobs();
gluLookAt(obs[0], obs[1], obs[2],
obs[0] + dir[0], obs[1] + dir[1], obs[2] + dir[2],
0.0, 1.0, 0.0);
drawterrain();
glPopMatrix();
glDisable(GL_TEXTURE_2D);
glDisable(GL_DEPTH_TEST);
glDisable(GL_FOG);
glShadeModel(GL_FLAT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-0.5, 639.5, -0.5, 479.5, -1.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0, 0.0, 0.0);
glRasterPos2i(10, 10);
printstring(GLUT_BITMAP_HELVETICA_18, frbuf);
glRasterPos2i(350, 470);
printstring(GLUT_BITMAP_HELVETICA_10,
"Terrain V1.2 Written by David Bucciarelli (tech.hmw@plus.it)");
glRasterPos2i(434, 457);
printstring(GLUT_BITMAP_HELVETICA_10,
"Based on a Mickael's demo (Skizo@Hol.Fr)");
if (help)
printhelp();
reshape(scrwidth, scrheight);
glutSwapBuffers();
Frames++;
{
GLint t = glutGet(GLUT_ELAPSED_TIME);
if (t - T0 >= 2000) {
GLfloat seconds = (t - T0) / 1000.0;
GLfloat fps = Frames / seconds;
sprintf(frbuf, "Frame rate: %f", fps);
T0 = t;
Frames = 0;
}
}
}
static void
key(unsigned char k, int x, int y)
{
switch (k) {
case 27:
exit(0);
break;
case 'a':
v += 50.;
break;
case 'z':
v -= 50.;
break;
case 'p':
if (poutline) {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
poutline = 0;
}
else {
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
poutline = 1;
}
break;
case 'j':
joyactive = (!joyactive);
break;
case 'h':
help = (!help);
break;
case 'f':
fog = (!fog);
break;
case 't':
usetex = (!usetex);
break;
case 'b':
if (bfcull) {
glDisable(GL_CULL_FACE);
bfcull = 0;
}
else {
glEnable(GL_CULL_FACE);
bfcull = 1;
}
break;
#ifdef XMESA
case ' ':
XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW);
fullscreen = (!fullscreen);
break;
#endif
}
}
static void
special(int k, int x, int y)
{
switch (k) {
case GLUT_KEY_LEFT:
alpha += 2.0;
break;
case GLUT_KEY_RIGHT:
alpha -= 2.0;
break;
case GLUT_KEY_DOWN:
beta -= 2.0;
break;
case GLUT_KEY_UP:
beta += 2.0;
break;
}
}
static void
calccolor(GLfloat height, GLfloat c[3])
{
GLfloat color[4][3] = {
{1.0, 1.0, 1.0},
{0.0, 0.8, 0.0},
{1.0, 1.0, 0.3},
{0.0, 0.0, 0.8}
};
GLfloat fact;
height = height * (1.0 / 255.0);
if (height >= 0.9) {
c[0] = color[0][0];
c[1] = color[0][1];
c[2] = color[0][2];
return;
}
if ((height < 0.9) && (height >= 0.7)) {
fact = (height - 0.7) * 5.0;
c[0] = fact * color[0][0] + (1.0 - fact) * color[1][0];
c[1] = fact * color[0][1] + (1.0 - fact) * color[1][1];
c[2] = fact * color[0][2] + (1.0 - fact) * color[1][2];
return;
}
if ((height < 0.7) && (height >= 0.6)) {
fact = (height - 0.6) * 10.0;
c[0] = fact * color[1][0] + (1.0 - fact) * color[2][0];
c[1] = fact * color[1][1] + (1.0 - fact) * color[2][1];
c[2] = fact * color[1][2] + (1.0 - fact) * color[2][2];
return;
}
if ((height < 0.6) && (height >= 0.5)) {
fact = (height - 0.5) * 10.0;
c[0] = fact * color[2][0] + (1.0 - fact) * color[3][0];
c[1] = fact * color[2][1] + (1.0 - fact) * color[3][1];
c[2] = fact * color[2][2] + (1.0 - fact) * color[3][2];
return;
}
c[0] = color[3][0];
c[1] = color[3][1];
c[2] = color[3][2];
}
static void
loadpic(void)
{
GLubyte bufferter[256 * 256], terrainpic[256 * 256];
FILE *FilePic;
int i, tmp;
GLenum gluerr;
size_t result;
if ((FilePic = fopen("terrain.dat", "r")) == NULL) {
fprintf(stderr, "Error loading terrain.dat\n");
exit(-1);
}
result = fread(bufferter, 256 * 256, 1, FilePic);
assert(result == 1);
fclose(FilePic);
for (i = 0; i < (256 * 256); i++) {
terrain[i] = (bufferter[i] * (heightMnt / 255.0f));
calccolor((GLfloat) bufferter[i], terraincolor[i]);
tmp = (((int) bufferter[i]) + 96);
terrainpic[i] = (tmp > 255) ? 255 : tmp;
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
if ((gluerr = gluBuild2DMipmaps(GL_TEXTURE_2D, 1, 256, 256, GL_LUMINANCE,
GL_UNSIGNED_BYTE,
(GLvoid *) (&terrainpic[0])))) {
fprintf(stderr, "GLULib%s\n", (char *) gluErrorString(gluerr));
exit(-1);
}
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_TEXTURE_2D);
}
static void
init(void)
{
float fogcolor[4] = { 0.6, 0.7, 0.7, 1.0 };
glClearColor(fogcolor[0], fogcolor[1], fogcolor[2], fogcolor[3]);
glClearDepth(1.0);
glDepthFunc(GL_LEQUAL);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
glDisable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_FOG);
glFogi(GL_FOG_MODE, GL_EXP2);
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.0007);
#ifdef FX
glHint(GL_FOG_HINT, GL_NICEST);
#endif
reshape(scrwidth, scrheight);
}
int
main(int ac, char **av)
{
glutInitWindowSize(WIDTH, HEIGHT);
glutInit(&ac, av);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
if (!(win = glutCreateWindow("Terrain"))) {
fprintf(stderr, "Error, couldn't open window\n");
return -1;
}
ModZMnt = 0.0f;
loadpic();
init();
#ifndef FX
glDisable(GL_TEXTURE_2D);
usetex = 0;
#endif
glutReshapeFunc(reshape);
glutDisplayFunc(drawscene);
glutKeyboardFunc(key);
glutSpecialFunc(special);
glutIdleFunc(drawscene);
glutMainLoop();
return 0;
}

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