Compare commits
326 Commits
mesa_7_5_r
...
intel_2009
Author | SHA1 | Date | |
---|---|---|---|
|
022e8e582e | ||
|
1c1307e7c5 | ||
|
cff2126f52 | ||
|
a79586ce18 | ||
|
f01af4dbd2 | ||
|
762c1d11ff | ||
|
baa7ff47d5 | ||
|
ca1b71b78d | ||
|
6ff1a5385e | ||
|
cade071d52 | ||
|
fcd3572edf | ||
|
78af70be37 | ||
|
c86b076668 | ||
|
abdb0fdcc0 | ||
|
36e906aad6 | ||
|
4adc9b4a5b | ||
|
7b861b9b9e | ||
|
71633abafc | ||
|
25b492b976 | ||
|
96601ec8e0 | ||
|
a4d952358d | ||
|
7fb4becf98 | ||
|
1068c15c61 | ||
|
6f4167c8a2 | ||
|
5470a67335 | ||
|
fc6e02ce62 | ||
|
c30f23c123 | ||
|
94e1117c9b | ||
|
f580494bef | ||
|
b928d18398 | ||
|
aa98575ebb | ||
|
cffe7c8bd0 | ||
|
2a2236606f | ||
|
588c862571 | ||
|
798cd2a98d | ||
|
1668a679c4 | ||
|
b3e8e1cd4c | ||
|
1fa4cde757 | ||
|
70ae7ba818 | ||
|
c48c01c9e7 | ||
|
1ca836f0de | ||
|
d6c2347d79 | ||
|
09a3a28fc8 | ||
|
7e91d035b9 | ||
|
2e570be852 | ||
|
1730eaa2a2 | ||
|
4147bb24d4 | ||
|
6af783bea0 | ||
|
a9ae89d104 | ||
|
6dfb89e4a0 | ||
|
cea259f039 | ||
|
79047cc1dd | ||
|
f6c8ca06f6 | ||
|
4c31632817 | ||
|
fa5b0364f9 | ||
|
52f895df51 | ||
|
14a2b5445a | ||
|
6e09c1fd08 | ||
|
18a6f0f1a7 | ||
|
4ffe2844a4 | ||
|
578230dbbf | ||
|
a4fd94a54a | ||
|
ba7f45ac0c | ||
|
f2de2d5f37 | ||
|
e2a8ef4430 | ||
|
6c913411d3 | ||
|
1c04731b87 | ||
|
e8c4663c11 | ||
|
c72261f2a8 | ||
|
57955451f8 | ||
|
e5cb11adda | ||
|
53f8dccd0c | ||
|
00438bb94a | ||
|
0846c88ec3 | ||
|
aa688d1579 | ||
|
8d24160a40 | ||
|
47173cf67f | ||
|
4e43126a59 | ||
|
b1f2f92d9b | ||
|
9014f475ff | ||
|
b799af91d5 | ||
|
9a5ee12434 | ||
|
bb8f3090ba | ||
|
72ad039d19 | ||
|
418987ff05 | ||
|
21320b24c5 | ||
|
4181a107cb | ||
|
2a41df86a3 | ||
|
318122b60a | ||
|
dd585db687 | ||
|
f08bebfe24 | ||
|
2d86503471 | ||
|
077a06c140 | ||
|
62ad606065 | ||
|
928e1ce47f | ||
|
af7fb892d8 | ||
|
f5dc352e5f | ||
|
e80ecdf659 | ||
|
8e6dd8bf79 | ||
|
aa48becb82 | ||
|
16787c513b | ||
|
ac05996b81 | ||
|
0efd25b502 | ||
|
2ae297c318 | ||
|
ddf64be258 | ||
|
f652f15e6d | ||
|
dd453fa37c | ||
|
2f1c5c58b3 | ||
|
65eaafee25 | ||
|
e139434d44 | ||
|
b04605d544 | ||
|
515513b409 | ||
|
09313043e7 | ||
|
5951ab311d | ||
|
e5b53c071b | ||
|
3c6480ea42 | ||
|
fc0896b50b | ||
|
f4b1a69b7d | ||
|
454a717d94 | ||
|
02edc8da36 | ||
|
08025cd4a5 | ||
|
2102e301a7 | ||
|
541594b044 | ||
|
38ddbc5588 | ||
|
4dafac2b2f | ||
|
aba93643be | ||
|
7e0eaca201 | ||
|
c1f74a6734 | ||
|
f38872473c | ||
|
f66733bbee | ||
|
c4fd947bee | ||
|
c20bb48d3a | ||
|
eb1eee03a6 | ||
|
4bc74a0756 | ||
|
625b0fe268 | ||
|
4031ea1520 | ||
|
84c5e4805b | ||
|
72aed16aee | ||
|
25f6c936fe | ||
|
3e94521912 | ||
|
c9f8c400ab | ||
|
c25534f30d | ||
|
b79e6a59d8 | ||
|
2f184d0d9f | ||
|
9d367d43b2 | ||
|
0584b6e433 | ||
|
19218fe712 | ||
|
a5b7e0c7d7 | ||
|
54f425b5ce | ||
|
810df8317d | ||
|
19ca5ee1db | ||
|
ad0514b24d | ||
|
00e203fe17 | ||
|
abfd56c24c | ||
|
daacac1c24 | ||
|
43bb78f2bb | ||
|
9dfce365c7 | ||
|
a120778c72 | ||
|
3cf92e936a | ||
|
0487656245 | ||
|
8f382fd3f3 | ||
|
21bfd0f4bd | ||
|
d609df1dae | ||
|
2af0173e9e | ||
|
42882897c6 | ||
|
4b4855c717 | ||
|
1b05b5b4fe | ||
|
0491142152 | ||
|
39366ed995 | ||
|
d446d3acac | ||
|
56235ae504 | ||
|
e15aebe10e | ||
|
a70c45bdab | ||
|
ff3da0966f | ||
|
1b8e4dd2c8 | ||
|
cee73ffdaf | ||
|
7805c3b57b | ||
|
97974b7e51 | ||
|
957f3c8c3d | ||
|
66bfd025c8 | ||
|
fbd554d074 | ||
|
6e0df938d4 | ||
|
988b61be27 | ||
|
320a303be0 | ||
|
d9e35d51fd | ||
|
61a2c9668f | ||
|
2770107d87 | ||
|
3f856c6b6b | ||
|
d18c57aaea | ||
|
3705f48688 | ||
|
c6f71eabd8 | ||
|
1bee650ef3 | ||
|
6e24fdeae5 | ||
|
557421b6de | ||
|
25f0c33bb3 | ||
|
c53705ed7b | ||
|
ebe0796ba2 | ||
|
d22828f716 | ||
|
992000cce7 | ||
|
6b917d0b17 | ||
|
742ba08406 | ||
|
3e48dd0445 | ||
|
ed7f4b4230 | ||
|
3463b1479d | ||
|
077c5e62d8 | ||
|
06075711af | ||
|
566bdbe67d | ||
|
d027e8feff | ||
|
227d233cff | ||
|
7585cbffe0 | ||
|
c6af9b2947 | ||
|
053d8eb891 | ||
|
6214c7262f | ||
|
37f2117cd1 | ||
|
c33ef1f7c6 | ||
|
940cb7ce16 | ||
|
5d0cf9ebb4 | ||
|
0e1abced56 | ||
|
db22b35d21 | ||
|
cbe5af766e | ||
|
fb64365642 | ||
|
476685c63c | ||
|
c6de08fff4 | ||
|
3754c4135c | ||
|
322e8556b9 | ||
|
0ddc38309a | ||
|
e1700009b7 | ||
|
d5ba39ad08 | ||
|
de413b1ba9 | ||
|
3f2e006b75 | ||
|
7cafd49c93 | ||
|
862c7b8cd3 | ||
|
bb0b954f12 | ||
|
9d5479eeeb | ||
|
cc09724a50 | ||
|
41cf681535 | ||
|
e3f14f2f3b | ||
|
48d816b8ff | ||
|
96aca15c9d | ||
|
337f559cd2 | ||
|
8fa8669aeb | ||
|
0a4fcabe44 | ||
|
dbab657fe7 | ||
|
9225b67383 | ||
|
88527220e4 | ||
|
506989b20e | ||
|
6f50c9865d | ||
|
5450281ff7 | ||
|
4d16eb5e18 | ||
|
978bca8b2a | ||
|
52411a1951 | ||
|
8bfbb7ec8b | ||
|
76a1017e97 | ||
|
9192347443 | ||
|
cb549775a5 | ||
|
34bb024cf2 | ||
|
7eed6ab5b5 | ||
|
304ba4bba4 | ||
|
77c329a277 | ||
|
b6753adbc7 | ||
|
e09f78d8dc | ||
|
42678dba94 | ||
|
33d6327770 | ||
|
0bced6a326 | ||
|
0d3c8fbf12 | ||
|
fce4ee12a6 | ||
|
4d9d0e6230 | ||
|
283e84bfb3 | ||
|
78dad27564 | ||
|
cfff2a6189 | ||
|
6453605785 | ||
|
5df6468589 | ||
|
9424d81d18 | ||
|
6907650211 | ||
|
d37795c453 | ||
|
45e744dddc | ||
|
fc7f924782 | ||
|
0f50c4fab8 | ||
|
273117ceed | ||
|
840af5fd62 | ||
|
c91df4c153 | ||
|
12e94d892e | ||
|
cb3a9f984d | ||
|
16fbd39129 | ||
|
1aef032d43 | ||
|
003cfd4dd2 | ||
|
69a765df1c | ||
|
503632557e | ||
|
557d2bb423 | ||
|
97f5953ced | ||
|
f989390af6 | ||
|
00e7a60077 | ||
|
3c756ed39f | ||
|
76ad2b4a5a | ||
|
0e8a5a8474 | ||
|
427554211b | ||
|
a5d033e89b | ||
|
ea3ee4791e | ||
|
0ea519f931 | ||
|
fe69b6bdc7 | ||
|
be7c56be06 | ||
|
76f2bacb07 | ||
|
1124f786c1 | ||
|
5bb2074798 | ||
|
8aef306c34 | ||
|
29c6c8eb18 | ||
|
a59575d8fb | ||
|
1045481dd9 | ||
|
c3538969e1 | ||
|
58fadc6242 | ||
|
995456f930 | ||
|
42b747e57d | ||
|
70c4b81e88 | ||
|
8da09e6924 | ||
|
d4fb7615b5 | ||
|
d2f4c2b632 | ||
|
042d9a5132 | ||
|
c99a60c40d | ||
|
7ce105d2e6 | ||
|
adabd0e81e | ||
|
30320f0afb | ||
|
14e5bff97b | ||
|
df37cde309 | ||
|
6e61700541 | ||
|
da0d4e1db6 | ||
|
f2445dfd85 |
3
Makefile
3
Makefile
@@ -127,6 +127,7 @@ linux-icc \
|
||||
linux-icc-static \
|
||||
linux-llvm \
|
||||
linux-osmesa \
|
||||
linux-osmesa-static \
|
||||
linux-osmesa16 \
|
||||
linux-osmesa16-static \
|
||||
linux-osmesa32 \
|
||||
@@ -181,7 +182,7 @@ ultrix-gcc:
|
||||
|
||||
# Rules for making release tarballs
|
||||
|
||||
VERSION=7.5-rc2
|
||||
VERSION=7.5-rc4
|
||||
DIRECTORY = Mesa-$(VERSION)
|
||||
LIB_NAME = MesaLib-$(VERSION)
|
||||
DEMO_NAME = MesaDemos-$(VERSION)
|
||||
|
@@ -66,8 +66,11 @@ if [ $# -ge 2 ] ; then
|
||||
|
||||
elif [ -f "$FILE" ] ; then
|
||||
#echo "$FILE" is a regular file
|
||||
$RM "$DEST/`basename $FILE`"
|
||||
cp "$FILE" "$DEST"
|
||||
# Only copy if the files differ
|
||||
if ! cmp -s $FILE $DEST/`basename $FILE`; then
|
||||
$RM "$DEST/`basename $FILE`"
|
||||
cp "$FILE" "$DEST"
|
||||
fi
|
||||
if [ $MODE ] ; then
|
||||
FILE=`basename "$FILE"`
|
||||
chmod $MODE "$DEST/$FILE"
|
||||
|
19
bin/mklib
19
bin/mklib
@@ -885,6 +885,17 @@ case $ARCH in
|
||||
|
||||
CYGWIN*)
|
||||
# GCC-based environment
|
||||
if [ $NOPREFIX = 1 ] ; then
|
||||
# No "lib" or ".so" part
|
||||
echo "mklib: Making CYGWIN shared library: " ${LIBNAME}
|
||||
OPTS="-shared -Wl,--enable-auto-image-base"
|
||||
if [ "${ALTOPTS}" ] ; then
|
||||
OPTS=${ALTOPTS}
|
||||
fi
|
||||
rm -f ${LIBNAME}
|
||||
${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
|
||||
FINAL_LIBS=${LIBNAME}
|
||||
else
|
||||
CYGNAME="cyg${LIBNAME}" # prefix with "cyg"
|
||||
LIBNAME="lib${LIBNAME}" # prefix with "lib"
|
||||
|
||||
@@ -901,11 +912,11 @@ case $ARCH in
|
||||
# finish up
|
||||
FINAL_LIBS=${LIBNAME}.a
|
||||
else
|
||||
OPTS="-shared -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a"
|
||||
OPTS="-shared -Wl,--enable-auto-image-base -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a"
|
||||
if [ "${ALTOPTS}" ] ; then
|
||||
OPTS=${ALTOPTS}
|
||||
fi
|
||||
echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}-${MAJOR}.dll
|
||||
echo "mklib: Making" $ARCH "shared library: " ${CYGNAME}-${MAJOR}.dll
|
||||
|
||||
if [ $CPLUSPLUS = 1 ] ; then
|
||||
LINK="g++"
|
||||
@@ -914,7 +925,8 @@ case $ARCH in
|
||||
fi
|
||||
|
||||
# rm any old libs
|
||||
rm -f ${LIBNAME}-${MAJOR}.dll
|
||||
rm -f ${CYGNAME}-${MAJOR}.dll
|
||||
rm -f ${LIBNAME}-${MAJOR}.dll.a
|
||||
rm -f ${LIBNAME}.dll.a
|
||||
rm -f ${LIBNAME}.a
|
||||
|
||||
@@ -927,6 +939,7 @@ case $ARCH in
|
||||
# special case for installing in bin
|
||||
FINAL_BINS="${CYGNAME}-${MAJOR}.dll"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
'example')
|
||||
|
@@ -55,7 +55,7 @@ def AddOptions(opts):
|
||||
from SCons.Options.EnumOption import EnumOption
|
||||
opts.Add(BoolOption('debug', 'debug build', 'no'))
|
||||
opts.Add(BoolOption('profile', 'profile build', 'no'))
|
||||
#opts.Add(BoolOption('quiet', 'quiet command lines', 'no'))
|
||||
opts.Add(BoolOption('quiet', 'quiet command lines', 'yes'))
|
||||
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
|
||||
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
|
||||
opts.Add(EnumOption('platform', 'target platform', default_platform,
|
||||
|
37
configs/linux-osmesa-static
Normal file
37
configs/linux-osmesa-static
Normal file
@@ -0,0 +1,37 @@
|
||||
# Configuration for building static libOSMesa.a on Linux, no Xlib driver
|
||||
# This doesn't really have any Linux dependencies, so it should be usable
|
||||
# on other (gcc-based) systems.
|
||||
|
||||
include $(TOP)/configs/default
|
||||
|
||||
CONFIG_NAME = linux-osmesa
|
||||
|
||||
# Compiler and flags
|
||||
CC = gcc -m32
|
||||
CXX = g++ -m32
|
||||
CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS
|
||||
CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
|
||||
|
||||
MKLIB_OPTIONS = -static
|
||||
|
||||
# Library names (actual file names)
|
||||
GL_LIB_NAME = libGL.a
|
||||
GLU_LIB_NAME = libGLU.a
|
||||
GLUT_LIB_NAME = libglut.a
|
||||
GLW_LIB_NAME = libGLw.a
|
||||
OSMESA_LIB_NAME = libOSMesa.a
|
||||
|
||||
# Directories
|
||||
SRC_DIRS = mesa glu
|
||||
DRIVER_DIRS = osmesa
|
||||
PROGRAM_DIRS = osdemos
|
||||
|
||||
|
||||
# Dependencies
|
||||
GL_LIB_DEPS =
|
||||
OSMESA_LIB_DEPS =
|
||||
GLU_LIB_DEPS =
|
||||
GLUT_LIB_DEPS =
|
||||
GLW_LIB_DEPS =
|
||||
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \
|
||||
$(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lpthread -lstdc++ -lm
|
14
configure.ac
14
configure.ac
@@ -222,6 +222,8 @@ else
|
||||
case "$host_os" in
|
||||
darwin* )
|
||||
LIB_EXTENSION='dylib' ;;
|
||||
cygwin* )
|
||||
LIB_EXTENSION='dll' ;;
|
||||
* )
|
||||
LIB_EXTENSION='so' ;;
|
||||
esac
|
||||
@@ -640,7 +642,7 @@ dnl Which drivers to build - default is chosen by platform
|
||||
AC_ARG_WITH([dri-drivers],
|
||||
[AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@],
|
||||
[comma delimited DRI drivers list, e.g.
|
||||
"swrast,i965,radeon,nouveau" @<:@default=auto@:>@])],
|
||||
"swrast,i965,radeon" @<:@default=auto@:>@])],
|
||||
[with_dri_drivers="$withval"],
|
||||
[with_dri_drivers=yes])
|
||||
if test "x$with_dri_drivers" = x; then
|
||||
@@ -826,12 +828,12 @@ case "$mesa_driver" in
|
||||
osmesa)
|
||||
# only link libraries with osmesa if shared
|
||||
if test "$enable_static" = no; then
|
||||
OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
|
||||
OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
|
||||
else
|
||||
OSMESA_LIB_DEPS=""
|
||||
fi
|
||||
OSMESA_MESA_DEPS=""
|
||||
OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS"
|
||||
OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
|
||||
;;
|
||||
*)
|
||||
# Link OSMesa to libGL otherwise
|
||||
@@ -845,9 +847,6 @@ osmesa)
|
||||
OSMESA_PC_REQ="gl"
|
||||
;;
|
||||
esac
|
||||
if test "$enable_static" = no; then
|
||||
OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS"
|
||||
fi
|
||||
OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
|
||||
AC_SUBST([OSMESA_LIB_DEPS])
|
||||
AC_SUBST([OSMESA_MESA_DEPS])
|
||||
@@ -1076,6 +1075,9 @@ if test "x$APP_LIB_DEPS" = x; then
|
||||
solaris*)
|
||||
APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm"
|
||||
;;
|
||||
cygwin*)
|
||||
APP_LIB_DEPS="-lX11"
|
||||
;;
|
||||
*)
|
||||
APP_LIB_DEPS="-lm"
|
||||
;;
|
||||
|
@@ -123,48 +123,46 @@ These are the instructions for making a new Mesa release.
|
||||
|
||||
<H3>Get latest source files</H3>
|
||||
<p>
|
||||
Use "cvs update -dAP " to get the latest Mesa files from CVS.
|
||||
Use git to get the latest Mesa files from the git repository, from whatever
|
||||
branch is relevant.
|
||||
</p>
|
||||
|
||||
|
||||
<H3>Verify and update version info</H3>
|
||||
<p>
|
||||
Create/edit the docs/RELNOTES-X.Y file to document what's new in the release.
|
||||
Add the new RELNOTES-X.Y file to <a href="relnotes.html">relnotes.html</a>.
|
||||
Update the docs/VERSIONS file too.
|
||||
Create/edit the docs/relnotes-x.y.html file to document what's new in the release.
|
||||
Add the new relnotes-x.y.html file to <a href="relnotes.html">relnotes.html</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Edit the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
|
||||
Update the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
|
||||
configs/default.
|
||||
Also update the VERSION line in the top-level Makefile.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Make sure the values in src/mesa/main/version.h are correct.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Edit the top-level Makefile and verify that DIRECTORY, LIB_NAME and
|
||||
DEMO_NAME are correct.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Update the docs/news.html file and docs/download.html files.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Check in all updates to CVS.
|
||||
Check in all updates to git.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Tag the CVS files with the release name (in the form <b>mesa_X_Y</b>).
|
||||
Tag the files with the release name (in the form <b>mesa_X_Y</b>)
|
||||
with: <code>git tag -a mesa_X_Y</code>
|
||||
Then: <code>git push origin mesa_X_Y</code>
|
||||
</p>
|
||||
|
||||
|
||||
<H3>Make the tarballs</H3>
|
||||
<p>
|
||||
Make a symbolic link from $(DIRECTORY) to 'Mesa'. For example,
|
||||
ln -s Mesa Mesa-6.3
|
||||
<code>ln -s Mesa Mesa-7.5</code>
|
||||
This is needed in order to make a correct tar file in the next step.
|
||||
</p>
|
||||
|
||||
@@ -177,7 +175,7 @@ Make the distribution files. From inside the Mesa directory:
|
||||
<p>
|
||||
After the tarballs are created, the md5 checksums for the files will
|
||||
be computed.
|
||||
Add them to the docs/news.html file.
|
||||
Add them to the docs/relnotes-X.Y.html file.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -191,9 +189,21 @@ Follow the directions on SourceForge for creating a new "release" and
|
||||
uploading the tarballs.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Basically, to upload the tarball files with:
|
||||
<br>
|
||||
<code>
|
||||
rsync -avP ssh Mesa*-X.Y.* USERNAME@frs.sourceforge.net:uploads/
|
||||
</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Update the web site by copying the docs/ directory's files to
|
||||
/home/users/b/br/brianp/mesa-www/htdocs/
|
||||
/home/users/b/br/brianp/mesa-www/htdocs/ with:
|
||||
<br>
|
||||
<code>
|
||||
sftp USERNAME,mesa3d@web.sourceforge.net
|
||||
</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@@ -21,6 +21,7 @@
|
||||
<li><a href="#pkg-config">Building OpenGL programs with pkg-config
|
||||
</ul>
|
||||
<li><a href="#windows">Windows</a>
|
||||
<li><a href="#scons">SCons</a>
|
||||
<li><a href="#other">Other</a>
|
||||
</ol>
|
||||
<br>
|
||||
@@ -328,13 +329,60 @@ For example, compiling and linking a GLUT application can be done with:
|
||||
<H2>2. Windows Compilation and Installation</H1>
|
||||
|
||||
<p>
|
||||
Please see the <a href="README.WIN32">README.WIN32</a> file.
|
||||
Please see the <a href="#scons">instructions on building with SCons</a>.
|
||||
Alternatively see <a href="README.WIN32">README.WIN32</a> file.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<a name="scons">
|
||||
<H2>3. Building with SCons</H1>
|
||||
|
||||
<p>
|
||||
To build Mesa with SCons on Linux or Windows do
|
||||
</p>
|
||||
<pre>
|
||||
scons
|
||||
</pre>
|
||||
<p>
|
||||
The build output will be placed in
|
||||
build/<i>platform</i>-<i>machine</i>-<i>debug</i>/..., where <i>platform</i> is for
|
||||
example linux or windows, <i>machine</i> is x86 or x86_64, optionally followed
|
||||
by -debug for debug builds.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The sample programs are built seperately. To build them do
|
||||
<pre>
|
||||
scons -C progs
|
||||
</pre>
|
||||
And the build output will be placed in progs/build/...
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler toolchain do
|
||||
</p>
|
||||
<pre>
|
||||
scons platform=windows toolchain=crossmingw machine=x86 statetrackers=mesa drivers=softpipe,trace winsys=gdi
|
||||
scons -C progs platform=windows toolchain=crossmingw machine=x86 -k
|
||||
</pre>
|
||||
<p>
|
||||
This will create:
|
||||
</p>
|
||||
<ul>
|
||||
<li>build/windows-x86-debug/gallium/winsys/gdi/opengl32.dll — Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll
|
||||
<li>build/windows-x86-debug/glut/glx/glut32.dll
|
||||
<li>progs/build/windows-x86-debug/wgl/wglinfo.exe
|
||||
<li>progs/build/windows-x86-debug/trivial/tri.exe
|
||||
<li>and many other samples in progs/build/windows-x86-debug/...
|
||||
</ul>
|
||||
<p>
|
||||
Put them all in the same directory to test them.
|
||||
</p>
|
||||
|
||||
|
||||
<a name="other">
|
||||
<H2>3. Other systems</H1>
|
||||
<H2>4. Other systems</H1>
|
||||
|
||||
<p>
|
||||
Documentation for other environments (some may be very out of date):
|
||||
|
@@ -11,6 +11,21 @@
|
||||
<H1>News</H1>
|
||||
|
||||
|
||||
<h2>June 23, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.4.4.html">Mesa 7.4.4</a> is released.
|
||||
This is a stable release that fixes a regression in the i915/i965 drivers
|
||||
that slipped into the 7.4.3 release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>June 19, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.4.3.html">Mesa 7.4.3</a> is released.
|
||||
This is a stable release fixing bugs since the 7.4.2 release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>May 15, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.4.2.html">Mesa 7.4.2</a> is released.
|
||||
|
79
docs/relnotes-7.4.3.html
Normal file
79
docs/relnotes-7.4.3.html
Normal file
@@ -0,0 +1,79 @@
|
||||
<HTML>
|
||||
|
||||
<TITLE>Mesa Release Notes</TITLE>
|
||||
|
||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.4.3 Release Notes / 19 June 2009</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.4.3 is a stable development release fixing bugs since the 7.4.2 release.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.4.3 implements the OpenGL 2.1 API, but the version reported by
|
||||
glGetString(GL_VERSION) depends on the particular driver being used.
|
||||
Some drivers don't support all the features required in OpenGL 2.1.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
34c5a6c47ed51f31c4fa36e269831352 MesaLib-7.4.3.tar.gz
|
||||
70a983ba3deaa8bd63b18bbab283f698 MesaLib-7.4.3.tar.bz2
|
||||
34f21b3205b271d575030aa98a2dda51 MesaLib-7.4.3.zip
|
||||
56752b7adede212e6097afb10d0c0d59 MesaDemos-7.4.3.tar.gz
|
||||
8ffa51c4833b1e298300a005e2d7ca2a MesaDemos-7.4.3.tar.bz2
|
||||
0037d24d41400d6fb9800ae55b8c863f MesaDemos-7.4.3.zip
|
||||
20e24f6692c0c90e7e3b220f79c4108d MesaGLUT-7.4.3.tar.gz
|
||||
03a4beeef74fc5ef0b1d6d04710e5a8a MesaGLUT-7.4.3.tar.bz2
|
||||
273788230adbdb9d57371309adedcf5f MesaGLUT-7.4.3.zip
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Fixed texture object reference counting bug (bug 21756)
|
||||
<li>Allow depth/stencil textures to be attached to GL_STENCIL_ATTACHMENT point
|
||||
(SF bug 2793846)
|
||||
<li>Added missing glGet case for GL_VERTEX_ARRAY_BINDING_APPLE
|
||||
<li>Fixed some OSMesa build issues
|
||||
<li>Fixed a vertex buffer object crash
|
||||
<li>Fixed broken glTexImage3D() when image type = GL_BITMAP
|
||||
<li>Fixed some GLSL preprocessor bugs
|
||||
<li>Fixed framebuffer mem leak in i945/i965 DRI drivers
|
||||
<li>Fixed texture coordinate repeat bug in swrast (bug 21872)
|
||||
<li>Fixed incorrect viewport clamping (lower bound is zero, not one)
|
||||
<li>GLX fix for glean's makeCurrent test case
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h2>Driver Status</h2>
|
||||
|
||||
<pre>
|
||||
Driver Status
|
||||
---------------------- ----------------------
|
||||
DRI drivers varies with the driver
|
||||
XMesa/GLX (on Xlib) implements OpenGL 2.1
|
||||
OSMesa (off-screen) implements OpenGL 2.1
|
||||
Windows/Win32 implements OpenGL 2.1
|
||||
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
|
||||
SVGA unsupported
|
||||
Wind River UGL unsupported
|
||||
DJGPP unsupported
|
||||
GGI unsupported
|
||||
BeOS unsupported
|
||||
Allegro unsupported
|
||||
D3D unsupported
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
68
docs/relnotes-7.4.4.html
Normal file
68
docs/relnotes-7.4.4.html
Normal file
@@ -0,0 +1,68 @@
|
||||
<HTML>
|
||||
|
||||
<TITLE>Mesa Release Notes</TITLE>
|
||||
|
||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.4.4 Release Notes / 23 June 2009</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.4.4 is a stable development release fixing bugs since the 7.4.3 release.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.4.4 implements the OpenGL 2.1 API, but the version reported by
|
||||
glGetString(GL_VERSION) depends on the particular driver being used.
|
||||
Some drivers don't support all the features required in OpenGL 2.1.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
0b56fe5a88ab0c3c5b2da5068f63f416 MesaLib-7.4.4.tar.gz
|
||||
b66528d314c574dccbe0ed963cac5e93 MesaLib-7.4.4.tar.bz2
|
||||
2818076f3ba23fa87fdfe4602a637a18 MesaLib-7.4.4.zip
|
||||
3e77b208386c47b18165bce5ae317e2c MesaDemos-7.4.4.tar.gz
|
||||
628142ec9a54cd28cc027e6ce26cff47 MesaDemos-7.4.4.tar.bz2
|
||||
d08a30d30ab7174859aa709cba6c726d MesaDemos-7.4.4.zip
|
||||
e6e91ba16e274d40cf3a97ad3218af01 MesaGLUT-7.4.4.tar.gz
|
||||
e14bbb52517e8121b31f1387515365ab MesaGLUT-7.4.4.tar.bz2
|
||||
f10ed20469753c2b3d68c99854f80fd4 MesaGLUT-7.4.4.zip
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Fixed i965/i915 segfault in screen destruction (bug 22408)
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h2>Driver Status</h2>
|
||||
|
||||
<pre>
|
||||
Driver Status
|
||||
---------------------- ----------------------
|
||||
DRI drivers varies with the driver
|
||||
XMesa/GLX (on Xlib) implements OpenGL 2.1
|
||||
OSMesa (off-screen) implements OpenGL 2.1
|
||||
Windows/Win32 implements OpenGL 2.1
|
||||
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
|
||||
SVGA unsupported
|
||||
Wind River UGL unsupported
|
||||
DJGPP unsupported
|
||||
GGI unsupported
|
||||
BeOS unsupported
|
||||
Allegro unsupported
|
||||
D3D unsupported
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -46,7 +46,7 @@ tbd
|
||||
|
||||
<h2>New features</h2>
|
||||
<ul>
|
||||
<li>Gallium - this is the new architecture for OS-independent and
|
||||
<li>Gallium3D - this is the new architecture for OS-independent and
|
||||
API-independent 3D drivers.
|
||||
Gallium3D is intended for GPUs that fully support vertex/fragment shaders.
|
||||
The Gallium3D drivers currently included are:
|
||||
@@ -54,8 +54,10 @@ tbd
|
||||
<li>softpipe - a software/reference driver
|
||||
<li>i915 - Intel 915/945 driver
|
||||
<li><a href="cell.html">Cell</a> - IBM/Sony/Toshiba Cell processor driver
|
||||
<li>nouveau - preliminary driver for NVIDIA GPUs (still under development)
|
||||
<li>r300 - preliminary driver for R300 (still under development)
|
||||
<li>nouveau (for NVIDIA GPUs) and R300 for (AMD/ATI R300).
|
||||
<b>PLEASE NOTE: these drivers are incomplete and still under development.
|
||||
It's probably NOT worthwhile to report any bugs unless you have patches.
|
||||
</b>
|
||||
</ul>
|
||||
<li>GL_ARB_framebuffer_object extension (software drivers, i965 driver)
|
||||
<li>Reworked two-sided stencil support.
|
||||
@@ -66,12 +68,18 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
|
||||
<li>GL_EXT_texture_swizzle extension (software drivers, i965 driver)
|
||||
<li>Updated SPARC assembly optimizations (David S. Miller)
|
||||
<li>Initial support for separate compilation units in GLSL compiler.
|
||||
<li>Increased max number of generic GLSL varying variables to 16 (formerly 8).
|
||||
<li>GLSL linker now detects when too many varying variables are used.
|
||||
<li>Optimize-out redundant glMaterial and glShadeModel calls in display lists
|
||||
<li>Fixed gl_TextureMatrix[i][j] array indexing bug in GLSL compiler.
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Lots of i965 driver bug fixes
|
||||
<li>Fixed some GLSL preprocessor bugs
|
||||
<li>GLSL: continue inside of a for-loop didn't work
|
||||
</ul>
|
||||
|
||||
|
||||
|
@@ -8,18 +8,14 @@
|
||||
|
||||
<H1>Release Notes</H1>
|
||||
|
||||
<p>
|
||||
Mesa uses an even/odd version number scheme like the Linux kernel.
|
||||
Odd numbered versions (such as 6.5) designate new developmental releases.
|
||||
Even numbered versions (such as 6.4) designate stable releases.
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
The release notes summarize what's new or changed in each Mesa release.
|
||||
</p>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="relnotes-7.5.html">7.5 release notes</A>
|
||||
<LI><A HREF="relnotes-7.4.4.html">7.4.4 release notes</A>
|
||||
<LI><A HREF="relnotes-7.4.3.html">7.4.3 release notes</A>
|
||||
<LI><A HREF="relnotes-7.4.2.html">7.4.2 release notes</A>
|
||||
<LI><A HREF="relnotes-7.4.1.html">7.4.1 release notes</A>
|
||||
<LI><A HREF="relnotes-7.4.html">7.4 release notes</A>
|
||||
|
@@ -2702,7 +2702,7 @@ typedef GLenum (GLAPIENTRY * PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
|
||||
typedef void (GLAPIENTRY * PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint* framebuffers);
|
||||
typedef void (GLAPIENTRY * PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint* renderbuffers);
|
||||
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURLAYERPROC) (GLenum target,GLenum attachment, GLuint texture,GLint level,GLint layer);
|
||||
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target,GLenum attachment, GLuint texture,GLint level,GLint layer);
|
||||
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (GLAPIENTRY * PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint layer);
|
||||
@@ -2723,7 +2723,7 @@ typedef void (GLAPIENTRY * PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum targ
|
||||
#define glDeleteFramebuffers GLEW_GET_FUN(__glewDeleteFramebuffers)
|
||||
#define glDeleteRenderbuffers GLEW_GET_FUN(__glewDeleteRenderbuffers)
|
||||
#define glFramebufferRenderbuffer GLEW_GET_FUN(__glewFramebufferRenderbuffer)
|
||||
#define glFramebufferTexturLayer GLEW_GET_FUN(__glewFramebufferTexturLayer)
|
||||
#define glFramebufferTextureLayer GLEW_GET_FUN(__glewFramebufferTextureLayer)
|
||||
#define glFramebufferTexture1D GLEW_GET_FUN(__glewFramebufferTexture1D)
|
||||
#define glFramebufferTexture2D GLEW_GET_FUN(__glewFramebufferTexture2D)
|
||||
#define glFramebufferTexture3D GLEW_GET_FUN(__glewFramebufferTexture3D)
|
||||
@@ -10563,7 +10563,7 @@ GLEW_FUN_EXPORT PFNGLCHECKFRAMEBUFFERSTATUSPROC __glewCheckFramebufferStatus;
|
||||
GLEW_FUN_EXPORT PFNGLDELETEFRAMEBUFFERSPROC __glewDeleteFramebuffers;
|
||||
GLEW_FUN_EXPORT PFNGLDELETERENDERBUFFERSPROC __glewDeleteRenderbuffers;
|
||||
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERRENDERBUFFERPROC __glewFramebufferRenderbuffer;
|
||||
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURLAYERPROC __glewFramebufferTexturLayer;
|
||||
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURELAYERPROC __glewFramebufferTextureLayer;
|
||||
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE1DPROC __glewFramebufferTexture1D;
|
||||
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE2DPROC __glewFramebufferTexture2D;
|
||||
GLEW_FUN_EXPORT PFNGLFRAMEBUFFERTEXTURE3DPROC __glewFramebufferTexture3D;
|
||||
|
@@ -1,6 +1,7 @@
|
||||
SConscript([
|
||||
'util/SConscript',
|
||||
'demos/SConscript',
|
||||
'glsl/SConscript',
|
||||
'redbook/SConscript',
|
||||
'samples/SConscript',
|
||||
'tests/SConscript',
|
||||
|
@@ -145,6 +145,13 @@ engine.o: engine.c trackball.h
|
||||
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) engine.c
|
||||
|
||||
|
||||
fbotexture: fbotexture.o
|
||||
$(APP_CC) $(CFLAGS) $(LDFLAGS) fbotexture.o $(LIBS) -o $@
|
||||
|
||||
fbotexture.o: fbotexture.c extfuncs.h
|
||||
$(APP_CC) -c -I$(INCDIR) $(CFLAGS) fbotexture.c
|
||||
|
||||
|
||||
fslight: fslight.o
|
||||
$(APP_CC) $(CFLAGS) $(LDFLAGS) fslight.o $(LIBS) -o $@
|
||||
|
||||
|
@@ -9,13 +9,13 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "extfuncs.h"
|
||||
|
||||
/* For debug */
|
||||
#define DEPTH 1
|
||||
@@ -80,9 +80,9 @@ RenderTexture(void)
|
||||
glTranslatef(0.0, 0.0, -15.0);
|
||||
|
||||
/* draw to texture image */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
|
||||
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, MyFB);
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
printf("Framebuffer incomplete!!!\n");
|
||||
}
|
||||
@@ -171,7 +171,7 @@ RenderTexture(void)
|
||||
|
||||
#if DRAW
|
||||
/* Bind normal framebuffer */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, 0);
|
||||
#endif
|
||||
|
||||
CheckError(__LINE__);
|
||||
@@ -252,12 +252,12 @@ static void
|
||||
CleanUp(void)
|
||||
{
|
||||
#if DEPTH
|
||||
glDeleteRenderbuffersEXT(1, &DepthRB);
|
||||
glDeleteRenderbuffers_func(1, &DepthRB);
|
||||
#endif
|
||||
#if STENCIL
|
||||
glDeleteRenderbuffersEXT(1, &StencilRB);
|
||||
glDeleteRenderbuffers_func(1, &StencilRB);
|
||||
#endif
|
||||
glDeleteFramebuffersEXT(1, &MyFB);
|
||||
glDeleteFramebuffers_func(1, &MyFB);
|
||||
|
||||
glDeleteTextures(1, &TexObj);
|
||||
|
||||
@@ -318,14 +318,14 @@ AttachDepthAndStencilBuffers(GLuint fbo,
|
||||
|
||||
*depthRbOut = *stencilRbOut = 0;
|
||||
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo);
|
||||
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, fbo);
|
||||
|
||||
if (tryDepthStencil) {
|
||||
GLuint rb;
|
||||
|
||||
glGenRenderbuffersEXT(1, &rb);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
|
||||
glGenRenderbuffers_func(1, &rb);
|
||||
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
|
||||
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
|
||||
GL_DEPTH24_STENCIL8_EXT,
|
||||
width, height);
|
||||
if (glGetError())
|
||||
@@ -333,7 +333,7 @@ AttachDepthAndStencilBuffers(GLuint fbo,
|
||||
|
||||
if (bindDepthStencil) {
|
||||
/* attach to both depth and stencil at once */
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
|
||||
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
|
||||
GL_DEPTH_STENCIL_ATTACHMENT,
|
||||
GL_RENDERBUFFER_EXT, rb);
|
||||
if (glGetError())
|
||||
@@ -341,21 +341,21 @@ AttachDepthAndStencilBuffers(GLuint fbo,
|
||||
}
|
||||
else {
|
||||
/* attach to depth attachment point */
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
|
||||
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
|
||||
GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, rb);
|
||||
if (glGetError())
|
||||
return GL_FALSE;
|
||||
|
||||
/* and attach to stencil attachment point */
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
|
||||
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
|
||||
GL_STENCIL_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, rb);
|
||||
if (glGetError())
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
|
||||
return GL_FALSE;
|
||||
|
||||
@@ -367,22 +367,22 @@ AttachDepthAndStencilBuffers(GLuint fbo,
|
||||
{
|
||||
GLuint rb;
|
||||
|
||||
glGenRenderbuffersEXT(1, &rb);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
|
||||
glGenRenderbuffers_func(1, &rb);
|
||||
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
|
||||
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
|
||||
GL_DEPTH_COMPONENT,
|
||||
width, height);
|
||||
if (glGetError())
|
||||
return GL_FALSE;
|
||||
|
||||
/* attach to depth attachment point */
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
|
||||
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
|
||||
GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, rb);
|
||||
if (glGetError())
|
||||
return GL_FALSE;
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT)
|
||||
return GL_FALSE;
|
||||
|
||||
@@ -393,26 +393,26 @@ AttachDepthAndStencilBuffers(GLuint fbo,
|
||||
{
|
||||
GLuint rb;
|
||||
|
||||
glGenRenderbuffersEXT(1, &rb);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT,
|
||||
glGenRenderbuffers_func(1, &rb);
|
||||
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, rb);
|
||||
glRenderbufferStorage_func(GL_RENDERBUFFER_EXT,
|
||||
GL_STENCIL_INDEX,
|
||||
width, height);
|
||||
if (glGetError())
|
||||
return GL_FALSE;
|
||||
|
||||
/* attach to depth attachment point */
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT,
|
||||
glFramebufferRenderbuffer_func(GL_FRAMEBUFFER_EXT,
|
||||
GL_STENCIL_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, rb);
|
||||
if (glGetError())
|
||||
return GL_FALSE;
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
status = glCheckFramebufferStatus_func(GL_FRAMEBUFFER_EXT);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
glDeleteRenderbuffersEXT(1, depthRbOut);
|
||||
glDeleteRenderbuffers_func(1, depthRbOut);
|
||||
*depthRbOut = 0;
|
||||
glDeleteRenderbuffersEXT(1, &rb);
|
||||
glDeleteRenderbuffers_func(1, &rb);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
@@ -463,6 +463,37 @@ ParseArgs(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
SetupFunctionPointers(void)
|
||||
{
|
||||
GetExtensionFuncs();
|
||||
|
||||
if (Use_ARB_fbo) {
|
||||
/* no-op: use the ARB functions as-is */
|
||||
}
|
||||
else {
|
||||
/* set the ARB-flavor function pointers to point to the EXT functions */
|
||||
glIsRenderbuffer_func = glIsRenderbufferEXT_func;
|
||||
glBindRenderbuffer_func = glBindRenderbufferEXT_func;
|
||||
glDeleteRenderbuffers_func = glDeleteRenderbuffersEXT_func;
|
||||
glGenRenderbuffers_func = glGenRenderbuffersEXT_func;
|
||||
glRenderbufferStorage_func = glRenderbufferStorageEXT_func;
|
||||
glGetRenderbufferParameteriv_func = glGetRenderbufferParameterivEXT_func;
|
||||
glIsFramebuffer_func = glIsFramebufferEXT_func;
|
||||
glBindFramebuffer_func = glBindFramebufferEXT_func;
|
||||
glDeleteFramebuffers_func = glDeleteFramebuffersEXT_func;
|
||||
glGenFramebuffers_func = glGenFramebuffersEXT_func;
|
||||
glCheckFramebufferStatus_func = glCheckFramebufferStatusEXT_func;
|
||||
glFramebufferTexture1D_func = glFramebufferTexture1DEXT_func;
|
||||
glFramebufferTexture2D_func = glFramebufferTexture2DEXT_func;
|
||||
glFramebufferTexture3D_func = glFramebufferTexture3DEXT_func;
|
||||
glFramebufferRenderbuffer_func = glFramebufferRenderbufferEXT_func;
|
||||
glGetFramebufferAttachmentParameteriv_func = glGetFramebufferAttachmentParameterivEXT_func;
|
||||
glGenerateMipmap_func = glGenerateMipmapEXT_func;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Make FBO to render into given texture.
|
||||
*/
|
||||
@@ -472,10 +503,10 @@ MakeFBO_RenderTexture(GLuint TexObj)
|
||||
GLuint fb;
|
||||
GLint sizeFudge = 0;
|
||||
|
||||
glGenFramebuffersEXT(1, &fb);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb);
|
||||
glGenFramebuffers_func(1, &fb);
|
||||
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, fb);
|
||||
/* Render color to texture */
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
glFramebufferTexture2D_func(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
TexTarget, TexObj, TextureLevel);
|
||||
|
||||
if (Use_ARB_fbo) {
|
||||
@@ -512,26 +543,26 @@ MakeFBO_RenderTexture(GLuint TexObj)
|
||||
{
|
||||
GLint bits, w, h;
|
||||
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRB);
|
||||
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
|
||||
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, DepthRB);
|
||||
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
|
||||
GL_RENDERBUFFER_WIDTH_EXT, &w);
|
||||
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
|
||||
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
|
||||
GL_RENDERBUFFER_HEIGHT_EXT, &h);
|
||||
printf("Color/Texture size: %d x %d\n", TexWidth, TexHeight);
|
||||
printf("Depth buffer size: %d x %d\n", w, h);
|
||||
|
||||
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
|
||||
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
|
||||
GL_RENDERBUFFER_DEPTH_SIZE_EXT, &bits);
|
||||
printf("Depth renderbuffer size = %d bits\n", bits);
|
||||
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, StencilRB);
|
||||
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT,
|
||||
glBindRenderbuffer_func(GL_RENDERBUFFER_EXT, StencilRB);
|
||||
glGetRenderbufferParameteriv_func(GL_RENDERBUFFER_EXT,
|
||||
GL_RENDERBUFFER_STENCIL_SIZE_EXT, &bits);
|
||||
printf("Stencil renderbuffer size = %d bits\n", bits);
|
||||
}
|
||||
|
||||
/* bind the regular framebuffer */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glBindFramebuffer_func(GL_FRAMEBUFFER_EXT, 0);
|
||||
|
||||
return fb;
|
||||
}
|
||||
@@ -547,6 +578,8 @@ Init(void)
|
||||
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
||||
SetupFunctionPointers();
|
||||
|
||||
/* lighting */
|
||||
{
|
||||
static const GLfloat mat[4] = { 1.0, 0.5, 0.5, 1.0 };
|
||||
@@ -605,7 +638,6 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(Width, Height);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Display);
|
||||
|
@@ -583,10 +583,14 @@ ParseOptions(int argc, char *argv[])
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-fs") == 0) {
|
||||
FragProgFile = argv[i+1];
|
||||
FragProgFile = argv[++i];
|
||||
}
|
||||
else if (strcmp(argv[i], "-vs") == 0) {
|
||||
VertProgFile = argv[i+1];
|
||||
VertProgFile = argv[++i];
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "unknown option %s\n", argv[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -514,12 +514,27 @@ static void draw_surface( unsigned int with_state )
|
||||
break;
|
||||
|
||||
case (GLVERTEX|STRIPS):
|
||||
glBegin( GL_TRIANGLE_STRIP );
|
||||
for (i=0;i<numverts;i++) {
|
||||
glNormal3fv( &data[i][3] );
|
||||
glVertex3fv( &data[i][0] );
|
||||
if (with_state & MATERIALS) {
|
||||
glBegin( GL_TRIANGLE_STRIP );
|
||||
for (i=0;i<numverts;i++) {
|
||||
if (i % 600 == 0 && i != 0) {
|
||||
unsigned j = i / 600;
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, col[j]);
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, col[j]);
|
||||
}
|
||||
glNormal3fv( &data[i][3] );
|
||||
glVertex3fv( &data[i][0] );
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
else {
|
||||
glBegin( GL_TRIANGLE_STRIP );
|
||||
for (i=0;i<numverts;i++) {
|
||||
glNormal3fv( &data[i][3] );
|
||||
glVertex3fv( &data[i][0] );
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
glEnd();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@@ -11,7 +11,20 @@ env.Prepend(CPPPATH = [
|
||||
|
||||
env.Prepend(LIBS = ['$GLUT_LIB'])
|
||||
|
||||
env.Program(
|
||||
target = 'fp-tri',
|
||||
source = ['fp-tri.c'],
|
||||
progs = [
|
||||
'fp-tri',
|
||||
'tri-depth',
|
||||
'tri-depth2',
|
||||
'tri-depthwrite',
|
||||
'tri-depthwrite2',
|
||||
'tri-inv',
|
||||
'tri-param',
|
||||
'tri-tex',
|
||||
'point-position',
|
||||
]
|
||||
|
||||
for prog in progs:
|
||||
env.Program(
|
||||
target = prog,
|
||||
source = [prog + '.c'],
|
||||
)
|
||||
|
@@ -89,7 +89,7 @@ static void Init( void )
|
||||
}
|
||||
fprintf(stderr, "%.*s\n", sz, buf);
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
@@ -2,9 +2,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#include "GL/gl.h"
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +16,7 @@ static void Init( void )
|
||||
;
|
||||
GLuint modulateProg;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -109,6 +108,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -2,9 +2,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#include "GL/gl.h"
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +18,7 @@ static void Init( void )
|
||||
;
|
||||
GLuint modulateProg;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -89,8 +88,6 @@ int main(int argc, char **argv)
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB;
|
||||
@@ -101,6 +98,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -2,9 +2,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#include "GL/gl.h"
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +20,7 @@ static void Init( void )
|
||||
;
|
||||
GLuint modulateProg;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -106,6 +105,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ static void Init(void)
|
||||
;
|
||||
GLuint modulateProg;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -97,6 +97,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ static void Init(void)
|
||||
;
|
||||
GLuint modulateProg;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -97,6 +97,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ static void Init( void )
|
||||
;
|
||||
GLuint modulateProg;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -99,6 +99,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -2,9 +2,9 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#include "GL/gl.h"
|
||||
|
||||
|
||||
static void Init( void )
|
||||
{
|
||||
@@ -15,7 +15,7 @@ static void Init( void )
|
||||
;
|
||||
GLuint modulateProg;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -104,6 +104,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "readtex.c"
|
||||
@@ -23,7 +23,7 @@ static void Init( void )
|
||||
GLuint modulateProg;
|
||||
GLuint Texture;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_fragment_program")) {
|
||||
if (!GLEW_ARB_fragment_program) {
|
||||
printf("Error: GL_ARB_fragment_program not supported!\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -120,6 +120,8 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
|
@@ -10,7 +10,7 @@ LIB_DEP = \
|
||||
$(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \
|
||||
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
|
||||
|
||||
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
|
||||
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
|
||||
|
||||
INCLUDE_DIRS = -I$(TOP)/progs/util
|
||||
|
||||
@@ -80,25 +80,26 @@ clean:
|
||||
-rm -f *.o *~
|
||||
-rm -f extfuncs.h
|
||||
-rm -f shaderutil.*
|
||||
-rm -f readtex.*
|
||||
|
||||
|
||||
|
||||
##### Extra dependencies
|
||||
|
||||
extfuncs.h:
|
||||
cp $(TOP)/progs/util/extfuncs.h .
|
||||
extfuncs.h: $(TOP)/progs/util/extfuncs.h
|
||||
cp $< .
|
||||
|
||||
readtex.c:
|
||||
cp $(TOP)/progs/util/readtex.c .
|
||||
readtex.c: $(TOP)/progs/util/readtex.c
|
||||
cp $< .
|
||||
|
||||
readtex.h:
|
||||
cp $(TOP)/progs/util/readtex.h .
|
||||
readtex.h: $(TOP)/progs/util/readtex.h
|
||||
cp $< .
|
||||
|
||||
shaderutil.c:
|
||||
cp $(TOP)/progs/util/shaderutil.c .
|
||||
shaderutil.c: $(TOP)/progs/util/shaderutil.c
|
||||
cp $< .
|
||||
|
||||
shaderutil.h:
|
||||
cp $(TOP)/progs/util/shaderutil.h .
|
||||
shaderutil.h: $(TOP)/progs/util/shaderutil.h
|
||||
cp $< .
|
||||
|
||||
|
||||
|
||||
|
55
progs/glsl/SConscript
Normal file
55
progs/glsl/SConscript
Normal file
@@ -0,0 +1,55 @@
|
||||
Import('*')
|
||||
|
||||
if not env['GLUT']:
|
||||
Return()
|
||||
|
||||
env = env.Clone()
|
||||
|
||||
env.Prepend(CPPPATH = [
|
||||
'../util',
|
||||
])
|
||||
|
||||
env.Prepend(LIBS = [
|
||||
util,
|
||||
'$GLUT_LIB'
|
||||
])
|
||||
|
||||
if env['platform'] == 'windows':
|
||||
env.Append(CPPDEFINES = ['NOMINMAX'])
|
||||
env.Prepend(LIBS = ['winmm'])
|
||||
|
||||
progs = [
|
||||
'array',
|
||||
'bitmap',
|
||||
'brick',
|
||||
'bump',
|
||||
'convolutions',
|
||||
'deriv',
|
||||
'fragcoord',
|
||||
'identity',
|
||||
'linktest',
|
||||
'mandelbrot',
|
||||
'multinoise',
|
||||
'multitex',
|
||||
'noise',
|
||||
'noise2',
|
||||
'pointcoord',
|
||||
'points',
|
||||
'samplers',
|
||||
'shadow_sampler',
|
||||
'skinning',
|
||||
'texaaline',
|
||||
'texdemo1',
|
||||
'toyball',
|
||||
'trirast',
|
||||
'twoside',
|
||||
'vert-or-frag-only',
|
||||
'vert-tex',
|
||||
]
|
||||
|
||||
for prog in progs:
|
||||
env.Program(
|
||||
target = prog,
|
||||
source = prog + '.c',
|
||||
)
|
||||
|
@@ -9,9 +9,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
@@ -248,6 +248,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(500, 500);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -309,6 +310,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -191,6 +192,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(400, 400);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
|
@@ -288,6 +288,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(400, 400);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
|
@@ -5,6 +5,8 @@
|
||||
* Author: Zack Rusin
|
||||
*/
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include "readtex.h"
|
||||
|
||||
@@ -455,6 +457,7 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glewInit();
|
||||
init();
|
||||
|
||||
glutReshapeFunc(reshape);
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -228,6 +229,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(200, 200);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -174,6 +175,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Redisplay);
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -195,6 +196,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(200, 200);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -245,6 +246,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(300, 300);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Redisplay);
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -206,6 +207,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(400, 400);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -270,6 +271,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(400, 400);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <GL/glew.h>
|
||||
#include "GL/glut.h"
|
||||
#include "readtex.h"
|
||||
#include "extfuncs.h"
|
||||
@@ -271,9 +272,24 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
|
||||
|
||||
InitUniforms(program, uniforms);
|
||||
|
||||
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
|
||||
if (VertCoord_attr > 0) {
|
||||
/* We want the VertCoord attrib to have position zero so that
|
||||
* the call to glVertexAttrib(0, xyz) triggers vertex processing.
|
||||
* Otherwise, if TexCoord0 or TexCoord1 gets position 0 we'd have
|
||||
* to set that attribute last (which is a PITA to manage).
|
||||
*/
|
||||
glBindAttribLocation_func(program, 0, "VertCoord");
|
||||
/* re-link */
|
||||
glLinkProgram_func(program);
|
||||
/* VertCoord_attr should be zero now */
|
||||
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
|
||||
assert(VertCoord_attr == 0);
|
||||
}
|
||||
|
||||
TexCoord0_attr = glGetAttribLocation_func(program, "TexCoord0");
|
||||
TexCoord1_attr = glGetAttribLocation_func(program, "TexCoord1");
|
||||
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
|
||||
|
||||
printf("TexCoord0_attr = %d\n", TexCoord0_attr);
|
||||
printf("TexCoord1_attr = %d\n", TexCoord1_attr);
|
||||
printf("VertCoord_attr = %d\n", VertCoord_attr);
|
||||
@@ -319,6 +335,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(500, 400);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
|
||||
glutCreateWindow(Demo);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(key);
|
||||
glutSpecialFunc(specialkey);
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -207,6 +208,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(400, 400);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -195,6 +196,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Redisplay);
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -248,6 +249,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
|
@@ -11,6 +11,7 @@ void main()
|
||||
float two_n_dot_u = 2.0 * dot(n, u);
|
||||
vec4 f;
|
||||
f.xyz = u - n * two_n_dot_u;
|
||||
f.w = 1.0;
|
||||
|
||||
// outputs
|
||||
normal = n;
|
||||
|
@@ -39,6 +39,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <GL/glew.h>
|
||||
#include "GL/glut.h"
|
||||
#include "readtex.h"
|
||||
#include "extfuncs.h"
|
||||
@@ -357,6 +358,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(500, 400);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
|
||||
glutCreateWindow(Demo);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(key);
|
||||
glutSpecialFunc(specialkey);
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -329,6 +330,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(400, 300);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Redisplay);
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -266,6 +267,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(500, 500);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -359,6 +360,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Redisplay);
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <GL/glew.h>
|
||||
#include "GL/glut.h"
|
||||
#include "readtex.h"
|
||||
#include "extfuncs.h"
|
||||
@@ -426,6 +427,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(500, 400);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
|
||||
win = glutCreateWindow(Demo);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(key);
|
||||
glutSpecialFunc(specialkey);
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -212,6 +213,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(400, 400);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -247,6 +248,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Redisplay);
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -293,6 +294,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Redisplay);
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -181,6 +182,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(400, 200);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Redisplay);
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
@@ -266,6 +267,7 @@ main(int argc, char *argv[])
|
||||
glutInitWindowSize(500, 500);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
|
4
progs/tests/.gitignore
vendored
4
progs/tests/.gitignore
vendored
@@ -55,6 +55,7 @@ multipal
|
||||
no_s3tc
|
||||
packedpixels
|
||||
pbo
|
||||
prim
|
||||
prog_parameter
|
||||
quads
|
||||
random
|
||||
@@ -62,6 +63,8 @@ readrate
|
||||
readtex.c
|
||||
readtex.h
|
||||
rubberband
|
||||
scissor
|
||||
scissor-viewport
|
||||
seccolor
|
||||
shader_api
|
||||
shaderutil.c
|
||||
@@ -75,6 +78,7 @@ subtex
|
||||
subtexrate
|
||||
tex1d
|
||||
texcompress2
|
||||
texcompsub
|
||||
texdown
|
||||
texfilt
|
||||
texline
|
||||
|
@@ -70,6 +70,8 @@ SOURCES = \
|
||||
random.c \
|
||||
readrate.c \
|
||||
rubberband.c \
|
||||
scissor.c \
|
||||
scissor-viewport.c \
|
||||
seccolor.c \
|
||||
shader_api.c \
|
||||
sharedtex.c \
|
||||
@@ -81,6 +83,7 @@ SOURCES = \
|
||||
subtexrate.c \
|
||||
tex1d.c \
|
||||
texcompress2.c \
|
||||
texcompsub.c \
|
||||
texdown \
|
||||
texfilt.c \
|
||||
texline.c \
|
||||
|
@@ -95,6 +95,8 @@ progs = [
|
||||
'random',
|
||||
'readrate',
|
||||
'rubberband',
|
||||
'scissor',
|
||||
'scissor-viewport',
|
||||
'seccolor',
|
||||
'shader_api',
|
||||
'stencil_twoside',
|
||||
@@ -106,6 +108,7 @@ progs = [
|
||||
'tex1d',
|
||||
'texcmp',
|
||||
'texcompress2',
|
||||
'texcompsub',
|
||||
'texdown',
|
||||
'texfilt',
|
||||
'texgenmix',
|
||||
|
138
progs/tests/scissor-viewport.c
Normal file
138
progs/tests/scissor-viewport.c
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
* Copyright (c) 2009 VMware, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
struct program
|
||||
{
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
int i;
|
||||
};
|
||||
|
||||
struct program prog;
|
||||
|
||||
static void init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
fflush(stderr);
|
||||
|
||||
prog.i = 0;
|
||||
}
|
||||
|
||||
static void reshape(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, 100, 100);
|
||||
|
||||
prog.width = width;
|
||||
prog.height = height;
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
glutPostRedisplay();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void drawQuad(void)
|
||||
{
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2d(-1.0, -1.0);
|
||||
glVertex2d( 1.0, -1.0);
|
||||
glVertex2d( 1.0, 1.0);
|
||||
glVertex2d(-1.0, 1.0);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
static void draw(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
i = prog.i++;
|
||||
if (prog.i >= 3)
|
||||
prog.i = 0;
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
{
|
||||
glColor4d(1.0, 0.0, 0.0, 1.0);
|
||||
|
||||
glScissor(i, i, 10 - 2*i, 10 - 2*i);
|
||||
drawQuad();
|
||||
}
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
//glutSwapBuffers();
|
||||
glFlush();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
prog.width = 200;
|
||||
prog.height = 200;
|
||||
|
||||
glutInitWindowPosition(100, 0);
|
||||
glutInitWindowSize(prog.width, prog.height);
|
||||
|
||||
//type = GLUT_RGB | GLUT_DOUBLE;
|
||||
type = GLUT_RGB | GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
glutReshapeFunc(reshape);
|
||||
glutKeyboardFunc(key);
|
||||
glutDisplayFunc(draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
168
progs/tests/scissor.c
Normal file
168
progs/tests/scissor.c
Normal file
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
* Copyright (c) 2009 VMware, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
struct program
|
||||
{
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
unsigned quads;
|
||||
};
|
||||
|
||||
struct program prog;
|
||||
|
||||
static void init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
static void reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
prog.width = width;
|
||||
prog.height = height;
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
prog.quads = !prog.quads;
|
||||
glutPostRedisplay();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void drawQuad(void)
|
||||
{
|
||||
|
||||
if (prog.quads) {
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2d(-1.0, -1.0);
|
||||
glVertex2d( 1.0, -1.0);
|
||||
glVertex2d( 1.0, 1.0);
|
||||
glVertex2d(-1.0, 1.0);
|
||||
glEnd();
|
||||
} else {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
static void draw(void)
|
||||
{
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
printf("drawing with %s\n", prog.quads ? "quads" : "clears");
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
{
|
||||
glClearColor(1.0, 0.0, 0.0, 1.0);
|
||||
glColor4d(1.0, 0.0, 0.0, 1.0);
|
||||
|
||||
glScissor(1, 1, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(1, prog.height - 11, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(prog.width - 11, prog.height - 11, 10, 10);
|
||||
drawQuad();
|
||||
}
|
||||
|
||||
{
|
||||
glClearColor(0.0, 1.0, 0.0, 1.0);
|
||||
glColor4d(0.0, 1.0, 0.0, 1.0);
|
||||
|
||||
glScissor(12, 1, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(12, prog.height - 11, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(prog.width - 22, prog.height - 11, 10, 10);
|
||||
drawQuad();
|
||||
}
|
||||
|
||||
{
|
||||
glClearColor(1.0, 1.0, 0.0, 1.0);
|
||||
glColor4d(1.0, 1.0, 0.0, 1.0);
|
||||
|
||||
glScissor(1, 12, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(1, prog.height - 22, 10, 10);
|
||||
drawQuad();
|
||||
glScissor(prog.width - 11, prog.height - 22, 10, 10);
|
||||
drawQuad();
|
||||
}
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
//glutSwapBuffers();
|
||||
glFlush();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
prog.width = 200;
|
||||
prog.height = 200;
|
||||
|
||||
glutInitWindowPosition(100, 0);
|
||||
glutInitWindowSize(prog.width, prog.height);
|
||||
|
||||
//type = GLUT_RGB | GLUT_DOUBLE;
|
||||
type = GLUT_RGB | GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
glutReshapeFunc(reshape);
|
||||
glutKeyboardFunc(key);
|
||||
glutDisplayFunc(draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
4100
progs/tests/texcomp_image.h
Normal file
4100
progs/tests/texcomp_image.h
Normal file
File diff suppressed because it is too large
Load Diff
165
progs/tests/texcompsub.c
Normal file
165
progs/tests/texcompsub.c
Normal file
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* Test texture compression.
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "texcomp_image.h"
|
||||
|
||||
static int ImgWidth = 512;
|
||||
static int ImgHeight = 512;
|
||||
static GLenum CompFormat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
|
||||
static GLfloat EyeDist = 5.0;
|
||||
static GLfloat Rot = 0.0;
|
||||
const GLenum Target = GL_TEXTURE_2D;
|
||||
|
||||
|
||||
static void
|
||||
CheckError(int line)
|
||||
{
|
||||
GLenum err = glGetError();
|
||||
if (err) {
|
||||
printf("GL Error %d at line %d\n", (int) err, line);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
LoadCompressedImage(void)
|
||||
{
|
||||
const GLenum filter = GL_LINEAR;
|
||||
glTexImage2D(Target, 0, CompFormat, ImgWidth, ImgHeight, 0,
|
||||
GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
||||
|
||||
/* bottom half */
|
||||
glCompressedTexSubImage2DARB(Target, 0,
|
||||
0, 0, /* pos */
|
||||
ImgWidth, ImgHeight / 2,
|
||||
CompFormat, ImgSize / 2, ImgData + ImgSize / 2);
|
||||
/* top half */
|
||||
glCompressedTexSubImage2DARB(Target, 0,
|
||||
0, ImgHeight / 2, /* pos */
|
||||
ImgWidth, ImgHeight / 2,
|
||||
CompFormat, ImgSize / 2, ImgData);
|
||||
|
||||
glTexParameteri(Target, GL_TEXTURE_MIN_FILTER, filter);
|
||||
glTexParameteri(Target, GL_TEXTURE_MAG_FILTER, filter);
|
||||
}
|
||||
|
||||
static void
|
||||
Init()
|
||||
{
|
||||
GLint numFormats, formats[100];
|
||||
GLint p;
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_texture_compression")) {
|
||||
printf("Sorry, GL_ARB_texture_compression is required.\n");
|
||||
exit(1);
|
||||
}
|
||||
if (!glutExtensionSupported("GL_EXT_texture_compression_s3tc")) {
|
||||
printf("Sorry, GL_EXT_texture_compression_s3tc is required.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
||||
glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, &numFormats);
|
||||
glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS_ARB, formats);
|
||||
printf("%d supported compression formats: ", numFormats);
|
||||
for (p = 0; p < numFormats; p++)
|
||||
printf("0x%x ", formats[p]);
|
||||
printf("\n");
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
LoadCompressedImage();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape( int width, int height )
|
||||
{
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glFrustum(-1, 1, -1, 1, 4, 100);
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 'd':
|
||||
EyeDist -= 1.0;
|
||||
if (EyeDist < 4.0)
|
||||
EyeDist = 4.0;
|
||||
break;
|
||||
case 'D':
|
||||
EyeDist += 1.0;
|
||||
break;
|
||||
case 'z':
|
||||
Rot += 5.0;
|
||||
break;
|
||||
case 'Z':
|
||||
Rot -= 5.0;
|
||||
break;
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Draw( void )
|
||||
{
|
||||
glClearColor(0.3, 0.3, .8, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
CheckError(__LINE__);
|
||||
glPushMatrix();
|
||||
glTranslatef(0, 0, -(EyeDist+0.01));
|
||||
glRotatef(Rot, 0, 0, 1);
|
||||
glBegin(GL_POLYGON);
|
||||
glTexCoord2f(0, 0); glVertex2f(-1, -1);
|
||||
glTexCoord2f(1, 0); glVertex2f( 1, -1);
|
||||
glTexCoord2f(1, 1); glVertex2f( 1, 1);
|
||||
glTexCoord2f(0, 1); glVertex2f(-1, 1);
|
||||
glEnd();
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowSize( 600, 600 );
|
||||
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
|
||||
|
||||
glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutDisplayFunc( Draw );
|
||||
|
||||
Init();
|
||||
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
@@ -21,7 +21,7 @@ static void Display(void)
|
||||
GLfloat min, max;
|
||||
int i;
|
||||
|
||||
glClearColor(0.5, 0.5, 0.5, 0);
|
||||
glClearColor(0.5, 0.5, 0.5, 1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
/* draw a sphere */
|
||||
@@ -82,7 +82,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
const GLfloat blue[4] = {.1, .1, 1.0, 0.0};
|
||||
const GLfloat blue[4] = {.1, .1, 1.0, 1.0};
|
||||
const GLfloat gray[4] = {0.2, 0.2, 0.2, 1.0};
|
||||
const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
|
||||
const GLfloat pos[4] = {0, 0, 10, 0};
|
||||
|
@@ -19,6 +19,12 @@ SOURCES = \
|
||||
clear-random.c \
|
||||
clear.c \
|
||||
dlist-dangling.c \
|
||||
dlist-flat-tri.c \
|
||||
dlist-mat-tri.c \
|
||||
dlist-tri-flat-tri.c \
|
||||
dlist-tri-mat-tri.c \
|
||||
dlist-recursive-call.c \
|
||||
dlist-begin-call-end.c \
|
||||
dlist-edgeflag-dangling.c \
|
||||
dlist-edgeflag.c \
|
||||
dlist-degenerate.c \
|
||||
@@ -105,6 +111,7 @@ SOURCES = \
|
||||
tri-fp.c \
|
||||
tri-fp-const-imm.c \
|
||||
tri-lit.c \
|
||||
tri-lit-material.c \
|
||||
tri-mask-tri.c \
|
||||
tri-orig.c \
|
||||
tri-query.c \
|
||||
|
159
progs/trivial/dlist-begin-call-end.c
Normal file
159
progs/trivial/dlist-begin-call-end.c
Normal file
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
GLint first_list, list;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
fflush(stderr);
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
|
||||
/* First list will disrupt state which might potentially be
|
||||
* short-circuited in calling list:
|
||||
*/
|
||||
first_list = glGenLists(1);
|
||||
glNewList(first_list, GL_COMPILE);
|
||||
// glColor3f(0,1,0);
|
||||
glEndList();
|
||||
|
||||
|
||||
/* List that looks like it might have redundant state:
|
||||
*/
|
||||
list = glGenLists(1);
|
||||
glNewList(list, GL_COMPILE);
|
||||
|
||||
glShadeModel(GL_FLAT);
|
||||
glBegin(GL_TRIANGLES);
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f( -0.9, 0.9, -30.0);
|
||||
glVertex3f( -0.9, -0.9, -30.0);
|
||||
glCallList( first_list );
|
||||
glVertex3f( 0.9, 0.0, -30.0);
|
||||
glEnd();
|
||||
glEndList();
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glShadeModel( GL_SMOOTH );
|
||||
glCallList(list);
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB | GLUT_ALPHA;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
171
progs/trivial/dlist-flat-tri.c
Normal file
171
progs/trivial/dlist-flat-tri.c
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
GLint list;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
fflush(stderr);
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
|
||||
list = glGenLists(1);
|
||||
glNewList(list, GL_COMPILE);
|
||||
|
||||
/* XXX: this state-change will only be executed if list is called
|
||||
* from outside a begin/end pair:
|
||||
*/
|
||||
glShadeModel( GL_FLAT );
|
||||
glBegin(GL_TRIANGLES);
|
||||
glColor3f(0,0,.7);
|
||||
glVertex3f( -0.9, 0.9, -30.0);
|
||||
glColor3f(0,.9,0);
|
||||
glVertex3f( -0.9, -0.9, -30.0);
|
||||
glColor3f(.8,0,0);
|
||||
glVertex3f( 0.9, 0.0, -30.0);
|
||||
glEnd();
|
||||
|
||||
/* This statechange is potentially NOT redundant:
|
||||
*/
|
||||
glShadeModel( GL_FLAT );
|
||||
glBegin(GL_TRIANGLES);
|
||||
glColor3f(0,1,0);
|
||||
glVertex3f( -0.5, 0.5, -30.0);
|
||||
glColor3f(0,0,1);
|
||||
glVertex3f( -0.5, -0.5, -30.0);
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f( 0.5, 0.0, -30.0);
|
||||
glEnd();
|
||||
|
||||
glEndList();
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glShadeModel( GL_SMOOTH );
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
/* Note: call the list from inside a begin/end pair. The end is
|
||||
* provided by the display list...
|
||||
*/
|
||||
glCallList(list);
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB | GLUT_ALPHA;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
182
progs/trivial/dlist-mat-tri.c
Normal file
182
progs/trivial/dlist-mat-tri.c
Normal file
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
GLint list;
|
||||
|
||||
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
|
||||
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
|
||||
/*static GLfloat blue[4] = {0.2, 0.2, .7, 1.0};*/
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
fflush(stderr);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
|
||||
list = glGenLists(1);
|
||||
glNewList(list, GL_COMPILE);
|
||||
|
||||
/* XXX: this state-change will be executed regardless of whether
|
||||
* the list is called from outside a begin/end pair:
|
||||
*/
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT, red);
|
||||
glBegin(GL_TRIANGLES);
|
||||
glVertex3f( -0.9, 0.9, -30.0);
|
||||
glVertex3f( -0.9, -0.9, -30.0);
|
||||
glVertex3f( 0.9, 0.0, -30.0);
|
||||
glEnd();
|
||||
|
||||
glMaterialfv(GL_FRONT, GL_DIFFUSE, red);
|
||||
glBegin(GL_TRIANGLES);
|
||||
glVertex3f( -0.7, 0.7, -30.0);
|
||||
glVertex3f( -0.7, -0.7, -30.0);
|
||||
glVertex3f( 0.7, 0.0, -30.0);
|
||||
glEnd();
|
||||
|
||||
/* This statechange is redundant:
|
||||
*/
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
|
||||
glBegin(GL_TRIANGLES);
|
||||
glVertex3f( -0.5, 0.5, -30.0);
|
||||
glVertex3f( -0.5, -0.5, -30.0);
|
||||
glVertex3f( 0.5, 0.0, -30.0);
|
||||
glEnd();
|
||||
|
||||
glEndList();
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glShadeModel( GL_SMOOTH );
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
/* Note: call the list from inside a begin/end pair. The end is
|
||||
* provided by the display list...
|
||||
*/
|
||||
glCallList(list);
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB | GLUT_ALPHA;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
190
progs/trivial/dlist-recursive-call.c
Normal file
190
progs/trivial/dlist-recursive-call.c
Normal file
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
GLint first_list, list;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
fflush(stderr);
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
|
||||
/* First list will disrupt state which might potentially be
|
||||
* short-circuited in calling list:
|
||||
*/
|
||||
first_list = glGenLists(1);
|
||||
glNewList(first_list, GL_COMPILE);
|
||||
glShadeModel( GL_SMOOTH );
|
||||
glEndList();
|
||||
|
||||
|
||||
/* List that looks like it might have redundant state:
|
||||
*/
|
||||
list = glGenLists(1);
|
||||
glNewList(list, GL_COMPILE);
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
glColor3f(0,0,.7);
|
||||
glVertex3f( 0.9, -0.9, -30.0);
|
||||
glColor3f(.8,0,0);
|
||||
glVertex3f( 0.9, 0.9, -30.0);
|
||||
glColor3f(0,.9,0);
|
||||
glVertex3f(-0.9, 0.0, -30.0);
|
||||
glEnd();
|
||||
|
||||
glShadeModel( GL_FLAT );
|
||||
glBegin(GL_TRIANGLES);
|
||||
glColor3f(0,0,.7);
|
||||
glVertex3f( -0.9, 0.9, -30.0);
|
||||
glColor3f(0,.9,0);
|
||||
glVertex3f( -0.9, -0.9, -30.0);
|
||||
glColor3f(.8,0,0);
|
||||
glVertex3f( 0.9, 0.0, -30.0);
|
||||
glEnd();
|
||||
|
||||
glCallList( first_list );
|
||||
|
||||
/* Do a quick begin/end to ensure we are not inside a dangling
|
||||
* primitive from the called list:
|
||||
*/
|
||||
glBegin( GL_POINTS );
|
||||
glEnd();
|
||||
|
||||
/* This statechange is NOT redundant:
|
||||
*/
|
||||
glShadeModel( GL_FLAT );
|
||||
glBegin(GL_TRIANGLES);
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f( -0.5, 0.5, -30.0);
|
||||
glColor3f(0,1,0);
|
||||
glVertex3f( -0.5, -0.5, -30.0);
|
||||
glColor3f(0,0,1);
|
||||
glVertex3f( 0.5, 0.0, -30.0);
|
||||
glEnd();
|
||||
|
||||
glEndList();
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glShadeModel( GL_SMOOTH );
|
||||
glCallList(list);
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB | GLUT_ALPHA;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
171
progs/trivial/dlist-tri-flat-tri.c
Normal file
171
progs/trivial/dlist-tri-flat-tri.c
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
GLint list;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
fflush(stderr);
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
|
||||
list = glGenLists(1);
|
||||
glNewList(list, GL_COMPILE);
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
glColor3f(0,0,.7);
|
||||
glVertex3f( 0.9, -0.9, -30.0);
|
||||
glColor3f(.8,0,0);
|
||||
glVertex3f( 0.9, 0.9, -30.0);
|
||||
glColor3f(0,.9,0);
|
||||
glVertex3f(-0.9, 0.0, -30.0);
|
||||
glEnd();
|
||||
|
||||
glShadeModel( GL_FLAT );
|
||||
glBegin(GL_TRIANGLES);
|
||||
glColor3f(0,0,.7);
|
||||
glVertex3f( -0.9, 0.9, -30.0);
|
||||
glColor3f(0,.9,0);
|
||||
glVertex3f( -0.9, -0.9, -30.0);
|
||||
glColor3f(.8,0,0);
|
||||
glVertex3f( 0.9, 0.0, -30.0);
|
||||
glEnd();
|
||||
|
||||
/* This statechange is redundant:
|
||||
*/
|
||||
glShadeModel( GL_FLAT );
|
||||
glBegin(GL_TRIANGLES);
|
||||
glColor3f(1,0,0);
|
||||
glVertex3f( -0.5, 0.5, -30.0);
|
||||
glColor3f(0,1,0);
|
||||
glVertex3f( -0.5, -0.5, -30.0);
|
||||
glColor3f(0,0,1);
|
||||
glVertex3f( 0.5, 0.0, -30.0);
|
||||
glEnd();
|
||||
|
||||
glEndList();
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glShadeModel( GL_SMOOTH );
|
||||
glCallList(list);
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB | GLUT_ALPHA;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
174
progs/trivial/dlist-tri-mat-tri.c
Normal file
174
progs/trivial/dlist-tri-mat-tri.c
Normal file
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
GLint list;
|
||||
|
||||
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
|
||||
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
|
||||
static GLfloat blue[4] = {0.2, 0.2, .9, 1.0};
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
fflush(stderr);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
|
||||
list = glGenLists(1);
|
||||
glNewList(list, GL_COMPILE);
|
||||
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
glNormal3f(0,0,.7);
|
||||
glVertex3f( 0.9, -0.9, -30.0);
|
||||
glVertex3f( 0.9, 0.9, -30.0);
|
||||
glVertex3f(-0.9, 0.0, -30.0);
|
||||
glEnd();
|
||||
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
glVertex3f( -0.9, 0.9, -30.0);
|
||||
glVertex3f( -0.9, -0.9, -30.0);
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
|
||||
glVertex3f( 0.9, 0.0, -30.0);
|
||||
glEnd();
|
||||
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
|
||||
glBegin(GL_TRIANGLES);
|
||||
glVertex3f( -0.5, 0.5, -30.0);
|
||||
glVertex3f( -0.5, -0.5, -30.0);
|
||||
glVertex3f( 0.5, 0.0, -30.0);
|
||||
glEnd();
|
||||
|
||||
glEndList();
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glShadeModel( GL_SMOOTH );
|
||||
glCallList(list);
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB | GLUT_ALPHA;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
149
progs/trivial/tri-lit-material.c
Normal file
149
progs/trivial/tri-lit-material.c
Normal file
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the name of
|
||||
* Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
|
||||
* ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define CI_OFFSET_1 16
|
||||
#define CI_OFFSET_2 32
|
||||
|
||||
|
||||
GLenum doubleBuffer;
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
fflush(stderr);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
||||
glClearColor(0.0, 0.0, 1.0, 0.0);
|
||||
}
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
/* glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
static void Draw(void)
|
||||
{
|
||||
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0};
|
||||
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0};
|
||||
static GLfloat blue[4] = {0.2, 0.2, .9, 1.0};
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
|
||||
glNormal3f(0,0,.7);
|
||||
glVertex3f( 0.9, -0.9, -0.0);
|
||||
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
|
||||
glNormal3f(0,0,.8);
|
||||
glVertex3f( 0.9, 0.9, -0.0);
|
||||
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
|
||||
glNormal3f(0,0,.9);
|
||||
glVertex3f(-0.9, 0.0, -0.0);
|
||||
glEnd();
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum Args(int argc, char **argv)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
doubleBuffer = GL_FALSE;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-sb") == 0) {
|
||||
doubleBuffer = GL_FALSE;
|
||||
} else if (strcmp(argv[i], "-db") == 0) {
|
||||
doubleBuffer = GL_TRUE;
|
||||
} else {
|
||||
fprintf(stderr, "%s (Bad option).\n", argv[i]);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
GLenum type;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
|
||||
if (Args(argc, argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
|
||||
|
||||
type = GLUT_RGB | GLUT_ALPHA;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
glutInitDisplayMode(type);
|
||||
|
||||
if (glutCreateWindow(*argv) == GL_FALSE) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Init();
|
||||
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
@@ -57,13 +57,19 @@ static struct { GLenum func; const char *str; } funcs[] =
|
||||
|
||||
static int curFunc = 0;
|
||||
static double clearVal = 1.0;
|
||||
|
||||
static float minZ = 0.0;
|
||||
static float maxZ = 1.0;
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
printf("t - toggle rendering order of triangles\n");
|
||||
printf("c - toggle Z clear value between 0, 1\n");
|
||||
printf("f - cycle through depth test functions\n");
|
||||
printf("t - toggle rendering order of triangles\n");
|
||||
printf("c - toggle Z clear value between 0, 1\n");
|
||||
printf("f - cycle through depth test functions\n");
|
||||
printf("n/N - decrease/increase depthrange minZ\n");
|
||||
printf("x/X - decrease/increase depthrange maxZ\n");
|
||||
printf("spc - reset\n");
|
||||
printf("z - set to reverse-direction (ztrick) mode\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
@@ -97,9 +103,11 @@ static void drawRightTriangle(void)
|
||||
|
||||
void display(void)
|
||||
{
|
||||
printf("GL_CLEAR_DEPTH = %f GL_DEPTH_FUNC = %s\n",
|
||||
clearVal, funcs[curFunc].str);
|
||||
printf("GL_CLEAR_DEPTH = %.2f, GL_DEPTH_FUNC = %s, DepthRange(%.1f, %.1f)\n",
|
||||
clearVal, funcs[curFunc].str, minZ, maxZ);
|
||||
fflush(stdout);
|
||||
glClearDepth(clearVal);
|
||||
glDepthRange(minZ, maxZ);
|
||||
glDepthFunc(funcs[curFunc].func);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
@@ -131,27 +139,49 @@ void reshape(int w, int h)
|
||||
void keyboard(unsigned char key, int x, int y)
|
||||
{
|
||||
switch (key) {
|
||||
case 'n':
|
||||
minZ -= .1;
|
||||
break;
|
||||
case 'N':
|
||||
minZ += .1;
|
||||
break;
|
||||
case 'x':
|
||||
maxZ -= .1;
|
||||
break;
|
||||
case 'X':
|
||||
maxZ += .1;
|
||||
break;
|
||||
case 'c':
|
||||
case 'C':
|
||||
clearVal = 1.0 - clearVal;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 'f':
|
||||
case 'F':
|
||||
curFunc = (curFunc + 1) % NUM_FUNCS;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 't':
|
||||
case 'T':
|
||||
leftFirst = !leftFirst;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case ' ':
|
||||
curFunc = 0;
|
||||
clearVal = 1.0;
|
||||
minZ = 0.0;
|
||||
maxZ = 1.0;
|
||||
break;
|
||||
case 'z':
|
||||
curFunc = 2;
|
||||
clearVal = 0.0;
|
||||
minZ = 1.0;
|
||||
maxZ = 0.0;
|
||||
break;
|
||||
case 27: /* Escape key */
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
/* Main Loop
|
||||
|
@@ -86,6 +86,57 @@ static PFNGLISVERTEXARRAYAPPLEPROC glIsVertexArrayAPPLE_func = NULL;
|
||||
/* GL_EXT_stencil_two_side */
|
||||
static PFNGLACTIVESTENCILFACEEXTPROC glActiveStencilFaceEXT_func = NULL;
|
||||
|
||||
/* GL_ARB_buffer_object */
|
||||
static PFNGLGENBUFFERSARBPROC glGenBuffersARB_func = NULL;
|
||||
static PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB_func = NULL;
|
||||
static PFNGLBINDBUFFERARBPROC glBindBufferARB_func = NULL;
|
||||
static PFNGLBUFFERDATAARBPROC glBufferDataARB_func = NULL;
|
||||
static PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB_func = NULL;
|
||||
static PFNGLMAPBUFFERARBPROC glMapBufferARB_func = NULL;
|
||||
static PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB_func = NULL;
|
||||
|
||||
/* GL_EXT_framebuffer_object */
|
||||
static PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT_func = NULL;
|
||||
static PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT_func = NULL;
|
||||
static PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT_func = NULL;
|
||||
static PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT_func = NULL;
|
||||
static PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT_func = NULL;
|
||||
static PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT_func = NULL;
|
||||
static PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT_func = NULL;
|
||||
static PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT_func = NULL;
|
||||
static PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT_func = NULL;
|
||||
static PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT_func = NULL;
|
||||
static PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT_func = NULL;
|
||||
static PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT_func = NULL;
|
||||
static PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT_func = NULL;
|
||||
static PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT_func = NULL;
|
||||
static PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT_func = NULL;
|
||||
static PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT_func = NULL;
|
||||
static PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT_func = NULL;
|
||||
|
||||
/* GL_ARB_framebuffer_object */
|
||||
static PFNGLISRENDERBUFFERPROC glIsRenderbuffer_func = NULL;
|
||||
static PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer_func = NULL;
|
||||
static PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers_func = NULL;
|
||||
static PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers_func = NULL;
|
||||
static PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage_func = NULL;
|
||||
static PFNGLGETRENDERBUFFERPARAMETERIVPROC glGetRenderbufferParameteriv_func = NULL;
|
||||
static PFNGLISFRAMEBUFFERPROC glIsFramebuffer_func = NULL;
|
||||
static PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer_func = NULL;
|
||||
static PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers_func = NULL;
|
||||
static PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers_func = NULL;
|
||||
static PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus_func = NULL;
|
||||
static PFNGLFRAMEBUFFERTEXTURE1DPROC glFramebufferTexture1D_func = NULL;
|
||||
static PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D_func = NULL;
|
||||
static PFNGLFRAMEBUFFERTEXTURE3DPROC glFramebufferTexture3D_func = NULL;
|
||||
static PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer_func = NULL;
|
||||
static PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameteriv_func = NULL;
|
||||
static PFNGLGENERATEMIPMAPPROC glGenerateMipmap_func = NULL;
|
||||
static PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer_func = NULL;
|
||||
static PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample_func = NULL;
|
||||
static PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer_func = NULL;
|
||||
|
||||
|
||||
|
||||
static void
|
||||
GetExtensionFuncs(void)
|
||||
@@ -173,5 +224,55 @@ GetExtensionFuncs(void)
|
||||
|
||||
/* GL_EXT_stencil_two_side */
|
||||
glActiveStencilFaceEXT_func = (PFNGLACTIVESTENCILFACEEXTPROC) glutGetProcAddress("glActiveStencilFaceEXT");
|
||||
|
||||
/* GL_ARB_vertex_buffer_object */
|
||||
glGenBuffersARB_func = (PFNGLGENBUFFERSARBPROC) glutGetProcAddress("glGenBuffersARB");
|
||||
glDeleteBuffersARB_func = (PFNGLDELETEBUFFERSARBPROC) glutGetProcAddress("glDeleteBuffersARB");
|
||||
glBindBufferARB_func = (PFNGLBINDBUFFERARBPROC) glutGetProcAddress("glBindBufferARB");
|
||||
glBufferDataARB_func = (PFNGLBUFFERDATAARBPROC) glutGetProcAddress("glBufferDataARB");
|
||||
glBufferSubDataARB_func = (PFNGLBUFFERSUBDATAARBPROC) glutGetProcAddress("glBufferSubDataARB");
|
||||
glMapBufferARB_func = (PFNGLMAPBUFFERARBPROC) glutGetProcAddress("glMapBufferARB");
|
||||
glUnmapBufferARB_func = (PFNGLUNMAPBUFFERARBPROC) glutGetProcAddress("glUnmapBufferARB");
|
||||
|
||||
/* GL_EXT_framebuffer_object */
|
||||
glIsRenderbufferEXT_func = (PFNGLISRENDERBUFFEREXTPROC) glutGetProcAddress("glIsRenderbufferEXT");
|
||||
glBindRenderbufferEXT_func = (PFNGLBINDRENDERBUFFEREXTPROC) glutGetProcAddress("glBindRenderbufferEXT");
|
||||
glDeleteRenderbuffersEXT_func = (PFNGLDELETERENDERBUFFERSEXTPROC) glutGetProcAddress("glDeleteRenderbuffersEXT");
|
||||
glGenRenderbuffersEXT_func = (PFNGLGENRENDERBUFFERSEXTPROC) glutGetProcAddress("glGenRenderbuffersEXT");
|
||||
glRenderbufferStorageEXT_func = (PFNGLRENDERBUFFERSTORAGEEXTPROC) glutGetProcAddress("glRenderbufferStorageEXT");
|
||||
glGetRenderbufferParameterivEXT_func = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) glutGetProcAddress("glGetRenderbufferParameterivEXT");
|
||||
glIsFramebufferEXT_func = (PFNGLISFRAMEBUFFEREXTPROC) glutGetProcAddress("glIsFramebufferEXT");
|
||||
glBindFramebufferEXT_func = (PFNGLBINDFRAMEBUFFEREXTPROC) glutGetProcAddress("glBindFramebufferEXT");
|
||||
glDeleteFramebuffersEXT_func = (PFNGLDELETEFRAMEBUFFERSEXTPROC) glutGetProcAddress("glDeleteFramebuffersEXT");
|
||||
glGenFramebuffersEXT_func = (PFNGLGENFRAMEBUFFERSEXTPROC) glutGetProcAddress("glGenFramebuffersEXT");
|
||||
glCheckFramebufferStatusEXT_func = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) glutGetProcAddress("glCheckFramebufferStatusEXT");
|
||||
glFramebufferTexture1DEXT_func = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) glutGetProcAddress("glFramebufferTexture1DEXT");
|
||||
glFramebufferTexture2DEXT_func = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) glutGetProcAddress("glFramebufferTexture2DEXT");
|
||||
glFramebufferTexture3DEXT_func = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) glutGetProcAddress("glFramebufferTexture3DEXT");
|
||||
glFramebufferRenderbufferEXT_func = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) glutGetProcAddress("glFramebufferRenderbufferEXT");
|
||||
glGetFramebufferAttachmentParameterivEXT_func = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) glutGetProcAddress("glGetFramebufferAttachmentParameterivEXT");
|
||||
glGenerateMipmapEXT_func = (PFNGLGENERATEMIPMAPEXTPROC) glutGetProcAddress("glGenerateMipmapEXT");
|
||||
|
||||
/* GL_ARB_framebuffer_object */
|
||||
glIsRenderbuffer_func = (PFNGLISRENDERBUFFERPROC) glutGetProcAddress("glIsRenderbuffer");
|
||||
glBindRenderbuffer_func = (PFNGLBINDRENDERBUFFERPROC) glutGetProcAddress("glBindRenderbuffer");
|
||||
glDeleteRenderbuffers_func = (PFNGLDELETERENDERBUFFERSPROC) glutGetProcAddress("glDeleteRenderbuffers");
|
||||
glGenRenderbuffers_func = (PFNGLGENRENDERBUFFERSPROC) glutGetProcAddress("glGenRenderbuffers");
|
||||
glRenderbufferStorage_func = (PFNGLRENDERBUFFERSTORAGEPROC) glutGetProcAddress("glRenderbufferStorage");
|
||||
glGetRenderbufferParameteriv_func = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) glutGetProcAddress("glGetRenderbufferParameteriv");
|
||||
glIsFramebuffer_func = (PFNGLISFRAMEBUFFERPROC) glutGetProcAddress("glIsFramebuffer");
|
||||
glBindFramebuffer_func = (PFNGLBINDFRAMEBUFFERPROC) glutGetProcAddress("glBindFramebuffer");
|
||||
glDeleteFramebuffers_func = (PFNGLDELETEFRAMEBUFFERSPROC) glutGetProcAddress("glDeleteFramebuffers");
|
||||
glGenFramebuffers_func = (PFNGLGENFRAMEBUFFERSPROC) glutGetProcAddress("glGenFramebuffers");
|
||||
glCheckFramebufferStatus_func = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) glutGetProcAddress("glCheckFramebufferStatus");
|
||||
glFramebufferTexture1D_func = (PFNGLFRAMEBUFFERTEXTURE1DPROC) glutGetProcAddress("glFramebufferTexture1D");
|
||||
glFramebufferTexture2D_func = (PFNGLFRAMEBUFFERTEXTURE2DPROC) glutGetProcAddress("glFramebufferTexture2D");
|
||||
glFramebufferTexture3D_func = (PFNGLFRAMEBUFFERTEXTURE3DPROC) glutGetProcAddress("glFramebufferTexture3D");
|
||||
glFramebufferRenderbuffer_func = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) glutGetProcAddress("glFramebufferRenderbuffer");
|
||||
glGetFramebufferAttachmentParameteriv_func = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) glutGetProcAddress("glGetFramebufferAttachmentParameteriv");
|
||||
glGenerateMipmap_func = (PFNGLGENERATEMIPMAPPROC) glutGetProcAddress("glGenerateMipmap");
|
||||
glBlitFramebuffer_func = (PFNGLBLITFRAMEBUFFERPROC) glutGetProcAddress("glBlitFramebuffer");
|
||||
glRenderbufferStorageMultisample_func = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) glutGetProcAddress("glRenderbufferStorageMultisample");
|
||||
glFramebufferTextureLayer_func = (PFNGLFRAMEBUFFERTEXTURELAYERPROC) glutGetProcAddress("glFramebufferTextureLayer");
|
||||
}
|
||||
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
@@ -78,8 +79,12 @@ CompileShaderFile(GLenum shaderType, const char *filename)
|
||||
int n;
|
||||
char *buffer = (char*) malloc(max);
|
||||
GLuint shader;
|
||||
FILE *f;
|
||||
|
||||
FILE *f = fopen(filename, "r");
|
||||
Init();
|
||||
|
||||
|
||||
f = fopen(filename, "r");
|
||||
if (!f) {
|
||||
fprintf(stderr, "Unable to open shader file %s\n", filename);
|
||||
return 0;
|
||||
|
6
progs/vpglsl/psiz-imm.glsl
Normal file
6
progs/vpglsl/psiz-imm.glsl
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
void main() {
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_PointSize = 2.0;
|
||||
gl_Position = gl_Vertex;
|
||||
}
|
6
progs/vpglsl/psiz-mul.glsl
Normal file
6
progs/vpglsl/psiz-mul.glsl
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
void main() {
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_PointSize = 10 * gl_Color.x;
|
||||
gl_Position = gl_Vertex;
|
||||
}
|
@@ -10,6 +10,10 @@
|
||||
|
||||
static const char *filename = NULL;
|
||||
static GLuint nr_steps = 4;
|
||||
static GLuint prim = GL_TRIANGLES;
|
||||
static GLfloat psz = 1.0;
|
||||
static GLboolean pointsmooth = 0;
|
||||
static GLboolean program_point_size = 0;
|
||||
|
||||
static GLuint fragShader;
|
||||
static GLuint vertShader;
|
||||
@@ -229,6 +233,14 @@ static void subdiv( union vert *v0,
|
||||
}
|
||||
}
|
||||
|
||||
static void enable( GLenum value, GLboolean flag )
|
||||
{
|
||||
if (flag)
|
||||
glEnable(value);
|
||||
else
|
||||
glDisable(value);
|
||||
}
|
||||
|
||||
/** Assignment */
|
||||
#define ASSIGN_3V( V, V0, V1, V2 ) \
|
||||
do { \
|
||||
@@ -241,10 +253,13 @@ static void Display( void )
|
||||
{
|
||||
glClearColor(0.3, 0.3, 0.3, 1);
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
glPointSize(psz);
|
||||
|
||||
glUseProgram(program);
|
||||
enable( GL_POINT_SMOOTH, pointsmooth );
|
||||
enable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB, program_point_size );
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
glBegin(prim);
|
||||
|
||||
|
||||
{
|
||||
@@ -291,10 +306,41 @@ static void Key( unsigned char key, int x, int y )
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
CleanUp();
|
||||
exit(0);
|
||||
break;
|
||||
case 'p':
|
||||
prim = GL_POINTS;
|
||||
break;
|
||||
case 't':
|
||||
prim = GL_TRIANGLES;
|
||||
break;
|
||||
case 's':
|
||||
psz += .5;
|
||||
break;
|
||||
case 'S':
|
||||
if (psz > .5)
|
||||
psz -= .5;
|
||||
break;
|
||||
case 'm':
|
||||
pointsmooth = !pointsmooth;
|
||||
break;
|
||||
case 'z':
|
||||
program_point_size = !program_point_size;
|
||||
break;
|
||||
case '+':
|
||||
nr_steps++;
|
||||
break;
|
||||
case '-':
|
||||
if (nr_steps)
|
||||
nr_steps--;
|
||||
break;
|
||||
case ' ':
|
||||
psz = 1.0;
|
||||
prim = GL_TRIANGLES;
|
||||
nr_steps = 4;
|
||||
break;
|
||||
case 27:
|
||||
CleanUp();
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
@@ -305,7 +351,7 @@ int main( int argc, char *argv[] )
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( 250, 250 );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
|
||||
glutCreateWindow(argv[0]);
|
||||
glutCreateWindow(argv[argc-1]);
|
||||
glewInit();
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
|
@@ -50,6 +50,7 @@ struct window {
|
||||
float Angle;
|
||||
int Id;
|
||||
HGLRC sharedContext;
|
||||
HANDLE hEventInitialised;
|
||||
};
|
||||
|
||||
|
||||
@@ -414,6 +415,10 @@ threadRunner (void *arg)
|
||||
Error("Couldn't obtain HDC");
|
||||
}
|
||||
|
||||
/* Wait for the previous thread */
|
||||
if(tia->id > 0)
|
||||
WaitForSingleObject(Windows[tia->id - 1].hEventInitialised, INFINITE);
|
||||
|
||||
pfd.cColorBits = 24;
|
||||
pfd.cDepthBits = 24;
|
||||
pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
|
||||
@@ -434,9 +439,16 @@ threadRunner (void *arg)
|
||||
}
|
||||
|
||||
if (win->sharedContext) {
|
||||
wglShareLists(win->sharedContext, win->Context);
|
||||
if(!wglShareLists(win->sharedContext, win->Context))
|
||||
Error("Couldn't share WGL context lists");
|
||||
}
|
||||
|
||||
SetEvent(win->hEventInitialised);
|
||||
|
||||
/* Wait for all threads to initialize otherwise wglShareLists will fail */
|
||||
if(tia->id < NumWindows - 1)
|
||||
WaitForSingleObject(Windows[NumWindows - 1].hEventInitialised, INFINITE);
|
||||
|
||||
SendMessage(win->Win, WM_SIZE, 0, 0);
|
||||
|
||||
while (1) {
|
||||
@@ -511,20 +523,26 @@ main(int argc, char *argv[])
|
||||
h[2] = AddWindow( 10, 350, gCtx);
|
||||
h[3] = AddWindow(330, 350, gCtx);
|
||||
|
||||
if (!wglMakeCurrent(gHDC, gCtx)) {
|
||||
Error("wglMakeCurrent failed for init thread.");
|
||||
return -1;
|
||||
for (i = 0; i < NumWindows; i++) {
|
||||
Windows[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
}
|
||||
|
||||
InitGLstuff();
|
||||
|
||||
for (i = 0; i < NumWindows; i++) {
|
||||
DWORD id;
|
||||
|
||||
tia[i].id = i;
|
||||
threads[i] = CreateThread(NULL, 0, threadRunner, &tia[i], 0, &id);
|
||||
|
||||
WaitForSingleObject(Windows[i].hEventInitialised, INFINITE);
|
||||
}
|
||||
|
||||
if (!wglMakeCurrent(gHDC, gCtx)) {
|
||||
Error("wglMakeCurrent failed for init thread.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
InitGLstuff();
|
||||
|
||||
while (1) {
|
||||
MSG msg;
|
||||
|
||||
|
@@ -348,7 +348,6 @@ print_screen_info(HDC _hdc, GLboolean limits)
|
||||
HWND win;
|
||||
HGLRC ctx;
|
||||
int visinfo;
|
||||
int width = 100, height = 100;
|
||||
HDC hdc;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
|
||||
@@ -364,18 +363,18 @@ print_screen_info(HDC _hdc, GLboolean limits)
|
||||
win = CreateWindowEx(0,
|
||||
wc.lpszClassName,
|
||||
"wglinfo",
|
||||
WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
||||
WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
width,
|
||||
height,
|
||||
NULL,
|
||||
NULL,
|
||||
wc.hInstance,
|
||||
NULL);
|
||||
if (!win) {
|
||||
fprintf(stderr, "Couldn't create window");
|
||||
exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
hdc = GetDC(win);
|
||||
@@ -476,7 +475,7 @@ print_visual_attribs_verbose(int iPixelFormat, LPPIXELFORMATDESCRIPTOR ppfd)
|
||||
ppfd->dwFlags & PFD_DRAW_TO_WINDOW ? 1 : 0);
|
||||
printf(" bufferSize=%d level=%d renderType=%s doubleBuffer=%d stereo=%d\n",
|
||||
0 /* ppfd->bufferSize */, 0 /* ppfd->level */,
|
||||
visual_render_type_name(ppfd->dwFlags),
|
||||
visual_render_type_name(ppfd->iPixelType),
|
||||
ppfd->dwFlags & PFD_DOUBLEBUFFER ? 1 : 0,
|
||||
ppfd->dwFlags & PFD_STEREO ? 1 : 0);
|
||||
printf(" rgba: cRedBits=%d cGreenBits=%d cBlueBits=%d cAlphaBits=%d\n",
|
||||
|
@@ -72,6 +72,7 @@ struct winthread {
|
||||
int WinWidth, WinHeight;
|
||||
GLboolean NewSize;
|
||||
HANDLE hEventInitialised;
|
||||
GLboolean Initialized;
|
||||
GLboolean MakeNewTexture;
|
||||
HANDLE hEventRedraw;
|
||||
};
|
||||
@@ -114,20 +115,20 @@ static void
|
||||
MakeNewTexture(struct winthread *wt)
|
||||
{
|
||||
#define TEX_SIZE 128
|
||||
static float step = 0.0;
|
||||
static float step = 0.0f;
|
||||
GLfloat image[TEX_SIZE][TEX_SIZE][4];
|
||||
GLint width;
|
||||
int i, j;
|
||||
|
||||
for (j = 0; j < TEX_SIZE; j++) {
|
||||
for (i = 0; i < TEX_SIZE; i++) {
|
||||
float dt = 5.0 * (j - 0.5 * TEX_SIZE) / TEX_SIZE;
|
||||
float ds = 5.0 * (i - 0.5 * TEX_SIZE) / TEX_SIZE;
|
||||
float dt = 5.0f * (j - 0.5f * TEX_SIZE) / TEX_SIZE;
|
||||
float ds = 5.0f * (i - 0.5f * TEX_SIZE) / TEX_SIZE;
|
||||
float r = dt * dt + ds * ds + step;
|
||||
image[j][i][0] =
|
||||
image[j][i][1] =
|
||||
image[j][i][2] = 0.75 + 0.25 * cos(r);
|
||||
image[j][i][3] = 1.0;
|
||||
image[j][i][2] = 0.75f + 0.25f * (float) cos(r);
|
||||
image[j][i][3] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +160,7 @@ static void
|
||||
draw_object(void)
|
||||
{
|
||||
glPushMatrix();
|
||||
glScalef(0.75, 0.75, 0.75);
|
||||
glScalef(0.75f, 0.75f, 0.75f);
|
||||
|
||||
glColor3f(1, 0, 0);
|
||||
|
||||
@@ -288,6 +289,15 @@ draw_loop(struct winthread *wt)
|
||||
|
||||
wglMakeCurrent(wt->hDC, wt->Context);
|
||||
|
||||
if (!wt->Initialized) {
|
||||
printf("wglthreads: %d: GL_RENDERER = %s\n", wt->Index,
|
||||
(char *) glGetString(GL_RENDERER));
|
||||
if (Texture /*&& wt->Index == 0*/) {
|
||||
MakeNewTexture(wt);
|
||||
}
|
||||
wt->Initialized = GL_TRUE;
|
||||
}
|
||||
|
||||
if (Locking)
|
||||
LeaveCriticalSection(&Mutex);
|
||||
|
||||
@@ -315,13 +325,15 @@ draw_loop(struct winthread *wt)
|
||||
glPushMatrix();
|
||||
glRotatef(wt->Angle, 0, 1, 0);
|
||||
glRotatef(wt->Angle, 1, 0, 0);
|
||||
glScalef(0.7, 0.7, 0.7);
|
||||
glScalef(0.7f, 0.7f, 0.7f);
|
||||
draw_object();
|
||||
glPopMatrix();
|
||||
|
||||
if (Locking)
|
||||
EnterCriticalSection(&Mutex);
|
||||
|
||||
SwapBuffers(wt->hDC);
|
||||
|
||||
if (Locking)
|
||||
LeaveCriticalSection(&Mutex);
|
||||
|
||||
@@ -433,7 +445,7 @@ create_window(struct winthread *wt, HGLRC shareCtx)
|
||||
win = CreateWindowEx(0,
|
||||
wc.lpszClassName,
|
||||
"wglthreads",
|
||||
WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
||||
WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TILEDWINDOW,
|
||||
xpos,
|
||||
ypos,
|
||||
width,
|
||||
@@ -471,7 +483,8 @@ create_window(struct winthread *wt, HGLRC shareCtx)
|
||||
}
|
||||
|
||||
if (shareCtx) {
|
||||
wglShareLists(shareCtx, ctx);
|
||||
if(!wglShareLists(shareCtx, ctx))
|
||||
Error("Couldn't share WGL context lists");
|
||||
}
|
||||
|
||||
/* save the info for this window/context */
|
||||
@@ -482,14 +495,6 @@ create_window(struct winthread *wt, HGLRC shareCtx)
|
||||
wt->WinWidth = width;
|
||||
wt->WinHeight = height;
|
||||
wt->NewSize = GL_TRUE;
|
||||
|
||||
wglMakeCurrent(hdc, ctx);
|
||||
printf("wglthreads: %d: GL_RENDERER = %s\n", wt->Index, (char *) glGetString(GL_RENDERER));
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
|
||||
if (Texture/* && wt->Index == 0*/) {
|
||||
MakeNewTexture(wt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -502,10 +507,22 @@ ThreadProc(void *p)
|
||||
struct winthread *wt = (struct winthread *) p;
|
||||
HGLRC share;
|
||||
|
||||
/* Wait for the previous thread */
|
||||
if(Texture && wt->Index > 0) {
|
||||
WaitForSingleObject(WinThreads[wt->Index - 1].hEventInitialised, INFINITE);
|
||||
share = WinThreads[0].Context;
|
||||
}
|
||||
else
|
||||
share = 0;
|
||||
|
||||
share = (Texture && wt->Index > 0) ? WinThreads[0].Context : 0;
|
||||
create_window(wt, share);
|
||||
SetEvent(wt->hEventInitialised);
|
||||
|
||||
/* Wait for all threads to initialize otherwise wglShareLists will fail */
|
||||
if(wt->Index < NumWinThreads - 1)
|
||||
WaitForSingleObject(WinThreads[NumWinThreads - 1].hEventInitialised, INFINITE);
|
||||
|
||||
draw_loop(wt);
|
||||
return 0;
|
||||
}
|
||||
@@ -539,6 +556,7 @@ main(int argc, char *argv[])
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-h") == 0) {
|
||||
usage();
|
||||
exit(0);
|
||||
}
|
||||
else if (strcmp(argv[i], "-l") == 0) {
|
||||
Locking = 1;
|
||||
@@ -588,13 +606,17 @@ main(int argc, char *argv[])
|
||||
|
||||
printf("wglthreads: creating threads\n");
|
||||
|
||||
/* Create the events */
|
||||
for (i = 0; i < NumWinThreads; i++) {
|
||||
WinThreads[i].Index = i;
|
||||
WinThreads[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
WinThreads[i].hEventRedraw = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
}
|
||||
|
||||
/* Create the threads */
|
||||
for (i = 0; i < NumWinThreads; i++) {
|
||||
DWORD id;
|
||||
|
||||
WinThreads[i].Index = i;
|
||||
WinThreads[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
WinThreads[i].hEventRedraw = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||
WinThreads[i].Thread = CreateThread(NULL,
|
||||
0,
|
||||
ThreadProc,
|
||||
@@ -603,8 +625,6 @@ main(int argc, char *argv[])
|
||||
&id);
|
||||
printf("wglthreads: Created thread %p\n", (void *) WinThreads[i].Thread);
|
||||
|
||||
WaitForSingleObject(WinThreads[i].hEventInitialised, INFINITE);
|
||||
|
||||
threads[i] = WinThreads[i].Thread;
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@
|
||||
* -p Open a display connection for each thread
|
||||
* -l Enable application-side locking
|
||||
* -n <num threads> Number of threads to create (default is 2)
|
||||
* -display <display name> Specify X display (default is :0.0)
|
||||
* -display <display name> Specify X display (default is $DISPLAY)
|
||||
* -t Use texture mapping
|
||||
*
|
||||
* Brian Paul 20 July 2000
|
||||
@@ -573,7 +573,7 @@ usage(void)
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
char *displayName = ":0.0";
|
||||
char *displayName = NULL;
|
||||
int numThreads = 2;
|
||||
Display *dpy = NULL;
|
||||
int i;
|
||||
|
@@ -20,16 +20,17 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is a port of the infamous "gears" demo to straight GLX (i.e. no GLUT)
|
||||
* Port by Brian Paul 23 March 2001
|
||||
* Version of glxgears that creates/destroys the rendering context for each
|
||||
* frame. Also periodically destroy/recreate the window.
|
||||
* Good for finding memory leaks, etc.
|
||||
*
|
||||
* Command line options:
|
||||
* -info print GL implementation information
|
||||
* -stereo use stereo enabled GLX visual
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@@ -92,13 +93,8 @@ static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
|
||||
static GLint gear1, gear2, gear3;
|
||||
static GLfloat angle = 0.0;
|
||||
|
||||
static GLboolean fullscreen = GL_FALSE; /* Create a single fullscreen window */
|
||||
static GLboolean stereo = GL_FALSE; /* Enable stereo. */
|
||||
static GLfloat eyesep = 5.0; /* Eye separation. */
|
||||
static GLfloat fix_point = 40.0; /* Fixation point distance. */
|
||||
static GLfloat left, right, asp; /* Stereo frustum params. */
|
||||
|
||||
XVisualInfo *visinfo;
|
||||
static XVisualInfo *visinfo = NULL;
|
||||
static int WinWidth = 300, WinHeight = 300;
|
||||
|
||||
|
||||
/*
|
||||
@@ -272,22 +268,13 @@ do_draw(void)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
if (stereo) {
|
||||
GLfloat w;
|
||||
|
||||
asp = (GLfloat) height / (GLfloat) width;
|
||||
w = fix_point * (1.0 / 5.0);
|
||||
|
||||
left = -5.0 * ((w - 0.5 * eyesep) / fix_point);
|
||||
right = 5.0 * ((w + 0.5 * eyesep) / fix_point);
|
||||
} else {
|
||||
{
|
||||
GLfloat h = (GLfloat) height / (GLfloat) width;
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
@@ -299,7 +286,6 @@ reshape(int width, int height)
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -40.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
@@ -337,7 +323,7 @@ init(void)
|
||||
|
||||
glEnable(GL_NORMALIZE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
draw( Display *dpy, Window win )
|
||||
@@ -354,36 +340,9 @@ draw( Display *dpy, Window win )
|
||||
|
||||
init();
|
||||
|
||||
if (stereo) {
|
||||
/* First left eye. */
|
||||
glDrawBuffer(GL_BACK_LEFT);
|
||||
reshape(WinWidth, WinHeight);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(left, right, -asp, asp, 5.0, 60.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslated(+0.5 * eyesep, 0.0, 0.0);
|
||||
do_draw();
|
||||
glPopMatrix();
|
||||
|
||||
/* Then right eye. */
|
||||
glDrawBuffer(GL_BACK_RIGHT);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-right, -left, -asp, asp, 5.0, 60.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslated(-0.5 * eyesep, 0.0, 0.0);
|
||||
do_draw();
|
||||
glPopMatrix();
|
||||
} else
|
||||
do_draw();
|
||||
do_draw();
|
||||
|
||||
glDeleteLists(gear1, 1);
|
||||
glDeleteLists(gear2, 1);
|
||||
@@ -410,14 +369,6 @@ make_window( Display *dpy, const char *name,
|
||||
GLX_DOUBLEBUFFER,
|
||||
GLX_DEPTH_SIZE, 1,
|
||||
None };
|
||||
int stereoAttribs[] = { GLX_RGBA,
|
||||
GLX_RED_SIZE, 1,
|
||||
GLX_GREEN_SIZE, 1,
|
||||
GLX_BLUE_SIZE, 1,
|
||||
GLX_DOUBLEBUFFER,
|
||||
GLX_DEPTH_SIZE, 1,
|
||||
GLX_STEREO,
|
||||
None };
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
@@ -427,22 +378,9 @@ make_window( Display *dpy, const char *name,
|
||||
scrnum = DefaultScreen( dpy );
|
||||
root = RootWindow( dpy, scrnum );
|
||||
|
||||
if (fullscreen) {
|
||||
x = 0; y = 0;
|
||||
width = DisplayWidth( dpy, scrnum );
|
||||
height = DisplayHeight( dpy, scrnum );
|
||||
}
|
||||
|
||||
if (stereo)
|
||||
visinfo = glXChooseVisual( dpy, scrnum, stereoAttribs );
|
||||
else
|
||||
visinfo = glXChooseVisual( dpy, scrnum, attribs );
|
||||
visinfo = glXChooseVisual( dpy, scrnum, attribs );
|
||||
if (!visinfo) {
|
||||
if (stereo) {
|
||||
printf("Error: couldn't get an RGB, "
|
||||
"Double-buffered, Stereo visual\n");
|
||||
} else
|
||||
printf("Error: couldn't get an RGB, Double-buffered visual\n");
|
||||
printf("Error: couldn't get an RGB, Double-buffered visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -451,7 +389,7 @@ make_window( Display *dpy, const char *name,
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
attr.override_redirect = fullscreen;
|
||||
attr.override_redirect = 0;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
|
||||
|
||||
win = XCreateWindow( dpy, root, x, y, width, height,
|
||||
@@ -479,10 +417,9 @@ static void
|
||||
event_loop(Display *dpy)
|
||||
{
|
||||
Window win;
|
||||
make_window(dpy, "glxgears", 0, 0, 300, 300, &win);
|
||||
make_window(dpy, "glxgears", 0, 0, WinWidth, WinHeight, &win);
|
||||
XMapWindow(dpy, win);
|
||||
|
||||
|
||||
while (1) {
|
||||
while (XPending(dpy) > 0) {
|
||||
XEvent event;
|
||||
@@ -492,34 +429,35 @@ event_loop(Display *dpy)
|
||||
/* we'll redraw below */
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
reshape(event.xconfigure.width, event.xconfigure.height);
|
||||
WinWidth = event.xconfigure.width;
|
||||
WinHeight = event.xconfigure.height;
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,9 +488,12 @@ event_loop(Display *dpy)
|
||||
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
|
||||
fps);
|
||||
tRate0 = t;
|
||||
|
||||
|
||||
/* Destroy window and create new one */
|
||||
XDestroyWindow(dpy, win);
|
||||
make_window(dpy, "glxgears", (int)(fps * 100) % 100, (int)(fps * 100) % 100, 300, 300, &win);
|
||||
make_window(dpy, "glxgears",
|
||||
(int)(fps * 100) % 100, (int)(fps * 100) % 100, /* x,y */
|
||||
WinWidth, WinHeight, &win);
|
||||
XMapWindow(dpy, win);
|
||||
|
||||
frames = 0;
|
||||
@@ -562,7 +503,6 @@ event_loop(Display *dpy)
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@@ -579,12 +519,6 @@ main(int argc, char *argv[])
|
||||
else if (strcmp(argv[i], "-info") == 0) {
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else if (strcmp(argv[i], "-stereo") == 0) {
|
||||
stereo = GL_TRUE;
|
||||
}
|
||||
else if (strcmp(argv[i], "-fullscreen") == 0) {
|
||||
fullscreen = GL_TRUE;
|
||||
}
|
||||
else
|
||||
printf("Warrning: unknown parameter: %s\n", argv[i]);
|
||||
}
|
||||
@@ -596,7 +530,6 @@ main(int argc, char *argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if (printInfo) {
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
@@ -604,7 +537,6 @@ main(int argc, char *argv[])
|
||||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
|
||||
|
||||
event_loop(dpy);
|
||||
|
||||
XCloseDisplay(dpy);
|
||||
|
@@ -39,6 +39,12 @@
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
|
||||
#ifndef GLX_MESA_swap_control
|
||||
#define GLX_MESA_swap_control 1
|
||||
typedef int (*PFNGLXGETSWAPINTERVALMESAPROC)(void);
|
||||
#endif
|
||||
|
||||
|
||||
static int is_glx_extension_supported(Display *dpy, const char *query);
|
||||
|
||||
static void query_vsync(Display *dpy);
|
||||
@@ -592,31 +598,22 @@ query_vsync(Display *dpy)
|
||||
int interval = 0;
|
||||
|
||||
|
||||
#ifdef GLX_MESA_swap_control
|
||||
if ((interval <= 0)
|
||||
&& is_glx_extension_supported(dpy, "GLX_MESA_swap_control")) {
|
||||
if (is_glx_extension_supported(dpy, "GLX_MESA_swap_control")) {
|
||||
PFNGLXGETSWAPINTERVALMESAPROC pglXGetSwapIntervalMESA =
|
||||
(PFNGLXGETSWAPINTERVALMESAPROC)
|
||||
glXGetProcAddressARB((const GLubyte *) "glXGetSwapIntervalMESA");
|
||||
|
||||
interval = (*pglXGetSwapIntervalMESA)();
|
||||
} else if (is_glx_extension_supported(dpy, "GLX_SGI_swap_control")) {
|
||||
/* The default swap interval with this extension is 1. Assume that it
|
||||
* is set to the default.
|
||||
*
|
||||
* Many Mesa-based drivers default to 0, but all of these drivers also
|
||||
* export GLX_MESA_swap_control. In that case, this branch will never
|
||||
* be taken, and the correct result should be reported.
|
||||
*/
|
||||
interval = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef GLX_SGI_video_sync
|
||||
if ((interval <= 0)
|
||||
&& is_glx_extension_supported(dpy, "GLX_SGI_video_sync")) {
|
||||
PFNGLXGETVIDEOSYNCSGIPROC pglXGetVideoSyncSGI =
|
||||
(PFNGLXGETVIDEOSYNCSGIPROC)
|
||||
glXGetProcAddressARB((const GLubyte *) "glXGetVideoSyncSGI");
|
||||
unsigned count;
|
||||
|
||||
if ((*pglXGetVideoSyncSGI)(& count) == 0) {
|
||||
interval = (int) count;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (interval > 0) {
|
||||
|
@@ -267,7 +267,8 @@ main(int argc, char *argv[])
|
||||
printf(" glxheads xdisplayname ...\n");
|
||||
printf("Example:\n");
|
||||
printf(" glxheads :0 mars:0 venus:1\n");
|
||||
h = AddHead(":0");
|
||||
|
||||
h = AddHead(XDisplayName(NULL));
|
||||
if (h)
|
||||
PrintInfo(h);
|
||||
}
|
||||
|
@@ -759,7 +759,7 @@ main(int argc, char *argv[])
|
||||
Display *dpy;
|
||||
Window win;
|
||||
GLXContext ctx;
|
||||
char *dpyName = ":0";
|
||||
char *dpyName = NULL;
|
||||
int swap_interval = 1;
|
||||
GLboolean do_swap_interval = GL_FALSE;
|
||||
GLboolean force_get_rate = GL_FALSE;
|
||||
|
@@ -158,7 +158,7 @@ main(int argc, char *argv[])
|
||||
Display *dpy;
|
||||
Window win;
|
||||
GLXContext ctx;
|
||||
char *dpyName = ":0";
|
||||
char *dpyName = NULL;
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
|
@@ -108,7 +108,7 @@ def shlib_emitter(target, source, env):
|
||||
return (target, source)
|
||||
|
||||
|
||||
shlib_action = SCons.Action.Action(shlib_generator, generator=1)
|
||||
shlib_action = SCons.Action.Action(shlib_generator, '$SHLINKCOMSTR', generator=1)
|
||||
|
||||
res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR')
|
||||
|
||||
|
64
scons/dxsdk.py
Normal file
64
scons/dxsdk.py
Normal file
@@ -0,0 +1,64 @@
|
||||
"""dxsdk
|
||||
|
||||
Tool-specific initialization for Microsoft DirectX SDK
|
||||
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (c) 2009 VMware, Inc.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
import os
|
||||
import os.path
|
||||
|
||||
import SCons.Errors
|
||||
import SCons.Util
|
||||
|
||||
|
||||
def get_dxsdk_root(env):
|
||||
try:
|
||||
return os.environ['DXSDK_DIR']
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
def generate(env):
|
||||
dxsdk_root = get_dxsdk_root(env)
|
||||
if dxsdk_root is None:
|
||||
# DirectX SDK not found
|
||||
return
|
||||
|
||||
if env['machine'] in ('generic', 'x86'):
|
||||
target_cpu = 'x86'
|
||||
elif env['machine'] == 'x86_64':
|
||||
target_cpu = 'x64'
|
||||
else:
|
||||
raise SCons.Errors.InternalError, "Unsupported target machine"
|
||||
include_dir = 'Include'
|
||||
|
||||
env.Append(CPPDEFINES = [('HAVE_DXSDK', '1')])
|
||||
env.Prepend(CPPPATH = [os.path.join(dxsdk_root, 'Include')])
|
||||
env.Prepend(LIBPATH = [os.path.join(dxsdk_root, 'Lib', target_cpu)])
|
||||
|
||||
def exists(env):
|
||||
return get_dxsdk_root(env) is not None
|
||||
|
||||
# vim:set ts=4 sw=4 et:
|
@@ -42,11 +42,17 @@ import SCons.Scanner
|
||||
def quietCommandLines(env):
|
||||
# Quiet command lines
|
||||
# See also http://www.scons.org/wiki/HidingCommandLinesInOutput
|
||||
env['ASCOMSTR'] = "Assembling $SOURCE ..."
|
||||
env['CCCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['SHCCCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['CXXCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['SHCXXCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['ARCOMSTR'] = "Archiving $TARGET ..."
|
||||
env['RANLIBCOMSTR'] = ""
|
||||
env['RANLIBCOMSTR'] = "Indexing $TARGET ..."
|
||||
env['LINKCOMSTR'] = "Linking $TARGET ..."
|
||||
env['SHLINKCOMSTR'] = "Linking $TARGET ..."
|
||||
env['LDMODULECOMSTR'] = "Linking $TARGET ..."
|
||||
env['SWIGCOMSTR'] = "Generating $TARGET ..."
|
||||
|
||||
|
||||
def createConvenienceLibBuilder(env):
|
||||
@@ -185,9 +191,8 @@ def num_jobs():
|
||||
def generate(env):
|
||||
"""Common environment generation code"""
|
||||
|
||||
# FIXME: this is already too late
|
||||
#if env.get('quiet', False):
|
||||
# quietCommandLines(env)
|
||||
if env.get('quiet', True):
|
||||
quietCommandLines(env)
|
||||
|
||||
# Toolchain
|
||||
platform = env['platform']
|
||||
@@ -313,76 +318,80 @@ def generate(env):
|
||||
env.Append(CPPDEFINES = cppdefines)
|
||||
|
||||
# C compiler options
|
||||
cflags = []
|
||||
cflags = [] # C
|
||||
cxxflags = [] # C++
|
||||
ccflags = [] # C & C++
|
||||
if gcc:
|
||||
if debug:
|
||||
cflags += ['-O0', '-g3']
|
||||
elif env['toolchain'] == 'crossmingw':
|
||||
cflags += ['-O0', '-g3'] # mingw 4.2.1 optimizer is broken
|
||||
ccflags += ['-O0', '-g3']
|
||||
elif env['CCVERSION'].startswith('4.2.'):
|
||||
# gcc 4.2.x optimizer is broken
|
||||
print "warning: gcc 4.2.x optimizer is broken -- disabling optimizations"
|
||||
ccflags += ['-O0', '-g3']
|
||||
else:
|
||||
cflags += ['-O3', '-g3']
|
||||
ccflags += ['-O3', '-g3']
|
||||
if env['profile']:
|
||||
cflags += ['-pg']
|
||||
ccflags += ['-pg']
|
||||
if env['machine'] == 'x86':
|
||||
cflags += [
|
||||
ccflags += [
|
||||
'-m32',
|
||||
#'-march=pentium4',
|
||||
'-mmmx', '-msse', '-msse2', # enable SIMD intrinsics
|
||||
#'-mfpmath=sse',
|
||||
]
|
||||
if env['machine'] == 'x86_64':
|
||||
cflags += ['-m64']
|
||||
ccflags += ['-m64']
|
||||
# See also:
|
||||
# - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
||||
cflags += [
|
||||
'-Werror=declaration-after-statement',
|
||||
ccflags += [
|
||||
'-Wall',
|
||||
'-Wmissing-prototypes',
|
||||
'-Wmissing-field-initializers',
|
||||
'-Wpointer-arith',
|
||||
'-Wno-long-long',
|
||||
'-ffast-math',
|
||||
'-std=gnu99',
|
||||
'-fmessage-length=0', # be nice to Eclipse
|
||||
]
|
||||
cflags += [
|
||||
'-Werror=declaration-after-statement',
|
||||
'-Wmissing-prototypes',
|
||||
'-std=gnu99',
|
||||
]
|
||||
if msvc:
|
||||
# See also:
|
||||
# - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
|
||||
# - cl /?
|
||||
if debug:
|
||||
cflags += [
|
||||
ccflags += [
|
||||
'/Od', # disable optimizations
|
||||
'/Oi', # enable intrinsic functions
|
||||
'/Oy-', # disable frame pointer omission
|
||||
'/GL-', # disable whole program optimization
|
||||
]
|
||||
else:
|
||||
cflags += [
|
||||
'/Ox', # maximum optimizations
|
||||
'/Oi', # enable intrinsic functions
|
||||
'/Ot', # favor code speed
|
||||
#'/fp:fast', # fast floating point
|
||||
ccflags += [
|
||||
'/O2', # optimize for speed
|
||||
#'/fp:fast', # fast floating point
|
||||
]
|
||||
if env['profile']:
|
||||
cflags += [
|
||||
ccflags += [
|
||||
'/Gh', # enable _penter hook function
|
||||
'/GH', # enable _pexit hook function
|
||||
]
|
||||
cflags += [
|
||||
ccflags += [
|
||||
'/W3', # warning level
|
||||
#'/Wp64', # enable 64 bit porting warnings
|
||||
]
|
||||
if env['machine'] == 'x86':
|
||||
cflags += [
|
||||
ccflags += [
|
||||
#'/QIfist', # Suppress _ftol
|
||||
#'/arch:SSE2', # use the SSE2 instructions
|
||||
]
|
||||
if platform == 'windows':
|
||||
cflags += [
|
||||
ccflags += [
|
||||
# TODO
|
||||
]
|
||||
if platform == 'winddk':
|
||||
cflags += [
|
||||
ccflags += [
|
||||
'/Zl', # omit default library name in .OBJ
|
||||
'/Zp8', # 8bytes struct member alignment
|
||||
'/Gy', # separate functions for linker
|
||||
@@ -401,7 +410,7 @@ def generate(env):
|
||||
]
|
||||
if platform == 'wince':
|
||||
# See also C:\WINCE600\public\common\oak\misc\makefile.def
|
||||
cflags += [
|
||||
ccflags += [
|
||||
'/Zl', # omit default library name in .OBJ
|
||||
'/GF', # enable read-only string pooling
|
||||
'/GR-', # disable C++ RTTI
|
||||
@@ -418,8 +427,9 @@ def generate(env):
|
||||
# See http://scons.tigris.org/issues/show_bug.cgi?id=1656
|
||||
env.EnsureSConsVersion(0, 98, 0)
|
||||
env['PDB'] = '${TARGET.base}.pdb'
|
||||
env.Append(CCFLAGS = ccflags)
|
||||
env.Append(CFLAGS = cflags)
|
||||
env.Append(CXXFLAGS = cflags)
|
||||
env.Append(CXXFLAGS = cxxflags)
|
||||
|
||||
if env['platform'] == 'windows' and msvc:
|
||||
# Choose the appropriate MSVC CRT
|
||||
@@ -440,11 +450,15 @@ def generate(env):
|
||||
|
||||
# Linker options
|
||||
linkflags = []
|
||||
shlinkflags = []
|
||||
if gcc:
|
||||
if env['machine'] == 'x86':
|
||||
linkflags += ['-m32']
|
||||
if env['machine'] == 'x86_64':
|
||||
linkflags += ['-m64']
|
||||
shlinkflags += [
|
||||
'-Wl,-Bsymbolic',
|
||||
]
|
||||
if platform == 'windows' and msvc:
|
||||
# See also:
|
||||
# - http://msdn2.microsoft.com/en-us/library/y0zzbyt4.aspx
|
||||
@@ -492,6 +506,7 @@ def generate(env):
|
||||
'/entry:_DllMainCRTStartup',
|
||||
]
|
||||
env.Append(LINKFLAGS = linkflags)
|
||||
env.Append(SHLINKFLAGS = shlinkflags)
|
||||
|
||||
# Default libs
|
||||
env.Append(LIBS = [])
|
||||
|
@@ -416,16 +416,18 @@ def generate(env):
|
||||
# See also:
|
||||
# - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
||||
ccflags += [
|
||||
'-Werror=declaration-after-statement',
|
||||
'-Wall',
|
||||
'-Wmissing-prototypes',
|
||||
'-Wmissing-field-initializers',
|
||||
'-Wpointer-arith',
|
||||
'-Wno-long-long',
|
||||
'-ffast-math',
|
||||
'-std=gnu99',
|
||||
'-fmessage-length=0', # be nice to Eclipse
|
||||
]
|
||||
cflags += [
|
||||
'-Werror=declaration-after-statement',
|
||||
'-Wmissing-prototypes',
|
||||
'-std=gnu99',
|
||||
]
|
||||
if msvc:
|
||||
# See also:
|
||||
# - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
|
||||
|
@@ -60,8 +60,6 @@ struct aaline_fragment_shader
|
||||
struct pipe_shader_state state;
|
||||
void *driver_fs;
|
||||
void *aaline_fs;
|
||||
void *aapoint_fs; /* not yet */
|
||||
void *sprite_fs; /* not yet */
|
||||
uint sampler_unit;
|
||||
int generic_attrib; /**< texcoord/generic used for texture */
|
||||
};
|
||||
@@ -373,10 +371,15 @@ generate_aaline_fs(struct aaline_stage *aaline)
|
||||
aaline->fs->aaline_fs
|
||||
= aaline->driver_create_fs_state(aaline->pipe, &aaline_fs);
|
||||
if (aaline->fs->aaline_fs == NULL)
|
||||
return FALSE;
|
||||
goto fail;
|
||||
|
||||
aaline->fs->generic_attrib = transform.maxGeneric + 1;
|
||||
FREE((void *)aaline_fs.tokens);
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
FREE((void *)aaline_fs.tokens);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -816,6 +819,10 @@ aaline_delete_fs_state(struct pipe_context *pipe, void *fs)
|
||||
struct aaline_fragment_shader *aafs = (struct aaline_fragment_shader *) fs;
|
||||
/* pass-through */
|
||||
aaline->driver_delete_fs_state(aaline->pipe, aafs->driver_fs);
|
||||
|
||||
if (aafs->aaline_fs)
|
||||
aaline->driver_delete_fs_state(aaline->pipe, aafs->aaline_fs);
|
||||
|
||||
FREE(aafs);
|
||||
}
|
||||
|
||||
|
@@ -523,11 +523,15 @@ generate_aapoint_fs(struct aapoint_stage *aapoint)
|
||||
aapoint->fs->aapoint_fs
|
||||
= aapoint->driver_create_fs_state(aapoint->pipe, &aapoint_fs);
|
||||
if (aapoint->fs->aapoint_fs == NULL)
|
||||
return FALSE;
|
||||
goto fail;
|
||||
|
||||
aapoint->fs->generic_attrib = transform.maxGeneric + 1;
|
||||
|
||||
FREE((void *)aapoint_fs.tokens);
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
FREE((void *)aapoint_fs.tokens);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -825,8 +829,13 @@ aapoint_delete_fs_state(struct pipe_context *pipe, void *fs)
|
||||
{
|
||||
struct aapoint_stage *aapoint = aapoint_stage_from_pipe(pipe);
|
||||
struct aapoint_fragment_shader *aafs = (struct aapoint_fragment_shader *) fs;
|
||||
|
||||
/* pass-through */
|
||||
aapoint->driver_delete_fs_state(aapoint->pipe, aafs->driver_fs);
|
||||
|
||||
if (aafs->aapoint_fs)
|
||||
aapoint->driver_delete_fs_state(aapoint->pipe, aafs->aapoint_fs);
|
||||
|
||||
FREE(aafs);
|
||||
}
|
||||
|
||||
|
@@ -358,6 +358,7 @@ generate_pstip_fs(struct pstip_stage *pstip)
|
||||
|
||||
pstip->fs->pstip_fs = pstip->driver_create_fs_state(pstip->pipe, &pstip_fs);
|
||||
|
||||
FREE((void *)pstip_fs.tokens);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -649,6 +650,10 @@ pstip_delete_fs_state(struct pipe_context *pipe, void *fs)
|
||||
struct pstip_fragment_shader *aafs = (struct pstip_fragment_shader *) fs;
|
||||
/* pass-through */
|
||||
pstip->driver_delete_fs_state(pstip->pipe, aafs->driver_fs);
|
||||
|
||||
if (aafs->pstip_fs)
|
||||
pstip->driver_delete_fs_state(pstip->pipe, aafs->pstip_fs);
|
||||
|
||||
FREE(aafs);
|
||||
}
|
||||
|
||||
|
@@ -253,6 +253,7 @@ static void widepoint_flush( struct draw_stage *stage, unsigned flags )
|
||||
{
|
||||
stage->point = widepoint_first_point;
|
||||
stage->next->flush( stage->next, flags );
|
||||
stage->draw->extra_vp_outputs.slot = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -54,7 +54,8 @@ static unsigned elt_ubyte( const void *elts, unsigned idx )
|
||||
|
||||
static unsigned elt_vert( const void *elts, unsigned idx )
|
||||
{
|
||||
return (const ubyte *)elts - (const ubyte *)NULL + idx;
|
||||
/* unsigned index is packed in the pointer */
|
||||
return (unsigned)(uintptr_t)elts + idx;
|
||||
}
|
||||
|
||||
pt_elt_func draw_pt_elt_func( struct draw_context *draw )
|
||||
|
@@ -244,7 +244,7 @@ int u_index_generator( unsigned hw_mask,
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
*out_generate = generate[out_idx][in_pv][out_pv][prim];
|
||||
*out_generate = generate[out_idx][in_pv][out_pv][PIPE_PRIM_POINTS];
|
||||
*out_prim = PIPE_PRIM_POINTS;
|
||||
*out_nr = nr;
|
||||
return U_TRANSLATE_ERROR;
|
||||
|
@@ -71,6 +71,12 @@ struct pb_desc
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Size. Regular (32bit) unsigned for now.
|
||||
*/
|
||||
typedef unsigned pb_size;
|
||||
|
||||
|
||||
/**
|
||||
* Base class for all pb_* buffers.
|
||||
*/
|
||||
@@ -126,7 +132,7 @@ struct pb_vtbl
|
||||
*/
|
||||
void (*get_base_buffer)( struct pb_buffer *buf,
|
||||
struct pb_buffer **base_buf,
|
||||
unsigned *offset );
|
||||
pb_size *offset );
|
||||
|
||||
};
|
||||
|
||||
@@ -177,7 +183,7 @@ pb_unmap(struct pb_buffer *buf)
|
||||
static INLINE void
|
||||
pb_get_base_buffer( struct pb_buffer *buf,
|
||||
struct pb_buffer **base_buf,
|
||||
unsigned *offset )
|
||||
pb_size *offset )
|
||||
{
|
||||
assert(buf);
|
||||
if(!buf) {
|
||||
@@ -241,7 +247,7 @@ pb_reference(struct pb_buffer **dst,
|
||||
* the requested or not.
|
||||
*/
|
||||
static INLINE boolean
|
||||
pb_check_alignment(size_t requested, size_t provided)
|
||||
pb_check_alignment(pb_size requested, pb_size provided)
|
||||
{
|
||||
if(!requested)
|
||||
return TRUE;
|
||||
@@ -269,7 +275,7 @@ pb_check_usage(unsigned requested, unsigned provided)
|
||||
* hardware.
|
||||
*/
|
||||
struct pb_buffer *
|
||||
pb_malloc_buffer_create(size_t size,
|
||||
pb_malloc_buffer_create(pb_size size,
|
||||
const struct pb_desc *desc);
|
||||
|
||||
|
||||
|
@@ -65,11 +65,11 @@ struct fenced_buffer_list
|
||||
|
||||
struct pb_fence_ops *ops;
|
||||
|
||||
size_t numDelayed;
|
||||
pb_size numDelayed;
|
||||
struct list_head delayed;
|
||||
|
||||
#ifdef DEBUG
|
||||
size_t numUnfenced;
|
||||
pb_size numUnfenced;
|
||||
struct list_head unfenced;
|
||||
#endif
|
||||
};
|
||||
@@ -433,7 +433,7 @@ fenced_buffer_fence(struct pb_buffer *buf,
|
||||
static void
|
||||
fenced_buffer_get_base_buffer(struct pb_buffer *buf,
|
||||
struct pb_buffer **base_buf,
|
||||
unsigned *offset)
|
||||
pb_size *offset)
|
||||
{
|
||||
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
|
||||
pb_get_base_buffer(fenced_buf->buffer, base_buf, offset);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user