Compare commits
183 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a7f8117153 | ||
|
45d21ca587 | ||
|
52d4c6ebb5 | ||
|
12e875ce4d | ||
|
5d26219288 | ||
|
40ba618a6f | ||
|
e8245c1409 | ||
|
ebc8b0aa5a | ||
|
7d63ac1e6b | ||
|
fca1ce3a26 | ||
|
e715c91000 | ||
|
e11f089f82 | ||
|
470d3cd4a2 | ||
|
3d16c369d9 | ||
|
b5bfe2f6ae | ||
|
439ded4e2a | ||
|
b66103971c | ||
|
bffae58175 | ||
|
3978d026ea | ||
|
8f47563559 | ||
|
47bcda78e2 | ||
|
d3788b60ae | ||
|
31c40f0905 | ||
|
954f511473 | ||
|
968e557dcd | ||
|
b1ee387ab5 | ||
|
220e77a3f7 | ||
|
0e94067d0d | ||
|
001f826f71 | ||
|
2427575c21 | ||
|
7bb6fcc19d | ||
|
5734421078 | ||
|
97856fd98a | ||
|
5ac8282a22 | ||
|
a573803ed3 | ||
|
78a03d3c45 | ||
|
497d6eab66 | ||
|
05ba9becc3 | ||
|
445e3cbd0d | ||
|
38112f5b60 | ||
|
80d5855692 | ||
|
448b88bb80 | ||
|
cfe52d8ae0 | ||
|
f2a50b141e | ||
|
8674e709ee | ||
|
62eb2e5909 | ||
|
fffc27015b | ||
|
7152305e0a | ||
|
7c4268176e | ||
|
2fc06af470 | ||
|
b6bcfc1f6a | ||
|
37f2d5e696 | ||
|
7b9fe820a3 | ||
|
c98541f54b | ||
|
e9479f24ab | ||
|
573dd2206b | ||
|
4742735a5c | ||
|
b14dcea418 | ||
|
94a6ec8f0c | ||
|
57c946096e | ||
|
fde5e2c5f1 | ||
|
1f20952a92 | ||
|
04120f6cce | ||
|
7c276329e8 | ||
|
edf8c06270 | ||
|
7cc49c2dc8 | ||
|
5ce1f374da | ||
|
675343c517 | ||
|
94666c4b55 | ||
|
ba57e5297d | ||
|
dcbe4d6d2f | ||
|
d22554d2ce | ||
|
097d2a025e | ||
|
e79f4b08d5 | ||
|
517903edcd | ||
|
306933046c | ||
|
30230a9cd1 | ||
|
9348cfc6e8 | ||
|
190d34874c | ||
|
62f75054cb | ||
|
7d5656bee7 | ||
|
7e975ba3aa | ||
|
9bed64cbf1 | ||
|
04ec0fd71e | ||
|
a0037ad8b3 | ||
|
a07e02fd01 | ||
|
0d6fd15840 | ||
|
a8b07a539b | ||
|
2a88946f9a | ||
|
afe4f5e6c1 | ||
|
e7df7cd6ad | ||
|
c123a9b2ed | ||
|
9babb73789 | ||
|
d9fc8e20e3 | ||
|
ac6daf97e1 | ||
|
df631a866d | ||
|
233aafbb30 | ||
|
fc1eadefeb | ||
|
976c26ca34 | ||
|
60174c1aef | ||
|
76a52525c7 | ||
|
bd9b4056d7 | ||
|
3d1df5554e | ||
|
9a90775010 | ||
|
b1a2393bb7 | ||
|
c8a27838a0 | ||
|
d922109eb3 | ||
|
978a2a0a43 | ||
|
2e5a20ae21 | ||
|
b22fe91cdb | ||
|
8b59b52297 | ||
|
58cfa0fd90 | ||
|
c6182ab54c | ||
|
94f494e780 | ||
|
ebc9f221b2 | ||
|
b5797a5085 | ||
|
696cd3d2b6 | ||
|
bb40d07830 | ||
|
5e1680ce1d | ||
|
636fb6cae7 | ||
|
84170351db | ||
|
76ca0f5232 | ||
|
554ceab8ec | ||
|
51184566fb | ||
|
c618005dcf | ||
|
3670e206a7 | ||
|
46af1f87c8 | ||
|
616f470629 | ||
|
2f65b316ff | ||
|
8a8d474068 | ||
|
dae1774e20 | ||
|
086f1b8428 | ||
|
24d9350897 | ||
|
73fc243420 | ||
|
172281dad8 | ||
|
e2df5de01c | ||
|
d4cff4f2fa | ||
|
bbf6a41d2f | ||
|
62c734f499 | ||
|
ae40b2281d | ||
|
3c03f3232d | ||
|
4fa5c1966a | ||
|
55180f4b92 | ||
|
f3b85c983f | ||
|
89480f7382 | ||
|
46e6c7ad54 | ||
|
48f3bdaeb3 | ||
|
fd28445e10 | ||
|
2a9eca0ed4 | ||
|
3b925120a6 | ||
|
277fd2e66e | ||
|
5356031129 | ||
|
4ae22b9721 | ||
|
461b990508 | ||
|
a1503b00f8 | ||
|
fba5e95468 | ||
|
96385fa155 | ||
|
274fc30d31 | ||
|
ac3958ea1b | ||
|
ee6cf4c6b0 | ||
|
601ce1d624 | ||
|
5b22aa1e33 | ||
|
f431a3fb4d | ||
|
bc07a99cc3 | ||
|
cff1cfd90d | ||
|
5c749d9e3c | ||
|
b23f5b5a5c | ||
|
77a4754d73 | ||
|
0cab1db776 | ||
|
1182ffeec3 | ||
|
fae7b778b8 | ||
|
571c8ecc8f | ||
|
ac54173414 | ||
|
5233ca8d30 | ||
|
8564f0536b | ||
|
47a28c0b4d | ||
|
206eda8b69 | ||
|
9c38ae35eb | ||
|
acc722d4b8 | ||
|
33170eeb18 | ||
|
4f76d0e215 | ||
|
8c2f6c5059 | ||
|
657323bf03 |
26
Make-config
26
Make-config
@@ -1,13 +1,13 @@
|
||||
# $Id: Make-config,v 1.46 2001/06/18 22:45:16 brianp Exp $
|
||||
# $Id: Make-config,v 1.50 2001/09/24 19:18:03 brianp Exp $
|
||||
|
||||
MESA_MAJOR=3
|
||||
MESA_MINOR=5
|
||||
MESA_MAJOR=4
|
||||
MESA_MINOR=0
|
||||
MESA_TINY=0
|
||||
VERSION=$(MESA_MAJOR).$(MESA_MINOR)
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
#
|
||||
# Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
# Copyright (C) 1999-2001 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"),
|
||||
@@ -587,7 +587,7 @@ linux-x86-static:
|
||||
"GLUT_LIB_DEPS = -L../lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \
|
||||
"APP_LIB_DEPS = -lm" \
|
||||
"ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \
|
||||
X86/x86_xform2.S X86/x86_xform3.S X86/x86_xform_raw4.S \
|
||||
X86/x86_xform2.S X86/x86_xform3.S X86/x86_xform4.S \
|
||||
X86/x86_cliptest.S X86/x86_vertex.S \
|
||||
X86/mmx_blend.S \
|
||||
X86/3dnow_xform1.S X86/3dnow_xform2.S \
|
||||
@@ -832,11 +832,23 @@ linux-osmesa16:
|
||||
"OSMESA16_LIB = libOSMesa16.so" \
|
||||
"CC = gcc" \
|
||||
"CPLUSPLUS = g++" \
|
||||
"CFLAGS = -g -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG -DCHAN_BITS=16" \
|
||||
"CFLAGS = -g -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG -DCHAN_BITS=16 -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \
|
||||
"CCFLAGS = $(CFLAGS)" \
|
||||
"MAKELIB = ../bin/mklib.linux" \
|
||||
"GL_LIB_DEPS = -lm -lpthread" \
|
||||
"APP_LIB_DEPS = -lOSMesa -lGL"
|
||||
"APP_LIB_DEPS = -lOSMesa16 -lGL"
|
||||
|
||||
# 32-bit/channel Mesa using OSMesa driver
|
||||
linux-osmesa32:
|
||||
$(MAKE) $(MFLAGS) -f Makefile.OSMesa16 targets \
|
||||
"OSMESA16_LIB = libOSMesa32.so" \
|
||||
"CC = gcc" \
|
||||
"CPLUSPLUS = g++" \
|
||||
"CFLAGS = -g -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG -DCHAN_BITS=32 -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \
|
||||
"CCFLAGS = $(CFLAGS)" \
|
||||
"MAKELIB = ../bin/mklib.linux" \
|
||||
"GL_LIB_DEPS = -lm -lpthread" \
|
||||
"APP_LIB_DEPS = -lOSMesa32 -lGL"
|
||||
|
||||
# May want to add these CFLAGS for better performance under LynxOS and GCC:
|
||||
# -fPIC -O2 -ansi -pedantic -mieee-fp -DUSE_XSHM -funroll-loops
|
||||
|
35
Makefile.X11
35
Makefile.X11
@@ -1,9 +1,9 @@
|
||||
# $Id: Makefile.X11,v 1.48 2001/06/19 21:49:06 brianp Exp $
|
||||
# $Id: Makefile.X11,v 1.56 2001/10/17 20:44:26 brianp Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.5
|
||||
# Version: 4.0
|
||||
#
|
||||
# Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
# Copyright (C) 1999-2001 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"),
|
||||
@@ -85,6 +85,7 @@ default:
|
||||
@echo " make linux-sparc5-elf for Sparc5 systems, make ELF shared libs"
|
||||
@echo " make linux-sparc-ultra for UltraSparc systems, make ELF shared libs"
|
||||
@echo " make linux-osmesa16 for 16-bit/channel OSMesa"
|
||||
@echo " make linux-osmesa32 for 32-bit/channel OSMesa"
|
||||
@echo " make lynxos for LynxOS systems with GCC"
|
||||
@echo " make macintosh for Macintosh"
|
||||
@echo " make machten-2.2 for Macs w/ MachTen 2.2 (68k w/ FPU)"
|
||||
@@ -294,7 +295,7 @@ linux-ggi-install linux-386-ggi-install:
|
||||
# echo ".include $(DESTDIR)/etc/ggi/ggimesa.conf" >> $(DESTDIR)/etc/ggi/libggi.conf ; \
|
||||
# fi
|
||||
|
||||
linux-osmesa16:
|
||||
linux-osmesa16 linux-osmesa32:
|
||||
-mkdir lib
|
||||
if [ -d src ] ; then touch src/depend ; fi
|
||||
if [ -d src ] ; then cd src ; $(MAKE) -f Makefile.OSMesa16 $@ ; fi
|
||||
@@ -331,10 +332,10 @@ realclean: clean
|
||||
|
||||
|
||||
|
||||
DIRECTORY = Mesa-3.5
|
||||
LIB_NAME = MesaLib-3.5
|
||||
DEMO_NAME = MesaDemos-3.5
|
||||
GLU_NAME = MesaGLU-3.5
|
||||
DIRECTORY = Mesa-4.0
|
||||
LIB_NAME = MesaLib-4.0
|
||||
DEMO_NAME = MesaDemos-4.0
|
||||
GLU_NAME = MesaGLU-4.0
|
||||
GLUT_NAME = GLUT-3.7
|
||||
|
||||
|
||||
@@ -395,6 +396,8 @@ LIB_FILES = \
|
||||
$(DIRECTORY)/include/GL/mglmesa.h \
|
||||
$(DIRECTORY)/include/GL/osmesa.h \
|
||||
$(DIRECTORY)/include/GL/svgamesa.h \
|
||||
$(DIRECTORY)/include/GL/ugl*.h \
|
||||
$(DIRECTORY)/include/GL/vms_x_fix.h \
|
||||
$(DIRECTORY)/include/GL/wmesa.h \
|
||||
$(DIRECTORY)/include/GL/xmesa.h \
|
||||
$(DIRECTORY)/include/GL/xmesa_x.h \
|
||||
@@ -405,7 +408,6 @@ LIB_FILES = \
|
||||
$(DIRECTORY)/src/Makefile* \
|
||||
$(DIRECTORY)/src/libGL_la_SOURCES \
|
||||
$(DIRECTORY)/src/descrip.mms \
|
||||
$(DIRECTORY)/src/mms_depend \
|
||||
$(DIRECTORY)/src/mesa.conf \
|
||||
$(DIRECTORY)/src/*.def \
|
||||
$(DIRECTORY)/src/depend \
|
||||
@@ -423,6 +425,14 @@ LIB_FILES = \
|
||||
$(DIRECTORY)/src/tnl/*.[ch] \
|
||||
$(DIRECTORY)/src/tnl/Makefile* \
|
||||
$(DIRECTORY)/src/tnl/libMesaTnl_la_SOURCES \
|
||||
$(DIRECTORY)/src/tnl_dd/*.[ch] \
|
||||
$(DIRECTORY)/src/tnl_dd/imm/*.[ch] \
|
||||
$(DIRECTORY)/src/tnl_dd/imm/NOTES.imm \
|
||||
$(DIRECTORY)/src/windml/*.[ch] \
|
||||
$(DIRECTORY)/src/windml/tornado/*.c \
|
||||
$(DIRECTORY)/src/windml/tornado/*.cdf \
|
||||
$(DIRECTORY)/src/windml/man3/*.3 \
|
||||
$(DIRECTORY)/src/windml/man3/*.html \
|
||||
$(DIRECTORY)/src/BeOS/*.cpp \
|
||||
$(DIRECTORY)/src/FX/Makefile.am \
|
||||
$(DIRECTORY)/src/FX/Makefile.in \
|
||||
@@ -454,6 +464,8 @@ LIB_FILES = \
|
||||
$(DIRECTORY)/src/KNOWN_BUGS \
|
||||
$(DIRECTORY)/src/OSmesa/Makefile.am \
|
||||
$(DIRECTORY)/src/OSmesa/Makefile.in \
|
||||
$(DIRECTORY)/src/OSmesa/Makefile.win \
|
||||
$(DIRECTORY)/src/OSmesa/osmesa.def \
|
||||
$(DIRECTORY)/src/OSmesa/*.[ch] \
|
||||
$(DIRECTORY)/src/SPARC/*.[chS] \
|
||||
$(DIRECTORY)/src/SPARC/Makefile.am \
|
||||
@@ -476,6 +488,8 @@ LIB_FILES = \
|
||||
$(DIRECTORY)/si-glu/Makefile.am \
|
||||
$(DIRECTORY)/si-glu/Makefile.in \
|
||||
$(DIRECTORY)/si-glu/Makefile.X11 \
|
||||
$(DIRECTORY)/si-glu/Makefile.win \
|
||||
$(DIRECTORY)/si-glu/glu.def \
|
||||
$(DIRECTORY)/si-glu/dummy.cc \
|
||||
$(DIRECTORY)/si-glu/descrip.mms \
|
||||
$(DIRECTORY)/si-glu/mesaglu.opt \
|
||||
@@ -617,6 +631,9 @@ DEMO_FILES = \
|
||||
$(DIRECTORY)/samples/README \
|
||||
$(DIRECTORY)/samples/*.c \
|
||||
$(DIRECTORY)/mtdemos \
|
||||
$(DIRECTORY)/windmldemos/Makefile.ugl \
|
||||
$(DIRECTORY)/windmldemos/*.c \
|
||||
$(DIRECTORY)/windmldemos/*.bmp \
|
||||
$(DIRECTORY)/ggi
|
||||
|
||||
OBSOLETE_DEMO_FILES = \
|
||||
|
@@ -3,6 +3,10 @@
|
||||
(see below for FAQ)
|
||||
|
||||
|
||||
Warning: this document is rather out of date, but most of the information
|
||||
should still apply.
|
||||
|
||||
|
||||
|
||||
What do you need ?
|
||||
------------------
|
||||
|
@@ -1,623 +1,91 @@
|
||||
|
||||
Mesa/Readme.win32
|
||||
|
||||
Last Updated: Sunday, September 19th, 1999 - tjump@tertius.com
|
||||
|
||||
*** What's New
|
||||
|
||||
- Updated for Mesa 3.1beta3/CVS. Debug and Release command-line builds of
|
||||
Mesa, fxMesa, GLU, GLUT and all sample programs DLL-based. Manual
|
||||
executions tests with minimum requisite results (aka: things looked like
|
||||
I expected them to).
|
||||
|
||||
What did you expect, complete regression testing maybe?
|
||||
|
||||
- NASM build support. Any file in the project coded as a .S file will
|
||||
automatically be recognized and built as a NASM-source assember file.
|
||||
|
||||
To enable building using NASM, set the environment variable NASM to
|
||||
indicate that command to execute to run nasm on a file. If NASM is in
|
||||
your command search path then all this needs be set to is 'nasmw' -
|
||||
otherwise you will need to include the complete drive and directory path.
|
||||
|
||||
NASM may be retrieved here: http://www.web-sites.co.uk/nasm/
|
||||
|
||||
- DevStudio projects suspended for compatability reasons: projects modified
|
||||
by DevStudio 6 are not compatible with DevStudio 5.
|
||||
|
||||
These will slowly be rebuilt and put into CVS as I can.
|
||||
|
||||
- Build environment change: The Glide SDK is no longer assumed to be in
|
||||
the global INCLUDE/LIB environment vars, it is required that you set the
|
||||
value 'GLIDE2X' as either an environment variable pointing to your Glide
|
||||
SDK install directory or that you configure that as a build option to
|
||||
nmake.exe when building fxmesagl32. Examples:
|
||||
|
||||
nmake /f nmake.mak GLIDE2X=g:\sdk\glide2x fxmesagl32
|
||||
|
||||
<or>
|
||||
|
||||
nmake /f nmake.mak GLIDE2X=g:\sdk\glide2x allfx
|
||||
|
||||
<or>
|
||||
|
||||
nmake /f nmake.mak GLIDE2X=g:\sdk\glide2x progs.3dfx.demos
|
||||
|
||||
The DevStudio workspace files for 3Dfx OpenGL require the definition of
|
||||
GLIDE2SDK as an environment variable pointing to where your copy of the
|
||||
Glide SDK has been installed. Adding this to your AUTOEXEC.BAT would do
|
||||
so (change the directories to match):
|
||||
|
||||
SET GLIDE2SDK=G:\SDK\GLIDE2X
|
||||
|
||||
*** Legalese
|
||||
|
||||
These build files are provided as-is and are submitted to be included with
|
||||
the "Mesa 3-D Graphics Library" package as (currently) maintained by Brian
|
||||
Paul. These project build files are free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU Library General Public License
|
||||
as published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
These project files are distributed in the hope that they will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; if not, write to the Free Software Foundation,
|
||||
Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*** Maintenance Responsiblity and Technical Support
|
||||
|
||||
While these files are now part of the Mesa core distribution please do NOT
|
||||
contact Mr. Paul for help with them if you encounter problems as he can't
|
||||
help you (currently). I will, however, attempt my straightforward best in
|
||||
assisting anyone with using these files on their system. I can NOT
|
||||
guarantee instant responses owing to other responsiblities, but I do try
|
||||
dang hard to answer any mail w/in 24 hours. I may be contacted at the
|
||||
above email address for the forseeable future.
|
||||
|
||||
-Ted
|
||||
mailto://tjump@tertius.com
|
||||
http://www.tertius.com/tjump
|
||||
|
||||
*** General Information
|
||||
|
||||
These build files facilitate convenient building of many variants of Mesa,
|
||||
both as static link libraries (including mesaglu) and as dynamic link
|
||||
libraries that in some cases may be used as "drop-in" replacements for
|
||||
OpenGL32.DLL on both Windows95 and Windows NT.
|
||||
|
||||
The construction of the Win32 command-line build files and projects has
|
||||
been something of a pet project of mine, and is based upon my own
|
||||
"standard" Win32 build environment as supplied by the "nmake.mif" file.
|
||||
They have been tested under Windows95 OSR2, Windows NT 4.0SP3, and Windows
|
||||
NT 5.0 beta 1. The libraries that they generated have been tested (via the
|
||||
demo programs) in a *limited* fashion on the above three systems, including
|
||||
the 3Dfx versions.
|
||||
|
||||
The reason I went with command-line build environment instead of the more
|
||||
convenient IDE-based project files is for two reasons: 1. These appear to
|
||||
have some amount of portability between versions (the nmake syntax hasn't
|
||||
changed much since Microsoft C 7.0) while the IDE project files seem to
|
||||
change drastically each version. and 2. These are readable with any ascii
|
||||
editor and such are better self-documentation of the file relationships for
|
||||
more people such that it will facilitate supporting other Win32 compilers.
|
||||
|
||||
While these files only deal with building for x86 targeted code it *should*
|
||||
be possible to add the necessary logic to them to build for the other MSVC
|
||||
supported CPU targets, I simply have no hardware to test them on nor the
|
||||
alternative compilers to build with.
|
||||
|
||||
*** Prerequisites for use
|
||||
|
||||
1. You must have a 32-bit Microsoft compiler installed. I have tested
|
||||
this with Visual C 5.0 (SP3) and Visual C 4.2, but with minor
|
||||
(possibly no) modification to the nmake.mak and nmake.mif files this
|
||||
sequence should work on Visual C 2.0 also. The workspace files
|
||||
(mesalib.dsw and mesademos-*.dsw) and their included project files
|
||||
(*.dsp) are specific to the DevStudio IDE - I have made no attempt at
|
||||
building a VC4 IDE project set as I do not use that any more. Note
|
||||
that the VC workspace files NO LONGER use NORE are dependant upon the
|
||||
nmake.mak and nmake.mif files for construction of definition (*.DEF)
|
||||
and resource (*.RC) files.
|
||||
|
||||
*** Visual C 4.x Users Warning ****
|
||||
|
||||
Note that early editions of VC4 do NOT have header files current enough
|
||||
for use building this code base. If you are using VC4 you will either need
|
||||
to get an update to version 4.2 *or* you may download the Platform SDK
|
||||
directly from Microsoft's web site (www.microsoft.com) and update your
|
||||
build environment that way.
|
||||
|
||||
*** Visual C 4.x Users Warning ****
|
||||
|
||||
2. You must have the PATH, INCLUDE, and LIB environment variables set
|
||||
properly. With VC5 you can easily get this by executing the VCVARS32.BAT
|
||||
file that was created for you upon installation. It is found in the
|
||||
DevStudio\VC\BIN directory, wherever you installed DevStudio. VC4 provides
|
||||
a similar batch file in it's BIN directory also.
|
||||
|
||||
3. (optional) If you're going to build for 3Dfx/Voodoo you will need to
|
||||
have previously installed the Glide SDK version 2.3 or later, if I
|
||||
recall. This may be retrieved from www.3dfx.com for no money and some
|
||||
download time. ;-) These build files assume that you have the Glide SDK
|
||||
added to the respective environment variables (LIB and INCLUDE).
|
||||
|
||||
4. (optional) If you're going to build for S3/Virge you will need the S3
|
||||
Developers Toolkit which may be downloaded from www.s3.com for the price of
|
||||
registering on-line and some time. NOTE: I can build the s3mesa.dll file to
|
||||
completion, however the compilation of s3mesa.c currently generates a large
|
||||
amount of compiler warnings and between that and the fact that I can not at
|
||||
all test it I can make no claims to it's ability to execute. Again, like
|
||||
the 3Dfx version before this, these build files assume you have the S3Dtk H
|
||||
and LIB files in the path of their respective environment variables.
|
||||
Note 2: As of Mesa3.0beta6 I have build files, both command-line and IDE,
|
||||
which should be able to build the s3mesa code base if it weren't for updates
|
||||
being required in the S3 DD code support (Mesa-3.0/src/s3 directory).
|
||||
|
||||
I advise putting any include and lib files for secondary toolkits (Glide,
|
||||
S3Tk, whatever) in their respective environment variables *before* the
|
||||
Microsoft-assigned default values.
|
||||
|
||||
*** FAQ: Frequenty Asked Questions and Other Important Information ***
|
||||
|
||||
- When running the 3Dfx demos under Windows NT, they crash on exit, what's
|
||||
up?
|
||||
|
||||
This is apparently a problem in Glide itself. The workaround is to go to
|
||||
your C:\WINNT\SYSTEM32 directory and rename the file FXOEM2X.DLL to
|
||||
FXOEM2X.DL_ to prevent Glide from loading and initializing it upon
|
||||
startup. This is known to be an issue with cards that do not have "TV
|
||||
out" and is known to cause crashes on Diamond Monster II 8M and 3Dfx
|
||||
Reference boards, all using 3Dfx Reference Drivers version 2.53. Other
|
||||
hardware/driver combinations will also likely exhibit this behavior.
|
||||
|
||||
- I'm having a problem building Mesa for static library linking.
|
||||
|
||||
This was caused by some incomplete testing on my part, and a fix is now
|
||||
available in the form of an add-on to the base Mesa 3.0 release. The
|
||||
file to get is:
|
||||
|
||||
via FTP download from: iris.ssec.wisc.edu
|
||||
you want to go here: /pub/Mesa/patches_to_3.0/
|
||||
you want to get file: Mesa-3.0-w32-static-fixes.tar.gz
|
||||
|
||||
This required a minor addition to INCLUDE/GL for a clean solution, the
|
||||
file "include/gl/mesa_wgl.h" is automatically included by
|
||||
"include/gl/gl.h" when a Win32 non-DLL build is in progress to provide
|
||||
prototypes for the various wgl functions.
|
||||
|
||||
The only remaining hitch in this setup is that the 3Dfx build is not yet
|
||||
running as a static build, because of problems with conflicts in
|
||||
existance of the various GDI functions like ChoosePixelFormat,
|
||||
etc. *sigh*
|
||||
|
||||
Anyway, the "allstatic" target now works as expected and builds all
|
||||
book/sample/demos programs to boot. ;^)
|
||||
|
||||
- How do I get fxMesa to render in a window on the desktop instead of only
|
||||
full-screen?
|
||||
|
||||
Use the Microsoft Windows fxMesa-in-a-window hack!
|
||||
|
||||
Seriously, if you want fxMesaGL to render using the 3Dfx Voodoo1 or
|
||||
Voodoo2 hardware into a window on the desktop then all you need to do is
|
||||
set the MESA_WGL_FX environment variable to anything other than
|
||||
"fullscreen" and it will render into a window. If you wish to go
|
||||
fullscreen then you only need to NOT have the environment variable, or
|
||||
have it set to "fullscreen". You may also switch at runtime between
|
||||
fullscreen-mode and windowed by pressing ALT-ENTER on the keyboard
|
||||
(unless the application using Mesa does something with those keystrokes,
|
||||
of course).
|
||||
|
||||
As of 8/13/98 this should be running a LOT better for more people as a
|
||||
low-compatability item was cleaned up which prevented it from working on
|
||||
many (most?) display drivers under Windows 9x.
|
||||
|
||||
- I have my 3Dfx card hooked to it's own monitor and I want the output to
|
||||
stay on even if I switch to another program, is this possible?
|
||||
|
||||
If the Glide environment variable SST_DUALHEAD is set to '1' then fxMesa
|
||||
will never disable the Voodoo output on a Voodoo1 or Voodoo2 display
|
||||
regardless of whether the fxMesa application is "current" or not. This
|
||||
works regardless of whether it's rendering using the window hack
|
||||
mentioned above or not.
|
||||
|
||||
- I want to run the Mesa demos on my Intel740 card using it's own OpenGL
|
||||
acceleration, how do I do this?
|
||||
|
||||
Build GLUT standalone for use with system OpenGL and GLU drivers!
|
||||
|
||||
The Command-line project supports building all test/demo programs against
|
||||
these drivers also! This allows you full use of GLUT on Windows using
|
||||
hardware accelerated OpenGL. Wheee! This includes the "3dfx/demos"
|
||||
directory of which only two programs will not run on "standard"
|
||||
opengl. Note that there are a few of the sample programs which will NOT
|
||||
work without Mesa as they directly call into Mesa instead of using the
|
||||
extension mechanism.
|
||||
|
||||
*** Included programs that exhibit unfortunate or bad behavior
|
||||
|
||||
- demos/bounce - doesn't run on high-colors screens? It's requesting an
|
||||
INDEX display from GLUT and that fails on my true-color desktop. Changing
|
||||
this to _RGB let's the program work, but it doesn't display
|
||||
properly. This is probably just an idiosyncracy of my machine though, as
|
||||
if I test the program using GLUT for System OpenGL on my Intel740 OpenGL
|
||||
accelerated machine it's just hunky-dory.
|
||||
|
||||
- demos/glutfx - runs, but crashes on exit (but not on my Intel740 machine)
|
||||
|
||||
- demos/texobj - runs, but crashes on exit if ESC is pressed. Exits cleanly
|
||||
if the Close box on the window frame is pressed with the mouse. Go figure.
|
||||
|
||||
- book/aaindex - doesn't run, can't get pixel format, because it wants an
|
||||
INDEX display maybe (but is okay on my Intel740 machine)?
|
||||
|
||||
- most of the book/* demos don't respond to ESC being pressed.
|
||||
|
||||
- 3dfx/demos/* - all demos run, however they all crash on exit. I've traced
|
||||
this so far as to determine the call it's happening with. The crash comes
|
||||
from within Glide during the processing of the grGlideShutdown() call, as
|
||||
in invalid memory reference exception. I'm wondering if this is because
|
||||
of some state or processing not being completed before the call. Dunno,
|
||||
but putting grSstIdle() in just before grGlideShutdown() does NOT fix the
|
||||
problem.
|
||||
|
||||
- 3dfx/demos/tunnel2 - does not run on my system even with SLI mode
|
||||
disabled. Hmmmm, maybe I need to disconnect my Voodoo2 cards?
|
||||
|
||||
*** Important Notes and Changing Default values
|
||||
|
||||
- The optimizer settings have been manually reworked in both command line
|
||||
and DevStudio IDE files to hopefully prevent possible irrational code on
|
||||
the part of the code generator. Formerly, it was configured for "/Ox",
|
||||
now it is configured for safer handling at a slight potential performance
|
||||
cost. This may not be required for Visual Studio 6 but I can't test that
|
||||
(yet).
|
||||
|
||||
- These files build with the code targeted for Pentium processors and
|
||||
8-byte structure padding.
|
||||
|
||||
- The IDE-built programs seem to be "happier" in that the command line
|
||||
build of the 3Dfx demo "fire" will grenade on exit (?). Otherwise pretty
|
||||
much everything may be built with either interface.
|
||||
|
||||
- The currently configured Mesa version is 3.1, and MesaDemos version is
|
||||
the same. To change this permanently you will need to edit NMAKE.MAK and
|
||||
change the lines that look like this (they start o/a line 116):
|
||||
|
||||
# Currently, Mesa is at rev 3.1 ...
|
||||
#
|
||||
!IF "$(MESAVER)" == ""
|
||||
MESAVER=3.1
|
||||
!ENDIF
|
||||
|
||||
# used in building all of the resource files for the Mesa DLLs
|
||||
#
|
||||
!IF "$(MESAFILEVER)" == ""
|
||||
MESAFILEVER=3,1,0,0
|
||||
!ENDIF
|
||||
|
||||
- Currently the build files are configured to be used from a Win32
|
||||
directory that is included inside the main Mesa-3.1 heirarchy.
|
||||
|
||||
- The build files are smart enough to find the files for the core lib, glu,
|
||||
glut, and the various demo programs if they are unpacked in the current
|
||||
Mesa-3.1 heirarchy, like this:
|
||||
|
||||
\Mesa-3.1
|
||||
\Mesa-3.1\src
|
||||
\Mesa-3.1\src-glu
|
||||
\Mesa-3.1\src-glut
|
||||
\Mesa-3.1\Win32
|
||||
\Mesa-3.1\samples
|
||||
\Mesa-3.1\demos
|
||||
\Mesa-3.1\book
|
||||
\Mesa-3.1\3Dfx\demos
|
||||
|
||||
... should work. This arose because my initial build tests for the
|
||||
demo files were done before MesaDemos 2.6 had been released.
|
||||
|
||||
- With the exception of the static link libraries generated by this file
|
||||
set (mesagl.lib, mesaglu.lib, mesaglut.lib) all DLLs and executables are
|
||||
built against the "Multithreaded DLL" runtime - this means that they
|
||||
require MSVCRT.DLL or MSVCRTD.DLL in the path to execute.
|
||||
|
||||
** CHANGED 8/11/98 ***
|
||||
|
||||
Note also that the demos are all built aginst the "OpenGL32, GLU32, and
|
||||
GLUT32" and as such they are fairly agnostic wrt: building against Mesa
|
||||
for CPU-rendering, Mesa-for-3Dfx, Mesa-for-S3, or System OpenGL.
|
||||
|
||||
If you want to build them for use on your system and your display card
|
||||
provides full OpenGL acceleration (Permedia, Intel740, Intergraph,
|
||||
whatever) then you only need to build GLUT prior to building any of the
|
||||
demo programs. For convenience, the GLUT project is included in each of
|
||||
the demo projects Workspace files for the DevStudio IDE builds BUT it is
|
||||
not automatically built - you still need to build it first manually.
|
||||
|
||||
Note that if you have GLUT already installed on your system (gl/glut.h in
|
||||
yoru INCLUDE path, glut32.lib/glut32d.lib in your LIB path, and the DLL
|
||||
in your PATH) then you do NOT need to build GLUT prior to the test
|
||||
programs.
|
||||
|
||||
- The 3Dfx build of Mesa has primarily been tested with Quake 2 and it runs
|
||||
(mostly) fine on my PC (take that for what you want it)...
|
||||
|
||||
** CHANGED 8/11/98 ***
|
||||
|
||||
There is still something going on that causes Glide to crash on shutdown,
|
||||
when I run fxMesa under Windows NT, however it does not appear to occur
|
||||
under Windows 9x on either Voodoo1 or Voodoo2 cards. *sigh*
|
||||
|
||||
- I can not test the S3 build as I have no machines available with Virge
|
||||
based display cards.
|
||||
|
||||
- The multithreaded test code is *not* built as it requires pthreads and I
|
||||
have as of yet spent not time trying to get that running. The latest word
|
||||
that I saw WRT threading support on win32 was that they are intending to
|
||||
support it natively within Win32 - so I'm waiting it out until they get
|
||||
it done.
|
||||
|
||||
- Similarly, the 'xdemos' are not currently built because I haven't gotten
|
||||
around to building the client libs for native win32 and getting it all
|
||||
setup for use.
|
||||
|
||||
*** Output Files
|
||||
|
||||
All final output files (DLL/LIB) are placed in the Mesa-3.1/lib directory,
|
||||
with the exception of the fxMesaGL32 build which is placed in
|
||||
Mesa-3./lib/FX and the executable images which are placed in their source
|
||||
directories.
|
||||
|
||||
To be able to execute the various test programs, you will need to copy the
|
||||
requisite DLL files into the same directory as the EXE files. Note that
|
||||
most of the 3Dfx/demos/* programs WILL run with the non-FX build of Mesa -
|
||||
just very slowly. The two programs which are hard-linked with the FX build
|
||||
and will not run without it are "glbpaltx" which uses "gl3DfxSetPaletteEXT"
|
||||
directly instead of via the extensions mechanism and "tunnel2" which uses
|
||||
"fxMesaSelectCurrentBoard" API for selecting between multiple 3Dfx cards
|
||||
installed in one system. Likewise, "paltex" directly uses the
|
||||
"glColorTableEXT" extension and thus may not run on anything except
|
||||
Mesa. If these applications used the proper extension mechanism they could
|
||||
then be used on more than "just" fxMesa to good effect (for example, the
|
||||
rest of the "3Dfx/demos" run just peachy on the Intel740 card in my test
|
||||
machine) under WinNT.
|
||||
|
||||
Because I'm anal about my computer and it's organization, and I like to
|
||||
prevent collision between builds, each of the subprojects has their own
|
||||
intermediate file directory inside .\win32\release (for example, when
|
||||
building mesagl.lib all of it's intermediate files will be found in
|
||||
.\win32\release\lib.mesagl). This makes it very easy to cleanup as you
|
||||
only need to remove .\win32\release.
|
||||
|
||||
*** Okay, Enough, how do I build with this stuff already Ted!
|
||||
|
||||
Okay, no major calamity here. The basic way to use the project file is to
|
||||
call it via NMAKE from the command line. The format is:
|
||||
|
||||
nmake[.exe] /f nmake.mak [options] [target]
|
||||
|
||||
The most likely [options] values you will use may be any combination of the
|
||||
following:
|
||||
|
||||
DEBUG=1 or DEBUG=0
|
||||
USE_CRTDLL=1 or USE_CRTDLL=0
|
||||
|
||||
Note that all three of these options are OFF by default.
|
||||
|
||||
The [target] includes but is not limited to the following (for full details
|
||||
please peruse the NMAKE.MAK and NMAKE.MIF files - but be warned that
|
||||
NMAKE.MIF is rather large and sometimes hard to follow):
|
||||
|
||||
--- convenience targets ---
|
||||
|
||||
all - builds everything
|
||||
libfiles - builds all linking library files
|
||||
progs - builds all executable images
|
||||
|
||||
--- library files, static and dynamic ---
|
||||
|
||||
mesagl - static lib build of Mesa core.
|
||||
mesaglu - static lib build of MesaGLU core.
|
||||
mesaglut - static lib build of Mesa GLUT core.
|
||||
|
||||
mesagl32 - dynamic lib build of Mesa core.
|
||||
|
||||
mesaglu32 - dynamic lib build of GLU core, generates
|
||||
GLU32.DLL and/or GLU32d.DLL.
|
||||
|
||||
mesaglut32 - dynamic lib build of GLUT core, generates
|
||||
GLUT32.DLL and/or GLUT32d.dll.
|
||||
|
||||
--- hardware accelerated mesa builds ---
|
||||
|
||||
fxmesagl32 - builds Mesa for use on top of the 3Dfx
|
||||
Glide runtime libs
|
||||
|
||||
s3mesagl32 - builds mesa for use on top of the S3
|
||||
'S3Tk' runtime libs.
|
||||
|
||||
--- executable images ---
|
||||
|
||||
progs.book - builds all programs in \book directory
|
||||
progs.demos - builds all programs in \demos directory
|
||||
progs.samples - builds all programs in \samples directory
|
||||
|
||||
These targets generate all of the programs in their respective
|
||||
directories and link the executables against OpenGL32.DLL,
|
||||
GLU32.DLL, and GLUT32.DLL (or their debug equivalents).
|
||||
|
||||
progs.3dfx.demos - builds all programs in \3dfx\demos directory
|
||||
|
||||
This target generates the 3Dfx/Demo executables, linking them
|
||||
against GLUT32.DLL, GLU32.DLL, OPENGL32.DLL and are thus NOT
|
||||
hard-bound to using Mesa per-se as you can simply NOT build the
|
||||
Mesa core and GLU libraries.
|
||||
|
||||
--- Microsoft/SGI OpenGL-based GLUT and Demo program builds ----
|
||||
|
||||
*** IMPORTANT SAFETY TIP: If you're going to build these variants of
|
||||
GLUT then DO NOT build any other target libraries in this package
|
||||
first, OR from the command line run the "nmake /f nmake.mak clean"
|
||||
command first! This is because generation of the GLUT for SGI
|
||||
OpenGL target libraries conflicts in naming with the static build
|
||||
libraries of Mesa and it's supporting GLUT build.
|
||||
|
||||
Currently, you may build GLUT as either GLUT32.DLL or GLUT.DLL for
|
||||
use running against either Microsoft or SGI OpenGL for Window,
|
||||
respectively. This allows for the general use of GLUT 3.7 on Windows
|
||||
systems with fully compliant OpenGL.
|
||||
|
||||
You can build the GLUT DLL files either with the command line by
|
||||
issuing either of these commands:
|
||||
|
||||
nmake /f nmake.mak glut.sysgl
|
||||
|
||||
<or>
|
||||
|
||||
nmake /f nmake.mak glut.sgigl
|
||||
|
||||
OR by using the DevStudio MesaLib Worksapce build the GLUT_SGIGL or
|
||||
GLUT_SYSGL projects within the DevStudio IDE.
|
||||
|
||||
Unfortunately, the only way to build the test programs against this
|
||||
build of GLUT is via the command line, and I will NOT be making
|
||||
duplicate demo program projects for the IDE as it's just not worth it,
|
||||
sorry.
|
||||
|
||||
To build the test programs against either MS or SGI OpenGL, you do so
|
||||
via either of these two commands:
|
||||
|
||||
nmake /f nmake.mak progs.sysgl
|
||||
|
||||
<or>
|
||||
|
||||
nmake /f nmake.mak progs.sgigl
|
||||
|
||||
To use the GLUT-for-system-OpenGL in your own programs, you need to do
|
||||
three things by way of preparation, after building GLUT of course:
|
||||
|
||||
1. Copy include\gl\glut.h to somewhere in your %INCLUDE% path, one
|
||||
likely candidate location would be in your
|
||||
"DevStudio\VC\INCLUDE\GL" directory.
|
||||
|
||||
2. Copy the linking libraries to somewhere in your %LIB% path, one
|
||||
likely candidate location would be in your "DevStudio\VC\LIB"
|
||||
directory. The linking libraries you need to copy are as
|
||||
follows:
|
||||
|
||||
.\Release\GLUT32.LIB
|
||||
.\Release\GLUT.LIB
|
||||
.\Debug\GLUT32.LIB
|
||||
.\Debug\GLUT.LIB
|
||||
|
||||
3. Copy the runtime libraries to somewhere in your %PATH%, one
|
||||
likely candidate location would be in WINDOWS\SYSTEM. the files
|
||||
that you should copy are as follows:
|
||||
|
||||
.\Release\GLUT32.DLL
|
||||
.\Release\GLUT32.PDB
|
||||
.\Release\GLUT.DLL
|
||||
.\Release\GLUT.PDB
|
||||
.\Debug\GLUT32d.DLL
|
||||
.\Debug\GLUT32d.PDB
|
||||
.\Debug\GLUTd.DLL
|
||||
.\Debug\GLUTd.PDB
|
||||
|
||||
Some examples are in order ...
|
||||
|
||||
... build all dynamic-link libs using MSVCRT.DLL for C runtime:
|
||||
|
||||
nmake /f nmake.mak USE_CRTDLL=1 alldynamic
|
||||
|
||||
... To build all library variants and all test and demonstration
|
||||
programs with the default settings you do this:
|
||||
|
||||
nmake /f nmake.mak all
|
||||
|
||||
... to build all static link libs and nothing else you do this:
|
||||
|
||||
nmake /f nmake.mak allstatic
|
||||
|
||||
... to build all non-accelerated dynamic link libs you do this:
|
||||
|
||||
nmake /f nmake.mak alldynamic
|
||||
|
||||
... to build all 3Dfx targeted dynamic link libs you do this:
|
||||
|
||||
nmake /f nmake.mak allaccel
|
||||
|
||||
... to build all S3 Virge targetd dynamic link libs you do this:
|
||||
|
||||
nmake /f nmake.mak alls3
|
||||
|
||||
... to build all libraries, static and dynamic, in all versions
|
||||
you do this:
|
||||
|
||||
nmake /f nmake.mak libfiles
|
||||
|
||||
... to subsequently build all demo and test programs you do this:
|
||||
|
||||
nmake /f nmake.mak progs
|
||||
|
||||
... to cleanup all intermediate files you do this:
|
||||
|
||||
nmake /f clean
|
||||
|
||||
You get the picture. (I hope) ;^) You may also specify specify
|
||||
single targets in a convenient fashion. The rule is simple, any of the
|
||||
above named lib files, static or dynamic, may be built by providing it's
|
||||
name on the command line as the target. Examples:
|
||||
|
||||
... to build only Mesa as OpenGL32.DLL ...
|
||||
|
||||
nmake /f nmake.mak opengl32
|
||||
|
||||
... to build only Mesa on top of the 3Dfx Glide API ...
|
||||
|
||||
nmake /f nmake.mak fxMesaGL32
|
||||
<or>
|
||||
nmake /f nmake.mak fxMesaGL
|
||||
|
||||
... to build only Mesa on top of the S3 Toolkit ...
|
||||
|
||||
nmake /f nmake.mak s3MesaGL32
|
||||
<or>
|
||||
nmake /f nmake.mak s3mesaGL
|
||||
|
||||
*** Revision history for ./win32 project files
|
||||
|
||||
1/18/98 - initial cut submitted and included with core mesa
|
||||
2/5/98 - fixed internal dependency within nmake.mif upon there being
|
||||
a $(DEVDIR) variable to make some temporary batch files
|
||||
dependant upon (thanks to Keven T. McDonnell for finding
|
||||
that there was this particular bug). I also updated the
|
||||
build files for 2.6beta6.
|
||||
2/8/98 - added DevStudio workspace and project files for all lib
|
||||
files and some test programs. Updated readme.win32.
|
||||
6/25/98 - initial revision for Mesa 3.0, does not include IDE files,
|
||||
not everything is running. *sigh*
|
||||
7/20/98 - Mesa 3.0beta6 rev of all build files, all libs built and
|
||||
minimally tested, all demo programs built and minimally
|
||||
tested to within limits of my PC. ;^) Eveything looks
|
||||
MUCH better now ...
|
||||
7/30/98 - Minor updates/edits based upon feedback from
|
||||
Eero Pajarre <epajarre@koti.tpo.fi>. These updates include a fix
|
||||
to the Mesa-on-3Dfx build such that Quake-II now runs almost
|
||||
properly on my system. It runs, just *very* slowly and with *no*
|
||||
textures. Hmmm. Doesn't make any difference whether Quake is set
|
||||
to use 8-bit textures or not.
|
||||
8/13/98 - Lots of build cleanups, minor bug fixes in fxwgl.c, and
|
||||
compatability fix in fxapi.c for in-window rendering using 3Dfx
|
||||
hardware.
|
||||
8/26/98 - Final revisions for Mesa 3 release checked
|
||||
9/22/98 - Fixed static builds for all but fxMesaGL32 and s3MesaGL32 targets
|
||||
9/29/98 - Reorganized FAQ information and added Added faq entry about Glide
|
||||
bug under NT (crash on exit) and a workaround.
|
||||
11/21/98 - Updated files for Mesa 3.1 beta 1
|
||||
Updated fxMesa window-hack code
|
||||
Updated fxMesa resolution support to handle 1600x1200 & 1280x1024
|
||||
7/9/99 - Rev'd for Mesa 3.1 beta 2
|
||||
File: docs/README.WIN32
|
||||
|
||||
Last updated: Oct 15, 2001 - Karl Schultz - kschultz@users.sourceforge.net
|
||||
|
||||
Quick Start
|
||||
|
||||
If you have Microsoft Visual C++ 6.0 installed, simply go to the top directory
|
||||
of the Mesa distribution and type 'nmake -f Makefile.win NODEBUG=1' for
|
||||
an optimized build.
|
||||
|
||||
Details and Notes
|
||||
|
||||
- Building Mesa as noted above should visit and build the following:
|
||||
src MesaGL.dll, MesaGL.lib, osmesa.dll, osmesa.lib
|
||||
si-glu MesaGLU.dll, MesaGLU.lib
|
||||
src-glut glut32.dll, glut32.lib
|
||||
demos a handful of demo executables.
|
||||
|
||||
- After building, you can copy the above DLL files to a place in your PATH
|
||||
or to the demos directory if you just want to give the demos a try.
|
||||
The DLL and LIB files are copied to the ./lib directory. The makefile
|
||||
creates this directory if it does not already exist.
|
||||
|
||||
- The make targets 'clean' and 'clobber' will remove objects and libraries.
|
||||
But the files in ./lib are never cleaned.
|
||||
|
||||
- The make target 'install' will take its best shot at copying DLL files,
|
||||
LIB files, and headers to the right places. I strongly suggest that
|
||||
you examine the makefiles to make sure that 'install' doesn't do anything
|
||||
that you can't live with.
|
||||
|
||||
- The makefiles are designed to work with Microsoft's NMAKE, and do,
|
||||
unfortunately, have some Microsoft-specific things in them. If you
|
||||
would like to use gcc or some other build tools like the Cygnus tools,
|
||||
then you will have to hack the makefiles to make them work with your
|
||||
tools. I'm sorry about this; I wasn't motivated to make this any
|
||||
different, but if you end up modifying the makefiles for your tools,
|
||||
you can send me the changes and I can apply the changes to the
|
||||
source tree.
|
||||
|
||||
- There are no Microsoft Visual Studio project files. However, these
|
||||
should be very easy to create. One can use the compiler and linker
|
||||
options found in the makefiles to make quick progress in creating
|
||||
projects.
|
||||
|
||||
- The DLL files are built so that the external entry points use the
|
||||
stdcall calling convention.
|
||||
|
||||
- Static LIB files are not built. The LIB files that are built with
|
||||
the current makefiles are the linker import files associated with
|
||||
the DLL files. If static LIB's are desired, it should not be too
|
||||
difficult to modify the makefiles to generate them.
|
||||
|
||||
- The si-glu sources are used to build the GLU libs. This was done
|
||||
mainly to get the better tessellator code. However the C++ NURBS
|
||||
code is not built. If you need NURBS, consider modifying the
|
||||
makefiles to build the C++ code or try to build the older GLU
|
||||
code in src-glu.
|
||||
|
||||
- The osmesa driver builds and should work on Windows as well as
|
||||
any other platform.
|
||||
|
||||
- The Windows driver (in src/Windows) builds and runs at least at
|
||||
a minimal level. I modified this driver to work with the new
|
||||
Mesa 4.0 code and driver architecture, but I did not do a great
|
||||
deal of optimization and testing. There are many opportunities
|
||||
for optimization, many of which can be done by coding more specific
|
||||
paths for the rasterizers. See src/osmesa/osmesa.c for some good
|
||||
examples.
|
||||
|
||||
- There is DirectDraw support in the Windows driver, but I do not
|
||||
know if it compiles or works. If you have an application that
|
||||
does not draw much in a frame, but needs a higher framerate, then
|
||||
it may pay to turn on the DirectDraw code, since DD often performs
|
||||
the off-screen to on-screen blit faster than GDI.
|
||||
|
||||
- Some of the more specialized code like FX drivers, stereo, and
|
||||
parallel support isn't compiled or tested. I left much of this
|
||||
code alone, but it may need some work to get it 'turned on' again.
|
||||
|
||||
- No assembly code is compiled or assembled. Again, this may need
|
||||
some work to turn it back on or use it again.
|
||||
|
||||
If you have a Windows-related build problem or question, it is
|
||||
probably better to direct it to me (kschultz@users.sourceforge.net),
|
||||
rather than directly to the other Mesa developers. I will help you
|
||||
as much as I can. I also monitor the Mesa mailing lists and will
|
||||
answer questions in this area there as well.
|
||||
|
||||
|
||||
Karl Schultz
|
||||
|
146
docs/README.WINDML
Normal file
146
docs/README.WINDML
Normal file
@@ -0,0 +1,146 @@
|
||||
|
||||
WindML Driver for Mesa 4.0
|
||||
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
Tornado 2 + WindML, Cumulative Patchs are recommended.
|
||||
|
||||
I suppose you have a valid WindML installation. Double buffer hardware
|
||||
gives better performance than double buffer software so if you can
|
||||
compile your WindML driver with this option, just do it. I/O
|
||||
redirection is adviced in target server.
|
||||
|
||||
|
||||
Tested on
|
||||
---------
|
||||
|
||||
During the development, my main target was a CoolMonster:
|
||||
- Video card: CT69000
|
||||
- CPU: PENTIUM 266MHz
|
||||
|
||||
and my host a Windows NT + Tornado 2.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
1. Mesa sources must be in root directory (C:\)
|
||||
|
||||
2. Add the following line to your torVars.bat:
|
||||
set MESA_BASE=C:\Mesa
|
||||
|
||||
OR copy the new torVars.bat in your bin path:
|
||||
c:/Mesa/src/ugl/tornado/torVars.sample ->
|
||||
/mnt/nt/Tornado/host/x86-win32/bin/torVars (for example)
|
||||
|
||||
3. In a command prompt:
|
||||
$ torVars
|
||||
$ cd c:\Mesa
|
||||
$ make -f Makefile.ugl CPU=PENTIUM
|
||||
|
||||
Take a long while...
|
||||
|
||||
5. Include all the files from ugldemos folder to build some downloadable
|
||||
application modules
|
||||
|
||||
4. Download UGL/Mesa object files on target
|
||||
|
||||
For example via the WindShell:
|
||||
ld < c:\Tornado\target\lib\objMesaGL.o
|
||||
ld < c:\Tornado\target\lib\objMesaUGL.o
|
||||
ld < c:\Tornado\target\lib\objMesaGLU.o
|
||||
ld < c:\Tornado\target\lib\objGLUTshapes.o
|
||||
ld < c:\Tornado\target\lib\objMesaOS.o
|
||||
|
||||
You can put the previous lines in a file and use:
|
||||
< filename
|
||||
|
||||
6. Download the application modules.
|
||||
|
||||
7. In WindShell, run:
|
||||
-> uglalldemos
|
||||
|
||||
During the show some messages will appear, it provides some useful
|
||||
information on key management.
|
||||
|
||||
|
||||
Coding
|
||||
------
|
||||
|
||||
Sample Usage:
|
||||
|
||||
In addition to the usual ugl calls to initialize UGL, (may be find an
|
||||
input driver), you must do the following to use the UGL/Mesa interface:
|
||||
|
||||
1. Call uglMesaCreateContext() to create a UGL/Mesa rendering context,
|
||||
given the display format.
|
||||
|
||||
2. Call uglMesaMakeCurrent() to bind the UGL/Mesa buffers to an
|
||||
UGL/Mesa Context and to make the context the current one.
|
||||
|
||||
3. Make gl* calls to render your graphics.
|
||||
|
||||
4. Use uglMesaSwapBuffers() when double buffering to swap front/back buffers.
|
||||
|
||||
5. Before the UGL is destroyed, call MesaDestroyContext().
|
||||
|
||||
6. Before exiting, call if required uglEventQDestroy and then
|
||||
uglDeinitialize();
|
||||
|
||||
Limitations
|
||||
-----------
|
||||
|
||||
I found the following limitations in my driver :
|
||||
- Color Indexed management is only in 8 bits
|
||||
- It's possible to mix UGL/OpenGL application with a software
|
||||
double buffer
|
||||
|
||||
Modifications
|
||||
------------
|
||||
|
||||
New files in Mesa:
|
||||
- Makefile.ugl
|
||||
- rules.windmlmesa
|
||||
- docs/README.UGL
|
||||
- include/GL/uglmesa.h
|
||||
- si-glu/Makefile.ugl
|
||||
- src/Makefile.ugl
|
||||
- src/ugl/torGLUTShapesInit.c
|
||||
- src/ugl/torMesaUGLInit.c
|
||||
- src/ugl/ugl_api.c
|
||||
- src/ugl/ugl_dd.c
|
||||
- src/ugl/ugl_glutshapes.c
|
||||
- src/ugl/ugl_line.c
|
||||
- src/ugl/ugl_span.c
|
||||
- src/ugl/ugl_tri.c
|
||||
- src/ugl/uglmesaP.h
|
||||
- ugldemos/*
|
||||
|
||||
Modified files in Tornado 2.0:
|
||||
- c:\Tornado\host\x86-win32\bin\torVars.bat
|
||||
rem Command line build environments
|
||||
set WIND_HOST_TYPE=x86-win32
|
||||
set WIND_BASE=C:\Tornado
|
||||
set MESA_BASE=C:\Mesa
|
||||
set PATH=%WIND_BASE%\host\%WIND_HOST_TYPE%\bin;%PATH%
|
||||
- c:\Tornado\target\config\comps\VxWorks\01uglmesa.cdf
|
||||
- c:\Tornado\target\h\GL\*
|
||||
|
||||
Todo
|
||||
----
|
||||
- GCC 2.96, ASM compilation
|
||||
|
||||
Thanks to:
|
||||
----------
|
||||
|
||||
Precision Insight team for their great job around Mesa, XFree, and DRI.
|
||||
Wind River Systems to take me as an intern.
|
||||
|
||||
|
||||
Stephane Raimbault
|
||||
<stephane.raimbault@windriver.com>
|
||||
<stephane.raimbault@deesse.univ-lemans.fr>
|
||||
|
||||
July 24, 2001
|
@@ -1,5 +1,5 @@
|
||||
|
||||
Mesa 3.5 Unix/X11 Information
|
||||
Mesa 4.0 Unix/X11 Information
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ There are two ways to compile Mesa on Unix/X11 systems:
|
||||
|
||||
|
||||
The top-level makefile will execute the makefiles in a number of sub-
|
||||
directories. When finished, the Mesa libraries will be in the Mesa-3.5/lib/
|
||||
directories. When finished, the Mesa libraries will be in the Mesa-4.0/lib/
|
||||
directory. A few GLUT demos in the demos/ directory should be ready to run.
|
||||
|
||||
If you also downloaded and unpacked the demos there should be executables
|
||||
@@ -323,4 +323,4 @@ Summary of X-related environment variables:
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
$Id: README.X11,v 3.6 2001/06/20 19:02:48 brianp Exp $
|
||||
$Id: README.X11,v 3.8 2001/09/23 16:10:02 brianp Exp $
|
||||
|
163
docs/RELNOTES-4.0
Normal file
163
docs/RELNOTES-4.0
Normal file
@@ -0,0 +1,163 @@
|
||||
|
||||
Mesa 4.0 release notes
|
||||
|
||||
October 18, 2001
|
||||
|
||||
PLEASE READ!!!!
|
||||
|
||||
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Mesa uses an even/odd version number scheme like the Linux kernel.
|
||||
Odd numbered versions (such as 3.3) designate new developmental releases.
|
||||
Even numbered versions (such as 3.4) designate stable releases.
|
||||
|
||||
Mesa version 4.0 signifies two things:
|
||||
|
||||
1. A stabilization of the 3.5 development release
|
||||
2. Implementation of the OpenGL 1.3 specification
|
||||
|
||||
|
||||
Note that the Mesa major version number is incremented with the OpenGL
|
||||
minor version number:
|
||||
|
||||
Mesa 1.x == OpenGL 1.0
|
||||
Mesa 2.x == OpenGL 1.1
|
||||
Mesa 3.x == OpenGL 1.2
|
||||
Mesa 4.x == OpenGL 1.3
|
||||
|
||||
|
||||
|
||||
New Features
|
||||
------------
|
||||
|
||||
Mesa 3.5 already had all the new features of OpenGL 1.3, implemented as
|
||||
extensions. These extensions were simply promoted to standard features:
|
||||
|
||||
GL_ARB_multisample
|
||||
GL_ARB_multitexture
|
||||
GL_ARB_texture_border_clamp
|
||||
GL_ARB_texture_compression
|
||||
GL_ARB_texture_cube_map
|
||||
GL_ARB_texture_env_add
|
||||
GL_ARB_texture_env_combine
|
||||
GL_ARB_texture_env_dot3
|
||||
GL_ARB_transpose_matrix
|
||||
|
||||
In Mesa 4.0 the functions defined by these extensions are now available
|
||||
without the "ARB" suffix. For example, glLoadTransposeMatrixf() is now
|
||||
a standard API function. The new functions in OpenGL 1.3 and Mesa 4.0 are:
|
||||
|
||||
glActiveTexture
|
||||
glClientActiveTexture
|
||||
glCompressedTexImage1D
|
||||
glCompressedTexImage2D
|
||||
glCompressedTexImage3D
|
||||
glCompressedTexSubImage1D
|
||||
glCompressedTexSubImage2D
|
||||
glCompressedTexSubImage3D
|
||||
glGetCompressedTexImage
|
||||
glLoadTransposeMatrixd
|
||||
glLoadTransposeMatrixf
|
||||
glMultiTexCoord1d
|
||||
glMultiTexCoord1dv
|
||||
glMultiTexCoord1f
|
||||
glMultiTexCoord1fv
|
||||
glMultiTexCoord1i
|
||||
glMultiTexCoord1iv
|
||||
glMultiTexCoord1s
|
||||
glMultiTexCoord1sv
|
||||
glMultiTexCoord2d
|
||||
glMultiTexCoord2dv
|
||||
glMultiTexCoord2f
|
||||
glMultiTexCoord2fv
|
||||
glMultiTexCoord2i
|
||||
glMultiTexCoord2iv
|
||||
glMultiTexCoord2s
|
||||
glMultiTexCoord2sv
|
||||
glMultiTexCoord3d
|
||||
glMultiTexCoord3dv
|
||||
glMultiTexCoord3f
|
||||
glMultiTexCoord3fv
|
||||
glMultiTexCoord3i
|
||||
glMultiTexCoord3iv
|
||||
glMultiTexCoord3s
|
||||
glMultiTexCoord3sv
|
||||
glMultiTexCoord4d
|
||||
glMultiTexCoord4dv
|
||||
glMultiTexCoord4f
|
||||
glMultiTexCoord4fv
|
||||
glMultiTexCoord4i
|
||||
glMultiTexCoord4iv
|
||||
glMultiTexCoord4s
|
||||
glMultiTexCoord4sv
|
||||
glMultTransposeMatrixd
|
||||
glMultTransposeMatrixf
|
||||
glSampleCoverage
|
||||
glSamplePass
|
||||
|
||||
|
||||
GLX 1.4 is the companion to OpenGL 1.3. The only new features in GLX 1.4
|
||||
are support for multisampling and the GLX_ARB_get_proc_address extension.
|
||||
glXGetProcAddress() is the only new function in GLX 1.4.
|
||||
|
||||
|
||||
|
||||
Multisample and Texture Compression
|
||||
-----------------------------------
|
||||
|
||||
The OpenGL 1.3 specification allows the multisample and texture compression
|
||||
features to essentially be no-ops. For example, if you query for multisample
|
||||
support you'll find none, but the API functions work.
|
||||
|
||||
Similarly, texture compression is not implemented by any of the software
|
||||
drivers but you can specify a generic compressed texture format (like
|
||||
GL_COMPRESSED_RGBA) to glTexImage2D and it'll be accepted.
|
||||
|
||||
|
||||
|
||||
Device Drivers
|
||||
--------------
|
||||
|
||||
Mesa advertises itself as either OpenGL 1.2 or OpenGL 1.3 depending on the
|
||||
device driver. If the driver enables all the ARB extensions which are part
|
||||
of OpenGL 1.3 then glGetString(GL_VERSION) will return "1.3". Otherwise,
|
||||
it'll return "1.2".
|
||||
|
||||
A number of Mesa's software drivers haven't been actively maintained for
|
||||
some time. We rely on volunteers to maintain many of the drivers.
|
||||
Here's the current status of all included drivers:
|
||||
|
||||
|
||||
Driver Status
|
||||
---------------------- ---------------------
|
||||
XMesa (Xlib) implements OpenGL 1.3
|
||||
OSMesa (off-screen) implements OpenGL 1.3
|
||||
FX (3dfx Voodoo1/2) implements OpenGL 1.3
|
||||
SVGA implements OpenGL 1.3
|
||||
Wind River UGL implements OpenGL 1.3
|
||||
Windows/Win32 implements OpenGL 1.3
|
||||
GGI needs updating
|
||||
DOS/DJGPP needs updating
|
||||
BeOS needs updating
|
||||
Allegro needs updating
|
||||
D3D needs updating
|
||||
DOS needs updating
|
||||
|
||||
Special thanks go to Karl Schultz for updating the Windows driver.
|
||||
|
||||
The XFree86/DRI drivers have not yet been updated to use Mesa 4.0 as of
|
||||
September 2001, but that should happen eventually.
|
||||
|
||||
|
||||
|
||||
Other Changes
|
||||
-------------
|
||||
|
||||
See the VERSIONS file for more details about bug fixes, etc. in Mesa 4.0.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
$Id: RELNOTES-4.0,v 3.2 2001/10/17 14:59:21 brianp Exp $
|
@@ -1,4 +1,4 @@
|
||||
$Id: VERSIONS,v 1.60 2001/06/20 19:02:48 brianp Exp $
|
||||
$Id: VERSIONS,v 1.73 2001/10/22 16:04:46 brianp Exp $
|
||||
|
||||
|
||||
Mesa Version History
|
||||
@@ -867,3 +867,33 @@ Mesa Version History
|
||||
Changes:
|
||||
- SGI's Sample Implementation (SI) 1.3 GLU library replaces Mesa GLU
|
||||
- new libOSMesa.so library, contains the OSMesa driver interface
|
||||
|
||||
|
||||
4.0 October 22, 2001
|
||||
New:
|
||||
- Mesa 4.0 implements the OpenGL 1.3 specification
|
||||
- GL_IBM_rasterpos_clip extension
|
||||
- GL_EXT_texture_edge_clamp extension (aka GL_SGIS_texture_edge_clamp)
|
||||
- GL_ARB_texture_mirrored_repeat extension
|
||||
- WindML UGL driver (Stephane Raimbault)
|
||||
- added OSMESA_MAX_WIDTH/HEIGHT queries
|
||||
- attempted compiliation fixes for Solaris 5, 7 and 8
|
||||
- updated glext.h and glxext.h files
|
||||
- updated Windows driver (Karl Schultz)
|
||||
Bug fixes:
|
||||
- added some missing GLX 1.3 tokens to include/GL/glx.h
|
||||
- GL_COLOR_MATRIX changes weren't recognized by teximage functions
|
||||
- glCopyPixels with scale and bias was broken
|
||||
- glRasterPos with lighting could segfault
|
||||
- glDeleteTextures could leave a dangling pointer
|
||||
- Proxy textures for cube maps didn't work
|
||||
- fixed a number of 16-bit color channel bugs
|
||||
- fixed a few minor memory leaks
|
||||
- GLX context sharing was broken in 3.5
|
||||
- fixed state-update bugs in glPopClientAttrib()
|
||||
- fixed glDrawRangeElements() bug
|
||||
- fixed a glPush/PopAttrib() bug related to texture binding
|
||||
- flat-shaded, textured lines were broken
|
||||
- fixed a dangling pointer problem in the XMesa code (Chris Burghart)
|
||||
- lighting didn't always produce the correct alpha value
|
||||
- fixed 3DNow! code to not read past end of arrays (Andrew Lewycky)
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: fxmesa.h,v 1.3 2001/06/20 19:52:11 brianp Exp $ */
|
||||
/* $Id: fxmesa.h,v 1.4 2001/09/23 16:06:13 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 4.0
|
||||
* Copyright (C) 1995-2001 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@@ -40,8 +40,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define FXMESA_MAJOR_VERSION 3
|
||||
#define FXMESA_MINOR_VERSION 5
|
||||
#define FXMESA_MAJOR_VERSION 4
|
||||
#define FXMESA_MINOR_VERSION 0
|
||||
|
||||
|
||||
/*
|
||||
|
340
include/GL/gl.h
340
include/GL/gl.h
@@ -1,10 +1,10 @@
|
||||
/* $Id: gl.h,v 1.57 2001/06/14 21:37:43 brianp Exp $ */
|
||||
/* $Id: gl.h,v 1.59 2001/09/23 16:06:13 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
* Version: 4.0
|
||||
*
|
||||
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2001 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"),
|
||||
@@ -84,6 +84,7 @@ extern "C" {
|
||||
|
||||
#define GL_VERSION_1_1 1
|
||||
#define GL_VERSION_1_2 1
|
||||
/*#define GL_VERSION_1_3 1 not yet */
|
||||
#define GL_ARB_imaging 1
|
||||
|
||||
|
||||
@@ -637,7 +638,46 @@ typedef double GLclampd; /* double precision float in [0,1] */
|
||||
#define GL_TEXTURE_GEN_R 0x0C62
|
||||
#define GL_TEXTURE_GEN_Q 0x0C63
|
||||
|
||||
/* GL 1.1 texturing */
|
||||
/* Utility */
|
||||
#define GL_VENDOR 0x1F00
|
||||
#define GL_RENDERER 0x1F01
|
||||
#define GL_VERSION 0x1F02
|
||||
#define GL_EXTENSIONS 0x1F03
|
||||
|
||||
/* Errors */
|
||||
#define GL_NO_ERROR 0x0
|
||||
#define GL_INVALID_VALUE 0x0501
|
||||
#define GL_INVALID_ENUM 0x0500
|
||||
#define GL_INVALID_OPERATION 0x0502
|
||||
#define GL_STACK_OVERFLOW 0x0503
|
||||
#define GL_STACK_UNDERFLOW 0x0504
|
||||
#define GL_OUT_OF_MEMORY 0x0505
|
||||
|
||||
/* glPush/PopAttrib bits */
|
||||
#define GL_CURRENT_BIT 0x00000001
|
||||
#define GL_POINT_BIT 0x00000002
|
||||
#define GL_LINE_BIT 0x00000004
|
||||
#define GL_POLYGON_BIT 0x00000008
|
||||
#define GL_POLYGON_STIPPLE_BIT 0x00000010
|
||||
#define GL_PIXEL_MODE_BIT 0x00000020
|
||||
#define GL_LIGHTING_BIT 0x00000040
|
||||
#define GL_FOG_BIT 0x00000080
|
||||
#define GL_DEPTH_BUFFER_BIT 0x00000100
|
||||
#define GL_ACCUM_BUFFER_BIT 0x00000200
|
||||
#define GL_STENCIL_BUFFER_BIT 0x00000400
|
||||
#define GL_VIEWPORT_BIT 0x00000800
|
||||
#define GL_TRANSFORM_BIT 0x00001000
|
||||
#define GL_ENABLE_BIT 0x00002000
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
#define GL_HINT_BIT 0x00008000
|
||||
#define GL_EVAL_BIT 0x00010000
|
||||
#define GL_LIST_BIT 0x00020000
|
||||
#define GL_TEXTURE_BIT 0x00040000
|
||||
#define GL_SCISSOR_BIT 0x00080000
|
||||
#define GL_ALL_ATTRIB_BITS 0x000FFFFF
|
||||
|
||||
|
||||
/* OpenGL 1.1 */
|
||||
#define GL_PROXY_TEXTURE_1D 0x8063
|
||||
#define GL_PROXY_TEXTURE_2D 0x8064
|
||||
#define GL_TEXTURE_PRIORITY 0x8066
|
||||
@@ -645,20 +685,6 @@ typedef double GLclampd; /* double precision float in [0,1] */
|
||||
#define GL_TEXTURE_BINDING_1D 0x8068
|
||||
#define GL_TEXTURE_BINDING_2D 0x8069
|
||||
#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
|
||||
|
||||
/* GL 1.2 texturing */
|
||||
#define GL_PACK_SKIP_IMAGES 0x806B
|
||||
#define GL_PACK_IMAGE_HEIGHT 0x806C
|
||||
#define GL_UNPACK_SKIP_IMAGES 0x806D
|
||||
#define GL_UNPACK_IMAGE_HEIGHT 0x806E
|
||||
#define GL_TEXTURE_3D 0x806F
|
||||
#define GL_PROXY_TEXTURE_3D 0x8070
|
||||
#define GL_TEXTURE_DEPTH 0x8071
|
||||
#define GL_TEXTURE_WRAP_R 0x8072
|
||||
#define GL_MAX_3D_TEXTURE_SIZE 0x8073
|
||||
#define GL_TEXTURE_BINDING_3D 0x806A
|
||||
|
||||
/* Internal texture formats (GL 1.1) */
|
||||
#define GL_ALPHA4 0x803B
|
||||
#define GL_ALPHA8 0x803C
|
||||
#define GL_ALPHA12 0x803D
|
||||
@@ -692,21 +718,10 @@ typedef double GLclampd; /* double precision float in [0,1] */
|
||||
#define GL_RGB10_A2 0x8059
|
||||
#define GL_RGBA12 0x805A
|
||||
#define GL_RGBA16 0x805B
|
||||
|
||||
/* Utility */
|
||||
#define GL_VENDOR 0x1F00
|
||||
#define GL_RENDERER 0x1F01
|
||||
#define GL_VERSION 0x1F02
|
||||
#define GL_EXTENSIONS 0x1F03
|
||||
|
||||
/* Errors */
|
||||
#define GL_NO_ERROR 0x0
|
||||
#define GL_INVALID_VALUE 0x0501
|
||||
#define GL_INVALID_ENUM 0x0500
|
||||
#define GL_INVALID_OPERATION 0x0502
|
||||
#define GL_STACK_OVERFLOW 0x0503
|
||||
#define GL_STACK_UNDERFLOW 0x0504
|
||||
#define GL_OUT_OF_MEMORY 0x0505
|
||||
#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001
|
||||
#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
|
||||
#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF
|
||||
#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF
|
||||
|
||||
|
||||
/* OpenGL 1.2 */
|
||||
@@ -741,7 +756,16 @@ typedef double GLclampd; /* double precision float in [0,1] */
|
||||
#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
|
||||
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
|
||||
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
|
||||
|
||||
#define GL_PACK_SKIP_IMAGES 0x806B
|
||||
#define GL_PACK_IMAGE_HEIGHT 0x806C
|
||||
#define GL_UNPACK_SKIP_IMAGES 0x806D
|
||||
#define GL_UNPACK_IMAGE_HEIGHT 0x806E
|
||||
#define GL_TEXTURE_3D 0x806F
|
||||
#define GL_PROXY_TEXTURE_3D 0x8070
|
||||
#define GL_TEXTURE_DEPTH 0x8071
|
||||
#define GL_TEXTURE_WRAP_R 0x8072
|
||||
#define GL_MAX_3D_TEXTURE_SIZE 0x8073
|
||||
#define GL_TEXTURE_BINDING_3D 0x806A
|
||||
|
||||
|
||||
/*
|
||||
@@ -822,38 +846,114 @@ typedef double GLclampd; /* double precision float in [0,1] */
|
||||
#define GL_FUNC_ADD 0x8006
|
||||
#define GL_FUNC_SUBTRACT 0x800A
|
||||
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
|
||||
#define GL_BLEND_COLOR 0x8005
|
||||
#define GL_BLEND_COLOR 0x8005
|
||||
|
||||
|
||||
/* glPush/PopAttrib bits */
|
||||
#define GL_CURRENT_BIT 0x00000001
|
||||
#define GL_POINT_BIT 0x00000002
|
||||
#define GL_LINE_BIT 0x00000004
|
||||
#define GL_POLYGON_BIT 0x00000008
|
||||
#define GL_POLYGON_STIPPLE_BIT 0x00000010
|
||||
#define GL_PIXEL_MODE_BIT 0x00000020
|
||||
#define GL_LIGHTING_BIT 0x00000040
|
||||
#define GL_FOG_BIT 0x00000080
|
||||
#define GL_DEPTH_BUFFER_BIT 0x00000100
|
||||
#define GL_ACCUM_BUFFER_BIT 0x00000200
|
||||
#define GL_STENCIL_BUFFER_BIT 0x00000400
|
||||
#define GL_VIEWPORT_BIT 0x00000800
|
||||
#define GL_TRANSFORM_BIT 0x00001000
|
||||
#define GL_ENABLE_BIT 0x00002000
|
||||
#define GL_COLOR_BUFFER_BIT 0x00004000
|
||||
#define GL_HINT_BIT 0x00008000
|
||||
#define GL_EVAL_BIT 0x00010000
|
||||
#define GL_LIST_BIT 0x00020000
|
||||
#define GL_TEXTURE_BIT 0x00040000
|
||||
#define GL_SCISSOR_BIT 0x00080000
|
||||
#define GL_ALL_ATTRIB_BITS 0x000FFFFF
|
||||
|
||||
|
||||
#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001
|
||||
#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002
|
||||
#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF
|
||||
#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF
|
||||
|
||||
/* OpenGL 1.3 */
|
||||
/* multitexture */
|
||||
#define GL_TEXTURE0 0x84C0
|
||||
#define GL_TEXTURE1 0x84C1
|
||||
#define GL_TEXTURE2 0x84C2
|
||||
#define GL_TEXTURE3 0x84C3
|
||||
#define GL_TEXTURE4 0x84C4
|
||||
#define GL_TEXTURE5 0x84C5
|
||||
#define GL_TEXTURE6 0x84C6
|
||||
#define GL_TEXTURE7 0x84C7
|
||||
#define GL_TEXTURE8 0x84C8
|
||||
#define GL_TEXTURE9 0x84C9
|
||||
#define GL_TEXTURE10 0x84CA
|
||||
#define GL_TEXTURE11 0x84CB
|
||||
#define GL_TEXTURE12 0x84CC
|
||||
#define GL_TEXTURE13 0x84CD
|
||||
#define GL_TEXTURE14 0x84CE
|
||||
#define GL_TEXTURE15 0x84CF
|
||||
#define GL_TEXTURE16 0x84D0
|
||||
#define GL_TEXTURE17 0x84D1
|
||||
#define GL_TEXTURE18 0x84D2
|
||||
#define GL_TEXTURE19 0x84D3
|
||||
#define GL_TEXTURE20 0x84D4
|
||||
#define GL_TEXTURE21 0x84D5
|
||||
#define GL_TEXTURE22 0x84D6
|
||||
#define GL_TEXTURE23 0x84D7
|
||||
#define GL_TEXTURE24 0x84D8
|
||||
#define GL_TEXTURE25 0x84D9
|
||||
#define GL_TEXTURE26 0x84DA
|
||||
#define GL_TEXTURE27 0x84DB
|
||||
#define GL_TEXTURE28 0x84DC
|
||||
#define GL_TEXTURE29 0x84DD
|
||||
#define GL_TEXTURE30 0x84DE
|
||||
#define GL_TEXTURE31 0x84DF
|
||||
#define GL_ACTIVE_TEXTURE 0x84E0
|
||||
#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
|
||||
#define GL_MAX_TEXTURE_UNITS 0x84E2
|
||||
/* texture_cube_map */
|
||||
#define GL_NORMAL_MAP 0x8511
|
||||
#define GL_REFLECTION_MAP 0x8512
|
||||
#define GL_TEXTURE_CUBE_MAP 0x8513
|
||||
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
|
||||
#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
|
||||
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
|
||||
/* texture_compression */
|
||||
#define GL_COMPRESSED_ALPHA 0x84E9
|
||||
#define GL_COMPRESSED_LUMINANCE 0x84EA
|
||||
#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
|
||||
#define GL_COMPRESSED_INTENSITY 0x84EC
|
||||
#define GL_COMPRESSED_RGB 0x84ED
|
||||
#define GL_COMPRESSED_RGBA 0x84EE
|
||||
#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
|
||||
#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
|
||||
#define GL_TEXTURE_COMPRESSED 0x86A1
|
||||
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
|
||||
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
|
||||
/* multisample */
|
||||
#define GL_MULTISAMPLE 0x809D
|
||||
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
|
||||
#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
|
||||
#define GL_SAMPLE_COVERAGE 0x80A0
|
||||
#define GL_SAMPLE_BUFFERS 0x80A8
|
||||
#define GL_SAMPLES 0x80A9
|
||||
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
|
||||
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
|
||||
#define GL_MULTISAMPLE_BIT 0x20000000
|
||||
/* transpose_matrix */
|
||||
#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
|
||||
#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
|
||||
#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
|
||||
#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
|
||||
/* texture_env_combine */
|
||||
#define GL_COMBINE 0x8570
|
||||
#define GL_COMBINE_RGB 0x8571
|
||||
#define GL_COMBINE_ALPHA 0x8572
|
||||
#define GL_SOURCE0_RGB 0x8580
|
||||
#define GL_SOURCE1_RGB 0x8581
|
||||
#define GL_SOURCE2_RGB 0x8582
|
||||
#define GL_SOURCE0_ALPHA 0x8588
|
||||
#define GL_SOURCE1_ALPHA 0x8589
|
||||
#define GL_SOURCE2_ALPHA 0x858A
|
||||
#define GL_OPERAND0_RGB 0x8590
|
||||
#define GL_OPERAND1_RGB 0x8591
|
||||
#define GL_OPERAND2_RGB 0x8592
|
||||
#define GL_OPERAND0_ALPHA 0x8598
|
||||
#define GL_OPERAND1_ALPHA 0x8599
|
||||
#define GL_OPERAND2_ALPHA 0x859A
|
||||
#define GL_RGB_SCALE 0x8573
|
||||
#define GL_ADD_SIGNED 0x8574
|
||||
#define GL_INTERPOLATE 0x8575
|
||||
#define GL_SUBTRACT 0x84E7
|
||||
#define GL_CONSTANT 0x8576
|
||||
#define GL_PRIMARY_COLOR 0x8577
|
||||
#define GL_PREVIOUS 0x8578
|
||||
/* texture_env_dot3 */
|
||||
#define GL_DOT3_RGB 0x86AE
|
||||
#define GL_DOT3_RGBA 0x86AF
|
||||
/* texture_border_clamp */
|
||||
#define GL_CLAMP_TO_BORDER 0x812D
|
||||
|
||||
|
||||
|
||||
@@ -868,17 +968,13 @@ typedef double GLclampd; /* double precision float in [0,1] */
|
||||
|
||||
GLAPI void GLAPIENTRY glClearIndex( GLfloat c );
|
||||
|
||||
GLAPI void GLAPIENTRY glClearColor( GLclampf red,
|
||||
GLclampf green,
|
||||
GLclampf blue,
|
||||
GLclampf alpha );
|
||||
GLAPI void GLAPIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
|
||||
|
||||
GLAPI void GLAPIENTRY glClear( GLbitfield mask );
|
||||
|
||||
GLAPI void GLAPIENTRY glIndexMask( GLuint mask );
|
||||
|
||||
GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green,
|
||||
GLboolean blue, GLboolean alpha );
|
||||
GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
|
||||
|
||||
GLAPI void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref );
|
||||
|
||||
@@ -908,8 +1004,7 @@ GLAPI void GLAPIENTRY glEdgeFlag( GLboolean flag );
|
||||
|
||||
GLAPI void GLAPIENTRY glEdgeFlagv( const GLboolean *flag );
|
||||
|
||||
GLAPI void GLAPIENTRY glScissor( GLint x, GLint y,
|
||||
GLsizei width, GLsizei height);
|
||||
GLAPI void GLAPIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
GLAPI void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation );
|
||||
|
||||
@@ -981,8 +1076,7 @@ GLAPI void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val );
|
||||
* Accumulation Buffer
|
||||
*/
|
||||
|
||||
GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green,
|
||||
GLfloat blue, GLfloat alpha );
|
||||
GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
|
||||
|
||||
GLAPI void GLAPIENTRY glAccum( GLenum op, GLfloat value );
|
||||
|
||||
@@ -1723,6 +1817,104 @@ GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format,
|
||||
|
||||
|
||||
|
||||
/* 1.3 functions */
|
||||
|
||||
GLAPI void GLAPIENTRY glActiveTexture( GLenum texture );
|
||||
|
||||
GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture );
|
||||
|
||||
GLAPI void GLAPIENTRY glCompressedTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data );
|
||||
|
||||
GLAPI void GLAPIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data );
|
||||
|
||||
GLAPI void GLAPIENTRY glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data );
|
||||
|
||||
GLAPI void GLAPIENTRY glCompressedTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data );
|
||||
|
||||
GLAPI void GLAPIENTRY glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data );
|
||||
|
||||
GLAPI void GLAPIENTRY glCompressedTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data );
|
||||
|
||||
GLAPI void GLAPIENTRY glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord1d( GLenum target, GLdouble s );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord1dv( GLenum target, const GLdouble *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord1f( GLenum target, GLfloat s );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord1fv( GLenum target, const GLfloat *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord1i( GLenum target, GLint s );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord1iv( GLenum target, const GLint *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord1s( GLenum target, GLshort s );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord1sv( GLenum target, const GLshort *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord2d( GLenum target, GLdouble s, GLdouble t );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord2dv( GLenum target, const GLdouble *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord2f( GLenum target, GLfloat s, GLfloat t );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord2fv( GLenum target, const GLfloat *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord2i( GLenum target, GLint s, GLint t );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord2iv( GLenum target, const GLint *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord2s( GLenum target, GLshort s, GLshort t );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord2sv( GLenum target, const GLshort *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord3d( GLenum target, GLdouble s, GLdouble t, GLdouble r );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord3dv( GLenum target, const GLdouble *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t, GLfloat r );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord3fv( GLenum target, const GLfloat *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord3i( GLenum target, GLint s, GLint t, GLint r );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord3iv( GLenum target, const GLint *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord3s( GLenum target, GLshort s, GLshort t, GLshort r );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord3sv( GLenum target, const GLshort *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord4d( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord4dv( GLenum target, const GLdouble *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord4fv( GLenum target, const GLfloat *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord4i( GLenum target, GLint s, GLint t, GLint r, GLint q );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord4iv( GLenum target, const GLint *v );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord4s( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord4sv( GLenum target, const GLshort *v );
|
||||
|
||||
|
||||
GLAPI void GLAPIENTRY glLoadTransposeMatrixd( const GLdouble m[16] );
|
||||
|
||||
GLAPI void GLAPIENTRY glLoadTransposeMatrixf( const GLfloat m[16] );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultTransposeMatrixd( const GLdouble m[16] );
|
||||
|
||||
GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] );
|
||||
|
||||
GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert );
|
||||
|
||||
GLAPI void GLAPIENTRY glSamplePass( GLenum pass );
|
||||
|
||||
|
||||
/*
|
||||
* GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1)
|
||||
*/
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: gl_mangle.h,v 1.6 2001/04/19 22:33:03 brianp Exp $ */
|
||||
/* $Id: gl_mangle.h,v 1.7 2001/09/21 17:23:30 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -676,4 +676,10 @@
|
||||
#define glSecondaryColor3usEXT mglSecondaryColor3usEXT
|
||||
#define glSecondaryColor3sEXT mglSecondaryColor3sEXT
|
||||
|
||||
|
||||
/* Internal symbols which may collide with other OpenGL implementations. */
|
||||
#define __glCoreCreateContext __mglCoreCreateContext
|
||||
#define __glCoreNopDispatch __mglCoreNopDispatch
|
||||
|
||||
|
||||
#endif
|
||||
|
2304
include/GL/glext.h
2304
include/GL/glext.h
File diff suppressed because it is too large
Load Diff
124
include/GL/glu.h
124
include/GL/glu.h
@@ -30,6 +30,10 @@
|
||||
#ifndef __glu_h__
|
||||
#define __glu_h__
|
||||
|
||||
#if defined(USE_MGL_NAMESPACE)
|
||||
#include "glu_mangle.h"
|
||||
#endif
|
||||
|
||||
#include <GL/gl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -254,67 +258,67 @@ typedef struct GLUtesselator GLUtriangulatorObj;
|
||||
#define GLU_TESS_MAX_COORD 1.0e150
|
||||
|
||||
/* Internal convenience typedefs */
|
||||
typedef void (*_GLUfuncptr)();
|
||||
typedef void (GLAPIENTRY *_GLUfuncptr)();
|
||||
|
||||
extern void gluBeginCurve (GLUnurbs* nurb);
|
||||
extern void gluBeginPolygon (GLUtesselator* tess);
|
||||
extern void gluBeginSurface (GLUnurbs* nurb);
|
||||
extern void gluBeginTrim (GLUnurbs* nurb);
|
||||
extern GLint gluBuild1DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
|
||||
extern GLint gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *data);
|
||||
extern GLint gluBuild2DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
|
||||
extern GLint gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
|
||||
extern GLint gluBuild3DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
|
||||
extern GLint gluBuild3DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
|
||||
extern GLboolean gluCheckExtension (const GLubyte *extName, const GLubyte *extString);
|
||||
extern void gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks);
|
||||
extern void gluDeleteNurbsRenderer (GLUnurbs* nurb);
|
||||
extern void gluDeleteQuadric (GLUquadric* quad);
|
||||
extern void gluDeleteTess (GLUtesselator* tess);
|
||||
extern void gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops);
|
||||
extern void gluEndCurve (GLUnurbs* nurb);
|
||||
extern void gluEndPolygon (GLUtesselator* tess);
|
||||
extern void gluEndSurface (GLUnurbs* nurb);
|
||||
extern void gluEndTrim (GLUnurbs* nurb);
|
||||
extern const GLubyte * gluErrorString (GLenum error);
|
||||
extern void gluGetNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat* data);
|
||||
extern const GLubyte * gluGetString (GLenum name);
|
||||
extern void gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data);
|
||||
extern void gluLoadSamplingMatrices (GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view);
|
||||
extern void gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ);
|
||||
extern GLUnurbs* gluNewNurbsRenderer (void);
|
||||
extern GLUquadric* gluNewQuadric (void);
|
||||
extern GLUtesselator* gluNewTess (void);
|
||||
extern void gluNextContour (GLUtesselator* tess, GLenum type);
|
||||
extern void gluNurbsCallback (GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc);
|
||||
extern void gluNurbsCallbackData (GLUnurbs* nurb, GLvoid* userData);
|
||||
extern void gluNurbsCallbackDataEXT (GLUnurbs* nurb, GLvoid* userData);
|
||||
extern void gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type);
|
||||
extern void gluNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat value);
|
||||
extern void gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type);
|
||||
extern void gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top);
|
||||
extern void gluPartialDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep);
|
||||
extern void gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
|
||||
extern void gluPickMatrix (GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport);
|
||||
extern GLint gluProject (GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ);
|
||||
extern void gluPwlCurve (GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type);
|
||||
extern void gluQuadricCallback (GLUquadric* quad, GLenum which, _GLUfuncptr CallBackFunc);
|
||||
extern void gluQuadricDrawStyle (GLUquadric* quad, GLenum draw);
|
||||
extern void gluQuadricNormals (GLUquadric* quad, GLenum normal);
|
||||
extern void gluQuadricOrientation (GLUquadric* quad, GLenum orientation);
|
||||
extern void gluQuadricTexture (GLUquadric* quad, GLboolean texture);
|
||||
extern GLint gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut);
|
||||
extern void gluSphere (GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks);
|
||||
extern void gluTessBeginContour (GLUtesselator* tess);
|
||||
extern void gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data);
|
||||
extern void gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
|
||||
extern void gluTessEndContour (GLUtesselator* tess);
|
||||
extern void gluTessEndPolygon (GLUtesselator* tess);
|
||||
extern void gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
|
||||
extern void gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data);
|
||||
extern void gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data);
|
||||
extern GLint gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ);
|
||||
extern GLint gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble near, GLdouble far, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW);
|
||||
GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb);
|
||||
GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess);
|
||||
GLAPI void GLAPIENTRY gluBeginSurface (GLUnurbs* nurb);
|
||||
GLAPI void GLAPIENTRY gluBeginTrim (GLUnurbs* nurb);
|
||||
GLAPI GLint GLAPIENTRY gluBuild1DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
|
||||
GLAPI GLint GLAPIENTRY gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *data);
|
||||
GLAPI GLint GLAPIENTRY gluBuild2DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
|
||||
GLAPI GLint GLAPIENTRY gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data);
|
||||
GLAPI GLint GLAPIENTRY gluBuild3DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data);
|
||||
GLAPI GLint GLAPIENTRY gluBuild3DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
|
||||
GLAPI GLboolean GLAPIENTRY gluCheckExtension (const GLubyte *extName, const GLubyte *extString);
|
||||
GLAPI void GLAPIENTRY gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks);
|
||||
GLAPI void GLAPIENTRY gluDeleteNurbsRenderer (GLUnurbs* nurb);
|
||||
GLAPI void GLAPIENTRY gluDeleteQuadric (GLUquadric* quad);
|
||||
GLAPI void GLAPIENTRY gluDeleteTess (GLUtesselator* tess);
|
||||
GLAPI void GLAPIENTRY gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops);
|
||||
GLAPI void GLAPIENTRY gluEndCurve (GLUnurbs* nurb);
|
||||
GLAPI void GLAPIENTRY gluEndPolygon (GLUtesselator* tess);
|
||||
GLAPI void GLAPIENTRY gluEndSurface (GLUnurbs* nurb);
|
||||
GLAPI void GLAPIENTRY gluEndTrim (GLUnurbs* nurb);
|
||||
GLAPI const GLubyte * GLAPIENTRY gluErrorString (GLenum error);
|
||||
GLAPI void GLAPIENTRY gluGetNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat* data);
|
||||
GLAPI const GLubyte * GLAPIENTRY gluGetString (GLenum name);
|
||||
GLAPI void GLAPIENTRY gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data);
|
||||
GLAPI void GLAPIENTRY gluLoadSamplingMatrices (GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view);
|
||||
GLAPI void GLAPIENTRY gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ);
|
||||
GLAPI GLUnurbs* GLAPIENTRY gluNewNurbsRenderer (void);
|
||||
GLAPI GLUquadric* GLAPIENTRY gluNewQuadric (void);
|
||||
GLAPI GLUtesselator* GLAPIENTRY gluNewTess (void);
|
||||
GLAPI void GLAPIENTRY gluNextContour (GLUtesselator* tess, GLenum type);
|
||||
GLAPI void GLAPIENTRY gluNurbsCallback (GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc);
|
||||
GLAPI void GLAPIENTRY gluNurbsCallbackData (GLUnurbs* nurb, GLvoid* userData);
|
||||
GLAPI void GLAPIENTRY gluNurbsCallbackDataEXT (GLUnurbs* nurb, GLvoid* userData);
|
||||
GLAPI void GLAPIENTRY gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type);
|
||||
GLAPI void GLAPIENTRY gluNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat value);
|
||||
GLAPI void GLAPIENTRY gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type);
|
||||
GLAPI void GLAPIENTRY gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top);
|
||||
GLAPI void GLAPIENTRY gluPartialDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep);
|
||||
GLAPI void GLAPIENTRY gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar);
|
||||
GLAPI void GLAPIENTRY gluPickMatrix (GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport);
|
||||
GLAPI GLint GLAPIENTRY gluProject (GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ);
|
||||
GLAPI void GLAPIENTRY gluPwlCurve (GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type);
|
||||
GLAPI void GLAPIENTRY gluQuadricCallback (GLUquadric* quad, GLenum which, _GLUfuncptr CallBackFunc);
|
||||
GLAPI void GLAPIENTRY gluQuadricDrawStyle (GLUquadric* quad, GLenum draw);
|
||||
GLAPI void GLAPIENTRY gluQuadricNormals (GLUquadric* quad, GLenum normal);
|
||||
GLAPI void GLAPIENTRY gluQuadricOrientation (GLUquadric* quad, GLenum orientation);
|
||||
GLAPI void GLAPIENTRY gluQuadricTexture (GLUquadric* quad, GLboolean texture);
|
||||
GLAPI GLint GLAPIENTRY gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut);
|
||||
GLAPI void GLAPIENTRY gluSphere (GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks);
|
||||
GLAPI void GLAPIENTRY gluTessBeginContour (GLUtesselator* tess);
|
||||
GLAPI void GLAPIENTRY gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data);
|
||||
GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc);
|
||||
GLAPI void GLAPIENTRY gluTessEndContour (GLUtesselator* tess);
|
||||
GLAPI void GLAPIENTRY gluTessEndPolygon (GLUtesselator* tess);
|
||||
GLAPI void GLAPIENTRY gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ);
|
||||
GLAPI void GLAPIENTRY gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data);
|
||||
GLAPI void GLAPIENTRY gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data);
|
||||
GLAPI GLint GLAPIENTRY gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ);
|
||||
GLAPI GLint GLAPIENTRY gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: glu_mangle.h,v 1.2 1999/09/10 02:08:19 gareth Exp $ */
|
||||
/* $Id: glu_mangle.h,v 1.3 2001/09/20 22:18:47 kschultz Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -23,6 +23,9 @@
|
||||
|
||||
/*
|
||||
* $Log: glu_mangle.h,v $
|
||||
* Revision 1.3 2001/09/20 22:18:47 kschultz
|
||||
* add mangling for new entry points
|
||||
*
|
||||
* Revision 1.2 1999/09/10 02:08:19 gareth
|
||||
* Added GLU 1.3 tessellation (except winding rule code).
|
||||
*
|
||||
@@ -92,5 +95,11 @@
|
||||
#define gluNextContour mgluNextContour
|
||||
#define gluEndPolygon mgluEndPolygon
|
||||
#define gluGetString mgluGetString
|
||||
#define gluBuild1DMipmapLevels mgluBuild1DMipmapLevels
|
||||
#define gluBuild2DMipmapLevels mgluBuild2DMipmapLevels
|
||||
#define gluBuild3DMipmapLevels mgluBuild3DMipmapLevels
|
||||
#define gluBuild3DMipmaps mgluBuild3DMipmaps
|
||||
#define gluCheckExtension mgluCheckExtension
|
||||
#define gluUnProject4 mgluUnProject4
|
||||
|
||||
#endif
|
||||
|
@@ -3,8 +3,8 @@
|
||||
|
||||
/* Copyright (c) Mark J. Kilgard & Willam F. Mitchell, 1998. */
|
||||
|
||||
/* This program is freely distributable without licensing fees
|
||||
and is provided without guarantee or warrantee expressed or
|
||||
/* 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 header provides the binding interface for William Mitchell's
|
||||
@@ -75,7 +75,7 @@ typedef void (GLUTCALLBACK *GLUTmenuStatusFCB) (int *, int *, int *);
|
||||
typedef void (GLUTCALLBACK *GLUTidleFCB) (void);
|
||||
|
||||
/* Functions that set and return Fortran callback functions. */
|
||||
extern void* GLUTAPIENTRY __glutGetFCB(int which);
|
||||
extern void GLUTAPIENTRY __glutSetFCB(int which, void *func);
|
||||
GLUTAPI void* APIENTRY __glutGetFCB(int which);
|
||||
GLUTAPI void APIENTRY __glutSetFCB(int which, void *func);
|
||||
|
||||
#endif /* __glutf90_h__ */
|
||||
|
@@ -1,10 +1,10 @@
|
||||
/* $Id: glx.h,v 1.27 2001/05/24 19:07:14 brianp Exp $ */
|
||||
/* $Id: glx.h,v 1.33 2001/09/24 14:15:58 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
* Version: 4.0
|
||||
*
|
||||
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2001 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"),
|
||||
@@ -60,6 +60,7 @@ extern "C" {
|
||||
#define GLX_VERSION_1_1 1
|
||||
#define GLX_VERSION_1_2 1
|
||||
#define GLX_VERSION_1_3 1
|
||||
#define GLX_VERSION_1_4 1
|
||||
|
||||
#define GLX_EXTENSION_NAME "GLX"
|
||||
|
||||
@@ -125,7 +126,10 @@ extern "C" {
|
||||
#define GLX_MAX_PBUFFER_HEIGHT 0x8017
|
||||
#define GLX_MAX_PBUFFER_PIXELS 0x8018
|
||||
#define GLX_PRESERVED_CONTENTS 0x801B
|
||||
#define GLX_LARGEST_BUFFER 0x801C
|
||||
#define GLX_LARGEST_PBUFFER 0x801C
|
||||
#define GLX_WIDTH 0x801D
|
||||
#define GLX_HEIGHT 0x801E
|
||||
#define GLX_EVENT_MASK 0x801F
|
||||
#define GLX_DRAWABLE_TYPE 0x8010
|
||||
#define GLX_FBCONFIG_ID 0x8013
|
||||
#define GLX_VISUAL_ID 0x800B
|
||||
@@ -137,7 +141,6 @@ extern "C" {
|
||||
#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
|
||||
#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
|
||||
#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
|
||||
#define GLX_AUX_BUFFERS_BIT 0x00000010
|
||||
#define GLX_DEPTH_BUFFER_BIT 0x00000020
|
||||
#define GLX_STENCIL_BUFFER_BIT 0x00000040
|
||||
#define GLX_ACCUM_BUFFER_BIT 0x00000080
|
||||
@@ -152,14 +155,25 @@ extern "C" {
|
||||
#define GLX_GRAY_SCALE 0x8006
|
||||
#define GLX_STATIC_GRAY 0x8007
|
||||
#define GLX_TRANSPARENT_INDEX 0x8009
|
||||
#define GLX_RGBA_TYPE 0x8014
|
||||
#define GLX_COLOR_INDEX_TYPE 0x8015
|
||||
#define GLX_COLOR_INDEX_BIT 0x00000002
|
||||
#define GLX_RGBA_BIT 0x00000001
|
||||
#define GLX_SCREEN 0x800C
|
||||
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
|
||||
#define GLX_DAMAGED 0x8020
|
||||
#define GLX_SAVED 0x8021
|
||||
#define GLX_WINDOW 0x8022
|
||||
#define GLX_PBUFFER 0x8023
|
||||
#define GLX_PBUFFER_HEIGHT 0x8040
|
||||
#define GLX_PBUFFER_WIDTH 0x8041
|
||||
|
||||
|
||||
/*
|
||||
* GLX 1.4 and later:
|
||||
*/
|
||||
#define GLX_SAMPLE_BUFFERS_SGIS 100000
|
||||
#define GLX_SAMPLES_SGIS 100001
|
||||
|
||||
|
||||
|
||||
@@ -279,6 +293,10 @@ extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
|
||||
unsigned long *mask );
|
||||
|
||||
|
||||
/* GLX 1.4 and later */
|
||||
extern void (*glXGetProcAddress(const GLubyte *procname))();
|
||||
|
||||
|
||||
|
||||
#ifndef GLX_GLXEXT_LEGACY
|
||||
|
||||
|
@@ -46,7 +46,8 @@ extern "C" {
|
||||
/*************************************************************/
|
||||
|
||||
/* Header file version number, required by OpenGL ABI for Linux */
|
||||
#define GLX_GLXEXT_VERSION 2
|
||||
/* glxext.h last updated 2001/09/26 */
|
||||
#define GLX_GLXEXT_VERSION 3
|
||||
|
||||
#ifndef GLX_VERSION_1_3
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
@@ -107,7 +108,16 @@ extern "C" {
|
||||
#define GLX_PBUFFER_WIDTH 0x8041
|
||||
#endif
|
||||
|
||||
/* XXX Added by BrianP */
|
||||
#ifndef GLX_VERSION_1_4
|
||||
#define GLX_SAMPLE_BUFFERS 100000
|
||||
#define GLX_SAMPLES 100001
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_multisample
|
||||
#define GLX_SAMPLE_BUFFERS_ARB 100000
|
||||
#define GLX_SAMPLES_ARB 100001
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIS_multisample
|
||||
#define GLX_SAMPLE_BUFFERS_SGIS 100000
|
||||
#define GLX_SAMPLES_SGIS 100001
|
||||
@@ -248,6 +258,20 @@ extern "C" {
|
||||
#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_visual_select_group
|
||||
#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028
|
||||
#endif
|
||||
|
||||
#ifndef GLX_OML_swap_method
|
||||
#define GLX_SWAP_METHOD_OML 0x8060
|
||||
#define GLX_SWAP_EXCHANGE_OML 0x8061
|
||||
#define GLX_SWAP_COPY_OML 0x8062
|
||||
#define GLX_SWAP_UNDEFINED_OML 0x8063
|
||||
#endif
|
||||
|
||||
#ifndef GLX_OML_sync_control
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
@@ -526,6 +550,18 @@ extern Bool glXSet3DfxModeMESA (int);
|
||||
typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_visual_select_group
|
||||
#define GLX_SGIX_visual_select_group 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_GLX_OML_swap_method
|
||||
#define GLX_GLX_OML_swap_method 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_GLX_OML_sync_control
|
||||
#define GLX_GLX_OML_sync_control 1
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
/* $Id: osmesa.h,v 1.6 2000/09/08 16:41:38 brianp Exp $ */
|
||||
/* $Id: osmesa.h,v 1.9 2001/09/23 16:06:13 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
* Version: 4.0
|
||||
*
|
||||
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2001 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"),
|
||||
@@ -62,8 +62,9 @@ extern "C" {
|
||||
#include <GL/gl.h>
|
||||
|
||||
|
||||
#define OSMESA_MAJOR_VERSION 3
|
||||
#define OSMESA_MINOR_VERSION 5
|
||||
#define OSMESA_MAJOR_VERSION 4
|
||||
#define OSMESA_MINOR_VERSION 0
|
||||
#define OSMESA_PATCH_VERSION 0
|
||||
|
||||
|
||||
|
||||
@@ -77,6 +78,7 @@ extern "C" {
|
||||
#define OSMESA_ARGB 0x2
|
||||
#define OSMESA_RGB GL_RGB
|
||||
#define OSMESA_BGR 0x4
|
||||
#define OSMESA_RGB_565 0x5
|
||||
|
||||
|
||||
/*
|
||||
@@ -94,6 +96,8 @@ extern "C" {
|
||||
#define OSMESA_HEIGHT 0x21
|
||||
#define OSMESA_FORMAT 0x22
|
||||
#define OSMESA_TYPE 0x23
|
||||
#define OSMESA_MAX_WIDTH 0x24 /* new in 4.0 */
|
||||
#define OSMESA_MAX_HEIGHT 0x25 /* new in 4.0 */
|
||||
|
||||
|
||||
typedef struct osmesa_context *OSMesaContext;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: svgamesa.h,v 1.5 2001/06/20 19:52:11 brianp Exp $ */
|
||||
/* $Id: svgamesa.h,v 1.6 2001/09/23 16:06:13 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
* Version: 4.0
|
||||
* Copyright (C) 1995-2001 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@@ -52,8 +52,8 @@
|
||||
#define SVGAMESA_H
|
||||
|
||||
|
||||
#define SVGAMESA_MAJOR_VERSION 3
|
||||
#define SVGAMESA_MINOR_VERSION 5
|
||||
#define SVGAMESA_MAJOR_VERSION 4
|
||||
#define SVGAMESA_MINOR_VERSION 0
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
45
include/GL/uglglutshapes.h
Normal file
45
include/GL/uglglutshapes.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/* uglglutshapes.h - Public header GLUT Shapes */
|
||||
|
||||
/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */
|
||||
|
||||
/* 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. */
|
||||
|
||||
#ifndef GLUTSHAPES_H
|
||||
#define GLUTSHAPES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <GL/gl.h>
|
||||
|
||||
void glutWireSphere (GLdouble radius, GLint slices, GLint stacks);
|
||||
void glutSolidSphere (GLdouble radius, GLint slices, GLint stacks);
|
||||
void glutWireCone (GLdouble base, GLdouble height,
|
||||
GLint slices, GLint stacks);
|
||||
void glutSolidCone (GLdouble base, GLdouble height,
|
||||
GLint slices, GLint stacks);
|
||||
void glutWireCube (GLdouble size);
|
||||
void glutSolidCube (GLdouble size);
|
||||
void glutWireTorus (GLdouble innerRadius, GLdouble outerRadius,
|
||||
GLint sides, GLint rings);
|
||||
void glutSolidTorus (GLdouble innerRadius, GLdouble outerRadius,
|
||||
GLint sides, GLint rings);
|
||||
void glutWireDodecahedron (void);
|
||||
void glutSolidDodecahedron (void);
|
||||
void glutWireOctahedron (void);
|
||||
void glutSolidOctahedron (void);
|
||||
void glutWireTetrahedron (void);
|
||||
void glutSolidTetrahedron (void);
|
||||
void glutWireIcosahedron (void);
|
||||
void glutSolidIcosahedron (void);
|
||||
void glutWireTeapot (GLdouble size);
|
||||
void glutSolidTeapot (GLdouble size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
155
include/GL/uglmesa.h
Normal file
155
include/GL/uglmesa.h
Normal file
@@ -0,0 +1,155 @@
|
||||
/* uglmesa.h - Public header UGL/Mesa */
|
||||
|
||||
/* Copyright (C) 2001 by Wind River Systems, Inc */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.0
|
||||
*
|
||||
* The MIT License
|
||||
* 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
|
||||
* THE AUTHORS OR COPYRIGHT 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Author:
|
||||
* Stephane Raimbault <stephane.raimbault@windriver.com>
|
||||
*/
|
||||
|
||||
#ifndef UGLMESA_H
|
||||
#define UGLMESA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define UGL_MESA_MAJOR_VERSION 4
|
||||
#define UGL_MESA_MINOR_VERSION 0
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <ugl/ugl.h>
|
||||
|
||||
/*
|
||||
* Values for display mode of uglMesaCreateContext ()
|
||||
*/
|
||||
|
||||
/*
|
||||
* With these mask values, it's possible to test double buffer mode
|
||||
* with UGL_MESA_DOUBLE mask
|
||||
*
|
||||
* SINGLE 0000 0001
|
||||
* DOUBLE 0000 0110
|
||||
* - SOFT 0000 0010
|
||||
* - HARD 0000 0100
|
||||
* WINDML 0001 0000
|
||||
*
|
||||
*
|
||||
*/
|
||||
#define UGL_MESA_SINGLE 0x01
|
||||
#define UGL_MESA_DOUBLE 0x06
|
||||
#define UGL_MESA_DOUBLE_SOFTWARE 0x02
|
||||
#define UGL_MESA_DOUBLE_HARDWARE 0x04
|
||||
|
||||
#define UGL_MESA_WINDML_EXCLUSIVE 0x10
|
||||
|
||||
#define UGL_MESA_FULLSCREEN_WIDTH 0x0
|
||||
#define UGL_MESA_FULLSCREEN_HEIGHT 0x0
|
||||
|
||||
/*
|
||||
* uglMesaPixelStore() parameters:
|
||||
*/
|
||||
|
||||
#define UGL_MESA_ROW_LENGTH 0x20
|
||||
#define UGL_MESA_Y_UP 0x21
|
||||
|
||||
/*
|
||||
* Accepted by uglMesaGetIntegerv:
|
||||
*/
|
||||
|
||||
#define UGL_MESA_LEFT_X 0x01
|
||||
#define UGL_MESA_TOP_Y 0x02
|
||||
#define UGL_MESA_WIDTH 0x03
|
||||
#define UGL_MESA_HEIGHT 0x04
|
||||
#define UGL_MESA_DISPLAY_WIDTH 0x05
|
||||
#define UGL_MESA_DISPLAY_HEIGHT 0x06
|
||||
#define UGL_MESA_COLOR_FORMAT 0x07
|
||||
#define UGL_MESA_COLOR_MODEL 0x08
|
||||
#define UGL_MESA_PIXEL_FORMAT 0x09
|
||||
#define UGL_MESA_TYPE 0x0A
|
||||
#define UGL_MESA_RGB 0x0B
|
||||
#define UGL_MESA_COLOR_INDEXED 0x0C
|
||||
#define UGL_MESA_SINGLE_BUFFER 0x0D
|
||||
#define UGL_MESA_DOUBLE_BUFFER 0x0E
|
||||
#define UGL_MESA_DOUBLE_BUFFER_SOFTWARE 0x0F
|
||||
#define UGL_MESA_DOUBLE_BUFFER_HARDWARE 0x10
|
||||
|
||||
/*
|
||||
* typedefs
|
||||
*/
|
||||
|
||||
typedef struct uglMesaContext * UGL_MESA_CONTEXT;
|
||||
|
||||
UGL_MESA_CONTEXT uglMesaCreateNewContext (GLenum mode,
|
||||
UGL_MESA_CONTEXT share_list);
|
||||
|
||||
UGL_MESA_CONTEXT uglMesaCreateNewContextExt (GLenum mode,
|
||||
GLint depth_bits,
|
||||
GLint stencil_bits,
|
||||
GLint accum_red_bits,
|
||||
GLint accum_green_bits,
|
||||
GLint accum_blue_bits,
|
||||
GLint accum_alpha_bits,
|
||||
UGL_MESA_CONTEXT share_list);
|
||||
|
||||
GLboolean uglMesaMakeCurrentContext (UGL_MESA_CONTEXT umc,
|
||||
GLsizei left, GLsizei top,
|
||||
GLsizei width, GLsizei height);
|
||||
|
||||
GLboolean uglMesaMoveWindow (GLsizei dx, GLsizei dy);
|
||||
|
||||
GLboolean uglMesaMoveToWindow (GLsizei left, GLsizei top);
|
||||
|
||||
GLboolean uglMesaResizeWindow (GLsizei dw, GLsizei dh);
|
||||
|
||||
GLboolean uglMesaResizeToWindow (GLsizei width, GLsizei height);
|
||||
|
||||
void uglMesaDestroyContext (void);
|
||||
|
||||
UGL_MESA_CONTEXT uglMesaGetCurrentContext (void);
|
||||
|
||||
void uglMesaSwapBuffers (void);
|
||||
|
||||
void uglMesaPixelStore (GLint pname, GLint value);
|
||||
|
||||
void uglMesaGetIntegerv (GLint pname, GLint *value);
|
||||
|
||||
GLboolean uglMesaGetDepthBuffer (GLint *width, GLint *height,
|
||||
GLint *bytesPerValue, void **buffer);
|
||||
|
||||
GLboolean uglMesaGetColorBuffer (GLint *width, GLint *height,
|
||||
GLint *format, void **buffer);
|
||||
|
||||
GLboolean uglMesaSetColor (GLubyte index, GLfloat red,
|
||||
GLfloat green, GLfloat blue);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
@@ -1,8 +1,8 @@
|
||||
/* $Id: xmesa.h,v 1.11 2001/06/20 19:52:11 brianp Exp $ */
|
||||
/* $Id: xmesa.h,v 1.12 2001/09/23 16:06:13 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
* Version: 4.0
|
||||
*
|
||||
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -89,8 +89,8 @@ extern struct Library *XLibBase;
|
||||
#endif
|
||||
|
||||
|
||||
#define XMESA_MAJOR_VERSION 3
|
||||
#define XMESA_MINOR_VERSION 5
|
||||
#define XMESA_MAJOR_VERSION 4
|
||||
#define XMESA_MINOR_VERSION 0
|
||||
|
||||
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.X11,v 1.19 2001/03/27 17:44:35 brianp Exp $
|
||||
# $Id: Makefile.X11,v 1.20 2001/08/21 05:42:11 gareth Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.5
|
||||
@@ -18,8 +18,7 @@ OSMESA_LIBS = -L$(LIBDIR) -lglut -lOSMesa -lGLU -lGL $(APP_LIB_DEPS)
|
||||
|
||||
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)
|
||||
|
||||
PROGS = anisotropic \
|
||||
bounce \
|
||||
PROGS = bounce \
|
||||
clearspd \
|
||||
cubemap \
|
||||
drawpix \
|
||||
|
100
progs/demos/Makefile.win
Normal file
100
progs/demos/Makefile.win
Normal file
@@ -0,0 +1,100 @@
|
||||
# $Id: Makefile.win,v 1.5 2001/10/04 19:13:36 kschultz Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.5
|
||||
# Copyright (C) 1995-2001 Brian Paul
|
||||
|
||||
# Makefile for GLUT-based demo programs for Windows
|
||||
|
||||
!include <win32.mak>
|
||||
|
||||
##### MACROS #####
|
||||
|
||||
TOP = ..
|
||||
INCDIR = ..\include
|
||||
LIBDIR = ..\lib
|
||||
|
||||
PROGS = anisotropic \
|
||||
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 \
|
||||
shadowtex \
|
||||
spectex \
|
||||
stex3d \
|
||||
teapot \
|
||||
terrain \
|
||||
tessdemo \
|
||||
texcyl \
|
||||
texdown \
|
||||
texenv \
|
||||
texobj \
|
||||
trispd \
|
||||
tunnel \
|
||||
tunnel2 \
|
||||
winpos
|
||||
|
||||
SRCS = \
|
||||
bounce.c \
|
||||
clearspd.c \
|
||||
cubemap.c \
|
||||
drawpix.c \
|
||||
fire.c \
|
||||
gamma.c \
|
||||
gears.c \
|
||||
geartrain.c \
|
||||
glinfo.c \
|
||||
gloss.c \
|
||||
isosurf.c \
|
||||
morph3d.c \
|
||||
teapot.c
|
||||
|
||||
OSMESASRCS = osdemo.c
|
||||
|
||||
!include "../mesawin32.mak"
|
||||
|
||||
##### TARGETS #####
|
||||
|
||||
clean::
|
||||
|
||||
realclean::
|
||||
|
||||
targets: readtex.c readtex.h $(PROGS)
|
||||
|
||||
# remove comments when we get non-osmesa pgm working
|
||||
$(EXES) : $*.obj
|
||||
@echo $@
|
||||
$(link) -out:$@ $** /LIBPATH:$(LIBDIR) $(LIBS)
|
||||
|
||||
$(OSMESAEXES) : $*.obj
|
||||
@echo $@
|
||||
$(link) $(lcommon) -out:$@ $** /LIBPATH:$(LIBDIR) $(LIBS) $(EXTRALIBS)
|
||||
|
||||
readtex.c:
|
||||
@copy ../util/readtex.c .
|
||||
|
||||
readtex.h:
|
||||
@copy ../util/readtex.c .
|
||||
|
@@ -1,220 +0,0 @@
|
||||
/* $Id: anisotropic.c,v 1.1 2001/03/22 15:24:15 gareth Exp $ */
|
||||
|
||||
/*
|
||||
* GL_ARB_texture_filter_anisotropic demo
|
||||
*
|
||||
* Gareth Hughes
|
||||
* March 2001
|
||||
*
|
||||
* 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 fairly early version. All it does is draw a couple of
|
||||
* textured quads with different forms of texture filtering. Eventually,
|
||||
* you'll be able to adjust the maximum anisotropy and so on.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#define TEXTURE_SIZE 256
|
||||
static GLubyte image[TEXTURE_SIZE][TEXTURE_SIZE][3];
|
||||
|
||||
static GLfloat repeat = 1.0;
|
||||
|
||||
static GLfloat texcoords[] = {
|
||||
0.0, 0.0,
|
||||
0.0, 1.0,
|
||||
1.0, 0.0,
|
||||
1.0, 1.0
|
||||
};
|
||||
|
||||
static GLfloat vertices[] = {
|
||||
-400.0, -400.0, 0.0,
|
||||
-400.0, 400.0, -7000.0,
|
||||
400.0, -400.0, 0.0,
|
||||
400.0, 400.0, -7000.0
|
||||
};
|
||||
|
||||
static GLfloat maxAnisotropy;
|
||||
|
||||
|
||||
static void init( void )
|
||||
{
|
||||
int i, j;
|
||||
|
||||
if ( !glutExtensionSupported( "GL_EXT_texture_filter_anisotropic" ) ) {
|
||||
fprintf( stderr, "Sorry, this demo requires GL_EXT_texture_filter_anisotropic.\n" );
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
glClearColor( 0.0, 0.0, 0.0, 0.0 );
|
||||
glShadeModel( GL_SMOOTH );
|
||||
|
||||
/* Init the vertex arrays.
|
||||
*/
|
||||
glEnableClientState( GL_VERTEX_ARRAY );
|
||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
|
||||
glVertexPointer( 3, GL_FLOAT, 0, vertices );
|
||||
glTexCoordPointer( 2, GL_FLOAT, 0, texcoords );
|
||||
|
||||
/* Init the texture environment.
|
||||
*/
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
|
||||
glMatrixMode( GL_TEXTURE );
|
||||
glScalef( repeat, repeat, 0 );
|
||||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
|
||||
glGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy );
|
||||
printf( "Maximum supported anisotropy: %.2f\n", maxAnisotropy );
|
||||
|
||||
/* Make the texture image.
|
||||
*/
|
||||
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
|
||||
|
||||
for ( i = 0 ; i < TEXTURE_SIZE ; i++ ) {
|
||||
for ( j = 0 ; j < TEXTURE_SIZE ; j++ ) {
|
||||
if ( (i/4 + j/4) & 1 ) {
|
||||
image[i][j][0] = 0;
|
||||
image[i][j][1] = 0;
|
||||
image[i][j][2] = 0;
|
||||
} else {
|
||||
image[i][j][0] = 255;
|
||||
image[i][j][1] = 255;
|
||||
image[i][j][2] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gluBuild2DMipmaps( GL_TEXTURE_2D, GL_RGB, TEXTURE_SIZE, TEXTURE_SIZE,
|
||||
GL_RGB, GL_UNSIGNED_BYTE, image );
|
||||
}
|
||||
|
||||
static void display( void )
|
||||
{
|
||||
GLint vp[4], w, h;
|
||||
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
glGetIntegerv( GL_VIEWPORT, vp );
|
||||
w = vp[2] / 2;
|
||||
h = vp[3] / 2;
|
||||
|
||||
/* Upper left corner:
|
||||
*/
|
||||
glViewport( 1, h + 1, w - 2, h - 2 );
|
||||
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAnisotropy );
|
||||
|
||||
glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 );
|
||||
|
||||
|
||||
/* Upper right corner:
|
||||
*/
|
||||
glViewport( w + 1, h + 1, w - 2, h - 2 );
|
||||
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAnisotropy );
|
||||
|
||||
glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 );
|
||||
|
||||
|
||||
/* Lower left corner:
|
||||
*/
|
||||
glViewport( 1, 1, w - 2, h - 2 );
|
||||
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR );
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAnisotropy );
|
||||
|
||||
glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 );
|
||||
|
||||
|
||||
/* Lower right corner:
|
||||
*/
|
||||
glViewport( w + 1, 1, w - 2, h - 2 );
|
||||
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
|
||||
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, maxAnisotropy );
|
||||
|
||||
glDrawArrays( GL_TRIANGLE_STRIP, 0, 4 );
|
||||
|
||||
|
||||
glViewport( vp[0], vp[1], vp[2], vp[3] );
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
static void reshape( int w, int h )
|
||||
{
|
||||
glViewport( 0, 0, (GLsizei) w, (GLsizei) h );
|
||||
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 10000.0 );
|
||||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
glTranslatef( 0.0, 0.0, -10.0 );
|
||||
}
|
||||
|
||||
static void key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x; (void) y;
|
||||
|
||||
switch ( key ) {
|
||||
case 27:
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
static void usage( void )
|
||||
{
|
||||
/* Nothing yet... */
|
||||
}
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
glutInit( &argc, argv );
|
||||
glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB );
|
||||
glutInitWindowSize( 600, 300 );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutCreateWindow( "Anisotropic Texture Filter Demo" );
|
||||
|
||||
init();
|
||||
|
||||
glutDisplayFunc( display );
|
||||
glutReshapeFunc( reshape );
|
||||
glutKeyboardFunc( key );
|
||||
|
||||
usage();
|
||||
|
||||
glutMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: geartrain.c,v 1.7 2000/11/30 01:44:24 gareth Exp $ */
|
||||
/* $Id: geartrain.c,v 1.8 2001/10/04 19:14:26 kschultz Exp $ */
|
||||
|
||||
/*
|
||||
* GearTrain Simulator * Version: 1.00
|
||||
@@ -32,7 +32,9 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef min
|
||||
#define min(x, y) ( x < y ? x : y )
|
||||
#endif
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265
|
||||
@@ -103,6 +105,7 @@ static GLint T0 = 0;
|
||||
static GLint Frames = 0;
|
||||
|
||||
|
||||
#ifndef _WIN32
|
||||
static void
|
||||
strset (char buf[], char ch)
|
||||
{
|
||||
@@ -110,6 +113,7 @@ strset (char buf[], char ch)
|
||||
for (i = 0; i < strlen (buf); i++)
|
||||
buf[i] = ch;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: isosurf.c,v 1.12 2001/06/04 15:34:31 keithw Exp $ */
|
||||
/* $Id: isosurf.c,v 1.13 2001/10/04 19:14:26 kschultz Exp $ */
|
||||
|
||||
/*
|
||||
* Display an isosurface of 3-D wind speed volume.
|
||||
@@ -30,6 +30,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#define GL_GLEXT_LEGACY
|
||||
#include "GL/glut.h"
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: osdemo.c,v 1.5 2000/09/08 16:42:06 brianp Exp $ */
|
||||
/* $Id: osdemo.c,v 1.7 2001/09/24 15:29:27 kschultz Exp $ */
|
||||
|
||||
/*
|
||||
* Demo of off-screen Mesa rendering
|
||||
@@ -228,9 +228,9 @@ int main( int argc, char *argv[] )
|
||||
/* Create an RGBA-mode context */
|
||||
#if OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 305
|
||||
/* specify Z, stencil, accum sizes */
|
||||
OSMesaContext ctx = OSMesaCreateContextExt( GL_RGBA, 16, 0, 0, NULL );
|
||||
OSMesaContext ctx = OSMesaCreateContextExt( OSMESA_RGBA, 16, 0, 0, NULL );
|
||||
#else
|
||||
OSMesaContext ctx = OSMesaCreateContext( GL_RGBA, NULL );
|
||||
OSMesaContext ctx = OSMesaCreateContext( OSMESA_RGBA, NULL );
|
||||
#endif
|
||||
if (!ctx) {
|
||||
printf("OSMesaCreateContext failed!\n");
|
||||
@@ -238,14 +238,18 @@ int main( int argc, char *argv[] )
|
||||
}
|
||||
|
||||
/* Allocate the image buffer */
|
||||
buffer = malloc( WIDTH * HEIGHT * 4 );
|
||||
buffer = malloc( WIDTH * HEIGHT * 4 * sizeof(GLubyte) );
|
||||
if (!buffer) {
|
||||
printf("Alloc image buffer failed!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Bind the buffer to the context and make it current */
|
||||
OSMesaMakeCurrent( ctx, buffer, GL_UNSIGNED_BYTE, WIDTH, HEIGHT );
|
||||
if (!OSMesaMakeCurrent( ctx, buffer, GL_UNSIGNED_BYTE, WIDTH, HEIGHT )) {
|
||||
printf("OSMesaMakeCurrent failed!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
int z, s, a;
|
||||
|
@@ -127,12 +127,12 @@ static void Idle(void)
|
||||
|
||||
static GLubyte warp(GLfloat s, int frame)
|
||||
{
|
||||
static const GLfloat PI = 3.14159265;
|
||||
static const GLfloat pi = 3.14159265;
|
||||
static int halfFrame = FRAMES / 2;
|
||||
GLfloat y, weight, v;
|
||||
if (frame >= halfFrame)
|
||||
frame = halfFrame - (frame - halfFrame);
|
||||
y = sin(s * PI);
|
||||
y = sin(s * pi);
|
||||
weight = (float) frame / (FRAMES-1);
|
||||
v = y * (0.8 * weight + 0.2);
|
||||
return (GLint) (v * 255.0F);
|
||||
|
BIN
progs/images/wrs_logo.rgb
Normal file
BIN
progs/images/wrs_logo.rgb
Normal file
Binary file not shown.
169
progs/tests/multiwindow.c
Normal file
169
progs/tests/multiwindow.c
Normal file
@@ -0,0 +1,169 @@
|
||||
/* $Id: multiwindow.c,v 1.1 2001/08/21 14:25:31 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* A skeleton/template GLUT program
|
||||
*
|
||||
* Written by Brian Paul and in the public domain.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* $Log: multiwindow.c,v $
|
||||
* Revision 1.1 2001/08/21 14:25:31 brianp
|
||||
* simple multi-window GLUT test prog
|
||||
*
|
||||
* Revision 1.1.1.1 1999/08/19 00:55:42 jtg
|
||||
* Imported sources
|
||||
*
|
||||
* Revision 1.2 1998/11/07 14:20:14 brianp
|
||||
* added simple rotation, animation of cube
|
||||
*
|
||||
* Revision 1.1 1998/11/07 14:14:37 brianp
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
static GLint Window[2];
|
||||
|
||||
static GLfloat Xrot = 0, Yrot = 0, Zrot = 0;
|
||||
static GLboolean Anim = GL_TRUE;
|
||||
|
||||
|
||||
static void Idle( void )
|
||||
{
|
||||
Xrot += 3.0;
|
||||
Yrot += 4.0;
|
||||
Zrot += 2.0;
|
||||
|
||||
glutSetWindow(Window[0]);
|
||||
glutPostRedisplay();
|
||||
glutSetWindow(Window[1]);
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void Display0( void )
|
||||
{
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(Xrot, 1, 0, 0);
|
||||
glRotatef(Yrot, 0, 1, 0);
|
||||
glRotatef(Zrot, 0, 0, 1);
|
||||
|
||||
glColor3f(0, 1, 0);
|
||||
glutSolidCube(2.0);
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void Display1( void )
|
||||
{
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(Xrot, 1, 0, 0);
|
||||
glRotatef(Yrot, 0, 1, 0);
|
||||
glRotatef(Zrot, 0, 0, 1);
|
||||
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
glBegin(GL_TRIANGLE_STRIP);
|
||||
glColor3f(1, 0, 0);
|
||||
glVertex2f(-1, -1);
|
||||
glVertex2f( 1, -1);
|
||||
glColor3f(1, 0, 0);
|
||||
glVertex2f( -1, 1);
|
||||
glColor3f(0, 0, 1);
|
||||
glVertex2f( 1, 1);
|
||||
glEnd();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
glTranslatef( 0.0, 0.0, -15.0 );
|
||||
}
|
||||
|
||||
|
||||
static void Key( unsigned char key, int x, int y )
|
||||
{
|
||||
const GLfloat step = 3.0;
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 'a':
|
||||
Anim = !Anim;
|
||||
if (Anim)
|
||||
glutIdleFunc(Idle);
|
||||
else
|
||||
glutIdleFunc(NULL);
|
||||
break;
|
||||
case 'z':
|
||||
Zrot -= step;
|
||||
break;
|
||||
case 'Z':
|
||||
Zrot += step;
|
||||
break;
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit( &argc, argv );
|
||||
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( 400, 400 );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
|
||||
Window[0] = glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutDisplayFunc( Display0 );
|
||||
glutIdleFunc(Idle);
|
||||
printf("GL_RENDERER[0] = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
||||
glutInitWindowPosition( 500, 0 );
|
||||
glutInitWindowSize( 400, 400 );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
|
||||
Window[1] = glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutDisplayFunc( Display1 );
|
||||
glutIdleFunc(Idle);
|
||||
printf("GL_RENDERER[1] = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
||||
glutMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
68
progs/windml/Makefile.ugl
Normal file
68
progs/windml/Makefile.ugl
Normal file
@@ -0,0 +1,68 @@
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.5
|
||||
#
|
||||
# Copyright (C) 2001 Wind River Systems, Inc
|
||||
|
||||
# The MIT License
|
||||
# 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
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
|
||||
# Makefile for UGL/Mesa demos
|
||||
|
||||
DEMO_SOURCES = readtex.c uglaccum.c uglalldemos.c uglbounce.c uglcube.c \
|
||||
ugldrawpix.c uglflip.c uglgears.c uglicotorus.c uglline.c uglolympic.c \
|
||||
uglpoint.c uglstencil.c uglteapot.c ugltexcube.c ugltexcyl.c
|
||||
#win2d3d/winRoot.c win2d3d/winBall.c win2d3d/winPuzzle.c win2d3d/winHello.c \
|
||||
#win2d3d/winImage.c win2d3d/winGears.c
|
||||
|
||||
DEMO_OBJECTS = $(DEMO_SOURCES:.c=.o)
|
||||
|
||||
SOURCES = $(DEMO_SOURCES)
|
||||
|
||||
include ../rules.windml
|
||||
|
||||
##### TARGETS #####
|
||||
|
||||
all: depend.$(CPU)$(TOOL) $(DEMO_OBJECTS)
|
||||
|
||||
depend.$(CPU)$(TOOL):
|
||||
ifeq ($(WIND_HOST_TYPE),x86-win32)
|
||||
@ $(RM) $@
|
||||
@ $(ECHO) Creating depend.$(CPU)$(TOOL)
|
||||
ifneq ($(SOURCES),)
|
||||
@ for %f in ($(SOURCES)) do \
|
||||
$(CC) -MM $(CFLAGS) %f >>$@
|
||||
endif
|
||||
else
|
||||
Makefile
|
||||
@ $(RM) $@
|
||||
@ $(ECHO) "Creating depend.$(CPU)$(TOOL)"
|
||||
ifneq ($(SOURCES),)
|
||||
@ for FILE in $(filter-out $(NODEPENDOBJS), $(SOURCES)); \
|
||||
do \
|
||||
$(CC) -MM $(CFLAGS) $$FILE \
|
||||
| $(TCL) $(BIN_DIR)/depend.tcl $(TGT_DIR) >>$@; \
|
||||
done
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY = clean
|
||||
|
||||
clean:
|
||||
$(RM) $(DEMO_OBJECTS)
|
||||
$(RM) depend.$(CPU)$(TOOL)
|
365
progs/windml/readtex.c
Normal file
365
progs/windml/readtex.c
Normal file
@@ -0,0 +1,365 @@
|
||||
/* readtex.c */
|
||||
|
||||
/*
|
||||
* Read an SGI .rgb image file and generate a mipmap texture set.
|
||||
* Much of this code was borrowed from SGI's tk OpenGL toolkit.
|
||||
*/
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "../util/readtex.h"
|
||||
|
||||
|
||||
#ifndef SEEK_SET
|
||||
# define SEEK_SET 0
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** RGB Image Structure
|
||||
*/
|
||||
|
||||
typedef struct _TK_RGBImageRec {
|
||||
GLint sizeX, sizeY;
|
||||
GLint components;
|
||||
unsigned char *data;
|
||||
} TK_RGBImageRec;
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef struct _rawImageRec {
|
||||
unsigned short imagic;
|
||||
unsigned short type;
|
||||
unsigned short dim;
|
||||
unsigned short sizeX, sizeY, sizeZ;
|
||||
unsigned long min, max;
|
||||
unsigned long wasteBytes;
|
||||
char name[80];
|
||||
unsigned long colorMap;
|
||||
FILE *file;
|
||||
unsigned char *tmp, *tmpR, *tmpG, *tmpB, *tmpA;
|
||||
unsigned long rleEnd;
|
||||
GLuint *rowStart;
|
||||
GLint *rowSize;
|
||||
} rawImageRec;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static void ConvertShort(unsigned short *array, long length)
|
||||
{
|
||||
unsigned long b1, b2;
|
||||
unsigned char *ptr;
|
||||
|
||||
ptr = (unsigned char *)array;
|
||||
while (length--) {
|
||||
b1 = *ptr++;
|
||||
b2 = *ptr++;
|
||||
*array++ = (unsigned short) ((b1 << 8) | (b2));
|
||||
}
|
||||
}
|
||||
|
||||
static void ConvertLong(GLuint *array, long length)
|
||||
{
|
||||
unsigned long b1, b2, b3, b4;
|
||||
unsigned char *ptr;
|
||||
|
||||
ptr = (unsigned char *)array;
|
||||
while (length--) {
|
||||
b1 = *ptr++;
|
||||
b2 = *ptr++;
|
||||
b3 = *ptr++;
|
||||
b4 = *ptr++;
|
||||
*array++ = (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4);
|
||||
}
|
||||
}
|
||||
|
||||
static rawImageRec *RawImageOpen(const char *fileName)
|
||||
{
|
||||
union {
|
||||
int testWord;
|
||||
char testByte[4];
|
||||
} endianTest;
|
||||
rawImageRec *raw;
|
||||
GLenum swapFlag;
|
||||
int x;
|
||||
|
||||
endianTest.testWord = 1;
|
||||
if (endianTest.testByte[0] == 1) {
|
||||
swapFlag = GL_TRUE;
|
||||
} else {
|
||||
swapFlag = GL_FALSE;
|
||||
}
|
||||
|
||||
raw = (rawImageRec *)malloc(sizeof(rawImageRec));
|
||||
if (raw == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
return NULL;
|
||||
}
|
||||
if ((raw->file = fopen(fileName, "rb")) == NULL) {
|
||||
perror(fileName);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fread(raw, 1, 12, raw->file);
|
||||
|
||||
if (swapFlag) {
|
||||
ConvertShort(&raw->imagic, 6);
|
||||
}
|
||||
|
||||
raw->tmp = (unsigned char *)malloc(raw->sizeX*256);
|
||||
raw->tmpR = (unsigned char *)malloc(raw->sizeX*256);
|
||||
raw->tmpG = (unsigned char *)malloc(raw->sizeX*256);
|
||||
raw->tmpB = (unsigned char *)malloc(raw->sizeX*256);
|
||||
if (raw->sizeZ==4) {
|
||||
raw->tmpA = (unsigned char *)malloc(raw->sizeX*256);
|
||||
}
|
||||
if (raw->tmp == NULL || raw->tmpR == NULL || raw->tmpG == NULL ||
|
||||
raw->tmpB == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if ((raw->type & 0xFF00) == 0x0100) {
|
||||
x = raw->sizeY * raw->sizeZ * sizeof(GLuint);
|
||||
raw->rowStart = (GLuint *)malloc(x);
|
||||
raw->rowSize = (GLint *)malloc(x);
|
||||
if (raw->rowStart == NULL || raw->rowSize == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
return NULL;
|
||||
}
|
||||
raw->rleEnd = 512 + (2 * x);
|
||||
fseek(raw->file, 512, SEEK_SET);
|
||||
fread(raw->rowStart, 1, x, raw->file);
|
||||
fread(raw->rowSize, 1, x, raw->file);
|
||||
if (swapFlag) {
|
||||
ConvertLong(raw->rowStart, (long) (x/sizeof(GLuint)));
|
||||
ConvertLong((GLuint *)raw->rowSize, (long) (x/sizeof(GLint)));
|
||||
}
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
||||
static void RawImageClose(rawImageRec *raw)
|
||||
{
|
||||
|
||||
fclose(raw->file);
|
||||
free(raw->tmp);
|
||||
free(raw->tmpR);
|
||||
free(raw->tmpG);
|
||||
free(raw->tmpB);
|
||||
if (raw->sizeZ>3) {
|
||||
free(raw->tmpA);
|
||||
}
|
||||
free(raw);
|
||||
}
|
||||
|
||||
static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z)
|
||||
{
|
||||
unsigned char *iPtr, *oPtr, pixel;
|
||||
int count, done = 0;
|
||||
|
||||
if ((raw->type & 0xFF00) == 0x0100) {
|
||||
fseek(raw->file, (long) raw->rowStart[y+z*raw->sizeY], SEEK_SET);
|
||||
fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY],
|
||||
raw->file);
|
||||
|
||||
iPtr = raw->tmp;
|
||||
oPtr = buf;
|
||||
while (!done) {
|
||||
pixel = *iPtr++;
|
||||
count = (int)(pixel & 0x7F);
|
||||
if (!count) {
|
||||
done = 1;
|
||||
return;
|
||||
}
|
||||
if (pixel & 0x80) {
|
||||
while (count--) {
|
||||
*oPtr++ = *iPtr++;
|
||||
}
|
||||
} else {
|
||||
pixel = *iPtr++;
|
||||
while (count--) {
|
||||
*oPtr++ = pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fseek(raw->file, 512+(y*raw->sizeX)+(z*raw->sizeX*raw->sizeY),
|
||||
SEEK_SET);
|
||||
fread(buf, 1, raw->sizeX, raw->file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void RawImageGetData(rawImageRec *raw, TK_RGBImageRec *final)
|
||||
{
|
||||
unsigned char *ptr;
|
||||
int i, j;
|
||||
|
||||
final->data = (unsigned char *)malloc((raw->sizeX+1)*(raw->sizeY+1)*4);
|
||||
if (final->data == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
}
|
||||
|
||||
ptr = final->data;
|
||||
for (i = 0; i < (int)(raw->sizeY); i++) {
|
||||
RawImageGetRow(raw, raw->tmpR, i, 0);
|
||||
RawImageGetRow(raw, raw->tmpG, i, 1);
|
||||
RawImageGetRow(raw, raw->tmpB, i, 2);
|
||||
if (raw->sizeZ>3) {
|
||||
RawImageGetRow(raw, raw->tmpA, i, 3);
|
||||
}
|
||||
for (j = 0; j < (int)(raw->sizeX); j++) {
|
||||
*ptr++ = *(raw->tmpR + j);
|
||||
*ptr++ = *(raw->tmpG + j);
|
||||
*ptr++ = *(raw->tmpB + j);
|
||||
if (raw->sizeZ>3) {
|
||||
*ptr++ = *(raw->tmpA + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static TK_RGBImageRec *tkRGBImageLoad(const char *fileName)
|
||||
{
|
||||
rawImageRec *raw;
|
||||
TK_RGBImageRec *final;
|
||||
|
||||
raw = RawImageOpen(fileName);
|
||||
if (!raw) {
|
||||
fprintf(stderr, "File not found\n");
|
||||
return NULL;
|
||||
}
|
||||
final = (TK_RGBImageRec *)malloc(sizeof(TK_RGBImageRec));
|
||||
if (final == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
return NULL;
|
||||
}
|
||||
final->sizeX = raw->sizeX;
|
||||
final->sizeY = raw->sizeY;
|
||||
final->components = raw->sizeZ;
|
||||
RawImageGetData(raw, final);
|
||||
RawImageClose(raw);
|
||||
return final;
|
||||
}
|
||||
|
||||
|
||||
static void FreeImage( TK_RGBImageRec *image )
|
||||
{
|
||||
free(image->data);
|
||||
free(image);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Load an SGI .rgb file and generate a set of 2-D mipmaps from it.
|
||||
* Input: imageFile - name of .rgb to read
|
||||
* intFormat - internal texture format to use, or number of components
|
||||
* Return: GL_TRUE if success, GL_FALSE if error.
|
||||
*/
|
||||
GLboolean LoadRGBMipmaps( const char *imageFile, GLint intFormat )
|
||||
{
|
||||
GLint w, h;
|
||||
return LoadRGBMipmaps2( imageFile, GL_TEXTURE_2D, intFormat, &w, &h );
|
||||
}
|
||||
|
||||
|
||||
|
||||
GLboolean LoadRGBMipmaps2( const char *imageFile, GLenum target,
|
||||
GLint intFormat, GLint *width, GLint *height )
|
||||
{
|
||||
GLint error;
|
||||
GLenum format;
|
||||
TK_RGBImageRec *image;
|
||||
|
||||
image = tkRGBImageLoad( imageFile );
|
||||
if (!image) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (image->components==3) {
|
||||
format = GL_RGB;
|
||||
}
|
||||
else if (image->components==4) {
|
||||
format = GL_RGBA;
|
||||
}
|
||||
else {
|
||||
/* not implemented */
|
||||
fprintf(stderr,
|
||||
"Error in LoadRGBMipmaps %d-component images not implemented\n",
|
||||
image->components );
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
error = gluBuild2DMipmaps( target,
|
||||
intFormat,
|
||||
image->sizeX, image->sizeY,
|
||||
format,
|
||||
GL_UNSIGNED_BYTE,
|
||||
image->data );
|
||||
|
||||
*width = image->sizeX;
|
||||
*height = image->sizeY;
|
||||
|
||||
FreeImage(image);
|
||||
|
||||
return error ? GL_FALSE : GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Load an SGI .rgb file and return a pointer to the image data.
|
||||
* Input: imageFile - name of .rgb to read
|
||||
* Output: width - width of image
|
||||
* height - height of image
|
||||
* format - format of image (GL_RGB or GL_RGBA)
|
||||
* Return: pointer to image data or NULL if error
|
||||
*/
|
||||
GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height,
|
||||
GLenum *format )
|
||||
{
|
||||
TK_RGBImageRec *image;
|
||||
GLint bytes;
|
||||
GLubyte *buffer;
|
||||
|
||||
image = tkRGBImageLoad( imageFile );
|
||||
if (!image) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (image->components==3) {
|
||||
*format = GL_RGB;
|
||||
}
|
||||
else if (image->components==4) {
|
||||
*format = GL_RGBA;
|
||||
}
|
||||
else {
|
||||
/* not implemented */
|
||||
fprintf(stderr,
|
||||
"Error in LoadRGBImage %d-component images not implemented\n",
|
||||
image->components );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*width = image->sizeX;
|
||||
*height = image->sizeY;
|
||||
|
||||
bytes = image->sizeX * image->sizeY * image->components;
|
||||
buffer = (GLubyte *) malloc(bytes);
|
||||
if (!buffer)
|
||||
return NULL;
|
||||
|
||||
memcpy( (void *) buffer, (void *) image->data, bytes );
|
||||
|
||||
FreeImage(image);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
250
progs/windml/uglaccum.c
Normal file
250
progs/windml/uglaccum.c
Normal file
@@ -0,0 +1,250 @@
|
||||
|
||||
/* Copyright (c) Mark J. Kilgard, 1994. */
|
||||
|
||||
/*
|
||||
* (c) Copyright 1993, Silicon Graphics, Inc.
|
||||
* ALL RIGHTS RESERVED
|
||||
* Permission to use, copy, modify, and distribute this software for
|
||||
* any purpose and without fee is hereby granted, provided that the above
|
||||
* copyright notice appear in all copies and that both the copyright notice
|
||||
* and this permission notice appear in supporting documentation, and that
|
||||
* the name of Silicon Graphics, Inc. not be used in advertising
|
||||
* or publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission.
|
||||
*
|
||||
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
||||
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
|
||||
* SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
|
||||
* KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
|
||||
* LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
||||
* THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* US Government Users Restricted Rights
|
||||
* Use, duplication, or disclosure by the Government is subject to
|
||||
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
||||
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
||||
* clause at DFARS 252.227-7013 and/or in similar or successor
|
||||
* clauses in the FAR or the DOD or NASA FAR Supplement.
|
||||
* Unpublished-- rights reserved under the copyright laws of the
|
||||
* United States. Contractor/manufacturer is Silicon Graphics,
|
||||
* Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
|
||||
*
|
||||
* OpenGL(TM) is a trademark of Silicon Graphics, Inc.
|
||||
*/
|
||||
|
||||
/* Original name: accanti.c
|
||||
*
|
||||
* Conversion to UGL/Mesa by Stephane Raimbault
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ugl/ugl.h>
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglinput.h>
|
||||
|
||||
#include <GL/uglmesa.h>
|
||||
#include <GL/uglglutshapes.h>
|
||||
|
||||
#include "../book/jitter.h"
|
||||
|
||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||
UGL_LOCAL UGL_MESA_CONTEXT umc;
|
||||
|
||||
/* Initialize lighting and other values.
|
||||
*/
|
||||
UGL_LOCAL void initGL(GLsizei w, GLsizei h)
|
||||
{
|
||||
GLfloat mat_ambient[] = { 1.0, 1.0, 1.0, 1.0 };
|
||||
GLfloat mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
|
||||
GLfloat light_position[] = { 0.0, 0.0, 10.0, 1.0 };
|
||||
GLfloat lm_ambient[] = { 0.2, 0.2, 0.2, 1.0 };
|
||||
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
|
||||
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
|
||||
glMaterialf(GL_FRONT, GL_SHININESS, 50.0);
|
||||
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
|
||||
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lm_ambient);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
glDepthFunc(GL_LESS);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glShadeModel (GL_FLAT);
|
||||
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClearAccum(0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
if (w <= h)
|
||||
glOrtho (-2.25, 2.25, -2.25*h/w, 2.25*h/w, -10.0, 10.0);
|
||||
else
|
||||
glOrtho (-2.25*w/h, 2.25*w/h, -2.25, 2.25, -10.0, 10.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
UGL_LOCAL void displayObjects(void)
|
||||
{
|
||||
GLfloat torus_diffuse[] = { 0.7, 0.7, 0.0, 1.0 };
|
||||
GLfloat cube_diffuse[] = { 0.0, 0.7, 0.7, 1.0 };
|
||||
GLfloat sphere_diffuse[] = { 0.7, 0.0, 0.7, 1.0 };
|
||||
GLfloat octa_diffuse[] = { 0.7, 0.4, 0.4, 1.0 };
|
||||
|
||||
glPushMatrix ();
|
||||
glRotatef (30.0, 1.0, 0.0, 0.0);
|
||||
|
||||
glPushMatrix ();
|
||||
glTranslatef (-0.80, 0.35, 0.0);
|
||||
glRotatef (100.0, 1.0, 0.0, 0.0);
|
||||
glMaterialfv(GL_FRONT, GL_DIFFUSE, torus_diffuse);
|
||||
glutSolidTorus (0.275, 0.85, 16, 16);
|
||||
glPopMatrix ();
|
||||
|
||||
glPushMatrix ();
|
||||
glTranslatef (-0.75, -0.50, 0.0);
|
||||
glRotatef (45.0, 0.0, 0.0, 1.0);
|
||||
glRotatef (45.0, 1.0, 0.0, 0.0);
|
||||
glMaterialfv(GL_FRONT, GL_DIFFUSE, cube_diffuse);
|
||||
glutSolidCube (1.5);
|
||||
glPopMatrix ();
|
||||
|
||||
glPushMatrix ();
|
||||
glTranslatef (0.75, 0.60, 0.0);
|
||||
glRotatef (30.0, 1.0, 0.0, 0.0);
|
||||
glMaterialfv(GL_FRONT, GL_DIFFUSE, sphere_diffuse);
|
||||
glutSolidSphere (1.0, 16, 16);
|
||||
glPopMatrix ();
|
||||
|
||||
glPushMatrix ();
|
||||
glTranslatef (0.70, -0.90, 0.25);
|
||||
glMaterialfv(GL_FRONT, GL_DIFFUSE, octa_diffuse);
|
||||
glutSolidOctahedron ();
|
||||
glPopMatrix ();
|
||||
|
||||
glPopMatrix ();
|
||||
}
|
||||
|
||||
#define ACSIZE 8
|
||||
|
||||
UGL_LOCAL void drawGL(void)
|
||||
{
|
||||
GLint viewport[4];
|
||||
int jitter;
|
||||
|
||||
glGetIntegerv (GL_VIEWPORT, viewport);
|
||||
|
||||
glClear(GL_ACCUM_BUFFER_BIT);
|
||||
for (jitter = 0; jitter < ACSIZE; jitter++)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glPushMatrix ();
|
||||
/* Note that 4.5 is the distance in world space between
|
||||
* left and right and bottom and top.
|
||||
* This formula converts fractional pixel movement to
|
||||
* world coordinates.
|
||||
*/
|
||||
glTranslatef (j8[jitter].x*4.5/viewport[2],
|
||||
j8[jitter].y*4.5/viewport[3], 0.0);
|
||||
displayObjects ();
|
||||
glPopMatrix ();
|
||||
glAccum(GL_ACCUM, 1.0/ACSIZE);
|
||||
}
|
||||
glAccum (GL_RETURN, 1.0);
|
||||
glFlush();
|
||||
|
||||
uglMesaSwapBuffers();
|
||||
}
|
||||
|
||||
UGL_LOCAL int getEvent(void)
|
||||
{
|
||||
UGL_EVENT event;
|
||||
UGL_STATUS status;
|
||||
int retVal = 0;
|
||||
|
||||
status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
|
||||
|
||||
while (status != UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
UGL_INPUT_EVENT * pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
retVal = 1;
|
||||
|
||||
status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
|
||||
}
|
||||
|
||||
return(retVal);
|
||||
}
|
||||
|
||||
void windMLAccum (UGL_BOOL windMLMode);
|
||||
|
||||
void uglaccum (void)
|
||||
{
|
||||
taskSpawn("tAccum", 210, VX_FP_TASK, 100000,
|
||||
(FUNCPTR)windMLAccum,UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
void windMLAccum (UGL_BOOL windMLMode)
|
||||
{
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
GLsizei width, height;
|
||||
|
||||
uglInitialize();
|
||||
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
|
||||
|
||||
uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
|
||||
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContextExt(UGL_MESA_DOUBLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE,
|
||||
16,
|
||||
0,
|
||||
8,8,8,0,
|
||||
NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContextExt(UGL_MESA_DOUBLE,
|
||||
16,
|
||||
0,
|
||||
8,8,8,0,
|
||||
NULL);
|
||||
|
||||
if (umc == NULL)
|
||||
{
|
||||
uglDeinitialize();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fullscreen */
|
||||
|
||||
uglMesaMakeCurrentContext(umc, 0, 0,
|
||||
UGL_MESA_FULLSCREEN_WIDTH,
|
||||
UGL_MESA_FULLSCREEN_HEIGHT);
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
|
||||
uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
|
||||
|
||||
initGL(width, height);
|
||||
|
||||
drawGL();
|
||||
|
||||
while (!getEvent());
|
||||
|
||||
uglEventQDestroy (eventServiceId, qId);
|
||||
|
||||
uglMesaDestroyContext();
|
||||
uglDeinitialize();
|
||||
|
||||
return;
|
||||
}
|
198
progs/windml/uglalldemos.c
Normal file
198
progs/windml/uglalldemos.c
Normal file
@@ -0,0 +1,198 @@
|
||||
|
||||
/* uglalldemos.c - WindML/Mesa example program */
|
||||
|
||||
/* Copyright (C) 2001 by Wind River Systems, Inc */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* The MIT License
|
||||
* 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
|
||||
* THE AUTHORS OR COPYRIGHT 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
02a,29aug01,sra WindML mode added
|
||||
01a,17jul01,sra written
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
Show all the UGL/Mesa demos
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <vxWorks.h>
|
||||
#include <taskLib.h>
|
||||
#include <ugl/ugl.h>
|
||||
#include <ugl/uglinput.h>
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglfont.h>
|
||||
|
||||
#define BLACK 0
|
||||
#define RED 1
|
||||
|
||||
struct _colorStruct
|
||||
{
|
||||
UGL_RGB rgbColor;
|
||||
UGL_COLOR uglColor;
|
||||
}
|
||||
colorTable[] =
|
||||
{
|
||||
{ UGL_MAKE_RGB(0, 0, 0), 0},
|
||||
{ UGL_MAKE_RGB(255, 0, 0), 0},
|
||||
};
|
||||
|
||||
void windMLPoint (UGL_BOOL windMLMode);
|
||||
void windMLLine (UGL_BOOL windMLMode);
|
||||
void windMLFlip (UGL_BOOL windMLMode);
|
||||
void windMLCube (UGL_BOOL windMLMode);
|
||||
void windMLBounce (UGL_BOOL windMLMode);
|
||||
void windMLGears (UGL_BOOL windMLMode);
|
||||
void windMLIcoTorus (UGL_BOOL windMLMode);
|
||||
void windMLOlympic (UGL_BOOL windMLMode);
|
||||
void windMLTexCube (UGL_BOOL windMLMode);
|
||||
void windMLTexCyl (UGL_BOOL windMLMode);
|
||||
void windMLTeapot (UGL_BOOL windMLMode);
|
||||
void windMLStencil (UGL_BOOL windMLMode);
|
||||
void windMLDrawPix (UGL_BOOL windMLMode);
|
||||
void windMLAccum (UGL_BOOL windMLMode);
|
||||
void windMLAllDemos (void);
|
||||
|
||||
void uglalldemos (void)
|
||||
{
|
||||
taskSpawn("tAllDemos", 210, VX_FP_TASK, 200000,
|
||||
(FUNCPTR)windMLAllDemos, 0,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
void windMLAllDemos(void)
|
||||
{
|
||||
UGL_BOOL windMLFlag = UGL_FALSE;
|
||||
UGL_FB_INFO fbInfo;
|
||||
UGL_EVENT event;
|
||||
UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_EVENT_Q_ID qId;
|
||||
UGL_INPUT_EVENT * pInputEvent;
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
UGL_DEVICE_ID devId;
|
||||
UGL_GC_ID gc;
|
||||
UGL_FONT_ID fontId;
|
||||
UGL_FONT_DEF fontDef;
|
||||
UGL_FONT_DRIVER_ID fontDrvId;
|
||||
UGL_ORD textOrigin = UGL_FONT_TEXT_UPPER_LEFT;
|
||||
int displayHeight, displayWidth;
|
||||
int textWidth, textHeight;
|
||||
static UGL_CHAR * message =
|
||||
"Do you want to use WindML exclusively ? (y/n) ";
|
||||
|
||||
uglInitialize();
|
||||
|
||||
uglDriverFind (UGL_DISPLAY_TYPE, 0, (UGL_UINT32 *)&devId);
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
|
||||
uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
|
||||
gc = uglGcCreate(devId);
|
||||
|
||||
uglDriverFind (UGL_FONT_ENGINE_TYPE, 0, (UGL_UINT32 *)&fontDrvId);
|
||||
uglFontDriverInfo(fontDrvId, UGL_FONT_TEXT_ORIGIN, &textOrigin);
|
||||
|
||||
uglFontFindString(fontDrvId, "familyName=Helvetica; pixelSize = 18",
|
||||
&fontDef);
|
||||
|
||||
if ((fontId = uglFontCreate(fontDrvId, &fontDef)) == UGL_NULL)
|
||||
{
|
||||
printf("Font not found. Exiting.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
uglInfo(devId, UGL_FB_INFO_REQ, &fbInfo);
|
||||
displayWidth = fbInfo.width;
|
||||
displayHeight = fbInfo.height;
|
||||
|
||||
uglColorAlloc (devId, &colorTable[BLACK].rgbColor, UGL_NULL,
|
||||
&colorTable[BLACK].uglColor, 1);
|
||||
uglColorAlloc(devId, &colorTable[RED].rgbColor, UGL_NULL,
|
||||
&colorTable[RED].uglColor, 1);
|
||||
|
||||
uglBackgroundColorSet(gc, colorTable[BLACK].uglColor);
|
||||
uglForegroundColorSet(gc, colorTable[RED].uglColor);
|
||||
uglFontSet(gc, fontId);
|
||||
uglTextSizeGet(fontId, &textWidth, &textHeight, -1, message);
|
||||
uglTextDraw(gc, (displayWidth - textWidth) / 2,
|
||||
(displayHeight - textHeight) / 2 - textHeight, -1, message);
|
||||
/* flushQ();
|
||||
*/
|
||||
if (uglEventGet (qId, &event, sizeof (event), UGL_WAIT_FOREVER)
|
||||
!= UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
|
||||
pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
{
|
||||
switch(pInputEvent->type.keyboard.key)
|
||||
{
|
||||
case 'Y':
|
||||
case 'y':
|
||||
windMLFlag = UGL_TRUE;
|
||||
break;
|
||||
default:
|
||||
windMLFlag = UGL_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uglFontDestroy (fontId);
|
||||
uglGcDestroy (gc);
|
||||
uglEventQDestroy (eventServiceId, qId);
|
||||
uglDeinitialize();
|
||||
|
||||
windMLPoint(windMLFlag);
|
||||
|
||||
windMLLine(windMLFlag);
|
||||
|
||||
windMLFlip(windMLFlag);
|
||||
|
||||
windMLCube(windMLFlag);
|
||||
|
||||
windMLBounce(windMLFlag);
|
||||
|
||||
windMLGears(windMLFlag);
|
||||
|
||||
windMLIcoTorus(windMLFlag);
|
||||
|
||||
windMLOlympic(windMLFlag);
|
||||
|
||||
windMLTexCube(windMLFlag);
|
||||
|
||||
windMLTexCyl(windMLFlag);
|
||||
|
||||
windMLTeapot(windMLFlag);
|
||||
|
||||
windMLStencil(windMLFlag);
|
||||
|
||||
windMLDrawPix(windMLFlag);
|
||||
|
||||
windMLAccum(windMLFlag);
|
||||
|
||||
return;
|
||||
}
|
272
progs/windml/uglbounce.c
Normal file
272
progs/windml/uglbounce.c
Normal file
@@ -0,0 +1,272 @@
|
||||
/*
|
||||
* Bouncing ball demo.
|
||||
*
|
||||
* This program is in the public domain
|
||||
*
|
||||
* Brian Paul
|
||||
*
|
||||
* Conversion to GLUT by Mark J. Kilgard
|
||||
*
|
||||
* Conversion to UGL/Mesa by Stephane Raimbault
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ugl/ugl.h>
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglinput.h>
|
||||
|
||||
#include <GL/uglmesa.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
|
||||
|
||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||
UGL_LOCAL UGL_MESA_CONTEXT umc;
|
||||
|
||||
UGL_LOCAL GLuint Ball;
|
||||
UGL_LOCAL GLfloat Zrot, Zstep;
|
||||
UGL_LOCAL GLfloat Xpos, Ypos;
|
||||
UGL_LOCAL GLfloat Xvel, Yvel;
|
||||
UGL_LOCAL GLfloat Xmin, Xmax;
|
||||
UGL_LOCAL GLfloat Ymin;
|
||||
/* UGL_LOCAL GLfloat Ymax = 4.0; */
|
||||
UGL_LOCAL GLfloat G;
|
||||
|
||||
UGL_LOCAL 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;
|
||||
}
|
||||
|
||||
UGL_LOCAL void initGL(GLsizei width, GLsizei height)
|
||||
{
|
||||
float aspect = (float) width / (float) height;
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
uglMesaSetColor(RED, 1.0, 0.0, 0.0);
|
||||
uglMesaSetColor(WHITE, 1.0, 1.0, 1.0);
|
||||
uglMesaSetColor(CYAN, 0.0, 1.0, 1.0);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-6.0 * aspect, 6.0 * aspect, -6.0, 6.0, -6.0, 6.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
}
|
||||
|
||||
UGL_LOCAL void drawGL(void)
|
||||
{
|
||||
GLint i;
|
||||
static float vel0 = -100.0;
|
||||
|
||||
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();
|
||||
|
||||
uglMesaSwapBuffers();
|
||||
|
||||
Zrot += Zstep;
|
||||
|
||||
Xpos += Xvel;
|
||||
if (Xpos >= Xmax)
|
||||
{
|
||||
Xpos = Xmax;
|
||||
Xvel = -Xvel;
|
||||
Zstep = -Zstep;
|
||||
}
|
||||
if (Xpos <= Xmin)
|
||||
{
|
||||
Xpos = Xmin;
|
||||
Xvel = -Xvel;
|
||||
Zstep = -Zstep;
|
||||
}
|
||||
Ypos += Yvel;
|
||||
Yvel += G;
|
||||
if (Ypos < Ymin)
|
||||
{
|
||||
Ypos = Ymin;
|
||||
if (vel0 == -100.0)
|
||||
vel0 = fabs(Yvel);
|
||||
Yvel = vel0;
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL int getEvent(void)
|
||||
{
|
||||
UGL_EVENT event;
|
||||
UGL_STATUS status;
|
||||
int retVal = 0;
|
||||
|
||||
status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
|
||||
|
||||
while (status != UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
UGL_INPUT_EVENT * pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
retVal = 1;
|
||||
|
||||
status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
|
||||
}
|
||||
|
||||
return(retVal);
|
||||
}
|
||||
|
||||
void windMLBounce (UGL_BOOL windMLMode);
|
||||
|
||||
void uglbounce (void)
|
||||
{
|
||||
taskSpawn("tBounce", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLBounce,
|
||||
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
void windMLBounce(UGL_BOOL windMLMode)
|
||||
{
|
||||
GLsizei width, height;
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
|
||||
Zrot = 0.0;
|
||||
Zstep = 6.0;
|
||||
Xpos = 0.0;
|
||||
Ypos = 1.0;
|
||||
Xvel = 0.2;
|
||||
Yvel = 0.0;
|
||||
Xmin = -4.0;
|
||||
Xmax = 4.0;
|
||||
Ymin = -3.8;
|
||||
G = -0.1;
|
||||
|
||||
uglInitialize();
|
||||
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
|
||||
|
||||
uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
|
||||
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||
|
||||
if (umc == NULL)
|
||||
{
|
||||
uglDeinitialize();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fullscreen */
|
||||
|
||||
uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
|
||||
UGL_MESA_FULLSCREEN_HEIGHT);
|
||||
|
||||
Ball = make_ball();
|
||||
glCullFace(GL_BACK);
|
||||
glEnable(GL_CULL_FACE);
|
||||
glDisable(GL_DITHER);
|
||||
glShadeModel(GL_FLAT);
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
|
||||
uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
|
||||
|
||||
initGL(width, height);
|
||||
|
||||
while(!getEvent())
|
||||
drawGL();
|
||||
|
||||
uglEventQDestroy (eventServiceId, qId);
|
||||
|
||||
uglMesaDestroyContext();
|
||||
uglDeinitialize ();
|
||||
|
||||
return;
|
||||
}
|
257
progs/windml/uglcube.c
Normal file
257
progs/windml/uglcube.c
Normal file
@@ -0,0 +1,257 @@
|
||||
/* uglcube.c - WindML/Mesa example program */
|
||||
|
||||
/* Copyright (C) 2001 by Wind River Systems, Inc */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* The MIT License
|
||||
* 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
|
||||
* THE AUTHORS OR COPYRIGHT 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
Draw a smooth cube.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglinput.h>
|
||||
|
||||
#include <GL/uglmesa.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||
UGL_LOCAL UGL_MESA_CONTEXT umc;
|
||||
UGL_LOCAL GLfloat rotx;
|
||||
UGL_LOCAL GLfloat roty;
|
||||
UGL_LOCAL GLuint theCube;
|
||||
|
||||
UGL_LOCAL void cube()
|
||||
{
|
||||
|
||||
/* Front */
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(0.0f, 0.0f, 1.0f);
|
||||
glVertex3f(-1.0f, 1.0f, 1.0f);
|
||||
glColor3f(0.0f, 1.0f, 0.0f);
|
||||
glVertex3f(1.0f, 1.0f, 1.0f);
|
||||
glColor3f(1.0f, 0.0f, 0.0f);
|
||||
glVertex3f(1.0f, -1.0f, 1.0f);
|
||||
glColor3f(1.0f, 1.0f, 0.0f);
|
||||
glVertex3f(-1.0f, -1.0f, 1.0f);
|
||||
glEnd();
|
||||
|
||||
|
||||
/* Back */
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(0.0f, 0.0f, 1.0f);
|
||||
glVertex3f(-1.0f, 1.0f, -1.0f);
|
||||
glColor3f(0.0f, 1.0f, 0.0f);
|
||||
glVertex3f(1.0f, 1.0f, -1.0f);
|
||||
glColor3f(1.0f, 0.0f, 0.0f);
|
||||
glVertex3f(1.0f, -1.0f, -1.0f);
|
||||
glColor3f(1.0f, 1.0f, 0.0f);
|
||||
glVertex3f(-1.0f, -1.0f, -1.0f);
|
||||
glEnd();
|
||||
|
||||
|
||||
/* Right */
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(0.0f, 1.0f, 0.0f);
|
||||
glVertex3f(1.0f, 1.0f, 1.0f);
|
||||
glColor3f(0.0f, 1.0f, 0.0f);
|
||||
glVertex3f(1.0f, 1.0f, -1.0f);
|
||||
glColor3f(1.0f, 0.0f, 0.0f);
|
||||
glVertex3f(1.0f, -1.0f, -1.0f);
|
||||
glColor3f(1.0f, 0.0f, 0.0f);
|
||||
glVertex3f(1.0f, -1.0f, 1.0f);
|
||||
glEnd();
|
||||
|
||||
/* Left */
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(0.0f, 0.0f, 1.0f);
|
||||
glVertex3f(-1.0f, 1.0f, 1.0f);
|
||||
glColor3f(0.0f, 0.0f, 1.0f);
|
||||
glVertex3f(-1.0f, 1.0f, -1.0f);
|
||||
glColor3f(1.0f, 1.0f, 0.0f);
|
||||
glVertex3f(-1.0f, -1.0f, -1.0f);
|
||||
glColor3f(1.0f, 1.0f, 0.0f);
|
||||
glVertex3f(-1.0f, -1.0f, 1.0f);
|
||||
glEnd();
|
||||
|
||||
/* Top */
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(0.0f, 0.0f, 1.0f);
|
||||
glVertex3f(-1.0f, 1.0f, -1.0f);
|
||||
glColor3f(0.0f, 1.0f, 0.0f);
|
||||
glVertex3f(1.0f, 1.0f, -1.0f);
|
||||
glColor3f(0.0f, 1.0f, 0.0f);
|
||||
glVertex3f(1.0f, 1.0f, 1.0f);
|
||||
glColor3f(0.0f, 0.0f, 1.0f);
|
||||
glVertex3f(-1.0f, 1.0f, 1.0f);
|
||||
glEnd();
|
||||
|
||||
|
||||
/* Bottom */
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f(1.0f, 1.0f, 0.0f);
|
||||
glVertex3f(-1.0f, -1.0f, -1.0f);
|
||||
glColor3f(1.0f, 0.0f, 0.0f);
|
||||
glVertex3f(1.0f, -1.0f, -1.0f);
|
||||
glColor3f(1.0f, 0.0f, 0.0f);
|
||||
glVertex3f(1.0f, -1.0f, 1.0f);
|
||||
glColor3f(1.0f, 1.0f, 0.0f);
|
||||
glVertex3f(-1.0f, -1.0f, 1.0f);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
UGL_LOCAL void initGL
|
||||
(
|
||||
int Width,
|
||||
int Height
|
||||
)
|
||||
{
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glDepthFunc(GL_LESS);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glShadeModel(GL_SMOOTH);
|
||||
|
||||
theCube = glGenLists(1);
|
||||
glNewList(theCube, GL_COMPILE);
|
||||
cube();
|
||||
glEndList();
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(45.0f, (GLfloat) Width / (GLfloat) Height, 0.1f, 100.0f);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0f, 0.0f, -6.0f);
|
||||
}
|
||||
|
||||
|
||||
/* The main drawing function. */
|
||||
|
||||
UGL_LOCAL void drawGL()
|
||||
{
|
||||
|
||||
/* Clear The Screen And The Depth Buffer */
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
/* Rotate the cube */
|
||||
|
||||
glRotatef(rotx, 1.0f, 0.0f, 0.0f);
|
||||
glRotatef(roty, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
glCallList(theCube);
|
||||
|
||||
glFlush();
|
||||
|
||||
uglMesaSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
/* The function called whenever a key is pressed. */
|
||||
|
||||
UGL_LOCAL int getEvent(void)
|
||||
{
|
||||
UGL_EVENT event;
|
||||
UGL_STATUS status;
|
||||
int retVal = 0;
|
||||
|
||||
status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
|
||||
|
||||
while (status != UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
UGL_INPUT_EVENT * pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
retVal = 1;
|
||||
|
||||
status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
|
||||
}
|
||||
|
||||
return(retVal);
|
||||
}
|
||||
|
||||
void windMLCube (UGL_BOOL windMLMode);
|
||||
|
||||
void uglcube (void)
|
||||
{
|
||||
taskSpawn("tCube", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLCube,
|
||||
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
void windMLCube (UGL_BOOL windMLMode)
|
||||
{
|
||||
GLsizei width, height;
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
|
||||
rotx = 2.5f;
|
||||
roty = 1.0f;
|
||||
|
||||
uglInitialize();
|
||||
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
|
||||
|
||||
if (uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0,
|
||||
(UGL_UINT32 *)&eventServiceId) == UGL_STATUS_OK)
|
||||
{
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
eventServiceId = UGL_NULL;
|
||||
}
|
||||
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||
|
||||
/* Fullscreen */
|
||||
|
||||
uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
|
||||
UGL_MESA_FULLSCREEN_HEIGHT);
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
|
||||
uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
|
||||
|
||||
/* Initialize our window. */
|
||||
|
||||
initGL(width, height);
|
||||
|
||||
while (!getEvent())
|
||||
drawGL();
|
||||
|
||||
if (eventServiceId != UGL_NULL)
|
||||
uglEventQDestroy (eventServiceId, qId);
|
||||
|
||||
uglMesaDestroyContext();
|
||||
uglDeinitialize();
|
||||
|
||||
return;
|
||||
}
|
438
progs/windml/ugldrawpix.c
Normal file
438
progs/windml/ugldrawpix.c
Normal file
@@ -0,0 +1,438 @@
|
||||
/*
|
||||
* glDrawPixels demo/test/benchmark
|
||||
*
|
||||
* Brian Paul September 25, 1997 This file is in the public domain.
|
||||
*
|
||||
* Conversion to UGL/Mesa by Stephane Raimbault july, 2001
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: ugldrawpix.c,v $
|
||||
* Revision 1.2 2001/09/10 19:21:13 brianp
|
||||
* WindML updates (Stephane Raimbault)
|
||||
*
|
||||
* Revision 1.1 2001/08/20 16:07:11 brianp
|
||||
* WindML driver (Stephane Raimbault)
|
||||
*
|
||||
* Revision 1.5 2000/12/24 22:53:54 pesco
|
||||
* * demos/Makefile.am (INCLUDES): Added -I$(top_srcdir)/util.
|
||||
* * demos/Makefile.X11, demos/Makefile.BeOS-R4, demos/Makefile.cygnus:
|
||||
* Essentially the same.
|
||||
* Program files updated to include "readtex.c", not "../util/readtex.c".
|
||||
* * demos/reflect.c: Likewise for "showbuffer.c".
|
||||
*
|
||||
*
|
||||
* * Makefile.am (EXTRA_DIST): Added top-level regular files.
|
||||
*
|
||||
* * include/GL/Makefile.am (INC_X11): Added glxext.h.
|
||||
*
|
||||
*
|
||||
* * src/GGI/include/ggi/mesa/Makefile.am (EXTRA_HEADERS): Include
|
||||
* Mesa GGI headers in dist even if HAVE_GGI is not given.
|
||||
*
|
||||
* * configure.in: Look for GLUT and demo source dirs in $srcdir.
|
||||
*
|
||||
* * src/swrast/Makefile.am (libMesaSwrast_la_SOURCES): Set to *.[ch].
|
||||
* More source list updates in various Makefile.am's.
|
||||
*
|
||||
* * Makefile.am (dist-hook): Remove CVS directory from distribution.
|
||||
* (DIST_SUBDIRS): List all possible subdirs here.
|
||||
* (SUBDIRS): Only list subdirs selected for build again.
|
||||
* The above two applied to all subdir Makefile.am's also.
|
||||
*
|
||||
* Revision 1.4 2000/09/08 21:45:21 brianp
|
||||
* added dither key option
|
||||
*
|
||||
* Revision 1.3 1999/10/28 18:23:29 brianp
|
||||
* minor changes to Usage() function
|
||||
*
|
||||
* Revision 1.2 1999/10/21 22:13:58 brianp
|
||||
* added f key to toggle front/back drawing
|
||||
*
|
||||
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
|
||||
* Imported sources
|
||||
*
|
||||
* Revision 3.3 1999/03/28 18:18:33 brianp
|
||||
* minor clean-up
|
||||
*
|
||||
* Revision 3.2 1998/11/05 04:34:04 brianp
|
||||
* moved image files to ../images/ directory
|
||||
*
|
||||
* Revision 3.1 1998/02/22 16:43:17 brianp
|
||||
* added a few casts to silence compiler warnings
|
||||
*
|
||||
* Revision 3.0 1998/02/14 18:42:29 brianp
|
||||
* initial rev
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <tickLib.h>
|
||||
|
||||
#include <ugl/ugl.h>
|
||||
#include <ugl/uglucode.h>
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglinput.h>
|
||||
|
||||
#include <GL/uglmesa.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#include "../util/readtex.h"
|
||||
|
||||
#define IMAGE_FILE "Mesa/images/wrs_logo.rgb"
|
||||
|
||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||
UGL_LOCAL volatile UGL_BOOL stopWex;
|
||||
UGL_LOCAL UGL_MESA_CONTEXT umc;
|
||||
|
||||
UGL_LOCAL int ImgWidth, ImgHeight;
|
||||
UGL_LOCAL GLenum ImgFormat;
|
||||
UGL_LOCAL GLubyte *Image;
|
||||
|
||||
UGL_LOCAL int Xpos, Ypos;
|
||||
UGL_LOCAL int SkipPixels, SkipRows;
|
||||
UGL_LOCAL int DrawWidth, DrawHeight;
|
||||
UGL_LOCAL float Xzoom, Yzoom;
|
||||
UGL_LOCAL GLboolean Scissor;
|
||||
UGL_LOCAL GLboolean DrawFront;
|
||||
UGL_LOCAL GLboolean Dither;
|
||||
|
||||
UGL_LOCAL void cleanUp (void);
|
||||
|
||||
UGL_LOCAL void reset(void)
|
||||
{
|
||||
Xpos = Ypos = 20;
|
||||
DrawWidth = ImgWidth;
|
||||
DrawHeight = ImgHeight;
|
||||
SkipPixels = SkipRows = 0;
|
||||
Scissor = GL_FALSE;
|
||||
Xzoom = Yzoom = 1.0;
|
||||
}
|
||||
|
||||
UGL_LOCAL void initGL(GLboolean ciMode, GLsizei width, GLsizei height)
|
||||
{
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
|
||||
Image = LoadRGBImage(IMAGE_FILE, &ImgWidth, &ImgHeight, &ImgFormat);
|
||||
if (!Image)
|
||||
{
|
||||
printf("Couldn't read %s\n", IMAGE_FILE);
|
||||
cleanUp();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glScissor(width/4, height/4, width/2, height/2);
|
||||
|
||||
if (ciMode)
|
||||
{
|
||||
/* Convert RGB image to grayscale */
|
||||
GLubyte *indexImage = 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;
|
||||
uglMesaSetColor(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();
|
||||
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glOrtho( 0.0, width, 0.0, height, -1.0, 1.0 );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
UGL_LOCAL void drawGL(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
/* This allows negative raster positions: */
|
||||
glRasterPos2i(0, 0);
|
||||
glBitmap(0, 0, 0, 0, Xpos, Ypos, NULL);
|
||||
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, SkipPixels);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, SkipRows);
|
||||
|
||||
glPixelZoom( Xzoom, Yzoom );
|
||||
|
||||
if (Scissor)
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
glDrawPixels(DrawWidth, DrawHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
uglMesaSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
UGL_LOCAL void benchmark( void )
|
||||
{
|
||||
int startTick, endTick, ticksBySec;
|
||||
int draws;
|
||||
double seconds, pixelsPerSecond;
|
||||
|
||||
printf("Benchmarking (4 sec)...\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 (DrawFront)
|
||||
glDrawBuffer(GL_FRONT);
|
||||
else
|
||||
glDrawBuffer(GL_BACK);
|
||||
|
||||
/* Run timing test */
|
||||
draws = 0;
|
||||
|
||||
ticksBySec = sysClkRateGet ();
|
||||
startTick = tickGet();
|
||||
|
||||
do {
|
||||
glDrawPixels(DrawWidth, DrawHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
|
||||
draws++;
|
||||
endTick = tickGet ();
|
||||
} while ((endTick - startTick)/ticksBySec < 4); /* 4 seconds */
|
||||
|
||||
/* GL clean-up */
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
/* Results */
|
||||
seconds = (endTick - startTick)/ticksBySec;
|
||||
pixelsPerSecond = draws * DrawWidth * DrawHeight / seconds;
|
||||
printf("Result: %d draws in %f seconds = %f pixels/sec\n",
|
||||
draws, seconds, pixelsPerSecond);
|
||||
}
|
||||
|
||||
UGL_LOCAL void echoUse(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 front/back buffer drawing\n");
|
||||
printf(" d Toggle dithering\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");
|
||||
}
|
||||
|
||||
|
||||
UGL_LOCAL void readKey(UGL_WCHAR key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case UGL_UNI_SPACE:
|
||||
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 'b':
|
||||
benchmark();
|
||||
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 UGL_UNI_UP_ARROW:
|
||||
Ypos += 1;
|
||||
break;
|
||||
case UGL_UNI_DOWN_ARROW:
|
||||
Ypos -= 1;
|
||||
break;
|
||||
case UGL_UNI_LEFT_ARROW:
|
||||
Xpos -= 1;
|
||||
break;
|
||||
case UGL_UNI_RIGHT_ARROW:
|
||||
Xpos += 1;
|
||||
break;
|
||||
case UGL_UNI_ESCAPE:
|
||||
stopWex = UGL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL void loopEvent(void)
|
||||
{
|
||||
UGL_EVENT event;
|
||||
UGL_INPUT_EVENT * pInputEvent;
|
||||
|
||||
UGL_FOREVER
|
||||
{
|
||||
if (uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT)
|
||||
!= UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
|
||||
pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
readKey(pInputEvent->type.keyboard.key);
|
||||
}
|
||||
|
||||
drawGL();
|
||||
if (stopWex)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL void cleanUp (void)
|
||||
{
|
||||
uglEventQDestroy (eventServiceId, qId);
|
||||
|
||||
uglMesaDestroyContext();
|
||||
uglDeinitialize ();
|
||||
}
|
||||
|
||||
void windMLDrawPix (UGL_BOOL windMLMode);
|
||||
|
||||
void ugldrawpix (void)
|
||||
{
|
||||
taskSpawn ("tDrawPix", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLDrawPix,
|
||||
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
void windMLDrawPix (UGL_BOOL windMLMode)
|
||||
{
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
GLuint ciMode;
|
||||
GLsizei width, height;
|
||||
|
||||
Image = NULL;
|
||||
Scissor = GL_FALSE;
|
||||
DrawFront = GL_FALSE;
|
||||
Dither = GL_TRUE;
|
||||
|
||||
uglInitialize ();
|
||||
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0,
|
||||
(UGL_UINT32 *)&keyboardDevId);
|
||||
|
||||
uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
|
||||
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
|
||||
/* Double buffering */
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||
|
||||
if (umc == NULL)
|
||||
{
|
||||
uglDeinitialize ();
|
||||
return;
|
||||
}
|
||||
|
||||
uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
|
||||
UGL_MESA_FULLSCREEN_HEIGHT);
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_COLOR_INDEXED, &ciMode);
|
||||
uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
|
||||
uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
|
||||
|
||||
initGL(ciMode, width, height);
|
||||
|
||||
echoUse();
|
||||
|
||||
stopWex = UGL_FALSE;
|
||||
loopEvent();
|
||||
|
||||
cleanUp();
|
||||
free(Image);
|
||||
|
||||
return;
|
||||
}
|
224
progs/windml/uglflip.c
Normal file
224
progs/windml/uglflip.c
Normal file
@@ -0,0 +1,224 @@
|
||||
|
||||
/* uglflip.c - WindML/Mesa example program */
|
||||
|
||||
/* Copyright (C) 2001 by Wind River Systems, Inc */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* The MIT License
|
||||
* 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
|
||||
* THE AUTHORS OR COPYRIGHT 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Stephane Raimbault <stephane.raimbault@windriver.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
Draw a triangle and flip the screen
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ugl/ugl.h>
|
||||
#include <ugl/uglucode.h>
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglinput.h>
|
||||
|
||||
#include <GL/uglmesa.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#define BLACK (0)
|
||||
#define RED (1)
|
||||
#define GREEN (2)
|
||||
#define BLUE (3)
|
||||
#define CI_OFFSET 4
|
||||
|
||||
UGL_LOCAL GLuint rgb;
|
||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||
UGL_LOCAL volatile UGL_BOOL stopWex;
|
||||
|
||||
UGL_LOCAL UGL_MESA_CONTEXT umc;
|
||||
|
||||
UGL_LOCAL void initGL (void)
|
||||
{
|
||||
uglMesaSetColor(BLACK, 0.0, 0.0, 0.0);
|
||||
uglMesaSetColor(RED, 1.0, 0.3, 0.3);
|
||||
uglMesaSetColor(GREEN, 0.3, 1.0, 0.3);
|
||||
uglMesaSetColor(BLUE, 0.3, 0.3, 1.0);
|
||||
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClearIndex(BLACK);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
UGL_LOCAL void drawGL (void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
(rgb) ? glColor3f(1.0, 0.3, 0.3) : glIndexi(RED);
|
||||
glVertex2f(0.75, -0.50);
|
||||
(rgb) ? glColor3f(0.3, 1.0, 0.3) : glIndexi(GREEN);
|
||||
glVertex2f(0.0, 0.75);
|
||||
(rgb) ? glColor3f(0.3, 0.3, 1.0) : glIndexi(BLUE);
|
||||
glVertex2f(-0.75, -0.50);
|
||||
glEnd();
|
||||
|
||||
glBegin(GL_LINES);
|
||||
(rgb) ? glColor3f(1.0, 0.3, 0.3) : glIndexi(RED);
|
||||
glVertex2f(-1.0, 1.0);
|
||||
(rgb) ? glColor3f(0.3, 0.3, 1.0) : glIndexi(BLUE);
|
||||
glVertex2f(1.0, -1.0);
|
||||
glEnd();
|
||||
|
||||
glFlush();
|
||||
|
||||
uglMesaSwapBuffers();
|
||||
}
|
||||
|
||||
UGL_LOCAL void echoUse(void)
|
||||
{
|
||||
printf("tFlip keys:\n");
|
||||
printf(" d Toggle dithering\n");
|
||||
printf(" up Reduce the window\n");
|
||||
printf(" down Enlarge the window\n");
|
||||
printf(" page up Y==0 is the bottom line and increases upward\n");
|
||||
printf(" page down Y==0 is the bottom line and increases downward\n");
|
||||
printf(" ESC Exit\n");
|
||||
}
|
||||
|
||||
UGL_LOCAL void readKey (UGL_WCHAR key)
|
||||
{
|
||||
|
||||
switch(key)
|
||||
{
|
||||
case UGL_UNI_UP_ARROW:
|
||||
uglMesaResizeWindow(8, 8);
|
||||
break;
|
||||
case UGL_UNI_DOWN_ARROW:
|
||||
glDrawBuffer(GL_FRONT_LEFT);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glDrawBuffer(GL_BACK_LEFT);
|
||||
uglMesaResizeWindow(-8, -8);
|
||||
break;
|
||||
case UGL_UNI_PAGE_UP:
|
||||
uglMesaPixelStore(UGL_MESA_Y_UP, GL_TRUE);
|
||||
break;
|
||||
case UGL_UNI_PAGE_DOWN:
|
||||
uglMesaPixelStore(UGL_MESA_Y_UP, GL_FALSE);
|
||||
break;
|
||||
case UGL_UNI_ESCAPE:
|
||||
stopWex = UGL_TRUE;
|
||||
break;
|
||||
case 'd':
|
||||
if (glIsEnabled(GL_DITHER))
|
||||
glDisable(GL_DITHER);
|
||||
else
|
||||
glEnable(GL_DITHER);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL void loopEvent(void)
|
||||
{
|
||||
UGL_EVENT event;
|
||||
UGL_INPUT_EVENT * pInputEvent;
|
||||
|
||||
drawGL();
|
||||
|
||||
UGL_FOREVER
|
||||
{
|
||||
if (uglEventGet (qId, &event, sizeof (event), UGL_WAIT_FOREVER)
|
||||
!= UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
|
||||
pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
{
|
||||
readKey(pInputEvent->type.keyboard.key);
|
||||
drawGL();
|
||||
}
|
||||
}
|
||||
|
||||
if (stopWex)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void windMLFlip (UGL_BOOL windMLMode);
|
||||
|
||||
void uglflip (void)
|
||||
{
|
||||
taskSpawn ("tFlip", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLFlip,
|
||||
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
void windMLFlip (UGL_BOOL windMLMode)
|
||||
{
|
||||
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
|
||||
uglInitialize();
|
||||
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
|
||||
|
||||
uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
|
||||
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_SINGLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE_SOFTWARE, NULL);
|
||||
|
||||
if (umc == NULL)
|
||||
{
|
||||
uglDeinitialize();
|
||||
return;
|
||||
}
|
||||
|
||||
uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
|
||||
UGL_MESA_FULLSCREEN_HEIGHT);
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_RGB, &rgb);
|
||||
|
||||
initGL();
|
||||
|
||||
echoUse();
|
||||
stopWex = UGL_FALSE;
|
||||
loopEvent();
|
||||
|
||||
uglEventQDestroy (eventServiceId, qId);
|
||||
|
||||
uglMesaDestroyContext();
|
||||
uglDeinitialize();
|
||||
|
||||
return;
|
||||
}
|
428
progs/windml/uglgears.c
Normal file
428
progs/windml/uglgears.c
Normal file
@@ -0,0 +1,428 @@
|
||||
|
||||
/* uglgears.c - WindML/Mesa example program */
|
||||
|
||||
/*
|
||||
* 3-D gear wheels. This program is in the public domain.
|
||||
*
|
||||
* Brian Paul
|
||||
*
|
||||
* Conversion to GLUT by Mark J. Kilgard
|
||||
* Conversion to UGL/Mesa from GLUT by Stephane Raimbault
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
Spinning gears demo
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <tickLib.h>
|
||||
|
||||
#include <ugl/ugl.h>
|
||||
#include <ugl/uglucode.h>
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglinput.h>
|
||||
#include <GL/uglmesa.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#define COUNT_FRAMES
|
||||
|
||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||
UGL_LOCAL volatile UGL_BOOL stopWex;
|
||||
UGL_LOCAL UGL_MESA_CONTEXT umc;
|
||||
|
||||
UGL_LOCAL GLfloat view_rotx, view_roty, view_rotz;
|
||||
UGL_LOCAL GLint gear1, gear2, gear3;
|
||||
UGL_LOCAL GLfloat angle;
|
||||
|
||||
UGL_LOCAL GLuint limit;
|
||||
UGL_LOCAL GLuint count;
|
||||
UGL_LOCAL GLuint tickStart, tickStop, tickBySec;
|
||||
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
UGL_LOCAL void gear
|
||||
(
|
||||
GLfloat inner_radius,
|
||||
GLfloat outer_radius,
|
||||
GLfloat width,
|
||||
GLint teeth,
|
||||
GLfloat tooth_depth
|
||||
)
|
||||
{
|
||||
GLint i;
|
||||
GLfloat r0, r1, r2;
|
||||
GLfloat angle, da;
|
||||
GLfloat u, v, len;
|
||||
|
||||
r0 = inner_radius;
|
||||
r1 = outer_radius - tooth_depth/2.0;
|
||||
r2 = outer_radius + tooth_depth/2.0;
|
||||
|
||||
da = 2.0*M_PI / teeth / 4.0;
|
||||
|
||||
glShadeModel (GL_FLAT);
|
||||
|
||||
glNormal3f (0.0, 0.0, 1.0);
|
||||
|
||||
/* draw front face */
|
||||
glBegin (GL_QUAD_STRIP);
|
||||
for (i=0;i<=teeth;i++)
|
||||
{
|
||||
angle = i * 2.0*M_PI / teeth;
|
||||
glVertex3f (r0*cos (angle), r0*sin (angle), width*0.5);
|
||||
glVertex3f (r1*cos (angle), r1*sin (angle), width*0.5);
|
||||
glVertex3f (r0*cos (angle), r0*sin (angle), width*0.5);
|
||||
glVertex3f (r1*cos (angle+3*da), r1*sin (angle+3*da), width*0.5);
|
||||
}
|
||||
glEnd ();
|
||||
|
||||
/* draw front sides of teeth */
|
||||
glBegin (GL_QUADS);
|
||||
da = 2.0*M_PI / teeth / 4.0;
|
||||
for (i=0; i<teeth; i++)
|
||||
{
|
||||
angle = i * 2.0*M_PI / teeth;
|
||||
|
||||
glVertex3f (r1*cos (angle), r1*sin (angle), width*0.5);
|
||||
glVertex3f (r2*cos (angle+da), r2*sin (angle+da), width*0.5);
|
||||
glVertex3f (r2*cos (angle+2*da), r2*sin (angle+2*da), width*0.5);
|
||||
glVertex3f (r1*cos (angle+3*da), r1*sin (angle+3*da), width*0.5);
|
||||
}
|
||||
glEnd ();
|
||||
|
||||
|
||||
glNormal3f (0.0, 0.0, -1.0);
|
||||
|
||||
/* draw back face */
|
||||
glBegin (GL_QUAD_STRIP);
|
||||
for (i=0; i<=teeth ;i++)
|
||||
{
|
||||
angle = i * 2.0*M_PI / teeth;
|
||||
glVertex3f (r1*cos (angle), r1*sin (angle), -width*0.5);
|
||||
glVertex3f (r0*cos (angle), r0*sin (angle), -width*0.5);
|
||||
glVertex3f (r1*cos (angle+3*da), r1*sin (angle+3*da), -width*0.5);
|
||||
glVertex3f (r0*cos (angle), r0*sin (angle), -width*0.5);
|
||||
}
|
||||
glEnd ();
|
||||
|
||||
/* draw back sides of teeth */
|
||||
glBegin (GL_QUADS);
|
||||
da = 2.0*M_PI / teeth / 4.0;
|
||||
for (i=0;i<teeth;i++)
|
||||
{
|
||||
angle = i * 2.0*M_PI / teeth;
|
||||
|
||||
glVertex3f (r1*cos (angle+3*da), r1*sin (angle+3*da), -width*0.5);
|
||||
glVertex3f (r2*cos (angle+2*da), r2*sin (angle+2*da), -width*0.5);
|
||||
glVertex3f (r2*cos (angle+da), r2*sin (angle+da), -width*0.5);
|
||||
glVertex3f (r1*cos (angle), r1*sin (angle), -width*0.5);
|
||||
}
|
||||
glEnd ();
|
||||
|
||||
|
||||
/* draw outward faces of teeth */
|
||||
glBegin (GL_QUAD_STRIP);
|
||||
for (i=0;i<teeth;i++)
|
||||
{
|
||||
angle = i * 2.0*M_PI / teeth;
|
||||
|
||||
glVertex3f (r1*cos (angle), r1*sin (angle), width*0.5);
|
||||
glVertex3f (r1*cos (angle), r1*sin (angle), -width*0.5);
|
||||
u = r2*cos (angle+da) - r1*cos (angle);
|
||||
v = r2*sin (angle+da) - r1*sin (angle);
|
||||
len = sqrt (u*u + v*v);
|
||||
u /= len;
|
||||
v /= len;
|
||||
glNormal3f (v, -u, 0.0);
|
||||
glVertex3f (r2*cos (angle+da), r2*sin (angle+da), width*0.5);
|
||||
glVertex3f (r2*cos (angle+da), r2*sin (angle+da), -width*0.5);
|
||||
glNormal3f (cos (angle), sin (angle), 0.0);
|
||||
glVertex3f (r2*cos (angle+2*da), r2*sin (angle+2*da), width*0.5);
|
||||
glVertex3f (r2*cos (angle+2*da), r2*sin (angle+2*da), -width*0.5);
|
||||
u = r1*cos (angle+3*da) - r2*cos (angle+2*da);
|
||||
v = r1*sin (angle+3*da) - r2*sin (angle+2*da);
|
||||
glNormal3f (v, -u, 0.0);
|
||||
glVertex3f (r1*cos (angle+3*da), r1*sin (angle+3*da), width*0.5);
|
||||
glVertex3f (r1*cos (angle+3*da), r1*sin (angle+3*da), -width*0.5);
|
||||
glNormal3f (cos (angle), sin (angle), 0.0);
|
||||
}
|
||||
|
||||
glVertex3f (r1*cos (0), r1*sin (0), width*0.5);
|
||||
glVertex3f (r1*cos (0), r1*sin (0), -width*0.5);
|
||||
|
||||
glEnd ();
|
||||
|
||||
glShadeModel (GL_SMOOTH);
|
||||
|
||||
/* draw inside radius cylinder */
|
||||
glBegin (GL_QUAD_STRIP);
|
||||
for (i=0;i<=teeth;i++)
|
||||
{
|
||||
angle = i * 2.0*M_PI / teeth;
|
||||
glNormal3f (-cos (angle), -sin (angle), 0.0);
|
||||
glVertex3f (r0*cos (angle), r0*sin (angle), -width*0.5);
|
||||
glVertex3f (r0*cos (angle), r0*sin (angle), width*0.5);
|
||||
}
|
||||
glEnd ();
|
||||
|
||||
}
|
||||
|
||||
UGL_LOCAL void drawGL (void)
|
||||
{
|
||||
#ifdef COUNT_FRAMES
|
||||
int time;
|
||||
#endif
|
||||
|
||||
angle += 2.0;
|
||||
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix ();
|
||||
glRotatef (view_rotx, 1.0, 0.0, 0.0);
|
||||
glRotatef (view_roty, 0.0, 1.0, 0.0);
|
||||
glRotatef (view_rotz, 0.0, 0.0, 1.0);
|
||||
|
||||
glPushMatrix ();
|
||||
glTranslatef (-3.0, -2.0, 0.0);
|
||||
glRotatef (angle, 0.0, 0.0, 1.0);
|
||||
glCallList (gear1);
|
||||
glPopMatrix ();
|
||||
|
||||
glPushMatrix ();
|
||||
glTranslatef (3.1, -2.0, 0.0);
|
||||
glRotatef (-2.0*angle-9.0, 0.0, 0.0, 1.0);
|
||||
glCallList (gear2);
|
||||
glPopMatrix ();
|
||||
|
||||
glPushMatrix ();
|
||||
glTranslatef (-3.1, 4.2, 0.0);
|
||||
glRotatef (-2.0*angle-25.0, 0.0, 0.0, 1.0);
|
||||
glCallList (gear3);
|
||||
glPopMatrix ();
|
||||
|
||||
glPopMatrix ();
|
||||
|
||||
glFlush();
|
||||
|
||||
uglMesaSwapBuffers ();
|
||||
|
||||
#ifdef COUNT_FRAMES
|
||||
if (count > limit)
|
||||
{
|
||||
tickStop = tickGet ();
|
||||
time = (tickStop-tickStart)/tickBySec;
|
||||
printf (" %i fps\n", count/time);
|
||||
tickStart = tickStop;
|
||||
count = 0;
|
||||
}
|
||||
else
|
||||
count++;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
UGL_LOCAL void initGL (GLsizei width, GLsizei height)
|
||||
{
|
||||
UGL_LOCAL GLfloat pos[4] = {5.0, 5.0, 10.0, 1.0 };
|
||||
UGL_LOCAL GLfloat red[4] = {0.8, 0.1, 0.0, 1.0 };
|
||||
UGL_LOCAL GLfloat green[4] = {0.0, 0.8, 0.2, 1.0 };
|
||||
UGL_LOCAL GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0 };
|
||||
|
||||
glLightfv (GL_LIGHT0, GL_POSITION, pos);
|
||||
glEnable (GL_CULL_FACE);
|
||||
glEnable (GL_LIGHTING);
|
||||
glEnable (GL_LIGHT0);
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
|
||||
/* make the gears */
|
||||
gear1 = glGenLists (1);
|
||||
glNewList (gear1, GL_COMPILE);
|
||||
glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
|
||||
gear (1.0, 4.0, 1.0, 20, 0.7);
|
||||
glEndList ();
|
||||
|
||||
gear2 = glGenLists (1);
|
||||
glNewList (gear2, GL_COMPILE);
|
||||
glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
|
||||
gear (0.5, 2.0, 2.0, 10, 0.7);
|
||||
glEndList ();
|
||||
|
||||
gear3 = glGenLists (1);
|
||||
glNewList (gear3, GL_COMPILE);
|
||||
glMaterialfv (GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
|
||||
gear (1.3, 2.0, 0.5, 10, 0.7);
|
||||
glEndList ();
|
||||
|
||||
glEnable (GL_NORMALIZE);
|
||||
|
||||
glViewport (0, 0, width, height);
|
||||
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glLoadIdentity ();
|
||||
if (width>height)
|
||||
{
|
||||
GLfloat w = (GLfloat) width / (GLfloat) height;
|
||||
glFrustum (-w, w, -1.0, 1.0, 5.0, 60.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
GLfloat h = (GLfloat) height / (GLfloat) width;
|
||||
glFrustum (-1.0, 1.0, -h, h, 5.0, 60.0);
|
||||
}
|
||||
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glLoadIdentity ();
|
||||
glTranslatef (0.0, 0.0, -40.0);
|
||||
|
||||
#ifdef COUNT_FRAMES
|
||||
tickStart = tickGet ();
|
||||
tickBySec = sysClkRateGet ();
|
||||
#endif
|
||||
}
|
||||
|
||||
UGL_LOCAL void echoUse(void)
|
||||
{
|
||||
printf("tGears keys:\n");
|
||||
printf(" z Counter clockwise rotation (z-axis)\n");
|
||||
printf(" Z Clockwise rotation (z-axis)\n");
|
||||
printf(" Up Counter clockwise rotation (x-axis)\n");
|
||||
printf(" Down Clockwise rotation (x-axis)\n");
|
||||
printf(" Left Counter clockwise rotation (y-axis)\n");
|
||||
printf(" Right Clockwise rotation (y-axis)\n");
|
||||
printf(" ESC Exit\n");
|
||||
}
|
||||
|
||||
|
||||
UGL_LOCAL void readKey (UGL_WCHAR key)
|
||||
{
|
||||
|
||||
switch(key)
|
||||
{
|
||||
case 'z':
|
||||
view_rotz += 5.0;
|
||||
break;
|
||||
case 'Z':
|
||||
view_rotz -= 5.0;
|
||||
break;
|
||||
case UGL_UNI_UP_ARROW:
|
||||
view_rotx += 5.0;
|
||||
break;
|
||||
case UGL_UNI_DOWN_ARROW:
|
||||
view_rotx -= 5.0;
|
||||
break;
|
||||
case UGL_UNI_LEFT_ARROW:
|
||||
view_roty += 5.0;
|
||||
break;
|
||||
case UGL_UNI_RIGHT_ARROW:
|
||||
view_roty -= 5.0;
|
||||
break;
|
||||
case UGL_UNI_ESCAPE:
|
||||
stopWex = UGL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL void loopEvent(void)
|
||||
{
|
||||
UGL_EVENT event;
|
||||
UGL_INPUT_EVENT * pInputEvent;
|
||||
|
||||
UGL_FOREVER
|
||||
{
|
||||
if (uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT)
|
||||
!= UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
|
||||
pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
readKey(pInputEvent->type.keyboard.key);
|
||||
}
|
||||
|
||||
drawGL();
|
||||
if (stopWex)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void windMLGears (UGL_BOOL windMLMode);
|
||||
|
||||
void uglgears (void)
|
||||
{
|
||||
taskSpawn ("tGears", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLGears,
|
||||
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
void windMLGears (UGL_BOOL windMLMode)
|
||||
{
|
||||
GLsizei width, height;
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
|
||||
view_rotx=20.0;
|
||||
view_roty=30.0;
|
||||
view_rotz=0.0;
|
||||
angle = 0.0;
|
||||
limit = 100;
|
||||
count = 1;
|
||||
|
||||
uglInitialize ();
|
||||
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0,
|
||||
(UGL_UINT32 *)&keyboardDevId);
|
||||
|
||||
uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
|
||||
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
|
||||
/* Double buffering */
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||
|
||||
if (umc == NULL)
|
||||
{
|
||||
uglDeinitialize ();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fullscreen */
|
||||
|
||||
uglMesaMakeCurrentContext (umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
|
||||
UGL_MESA_FULLSCREEN_HEIGHT);
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
|
||||
uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
|
||||
|
||||
initGL (width, height);
|
||||
|
||||
echoUse();
|
||||
|
||||
stopWex = UGL_FALSE;
|
||||
loopEvent();
|
||||
|
||||
uglEventQDestroy (eventServiceId, qId);
|
||||
|
||||
uglMesaDestroyContext();
|
||||
uglDeinitialize ();
|
||||
|
||||
return;
|
||||
}
|
315
progs/windml/uglicotorus.c
Normal file
315
progs/windml/uglicotorus.c
Normal file
@@ -0,0 +1,315 @@
|
||||
/* uglicotorus.c - WindML/Mesa example program */
|
||||
|
||||
/* Copyright (C) 2001 by Wind River Systems, Inc */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* The MIT License
|
||||
* 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
|
||||
* THE AUTHORS OR COPYRIGHT 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01a,jun01,sra
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglinput.h>
|
||||
#include <ugl/uglucode.h>
|
||||
|
||||
#include <GL/uglmesa.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
/* Need GLUT_SHAPES */
|
||||
|
||||
#include <GL/uglglutshapes.h>
|
||||
|
||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||
UGL_LOCAL UGL_MESA_CONTEXT umc;
|
||||
UGL_LOCAL volatile UGL_BOOL stopWex;
|
||||
|
||||
UGL_LOCAL GLfloat angle;
|
||||
UGL_LOCAL GLboolean chaos_on;
|
||||
UGL_LOCAL GLboolean color_on;
|
||||
|
||||
UGL_LOCAL GLuint theIco, theTorus, theSphere, theCube;
|
||||
|
||||
UGL_LOCAL void initGL
|
||||
(
|
||||
int w,
|
||||
int h
|
||||
)
|
||||
{
|
||||
glViewport(0,0,(GLsizei)w,(GLsizei)h);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(60.0,(GLfloat)w/(GLfloat)h,1.0,60.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
gluLookAt(0.0,0.0,25.0,0.0,0.0,0.0,0.0,1.0,0.0);
|
||||
|
||||
glClearColor(0.0,0.0,0.0,0.0);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
|
||||
theIco = glGenLists(1);
|
||||
glNewList(theIco, GL_COMPILE);
|
||||
glutSolidIcosahedron();
|
||||
glEndList();
|
||||
|
||||
theTorus = glGenLists(1);
|
||||
glNewList(theTorus, GL_COMPILE);
|
||||
glutSolidTorus(0.2,1.0,10,10);
|
||||
glEndList();
|
||||
|
||||
theSphere = glGenLists(1);
|
||||
glNewList(theSphere, GL_COMPILE);
|
||||
glutSolidSphere(2.5,20,20);
|
||||
glEndList();
|
||||
|
||||
theCube = glGenLists(1);
|
||||
glNewList(theCube, GL_COMPILE);
|
||||
glutSolidCube(4.0);
|
||||
glEndList();
|
||||
|
||||
}
|
||||
|
||||
UGL_LOCAL void createIcoToruses
|
||||
(
|
||||
int i
|
||||
)
|
||||
{
|
||||
glPushMatrix();
|
||||
glRotatef(angle,1.0,1.0,1.0);
|
||||
glCallList(theIco);
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 9 :
|
||||
glColor3f(1.0,0.0,0.0);
|
||||
break;
|
||||
case 0 :
|
||||
glColor3f(1.0,0.1,0.7);
|
||||
break;
|
||||
case 1 :
|
||||
glColor3f(1.0,0.0,1.0);
|
||||
break;
|
||||
case 2 :
|
||||
glColor3f(0.0,0.0,1.0);
|
||||
break;
|
||||
case 3 :
|
||||
glColor3f(0.0,0.5,1.0);
|
||||
break;
|
||||
case 4 :
|
||||
glColor3f(0.0,1.0,0.7);
|
||||
break;
|
||||
case 5 :
|
||||
glColor3f(0.0,1.0,0.0);
|
||||
break;
|
||||
case 6 :
|
||||
glColor3f(0.5,1.0,0.0);
|
||||
break;
|
||||
case 7 :
|
||||
glColor3f(1.0,1.0,0.0);
|
||||
break;
|
||||
case 8 :
|
||||
glColor3f(1.0,0.5,0.0);
|
||||
break;
|
||||
}
|
||||
|
||||
glRotatef(angle,1.0,1.0,1.0);
|
||||
glCallList(theTorus);
|
||||
glRotatef(-2*angle,1.0,1.0,1.0);
|
||||
glCallList(theTorus);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
UGL_LOCAL void drawGL (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (color_on)
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
else
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
if (chaos_on)
|
||||
glRotatef(angle,1.0,1.0,1.0);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(angle,1.0,1.0,1.0);
|
||||
glColor3f(1.0,0.5,0.0);
|
||||
glCallList(theSphere);
|
||||
glColor3f(1.0,0.0,0.0);
|
||||
glCallList(theCube);
|
||||
glPopMatrix();
|
||||
|
||||
glRotatef(-angle,0.0,0.0,1.0);
|
||||
glPushMatrix();
|
||||
/* draw ten icosahedrons */
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
glPushMatrix();
|
||||
glRotatef(36*i,0.0,0.0,1.0);
|
||||
glTranslatef(10.0,0.0,0.0);
|
||||
glRotatef(2*angle,0.0,1.0,0.0);
|
||||
glTranslatef(0.0,0.0,2.0);
|
||||
|
||||
createIcoToruses(i);
|
||||
glPopMatrix();
|
||||
}
|
||||
glPopMatrix();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
uglMesaSwapBuffers();
|
||||
|
||||
angle += 1.0;
|
||||
|
||||
}
|
||||
|
||||
UGL_LOCAL void echoUse(void)
|
||||
{
|
||||
printf("tIcoTorus keys:\n");
|
||||
printf(" c Toggle color buffer clear\n");
|
||||
printf(" SPACE Toggle chaos mode\n");
|
||||
printf(" ESC Exit\n");
|
||||
}
|
||||
|
||||
UGL_LOCAL void readKey (UGL_WCHAR key)
|
||||
{
|
||||
|
||||
switch(key)
|
||||
{
|
||||
case 'c':
|
||||
color_on = !color_on;
|
||||
break;
|
||||
case UGL_UNI_SPACE:
|
||||
chaos_on = !chaos_on;
|
||||
break;
|
||||
case UGL_UNI_ESCAPE:
|
||||
stopWex = UGL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL void loopEvent(void)
|
||||
{
|
||||
UGL_EVENT event;
|
||||
UGL_INPUT_EVENT * pInputEvent;
|
||||
|
||||
UGL_FOREVER
|
||||
{
|
||||
if (uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT)
|
||||
!= UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
|
||||
pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
readKey(pInputEvent->type.keyboard.key);
|
||||
}
|
||||
|
||||
drawGL();
|
||||
if (stopWex)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void windMLIcoTorus (UGL_BOOL windMLMode);
|
||||
|
||||
void uglicotorus (void)
|
||||
{
|
||||
taskSpawn ("tIcoTorus", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLIcoTorus,
|
||||
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
void windMLIcoTorus (UGL_BOOL windMLMode)
|
||||
{
|
||||
GLsizei width, height;
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
|
||||
angle = 0.0;
|
||||
chaos_on = GL_TRUE;
|
||||
color_on = GL_TRUE;
|
||||
|
||||
uglInitialize ();
|
||||
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0,
|
||||
(UGL_UINT32 *)&keyboardDevId);
|
||||
|
||||
if (uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0,
|
||||
(UGL_UINT32 *)&eventServiceId) == UGL_STATUS_OK)
|
||||
{
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
eventServiceId = UGL_NULL;
|
||||
}
|
||||
|
||||
/* Double buffering */
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||
|
||||
if (umc == NULL)
|
||||
{
|
||||
uglDeinitialize ();
|
||||
return;
|
||||
}
|
||||
|
||||
uglMesaMakeCurrentContext (umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
|
||||
UGL_MESA_FULLSCREEN_HEIGHT);
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
|
||||
uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
|
||||
|
||||
initGL (width, height);
|
||||
|
||||
echoUse();
|
||||
|
||||
stopWex = UGL_FALSE;
|
||||
loopEvent();
|
||||
|
||||
if (eventServiceId != UGL_NULL)
|
||||
uglEventQDestroy (eventServiceId, qId);
|
||||
|
||||
uglMesaDestroyContext ();
|
||||
uglDeinitialize ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
274
progs/windml/uglline.c
Normal file
274
progs/windml/uglline.c
Normal file
@@ -0,0 +1,274 @@
|
||||
|
||||
/* uglline.c - WindML/Mesa example program */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
modification history
|
||||
--------------------
|
||||
01a,jun01,sra Ported to UGL/Mesa and modifications
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
Draw circular lines
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ugl/ugl.h>
|
||||
#include <ugl/uglucode.h>
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglinput.h>
|
||||
|
||||
#include <GL/uglmesa.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#define BLACK (0)
|
||||
#define YELLOW (1)
|
||||
#define GREEN (2)
|
||||
#define BLUE (3)
|
||||
#define CI_OFFSET 4
|
||||
|
||||
UGL_LOCAL GLuint rgb;
|
||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||
UGL_LOCAL volatile UGL_BOOL stopWex;
|
||||
UGL_LOCAL UGL_MESA_CONTEXT umc;
|
||||
|
||||
UGL_LOCAL GLboolean mode1, mode2;
|
||||
UGL_LOCAL GLint size;
|
||||
|
||||
UGL_LOCAL GLfloat pntA[3] = {
|
||||
-10.0, 0.0, 0.0
|
||||
};
|
||||
UGL_LOCAL GLfloat pntB[3] = {
|
||||
-5.0, 0.0, 0.0
|
||||
};
|
||||
|
||||
UGL_LOCAL GLint angleA;
|
||||
|
||||
UGL_LOCAL void initGL (void)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
uglMesaSetColor(BLACK, 0.0, 0.0, 0.0);
|
||||
uglMesaSetColor(YELLOW, 1.0, 1.0, 0.0);
|
||||
uglMesaSetColor(GREEN, 0.0, 1.0, 0.0);
|
||||
uglMesaSetColor(BLUE, 0.0, 0.0, 1.0);
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
uglMesaSetColor(CI_OFFSET+i, i/15.0, i/15.0, 0.0);
|
||||
}
|
||||
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClearIndex(BLACK);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-10, 10, -10, 10, -10.0, 10.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glLineStipple(1, 0xF0E0);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
|
||||
mode1 = GL_FALSE;
|
||||
mode2 = GL_FALSE;
|
||||
size = 1;
|
||||
}
|
||||
|
||||
UGL_LOCAL void drawGL (void)
|
||||
{
|
||||
|
||||
GLint ci, i;
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glLineWidth(size);
|
||||
|
||||
if (mode1) {
|
||||
glEnable(GL_LINE_STIPPLE);
|
||||
} else {
|
||||
glDisable(GL_LINE_STIPPLE);
|
||||
}
|
||||
|
||||
if (mode2) {
|
||||
ci = CI_OFFSET;
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
glEnable(GL_BLEND);
|
||||
} else {
|
||||
ci = YELLOW;
|
||||
glDisable(GL_LINE_SMOOTH);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
glRotatef(angleA, 1, 0, 1);
|
||||
angleA = angleA++ % 360;
|
||||
|
||||
for (i = 0; i < 360; i += 5) {
|
||||
glRotatef(5.0, 0, 0, 1);
|
||||
|
||||
glColor3f(1.0, 1.0, 0.0);
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex3fv(pntA);
|
||||
glVertex3fv(pntB);
|
||||
glEnd();
|
||||
|
||||
glPointSize(1);
|
||||
|
||||
glColor3f(0.0, 1.0, 0.0);
|
||||
glBegin(GL_POINTS);
|
||||
glVertex3fv(pntA);
|
||||
glVertex3fv(pntB);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glFlush();
|
||||
|
||||
uglMesaSwapBuffers();
|
||||
|
||||
}
|
||||
|
||||
UGL_LOCAL void echoUse(void)
|
||||
{
|
||||
printf("tLine keys:\n");
|
||||
printf(" b Blending/antialiasing\n");
|
||||
printf(" n Line stipple\n");
|
||||
printf(" Up/Down Pixel size\n");
|
||||
printf(" ESC Exit\n");
|
||||
}
|
||||
|
||||
UGL_LOCAL void readKey (UGL_WCHAR key)
|
||||
{
|
||||
switch(key)
|
||||
{
|
||||
case 'n':
|
||||
mode1 = (mode1) ? GL_FALSE: GL_TRUE;
|
||||
break;
|
||||
case 'b':
|
||||
mode2 = (mode2) ? GL_FALSE: GL_TRUE;
|
||||
break;
|
||||
case UGL_UNI_DOWN_ARROW:
|
||||
if(size>0)
|
||||
size--;
|
||||
break;
|
||||
case UGL_UNI_UP_ARROW:
|
||||
size++;
|
||||
break;
|
||||
case UGL_UNI_ESCAPE:
|
||||
stopWex = UGL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL void loopEvent(void)
|
||||
{
|
||||
UGL_EVENT event;
|
||||
UGL_INPUT_EVENT * pInputEvent;
|
||||
|
||||
UGL_FOREVER
|
||||
{
|
||||
if (uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT)
|
||||
!= UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
|
||||
pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
readKey(pInputEvent->type.keyboard.key);
|
||||
}
|
||||
|
||||
drawGL();
|
||||
if (stopWex)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void windMLLine (UGL_BOOL windMLMode);
|
||||
|
||||
void uglline (void)
|
||||
{
|
||||
taskSpawn("tLine", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLLine,
|
||||
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
|
||||
void windMLLine(UGL_BOOL windMLMode)
|
||||
{
|
||||
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
|
||||
angleA = 0;
|
||||
|
||||
uglInitialize();
|
||||
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
|
||||
|
||||
uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
|
||||
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
|
||||
/* Double buffer */
|
||||
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||
|
||||
if (umc == NULL)
|
||||
{
|
||||
uglDeinitialize();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fullscreen */
|
||||
|
||||
uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
|
||||
UGL_MESA_FULLSCREEN_HEIGHT);
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_RGB, &rgb);
|
||||
|
||||
initGL();
|
||||
|
||||
echoUse();
|
||||
|
||||
stopWex = UGL_FALSE;
|
||||
loopEvent();
|
||||
|
||||
uglEventQDestroy(eventServiceId, qId);
|
||||
|
||||
uglMesaDestroyContext();
|
||||
uglDeinitialize();
|
||||
|
||||
return;
|
||||
}
|
479
progs/windml/uglolympic.c
Normal file
479
progs/windml/uglolympic.c
Normal file
@@ -0,0 +1,479 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Nov 20, 1995 use stdlib's rand()/srand() instead of random()/srand48(), etc.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by Stephane Raimbault to be able to run in VxWorks 07/18/01
|
||||
*
|
||||
* Modified by Li Wei(liwei@aiar.xjtu.edu.cn) to be able to run in Windows
|
||||
* 6/13
|
||||
*
|
||||
* Modified by Brian Paul to compile with Windows OR Unix. 7/23/97
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ugl/ugl.h>
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglinput.h>
|
||||
#include <ugl/uglucode.h>
|
||||
|
||||
#include <GL/uglmesa.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#ifndef RAND_MAX
|
||||
# define RAND_MAX 32767
|
||||
#endif
|
||||
|
||||
#define XSIZE 100
|
||||
#define YSIZE 75
|
||||
|
||||
#define RINGS 5
|
||||
#define BLUERING 0
|
||||
#define BLACKRING 1
|
||||
#define REDRING 2
|
||||
#define YELLOWRING 3
|
||||
#define GREENRING 4
|
||||
|
||||
#define BACKGROUND 8
|
||||
|
||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||
UGL_LOCAL UGL_MESA_CONTEXT umc;
|
||||
UGL_LOCAL volatile UGL_BOOL stopWex;
|
||||
|
||||
UGL_LOCAL int rgb;
|
||||
UGL_LOCAL unsigned char rgb_colors[RINGS][3];
|
||||
UGL_LOCAL int mapped_colors[RINGS];
|
||||
UGL_LOCAL float dests[RINGS][3];
|
||||
UGL_LOCAL float offsets[RINGS][3];
|
||||
UGL_LOCAL float angs[RINGS];
|
||||
UGL_LOCAL float rotAxis[RINGS][3];
|
||||
UGL_LOCAL int iters[RINGS];
|
||||
UGL_LOCAL GLuint theTorus;
|
||||
|
||||
enum {
|
||||
COLOR_BLACK = 0,
|
||||
COLOR_RED,
|
||||
COLOR_GREEN,
|
||||
COLOR_YELLOW,
|
||||
COLOR_BLUE,
|
||||
COLOR_MAGENTA,
|
||||
COLOR_CYAN,
|
||||
COLOR_WHITE
|
||||
};
|
||||
|
||||
/*
|
||||
UGL_LOCAL float RGBMap[9][3] = {
|
||||
{0, 0, 0},
|
||||
{1, 0, 0},
|
||||
{0, 1, 0},
|
||||
{1, 1, 0},
|
||||
{0, 0, 1},
|
||||
{1, 0, 1},
|
||||
{0, 1, 1},
|
||||
{1, 1, 1},
|
||||
{0.5, 0.5, 0.5}
|
||||
};
|
||||
|
||||
UGL_LOCAL void SetColor(int c)
|
||||
{
|
||||
(rgb) ? glColor3fv(RGBMap[c]): glIndexf(c);
|
||||
}
|
||||
|
||||
UGL_LOCAL void InitMap(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (rgb)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 9; i++)
|
||||
uglMesaSetColor(i, RGBMap[i][0], RGBMap[i][1], RGBMap[i][2]);
|
||||
}
|
||||
|
||||
UGL_LOCAL void SetFogRamp(int density, int startIndex)
|
||||
{
|
||||
int fogValues, colorValues;
|
||||
int i, j, k;
|
||||
float intensity;
|
||||
|
||||
fogValues = 1 << density;
|
||||
colorValues = 1 << startIndex;
|
||||
for (i = 0; i < colorValues; i++)
|
||||
{
|
||||
for (j = 0; j < fogValues; j++)
|
||||
{
|
||||
k = i * fogValues + j;
|
||||
intensity = (i * fogValues + j * colorValues) / 255.0;
|
||||
uglMesaSetColor(k, intensity, intensity, intensity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL void SetGreyRamp(void)
|
||||
{
|
||||
int i;
|
||||
float intensity;
|
||||
|
||||
for (i = 0; i < 255; i++)
|
||||
{
|
||||
intensity = i / 255.0;
|
||||
uglMesaSetColor(i, intensity, intensity, intensity);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
UGL_LOCAL void FillTorus(float rc, int numc, float rt, int numt)
|
||||
{
|
||||
int i, j, k;
|
||||
double s, t;
|
||||
double x, y, z;
|
||||
double pi, twopi;
|
||||
|
||||
pi = 3.14159265358979323846;
|
||||
twopi = 2 * pi;
|
||||
|
||||
for (i = 0; i < numc; i++)
|
||||
{
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for (j = 0; j <= numt; j++)
|
||||
{
|
||||
for (k = 1; k >= 0; k--)
|
||||
{
|
||||
s = (i + k) % numc + 0.5;
|
||||
t = j % numt;
|
||||
|
||||
x = cos(t*twopi/numt) * cos(s*twopi/numc);
|
||||
y = sin(t*twopi/numt) * cos(s*twopi/numc);
|
||||
z = sin(s*twopi/numc);
|
||||
glNormal3f(x, y, z);
|
||||
|
||||
x = (rt + rc * cos(s*twopi/numc)) * cos(t*twopi/numt);
|
||||
y = (rt + rc * cos(s*twopi/numc)) * sin(t*twopi/numt);
|
||||
z = rc * sin(s*twopi/numc);
|
||||
glVertex3f(x, y, z);
|
||||
}
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL float Clamp(int iters_left, float t)
|
||||
{
|
||||
if (iters_left < 3)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
return (iters_left-2)*t/iters_left;
|
||||
}
|
||||
|
||||
UGL_LOCAL void drawGL(void)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < RINGS; i++)
|
||||
{
|
||||
if (iters[i]) {
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
offsets[i][j] = Clamp(iters[i], offsets[i][j]);
|
||||
}
|
||||
angs[i] = Clamp(iters[i], angs[i]);
|
||||
iters[i]--;
|
||||
}
|
||||
}
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
gluLookAt(0,0,10, 0,0,0, 0,1,0);
|
||||
|
||||
for (i = 0; i < RINGS; i++)
|
||||
{
|
||||
if (rgb)
|
||||
{
|
||||
glColor3ubv(rgb_colors[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
glIndexi(mapped_colors[i]);
|
||||
}
|
||||
glPushMatrix();
|
||||
glTranslatef(dests[i][0]+offsets[i][0], dests[i][1]+offsets[i][1],
|
||||
dests[i][2]+offsets[i][2]);
|
||||
glRotatef(angs[i], rotAxis[i][0], rotAxis[i][1], rotAxis[i][2]);
|
||||
glCallList(theTorus);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glFlush();
|
||||
|
||||
uglMesaSwapBuffers();
|
||||
}
|
||||
|
||||
UGL_LOCAL float MyRand(void)
|
||||
{
|
||||
return 10.0 * ( (float) rand() / (float) RAND_MAX - 0.5 );
|
||||
}
|
||||
|
||||
UGL_LOCAL void ReInit(void)
|
||||
{
|
||||
int i;
|
||||
float deviation;
|
||||
|
||||
deviation = MyRand() / 2;
|
||||
deviation = deviation * deviation;
|
||||
for (i = 0; i < RINGS; i++)
|
||||
{
|
||||
offsets[i][0] = MyRand();
|
||||
offsets[i][1] = MyRand();
|
||||
offsets[i][2] = MyRand();
|
||||
angs[i] = 260.0 * MyRand();
|
||||
rotAxis[i][0] = MyRand();
|
||||
rotAxis[i][1] = MyRand();
|
||||
rotAxis[i][2] = MyRand();
|
||||
iters[i] = (deviation * MyRand() + 60.0);
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL void initGL(void)
|
||||
{
|
||||
float base, height;
|
||||
float aspect, x, y;
|
||||
int i;
|
||||
|
||||
float top_y = 1.0;
|
||||
float bottom_y = 0.0;
|
||||
float top_z = 0.15;
|
||||
float bottom_z = 0.69;
|
||||
float spacing = 2.5;
|
||||
static float lmodel_ambient[] = {0.0, 0.0, 0.0, 0.0};
|
||||
static float lmodel_twoside[] = {GL_FALSE};
|
||||
static float lmodel_local[] = {GL_FALSE};
|
||||
static float light0_ambient[] = {0.1, 0.1, 0.1, 1.0};
|
||||
static float light0_diffuse[] = {1.0, 1.0, 1.0, 0.0};
|
||||
static float light0_position[] = {0.8660254, 0.5, 1, 0};
|
||||
static float light0_specular[] = {1.0, 1.0, 1.0, 0.0};
|
||||
static float bevel_mat_ambient[] = {0.0, 0.0, 0.0, 1.0};
|
||||
static float bevel_mat_shininess[] = {40.0};
|
||||
static float bevel_mat_specular[] = {1.0, 1.0, 1.0, 0.0};
|
||||
static float bevel_mat_diffuse[] = {1.0, 0.0, 0.0, 0.0};
|
||||
|
||||
ReInit();
|
||||
|
||||
for (i = 0; i < RINGS; i++)
|
||||
{
|
||||
rgb_colors[i][0] = rgb_colors[i][1] = rgb_colors[i][2] = 0;
|
||||
}
|
||||
rgb_colors[BLUERING][2] = 255;
|
||||
rgb_colors[REDRING][0] = 255;
|
||||
rgb_colors[GREENRING][1] = 255;
|
||||
rgb_colors[YELLOWRING][0] = 255;
|
||||
rgb_colors[YELLOWRING][1] = 255;
|
||||
mapped_colors[BLUERING] = COLOR_BLUE;
|
||||
mapped_colors[REDRING] = COLOR_RED;
|
||||
mapped_colors[GREENRING] = COLOR_GREEN;
|
||||
mapped_colors[YELLOWRING] = COLOR_YELLOW;
|
||||
mapped_colors[BLACKRING] = COLOR_BLACK;
|
||||
|
||||
dests[BLUERING][0] = -spacing;
|
||||
dests[BLUERING][1] = top_y;
|
||||
dests[BLUERING][2] = top_z;
|
||||
|
||||
dests[BLACKRING][0] = 0.0;
|
||||
dests[BLACKRING][1] = top_y;
|
||||
dests[BLACKRING][2] = top_z;
|
||||
|
||||
dests[REDRING][0] = spacing;
|
||||
dests[REDRING][1] = top_y;
|
||||
dests[REDRING][2] = top_z;
|
||||
|
||||
dests[YELLOWRING][0] = -spacing / 2.0;
|
||||
dests[YELLOWRING][1] = bottom_y;
|
||||
dests[YELLOWRING][2] = bottom_z;
|
||||
|
||||
dests[GREENRING][0] = spacing / 2.0;
|
||||
dests[GREENRING][1] = bottom_y;
|
||||
dests[GREENRING][2] = bottom_z;
|
||||
|
||||
base = 2.0;
|
||||
height = 2.0;
|
||||
theTorus = glGenLists(1);
|
||||
glNewList(theTorus, GL_COMPILE);
|
||||
FillTorus(0.1, 8, 1.0, 25);
|
||||
glEndList();
|
||||
|
||||
x = (float)XSIZE;
|
||||
y = (float)YSIZE;
|
||||
aspect = x / y;
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glClearDepth(1.0);
|
||||
|
||||
if (rgb)
|
||||
{
|
||||
glClearColor(0.5, 0.5, 0.5, 0.0);
|
||||
glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
|
||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
|
||||
glLightfv(GL_LIGHT0, GL_SPECULAR, light0_specular);
|
||||
glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
||||
glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, lmodel_local);
|
||||
glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
|
||||
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
|
||||
glEnable(GL_LIGHTING);
|
||||
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT, bevel_mat_ambient);
|
||||
glMaterialfv(GL_FRONT, GL_SHININESS, bevel_mat_shininess);
|
||||
glMaterialfv(GL_FRONT, GL_SPECULAR, bevel_mat_specular);
|
||||
glMaterialfv(GL_FRONT, GL_DIFFUSE, bevel_mat_diffuse);
|
||||
|
||||
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
glShadeModel(GL_SMOOTH);
|
||||
}
|
||||
else
|
||||
{
|
||||
glClearIndex(BACKGROUND);
|
||||
glShadeModel(GL_FLAT);
|
||||
}
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
gluPerspective(45, 1.33, 0.1, 100.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
UGL_LOCAL void echoUse(void)
|
||||
{
|
||||
printf("tOlympic keys:\n");
|
||||
printf(" SPACE Reinitialize\n");
|
||||
printf(" ESC Exit\n");
|
||||
}
|
||||
|
||||
UGL_LOCAL void readKey (UGL_WCHAR key)
|
||||
{
|
||||
switch(key)
|
||||
{
|
||||
case UGL_UNI_SPACE:
|
||||
ReInit();
|
||||
break;
|
||||
case UGL_UNI_ESCAPE:
|
||||
stopWex = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL void loopEvent(void)
|
||||
{
|
||||
UGL_EVENT event;
|
||||
UGL_INPUT_EVENT * pInputEvent;
|
||||
|
||||
UGL_FOREVER
|
||||
{
|
||||
if (uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT)
|
||||
!= UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
|
||||
pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
readKey(pInputEvent->type.keyboard.key);
|
||||
}
|
||||
|
||||
drawGL();
|
||||
if (stopWex)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void windMLOlympic (UGL_BOOL windMLMode);
|
||||
|
||||
void uglolympic (void)
|
||||
{
|
||||
taskSpawn("tOlympic", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLOlympic,
|
||||
0,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
void windMLOlympic(UGL_BOOL windMLMode)
|
||||
{
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
|
||||
uglInitialize();
|
||||
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
|
||||
|
||||
if (uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0,
|
||||
(UGL_UINT32 *)&eventServiceId) == UGL_STATUS_OK)
|
||||
{
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
eventServiceId = UGL_NULL;
|
||||
}
|
||||
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||
|
||||
if (umc == NULL)
|
||||
{
|
||||
uglDeinitialize();
|
||||
return;
|
||||
}
|
||||
|
||||
uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
|
||||
UGL_MESA_FULLSCREEN_HEIGHT);
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_RGB, &rgb);
|
||||
|
||||
initGL();
|
||||
|
||||
echoUse();
|
||||
|
||||
stopWex = 0;
|
||||
loopEvent();
|
||||
|
||||
if (eventServiceId != UGL_NULL)
|
||||
uglEventQDestroy (eventServiceId, qId);
|
||||
|
||||
uglMesaDestroyContext();
|
||||
uglDeinitialize();
|
||||
|
||||
return;
|
||||
}
|
277
progs/windml/uglpoint.c
Normal file
277
progs/windml/uglpoint.c
Normal file
@@ -0,0 +1,277 @@
|
||||
|
||||
/* uglpoint.c - WindML/Mesa example program */
|
||||
|
||||
/* Copyright (C) 2001 by Wind River Systems, Inc */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* The MIT License
|
||||
* 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
|
||||
* THE AUTHORS OR COPYRIGHT 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Stephane Raimbault <stephane.raimbault@windriver.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
Draw a single point.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ugl/ugl.h>
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglinput.h>
|
||||
|
||||
#include <GL/uglmesa.h>
|
||||
|
||||
#define DOUBLE_BUFFER GL_TRUE
|
||||
|
||||
enum {
|
||||
BLACK = 0,
|
||||
RED,
|
||||
GREEN,
|
||||
BLUE,
|
||||
WHITE
|
||||
};
|
||||
|
||||
UGL_LOCAL GLuint rgb;
|
||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||
UGL_LOCAL UGL_MESA_CONTEXT umc;
|
||||
UGL_LOCAL GLint angleT;
|
||||
|
||||
UGL_LOCAL void initGL (void)
|
||||
{
|
||||
/* By passed in RGB mode */
|
||||
uglMesaSetColor(BLACK, 0.0, 0.0, 0.0);
|
||||
uglMesaSetColor(RED, 1.0, 0.0, 0.0);
|
||||
uglMesaSetColor(GREEN, 0.0, 1.0, 0.0);
|
||||
uglMesaSetColor(BLUE, 0.0, 0.0, 1.0);
|
||||
uglMesaSetColor(WHITE, 1.0, 1.0, 1.0);
|
||||
|
||||
glOrtho(0.0, 1.0, 0.0, 1.0, -20.0, 20.0);
|
||||
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClearIndex(BLACK);
|
||||
}
|
||||
|
||||
UGL_LOCAL void drawGL (void)
|
||||
{
|
||||
GLint i;
|
||||
GLfloat x, y;
|
||||
|
||||
/* Avoid blinking in single buffer */
|
||||
|
||||
if (DOUBLE_BUFFER)
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
/* Random points */
|
||||
|
||||
glBegin(GL_POINTS);
|
||||
(rgb) ? glColor3f(1.0, 0.0, 0.0): glIndexi(RED);
|
||||
|
||||
for (i=0; i<150; i++)
|
||||
{
|
||||
x = rand() / (RAND_MAX+1.0);
|
||||
y = rand() / (RAND_MAX+1.0);
|
||||
glVertex2f(x, y);
|
||||
}
|
||||
|
||||
(rgb) ? glColor3f(0.0, 1.0, 0.0): glIndexi(GREEN);
|
||||
|
||||
for (i=0; i<150; i++)
|
||||
{
|
||||
x = (rand() / (RAND_MAX+1.0));
|
||||
y = (rand() / (RAND_MAX+1.0));
|
||||
glVertex2f(x, y);
|
||||
}
|
||||
|
||||
(rgb) ? glColor3f(0.0, 0.0, 1.0): glIndexi(BLUE);
|
||||
glVertex2f(0.5,0.5);
|
||||
|
||||
for (i=0; i<150; i++)
|
||||
{
|
||||
x = rand() / (RAND_MAX+1.0);
|
||||
y = rand() / (RAND_MAX+1.0);
|
||||
glVertex2f(x, y);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
|
||||
/* Smooth triangle */
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(0.5, 0.5, 0);
|
||||
glRotatef(angleT, 1.0, -1.0, 0.0);
|
||||
angleT = angleT++ % 360;
|
||||
glBegin(GL_TRIANGLES);
|
||||
(rgb) ? glColor3f(1.0, 0.0, 0.0): glIndexi(RED);
|
||||
glVertex2f(0.75, 0.25);
|
||||
(rgb) ? glColor3f(0.0, 1.0, 0.0): glIndexi(GREEN);
|
||||
glVertex2f(0.75, 0.75);
|
||||
(rgb) ? glColor3f(0.0, 0.0, 1.0): glIndexi(BLUE);
|
||||
glVertex2f(0.25, 0.75);
|
||||
glEnd();
|
||||
glPopMatrix();
|
||||
|
||||
/* Flush and swap */
|
||||
|
||||
glFlush();
|
||||
|
||||
uglMesaSwapBuffers();
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* getEvent
|
||||
*
|
||||
* RETURNS: true or false
|
||||
*
|
||||
* NOMANUAL
|
||||
*
|
||||
*/
|
||||
|
||||
UGL_LOCAL int getEvent(void)
|
||||
{
|
||||
UGL_EVENT event;
|
||||
UGL_STATUS status;
|
||||
int retVal = 0;
|
||||
|
||||
status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
|
||||
|
||||
while (status != UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
UGL_INPUT_EVENT * pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
retVal = 1;
|
||||
|
||||
status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
|
||||
}
|
||||
|
||||
return(retVal);
|
||||
}
|
||||
|
||||
void windMLPoint (UGL_BOOL windMLMode);
|
||||
|
||||
void uglpoint (void)
|
||||
{
|
||||
taskSpawn ("tPoint", 210, VX_FP_TASK, 100000,
|
||||
(FUNCPTR)windMLPoint, UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
void windMLPoint (UGL_BOOL windMLMode)
|
||||
{
|
||||
GLubyte pPixels[4];
|
||||
GLsizei width, height;
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
|
||||
angleT = 0;
|
||||
|
||||
uglInitialize();
|
||||
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
|
||||
|
||||
if (uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0,
|
||||
(UGL_UINT32 *)&eventServiceId) == UGL_STATUS_OK)
|
||||
{
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
eventServiceId = UGL_NULL;
|
||||
}
|
||||
|
||||
if (DOUBLE_BUFFER)
|
||||
{
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_SINGLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_SINGLE, NULL);
|
||||
}
|
||||
|
||||
if (umc == NULL)
|
||||
{
|
||||
uglDeinitialize();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fullscreen */
|
||||
|
||||
uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
|
||||
UGL_MESA_FULLSCREEN_HEIGHT);
|
||||
|
||||
/* RGB or CI ? */
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_RGB, &rgb);
|
||||
|
||||
initGL();
|
||||
|
||||
while (!getEvent())
|
||||
drawGL();
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
|
||||
uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
|
||||
|
||||
printf ("glReadPixel return ");
|
||||
if (rgb)
|
||||
{
|
||||
glReadPixels(width/2, height/2,
|
||||
1, 1, GL_RGB,
|
||||
GL_UNSIGNED_BYTE, pPixels);
|
||||
glFlush();
|
||||
printf ("R:%i G:%i B:%i (RGB)", pPixels[0], pPixels[1], pPixels[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
glReadPixels(width/2, height/2,
|
||||
1, 1, GL_COLOR_INDEX,
|
||||
GL_UNSIGNED_BYTE, pPixels);
|
||||
glFlush();
|
||||
if (pPixels[0] == BLUE)
|
||||
printf ("BLUE (CI)");
|
||||
else
|
||||
printf ("%i (CI))", pPixels[0]);
|
||||
}
|
||||
|
||||
printf(" for %ix%i\n", width/2, height/2);
|
||||
|
||||
if (eventServiceId != UGL_NULL)
|
||||
uglEventQDestroy (eventServiceId, qId);
|
||||
|
||||
uglMesaDestroyContext();
|
||||
uglDeinitialize();
|
||||
|
||||
return;
|
||||
}
|
242
progs/windml/uglstencil.c
Normal file
242
progs/windml/uglstencil.c
Normal file
@@ -0,0 +1,242 @@
|
||||
|
||||
/* Copyright (c) Mark J. Kilgard, 1994. */
|
||||
|
||||
/*
|
||||
* (c) Copyright 1993, Silicon Graphics, Inc.
|
||||
* ALL RIGHTS RESERVED
|
||||
* Permission to use, copy, modify, and distribute this software for
|
||||
* any purpose and without fee is hereby granted, provided that the above
|
||||
* copyright notice appear in all copies and that both the copyright notice
|
||||
* and this permission notice appear in supporting documentation, and that
|
||||
* the name of Silicon Graphics, Inc. not be used in advertising
|
||||
* or publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission.
|
||||
*
|
||||
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
|
||||
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
||||
* GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
|
||||
* SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
|
||||
* KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
|
||||
* LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
|
||||
* THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
|
||||
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* US Government Users Restricted Rights
|
||||
* Use, duplication, or disclosure by the Government is subject to
|
||||
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
||||
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
|
||||
* clause at DFARS 252.227-7013 and/or in similar or successor
|
||||
* clauses in the FAR or the DOD or NASA FAR Supplement.
|
||||
* Unpublished-- rights reserved under the copyright laws of the
|
||||
* United States. Contractor/manufacturer is Silicon Graphics,
|
||||
* Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
|
||||
*
|
||||
* OpenGL(TM) is a trademark of Silicon Graphics, Inc.
|
||||
*/
|
||||
/* stencil.c
|
||||
* This program draws two rotated tori in a window.
|
||||
* A diamond in the center of the window masks out part
|
||||
* of the scene. Within this mask, a different model
|
||||
* (a sphere) is drawn in a different color.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Conversion to UGL/Mesa by Stephane Raimbault, 2001
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ugl/ugl.h>
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglinput.h>
|
||||
|
||||
#include <GL/uglmesa.h>
|
||||
#include <GL/glu.h>
|
||||
#include <GL/uglglutshapes.h>
|
||||
|
||||
#define YELLOWMAT 1
|
||||
#define BLUEMAT 2
|
||||
|
||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||
UGL_LOCAL UGL_MESA_CONTEXT umc;
|
||||
|
||||
UGL_LOCAL void initGL (GLsizei w, GLsizei h)
|
||||
{
|
||||
GLfloat yellow_diffuse[] = { 0.7, 0.7, 0.0, 1.0 };
|
||||
GLfloat yellow_specular[] = { 1.0, 1.0, 1.0, 1.0 };
|
||||
|
||||
GLfloat blue_diffuse[] = { 0.1, 0.1, 0.7, 1.0 };
|
||||
GLfloat blue_specular[] = { 0.1, 1.0, 1.0, 1.0 };
|
||||
|
||||
GLfloat position_one[] = { 1.0, 1.0, 1.0, 0.0 };
|
||||
|
||||
glNewList(YELLOWMAT, GL_COMPILE);
|
||||
glMaterialfv(GL_FRONT, GL_DIFFUSE, yellow_diffuse);
|
||||
glMaterialfv(GL_FRONT, GL_SPECULAR, yellow_specular);
|
||||
glMaterialf(GL_FRONT, GL_SHININESS, 64.0);
|
||||
glEndList();
|
||||
|
||||
glNewList(BLUEMAT, GL_COMPILE);
|
||||
glMaterialfv(GL_FRONT, GL_DIFFUSE, blue_diffuse);
|
||||
glMaterialfv(GL_FRONT, GL_SPECULAR, blue_specular);
|
||||
glMaterialf(GL_FRONT, GL_SHININESS, 45.0);
|
||||
glEndList();
|
||||
|
||||
glLightfv(GL_LIGHT0, GL_POSITION, position_one);
|
||||
|
||||
glEnable(GL_LIGHT0);
|
||||
glEnable(GL_LIGHTING);
|
||||
glDepthFunc(GL_LESS);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glClearStencil(0x0);
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
|
||||
glClear(GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
/* create a diamond shaped stencil area */
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-3.0, 3.0, -3.0, 3.0, -1.0, 1.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
glStencilFunc (GL_ALWAYS, 0x1, 0x1);
|
||||
glStencilOp (GL_REPLACE, GL_REPLACE, GL_REPLACE);
|
||||
glBegin(GL_QUADS);
|
||||
glVertex3f (-1.0, 0.0, 0.0);
|
||||
glVertex3f (0.0, 1.0, 0.0);
|
||||
glVertex3f (1.0, 0.0, 0.0);
|
||||
glVertex3f (0.0, -1.0, 0.0);
|
||||
glEnd();
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(45.0, (GLfloat) w/(GLfloat) h, 3.0, 7.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -5.0);
|
||||
}
|
||||
|
||||
/* Draw a sphere in a diamond-shaped section in the
|
||||
* middle of a window with 2 tori.
|
||||
*/
|
||||
UGL_LOCAL void drawGL(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
|
||||
|
||||
/* draw blue sphere where the stencil is 1 */
|
||||
glStencilFunc (GL_EQUAL, 0x1, 0x1);
|
||||
glCallList (BLUEMAT);
|
||||
glutSolidSphere (0.5, 15, 15);
|
||||
|
||||
/* draw the tori where the stencil is not 1 */
|
||||
glStencilFunc (GL_NOTEQUAL, 0x1, 0x1);
|
||||
glPushMatrix();
|
||||
glRotatef (45.0, 0.0, 0.0, 1.0);
|
||||
glRotatef (45.0, 0.0, 1.0, 0.0);
|
||||
glCallList (YELLOWMAT);
|
||||
glutSolidTorus (0.275, 0.85, 15, 15);
|
||||
glPushMatrix();
|
||||
glRotatef (90.0, 1.0, 0.0, 0.0);
|
||||
glutSolidTorus (0.275, 0.85, 15, 15);
|
||||
glPopMatrix();
|
||||
glPopMatrix();
|
||||
|
||||
glFlush();
|
||||
|
||||
uglMesaSwapBuffers();
|
||||
}
|
||||
|
||||
UGL_LOCAL int getEvent(void)
|
||||
{
|
||||
UGL_EVENT event;
|
||||
UGL_STATUS status;
|
||||
int retVal = 0;
|
||||
|
||||
status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
|
||||
|
||||
while (status != UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
UGL_INPUT_EVENT * pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
retVal = 1;
|
||||
|
||||
status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
|
||||
}
|
||||
|
||||
return(retVal);
|
||||
}
|
||||
|
||||
void windMLStencil (UGL_BOOL windMLMode);
|
||||
|
||||
void uglstencil (void)
|
||||
{
|
||||
taskSpawn("tStencil", 210, VX_FP_TASK, 100000,
|
||||
(FUNCPTR)windMLStencil,UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
void windMLStencil(UGL_BOOL windMLMode)
|
||||
{
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
GLsizei width, height;
|
||||
|
||||
uglInitialize();
|
||||
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
|
||||
|
||||
uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
|
||||
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContextExt(UGL_MESA_SINGLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE,
|
||||
16,
|
||||
8,
|
||||
0,0,0,0,
|
||||
NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContextExt(UGL_MESA_SINGLE,
|
||||
16,
|
||||
8,
|
||||
0,0,0,0,
|
||||
NULL);
|
||||
|
||||
if (umc == NULL)
|
||||
{
|
||||
uglDeinitialize();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fullscreen */
|
||||
|
||||
uglMesaMakeCurrentContext(umc, 0, 0, UGL_MESA_FULLSCREEN_WIDTH,
|
||||
UGL_MESA_FULLSCREEN_HEIGHT);
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
|
||||
uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
|
||||
|
||||
initGL(width, height);
|
||||
|
||||
drawGL();
|
||||
|
||||
while (!getEvent());
|
||||
|
||||
uglEventQDestroy (eventServiceId, qId);
|
||||
|
||||
uglMesaDestroyContext();
|
||||
uglDeinitialize();
|
||||
|
||||
return;
|
||||
}
|
||||
|
295
progs/windml/uglteapot.c
Normal file
295
progs/windml/uglteapot.c
Normal file
@@ -0,0 +1,295 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* The MIT License
|
||||
* 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
|
||||
* THE AUTHORS OR COPYRIGHT 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Linux Magazine July 2001
|
||||
* Conversion to UGL/Mesa from GLUT by Stephane Raimbault, 2001
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ugl/ugl.h>
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglinput.h>
|
||||
#include <ugl/uglucode.h>
|
||||
|
||||
#include <GL/uglmesa.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
/* Need GLUT_SHAPES */
|
||||
|
||||
#include <GL/uglglutshapes.h>
|
||||
|
||||
#ifndef PI
|
||||
#define PI 3.14159265
|
||||
#endif
|
||||
|
||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||
UGL_LOCAL UGL_MESA_CONTEXT umc;
|
||||
UGL_LOCAL volatile UGL_BOOL stopWex;
|
||||
|
||||
UGL_LOCAL GLint angle;
|
||||
UGL_LOCAL GLfloat Sin[360], Cos[360];
|
||||
UGL_LOCAL GLfloat L0pos[]={0.0, 2.0, -1.0};
|
||||
UGL_LOCAL GLfloat L0dif[]={0.3, 0.3, 0.8};
|
||||
UGL_LOCAL GLfloat L1pos[]={2.0, 2.0, 2.0};
|
||||
UGL_LOCAL GLfloat L1dif[]={0.5, 0.5, 0.5};
|
||||
UGL_LOCAL GLfloat Mspec[3];
|
||||
UGL_LOCAL GLfloat Mshiny;
|
||||
UGL_LOCAL GLuint theTeapot;
|
||||
|
||||
UGL_LOCAL void calcTableCosSin()
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<360;i++) {
|
||||
Cos[i] = cos(((float)i)/180.0*PI);
|
||||
Sin[i] = sin(((float)i)/180.0*PI);
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL void initGL(void)
|
||||
{
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glColor3f(1.0, 0.0, 0.0);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glShadeModel(GL_SMOOTH);
|
||||
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
glEnable(GL_LIGHT1);
|
||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, L0dif);
|
||||
glLightfv(GL_LIGHT0, GL_SPECULAR, L0dif);
|
||||
glLightfv(GL_LIGHT1, GL_DIFFUSE, L1dif);
|
||||
glLightfv(GL_LIGHT1, GL_SPECULAR, L1dif);
|
||||
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Mspec);
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, Mshiny);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(45.0, 1.0, 0.1, 10.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
theTeapot = glGenLists(1);
|
||||
glNewList(theTeapot, GL_COMPILE);
|
||||
glutSolidTeapot(1.0);
|
||||
glEndList();
|
||||
|
||||
}
|
||||
|
||||
UGL_LOCAL void drawGL()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glLoadIdentity();
|
||||
|
||||
gluLookAt(4.5*Cos[angle], 2.0,4.5*Sin[angle],0.0,0.0,0.0,0.0,
|
||||
1.0,0.0);
|
||||
glLightfv(GL_LIGHT0, GL_POSITION, L0pos);
|
||||
glLightfv(GL_LIGHT1, GL_POSITION, L1pos);
|
||||
|
||||
glCallList(theTeapot);
|
||||
|
||||
glFlush();
|
||||
|
||||
uglMesaSwapBuffers();
|
||||
}
|
||||
|
||||
UGL_LOCAL void echoUse(void)
|
||||
{
|
||||
printf("tTeapot keys:\n");
|
||||
printf(" Left Counter clockwise rotation (y-axis)\n");
|
||||
printf(" Right Clockwise rotation (y-axis)\n");
|
||||
printf(" j Enable/disable Light0\n");
|
||||
printf(" k Enable/disable Light1\n");
|
||||
printf(" m Add specular\n");
|
||||
printf(" l Remove specular\n");
|
||||
printf(" o Add shininess\n");
|
||||
printf(" p Remove shininess\n");
|
||||
printf(" ESC Exit\n");
|
||||
}
|
||||
|
||||
|
||||
UGL_LOCAL void readKey (UGL_WCHAR key)
|
||||
{
|
||||
switch(key)
|
||||
{
|
||||
case UGL_UNI_RIGHT_ARROW:
|
||||
angle +=2;
|
||||
if (angle>= 360)
|
||||
angle-=360;
|
||||
break;
|
||||
case UGL_UNI_LEFT_ARROW:
|
||||
angle -=2;
|
||||
if (angle<0)
|
||||
angle+=360;
|
||||
break;
|
||||
case 'j':
|
||||
glIsEnabled(GL_LIGHT0) ?
|
||||
glDisable(GL_LIGHT0) : glEnable(GL_LIGHT0);
|
||||
break;
|
||||
case 'k':
|
||||
glIsEnabled(GL_LIGHT1) ?
|
||||
glDisable(GL_LIGHT1) : glEnable(GL_LIGHT1);
|
||||
break;
|
||||
case 'm':
|
||||
Mspec[0]+=0.1;
|
||||
if(Mspec[0]>1)
|
||||
Mspec[0]=1;
|
||||
Mspec[1]+=0.1;
|
||||
if(Mspec[1]>1)
|
||||
Mspec[1]=1;
|
||||
Mspec[2]+=0.1;
|
||||
if(Mspec[2]>1)
|
||||
Mspec[2]=1;
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Mspec);
|
||||
break;
|
||||
case 'l':
|
||||
Mspec[0]-=0.1;
|
||||
if(Mspec[0]>1)
|
||||
Mspec[0]=1;
|
||||
Mspec[1]-=0.1;
|
||||
if(Mspec[1]>1)
|
||||
Mspec[1]=1;
|
||||
Mspec[2]-=0.1;
|
||||
if(Mspec[2]>1)
|
||||
Mspec[2]=1;
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Mspec);
|
||||
break;
|
||||
case 'o':
|
||||
Mshiny -= 1;
|
||||
if (Mshiny<0)
|
||||
Mshiny=0;
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, Mshiny);
|
||||
break;
|
||||
case 'p':
|
||||
Mshiny += 1;
|
||||
if (Mshiny>128)
|
||||
Mshiny=128;
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, Mshiny);
|
||||
break;
|
||||
case UGL_UNI_ESCAPE:
|
||||
stopWex = UGL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL void loopEvent(void)
|
||||
{
|
||||
UGL_EVENT event;
|
||||
UGL_INPUT_EVENT * pInputEvent;
|
||||
|
||||
UGL_FOREVER
|
||||
{
|
||||
if (uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT)
|
||||
!= UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
|
||||
pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
readKey(pInputEvent->type.keyboard.key);
|
||||
}
|
||||
|
||||
drawGL();
|
||||
if (stopWex)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void windMLTeapot (UGL_BOOL windMLMode);
|
||||
|
||||
void uglteapot (void)
|
||||
{
|
||||
taskSpawn ("tTeapot", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLTeapot,
|
||||
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
void windMLTeapot (UGL_BOOL windMLMode)
|
||||
{
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
GLsizei displayWidth, displayHeight;
|
||||
GLsizei x, y, w, h;
|
||||
|
||||
angle = 45;
|
||||
Mspec[0] = 0.5;
|
||||
Mspec[1] = 0.5;
|
||||
Mspec[2] = 0.5;
|
||||
Mshiny = 50;
|
||||
|
||||
uglInitialize ();
|
||||
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0,
|
||||
(UGL_UINT32 *)&keyboardDevId);
|
||||
|
||||
uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
|
||||
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
|
||||
/* Double buffering */
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||
|
||||
if (umc == NULL)
|
||||
{
|
||||
uglDeinitialize ();
|
||||
return;
|
||||
}
|
||||
|
||||
uglMesaMakeCurrentContext (umc, 0, 0, 1, 1);
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_DISPLAY_WIDTH, &displayWidth);
|
||||
uglMesaGetIntegerv(UGL_MESA_DISPLAY_HEIGHT, &displayHeight);
|
||||
|
||||
h = (displayHeight*2)/3;
|
||||
w = h;
|
||||
x = (displayWidth-w)/2;
|
||||
y = (displayHeight-h)/2;
|
||||
|
||||
uglMesaMoveToWindow(x, y);
|
||||
uglMesaResizeToWindow(w, h);
|
||||
|
||||
calcTableCosSin();
|
||||
|
||||
initGL ();
|
||||
|
||||
echoUse();
|
||||
|
||||
stopWex = UGL_FALSE;
|
||||
loopEvent();
|
||||
|
||||
uglEventQDestroy (eventServiceId, qId);
|
||||
|
||||
uglMesaDestroyContext();
|
||||
uglDeinitialize ();
|
||||
|
||||
return;
|
||||
}
|
379
progs/windml/ugltexcube.c
Normal file
379
progs/windml/ugltexcube.c
Normal file
@@ -0,0 +1,379 @@
|
||||
|
||||
/* ugltexcube.c - WindML/Mesa example program */
|
||||
|
||||
/* Copyright (C) 2001 by Wind River Systems, Inc */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
*
|
||||
* The MIT License
|
||||
* 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
|
||||
* THE AUTHORS OR COPYRIGHT 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Stephane Raimbault <stephane.raimbault@windriver.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
Draw a textured cube
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ugl/ugl.h>
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglinput.h>
|
||||
#include <GL/uglmesa.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#include "../util/readtex.h"
|
||||
|
||||
#define IMAGE_FILE "Mesa/images/wrs_logo.rgb"
|
||||
|
||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||
UGL_LOCAL UGL_MESA_CONTEXT umc;
|
||||
|
||||
UGL_LOCAL GLfloat xrot, yrot, zrot;
|
||||
UGL_LOCAL GLuint texture[1];
|
||||
UGL_LOCAL GLuint theTexCube;
|
||||
|
||||
typedef struct {
|
||||
GLubyte *data;
|
||||
int width, height;
|
||||
GLenum format;
|
||||
} TEX_IMAGE;
|
||||
|
||||
UGL_LOCAL void cleanUp (void);
|
||||
|
||||
UGL_LOCAL void loadGLTexture()
|
||||
{
|
||||
TEX_IMAGE * texImage=NULL;
|
||||
|
||||
texImage = (TEX_IMAGE *) malloc(sizeof(TEX_IMAGE));
|
||||
|
||||
if (texImage == NULL)
|
||||
{
|
||||
printf("Error allocating space for image");
|
||||
cleanUp();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
texImage->data = LoadRGBImage(IMAGE_FILE, &texImage->width,
|
||||
&texImage->height, &texImage->format);
|
||||
if (!texImage->data)
|
||||
{
|
||||
printf("Couldn't read %s\n", IMAGE_FILE);
|
||||
free(texImage);
|
||||
cleanUp();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Create Texture */
|
||||
glGenTextures(1, &texture[0]);
|
||||
glBindTexture(GL_TEXTURE_2D, texture[0]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, 3,
|
||||
texImage->width, texImage->height,
|
||||
0, GL_RGB, GL_UNSIGNED_BYTE, texImage->data);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
free(texImage->data);
|
||||
free(texImage);
|
||||
}
|
||||
|
||||
UGL_LOCAL void initGL(int width, int height)
|
||||
{
|
||||
|
||||
/* Load the texture(s) */
|
||||
loadGLTexture();
|
||||
|
||||
/* Enable texture mapping */
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
/* Clear the background color to black */
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
/* Enables smooth color shading */
|
||||
glShadeModel(GL_SMOOTH);
|
||||
|
||||
/* glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); */
|
||||
/* glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); */
|
||||
|
||||
theTexCube = glGenLists(1);
|
||||
glNewList(theTexCube, GL_COMPILE);
|
||||
|
||||
/* Choose the texture to use */
|
||||
glBindTexture(GL_TEXTURE_2D, texture[0]);
|
||||
|
||||
/* Begin drawing a cube */
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
/* Front face (note that the texture's corners have to match the
|
||||
quad's corners) */
|
||||
|
||||
/* Bottom left of the texture and quad */
|
||||
glTexCoord2f(0.0f, 0.0f);
|
||||
glVertex3f(-1.0f, -1.0f, 1.0f);
|
||||
|
||||
/* Bottom Right Of The Texture and Quad */
|
||||
glTexCoord2f(1.0f, 0.0f);
|
||||
glVertex3f(1.0f, -1.0f, 1.0f);
|
||||
|
||||
/* Top Right Of The Texture and Quad */
|
||||
glTexCoord2f(1.0f, 1.0f);
|
||||
glVertex3f(1.0f, 1.0f, 1.0f);
|
||||
/* Top Left Of The Texture and Quad */
|
||||
glTexCoord2f(0.0f, 1.0f);
|
||||
glVertex3f(-1.0f, 1.0f, 1.0f);
|
||||
|
||||
/* Back Face */
|
||||
|
||||
/* Bottom Right Of The Texture and Quad */
|
||||
glTexCoord2f(1.0f, 0.0f);
|
||||
glVertex3f(-1.0f, -1.0f, -1.0f);
|
||||
|
||||
/* Top Right Of The Texture and Quad */
|
||||
glTexCoord2f(1.0f, 1.0f);
|
||||
glVertex3f(-1.0f, 1.0f, -1.0f);
|
||||
|
||||
/* Top Left Of The Texture and Quad */
|
||||
glTexCoord2f(0.0f, 1.0f);
|
||||
glVertex3f(1.0f, 1.0f, -1.0f);
|
||||
|
||||
/* Bottom Left Of The Texture and Quad */
|
||||
glTexCoord2f(0.0f, 0.0f);
|
||||
glVertex3f(1.0f, -1.0f, -1.0f);
|
||||
|
||||
|
||||
/* Top Face */
|
||||
|
||||
/* Top Left Of The Texture and Quad */
|
||||
glTexCoord2f(0.0f, 1.0f);
|
||||
glVertex3f(-1.0f, 1.0f, -1.0f);
|
||||
|
||||
/* Bottom Left Of The Texture and Quad */
|
||||
glTexCoord2f(0.0f, 0.0f);
|
||||
glVertex3f(-1.0f, 1.0f, 1.0f);
|
||||
|
||||
/* Bottom Right Of The Texture and Quad */
|
||||
glTexCoord2f(1.0f, 0.0f);
|
||||
glVertex3f(1.0f, 1.0f, 1.0f);
|
||||
|
||||
/* Top Right Of The Texture and Quad */
|
||||
glTexCoord2f(1.0f, 1.0f);
|
||||
glVertex3f(1.0f, 1.0f, -1.0f);
|
||||
|
||||
/* Bottom Face */
|
||||
|
||||
/* Top Right Of The Texture and Quad */
|
||||
glTexCoord2f(1.0f, 1.0f);
|
||||
glVertex3f(-1.0f, -1.0f, -1.0f);
|
||||
|
||||
/* Top Left Of The Texture and Quad */
|
||||
glTexCoord2f(0.0f, 1.0f);
|
||||
glVertex3f(1.0f, -1.0f, -1.0f);
|
||||
|
||||
/* Bottom Left Of The Texture and Quad */
|
||||
glTexCoord2f(0.0f, 0.0f);
|
||||
glVertex3f(1.0f, -1.0f, 1.0f);
|
||||
|
||||
/* Bottom Right Of The Texture and Quad */
|
||||
glTexCoord2f(1.0f, 0.0f);
|
||||
glVertex3f(-1.0f, -1.0f, 1.0f);
|
||||
|
||||
|
||||
/* Right face */
|
||||
/* Bottom Right Of The Texture and Quad */
|
||||
glTexCoord2f(1.0f, 0.0f);
|
||||
glVertex3f(1.0f, -1.0f, -1.0f);
|
||||
|
||||
/* Top Right Of The Texture and Quad */
|
||||
glTexCoord2f(1.0f, 1.0f);
|
||||
glVertex3f(1.0f, 1.0f, -1.0f);
|
||||
|
||||
/* Top Left Of The Texture and Quad */
|
||||
glTexCoord2f(0.0f, 1.0f);
|
||||
glVertex3f(1.0f, 1.0f, 1.0f);
|
||||
|
||||
/* Bottom Left Of The Texture and Quad */
|
||||
glTexCoord2f(0.0f, 0.0f);
|
||||
glVertex3f(1.0f, -1.0f, 1.0f);
|
||||
|
||||
|
||||
/* Left Face */
|
||||
/* Bottom Left Of The Texture and Quad */
|
||||
glTexCoord2f(0.0f, 0.0f);
|
||||
glVertex3f(-1.0f, -1.0f, -1.0f);
|
||||
|
||||
/* Bottom Right Of The Texture and Quad */
|
||||
glTexCoord2f(1.0f, 0.0f);
|
||||
glVertex3f(-1.0f, -1.0f, 1.0f);
|
||||
|
||||
/* Top Right Of The Texture and Quad */
|
||||
glTexCoord2f(1.0f, 1.0f);
|
||||
glVertex3f(-1.0f, 1.0f, 1.0f);
|
||||
|
||||
/* Top Left Of The Texture and Quad */
|
||||
glTexCoord2f(0.0f, 1.0f);
|
||||
glVertex3f(-1.0f, 1.0f, -1.0f);
|
||||
|
||||
glEnd(); /* done with the polygon */
|
||||
glEndList();
|
||||
|
||||
glDisable(GL_DITHER);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
/* Reset the projection matrix */
|
||||
glLoadIdentity();
|
||||
/* Calculate the aspect ratio of the window */
|
||||
gluPerspective(45.0f, (GLfloat) width / (GLfloat) height, 0.1f, 100.0f);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
UGL_LOCAL void drawGL()
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
/* Reset The View */
|
||||
glPushMatrix();
|
||||
|
||||
/* Move 8 units into the screen */
|
||||
glTranslatef(0.0f, 0.0f, -8.0f);
|
||||
|
||||
/* Rotate on the X axis */
|
||||
glRotatef(xrot, 1.0f, 0.0f, 0.0f);
|
||||
|
||||
/* Rotate on the Y axis */
|
||||
glRotatef(yrot, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
/* Rotate On The Z Axis */
|
||||
glRotatef(zrot, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
glCallList(theTexCube);
|
||||
|
||||
glFlush();
|
||||
|
||||
uglMesaSwapBuffers();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
xrot += 1.6f;
|
||||
yrot += 1.6f;
|
||||
zrot += 1.6f;
|
||||
}
|
||||
|
||||
UGL_LOCAL int getEvent(void)
|
||||
{
|
||||
UGL_EVENT event;
|
||||
UGL_STATUS status;
|
||||
int retVal = 0;
|
||||
|
||||
status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
|
||||
|
||||
while (status != UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
UGL_INPUT_EVENT * pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
retVal = 1;
|
||||
|
||||
status = uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT);
|
||||
}
|
||||
|
||||
return(retVal);
|
||||
}
|
||||
|
||||
UGL_LOCAL void cleanUp (void)
|
||||
{
|
||||
if (eventServiceId != UGL_NULL)
|
||||
uglEventQDestroy (eventServiceId, qId);
|
||||
|
||||
uglMesaDestroyContext();
|
||||
uglDeinitialize();
|
||||
}
|
||||
|
||||
void windMLTexCube (UGL_BOOL windMLMode);
|
||||
|
||||
void ugltexcube (void)
|
||||
{
|
||||
taskSpawn("tTexCube", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLTexCube,
|
||||
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
|
||||
void windMLTexCube(UGL_BOOL windMLMode)
|
||||
{
|
||||
GLuint width, height;
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
|
||||
uglInitialize();
|
||||
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0, (UGL_UINT32 *)&keyboardDevId);
|
||||
|
||||
if (uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0,
|
||||
(UGL_UINT32 *)&eventServiceId) == UGL_STATUS_OK)
|
||||
{
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
eventServiceId = UGL_NULL;
|
||||
}
|
||||
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||
|
||||
if (umc == NULL)
|
||||
{
|
||||
uglDeinitialize();
|
||||
return;
|
||||
}
|
||||
|
||||
uglMesaMakeCurrentContext(umc, 0, 0,
|
||||
UGL_MESA_FULLSCREEN_WIDTH,
|
||||
UGL_MESA_FULLSCREEN_HEIGHT);
|
||||
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_WIDTH, &width);
|
||||
uglMesaGetIntegerv(UGL_MESA_HEIGHT, &height);
|
||||
|
||||
initGL(width, height);
|
||||
|
||||
while(!getEvent())
|
||||
drawGL();
|
||||
|
||||
cleanUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
407
progs/windml/ugltexcyl.c
Normal file
407
progs/windml/ugltexcyl.c
Normal file
@@ -0,0 +1,407 @@
|
||||
/*
|
||||
* Textured cylinder demo: lighting, texturing, reflection mapping.
|
||||
*
|
||||
* Brian Paul May 1997 This program is in the public domain.
|
||||
*
|
||||
* Conversion to UGL/Mesa by Stephane Raimbault
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: ugltexcyl.c,v $
|
||||
* Revision 1.2 2001/09/10 19:21:13 brianp
|
||||
* WindML updates (Stephane Raimbault)
|
||||
*
|
||||
* Revision 1.1 2001/08/20 16:07:11 brianp
|
||||
* WindML driver (Stephane Raimbault)
|
||||
*
|
||||
* Revision 1.5 2001/03/27 17:35:26 brianp
|
||||
* set initial window pos
|
||||
*
|
||||
* Revision 1.4 2000/12/24 22:53:54 pesco
|
||||
* * demos/Makefile.am (INCLUDES): Added -I$(top_srcdir)/util.
|
||||
* * demos/Makefile.X11, demos/Makefile.BeOS-R4, demos/Makefile.cygnus:
|
||||
* Essentially the same.
|
||||
* Program files updated to include "readtex.c", not "../util/readtex.c".
|
||||
* * demos/reflect.c: Likewise for "showbuffer.c".
|
||||
*
|
||||
*
|
||||
* * Makefile.am (EXTRA_DIST): Added top-level regular files.
|
||||
*
|
||||
* * include/GL/Makefile.am (INC_X11): Added glxext.h.
|
||||
*
|
||||
*
|
||||
* * src/GGI/include/ggi/mesa/Makefile.am (EXTRA_HEADERS): Include
|
||||
* Mesa GGI headers in dist even if HAVE_GGI is not given.
|
||||
*
|
||||
* * configure.in: Look for GLUT and demo source dirs in $srcdir.
|
||||
*
|
||||
* * src/swrast/Makefile.am (libMesaSwrast_la_SOURCES): Set to *.[ch].
|
||||
* More source list updates in various Makefile.am's.
|
||||
*
|
||||
* * Makefile.am (dist-hook): Remove CVS directory from distribution.
|
||||
* (DIST_SUBDIRS): List all possible subdirs here.
|
||||
* (SUBDIRS): Only list subdirs selected for build again.
|
||||
* The above two applied to all subdir Makefile.am's also.
|
||||
*
|
||||
* Revision 1.3 2000/09/29 23:09:39 brianp
|
||||
* added fps output
|
||||
*
|
||||
* Revision 1.2 1999/10/21 16:39:06 brianp
|
||||
* added -info command line option
|
||||
*
|
||||
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
|
||||
* Imported sources
|
||||
*
|
||||
* Revision 3.3 1999/03/28 18:24:37 brianp
|
||||
* minor clean-up
|
||||
*
|
||||
* Revision 3.2 1998/11/05 04:34:04 brianp
|
||||
* moved image files to ../images/ directory
|
||||
*
|
||||
* Revision 3.1 1998/06/23 03:16:51 brianp
|
||||
* added Point/Linear sampling menu items
|
||||
*
|
||||
* Revision 3.0 1998/02/14 18:42:29 brianp
|
||||
* initial rev
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <tickLib.h>
|
||||
|
||||
#include <ugl/ugl.h>
|
||||
#include <ugl/uglucode.h>
|
||||
#include <ugl/uglevent.h>
|
||||
#include <ugl/uglinput.h>
|
||||
|
||||
#include <GL/uglmesa.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#include "../util/readtex.h"
|
||||
|
||||
#define TEXTURE_FILE "Mesa/images/reflect.rgb"
|
||||
|
||||
#define LIT 1
|
||||
#define TEXTURED 2
|
||||
#define REFLECT 3
|
||||
#define ANIMATE 10
|
||||
#define POINT_FILTER 20
|
||||
#define LINEAR_FILTER 21
|
||||
#define QUIT 100
|
||||
#define COUNT_FRAMES
|
||||
|
||||
UGL_LOCAL UGL_EVENT_SERVICE_ID eventServiceId;
|
||||
UGL_LOCAL UGL_EVENT_Q_ID qId;
|
||||
UGL_LOCAL volatile UGL_BOOL stopWex;
|
||||
UGL_LOCAL UGL_MESA_CONTEXT umc;
|
||||
|
||||
UGL_LOCAL GLuint CylinderObj;
|
||||
UGL_LOCAL GLboolean Animate;
|
||||
UGL_LOCAL GLboolean linearFilter;
|
||||
|
||||
UGL_LOCAL GLfloat Xrot, Yrot, Zrot;
|
||||
UGL_LOCAL GLfloat DXrot, DYrot;
|
||||
|
||||
UGL_LOCAL GLuint limit;
|
||||
UGL_LOCAL GLuint count;
|
||||
UGL_LOCAL GLuint tickStart, tickStop, tickBySec;
|
||||
|
||||
UGL_LOCAL void cleanUp (void);
|
||||
|
||||
UGL_LOCAL void drawGL(void)
|
||||
{
|
||||
#ifdef COUNT_FRAMES
|
||||
int time;
|
||||
#endif
|
||||
|
||||
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);
|
||||
glCallList(CylinderObj);
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
uglMesaSwapBuffers();
|
||||
|
||||
if (Animate)
|
||||
{
|
||||
Xrot += DXrot;
|
||||
Yrot += DYrot;
|
||||
}
|
||||
|
||||
#ifdef COUNT_FRAMES
|
||||
if (count > limit)
|
||||
{
|
||||
tickStop = tickGet ();
|
||||
time = (tickStop-tickStart)/tickBySec;
|
||||
printf (" %i fps\n", count/time);
|
||||
tickStart = tickStop;
|
||||
count = 0;
|
||||
}
|
||||
else
|
||||
count++;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
UGL_LOCAL void echoUse(void)
|
||||
{
|
||||
printf("Keys:\n");
|
||||
printf(" Up/Down Rotate on Y\n");
|
||||
printf(" Left/Right Rotate on X\n");
|
||||
printf(" a Toggle animation\n");
|
||||
printf(" f Toggle point/linear filtered\n");
|
||||
printf(" l Lit\n");
|
||||
printf(" t Textured\n");
|
||||
printf(" r Reflect\n");
|
||||
printf(" ESC Exit\n");
|
||||
}
|
||||
|
||||
UGL_LOCAL void readKey(UGL_WCHAR key)
|
||||
{
|
||||
float step = 3.0;
|
||||
switch (key)
|
||||
{
|
||||
case 'a':
|
||||
Animate = !Animate;
|
||||
break;
|
||||
case 'f':
|
||||
if(linearFilter)
|
||||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
|
||||
GL_NEAREST);
|
||||
}
|
||||
else
|
||||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
|
||||
GL_LINEAR);
|
||||
}
|
||||
linearFilter = !linearFilter;
|
||||
break;
|
||||
case 'l':
|
||||
glEnable(GL_LIGHTING);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glDisable(GL_TEXTURE_GEN_S);
|
||||
glDisable(GL_TEXTURE_GEN_T);
|
||||
break;
|
||||
case 't':
|
||||
glDisable(GL_LIGHTING);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_TEXTURE_GEN_S);
|
||||
glDisable(GL_TEXTURE_GEN_T);
|
||||
break;
|
||||
case 'r':
|
||||
glDisable(GL_LIGHTING);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_TEXTURE_GEN_S);
|
||||
glEnable(GL_TEXTURE_GEN_T);
|
||||
break;
|
||||
case UGL_UNI_UP_ARROW:
|
||||
Xrot += step;
|
||||
break;
|
||||
case UGL_UNI_DOWN_ARROW:
|
||||
Xrot -= step;
|
||||
break;
|
||||
case UGL_UNI_LEFT_ARROW:
|
||||
Yrot += step;
|
||||
break;
|
||||
case UGL_UNI_RIGHT_ARROW:
|
||||
Yrot -= step;
|
||||
break;
|
||||
case UGL_UNI_ESCAPE:
|
||||
stopWex = UGL_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL void loopEvent(void)
|
||||
{
|
||||
UGL_EVENT event;
|
||||
UGL_INPUT_EVENT * pInputEvent;
|
||||
|
||||
UGL_FOREVER
|
||||
{
|
||||
if (uglEventGet (qId, &event, sizeof (event), UGL_NO_WAIT)
|
||||
!= UGL_STATUS_Q_EMPTY)
|
||||
{
|
||||
pInputEvent = (UGL_INPUT_EVENT *)&event;
|
||||
|
||||
if (pInputEvent->header.type == UGL_EVENT_TYPE_KEYBOARD &&
|
||||
pInputEvent->modifiers & UGL_KEYBOARD_KEYDOWN)
|
||||
readKey(pInputEvent->type.keyboard.key);
|
||||
}
|
||||
|
||||
drawGL();
|
||||
if (stopWex)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UGL_LOCAL void initGL(void)
|
||||
{
|
||||
GLUquadricObj *q = gluNewQuadric();
|
||||
CylinderObj = glGenLists(1);
|
||||
glNewList(CylinderObj, GL_COMPILE);
|
||||
|
||||
glTranslatef(0.0, 0.0, -1.0);
|
||||
|
||||
/* cylinder */
|
||||
gluQuadricNormals(q, GL_SMOOTH);
|
||||
gluQuadricTexture(q, GL_TRUE);
|
||||
gluCylinder(q, 0.6, 0.6, 2.0, 24, 1);
|
||||
|
||||
/* end cap */
|
||||
glTranslatef(0.0, 0.0, 2.0);
|
||||
gluDisk(q, 0.0, 0.6, 24, 1);
|
||||
|
||||
/* other end cap */
|
||||
glTranslatef(0.0, 0.0, -2.0);
|
||||
gluQuadricOrientation(q, GLU_INSIDE);
|
||||
gluDisk(q, 0.0, 0.6, 24, 1);
|
||||
|
||||
glEndList();
|
||||
gluDeleteQuadric(q);
|
||||
|
||||
/* lighting */
|
||||
glEnable(GL_LIGHTING);
|
||||
{
|
||||
GLfloat gray[4] = {0.2, 0.2, 0.2, 1.0};
|
||||
GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
|
||||
GLfloat teal[4] = { 0.0, 1.0, 0.8, 1.0 };
|
||||
glMaterialfv(GL_FRONT, GL_DIFFUSE, teal);
|
||||
glLightfv(GL_LIGHT0, GL_AMBIENT, gray);
|
||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, white);
|
||||
glEnable(GL_LIGHT0);
|
||||
}
|
||||
|
||||
/* fitering = nearest, initially */
|
||||
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_DECAL);
|
||||
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
|
||||
|
||||
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
|
||||
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP);
|
||||
|
||||
if (!LoadRGBMipmaps(TEXTURE_FILE, GL_RGB))
|
||||
{
|
||||
printf("Error: couldn't load texture image\n");
|
||||
cleanUp();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glEnable(GL_CULL_FACE); /* don't need Z testing for convex objects */
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
glTranslatef( 0.0, 0.0, -70.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));
|
||||
|
||||
#ifdef COUNT_FRAMES
|
||||
tickStart = tickGet ();
|
||||
tickBySec = sysClkRateGet ();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
UGL_LOCAL void cleanUp (void)
|
||||
{
|
||||
uglEventQDestroy (eventServiceId, qId);
|
||||
|
||||
uglMesaDestroyContext();
|
||||
uglDeinitialize ();
|
||||
}
|
||||
|
||||
void windMLTexCyl (UGL_BOOL windMLMode);
|
||||
|
||||
void ugltexcyl (void)
|
||||
{
|
||||
taskSpawn ("tTexCyl", 210, VX_FP_TASK, 100000, (FUNCPTR)windMLTexCyl,
|
||||
UGL_FALSE,1,2,3,4,5,6,7,8,9);
|
||||
}
|
||||
|
||||
void windMLTexCyl (UGL_BOOL windMLMode)
|
||||
{
|
||||
UGL_INPUT_DEVICE_ID keyboardDevId;
|
||||
GLsizei displayWidth, displayHeight;
|
||||
GLsizei x, y, w, h;
|
||||
|
||||
CylinderObj = 0;
|
||||
Animate = GL_TRUE;
|
||||
linearFilter = GL_FALSE;
|
||||
Xrot = 0.0;
|
||||
Yrot = 0.0;
|
||||
Zrot = 0.0;
|
||||
DXrot = 1.0;
|
||||
DYrot = 2.5;
|
||||
limit = 100;
|
||||
count = 1;
|
||||
|
||||
uglInitialize ();
|
||||
|
||||
uglDriverFind (UGL_KEYBOARD_TYPE, 0,
|
||||
(UGL_UINT32 *)&keyboardDevId);
|
||||
|
||||
uglDriverFind (UGL_EVENT_SERVICE_TYPE, 0, (UGL_UINT32 *)&eventServiceId);
|
||||
|
||||
qId = uglEventQCreate (eventServiceId, 100);
|
||||
|
||||
/* Double buffering */
|
||||
if (windMLMode)
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE
|
||||
| UGL_MESA_WINDML_EXCLUSIVE, NULL);
|
||||
else
|
||||
umc = uglMesaCreateNewContext(UGL_MESA_DOUBLE, NULL);
|
||||
|
||||
if (umc == NULL)
|
||||
{
|
||||
uglDeinitialize ();
|
||||
return;
|
||||
}
|
||||
|
||||
uglMesaMakeCurrentContext (umc, 0, 0, 1, 1);
|
||||
|
||||
uglMesaGetIntegerv(UGL_MESA_DISPLAY_WIDTH, &displayWidth);
|
||||
uglMesaGetIntegerv(UGL_MESA_DISPLAY_HEIGHT, &displayHeight);
|
||||
|
||||
h = (displayHeight*3)/4;
|
||||
w = h;
|
||||
x = (displayWidth-w)/2;
|
||||
y = (displayHeight-h)/2;
|
||||
|
||||
uglMesaMoveToWindow(x, y);
|
||||
uglMesaResizeToWindow(w, h);
|
||||
|
||||
initGL ();
|
||||
|
||||
echoUse();
|
||||
|
||||
stopWex = UGL_FALSE;
|
||||
loopEvent();
|
||||
|
||||
cleanUp();
|
||||
|
||||
return;
|
||||
}
|
||||
|
BIN
progs/windml/wrs_logo.bmp
Normal file
BIN
progs/windml/wrs_logo.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 192 KiB |
96
src/glu/mesa/Makefile.ugl
Normal file
96
src/glu/mesa/Makefile.ugl
Normal file
@@ -0,0 +1,96 @@
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.5
|
||||
#
|
||||
# Copyright (C) 2001 Wind River Systems, Inc
|
||||
|
||||
# The MIT License
|
||||
# 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
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
|
||||
# Makefile for GLU library
|
||||
|
||||
##### MACROS #####
|
||||
GLU_MAJOR = 1
|
||||
GLU_MINOR = 3
|
||||
GLU_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
|
||||
|
||||
##### RULES #####
|
||||
|
||||
include ../rules.windml
|
||||
|
||||
GLU_SOURCES = \
|
||||
glu.c \
|
||||
mipmap.c \
|
||||
nurbs.c \
|
||||
nurbscrv.c \
|
||||
nurbssrf.c \
|
||||
nurbsutl.c \
|
||||
polytest.c \
|
||||
project.c \
|
||||
quadric.c \
|
||||
tess.c \
|
||||
tesselat.c \
|
||||
../src/windml/tornado/torMesaGLUInit.c
|
||||
|
||||
GLU_OBJECTS = $(GLU_SOURCES:.c=.o)
|
||||
GLU_OBJNAME = $(MESA_LIBDIR)/objMesaGLU.o
|
||||
|
||||
SOURCES = $(GLU_SOURCES)
|
||||
|
||||
##### TARGETS #####
|
||||
|
||||
all: depend.$(CPU)$(TOOL) $(GLU_OBJNAME)
|
||||
|
||||
# Make the GLU library
|
||||
$(GLU_OBJNAME): $(GLU_OBJECTS)
|
||||
# $(LD) -r $(GLU_OBJECTS) -o $(MESA_OBJNAME)
|
||||
$(LD) -r $(GLU_OBJECTS) -o $(GLU_OBJNAME)
|
||||
# $(AR) rus $(MESA_LIBNAME) $(GLU_OBJNAME)
|
||||
# $(AR) rus $(VX_LIBNAME) $(GLU_OBJNAME)
|
||||
|
||||
depend.$(CPU)$(TOOL):
|
||||
ifeq ($(WIND_HOST_TYPE),x86-win32)
|
||||
@ $(RM) $@
|
||||
@ $(ECHO) Creating depend.$(CPU)$(TOOL)
|
||||
ifneq ($(SOURCES),)
|
||||
@ for %f in ($(SOURCES)) do \
|
||||
$(CC) -MM $(CFLAGS) %f >>$@
|
||||
endif
|
||||
else
|
||||
Makefile
|
||||
@ $(RM) $@
|
||||
@ $(ECHO) "Creating depend.$(CPU)$(TOOL)"
|
||||
ifneq ($(SOURCES),)
|
||||
@ for FILE in $(filter-out $(NODEPENDOBJS), $(SOURCES)); \
|
||||
do \
|
||||
$(CC) -MM $(CFLAGS) $$FILE \
|
||||
| $(TCL) $(BIN_DIR)/depend.tcl $(TGT_DIR) >>$@; \
|
||||
done
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY = clean
|
||||
|
||||
clean:
|
||||
# $(AR) d $(MESA_LIBNAME) $(GLU_OBJNAME)
|
||||
# $(AR) d $(VX_LIBNAME) $(GLU_OBJNAME)
|
||||
$(RM) $(GLU_OBJNAME)
|
||||
$(RM) $(GLU_OBJECTS)
|
||||
$(RM) depend.$(CPU)$(TOOL)
|
||||
|
||||
include depend.$(CPU)$(TOOL)
|
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.X11,v 1.4 2001/03/28 20:17:55 gareth Exp $
|
||||
# $Id: Makefile.X11,v 1.5 2001/08/13 16:51:08 brianp Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.5
|
||||
@@ -135,6 +135,9 @@ default:
|
||||
|
||||
clean:
|
||||
-rm *.o */*.o */*/*.o
|
||||
-rm *.lo */*.lo */*/*.lo
|
||||
-rm *.la */*.la */*/*.la
|
||||
|
||||
|
||||
targets: $(LIBDIR)/$(GLU_LIB)
|
||||
|
||||
|
160
src/glu/sgi/Makefile.win
Normal file
160
src/glu/sgi/Makefile.win
Normal file
@@ -0,0 +1,160 @@
|
||||
# Makefile for Win32
|
||||
|
||||
#
|
||||
# Sept 12, 2001
|
||||
# Note: The nurbs code is not being built at this time.
|
||||
# If you want to work on it, uncomment the definitions
|
||||
# noted below to try to compile the sources.
|
||||
# There are numerous problems, some of which may be solved
|
||||
# by setting some #defines.
|
||||
#
|
||||
|
||||
!include <win32.mak>
|
||||
|
||||
.SUFFIXES : .cc
|
||||
|
||||
TOP = ..
|
||||
|
||||
GLU_SRCS_CC = \
|
||||
libnurbs\interface\bezierEval.cc \
|
||||
libnurbs\interface\bezierPatch.cc \
|
||||
libnurbs\interface\bezierPatchMesh.cc \
|
||||
libnurbs\interface\glcurveval.cc \
|
||||
libnurbs\interface\glinterface.cc \
|
||||
libnurbs\interface\glrenderer.cc \
|
||||
libnurbs\interface\glsurfeval.cc \
|
||||
libnurbs\interface\incurveeval.cc \
|
||||
libnurbs\interface\insurfeval.cc \
|
||||
libnurbs\internals\arc.cc \
|
||||
libnurbs\internals\arcsorter.cc \
|
||||
libnurbs\internals\arctess.cc \
|
||||
libnurbs\internals\backend.cc \
|
||||
libnurbs\internals\basiccrveval.cc \
|
||||
libnurbs\internals\basicsurfeval.cc \
|
||||
libnurbs\internals\bin.cc \
|
||||
libnurbs\internals\bufpool.cc \
|
||||
libnurbs\internals\cachingeval.cc \
|
||||
libnurbs\internals\ccw.cc \
|
||||
libnurbs\internals\coveandtiler.cc \
|
||||
libnurbs\internals\curve.cc \
|
||||
libnurbs\internals\curvelist.cc \
|
||||
libnurbs\internals\curvesub.cc \
|
||||
libnurbs\internals\dataTransform.cc \
|
||||
libnurbs\internals\displaylist.cc \
|
||||
libnurbs\internals\flist.cc \
|
||||
libnurbs\internals\flistsorter.cc \
|
||||
libnurbs\internals\hull.cc \
|
||||
libnurbs\internals\intersect.cc \
|
||||
libnurbs\internals\knotvector.cc \
|
||||
libnurbs\internals\mapdesc.cc \
|
||||
libnurbs\internals\mapdescv.cc \
|
||||
libnurbs\internals\maplist.cc \
|
||||
libnurbs\internals\mesher.cc \
|
||||
libnurbs\internals\monoTriangulationBackend.cc \
|
||||
libnurbs\internals\monotonizer.cc \
|
||||
libnurbs\internals\mycode.cc \
|
||||
libnurbs\internals\nurbsinterfac.cc \
|
||||
libnurbs\internals\nurbstess.cc \
|
||||
libnurbs\internals\patch.cc \
|
||||
libnurbs\internals\patchlist.cc \
|
||||
libnurbs\internals\quilt.cc \
|
||||
libnurbs\internals\reader.cc \
|
||||
libnurbs\internals\renderhints.cc \
|
||||
libnurbs\internals\slicer.cc \
|
||||
libnurbs\internals\sorter.cc \
|
||||
libnurbs\internals\splitarcs.cc \
|
||||
libnurbs\internals\subdivider.cc \
|
||||
libnurbs\internals\tobezier.cc \
|
||||
libnurbs\internals\trimline.cc \
|
||||
libnurbs\internals\trimregion.cc \
|
||||
libnurbs\internals\trimvertpool.cc \
|
||||
libnurbs\internals\uarray.cc \
|
||||
libnurbs\internals\varray.cc \
|
||||
libnurbs\nurbtess\directedLine.cc \
|
||||
libnurbs\nurbtess\gridWrap.cc \
|
||||
libnurbs\nurbtess\monoChain.cc \
|
||||
libnurbs\nurbtess\monoPolyPart.cc \
|
||||
libnurbs\nurbtess\monoTriangulation.cc \
|
||||
libnurbs\nurbtess\partitionX.cc \
|
||||
libnurbs\nurbtess\partitionY.cc \
|
||||
libnurbs\nurbtess\polyDBG.cc \
|
||||
libnurbs\nurbtess\polyUtil.cc \
|
||||
libnurbs\nurbtess\primitiveStream.cc \
|
||||
libnurbs\nurbtess\quicksort.cc \
|
||||
libnurbs\nurbtess\rectBlock.cc \
|
||||
libnurbs\nurbtess\sampleComp.cc \
|
||||
libnurbs\nurbtess\sampleCompBot.cc \
|
||||
libnurbs\nurbtess\sampleCompRight.cc \
|
||||
libnurbs\nurbtess\sampleCompTop.cc \
|
||||
libnurbs\nurbtess\sampleMonoPoly.cc \
|
||||
libnurbs\nurbtess\sampledLine.cc \
|
||||
libnurbs\nurbtess\searchTree.cc
|
||||
|
||||
GLU_SRCS = \
|
||||
libtess\dict.c \
|
||||
libtess\geom.c \
|
||||
libtess\memalloc.c \
|
||||
libtess\mesh.c \
|
||||
libtess\normal.c \
|
||||
libtess\priorityq.c \
|
||||
libtess\render.c \
|
||||
libtess\sweep.c \
|
||||
libtess\tess.c \
|
||||
libtess\tessmono.c \
|
||||
libutil\error.c \
|
||||
libutil\glue.c \
|
||||
libutil\mipmap.c \
|
||||
libutil\project.c \
|
||||
libutil\quad.c \
|
||||
libutil\registry.c
|
||||
|
||||
SRCS = $(GLU_SRCS)
|
||||
|
||||
all : gludll
|
||||
|
||||
!include "$(TOP)/mesawin32.mak"
|
||||
|
||||
gludll : $(GLUDLL)
|
||||
|
||||
CFLAGS = $(cvarsdll) $(CFLAGS) -D_OPENGL32_ -Iinclude -DBUILD_GL32
|
||||
LFLAGS = $(dlllflags) $(lcommon) $(LFLAGS)
|
||||
|
||||
OBJS = $(GLU_SRCS:.c=.obj)
|
||||
LIBS = ../lib/$(MESALIB) winmm.lib $(guilibsdll)
|
||||
|
||||
# Uncomment these definitions to try to compile the NURBS code.
|
||||
#OBJS = $(GLU_SRCS_CC:.cc=.obj) $(GLU_SRCS:.c=.obj)
|
||||
#NURBSINC = -Ilibnurbs\interface -Ilibnurbs\internals -Ilibnurbs\nurbtess
|
||||
#CFLAGS = $(CFLAGS) $(NURBSINC)
|
||||
|
||||
$(GLUDLL): $(OBJS) glu.def
|
||||
$(link) $(LFLAGS) -out:$(GLUDLL) -def:glu.def $(OBJS) $(LIBS)
|
||||
@echo "copying Mesa GLU dynamic link library to library directory..."
|
||||
-copy $(GLUDLL) $(TOP)\lib
|
||||
@echo "copying Mesa GLU import library to library directory..."
|
||||
-copy $(GLULIB) $(TOP)\lib
|
||||
|
||||
install : $(GLUDLL) $(GLULIB)
|
||||
@echo "copying Mesa GLU dynamic link library to system directory..."
|
||||
-copy $(GLUDLL) $(DLLINSTALL)
|
||||
@echo "copying Mesa GLU header files to include directory..."
|
||||
-copy ..\..\include\GL\glu.h $(INCLUDEINSTALL)
|
||||
@echo "copying Mesa GLU import library to system library directory..."
|
||||
-copy $(GLULIB) $(LIBINSTALL)
|
||||
|
||||
clean ::
|
||||
@del /f libtess\*.obj libutil\*.obj
|
||||
@del /f libnurbs\interface\*.obj libnurbs\internals\*.obj
|
||||
@del /f libnurbs\nurbtess\*.obj
|
||||
|
||||
# override default inference rule with one that writes the object to
|
||||
# the same subdir as the c file.
|
||||
|
||||
.c.obj :
|
||||
$(cc) $(CFLAGS) -I. $< /Fo$*.obj
|
||||
|
||||
# /TP is needed for C++ files because MS compiler
|
||||
# does not recognize .cc as a C++ file.
|
||||
|
||||
.cc.obj :
|
||||
$(cc) $(CFLAGS) -I. $< /TP /Fo$*.obj
|
46
src/glu/sgi/glu.def
Normal file
46
src/glu/sgi/glu.def
Normal file
@@ -0,0 +1,46 @@
|
||||
DESCRIPTION 'Mesa GLU (OpenGL work-alike) for Win32'
|
||||
VERSION 3.5
|
||||
|
||||
EXPORTS
|
||||
gluBeginPolygon
|
||||
gluBuild1DMipmapLevels
|
||||
gluBuild1DMipmaps
|
||||
gluBuild2DMipmapLevels
|
||||
gluBuild2DMipmaps
|
||||
gluBuild3DMipmapLevels
|
||||
gluBuild3DMipmaps
|
||||
gluCheckExtension
|
||||
gluCylinder
|
||||
gluDeleteQuadric
|
||||
gluDeleteTess
|
||||
gluDisk
|
||||
gluEndPolygon
|
||||
gluErrorString
|
||||
gluGetString
|
||||
gluGetTessProperty
|
||||
gluLookAt
|
||||
gluNewQuadric
|
||||
gluNewTess
|
||||
gluNextContour
|
||||
gluOrtho2D
|
||||
gluPartialDisk
|
||||
gluPerspective
|
||||
gluPickMatrix
|
||||
gluProject
|
||||
gluQuadricCallback
|
||||
gluQuadricDrawStyle
|
||||
gluQuadricNormals
|
||||
gluQuadricOrientation
|
||||
gluQuadricTexture
|
||||
gluScaleImage
|
||||
gluSphere
|
||||
gluTessBeginContour
|
||||
gluTessBeginPolygon
|
||||
gluTessCallback
|
||||
gluTessEndContour
|
||||
gluTessEndPolygon
|
||||
gluTessNormal
|
||||
gluTessProperty
|
||||
gluTessVertex
|
||||
gluUnProject
|
||||
gluUnProject4
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
** gluos.h - operating system dependencies for GLU
|
||||
**
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/include/gluos.h,v 1.2 2001/03/22 11:38:36 joukj Exp $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/include/gluos.h,v 1.3 2001/07/16 15:46:42 brianp Exp $
|
||||
*/
|
||||
#ifdef __VMS
|
||||
#ifdef __cplusplus
|
||||
@@ -12,10 +12,20 @@
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <stdlib.h> /* For _MAX_PATH definition */
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOGDI
|
||||
#define NOIME
|
||||
#define NOMINMAX
|
||||
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#ifndef STRICT
|
||||
#define STRICT 1
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* Disable warnings */
|
||||
@@ -23,6 +33,8 @@
|
||||
#pragma warning(disable : 4244)
|
||||
#pragma warning(disable : 4761)
|
||||
|
||||
#pragma comment(linker, "/OPT:NOWIN98")
|
||||
|
||||
#else
|
||||
|
||||
/* Disable Microsoft-specific keywords */
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* glcurveval.c++
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glcurveval.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
* $Date: 2001/08/07 17:34:10 $ $Revision: 1.3 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glcurveval.cc,v 1.3 2001/08/07 17:34:10 brianp Exp $
|
||||
*/
|
||||
|
||||
/* Polynomial Evaluator Interface */
|
||||
@@ -300,7 +300,11 @@ void OpenGLCurveEvaluator::evalcoord1f(long, REAL u)
|
||||
}
|
||||
|
||||
void
|
||||
OpenGLCurveEvaluator::putCallBack(GLenum which, GLvoid (GLAPIENTRY *fn)(...))
|
||||
#ifdef _WIN32
|
||||
OpenGLCurveEvaluator::putCallBack(GLenum which, void (GLAPIENTRY *fn)())
|
||||
#else
|
||||
OpenGLCurveEvaluator::putCallBack(GLenum which, _GLUfuncptr fn)
|
||||
#endif
|
||||
{
|
||||
switch(which)
|
||||
{
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* glcurveval.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glcurveval.h,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
* $Date: 2001/08/07 17:34:11 $ $Revision: 1.4 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glcurveval.h,v 1.4 2001/08/07 17:34:11 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __gluglcurveval_h_
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
#include "gluos.h"
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include "basiccrveval.h"
|
||||
|
||||
class CurveMap;
|
||||
@@ -93,7 +94,11 @@ public:
|
||||
{
|
||||
output_triangles = flag;
|
||||
}
|
||||
void putCallBack(GLenum which, GLvoid (GLAPIENTRY *fn)(...));
|
||||
#ifdef _WIN32
|
||||
void putCallBack(GLenum which, void (APIENTRY *fn)() );
|
||||
#else
|
||||
void putCallBack(GLenum which, _GLUfuncptr fn );
|
||||
#endif
|
||||
void set_callback_userData(void *data)
|
||||
{
|
||||
userData = data;
|
||||
|
@@ -31,10 +31,10 @@
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
** $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
** $Date: 2001/07/16 15:46:42 $ $Revision: 1.2 $
|
||||
*/
|
||||
/*
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glinterface.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glinterface.cc,v 1.2 2001/07/16 15:46:42 brianp Exp $
|
||||
*/
|
||||
|
||||
#include "gluos.h"
|
||||
@@ -429,7 +429,7 @@ gluGetNurbsProperty(GLUnurbs *r, GLenum property, GLfloat *value)
|
||||
}
|
||||
|
||||
extern "C" void GLAPIENTRY
|
||||
gluNurbsCallback(GLUnurbs *r, GLenum which, GLvoid (*fn)())
|
||||
gluNurbsCallback(GLUnurbs *r, GLenum which, _GLUfuncptr fn )
|
||||
{
|
||||
switch (which) {
|
||||
case GLU_NURBS_BEGIN:
|
||||
@@ -444,11 +444,11 @@ gluNurbsCallback(GLUnurbs *r, GLenum which, GLvoid (*fn)())
|
||||
case GLU_NURBS_NORMAL_DATA:
|
||||
case GLU_NURBS_TEXTURE_COORD_DATA:
|
||||
case GLU_NURBS_COLOR_DATA:
|
||||
r->putSurfCallBack(which, (GLvoid (*)(...))fn);
|
||||
r->putSurfCallBack(which, fn);
|
||||
break;
|
||||
|
||||
case GLU_NURBS_ERROR:
|
||||
r->errorCallback = (void (*)( GLenum )) fn;
|
||||
r->errorCallback = (void (APIENTRY *)( GLenum e )) fn;
|
||||
break;
|
||||
default:
|
||||
r->postError(GLU_INVALID_ENUM);
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* glrenderer.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glrenderer.h,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
* $Date: 2001/08/07 17:34:11 $ $Revision: 1.3 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glrenderer.h,v 1.3 2001/08/07 17:34:11 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __gluglrenderer_h_
|
||||
@@ -70,11 +70,14 @@ public:
|
||||
}
|
||||
GLboolean getautoloadmode( void ) { return autoloadmode; }
|
||||
|
||||
void (GLAPIENTRY *errorCallback)( GLenum );
|
||||
void (APIENTRY *errorCallback)( GLenum );
|
||||
void postError( int which )
|
||||
{ if (errorCallback) (*errorCallback)( (GLenum)which ); }
|
||||
|
||||
void putSurfCallBack(GLenum which, GLvoid (GLAPIENTRY *fn)(...))
|
||||
{ if (errorCallback) (errorCallback)( (GLenum)which ); }
|
||||
#ifdef _WIN32
|
||||
void putSurfCallBack(GLenum which, void (GLAPIENTRY *fn)() )
|
||||
#else
|
||||
void putSurfCallBack(GLenum which, _GLUfuncptr fn )
|
||||
#endif
|
||||
{
|
||||
curveEvaluator.putCallBack(which, fn);
|
||||
surfaceEvaluator.putCallBack(which, fn);
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* glsurfeval.c++
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glsurfeval.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
* $Date: 2001/07/16 15:46:42 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glsurfeval.cc,v 1.2 2001/07/16 15:46:42 brianp Exp $
|
||||
*/
|
||||
|
||||
/* Polynomial Evaluator Interface */
|
||||
@@ -1188,7 +1188,7 @@ return;
|
||||
}
|
||||
|
||||
void
|
||||
OpenGLSurfaceEvaluator::putCallBack(GLenum which, GLvoid (GLAPIENTRY *fn)(...))
|
||||
OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn )
|
||||
{
|
||||
switch(which)
|
||||
{
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* glsurfeval.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glsurfeval.h,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
* $Date: 2001/08/07 17:34:11 $ $Revision: 1.4 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glsurfeval.h,v 1.4 2001/08/07 17:34:11 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __gluglsurfeval_h_
|
||||
@@ -44,7 +44,8 @@
|
||||
|
||||
#include "basicsurfeval.h"
|
||||
#include "bezierPatchMesh.h" //in case output triangles
|
||||
#include "GL/gl.h"
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
class SurfaceMap;
|
||||
class OpenGLSurfaceEvaluator;
|
||||
@@ -145,7 +146,12 @@ public:
|
||||
void newtmeshvert( REAL, REAL );
|
||||
void newtmeshvert( long, long );
|
||||
|
||||
void putCallBack(GLenum which, GLvoid (GLAPIENTRY *fn)(...));
|
||||
#ifdef _WIN32
|
||||
void putCallBack(GLenum which, void (APIENTRY *fn)() );
|
||||
#else
|
||||
void putCallBack(GLenum which, _GLUfuncptr fn );
|
||||
#endif
|
||||
|
||||
int get_vertices_call_back()
|
||||
{
|
||||
return output_triangles;
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* arc.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arc.h,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
* $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arc.h,v 1.2 2001/08/07 17:34:11 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __gluarc_h_
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
class Bin;
|
||||
class Arc;
|
||||
class BezierArc;
|
||||
struct BezierArc;
|
||||
|
||||
typedef class Arc *Arc_ptr;
|
||||
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* arctess.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arctess.h,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
* $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arctess.h,v 1.2 2001/08/07 17:34:11 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __gluarctess_h_
|
||||
@@ -46,7 +46,7 @@
|
||||
#include "types.h"
|
||||
#include "arc.h"
|
||||
|
||||
class BezierArc;
|
||||
struct BezierArc;
|
||||
class Pool;
|
||||
class TrimVertexPool;
|
||||
|
||||
|
@@ -35,18 +35,18 @@
|
||||
/*
|
||||
* coveandtiler.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/coveandtiler.h,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
* $Date: 2001/07/16 15:46:42 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/coveandtiler.h,v 1.2 2001/07/16 15:46:42 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __glucoveandtiler_h
|
||||
#define __glucoveandtiler_h
|
||||
|
||||
#include "trimregion.h"
|
||||
#include "trimvertex.h"
|
||||
#include "gridvertex.h"
|
||||
|
||||
class Backend;
|
||||
class TrimVertex;
|
||||
class GridVertex;
|
||||
class GridTrimVertex;
|
||||
|
||||
class CoveAndTiler : virtual public TrimRegion {
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* curve.c++
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/curve.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
* $Date: 2001/08/13 16:52:18 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/curve.cc,v 1.2 2001/08/13 16:52:18 brianp Exp $
|
||||
*/
|
||||
|
||||
#include "glimports.h"
|
||||
@@ -170,7 +170,7 @@ Curve::getstepsize( void )
|
||||
REAL t = mapdesc->getProperty( N_PIXEL_TOLERANCE );
|
||||
if( mapdesc->isParametricDistanceSampling() ) {
|
||||
REAL d = mapdesc->calcPartialVelocity( &tmp[0][0], tstride, order, 2, range[2] );
|
||||
stepsize = (d > 0.0) ? ::sqrtf( 8.0 * t / d ) : range[2];
|
||||
stepsize = (d > 0.0) ? sqrtf( 8.0 * t / d ) : range[2];
|
||||
minstepsize = ( mapdesc->maxrate > 0.0 ) ? (range[2] / mapdesc->maxrate) : 0.0;
|
||||
} else if( mapdesc->isPathLengthSampling() ) {
|
||||
// t is upper bound on path (arc) length
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* hull.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/hull.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
* $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/hull.h,v 1.2 2001/08/07 17:34:11 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __gluhull_h_
|
||||
@@ -44,9 +44,10 @@
|
||||
|
||||
#include "trimline.h"
|
||||
#include "trimregion.h"
|
||||
#include "trimvertex.h"
|
||||
#include "gridtrimvertex.h"
|
||||
|
||||
class GridTrimVertex;
|
||||
class Gridline;
|
||||
struct Gridline;
|
||||
class Uarray;
|
||||
|
||||
class Hull : virtual public TrimRegion {
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* mapdescv.c++
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mapdescv.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
* $Date: 2001/08/13 16:52:18 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mapdescv.cc,v 1.2 2001/08/13 16:52:18 brianp Exp $
|
||||
*/
|
||||
|
||||
#include "glimports.h"
|
||||
@@ -93,7 +93,7 @@ Mapdesc::calcPartialVelocity (
|
||||
REAL max = 0.0;
|
||||
for( j=0; j != ncols-partial; j++ )
|
||||
if( mag[j] > max ) max = mag[j];
|
||||
max = fac * ::sqrtf( (float) max );
|
||||
max = fac * sqrtf( (float) max );
|
||||
|
||||
return max;
|
||||
}
|
||||
@@ -217,8 +217,8 @@ Mapdesc::calcPartialVelocity (
|
||||
j = ncols-tpartial-1;
|
||||
if( mag[i][j] > dist[1] ) dist[1] = mag[i][j];
|
||||
}
|
||||
dist[0] = fac * ::sqrtf( dist[0] );
|
||||
dist[1] = fac * ::sqrtf( dist[1] );
|
||||
dist[0] = fac * sqrtf( dist[0] );
|
||||
dist[1] = fac * sqrtf( dist[1] );
|
||||
} else if( side == 1 ) {
|
||||
// compute max magnitude of first and last row
|
||||
dist[0] = 0.0;
|
||||
@@ -230,11 +230,11 @@ Mapdesc::calcPartialVelocity (
|
||||
i = nrows-spartial-1;
|
||||
if( mag[i][j] > dist[1] ) dist[1] = mag[i][j];
|
||||
}
|
||||
dist[0] = fac * ::sqrtf( dist[0] );
|
||||
dist[1] = fac * ::sqrtf( dist[1] );
|
||||
dist[0] = fac * sqrtf( dist[0] );
|
||||
dist[1] = fac * sqrtf( dist[1] );
|
||||
}
|
||||
|
||||
max = fac * ::sqrtf( (float) max );
|
||||
max = fac * sqrtf( (float) max );
|
||||
|
||||
return max;
|
||||
}
|
||||
|
@@ -35,14 +35,13 @@
|
||||
/*
|
||||
* mesher.c++
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mesher.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
* $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mesher.cc,v 1.2 2001/08/07 17:34:11 brianp Exp $
|
||||
*/
|
||||
|
||||
#include "glimports.h"
|
||||
#include "myassert.h"
|
||||
#include "mystdio.h"
|
||||
#include "mesher.h"
|
||||
#include "gridvertex.h"
|
||||
#include "gridtrimvertex.h"
|
||||
#include "jarcloc.h"
|
||||
@@ -50,6 +49,7 @@
|
||||
#include "trimline.h"
|
||||
#include "uarray.h"
|
||||
#include "backend.h"
|
||||
#include "mesher.h"
|
||||
|
||||
|
||||
const float Mesher::ZERO = 0.0;
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* mesher.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mesher.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
* $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mesher.h,v 1.2 2001/08/07 17:34:11 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __glumesher_h_
|
||||
@@ -47,7 +47,7 @@
|
||||
class TrimRegion;
|
||||
class Backend;
|
||||
class Pool;
|
||||
class GridTrimVertex;
|
||||
// struct GridTrimVertex;
|
||||
|
||||
|
||||
class Mesher : virtual public TrimRegion, public Hull {
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* mymath.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mymath.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
* $Date: 2001/08/13 16:52:18 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/mymath.h,v 1.2 2001/08/13 16:52:18 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __glumymath_h_
|
||||
@@ -61,4 +61,14 @@ extern "C" float floorf(float);
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#if !defined sqrtf
|
||||
# define sqrtf(x) ((float)sqrt(x))
|
||||
#endif
|
||||
#if !defined ceilf
|
||||
# define ceilf(x) ((float)ceil(x))
|
||||
#endif
|
||||
#if !defined floorf
|
||||
# define floorf(x) ((float)floor(x))
|
||||
#endif
|
||||
|
||||
#endif /* __glumymath_h_ */
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* nurbstess.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/nurbstess.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
* $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/nurbstess.h,v 1.2 2001/08/07 17:34:11 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __glunurbstess_h_
|
||||
@@ -50,7 +50,7 @@
|
||||
#include "reader.h"
|
||||
#include "nurbsconsts.h"
|
||||
|
||||
class Knotvector;
|
||||
struct Knotvector;
|
||||
class Quilt;
|
||||
class DisplayList;
|
||||
class BasicCurveEvaluator;
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* patch.c++
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/patch.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
* $Date: 2001/08/13 16:52:18 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/patch.cc,v 1.2 2001/08/13 16:52:18 brianp Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -321,43 +321,43 @@ Patch::getstepsize( void )
|
||||
if( ss != 0.0 && tt != 0.0 ) {
|
||||
/* printf( "ssv[0] %g ssv[1] %g ttv[0] %g ttv[1] %g\n",
|
||||
ssv[0], ssv[1], ttv[0], ttv[1] ); */
|
||||
REAL ttq = ::sqrtf( (float) ss );
|
||||
REAL ssq = ::sqrtf( (float) tt );
|
||||
REAL ds = ::sqrtf( 4 * t2 * ttq / ( ss * ttq + st * ssq ) );
|
||||
REAL dt = ::sqrtf( 4 * t2 * ssq / ( tt * ssq + st * ttq ) );
|
||||
REAL ttq = sqrtf( (float) ss );
|
||||
REAL ssq = sqrtf( (float) tt );
|
||||
REAL ds = sqrtf( 4 * t2 * ttq / ( ss * ttq + st * ssq ) );
|
||||
REAL dt = sqrtf( 4 * t2 * ssq / ( tt * ssq + st * ttq ) );
|
||||
pspec[0].stepsize = ( ds < pspec[0].range[2] ) ? ds : pspec[0].range[2];
|
||||
REAL scutoff = 2.0 * t2 / ( pspec[0].range[2] * pspec[0].range[2]);
|
||||
pspec[0].sidestep[0] = (ssv[0] > scutoff) ? ::sqrtf( 2.0 * t2 / ssv[0] ) : pspec[0].range[2];
|
||||
pspec[0].sidestep[1] = (ssv[1] > scutoff) ? ::sqrtf( 2.0 * t2 / ssv[1] ) : pspec[0].range[2];
|
||||
pspec[0].sidestep[0] = (ssv[0] > scutoff) ? sqrtf( 2.0 * t2 / ssv[0] ) : pspec[0].range[2];
|
||||
pspec[0].sidestep[1] = (ssv[1] > scutoff) ? sqrtf( 2.0 * t2 / ssv[1] ) : pspec[0].range[2];
|
||||
|
||||
pspec[1].stepsize = ( dt < pspec[1].range[2] ) ? dt : pspec[1].range[2];
|
||||
REAL tcutoff = 2.0 * t2 / ( pspec[1].range[2] * pspec[1].range[2]);
|
||||
pspec[1].sidestep[0] = (ttv[0] > tcutoff) ? ::sqrtf( 2.0 * t2 / ttv[0] ) : pspec[1].range[2];
|
||||
pspec[1].sidestep[1] = (ttv[1] > tcutoff) ? ::sqrtf( 2.0 * t2 / ttv[1] ) : pspec[1].range[2];
|
||||
pspec[1].sidestep[0] = (ttv[0] > tcutoff) ? sqrtf( 2.0 * t2 / ttv[0] ) : pspec[1].range[2];
|
||||
pspec[1].sidestep[1] = (ttv[1] > tcutoff) ? sqrtf( 2.0 * t2 / ttv[1] ) : pspec[1].range[2];
|
||||
} else if( ss != 0.0 ) {
|
||||
REAL x = pspec[1].range[2] * st;
|
||||
REAL ds = ( ::sqrtf( x * x + 8.0 * t2 * ss ) - x ) / ss;
|
||||
REAL ds = ( sqrtf( x * x + 8.0 * t2 * ss ) - x ) / ss;
|
||||
pspec[0].stepsize = ( ds < pspec[0].range[2] ) ? ds : pspec[0].range[2];
|
||||
REAL scutoff = 2.0 * t2 / ( pspec[0].range[2] * pspec[0].range[2]);
|
||||
pspec[0].sidestep[0] = (ssv[0] > scutoff) ? ::sqrtf( 2.0 * t2 / ssv[0] ) : pspec[0].range[2];
|
||||
pspec[0].sidestep[1] = (ssv[1] > scutoff) ? ::sqrtf( 2.0 * t2 / ssv[1] ) : pspec[0].range[2];
|
||||
pspec[0].sidestep[0] = (ssv[0] > scutoff) ? sqrtf( 2.0 * t2 / ssv[0] ) : pspec[0].range[2];
|
||||
pspec[0].sidestep[1] = (ssv[1] > scutoff) ? sqrtf( 2.0 * t2 / ssv[1] ) : pspec[0].range[2];
|
||||
pspec[1].singleStep();
|
||||
} else if( tt != 0.0 ) {
|
||||
REAL x = pspec[0].range[2] * st;
|
||||
REAL dt = ( ::sqrtf( x * x + 8.0 * t2 * tt ) - x ) / tt;
|
||||
REAL dt = ( sqrtf( x * x + 8.0 * t2 * tt ) - x ) / tt;
|
||||
pspec[0].singleStep();
|
||||
REAL tcutoff = 2.0 * t2 / ( pspec[1].range[2] * pspec[1].range[2]);
|
||||
pspec[1].stepsize = ( dt < pspec[1].range[2] ) ? dt : pspec[1].range[2];
|
||||
pspec[1].sidestep[0] = (ttv[0] > tcutoff) ? ::sqrtf( 2.0 * t2 / ttv[0] ) : pspec[1].range[2];
|
||||
pspec[1].sidestep[1] = (ttv[1] > tcutoff) ? ::sqrtf( 2.0 * t2 / ttv[1] ) : pspec[1].range[2];
|
||||
pspec[1].sidestep[0] = (ttv[0] > tcutoff) ? sqrtf( 2.0 * t2 / ttv[0] ) : pspec[1].range[2];
|
||||
pspec[1].sidestep[1] = (ttv[1] > tcutoff) ? sqrtf( 2.0 * t2 / ttv[1] ) : pspec[1].range[2];
|
||||
} else {
|
||||
if( 4.0 * t2 > st * pspec[0].range[2] * pspec[1].range[2] ) {
|
||||
pspec[0].singleStep();
|
||||
pspec[1].singleStep();
|
||||
} else {
|
||||
REAL area = 4.0 * t2 / st;
|
||||
REAL ds = ::sqrtf( area * pspec[0].range[2] / pspec[1].range[2] );
|
||||
REAL dt = ::sqrtf( area * pspec[1].range[2] / pspec[0].range[2] );
|
||||
REAL ds = sqrtf( area * pspec[0].range[2] / pspec[1].range[2] );
|
||||
REAL dt = sqrtf( area * pspec[1].range[2] / pspec[0].range[2] );
|
||||
pspec[0].stepsize = ( ds < pspec[0].range[2] ) ? ds : pspec[0].range[2];
|
||||
pspec[0].sidestep[0] = pspec[0].range[2];
|
||||
pspec[0].sidestep[1] = pspec[0].range[2];
|
||||
@@ -417,8 +417,8 @@ Patch::getstepsize( void )
|
||||
if( ms != 0.0 && mt != 0.0 ) {
|
||||
REAL d = 1.0 / (ms * mt);
|
||||
t *= M_SQRT2;
|
||||
REAL ds = t * ::sqrtf( d * pspec[0].range[2] / pspec[1].range[2] );
|
||||
REAL dt = t * ::sqrtf( d * pspec[1].range[2] / pspec[0].range[2] );
|
||||
REAL ds = t * sqrtf( d * pspec[0].range[2] / pspec[1].range[2] );
|
||||
REAL dt = t * sqrtf( d * pspec[1].range[2] / pspec[0].range[2] );
|
||||
pspec[0].stepsize = ( ds < pspec[0].range[2] ) ? ds : pspec[0].range[2];
|
||||
pspec[0].sidestep[0] = ( msv[0] * pspec[0].range[2] > t ) ? (t / msv[0]) : pspec[0].range[2];
|
||||
pspec[0].sidestep[1] = ( msv[1] * pspec[0].range[2] > t ) ? (t / msv[1]) : pspec[0].range[2];
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* quilt.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/quilt.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
* $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/quilt.h,v 1.2 2001/08/07 17:34:11 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __gluquilt_h_
|
||||
@@ -49,7 +49,7 @@
|
||||
class Backend;
|
||||
class Mapdesc;
|
||||
class Flist;
|
||||
class Knotvector;
|
||||
struct Knotvector;
|
||||
|
||||
/* constants for memory allocation of NURBS to Bezier conversion */
|
||||
#define MAXDIM 2
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* reader.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/reader.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
* $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/reader.h,v 1.2 2001/08/07 17:34:11 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __glureader_h_
|
||||
@@ -51,7 +51,7 @@ struct Property;
|
||||
struct O_surface;
|
||||
struct O_nurbssurface;
|
||||
struct O_trim;
|
||||
struct O_pwlcurve;
|
||||
class O_pwlcurve;
|
||||
struct O_nurbscurve;
|
||||
struct O_curve;
|
||||
class Quilt;
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* subdivider.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/subdivider.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
* $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/subdivider.h,v 1.2 2001/08/07 17:34:11 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __glusubdivider_h_
|
||||
@@ -56,7 +56,7 @@ class Renderhints;
|
||||
class Quilt;
|
||||
class Patchlist;
|
||||
class Curvelist;
|
||||
class JumpBuffer;
|
||||
struct JumpBuffer;
|
||||
|
||||
class Subdivider {
|
||||
public:
|
||||
|
@@ -35,14 +35,18 @@
|
||||
/*
|
||||
** Author: Eric Veach, July 1994.
|
||||
**
|
||||
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/memalloc.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
** $Date: 2001/07/20 11:20:32 $ $Revision: 1.2 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/memalloc.h,v 1.2 2001/07/20 11:20:32 joukj Exp $
|
||||
*/
|
||||
|
||||
#ifndef __memalloc_simple_h_
|
||||
#define __memalloc_simple_h_
|
||||
|
||||
#include <malloc.h>
|
||||
#ifdef __VMS
|
||||
# include <stdlib.h>
|
||||
#else
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
#define memRealloc realloc
|
||||
#define memFree free
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
** Author: Eric Veach, July 1994.
|
||||
**
|
||||
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/sweep.c,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
** $Date: 2001/09/20 21:47:52 $ $Revision: 1.2 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/sweep.c,v 1.2 2001/09/20 21:47:52 kschultz Exp $
|
||||
*/
|
||||
|
||||
#include "gluos.h"
|
||||
@@ -253,6 +253,7 @@ static GLboolean IsWindingInside( GLUtesselator *tess, int n )
|
||||
/*LINTED*/
|
||||
assert( FALSE );
|
||||
/*NOTREACHED*/
|
||||
return GL_FALSE; /* avoid compiler complaints */
|
||||
}
|
||||
|
||||
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
** Author: Eric Veach, July 1994.
|
||||
**
|
||||
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/tess.c,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
** $Date: 2001/09/20 21:47:52 $ $Revision: 1.2 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libtess/tess.c,v 1.2 2001/09/20 21:47:52 kschultz Exp $
|
||||
*/
|
||||
|
||||
#include "gluos.h"
|
||||
@@ -271,7 +271,7 @@ gluTessNormal( GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z )
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
gluTessCallback( GLUtesselator *tess, GLenum which, void (GLAPIENTRY *fn)())
|
||||
gluTessCallback( GLUtesselator *tess, GLenum which, _GLUfuncptr fn)
|
||||
{
|
||||
switch( which ) {
|
||||
case GLU_TESS_BEGIN:
|
||||
|
@@ -31,70 +31,70 @@
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/glue.c,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
** $Date: 2001/09/24 09:40:40 $ $Revision: 1.3 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/glue.c,v 1.3 2001/09/24 09:40:40 joukj Exp $
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "gluint.h"
|
||||
|
||||
static char *__gluNurbsErrors[] = {
|
||||
" ",
|
||||
"spline order un-supported",
|
||||
"too few knots",
|
||||
"valid knot range is empty",
|
||||
"decreasing knot sequence knot",
|
||||
"knot multiplicity greater than order of spline",
|
||||
"gluEndCurve() must follow gluBeginCurve()",
|
||||
"gluBeginCurve() must precede gluEndCurve()",
|
||||
"missing or extra geometric data",
|
||||
"can't draw piecewise linear trimming curves",
|
||||
"missing or extra domain data",
|
||||
"missing or extra domain data",
|
||||
"gluEndTrim() must precede gluEndSurface()",
|
||||
"gluBeginSurface() must precede gluEndSurface()",
|
||||
"curve of improper type passed as trim curve",
|
||||
"gluBeginSurface() must precede gluBeginTrim()",
|
||||
"gluEndTrim() must follow gluBeginTrim()",
|
||||
"gluBeginTrim() must precede gluEndTrim()",
|
||||
"invalid or missing trim curve",
|
||||
"gluBeginTrim() must precede gluPwlCurve()",
|
||||
"piecewise linear trimming curve referenced twice",
|
||||
"piecewise linear trimming curve and nurbs curve mixed",
|
||||
"improper usage of trim data type",
|
||||
"nurbs curve referenced twice",
|
||||
"nurbs curve and piecewise linear trimming curve mixed",
|
||||
"nurbs surface referenced twice",
|
||||
"invalid property",
|
||||
"gluEndSurface() must follow gluBeginSurface()",
|
||||
"intersecting or misoriented trim curves",
|
||||
"intersecting trim curves",
|
||||
"UNUSED",
|
||||
"unconnected trim curves",
|
||||
"unknown knot error",
|
||||
"negative vertex count encountered",
|
||||
"negative byte-stride encounteed",
|
||||
"unknown type descriptor",
|
||||
"null control point reference",
|
||||
"duplicate point on piecewise linear trimming curve",
|
||||
static unsigned char *__gluNurbsErrors[] = {
|
||||
(unsigned char*) " ",
|
||||
(unsigned char*) "spline order un-supported",
|
||||
(unsigned char*) "too few knots",
|
||||
(unsigned char*) "valid knot range is empty",
|
||||
(unsigned char*) "decreasing knot sequence knot",
|
||||
(unsigned char*) "knot multiplicity greater than order of spline",
|
||||
(unsigned char*) "gluEndCurve() must follow gluBeginCurve()",
|
||||
(unsigned char*) "gluBeginCurve() must precede gluEndCurve()",
|
||||
(unsigned char*) "missing or extra geometric data",
|
||||
(unsigned char*) "can't draw piecewise linear trimming curves",
|
||||
(unsigned char*) "missing or extra domain data",
|
||||
(unsigned char*) "missing or extra domain data",
|
||||
(unsigned char*) "gluEndTrim() must precede gluEndSurface()",
|
||||
(unsigned char*) "gluBeginSurface() must precede gluEndSurface()",
|
||||
(unsigned char*) "curve of improper type passed as trim curve",
|
||||
(unsigned char*) "gluBeginSurface() must precede gluBeginTrim()",
|
||||
(unsigned char*) "gluEndTrim() must follow gluBeginTrim()",
|
||||
(unsigned char*) "gluBeginTrim() must precede gluEndTrim()",
|
||||
(unsigned char*) "invalid or missing trim curve",
|
||||
(unsigned char*) "gluBeginTrim() must precede gluPwlCurve()",
|
||||
(unsigned char*) "piecewise linear trimming curve referenced twice",
|
||||
(unsigned char*) "piecewise linear trimming curve and nurbs curve mixed",
|
||||
(unsigned char*) "improper usage of trim data type",
|
||||
(unsigned char*) "nurbs curve referenced twice",
|
||||
(unsigned char*) "nurbs curve and piecewise linear trimming curve mixed",
|
||||
(unsigned char*) "nurbs surface referenced twice",
|
||||
(unsigned char*) "invalid property",
|
||||
(unsigned char*) "gluEndSurface() must follow gluBeginSurface()",
|
||||
(unsigned char*) "intersecting or misoriented trim curves",
|
||||
(unsigned char*) "intersecting trim curves",
|
||||
(unsigned char*) "UNUSED",
|
||||
(unsigned char*) "unconnected trim curves",
|
||||
(unsigned char*) "unknown knot error",
|
||||
(unsigned char*) "negative vertex count encountered",
|
||||
(unsigned char*) "negative byte-stride encounteed",
|
||||
(unsigned char*) "unknown type descriptor",
|
||||
(unsigned char*) "null control point reference",
|
||||
(unsigned char*) "duplicate point on piecewise linear trimming curve",
|
||||
};
|
||||
|
||||
const char *__gluNURBSErrorString( int errno )
|
||||
const unsigned char *__gluNURBSErrorString( int errnum )
|
||||
{
|
||||
return __gluNurbsErrors[errno];
|
||||
return __gluNurbsErrors[errnum];
|
||||
}
|
||||
|
||||
static char *__gluTessErrors[] = {
|
||||
" ",
|
||||
"gluTessBeginPolygon() must precede a gluTessEndPolygon()",
|
||||
"gluTessBeginContour() must precede a gluTessEndContour()",
|
||||
"gluTessEndPolygon() must follow a gluTessBeginPolygon()",
|
||||
"gluTessEndContour() must follow a gluTessBeginContour()",
|
||||
"a coordinate is too large",
|
||||
"need combine callback",
|
||||
static unsigned char *__gluTessErrors[] = {
|
||||
(unsigned char*) " ",
|
||||
(unsigned char*) "gluTessBeginPolygon() must precede a gluTessEndPolygon()",
|
||||
(unsigned char*) "gluTessBeginContour() must precede a gluTessEndContour()",
|
||||
(unsigned char*) "gluTessEndPolygon() must follow a gluTessBeginPolygon()",
|
||||
(unsigned char*) "gluTessEndContour() must follow a gluTessBeginContour()",
|
||||
(unsigned char*) "a coordinate is too large",
|
||||
(unsigned char*) "need combine callback",
|
||||
};
|
||||
|
||||
const char *__gluTessErrorString( int errno )
|
||||
const unsigned char *__gluTessErrorString( int errnum )
|
||||
{
|
||||
return __gluTessErrors[errno];
|
||||
return __gluTessErrors[errnum];
|
||||
} /* __glTessErrorString() */
|
||||
|
@@ -31,16 +31,16 @@
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/gluint.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
** $Date: 2001/09/20 21:50:53 $ $Revision: 1.2 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/gluint.h,v 1.2 2001/09/20 21:50:53 kschultz Exp $
|
||||
*/
|
||||
|
||||
#ifndef __gluint_h__
|
||||
#define __gluint_h__
|
||||
|
||||
extern const char *__gluNURBSErrorString( int errno );
|
||||
extern const unsigned char *__gluNURBSErrorString( int errnum );
|
||||
|
||||
extern const char *__gluTessErrorString( int errno );
|
||||
extern const unsigned char *__gluTessErrorString( int errnum );
|
||||
|
||||
#ifdef _EXTENSIONS_
|
||||
#define COS cosf
|
||||
|
@@ -31,8 +31,8 @@
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/mipmap.c,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
** $Date: 2001/08/07 17:34:11 $ $Revision: 1.2 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/mipmap.c,v 1.2 2001/08/07 17:34:11 brianp Exp $
|
||||
*/
|
||||
|
||||
#include "gluos.h"
|
||||
@@ -6567,6 +6567,65 @@ static void halve1DimagePackedPixel(int components,
|
||||
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifdef RESOLVE_3D_TEXTURE_SUPPORT
|
||||
/*
|
||||
* This section ensures that GLU 1.3 will load and run on
|
||||
* a GL 1.1 implementation. It dynamically resolves the
|
||||
* call to glTexImage3D() which might not be available.
|
||||
* Or is it might be supported as an extension.
|
||||
* Contributed by Gerk Huisma <gerk@five-d.demon.nl>.
|
||||
*/
|
||||
|
||||
typedef GLAPI void (GLAPIENTRY *TexImage3Dproc)( GLenum target, GLint level,
|
||||
GLenum internalFormat,
|
||||
GLsizei width, GLsizei height,
|
||||
GLsizei depth, GLint border,
|
||||
GLenum format, GLenum type,
|
||||
const GLvoid *pixels );
|
||||
|
||||
static TexImage3Dproc pTexImage3D;
|
||||
|
||||
#ifndef WIN32
|
||||
# include <dlfcn.h>
|
||||
# include <sys/types.h>
|
||||
#else
|
||||
WINGDIAPI PROC WINAPI wglGetProcAddress(LPCSTR);
|
||||
#endif
|
||||
|
||||
static void gluTexImage3D( GLenum target, GLint level,
|
||||
GLenum internalFormat,
|
||||
GLsizei width, GLsizei height,
|
||||
GLsizei depth, GLint border,
|
||||
GLenum format, GLenum type,
|
||||
const GLvoid *pixels )
|
||||
{
|
||||
if (!pTexImage3D) {
|
||||
#ifdef WIN32
|
||||
pTexImage3D = (TexImage3Dproc) wglGetProcAddress("glTexImage3D");
|
||||
if (!pTexImage3D)
|
||||
pTexImage3D = (TexImage3Dproc) wglGetProcAddress("glTexImage3DEXT");
|
||||
#else
|
||||
void *libHandle = dlopen("libgl.so", RTLD_LAZY);
|
||||
pTexImage3D = TexImage3Dproc) dlsym(libHandle, "glTexImage3D" );
|
||||
if (!pTexImage3D)
|
||||
pTexImage3D = (TexImage3Dproc) dlsym(libHandle,"glTexImage3DEXT");
|
||||
dlclose(libHandle);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Now call glTexImage3D */
|
||||
if (pTexImage3D)
|
||||
pTexImage3D(target, level, internalFormat, width, height,
|
||||
depth, border, format, type, pixels);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Only bind to a GL 1.2 implementation: */
|
||||
#define gluTexImage3D glTexImage3D
|
||||
|
||||
#endif
|
||||
|
||||
static GLint imageSize3D(GLint width, GLint height, GLint depth,
|
||||
GLenum format, GLenum type)
|
||||
{
|
||||
@@ -7330,7 +7389,7 @@ static void closestFit3D(GLenum target, GLint width, GLint height, GLint depth,
|
||||
/* does width x height x depth at level 1 & all their mipmaps fit? */
|
||||
if (target == GL_TEXTURE_3D || target == GL_PROXY_TEXTURE_3D) {
|
||||
proxyTarget = GL_PROXY_TEXTURE_3D;
|
||||
glTexImage3D(proxyTarget, 1, /* must be non-zero */
|
||||
gluTexImage3D(proxyTarget, 1, /* must be non-zero */
|
||||
internalFormat,
|
||||
widthAtLevelOne,heightAtLevelOne,depthAtLevelOne,
|
||||
0,format,type,NULL);
|
||||
@@ -7705,7 +7764,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat,
|
||||
if (width == newWidth && height == newHeight && depth == newDepth) {
|
||||
/* Use usersImage for level userLevel */
|
||||
if (baseLevel <= level && level <= maxLevel) {
|
||||
glTexImage3D(target, level, internalFormat, width,
|
||||
gluTexImage3D(target, level, internalFormat, width,
|
||||
height, depth, 0, format, type,
|
||||
usersImage);
|
||||
}
|
||||
@@ -8143,7 +8202,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat,
|
||||
|
||||
glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
|
||||
if (baseLevel <= level && level <= maxLevel) {
|
||||
glTexImage3D(target, level, internalFormat, newWidth, newHeight, newDepth,
|
||||
gluTexImage3D(target, level, internalFormat, newWidth, newHeight, newDepth,
|
||||
0,format, type, (void *)srcImage);
|
||||
}
|
||||
level++; /* update current level for the loop */
|
||||
@@ -8318,7 +8377,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat,
|
||||
{
|
||||
/* call tex image with srcImage untouched since it's not padded */
|
||||
if (baseLevel <= level && level <= maxLevel) {
|
||||
glTexImage3D(target, level, internalFormat, newWidth, newHeight,
|
||||
gluTexImage3D(target, level, internalFormat, newWidth, newHeight,
|
||||
newDepth,0, format, type, (void *) srcImage);
|
||||
}
|
||||
}
|
||||
|
@@ -31,8 +31,8 @@
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/project.c,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
** $Date: 2001/09/18 16:39:38 $ $Revision: 1.4 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/project.c,v 1.4 2001/09/18 16:39:38 kschultz Exp $
|
||||
*/
|
||||
|
||||
#include "gluos.h"
|
||||
@@ -331,7 +331,7 @@ gluUnProject4(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble clipw,
|
||||
const GLdouble modelMatrix[16],
|
||||
const GLdouble projMatrix[16],
|
||||
const GLint viewport[4],
|
||||
GLclampd near, GLclampd far,
|
||||
GLclampd nearVal, GLclampd farVal,
|
||||
GLdouble *objx, GLdouble *objy, GLdouble *objz,
|
||||
GLdouble *objw)
|
||||
{
|
||||
@@ -350,7 +350,7 @@ gluUnProject4(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble clipw,
|
||||
/* Map x and y from window coordinates */
|
||||
in[0] = (in[0] - viewport[0]) / viewport[2];
|
||||
in[1] = (in[1] - viewport[1]) / viewport[3];
|
||||
in[2] = (in[2] - near) / (far - near);
|
||||
in[2] = (in[2] - nearVal) / (farVal - nearVal);
|
||||
|
||||
/* Map to range -1 to 1 */
|
||||
in[0] = in[0] * 2 - 1;
|
||||
|
@@ -31,8 +31,8 @@
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/quad.c,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
** $Date: 2001/09/20 21:47:52 $ $Revision: 1.2 $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libutil/quad.c,v 1.2 2001/09/20 21:47:52 kschultz Exp $
|
||||
*/
|
||||
|
||||
#include "gluos.h"
|
||||
@@ -89,7 +89,7 @@ static void gluQuadricError(GLUquadric *qobj, GLenum which)
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
gluQuadricCallback(GLUquadric *qobj, GLenum which, void (GLAPIENTRY *fn)())
|
||||
gluQuadricCallback(GLUquadric *qobj, GLenum which, _GLUfuncptr fn)
|
||||
{
|
||||
switch (which) {
|
||||
case GLU_ERROR:
|
||||
|
@@ -1,95 +1,99 @@
|
||||
# Makefile for Win32
|
||||
|
||||
!include <win32.mak>
|
||||
|
||||
TOP = ../..
|
||||
|
||||
# NOTE: glut_menu.c and glut_glxext.c are NOT compiled into Win32 GLUT
|
||||
|
||||
SRCS = glut_8x13.c glut_9x15.c glut_bitmap.c glut_bwidth.c glut_cindex.c glut_cmap.c glut_cursor.c glut_dials.c glut_dstr.c glut_event.c glut_ext.c glut_fbc.c glut_fullscrn.c glut_gamemode.c glut_get.c glut_hel10.c glut_hel12.c glut_hel18.c glut_init.c glut_input.c glut_joy.c glut_key.c glut_keyctrl.c glut_keyup.c glut_mesa.c glut_modifier.c glut_mroman.c glut_overlay.c glut_roman.c glut_shapes.c glut_space.c glut_stroke.c glut_swap.c glut_swidth.c glut_tablet.c glut_teapot.c glut_tr10.c glut_tr24.c glut_util.c glut_vidresize.c glut_warp.c glut_win.c glut_winmisc.c win32_glx.c win32_menu.c win32_util.c win32_winproc.c win32_x11.c
|
||||
|
||||
all : glutdll install
|
||||
|
||||
!include "$(TOP)/glutwin32.mak"
|
||||
|
||||
glutdll : $(GLUTDLL)
|
||||
|
||||
!IFDEF NODEBUG
|
||||
OPTIMIZE_CFLAGS = -DNDEBUG
|
||||
!ENDIF
|
||||
|
||||
CFLAGS = $(cvarsdll) $(CFLAGS) $(OPTIMIZE_CFLAGS)
|
||||
LFLAGS = $(dlllflags) $(LFLAGS)
|
||||
|
||||
OBJS = $(SRCS:.c=.obj)
|
||||
MS_LIBS = $(MS_OPENGL) $(MS_GLU) winmm.lib $(guilibsdll)
|
||||
SGI_LIBS = $(SGI_OPENGL) $(SGI_GLU) winmm.lib $(guilibsdll)
|
||||
|
||||
glut32.dll : $(OBJS) glut.def
|
||||
$(link) $(LFLAGS) -out:glut32.dll -def:glut.def $(OBJS) $(MS_LIBS)
|
||||
|
||||
glut.dll : $(OBJS) glut.def
|
||||
$(link) $(LFLAGS) -out:glut.dll -def:glut.def $(OBJS) $(SGI_LIBS)
|
||||
|
||||
install : $(GLUTDLL)
|
||||
@echo "copying GLUT dynamic link library to system directory..."
|
||||
-copy $(GLUTDLL) $(DLLINSTALL)
|
||||
@echo "copying GLUT header file to include directory..."
|
||||
-copy ..\..\include\GL\glut.h $(INCLUDEINSTALL)
|
||||
@echo "copying GLUT import library to library directory..."
|
||||
-copy $(GLUTLIB) $(LIBINSTALL)
|
||||
|
||||
.c.obj :
|
||||
$(cc) $(CFLAGS) -I . $*.c
|
||||
|
||||
# explicit object dependencies for all source files
|
||||
|
||||
win32_glx.obj: win32_glx.c win32_glx.h
|
||||
win32_x11.obj: win32_x11.c win32_x11.h
|
||||
win32_menu.obj: win32_menu.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h
|
||||
win32_util.obj: win32_util.c glutint.h ..\..\include\GL\glutf90.h
|
||||
win32_winproc.obj: win32_winproc.c glutint.h ..\..\include\GL\glutf90.h
|
||||
|
||||
glut_mroman.obj: glut_mroman.c glutstroke.h glutint.h ..\..\include\GL\glutf90.h
|
||||
glut_roman.obj: glut_roman.c glutstroke.h glutint.h ..\..\include\GL\glutf90.h
|
||||
glut_hel12.obj: glut_hel12.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h
|
||||
glut_8x13.obj: glut_8x13.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h
|
||||
glut_hel18.obj: glut_hel18.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h
|
||||
glut_9x15.obj: glut_9x15.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h
|
||||
glut_tr10.obj: glut_tr10.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h
|
||||
glut_hel10.obj: glut_hel10.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h
|
||||
glut_tr24.obj: glut_tr24.c glutbitmap.h glutint.h ..\..\include\GL\glutf90.h
|
||||
|
||||
glut_bitmap.obj: glut_bitmap.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_bwidth.obj: glut_bwidth.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_cindex.obj: glut_cindex.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_cmap.obj: glut_cmap.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_cursor.obj: glut_cursor.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_dials.obj: glut_dials.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_dstr.obj: glut_dstr.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_event.obj: glut_event.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_ext.obj: glut_ext.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_fullscrn.obj: glut_fullscrn.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_gamemode.obj: glut_gamemode.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_get.obj: glut_get.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_init.obj: glut_init.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_input.obj: glut_input.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_joy.obj: glut_joy.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_key.obj: glut_key.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_keyctrl.obj: glut_keyctrl.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_keyup.obj: glut_keyup.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_mesa.obj: glut_mesa.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_modifier.obj: glut_modifier.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_overlay.obj: glut_overlay.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_shapes.obj: glut_shapes.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_space.obj: glut_space.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_swap.obj: glut_swap.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_swidth.obj: glut_swidth.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_tablet.obj: glut_tablet.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_teapot.obj: glut_teapot.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_util.obj: glut_util.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_vidresize.obj: glut_vidresize.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_warp.obj: glut_warp.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_win.obj: glut_win.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h
|
||||
glut_winmisc.obj: glut_winmisc.c glutint.h ..\..\include\GL\glutf90.h ..\..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
|
||||
# Makefile for Win32
|
||||
|
||||
!include <win32.mak>
|
||||
|
||||
TOP = ..
|
||||
|
||||
# NOTE: glut_menu.c and glut_glxext.c are NOT compiled into Win32 GLUT
|
||||
|
||||
SRCS = glut_8x13.c glut_9x15.c glut_bitmap.c glut_bwidth.c glut_cindex.c glut_cmap.c glut_cursor.c glut_dials.c glut_dstr.c glut_event.c glut_ext.c glut_fbc.c glut_fullscrn.c glut_gamemode.c glut_get.c glut_hel10.c glut_hel12.c glut_hel18.c glut_init.c glut_input.c glut_joy.c glut_key.c glut_keyctrl.c glut_keyup.c glut_mesa.c glut_modifier.c glut_mroman.c glut_overlay.c glut_roman.c glut_shapes.c glut_space.c glut_stroke.c glut_swap.c glut_swidth.c glut_tablet.c glut_teapot.c glut_tr10.c glut_tr24.c glut_util.c glut_vidresize.c glut_warp.c glut_win.c glut_winmisc.c win32_glx.c win32_menu.c win32_util.c win32_winproc.c win32_x11.c
|
||||
|
||||
all : glutdll
|
||||
|
||||
!include "$(TOP)/mesawin32.mak"
|
||||
|
||||
glutdll : $(GLUTDLL)
|
||||
|
||||
!IFDEF NODEBUG
|
||||
OPTIMIZE_CFLAGS = -DNDEBUG
|
||||
!ENDIF
|
||||
|
||||
CFLAGS = $(cvarsdll) $(CFLAGS) $(OPTIMIZE_CFLAGS) -DMESA -DBUILD_GL32
|
||||
LFLAGS = $(dlllflags) $(lcommon) $(LFLAGS)
|
||||
|
||||
OBJS = $(SRCS:.c=.obj)
|
||||
MS_LIBS = ../lib/$(MESALIB) ../lib/$(GLULIB) winmm.lib $(guilibsdll)
|
||||
SGI_LIBS = $(SGI_OPENGL) $(SGI_GLU) winmm.lib $(guilibsdll)
|
||||
|
||||
glut32.dll : $(OBJS) glut.def
|
||||
$(link) $(LFLAGS) -out:glut32.dll -def:glut.def $(OBJS) $(MS_LIBS)
|
||||
@echo "copying GLUT dynamic link library to lib directory..."
|
||||
-copy $(GLUTDLL) ..\lib
|
||||
@echo "copying GLUT import library to lib directory..."
|
||||
-copy $(GLUTLIB) ..\lib
|
||||
|
||||
glut.dll : $(OBJS) glut.def
|
||||
$(link) $(LFLAGS) -out:glut.dll -def:glut.def $(OBJS) $(SGI_LIBS)
|
||||
|
||||
install : $(GLUTDLL)
|
||||
@echo "copying GLUT dynamic link library to system directory..."
|
||||
-copy $(GLUTDLL) $(DLLINSTALL)
|
||||
@echo "copying GLUT header file to include directory..."
|
||||
-copy ..\include\GL\glut.h $(INCLUDEINSTALL)
|
||||
@echo "copying GLUT import library to library directory..."
|
||||
-copy $(GLUTLIB) $(LIBINSTALL)
|
||||
|
||||
.c.obj :
|
||||
$(cc) $(CFLAGS) -I . $*.c
|
||||
|
||||
# explicit object dependencies for all source files
|
||||
|
||||
win32_glx.obj: win32_glx.c win32_glx.h
|
||||
win32_x11.obj: win32_x11.c win32_x11.h
|
||||
win32_menu.obj: win32_menu.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h
|
||||
win32_util.obj: win32_util.c glutint.h ..\include\GL\glutf90.h
|
||||
win32_winproc.obj: win32_winproc.c glutint.h ..\include\GL\glutf90.h
|
||||
|
||||
glut_mroman.obj: glut_mroman.c glutstroke.h glutint.h ..\include\GL\glutf90.h
|
||||
glut_roman.obj: glut_roman.c glutstroke.h glutint.h ..\include\GL\glutf90.h
|
||||
glut_hel12.obj: glut_hel12.c glutbitmap.h glutint.h ..\include\GL\glutf90.h
|
||||
glut_8x13.obj: glut_8x13.c glutbitmap.h glutint.h ..\include\GL\glutf90.h
|
||||
glut_hel18.obj: glut_hel18.c glutbitmap.h glutint.h ..\include\GL\glutf90.h
|
||||
glut_9x15.obj: glut_9x15.c glutbitmap.h glutint.h ..\include\GL\glutf90.h
|
||||
glut_tr10.obj: glut_tr10.c glutbitmap.h glutint.h ..\include\GL\glutf90.h
|
||||
glut_hel10.obj: glut_hel10.c glutbitmap.h glutint.h ..\include\GL\glutf90.h
|
||||
glut_tr24.obj: glut_tr24.c glutbitmap.h glutint.h ..\include\GL\glutf90.h
|
||||
|
||||
glut_bitmap.obj: glut_bitmap.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_bwidth.obj: glut_bwidth.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_cindex.obj: glut_cindex.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_cmap.obj: glut_cmap.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_cursor.obj: glut_cursor.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_dials.obj: glut_dials.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_dstr.obj: glut_dstr.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_event.obj: glut_event.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_ext.obj: glut_ext.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_fullscrn.obj: glut_fullscrn.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_gamemode.obj: glut_gamemode.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_get.obj: glut_get.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_init.obj: glut_init.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_input.obj: glut_input.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_joy.obj: glut_joy.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_key.obj: glut_key.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_keyctrl.obj: glut_keyctrl.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_keyup.obj: glut_keyup.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_mesa.obj: glut_mesa.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_modifier.obj: glut_modifier.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_overlay.obj: glut_overlay.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_shapes.obj: glut_shapes.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_space.obj: glut_space.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_swap.obj: glut_swap.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_swidth.obj: glut_swidth.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_tablet.obj: glut_tablet.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_teapot.obj: glut_teapot.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_util.obj: glut_util.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_vidresize.obj: glut_vidresize.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_warp.obj: glut_warp.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
glut_win.obj: glut_win.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h
|
||||
glut_winmisc.obj: glut_winmisc.c glutint.h ..\include\GL\glutf90.h ..\include\GL\glut.h glutwin32.h win32_glx.h win32_x11.h
|
||||
|
||||
|
126
src/glut/glx/glut.def
Normal file
126
src/glut/glx/glut.def
Normal file
@@ -0,0 +1,126 @@
|
||||
DESCRIPTION 'OpenGL Utility Toolkit for Win32'
|
||||
|
||||
VERSION 3.7
|
||||
|
||||
EXPORTS
|
||||
|
||||
glutAddMenuEntry
|
||||
glutAddSubMenu
|
||||
glutAttachMenu
|
||||
glutBitmapCharacter
|
||||
glutBitmapLength
|
||||
glutBitmapWidth
|
||||
glutButtonBoxFunc
|
||||
glutChangeToMenuEntry
|
||||
glutChangeToSubMenu
|
||||
glutCopyColormap
|
||||
glutCreateMenu
|
||||
__glutCreateMenuWithExit
|
||||
glutCreateSubWindow
|
||||
glutCreateWindow
|
||||
__glutCreateWindowWithExit
|
||||
glutDestroyMenu
|
||||
glutDestroyWindow
|
||||
glutDetachMenu
|
||||
glutDeviceGet
|
||||
glutDialsFunc
|
||||
glutDisplayFunc
|
||||
glutEnterGameMode
|
||||
glutEntryFunc
|
||||
glutEstablishOverlay
|
||||
glutExtensionSupported
|
||||
glutForceJoystickFunc
|
||||
glutFullScreen
|
||||
glutGameModeGet
|
||||
glutGameModeString
|
||||
glutGet
|
||||
glutGetColor
|
||||
glutGetMenu
|
||||
glutGetModifiers
|
||||
glutGetWindow
|
||||
glutHideOverlay
|
||||
glutHideWindow
|
||||
glutIconifyWindow
|
||||
glutIdleFunc
|
||||
glutIgnoreKeyRepeat
|
||||
glutInit
|
||||
__glutInitWithExit
|
||||
glutInitDisplayMode
|
||||
glutInitDisplayString
|
||||
glutInitWindowPosition
|
||||
glutInitWindowSize
|
||||
glutJoystickFunc
|
||||
glutKeyboardFunc
|
||||
glutKeyboardUpFunc
|
||||
glutLayerGet
|
||||
glutLeaveGameMode
|
||||
glutMainLoop
|
||||
glutMenuStateFunc
|
||||
glutMenuStatusFunc
|
||||
glutMotionFunc
|
||||
glutMouseFunc
|
||||
glutOverlayDisplayFunc
|
||||
glutPassiveMotionFunc
|
||||
glutPopWindow
|
||||
glutPositionWindow
|
||||
glutPostOverlayRedisplay
|
||||
glutPostRedisplay
|
||||
glutPostWindowOverlayRedisplay
|
||||
glutPostWindowRedisplay
|
||||
glutPushWindow
|
||||
glutRemoveMenuItem
|
||||
glutRemoveOverlay
|
||||
glutReportErrors
|
||||
glutReshapeFunc
|
||||
glutReshapeWindow
|
||||
glutSetColor
|
||||
glutSetCursor
|
||||
glutSetIconTitle
|
||||
glutSetKeyRepeat
|
||||
glutSetMenu
|
||||
glutSetWindow
|
||||
glutSetWindowTitle
|
||||
glutSetupVideoResizing
|
||||
glutShowOverlay
|
||||
glutShowWindow
|
||||
glutSolidCone
|
||||
glutSolidCube
|
||||
glutSolidDodecahedron
|
||||
glutSolidIcosahedron
|
||||
glutSolidOctahedron
|
||||
glutSolidSphere
|
||||
glutSolidTeapot
|
||||
glutSolidTetrahedron
|
||||
glutSolidTorus
|
||||
glutSpaceballButtonFunc
|
||||
glutSpaceballMotionFunc
|
||||
glutSpaceballRotateFunc
|
||||
glutSpecialFunc
|
||||
glutSpecialUpFunc
|
||||
glutStopVideoResizing
|
||||
glutStrokeCharacter
|
||||
glutStrokeLength
|
||||
glutStrokeWidth
|
||||
glutSwapBuffers
|
||||
glutTabletButtonFunc
|
||||
glutTabletMotionFunc
|
||||
glutTimerFunc
|
||||
glutUseLayer
|
||||
glutVideoPan
|
||||
glutVideoResize
|
||||
glutVideoResizeGet
|
||||
glutVisibilityFunc
|
||||
glutWarpPointer
|
||||
glutWindowStatusFunc
|
||||
glutWireCone
|
||||
glutWireCube
|
||||
glutWireDodecahedron
|
||||
glutWireIcosahedron
|
||||
glutWireOctahedron
|
||||
glutWireSphere
|
||||
glutWireTeapot
|
||||
glutWireTetrahedron
|
||||
glutWireTorus
|
||||
; __glutSetFCB
|
||||
; __glutGetFCB
|
||||
|
@@ -1548,7 +1548,7 @@ main(int argc, char **argv)
|
||||
while (!feof(stdin)) {
|
||||
if (tty)
|
||||
printf("dstr> ");
|
||||
str = gets(buffer);
|
||||
str = fgets(buffer, 1023, stdin);
|
||||
if (str) {
|
||||
printf("\n");
|
||||
if (!strcmp("v", str)) {
|
||||
|
@@ -10,6 +10,13 @@
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
|
||||
/* These definitions are missing from windows.h */
|
||||
WINGDIAPI int WINAPI wglChoosePixelFormat(HDC, PIXELFORMATDESCRIPTOR *);
|
||||
WINGDIAPI int WINAPI wglDescribePixelFormat(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
|
||||
WINGDIAPI int WINAPI wglGetPixelFormat(HDC);
|
||||
WINGDIAPI BOOL WINAPI wglSetPixelFormat(HDC, int, PIXELFORMATDESCRIPTOR *);
|
||||
WINGDIAPI BOOL WINAPI wglSwapBuffers(HDC);
|
||||
|
||||
/* Type definitions (conversions) */
|
||||
typedef int Visual; /* Win32 equivalent of X11 type */
|
||||
typedef HWND Window;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# $Id: Makefile.X11,v 1.54 2001/06/18 17:26:08 brianp Exp $
|
||||
# $Id: Makefile.X11,v 1.58 2001/09/23 16:11:26 brianp Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.5
|
||||
# Version: 4.0
|
||||
# Copyright (C) 1995-2001 Brian Paul
|
||||
|
||||
# Makefile for core library
|
||||
@@ -10,7 +10,7 @@
|
||||
##### MACROS #####
|
||||
|
||||
GL_MAJOR = 1
|
||||
GL_MINOR = 2
|
||||
GL_MINOR = 3
|
||||
GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
|
||||
|
||||
VPATH = RCS
|
||||
@@ -21,6 +21,9 @@ LIBDIR = ../lib
|
||||
|
||||
|
||||
CORE_SOURCES = \
|
||||
swrast_setup/ss_context.c \
|
||||
swrast_setup/ss_triangle.c \
|
||||
swrast_setup/ss_vb.c \
|
||||
api_arrayelt.c \
|
||||
api_loopback.c \
|
||||
api_noop.c \
|
||||
@@ -118,10 +121,6 @@ CORE_SOURCES = \
|
||||
swrast/s_texstore.c \
|
||||
swrast/s_triangle.c \
|
||||
swrast/s_zoom.c \
|
||||
swrast_setup/ss_context.c \
|
||||
swrast_setup/ss_triangle.c \
|
||||
swrast_setup/ss_vb.c \
|
||||
swrast_setup/ss_interp.c \
|
||||
tnl/t_array_api.c \
|
||||
tnl/t_array_import.c \
|
||||
tnl/t_context.c \
|
||||
@@ -308,7 +307,7 @@ Trace/tr_wrapper.o: Trace/tr_wrapper.c
|
||||
# @echo "Specify a target configuration"
|
||||
|
||||
clean:
|
||||
-rm *.o *~ */*.o */*~ *.lo *.la
|
||||
-rm -f *.o *~ */*.o */*~ *.lo *.la
|
||||
-rm -rf .libs
|
||||
|
||||
targets: $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(OSMESA_LIB)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: ac_context.c,v 1.4 2001/04/28 08:39:18 keithw Exp $ */
|
||||
/* $Id: ac_context.c,v 1.5 2001/07/19 15:54:35 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -263,6 +263,10 @@ void _ac_DestroyContext( GLcontext *ctx )
|
||||
}
|
||||
|
||||
if (ac->Elts) FREE( ac->Elts );
|
||||
|
||||
/* Free the context structure itself */
|
||||
FREE(ac);
|
||||
ctx->acache_context = NULL;
|
||||
}
|
||||
|
||||
void _ac_InvalidateState( GLcontext *ctx, GLuint new_state )
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: t_dd_tritmp.h,v 1.11 2001/06/01 12:07:15 keithw Exp $ */
|
||||
/* $Id: t_dd_tritmp.h,v 1.12 2001/07/17 19:39:32 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -177,9 +177,9 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
|
||||
}
|
||||
}
|
||||
else {
|
||||
GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->Ptr;
|
||||
ASSERT(VB->ColorPtr[1]->Type == GL_FLOAT);
|
||||
ASSERT(VB->ColorPtr[1]->StrideB == 4*sizeof(GLfloat));
|
||||
GLchan (*vbcolor)[4] = VB->ColorPtr[1]->Ptr;
|
||||
ASSERT(VB->ColorPtr[1]->Type == CHAN_TYPE);
|
||||
ASSERT(VB->ColorPtr[1]->StrideB == 4*sizeof(GLchan));
|
||||
(void) vbcolor;
|
||||
|
||||
if (!DO_FLAT) {
|
||||
@@ -192,7 +192,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
|
||||
VERT_SET_RGBA( v[2], vbcolor[e2] );
|
||||
|
||||
if (HAVE_SPEC && VB->SecondaryColorPtr[1]) {
|
||||
GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->Ptr;
|
||||
GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->Ptr;
|
||||
|
||||
if (!DO_FLAT) {
|
||||
VERT_SAVE_SPEC( 0 );
|
||||
@@ -385,7 +385,7 @@ static void TAG(quad)( GLcontext *ctx,
|
||||
if (DO_TWOSIDE && facing == 1)
|
||||
{
|
||||
if (HAVE_RGBA) {
|
||||
GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->Ptr;
|
||||
GLchan (*vbcolor)[4] = VB->ColorPtr[1]->Ptr;
|
||||
(void)vbcolor;
|
||||
|
||||
if (HAVE_BACK_COLORS) {
|
||||
@@ -426,7 +426,7 @@ static void TAG(quad)( GLcontext *ctx,
|
||||
|
||||
if (HAVE_SPEC && VB->SecondaryColorPtr[1]) {
|
||||
GLchan (*vbspec)[4] = VB->SecondaryColorPtr[1]->Ptr;
|
||||
ASSERT(VB->SecondaryColorPtr[1]->StrideB==4*sizeof(GLfloat));
|
||||
ASSERT(VB->SecondaryColorPtr[1]->StrideB==4*sizeof(GLchan));
|
||||
|
||||
if (!DO_FLAT) {
|
||||
VERT_SAVE_SPEC( 0 );
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: t_dd_vertex.h,v 1.8 2001/03/20 18:33:41 gareth Exp $ */
|
||||
/* $Id: t_dd_vertex.h,v 1.9 2001/09/23 15:19:16 keithw Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -76,19 +76,8 @@ typedef union {
|
||||
} TAG(Vertex), *TAG(VertexPtr);
|
||||
|
||||
typedef struct {
|
||||
GLfloat obj[4];
|
||||
GLfloat normal[4];
|
||||
|
||||
GLfloat clip[4];
|
||||
GLuint mask;
|
||||
|
||||
GLubyte color[4];
|
||||
GLubyte specular[4];
|
||||
GLuint __padding0;
|
||||
|
||||
GLfloat win[4];
|
||||
GLfloat eye[4];
|
||||
|
||||
GLfloat texture[MAX_TEXTURE_UNITS][4];
|
||||
GLuint __padding1[8]; /* FIXME: This is kinda evil... */
|
||||
GLuint pad; /* alignment */
|
||||
TAG(Vertex) v;
|
||||
} TAG(TnlVertex), *TAG(TnlVertexPtr);
|
||||
|
1
src/mesa/drivers/ggi/default/.cvsignore
Normal file
1
src/mesa/drivers/ggi/default/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
genkgi.conf
|
1
src/mesa/drivers/ggi/display/.cvsignore
Normal file
1
src/mesa/drivers/ggi/display/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
fbdev.conf
|
@@ -1,10 +1,10 @@
|
||||
/* -*- mode: C; tab-width:8; -*- */
|
||||
/* $Id: fxapi.c,v 1.32 2001/09/23 16:50:01 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 4.0
|
||||
*
|
||||
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2001 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"),
|
||||
@@ -22,26 +22,18 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
|
||||
* terms stated above.
|
||||
*
|
||||
* Thank you for your contribution, David!
|
||||
*
|
||||
* Please make note of the above copyright/license statement. If you
|
||||
* contributed code or bug fixes to this code under the previous (GNU
|
||||
* Library) license and object to the new license, your code will be
|
||||
* removed at your request. Please see the Mesa docs/COPYRIGHT file
|
||||
* for more information.
|
||||
*
|
||||
* Additional Mesa/3Dfx driver developers:
|
||||
* Daryll Strauss <daryll@precisioninsight.com>
|
||||
* Keith Whitwell <keith@precisioninsight.com>
|
||||
*
|
||||
* See fxapi.h for more revision/author details.
|
||||
*/
|
||||
|
||||
/* Authors:
|
||||
* David Bucciarelli
|
||||
* Brian Paul
|
||||
* Daryll Strauss
|
||||
* Keith Whitwell
|
||||
*/
|
||||
|
||||
|
||||
/* fxapi.c - public interface to FX/Mesa functions (fxmesa.h) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "conf.h"
|
||||
|
@@ -1,9 +1,10 @@
|
||||
/* $Id: fxdd.c,v 1.84 2001/09/23 16:50:01 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 4.0
|
||||
*
|
||||
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2001 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"),
|
||||
@@ -21,26 +22,14 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
|
||||
* terms stated above.
|
||||
*
|
||||
* Thank you for your contribution, David!
|
||||
*
|
||||
* Please make note of the above copyright/license statement. If you
|
||||
* contributed code or bug fixes to this code under the previous (GNU
|
||||
* Library) license and object to the new license, your code will be
|
||||
* removed at your request. Please see the Mesa docs/COPYRIGHT file
|
||||
* for more information.
|
||||
*
|
||||
* Additional Mesa/3Dfx driver developers:
|
||||
* Daryll Strauss <daryll@precisioninsight.com>
|
||||
* Keith Whitwell <keith@precisioninsight.com>
|
||||
*
|
||||
* See fxapi.h for more revision/author details.
|
||||
*/
|
||||
|
||||
/* Authors:
|
||||
* David Bucciarelli
|
||||
* Brian Paul
|
||||
* Daryll Strauss
|
||||
* Keith Whitwell
|
||||
*/
|
||||
|
||||
/* fxdd.c - 3Dfx VooDoo Mesa device driver functions */
|
||||
|
||||
@@ -657,28 +646,16 @@ int
|
||||
fxDDInitFxMesaContext(fxMesaContext fxMesa)
|
||||
{
|
||||
int i;
|
||||
static int firsttime = 1;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
gl_ubyte_to_float_255_color_tab[i] = (float) i;
|
||||
}
|
||||
|
||||
if (firsttime) {
|
||||
fxDDSetupInit();
|
||||
fxDDTrifuncInit();
|
||||
firsttime = 0;
|
||||
}
|
||||
|
||||
FX_setupGrVertexLayout();
|
||||
|
||||
if (getenv("FX_EMULATE_SINGLE_TMU"))
|
||||
fxMesa->haveTwoTMUs = GL_FALSE;
|
||||
|
||||
fxMesa->emulateTwoTMUs = fxMesa->haveTwoTMUs;
|
||||
|
||||
if (!getenv("FX_DONT_FAKE_MULTITEX"))
|
||||
fxMesa->emulateTwoTMUs = GL_TRUE;
|
||||
|
||||
if (getenv("FX_GLIDE_SWAPINTERVAL"))
|
||||
fxMesa->swapInterval = atoi(getenv("FX_GLIDE_SWAPINTERVAL"));
|
||||
else
|
||||
@@ -754,7 +731,7 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
|
||||
|
||||
fxMesa->textureAlign = FX_grGetInteger(FX_TEXTURE_ALIGN);
|
||||
fxMesa->glCtx->Const.MaxTextureLevels = 9;
|
||||
fxMesa->glCtx->Const.MaxTextureUnits = fxMesa->emulateTwoTMUs ? 2 : 1;
|
||||
fxMesa->glCtx->Const.MaxTextureUnits = fxMesa->haveTwoTMUs ? 2 : 1;
|
||||
fxMesa->new_state = _NEW_ALL;
|
||||
|
||||
/* Initialize the software rasterizer and helper modules.
|
||||
@@ -770,6 +747,7 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
|
||||
fxAllocVB(fxMesa->glCtx);
|
||||
|
||||
fxSetupDDPointers(fxMesa->glCtx);
|
||||
fxDDInitTriFuncs(fxMesa->glCtx);
|
||||
|
||||
/* Tell the software rasterizer to use pixel fog always.
|
||||
*/
|
||||
@@ -783,10 +761,6 @@ fxDDInitFxMesaContext(fxMesaContext fxMesa)
|
||||
|
||||
fxDDInitExtensions(fxMesa->glCtx);
|
||||
|
||||
#ifdef FXVTXFMT
|
||||
fxDDInitVtxfmt(fxMesa->glCtx);
|
||||
#endif
|
||||
|
||||
FX_grGlideGetState((GrState *) fxMesa->state);
|
||||
|
||||
/* Run the config file */
|
||||
@@ -830,7 +804,7 @@ fxDDInitExtensions(GLcontext * ctx)
|
||||
if (fxMesa->haveTwoTMUs)
|
||||
_mesa_enable_extension(ctx, "GL_EXT_texture_env_add");
|
||||
|
||||
if (fxMesa->emulateTwoTMUs)
|
||||
if (fxMesa->haveTwoTMUs)
|
||||
_mesa_enable_extension(ctx, "GL_ARB_multitexture");
|
||||
}
|
||||
|
||||
@@ -843,8 +817,8 @@ fxDDInitExtensions(GLcontext * ctx)
|
||||
*
|
||||
* Performs similar work to fxDDChooseRenderState() - should be merged.
|
||||
*/
|
||||
static GLboolean
|
||||
fxIsInHardware(GLcontext * ctx)
|
||||
GLboolean
|
||||
fx_check_IsInHardware(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
|
||||
@@ -868,7 +842,7 @@ fxIsInHardware(GLcontext * ctx)
|
||||
}
|
||||
/* Unsupported texture/multitexture cases */
|
||||
|
||||
if (fxMesa->emulateTwoTMUs) {
|
||||
if (fxMesa->haveTwoTMUs) {
|
||||
if (ctx->Texture._ReallyEnabled & (TEXTURE0_3D | TEXTURE1_3D))
|
||||
return GL_FALSE; /* can't do 3D textures */
|
||||
if (ctx->Texture._ReallyEnabled & (TEXTURE0_1D | TEXTURE1_1D))
|
||||
@@ -939,6 +913,8 @@ fxIsInHardware(GLcontext * ctx)
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
update_texture_scales(GLcontext * ctx)
|
||||
{
|
||||
@@ -964,7 +940,7 @@ update_texture_scales(GLcontext * ctx)
|
||||
static void
|
||||
fxDDUpdateDDPointers(GLcontext * ctx, GLuint new_state)
|
||||
{
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
/* TNLcontext *tnl = TNL_CONTEXT(ctx);*/
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
|
||||
_swrast_InvalidateState(ctx, new_state);
|
||||
@@ -980,72 +956,29 @@ fxDDUpdateDDPointers(GLcontext * ctx, GLuint new_state)
|
||||
|
||||
if (new_state & (_FX_NEW_IS_IN_HARDWARE |
|
||||
_FX_NEW_RENDERSTATE |
|
||||
_FX_NEW_SETUP_FUNCTION | _NEW_TEXTURE)) {
|
||||
_FX_NEW_SETUP_FUNCTION |
|
||||
_NEW_TEXTURE)) {
|
||||
|
||||
if (new_state & _FX_NEW_IS_IN_HARDWARE)
|
||||
fxMesa->is_in_hardware = fxIsInHardware(ctx);
|
||||
fxCheckIsInHardware(ctx);
|
||||
|
||||
if (fxMesa->new_state)
|
||||
fxSetupFXUnits(ctx);
|
||||
|
||||
if (new_state & _FX_NEW_RENDERSTATE)
|
||||
fxDDChooseRenderState(ctx);
|
||||
if (fxMesa->is_in_hardware) {
|
||||
if (new_state & _FX_NEW_RENDERSTATE)
|
||||
fxDDChooseRenderState(ctx);
|
||||
|
||||
if (new_state & _FX_NEW_SETUP_FUNCTION)
|
||||
tnl->Driver.BuildProjectedVertices = fx_validate_BuildProjVerts;
|
||||
if (new_state & _FX_NEW_SETUP_FUNCTION)
|
||||
fxChooseVertexState(ctx);
|
||||
}
|
||||
|
||||
if (new_state & _NEW_TEXTURE)
|
||||
update_texture_scales(ctx);
|
||||
|
||||
}
|
||||
|
||||
#ifdef FXVTXFMT
|
||||
if (fxMesa->allow_vfmt) {
|
||||
if (new_state & _NEW_LIGHT)
|
||||
fx_update_lighting(ctx);
|
||||
|
||||
if (new_state & _FX_NEW_VTXFMT)
|
||||
fxDDCheckVtxfmt(ctx);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
fxDDRenderPrimitive(GLcontext * ctx, GLenum mode)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
|
||||
if (!fxMesa->is_in_hardware) {
|
||||
_swsetup_RenderPrimitive(ctx, mode);
|
||||
}
|
||||
else {
|
||||
fxMesa->render_prim = mode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fxDDRenderStart(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
|
||||
_swsetup_RenderStart(ctx);
|
||||
|
||||
if (fxMesa->new_state) {
|
||||
fxSetupFXUnits(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fxDDRenderFinish(GLcontext * ctx)
|
||||
{
|
||||
fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx;
|
||||
|
||||
if (!fxMesa->is_in_hardware) {
|
||||
_swsetup_RenderFinish(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
@@ -1107,14 +1040,6 @@ fxSetupDDPointers(GLcontext * ctx)
|
||||
ctx->Driver.Enable = fxDDEnable;
|
||||
|
||||
tnl->Driver.RunPipeline = _tnl_run_pipeline;
|
||||
tnl->Driver.RenderStart = fxDDRenderStart;
|
||||
tnl->Driver.RenderFinish = fxDDRenderFinish;
|
||||
tnl->Driver.ResetLineStipple = _swrast_ResetLineStipple;
|
||||
tnl->Driver.RenderPrimitive = fxDDRenderPrimitive;
|
||||
tnl->Driver.RenderInterp = _swsetup_RenderInterp;
|
||||
tnl->Driver.RenderCopyPV = _swsetup_RenderCopyPV;
|
||||
tnl->Driver.RenderClippedLine = _swsetup_RenderClippedLine;
|
||||
tnl->Driver.RenderClippedPolygon = _swsetup_RenderClippedPolygon;
|
||||
|
||||
fxSetupDDSpanPointers(ctx);
|
||||
fxDDUpdateDDPointers(ctx, ~0);
|
||||
|
@@ -1,9 +1,10 @@
|
||||
/* $Id: fxddspan.c,v 1.19 2001/09/23 16:50:01 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 4.0
|
||||
*
|
||||
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2001 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"),
|
||||
@@ -21,24 +22,13 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
|
||||
* terms stated above.
|
||||
*
|
||||
* Thank you for your contribution, David!
|
||||
*
|
||||
* Please make note of the above copyright/license statement. If you
|
||||
* contributed code or bug fixes to this code under the previous (GNU
|
||||
* Library) license and object to the new license, your code will be
|
||||
* removed at your request. Please see the Mesa docs/COPYRIGHT file
|
||||
* for more information.
|
||||
*
|
||||
* Additional Mesa/3Dfx driver developers:
|
||||
* Daryll Strauss <daryll@precisioninsight.com>
|
||||
* Keith Whitwell <keith@precisioninsight.com>
|
||||
*
|
||||
* See fxapi.h for more revision/author details.
|
||||
*/
|
||||
|
||||
/* Authors:
|
||||
* David Bucciarelli
|
||||
* Brian Paul
|
||||
* Daryll Strauss
|
||||
* Keith Whitwell
|
||||
*/
|
||||
|
||||
|
||||
|
@@ -1,7 +1,8 @@
|
||||
/* $Id: fxddtex.c,v 1.45 2001/09/23 16:50:01 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
* Version: 4.0
|
||||
*
|
||||
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -21,24 +22,13 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
|
||||
* terms stated above.
|
||||
*
|
||||
* Thank you for your contribution, David!
|
||||
*
|
||||
* Please make note of the above copyright/license statement. If you
|
||||
* contributed code or bug fixes to this code under the previous (GNU
|
||||
* Library) license and object to the new license, your code will be
|
||||
* removed at your request. Please see the Mesa docs/COPYRIGHT file
|
||||
* for more information.
|
||||
*
|
||||
* Additional Mesa/3Dfx driver developers:
|
||||
* Daryll Strauss <daryll@precisioninsight.com>
|
||||
* Keith Whitwell <keith@precisioninsight.com>
|
||||
*
|
||||
* See fxapi.h for more revision/author details.
|
||||
*/
|
||||
|
||||
/* Authors:
|
||||
* David Bucciarelli
|
||||
* Brian Paul
|
||||
* Daryll Strauss
|
||||
* Keith Whitwell
|
||||
*/
|
||||
|
||||
|
||||
|
@@ -1,9 +1,10 @@
|
||||
/* $Id: fxdrv.h,v 1.52 2001/09/23 16:50:01 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 4.0
|
||||
*
|
||||
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2001 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"),
|
||||
@@ -21,26 +22,17 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
|
||||
* terms stated above.
|
||||
*
|
||||
* Thank you for your contribution, David!
|
||||
*
|
||||
* Please make note of the above copyright/license statement. If you
|
||||
* contributed code or bug fixes to this code under the previous (GNU
|
||||
* Library) license and object to the new license, your code will be
|
||||
* removed at your request. Please see the Mesa docs/COPYRIGHT file
|
||||
* for more information.
|
||||
*
|
||||
* Additional Mesa/3Dfx driver developers:
|
||||
* Daryll Strauss <daryll@precisioninsight.com>
|
||||
* Keith Whitwell <keith@precisioninsight.com>
|
||||
*
|
||||
* See fxapi.h for more revision/author details.
|
||||
*/
|
||||
|
||||
/* Authors:
|
||||
* David Bucciarelli
|
||||
* Brian Paul
|
||||
* Daryll Strauss
|
||||
* Keith Whitwell
|
||||
*/
|
||||
|
||||
/* fxsetup.c - 3Dfx VooDoo rendering mode setup functions */
|
||||
|
||||
|
||||
#ifndef FXDRV_H
|
||||
#define FXDRV_H
|
||||
@@ -94,37 +86,6 @@ extern float gl_ubyte_to_float_255_color_tab[256];
|
||||
|
||||
|
||||
|
||||
/* Should have size == 16 * sizeof(float).
|
||||
*/
|
||||
typedef union
|
||||
{
|
||||
GrVertex v;
|
||||
GLfloat f[16];
|
||||
GLuint ui[16];
|
||||
}
|
||||
fxVertex;
|
||||
|
||||
/* Used in the fxvtxfmt t&l engine.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
GrVertex v;
|
||||
GLfloat clip[4];
|
||||
GLfloat texcoord[2][2];
|
||||
GLubyte mask;
|
||||
GLfloat normal[3]; /* for replay & fallback */
|
||||
}
|
||||
fxClipVertex;
|
||||
|
||||
|
||||
|
||||
typedef void (*vfmt_project_func) (GLcontext * ctx, fxClipVertex * v);
|
||||
typedef void (*vfmt_interpolate_func) (GLfloat t,
|
||||
fxClipVertex * O,
|
||||
const fxClipVertex * I,
|
||||
const fxClipVertex * J);
|
||||
|
||||
|
||||
|
||||
#if defined(FXMESA_USE_ARGB)
|
||||
#define FXCOLOR4( c ) ( \
|
||||
@@ -147,14 +108,15 @@ typedef void (*vfmt_interpolate_func) (GLfloat t,
|
||||
|
||||
|
||||
|
||||
/* fastpath/vtxfmt flags first
|
||||
/* fastpath flags first
|
||||
*/
|
||||
#define SETUP_TMU0 0x1
|
||||
#define SETUP_TMU1 0x2
|
||||
#define SETUP_RGBA 0x4
|
||||
#define SETUP_SNAP 0x8
|
||||
#define SETUP_XYZW 0x10
|
||||
#define MAX_SETUP 0x20
|
||||
#define SETUP_PTEX 0x20
|
||||
#define MAX_SETUP 0x40
|
||||
|
||||
|
||||
#define FX_NUM_TMU 2
|
||||
@@ -356,6 +318,7 @@ tfxUnitsState;
|
||||
_DD_NEW_POINT_SIZE | \
|
||||
_NEW_LINE)
|
||||
|
||||
|
||||
/* Covers the state referenced by fxDDChooseSetupFunction.
|
||||
*/
|
||||
#define _FX_NEW_SETUP_FUNCTION (_NEW_LIGHT| \
|
||||
@@ -364,18 +327,6 @@ tfxUnitsState;
|
||||
_NEW_COLOR) \
|
||||
|
||||
|
||||
/* Covers the state referenced in fxDDCheckVtxfmt.
|
||||
*/
|
||||
#define _FX_NEW_VTXFMT (_NEW_TEXTURE | \
|
||||
_NEW_TEXTURE_MATRIX | \
|
||||
_NEW_TRANSFORM | \
|
||||
_NEW_LIGHT | \
|
||||
_NEW_PROJECTION | \
|
||||
_NEW_MODELVIEW | \
|
||||
_TNL_NEW_NEED_EYE_COORDS | \
|
||||
_FX_NEW_RENDERSTATE)
|
||||
|
||||
|
||||
/* These lookup table are used to extract RGB values in [0,255] from
|
||||
* 16-bit pixel values.
|
||||
*/
|
||||
@@ -384,11 +335,9 @@ extern GLubyte FX_PixelToG[0x10000];
|
||||
extern GLubyte FX_PixelToB[0x10000];
|
||||
|
||||
|
||||
typedef void (*fx_tri_func) (GLcontext *, const fxVertex *,
|
||||
const fxVertex *, const fxVertex *);
|
||||
typedef void (*fx_line_func) (GLcontext *, const fxVertex *,
|
||||
const fxVertex *);
|
||||
typedef void (*fx_point_func) (GLcontext *, const fxVertex *);
|
||||
typedef void (*fx_tri_func) (fxMesaContext, GrVertex *, GrVertex *, GrVertex *);
|
||||
typedef void (*fx_line_func) (fxMesaContext, GrVertex *, GrVertex *);
|
||||
typedef void (*fx_point_func) (fxMesaContext, GrVertex *);
|
||||
|
||||
struct tfxMesaContext
|
||||
{
|
||||
@@ -434,19 +383,18 @@ struct tfxMesaContext
|
||||
/* Vertex building and storage:
|
||||
*/
|
||||
GLuint tmu_source[FX_NUM_TMU];
|
||||
GLuint tex_dest[MAX_TEXTURE_UNITS];
|
||||
GLuint setupindex;
|
||||
GLuint setup_gone; /* for multipass */
|
||||
GLuint SetupIndex;
|
||||
GLuint stw_hint_state; /* for grHints */
|
||||
fxVertex *verts;
|
||||
GrVertex *verts;
|
||||
GLboolean snapVertices; /* needed for older Voodoo hardware */
|
||||
struct gl_client_array UbyteColor;
|
||||
|
||||
/* Rasterization:
|
||||
*/
|
||||
GLuint render_index;
|
||||
GLuint passes, multipass;
|
||||
GLuint is_in_hardware;
|
||||
GLenum render_prim;
|
||||
GLenum render_primitive;
|
||||
GLenum raster_primitive;
|
||||
|
||||
/* Current rasterization functions
|
||||
*/
|
||||
@@ -454,15 +402,6 @@ struct tfxMesaContext
|
||||
fx_line_func draw_line;
|
||||
fx_tri_func draw_tri;
|
||||
|
||||
/* System to turn culling on/off for tris/lines/points.
|
||||
*/
|
||||
fx_point_func initial_point;
|
||||
fx_line_func initial_line;
|
||||
fx_tri_func initial_tri;
|
||||
|
||||
fx_point_func subsequent_point;
|
||||
fx_line_func subsequent_line;
|
||||
fx_tri_func subsequent_tri;
|
||||
|
||||
/* Keep texture scales somewhere handy:
|
||||
*/
|
||||
@@ -485,7 +424,6 @@ struct tfxMesaContext
|
||||
|
||||
GLboolean verbose;
|
||||
GLboolean haveTwoTMUs; /* True if we really have 2 tmu's */
|
||||
GLboolean emulateTwoTMUs; /* True if we present 2 tmu's to mesa. */
|
||||
GLboolean haveAlphaBuffer;
|
||||
GLboolean haveZBuffer;
|
||||
GLboolean haveDoubleBuffer;
|
||||
@@ -502,37 +440,8 @@ struct tfxMesaContext
|
||||
int clipMaxX;
|
||||
int clipMinY;
|
||||
int clipMaxY;
|
||||
|
||||
/* fxvtxfmt
|
||||
*/
|
||||
GLboolean allow_vfmt;
|
||||
GLvertexformat vtxfmt;
|
||||
fxClipVertex current;
|
||||
fxClipVertex *vert; /* points into verts[] */
|
||||
void (*fire_on_vertex) (GLcontext *);
|
||||
void (*fire_on_end) (GLcontext *);
|
||||
void (*fire_on_fallback) (GLcontext *);
|
||||
|
||||
vfmt_project_func project_vertex;
|
||||
vfmt_interpolate_func interpolate_vertices;
|
||||
|
||||
int vtxfmt_fallback_count;
|
||||
int vtxfmt_installed;
|
||||
void (*old_begin) (GLenum);
|
||||
GLenum prim;
|
||||
|
||||
GLuint accel_light;
|
||||
GLfloat basecolor[4];
|
||||
|
||||
|
||||
/* Projected vertices, fastpath data:
|
||||
*/
|
||||
GLvector1ui clipped_elements;
|
||||
fxVertex *last_vert;
|
||||
GLuint size;
|
||||
};
|
||||
|
||||
typedef void (*tfxSetupFunc) (GLcontext * ctx, GLuint, GLuint);
|
||||
|
||||
extern GrHwConfiguration glbHWConfig;
|
||||
extern int glbCurrentBoard;
|
||||
@@ -540,21 +449,24 @@ extern int glbCurrentBoard;
|
||||
extern void fxSetupFXUnits(GLcontext *);
|
||||
extern void fxSetupDDPointers(GLcontext *);
|
||||
|
||||
/* fxvsetup:
|
||||
/* fxvb.c:
|
||||
*/
|
||||
extern void fxDDSetupInit(void);
|
||||
extern void fxAllocVB(GLcontext * ctx);
|
||||
extern void fxFreeVB(GLcontext * ctx);
|
||||
extern void fxPrintSetupFlags(const char *msg, GLuint flags);
|
||||
extern void fx_BuildProjVerts(GLcontext * ctx,
|
||||
GLuint start, GLuint count, GLuint newinputs);
|
||||
extern void fx_validate_BuildProjVerts(GLcontext * ctx,
|
||||
GLuint start, GLuint count,
|
||||
GLuint newinputs);
|
||||
extern void fxPrintSetupFlags(char *msg, GLuint flags );
|
||||
extern void fxCheckTexSizes( GLcontext *ctx );
|
||||
extern void fxBuildVertices( GLcontext *ctx, GLuint start, GLuint count,
|
||||
GLuint newinputs );
|
||||
extern void fxChooseVertexState( GLcontext *ctx );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* fxtrifuncs:
|
||||
*/
|
||||
extern void fxDDTrifuncInit(void);
|
||||
extern void fxDDInitTriFuncs(GLcontext *);
|
||||
extern void fxDDChooseRenderState(GLcontext * ctx);
|
||||
|
||||
|
||||
@@ -654,15 +566,8 @@ extern void fxTMMoveInTM_NoLock(fxMesaContext fxMesa,
|
||||
struct gl_texture_object *tObj, GLint where);
|
||||
extern void fxInitPixelTables(fxMesaContext fxMesa, GLboolean bgrOrder);
|
||||
|
||||
extern void fxCheckIsInHardware(GLcontext *ctx);
|
||||
|
||||
/* fxvtxfmt:
|
||||
*/
|
||||
extern void fxDDCheckVtxfmt(GLcontext * ctx);
|
||||
extern void fx_update_lighting(GLcontext * ctx);
|
||||
extern void fxDDInitVtxfmt(GLcontext * ctx);
|
||||
|
||||
/* fxsimplerender
|
||||
*/
|
||||
extern const struct gl_pipeline_stage fx_render_stage;
|
||||
extern GLboolean fx_check_IsInHardware(GLcontext *ctx);
|
||||
|
||||
#endif
|
||||
|
@@ -1,9 +1,10 @@
|
||||
/* $Id: fxglidew.c,v 1.19 2001/09/23 16:50:01 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 4.0
|
||||
*
|
||||
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2001 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"),
|
||||
@@ -21,26 +22,17 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
|
||||
* terms stated above.
|
||||
*
|
||||
* Thank you for your contribution, David!
|
||||
*
|
||||
* Please make note of the above copyright/license statement. If you
|
||||
* contributed code or bug fixes to this code under the previous (GNU
|
||||
* Library) license and object to the new license, your code will be
|
||||
* removed at your request. Please see the Mesa docs/COPYRIGHT file
|
||||
* for more information.
|
||||
*
|
||||
* Additional Mesa/3Dfx driver developers:
|
||||
* Daryll Strauss <daryll@precisioninsight.com>
|
||||
* Keith Whitwell <keith@precisioninsight.com>
|
||||
*
|
||||
* See fxapi.h for more revision/author details.
|
||||
*/
|
||||
|
||||
/* Authors:
|
||||
* David Bucciarelli
|
||||
* Brian Paul
|
||||
* Daryll Strauss
|
||||
* Keith Whitwell
|
||||
*/
|
||||
|
||||
/* fxsetup.c - 3Dfx VooDoo rendering mode setup functions */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "conf.h"
|
||||
|
@@ -1,9 +1,10 @@
|
||||
/* $Id: fxglidew.h,v 1.13 2001/09/23 16:50:01 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 4.0
|
||||
*
|
||||
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2001 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"),
|
||||
@@ -21,24 +22,13 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
|
||||
* terms stated above.
|
||||
*
|
||||
* Thank you for your contribution, David!
|
||||
*
|
||||
* Please make note of the above copyright/license statement. If you
|
||||
* contributed code or bug fixes to this code under the previous (GNU
|
||||
* Library) license and object to the new license, your code will be
|
||||
* removed at your request. Please see the Mesa docs/COPYRIGHT file
|
||||
* for more information.
|
||||
*
|
||||
* Additional Mesa/3Dfx driver developers:
|
||||
* Daryll Strauss <daryll@precisioninsight.com>
|
||||
* Keith Whitwell <keith@precisioninsight.com>
|
||||
*
|
||||
* See fxapi.h for more revision/author details.
|
||||
*/
|
||||
|
||||
/* Authors:
|
||||
* David Bucciarelli
|
||||
* Brian Paul
|
||||
* Daryll Strauss
|
||||
* Keith Whitwell
|
||||
*/
|
||||
|
||||
|
||||
|
@@ -1,9 +1,10 @@
|
||||
/* $Id: fxsetup.c,v 1.36 2001/09/23 16:50:01 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Version: 4.0
|
||||
*
|
||||
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2001 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"),
|
||||
@@ -21,26 +22,14 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
* Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
|
||||
* terms stated above.
|
||||
*
|
||||
* Thank you for your contribution, David!
|
||||
*
|
||||
* Please make note of the above copyright/license statement. If you
|
||||
* contributed code or bug fixes to this code under the previous (GNU
|
||||
* Library) license and object to the new license, your code will be
|
||||
* removed at your request. Please see the Mesa docs/COPYRIGHT file
|
||||
* for more information.
|
||||
*
|
||||
* Additional Mesa/3Dfx driver developers:
|
||||
* Daryll Strauss <daryll@precisioninsight.com>
|
||||
* Keith Whitwell <keith@precisioninsight.com>
|
||||
*
|
||||
* See fxapi.h for more revision/author details.
|
||||
*/
|
||||
|
||||
/* Authors:
|
||||
* David Bucciarelli
|
||||
* Brian Paul
|
||||
* Daryll Strauss
|
||||
* Keith Whitwell
|
||||
*/
|
||||
|
||||
/* fxsetup.c - 3Dfx VooDoo rendering mode setup functions */
|
||||
|
||||
@@ -55,8 +44,6 @@
|
||||
#include "enums.h"
|
||||
#include "tnl/t_context.h"
|
||||
|
||||
/*static GLboolean fxMultipassTexture(GLcontext *, GLuint);*/
|
||||
|
||||
static void
|
||||
fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj)
|
||||
{
|
||||
@@ -531,23 +518,8 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
|
||||
localc, GR_COMBINE_OTHER_TEXTURE, FXFALSE);
|
||||
break;
|
||||
case GL_BLEND:
|
||||
#if 0
|
||||
FX_grAlphaCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER,
|
||||
GR_COMBINE_FACTOR_LOCAL,
|
||||
locala, GR_COMBINE_OTHER_TEXTURE, FXFALSE);
|
||||
if (ifmt == GL_ALPHA)
|
||||
FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_LOCAL,
|
||||
GR_COMBINE_FACTOR_NONE,
|
||||
localc, GR_COMBINE_OTHER_NONE, FXFALSE);
|
||||
else
|
||||
FX_grColorCombine_NoLock(GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
|
||||
GR_COMBINE_FACTOR_LOCAL,
|
||||
localc, GR_COMBINE_OTHER_TEXTURE, FXTRUE);
|
||||
ctx->Driver.MultipassFunc = fxMultipassBlend;
|
||||
#else
|
||||
if (MESA_VERBOSE & VERBOSE_DRIVER)
|
||||
fprintf(stderr, "fx Driver: GL_BLEND not yet supported\n");
|
||||
#endif
|
||||
break;
|
||||
case GL_REPLACE:
|
||||
if ((ifmt == GL_RGB) || (ifmt == GL_LUMINANCE))
|
||||
@@ -580,6 +552,7 @@ fxSetupTextureSingleTMU_NoLock(GLcontext * ctx, GLuint textureset)
|
||||
}
|
||||
}
|
||||
|
||||
#if 00
|
||||
static void
|
||||
fxSetupTextureSingleTMU(GLcontext * ctx, GLuint textureset)
|
||||
{
|
||||
@@ -587,6 +560,8 @@ fxSetupTextureSingleTMU(GLcontext * ctx, GLuint textureset)
|
||||
fxSetupTextureSingleTMU_NoLock(ctx, textureset);
|
||||
END_BOARD_LOCK();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************************* Double Texture Set ***************************/
|
||||
|
||||
@@ -1037,7 +1012,7 @@ fxSetupTexture_NoLock(GLcontext * ctx)
|
||||
*/
|
||||
tex2Denabled = (ctx->Texture._ReallyEnabled & TEXTURE0_2D);
|
||||
|
||||
if (fxMesa->emulateTwoTMUs)
|
||||
if (fxMesa->haveTwoTMUs)
|
||||
tex2Denabled |= (ctx->Texture._ReallyEnabled & TEXTURE1_2D);
|
||||
|
||||
switch (tex2Denabled) {
|
||||
@@ -1055,7 +1030,6 @@ fxSetupTexture_NoLock(GLcontext * ctx)
|
||||
fprintf(stderr, "fxmesa: enabling fake multitexture\n");
|
||||
|
||||
fxSetupTextureSingleTMU_NoLock(ctx, 0);
|
||||
/*ctx->Driver.MultipassFunc = fxMultipassTexture;*/
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1547,7 +1521,8 @@ fxSetupCull(GLcontext * ctx)
|
||||
else
|
||||
FX_CONTEXT(ctx)->cullMode = GR_CULL_DISABLE;
|
||||
|
||||
FX_grCullMode(FX_CONTEXT(ctx)->cullMode);
|
||||
if (FX_CONTEXT(ctx)->raster_primitive == GL_TRIANGLES)
|
||||
FX_grCullMode(FX_CONTEXT(ctx)->cullMode);
|
||||
}
|
||||
|
||||
|
||||
@@ -1616,129 +1591,7 @@ fxDDEnable(GLcontext * ctx, GLenum cap, GLboolean state)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
Multipass to do GL_BLEND texture functions
|
||||
Cf*(1-Ct) has already been written to the buffer during the first pass
|
||||
Cc*Ct gets written during the second pass (in this function)
|
||||
Everything gets reset in the third call (in this function)
|
||||
*/
|
||||
static GLboolean
|
||||
fxMultipassBlend(struct vertex_buffer *VB, GLuint pass)
|
||||
{
|
||||
GLcontext *ctx = VB->ctx;
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
|
||||
switch (pass) {
|
||||
case 1:
|
||||
/* Add Cc*Ct */
|
||||
fxMesa->restoreUnitsState = fxMesa->unitsState;
|
||||
if (ctx->Depth.Mask) {
|
||||
/* We don't want to check or change the depth buffers */
|
||||
switch (ctx->Depth.Func) {
|
||||
case GL_NEVER:
|
||||
case GL_ALWAYS:
|
||||
break;
|
||||
default:
|
||||
fxDDDepthFunc(ctx, GL_EQUAL);
|
||||
break;
|
||||
}
|
||||
fxDDDepthMask(ctx, FALSE);
|
||||
}
|
||||
/* Enable Cc*Ct mode */
|
||||
/* XXX Set the Constant Color ? */
|
||||
fxDDEnable(ctx, GL_BLEND, GL_TRUE);
|
||||
fxDDBlendFunc(ctx, XXX, XXX);
|
||||
fxSetupTextureSingleTMU(ctx, XXX);
|
||||
fxSetupBlend(ctx);
|
||||
fxSetupDepthTest(ctx);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/* Reset everything back to normal */
|
||||
fxMesa->unitsState = fxMesa->restoreUnitsState;
|
||||
fxMesa->setup_gone |= XXX;
|
||||
fxSetupTextureSingleTMU(ctx, XXX);
|
||||
fxSetupBlend(ctx);
|
||||
fxSetupDepthTest(ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
return pass == 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/******************** Fake Multitexture Support *************************/
|
||||
/************************************************************************/
|
||||
|
||||
/* Its considered cheeky to try to fake ARB multitexture by doing
|
||||
* multipass rendering, because it is not possible to emulate the full
|
||||
* spec in this way. The fact is that the voodoo 2 supports only a
|
||||
* subset of the possible multitexturing modes, and it is possible to
|
||||
* support almost the same subset using multipass blending on the
|
||||
* voodoo 1. In all other cases for both voodoo 1 and 2, we fall back
|
||||
* to software rendering, satisfying the spec if not the user.
|
||||
*/
|
||||
static GLboolean
|
||||
fxMultipassTexture(GLcontext * ctx, GLuint pass)
|
||||
{
|
||||
fxMesaContext fxMesa = FX_CONTEXT(ctx);
|
||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||
fxVertex *v = fxMesa->verts;
|
||||
fxVertex *last = fxMesa->verts + tnl->vb.Count;
|
||||
|
||||
switch (pass) {
|
||||
case 1:
|
||||
if (MESA_VERBOSE &
|
||||
(VERBOSE_DRIVER | VERBOSE_PIPELINE | VERBOSE_TEXTURE))
|
||||
fprintf(stderr, "fxmesa: Second texture pass\n");
|
||||
|
||||
for (; v != last; v++) {
|
||||
v->f[S0COORD] = v->f[S1COORD];
|
||||
v->f[T0COORD] = v->f[T1COORD];
|
||||
}
|
||||
|
||||
fxMesa->restoreUnitsState = fxMesa->unitsState;
|
||||
fxMesa->tmu_source[0] = 1;
|
||||
|
||||
if (ctx->Depth.Mask) {
|
||||
switch (ctx->Depth.Func) {
|
||||
case GL_NEVER:
|
||||
case GL_ALWAYS:
|
||||
break;
|
||||
default:
|
||||
fxDDDepthFunc(ctx, GL_EQUAL);
|
||||
break;
|
||||
}
|
||||
|
||||
fxDDDepthMask(ctx, GL_FALSE);
|
||||
}
|
||||
|
||||
if (ctx->Texture.Unit[1].EnvMode == GL_MODULATE) {
|
||||
fxDDEnable(ctx, GL_BLEND, GL_TRUE);
|
||||
fxDDBlendFunc(ctx, GL_DST_COLOR, GL_ZERO);
|
||||
}
|
||||
|
||||
fxSetupTextureSingleTMU(ctx, 1);
|
||||
fxSetupBlend(ctx);
|
||||
fxSetupDepthTest(ctx);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/* Restore original state.
|
||||
*/
|
||||
fxMesa->tmu_source[0] = 0;
|
||||
fxMesa->unitsState = fxMesa->restoreUnitsState;
|
||||
fxMesa->setup_gone |= SETUP_TMU0;
|
||||
fxSetupTextureSingleTMU(ctx, 0);
|
||||
fxSetupBlend(ctx);
|
||||
fxSetupDepthTest(ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
return pass == 1;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
@@ -1809,9 +1662,6 @@ fxSetupFXUnits(GLcontext * ctx)
|
||||
if (newstate & FX_NEW_CULL)
|
||||
fxSetupCull(ctx);
|
||||
|
||||
fxMesa->draw_point = fxMesa->initial_point;
|
||||
fxMesa->draw_line = fxMesa->initial_line;
|
||||
fxMesa->draw_tri = fxMesa->initial_tri;
|
||||
fxMesa->new_state = 0;
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user