Compare commits
409 Commits
mesa_7_1_r
...
mesa_7_0_3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70d227ac62 | ||
|
|
7f2c4f96f5 | ||
|
|
667f0f60fc | ||
|
|
7592b8cc10 | ||
|
|
f55b831859 | ||
|
|
217f7f7e5d | ||
|
|
1e83d70b6d | ||
|
|
767dfa5b9c | ||
|
|
7ff5b38126 | ||
|
|
e209f5300d | ||
|
|
3c4b50c352 | ||
|
|
4e7c2fcf18 | ||
|
|
22534f94f5 | ||
|
|
1a6928fdbe | ||
|
|
325dbbac47 | ||
|
|
39ac6b0481 | ||
|
|
46cc4854e9 | ||
|
|
f93882512e | ||
|
|
0dee2a4f6f | ||
|
|
3cebc35669 | ||
|
|
e75a204fb9 | ||
|
|
ac06a5c16a | ||
|
|
ed758fee0c | ||
|
|
a21c61ee8b | ||
|
|
24697da20e | ||
|
|
7120c0089d | ||
|
|
88a436a8f7 | ||
|
|
2fdb5a245d | ||
|
|
8441b53538 | ||
|
|
d336df8b73 | ||
|
|
8aaf805b8a | ||
|
|
8161fd2785 | ||
|
|
2f23025dfe | ||
|
|
1867eac230 | ||
|
|
096e35d05f | ||
|
|
8998f52b97 | ||
|
|
0fd38dcc83 | ||
|
|
ff63cf8068 | ||
|
|
4716670de9 | ||
|
|
33c5b38034 | ||
|
|
5737d6c565 | ||
|
|
08a7f56c6a | ||
|
|
7916f2b4aa | ||
|
|
193d303ac7 | ||
|
|
e70609b7b8 | ||
|
|
da476ff02d | ||
|
|
77e3b5d28b | ||
|
|
bf97ca448c | ||
|
|
c5f8ff8b32 | ||
|
|
50465766d1 | ||
|
|
7d8df58a63 | ||
|
|
762c074012 | ||
|
|
51f2ee3bfb | ||
|
|
b5cd34aa21 | ||
|
|
ae5c6dcd42 | ||
|
|
97196d0c8c | ||
|
|
f6de56b88a | ||
|
|
d64ea43b76 | ||
|
|
2deaf93d24 | ||
|
|
a107ec8300 | ||
|
|
120a1f9508 | ||
|
|
bb84007a57 | ||
|
|
86234e55a6 | ||
|
|
61972077cd | ||
|
|
5a7feb8ea2 | ||
|
|
4b4c131cd0 | ||
|
|
0fd23f01c6 | ||
|
|
557b0d9df7 | ||
|
|
888f4380cf | ||
|
|
3266c5e95a | ||
|
|
834decdaae | ||
|
|
18b2d83173 | ||
|
|
30c65c3c62 | ||
|
|
04fcc4cf1e | ||
|
|
48ae5cf09d | ||
|
|
45cdb6eb45 | ||
|
|
b9f3f732aa | ||
|
|
17006ddd6b | ||
|
|
b77a354df3 | ||
|
|
71d46beebf | ||
|
|
454e296eb1 | ||
|
|
f9b696be2b | ||
|
|
c923edbc71 | ||
|
|
e20c1d987f | ||
|
|
cd354eb10f | ||
|
|
e9ac27ee23 | ||
|
|
3f9dc9f5b6 | ||
|
|
ba709875ae | ||
|
|
80f8397b35 | ||
|
|
b45fa27fa1 | ||
|
|
b59480645d | ||
|
|
148cb36979 | ||
|
|
c1eb78f7ff | ||
|
|
8aa0fd6b20 | ||
|
|
a1b3a908f5 | ||
|
|
f9e70d951a | ||
|
|
41ed6be1da | ||
|
|
27de28fc3e | ||
|
|
dd2f01c229 | ||
|
|
deb5c56c77 | ||
|
|
0107acded0 | ||
|
|
2ac5e08d1d | ||
|
|
1837b8c214 | ||
|
|
03d2bc1774 | ||
|
|
385bddbde0 | ||
|
|
c135426267 | ||
|
|
4be0c98120 | ||
|
|
e760aebd5a | ||
|
|
1f6e7d9c29 | ||
|
|
c6d421af05 | ||
|
|
952df5e493 | ||
|
|
45acb8b058 | ||
|
|
e8997c0183 | ||
|
|
169e62f563 | ||
|
|
1b43babfb1 | ||
|
|
43e902f774 | ||
|
|
b0a800e249 | ||
|
|
73d5f232ad | ||
|
|
f7209541e4 | ||
|
|
397a32dca7 | ||
|
|
e0719d7122 | ||
|
|
3f18c0a9f2 | ||
|
|
b14be61938 | ||
|
|
440d620308 | ||
|
|
8dd9df0f3e | ||
|
|
6b9534eaf5 | ||
|
|
c91d374ad7 | ||
|
|
1cab4160bc | ||
|
|
718d2dfbbd | ||
|
|
0967e1270d | ||
|
|
a08c02f1a8 | ||
|
|
bdfd9afead | ||
|
|
1c91a590d6 | ||
|
|
65bd7968bf | ||
|
|
6ccd23b87b | ||
|
|
823409b7d0 | ||
|
|
c85d31f4a0 | ||
|
|
24af5c44da | ||
|
|
75efacf8eb | ||
|
|
825e810247 | ||
|
|
e20723cfc1 | ||
|
|
9f39a67c1d | ||
|
|
2044f3f791 | ||
|
|
30d4e8c422 | ||
|
|
92d552f6a2 | ||
|
|
5adfcbbc4f | ||
|
|
69969b3819 | ||
|
|
edfee04fcb | ||
|
|
28c9930888 | ||
|
|
e3a35a123e | ||
|
|
412168f2e8 | ||
|
|
fc0fa0d636 | ||
|
|
8a40b670c3 | ||
|
|
d9fa5cbfc9 | ||
|
|
1c21564292 | ||
|
|
6cc96bf156 | ||
|
|
29afd4bbc4 | ||
|
|
4e3db063ec | ||
|
|
6560744c38 | ||
|
|
572ad87881 | ||
|
|
2ab75d6cfa | ||
|
|
041a8eb5ec | ||
|
|
c1c13bdcfa | ||
|
|
403edd34dd | ||
|
|
f279e48416 | ||
|
|
bf854d8d27 | ||
|
|
f334121679 | ||
|
|
b88e2be609 | ||
|
|
08229c8bb8 | ||
|
|
c984017f71 | ||
|
|
00e7dd8a13 | ||
|
|
d11b375b16 | ||
|
|
d1afa8146f | ||
|
|
31d4ba8a93 | ||
|
|
1a7640958c | ||
|
|
2e2a5a450b | ||
|
|
574fd63ff0 | ||
|
|
1063d47526 | ||
|
|
b59a892d3e | ||
|
|
6e5d5d77df | ||
|
|
a6319d18cf | ||
|
|
5103e883fd | ||
|
|
98c4ea4b24 | ||
|
|
29b8cac7d7 | ||
|
|
cdb02d43fe | ||
|
|
50cecddc4a | ||
|
|
177f6398e5 | ||
|
|
887bd6a46f | ||
|
|
9af5153410 | ||
|
|
0e2103689e | ||
|
|
2c496d8e46 | ||
|
|
8f0ba02e44 | ||
|
|
524c56e417 | ||
|
|
773f3a266c | ||
|
|
882ada0d22 | ||
|
|
6229005f93 | ||
|
|
6c63b35ef7 | ||
|
|
fb85e50e09 | ||
|
|
5e5f908d0c | ||
|
|
c09e2143c7 | ||
|
|
74ced1e67f | ||
|
|
dd02c1609e | ||
|
|
cdf4880a79 | ||
|
|
2ec8e8547d | ||
|
|
b7c36d1d33 | ||
|
|
970d18a708 | ||
|
|
9456e7f0ff | ||
|
|
a5db24adc2 | ||
|
|
17664e2620 | ||
|
|
43a0eb0253 | ||
|
|
bcdaed2c0a | ||
|
|
78c6637db5 | ||
|
|
44214a98fd | ||
|
|
9cc6d2310c | ||
|
|
1a045954be | ||
|
|
b3fc9a1585 | ||
|
|
2a86a449ca | ||
|
|
44f032db61 | ||
|
|
5a520729ee | ||
|
|
36fbe78c60 | ||
|
|
029bb17770 | ||
|
|
7958bee6be | ||
|
|
0b9bb21ce4 | ||
|
|
cfcc5b794e | ||
|
|
925ff408a6 | ||
|
|
f40ca444f5 | ||
|
|
638a5e0382 | ||
|
|
6d777bf055 | ||
|
|
ae6d4e8bc0 | ||
|
|
f2728724d3 | ||
|
|
bc95b34cce | ||
|
|
9eb89616af | ||
|
|
f7713a6d81 | ||
|
|
1cec9b727a | ||
|
|
18a4730f5b | ||
|
|
1342aefcdd | ||
|
|
1fd4b1e702 | ||
|
|
32dff44c28 | ||
|
|
e7c2ae476a | ||
|
|
a66301f83d | ||
|
|
a5f7d56221 | ||
|
|
140080c1ec | ||
|
|
ef43af6d43 | ||
|
|
949d0532f0 | ||
|
|
96efc76d74 | ||
|
|
6ca0d63692 | ||
|
|
95fc2485e2 | ||
|
|
d6ce1e4834 | ||
|
|
2cc2b12fc7 | ||
|
|
2259f81cf7 | ||
|
|
791f12880f | ||
|
|
7aa7373a64 | ||
|
|
2f186a190f | ||
|
|
357893a873 | ||
|
|
a17881da5f | ||
|
|
4872ee83a9 | ||
|
|
5ec222a832 | ||
|
|
40438b3440 | ||
|
|
e0b80660c8 | ||
|
|
a2016301f5 | ||
|
|
7ec6729fb6 | ||
|
|
837a2cf72e | ||
|
|
0adca14536 | ||
|
|
57b0f66c6d | ||
|
|
e47e7a9571 | ||
|
|
68ca01560f | ||
|
|
64f1c91fcb | ||
|
|
7d33f94198 | ||
|
|
d69a596193 | ||
|
|
8aa4ae638e | ||
|
|
3069f34841 | ||
|
|
b3788a0e4f | ||
|
|
582bc029ab | ||
|
|
e9e3099433 | ||
|
|
4fc561cc7b | ||
|
|
ad3e3a0b99 | ||
|
|
bfb8c849cb | ||
|
|
09dd25b5d1 | ||
|
|
c48efb1dbe | ||
|
|
5408acb6b7 | ||
|
|
15481160f9 | ||
|
|
00ccff03a5 | ||
|
|
21594921b1 | ||
|
|
42c91eebc9 | ||
|
|
88273e08b4 | ||
|
|
08f7fb45ef | ||
|
|
75ebda3ce6 | ||
|
|
53ff15fcbf | ||
|
|
72adb70ee2 | ||
|
|
960d41fcfe | ||
|
|
0c4e35b070 | ||
|
|
c53f1cb813 | ||
|
|
f6696cc15e | ||
|
|
fef9a41fe4 | ||
|
|
e279a0a076 | ||
|
|
88c8aaed96 | ||
|
|
62cbbd7226 | ||
|
|
f7cbe7fcee | ||
|
|
d8e4ff9079 | ||
|
|
510ff27eda | ||
|
|
5abf055100 | ||
|
|
4bb5721f6b | ||
|
|
c41ab70d3a | ||
|
|
a05e403bf2 | ||
|
|
2f57e0f71d | ||
|
|
95a2eb9767 | ||
|
|
55175daed7 | ||
|
|
ae16a51e95 | ||
|
|
4398d67546 | ||
|
|
c93738687c | ||
|
|
799492e606 | ||
|
|
f33ff071bb | ||
|
|
99e854743c | ||
|
|
6f79062d91 | ||
|
|
2f682c3995 | ||
|
|
067370e68f | ||
|
|
2aa439a6a4 | ||
|
|
b477182dc3 | ||
|
|
a8964ca89e | ||
|
|
4f0e92d07c | ||
|
|
577f4e8a5f | ||
|
|
0586d9fe56 | ||
|
|
1f0d9bf05e | ||
|
|
8bcae2a527 | ||
|
|
35ca9aae91 | ||
|
|
6cdd2bf8d7 | ||
|
|
ce7d175adb | ||
|
|
1904fd095f | ||
|
|
897d0ac5cc | ||
|
|
e262d0182f | ||
|
|
aa5b748c10 | ||
|
|
3c182c5bc8 | ||
|
|
1b5677847b | ||
|
|
1be59a9dbe | ||
|
|
55c2178ad4 | ||
|
|
3e3d392e1c | ||
|
|
756a7a4e4b | ||
|
|
121b4ac220 | ||
|
|
cdbd5db3af | ||
|
|
b2240f6ad4 | ||
|
|
33814a55f8 | ||
|
|
a57c5a417b | ||
|
|
ff1a28de17 | ||
|
|
772f57f99b | ||
|
|
dacee32b8b | ||
|
|
fa1a3eb06d | ||
|
|
bd4817ca54 | ||
|
|
005eea249c | ||
|
|
9747de8ec6 | ||
|
|
849a9799d0 | ||
|
|
e32ae4fe33 | ||
|
|
4595389c4c | ||
|
|
e8ccc7cc49 | ||
|
|
673d21047a | ||
|
|
fdefc2bbda | ||
|
|
2079df8527 | ||
|
|
b53659452c | ||
|
|
46f1d6653e | ||
|
|
c1938a60f7 | ||
|
|
d65110f352 | ||
|
|
9fa3bbcb5a | ||
|
|
99d62f2922 | ||
|
|
284743cafe | ||
|
|
08d7307b2a | ||
|
|
ef6a64abe6 | ||
|
|
18bfa52ef7 | ||
|
|
d62be2652c | ||
|
|
ea53ff80af | ||
|
|
feeca1bcbc | ||
|
|
12e7278c08 | ||
|
|
45b5c44eb9 | ||
|
|
e3456c1028 | ||
|
|
327fb38573 | ||
|
|
1d25d9e15f | ||
|
|
cc7cee3f48 | ||
|
|
d7062710cd | ||
|
|
9bfba734d8 | ||
|
|
aaebf2f47e | ||
|
|
23f8d77b38 | ||
|
|
87d22ee0fe | ||
|
|
52e25f63d4 | ||
|
|
f3fb67972b | ||
|
|
6400756364 | ||
|
|
d59f0314bd | ||
|
|
131baefac3 | ||
|
|
a450078b67 | ||
|
|
f6b041bf6c | ||
|
|
4f340d181a | ||
|
|
b58e38e936 | ||
|
|
8713cb48a8 | ||
|
|
277c5e57ed | ||
|
|
b3d62d5af5 | ||
|
|
9c0f0c8d81 | ||
|
|
18a0a2a7ac | ||
|
|
8b99d9e33c | ||
|
|
01e7e153e3 | ||
|
|
0ad4ca24d2 | ||
|
|
724a155552 | ||
|
|
d38b74a316 | ||
|
|
54cab4b47b | ||
|
|
c093666bc5 | ||
|
|
04972f6761 | ||
|
|
67f8234622 | ||
|
|
201d6dbd9c | ||
|
|
fbcac5aa83 | ||
|
|
2b72ab8f8f | ||
|
|
0ea97b9408 | ||
|
|
28683ac7c0 | ||
|
|
c72e3e210f |
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -1,4 +0,0 @@
|
||||
*.dsp -crlf
|
||||
*.dsw -crlf
|
||||
*.sln -crlf
|
||||
*.vcproj -crlf
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -8,9 +8,3 @@ depend
|
||||
depend.bak
|
||||
lib
|
||||
lib64
|
||||
configure
|
||||
autom4te.cache
|
||||
aclocal.m4
|
||||
config.log
|
||||
config.status
|
||||
cscope*
|
||||
|
||||
75
Makefile
75
Makefile
@@ -14,25 +14,25 @@ default: $(TOP)/configs/current
|
||||
|
||||
|
||||
doxygen:
|
||||
cd doxygen && $(MAKE)
|
||||
(cd doxygen ; make) ; \
|
||||
|
||||
clean:
|
||||
-@touch $(TOP)/configs/current
|
||||
-@for dir in $(SUBDIRS) ; do \
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
if [ -d $$dir ] ; then \
|
||||
(cd $$dir && $(MAKE) clean) ; \
|
||||
fi \
|
||||
done
|
||||
-@test -s $(TOP)/configs/current || rm -f $(TOP)/configs/current
|
||||
|
||||
|
||||
realclean: clean
|
||||
realclean:
|
||||
touch $(TOP)/configs/current
|
||||
$(MAKE) clean
|
||||
-rm -rf lib*
|
||||
-rm -f $(TOP)/configs/current
|
||||
-rm -f $(TOP)/configs/autoconf
|
||||
-rm -rf autom4te.cache
|
||||
-find . '(' -name '*.o' -o -name '*.a' -o -name '*.so' -o \
|
||||
-name depend -o -name depend.bak ')' -exec rm -f '{}' ';'
|
||||
-rm -f `find . -name \*.o`
|
||||
-rm -f `find . -name \*.a`
|
||||
-rm -f `find . -name \*.so`
|
||||
-rm -f `find . -name depend`
|
||||
|
||||
|
||||
|
||||
@@ -48,20 +48,14 @@ install:
|
||||
linux-directfb-install:
|
||||
cd src/mesa/drivers/directfb && $(MAKE) install
|
||||
|
||||
.PHONY: default doxygen clean realclean install linux-directfb-install
|
||||
|
||||
# If there's no current configuration file
|
||||
$(TOP)/configs/current:
|
||||
@echo
|
||||
@echo
|
||||
@echo "Please choose a configuration from the following list:"
|
||||
@ls -1 $(TOP)/configs | grep -v "current\|default\|CVS\|autoconf.*"
|
||||
@ls -1 $(TOP)/configs | grep -v "current\|default\|CVS"
|
||||
@echo
|
||||
@echo "Then type 'make <config>' (ex: 'make linux-x86')"
|
||||
@echo
|
||||
@echo "Or, run './configure' then 'make'"
|
||||
@echo "See './configure --help' for details"
|
||||
@echo
|
||||
@echo "(ignore the following error message)"
|
||||
@exit 1
|
||||
|
||||
@@ -72,10 +66,9 @@ aix-64 \
|
||||
aix-64-static \
|
||||
aix-gcc \
|
||||
aix-static \
|
||||
autoconf \
|
||||
beos \
|
||||
bluegene-osmesa \
|
||||
bluegene-xlc-osmesa \
|
||||
beos \
|
||||
catamount-osmesa-pgi \
|
||||
darwin \
|
||||
darwin-fat-32bit \
|
||||
@@ -174,22 +167,15 @@ ultrix-gcc:
|
||||
|
||||
# Rules for making release tarballs
|
||||
|
||||
DIRECTORY = Mesa-7.1-rc1
|
||||
LIB_NAME = MesaLib-7.1-rc1
|
||||
DEMO_NAME = MesaDemos-7.1-rc1
|
||||
GLUT_NAME = MesaGLUT-7.1-rc1
|
||||
DIRECTORY = Mesa-7.0.3-rc3
|
||||
LIB_NAME = MesaLib-7.0.3-rc3
|
||||
DEMO_NAME = MesaDemos-7.0.3-rc3
|
||||
GLUT_NAME = MesaGLUT-7.0.3-rc3
|
||||
|
||||
MAIN_FILES = \
|
||||
$(DIRECTORY)/Makefile* \
|
||||
$(DIRECTORY)/configure \
|
||||
$(DIRECTORY)/configure.ac \
|
||||
$(DIRECTORY)/acinclude.m4 \
|
||||
$(DIRECTORY)/aclocal.m4 \
|
||||
$(DIRECTORY)/descrip.mms \
|
||||
$(DIRECTORY)/mms-config. \
|
||||
$(DIRECTORY)/bin/config.guess \
|
||||
$(DIRECTORY)/bin/config.sub \
|
||||
$(DIRECTORY)/bin/install-sh \
|
||||
$(DIRECTORY)/bin/mklib \
|
||||
$(DIRECTORY)/bin/minstall \
|
||||
$(DIRECTORY)/configs/[a-z]* \
|
||||
@@ -232,28 +218,37 @@ MAIN_FILES = \
|
||||
$(DIRECTORY)/src/mesa/depend \
|
||||
$(DIRECTORY)/src/mesa/main/*.[chS] \
|
||||
$(DIRECTORY)/src/mesa/main/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/main/sources \
|
||||
$(DIRECTORY)/src/mesa/glapi/*.[chS] \
|
||||
$(DIRECTORY)/src/mesa/glapi/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/glapi/sources \
|
||||
$(DIRECTORY)/src/mesa/math/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/math/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/math/sources \
|
||||
$(DIRECTORY)/src/mesa/shader/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/shader/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/shader/sources \
|
||||
$(DIRECTORY)/src/mesa/shader/grammar/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/shader/grammar/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/shader/grammar/sources \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/sources \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/library/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/library/*.gc \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/library/*.syn \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/library/Makefile \
|
||||
$(DIRECTORY)/src/mesa/swrast/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/swrast/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/swrast/sources \
|
||||
$(DIRECTORY)/src/mesa/swrast_setup/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/swrast_setup/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/swrast_setup/sources \
|
||||
$(DIRECTORY)/src/mesa/vbo/*.[chS] \
|
||||
$(DIRECTORY)/src/mesa/vbo/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/tnl/*.[chS] \
|
||||
$(DIRECTORY)/src/mesa/tnl/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/tnl/sources \
|
||||
$(DIRECTORY)/src/mesa/tnl_dd/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/tnl_dd/imm/NOTES.imm \
|
||||
@@ -261,6 +256,7 @@ MAIN_FILES = \
|
||||
$(DIRECTORY)/src/mesa/drivers/beos/Makefile \
|
||||
$(DIRECTORY)/src/mesa/drivers/common/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/drivers/common/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/drivers/common/sources \
|
||||
$(DIRECTORY)/src/mesa/drivers/directfb/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/drivers/directfb/Makefile \
|
||||
$(DIRECTORY)/src/mesa/drivers/dos/*.[chS] \
|
||||
@@ -281,6 +277,7 @@ MAIN_FILES = \
|
||||
$(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/drivers/windows/*/*.def \
|
||||
$(DIRECTORY)/src/mesa/drivers/x11/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/drivers/x11/sources \
|
||||
$(DIRECTORY)/src/mesa/drivers/x11/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/ppc/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/sparc/*.[chS] \
|
||||
@@ -309,7 +306,6 @@ MAIN_FILES = \
|
||||
|
||||
DRI_FILES = \
|
||||
$(DIRECTORY)/include/GL/internal/dri_interface.h \
|
||||
$(DIRECTORY)/include/GL/internal/dri_sarea.h \
|
||||
$(DIRECTORY)/include/GL/internal/sarea.h \
|
||||
$(DIRECTORY)/src/glx/Makefile \
|
||||
$(DIRECTORY)/src/glx/x11/Makefile \
|
||||
@@ -439,20 +435,9 @@ LIB_FILES = $(MAIN_FILES) $(DRI_FILES) $(SGI_GLU_FILES) $(GLW_FILES)
|
||||
|
||||
|
||||
# Everything for new a Mesa release:
|
||||
tarballs: rm_depend configure aclocal.m4 lib_gz demo_gz glut_gz \
|
||||
lib_bz2 demo_bz2 glut_bz2 lib_zip demo_zip glut_zip md5
|
||||
tarballs: rm_depend lib_gz demo_gz glut_gz lib_bz2 demo_bz2 glut_bz2 lib_zip demo_zip glut_zip md5
|
||||
|
||||
|
||||
# Helper for autoconf builds
|
||||
ACLOCAL = aclocal
|
||||
ACLOCAL_FLAGS =
|
||||
AUTOCONF = autoconf
|
||||
AC_FLAGS =
|
||||
aclocal.m4: configure.ac acinclude.m4
|
||||
$(ACLOCAL) $(ACLOCAL_FLAGS)
|
||||
configure: configure.ac aclocal.m4 acinclude.m4
|
||||
$(AUTOCONF) $(AC_FLAGS)
|
||||
|
||||
rm_depend:
|
||||
@for dep in $(DEPEND_FILES) ; do \
|
||||
rm -f $$dep ; \
|
||||
@@ -461,7 +446,6 @@ rm_depend:
|
||||
|
||||
lib_gz:
|
||||
rm -f configs/current ; \
|
||||
rm -f configs/autoconf ; \
|
||||
cd .. ; \
|
||||
tar -cf $(LIB_NAME).tar $(LIB_FILES) ; \
|
||||
gzip $(LIB_NAME).tar ; \
|
||||
@@ -481,7 +465,6 @@ glut_gz:
|
||||
|
||||
lib_bz2:
|
||||
rm -f configs/current ; \
|
||||
rm -f configs/autoconf ; \
|
||||
cd .. ; \
|
||||
tar -cf $(LIB_NAME).tar $(LIB_FILES) ; \
|
||||
bzip2 $(LIB_NAME).tar ; \
|
||||
@@ -501,7 +484,6 @@ glut_bz2:
|
||||
|
||||
lib_zip:
|
||||
rm -f configs/current ; \
|
||||
rm -f configs/autoconf ; \
|
||||
rm -f $(LIB_NAME).zip ; \
|
||||
cd .. ; \
|
||||
zip -qr $(LIB_NAME).zip $(LIB_FILES) ; \
|
||||
@@ -529,6 +511,3 @@ md5:
|
||||
@-md5sum $(GLUT_NAME).tar.gz
|
||||
@-md5sum $(GLUT_NAME).tar.bz2
|
||||
@-md5sum $(GLUT_NAME).zip
|
||||
|
||||
.PHONY: tarballs rm_depend lib_gz demo_gz glut_gz lib_bz2 demo_bz2 \
|
||||
glut_bz2 lib_zip demo_zip glut_zip md5
|
||||
|
||||
119
acinclude.m4
119
acinclude.m4
@@ -1,119 +0,0 @@
|
||||
# A few convenience macros for Mesa, mostly to keep all the platform
|
||||
# specifics out of configure.ac.
|
||||
|
||||
# MESA_PIC_FLAGS()
|
||||
#
|
||||
# Find out whether to build PIC code using the option --enable-pic and
|
||||
# the configure enable_static/enable_shared settings. If PIC is needed,
|
||||
# figure out the necessary flags for the platform and compiler.
|
||||
#
|
||||
# The platform checks have been shamelessly taken from libtool and
|
||||
# stripped down to just what's needed for Mesa. See _LT_COMPILER_PIC in
|
||||
# /usr/share/aclocal/libtool.m4 or
|
||||
# http://git.savannah.gnu.org/gitweb/?p=libtool.git;a=blob;f=libltdl/m4/libtool.m4;hb=HEAD
|
||||
#
|
||||
AC_DEFUN([MESA_PIC_FLAGS],
|
||||
[AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_ARG_VAR([PIC_FLAGS], [compiler flags for PIC code])
|
||||
AC_ARG_ENABLE([pic],
|
||||
[AS_HELP_STRING([--disable-pic],
|
||||
[compile PIC objects @<:@default=enabled for shared builds
|
||||
on supported platforms@:>@])],
|
||||
[enable_pic="$enableval"
|
||||
test "x$enable_pic" = x && enable_pic=auto],
|
||||
[enable_pic=auto])
|
||||
# disable PIC by default for static builds
|
||||
if test "$enable_pic" = auto && test "$enable_static" = yes; then
|
||||
enable_pic=no
|
||||
fi
|
||||
# if PIC hasn't been explicitly disabled, try to figure out the flags
|
||||
if test "$enable_pic" != no; then
|
||||
AC_MSG_CHECKING([for $CC option to produce PIC])
|
||||
# allow the user's flags to override
|
||||
if test "x$PIC_FLAGS" = x; then
|
||||
# see if we're using GCC
|
||||
if test "x$GCC" = xyes; then
|
||||
case "$host_os" in
|
||||
aix*|beos*|cygwin*|irix5*|irix6*|osf3*|osf4*|osf5*)
|
||||
# PIC is the default for these OSes.
|
||||
;;
|
||||
mingw*|os2*|pw32*)
|
||||
# This hack is so that the source file can tell whether
|
||||
# it is being built for inclusion in a dll (and should
|
||||
# export symbols for example).
|
||||
PIC_FLAGS="-DDLL_EXPORT"
|
||||
;;
|
||||
darwin*|rhapsody*)
|
||||
# PIC is the default on this platform
|
||||
# Common symbols not allowed in MH_DYLIB files
|
||||
PIC_FLAGS="-fno-common"
|
||||
;;
|
||||
hpux*)
|
||||
# PIC is the default for IA64 HP-UX and 64-bit HP-UX,
|
||||
# but not for PA HP-UX.
|
||||
case $host_cpu in
|
||||
hppa*64*|ia64*)
|
||||
;;
|
||||
*)
|
||||
PIC_FLAGS="-fPIC"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
# Everyone else on GCC uses -fPIC
|
||||
PIC_FLAGS="-fPIC"
|
||||
;;
|
||||
esac
|
||||
else # !GCC
|
||||
case "$host_os" in
|
||||
hpux9*|hpux10*|hpux11*)
|
||||
# PIC is the default for IA64 HP-UX and 64-bit HP-UX,
|
||||
# but not for PA HP-UX.
|
||||
case "$host_cpu" in
|
||||
hppa*64*|ia64*)
|
||||
# +Z the default
|
||||
;;
|
||||
*)
|
||||
PIC_FLAGS="+Z"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
linux*|k*bsd*-gnu)
|
||||
case `basename "$CC"` in
|
||||
icc*|ecc*|ifort*)
|
||||
PIC_FLAGS="-KPIC"
|
||||
;;
|
||||
pgcc*|pgf77*|pgf90*|pgf95*)
|
||||
# Portland Group compilers (*not* the Pentium gcc
|
||||
# compiler, which looks to be a dead project)
|
||||
PIC_FLAGS="-fpic"
|
||||
;;
|
||||
ccc*)
|
||||
# All Alpha code is PIC.
|
||||
;;
|
||||
xl*)
|
||||
# IBM XL C 8.0/Fortran 10.1 on PPC
|
||||
PIC_FLAGS="-qpic"
|
||||
;;
|
||||
*)
|
||||
case `$CC -V 2>&1 | sed 5q` in
|
||||
*Sun\ C*|*Sun\ F*)
|
||||
# Sun C 5.9 or Sun Fortran
|
||||
PIC_FLAGS="-KPIC"
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
;;
|
||||
solaris*)
|
||||
PIC_FLAGS="-KPIC"
|
||||
;;
|
||||
sunos4*)
|
||||
PIC_FLAGS="-PIC"
|
||||
;;
|
||||
esac
|
||||
fi # GCC
|
||||
fi # PIC_FLAGS
|
||||
AC_MSG_RESULT([$PIC_FLAGS])
|
||||
fi
|
||||
AC_SUBST([PIC_FLAGS])
|
||||
])# MESA_PIC_FLAGS
|
||||
16
autogen.sh
16
autogen.sh
@@ -1,16 +0,0 @@
|
||||
#! /bin/sh
|
||||
|
||||
srcdir=`dirname "$0"`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
SRCDIR=`(cd "$srcdir" && pwd)`
|
||||
ORIGDIR=`pwd`
|
||||
|
||||
if test "x$SRCDIR" != "x$ORIGDIR"; then
|
||||
echo "Mesa cannot be built when srcdir != builddir" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
autoreconf -v --install || exit 1
|
||||
|
||||
"$srcdir"/configure "$@"
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
usage()
|
||||
{
|
||||
echo "Usage: $0 <target1> <target2>"
|
||||
echo "Highlight differences between Mesa configs"
|
||||
echo "Example:"
|
||||
echo " $0 linux linux-x86"
|
||||
}
|
||||
|
||||
die()
|
||||
{
|
||||
echo "$@" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
-h|--help) usage; exit 0;;
|
||||
esac
|
||||
|
||||
[ $# -lt 2 ] && die 2 targets needed. See $0 --help
|
||||
target1=$1
|
||||
target2=$2
|
||||
|
||||
topdir=$(cd "`dirname $0`"/..; pwd)
|
||||
cd "$topdir"
|
||||
|
||||
[ -f "./configs/$target1" ] || die Missing configs/$target1
|
||||
[ -f "./configs/$target2" ] || die Missing configs/$target2
|
||||
|
||||
trap 'rm -f "$t1" "$t2"' 0
|
||||
|
||||
t1=$(mktemp)
|
||||
t2=$(mktemp)
|
||||
|
||||
make -f- -n -p <<EOF | sed '/^# Not a target/,/^$/d' > $t1
|
||||
TOP = .
|
||||
include \$(TOP)/configs/$target1
|
||||
default:
|
||||
EOF
|
||||
|
||||
make -f- -n -p <<EOF | sed '/^# Not a target/,/^$/d' > $t2
|
||||
TOP = .
|
||||
include \$(TOP)/configs/$target2
|
||||
default:
|
||||
EOF
|
||||
|
||||
diff -pu -I'^#' $t1 $t2
|
||||
1516
bin/config.guess
vendored
1516
bin/config.guess
vendored
File diff suppressed because it is too large
Load Diff
1626
bin/config.sub
vendored
1626
bin/config.sub
vendored
File diff suppressed because it is too large
Load Diff
@@ -1 +0,0 @@
|
||||
minstall
|
||||
@@ -107,9 +107,6 @@ do
|
||||
-L*)
|
||||
DEPS="$DEPS $1"
|
||||
;;
|
||||
-Wl*)
|
||||
DEPS="$DEPS $1"
|
||||
;;
|
||||
-pthread)
|
||||
# this is a special case (see bugzilla 10876)
|
||||
DEPS="$DEPS $1"
|
||||
@@ -201,7 +198,7 @@ fi
|
||||
#
|
||||
case $ARCH in
|
||||
|
||||
'Linux' | 'OpenBSD' | 'DragonFly' | 'GNU' | GNU/*)
|
||||
'Linux' | 'OpenBSD' | 'GNU' | GNU/*)
|
||||
# we assume gcc
|
||||
|
||||
if [ "x$LINK" = "x" ] ; then
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/usr/bin/make -sf
|
||||
# Print the various Mesa version fields. This is mostly used to add the
|
||||
# version to configure.
|
||||
|
||||
# This reflects that this script is usually called from the toplevel
|
||||
TOP = .
|
||||
|
||||
include $(TOP)/configs/default
|
||||
|
||||
version:
|
||||
@echo $(MESA_VERSION)
|
||||
major:
|
||||
@echo $(MESA_MAJOR)
|
||||
minor:
|
||||
@echo $(MESA_MINOR)
|
||||
tiny:
|
||||
@echo $(MESA_TINY)
|
||||
1
configs/.gitignore
vendored
1
configs/.gitignore
vendored
@@ -1,2 +1 @@
|
||||
current
|
||||
autoconf
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
# Autoconf configuration
|
||||
|
||||
# Pull in the defaults
|
||||
include $(TOP)/configs/default
|
||||
|
||||
# This is generated by configure
|
||||
CONFIG_NAME = autoconf
|
||||
|
||||
# Compiler and flags
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
OPT_FLAGS = @OPT_FLAGS@
|
||||
ARCH_FLAGS = @ARCH_FLAGS@
|
||||
ASM_FLAGS = @ASM_FLAGS@
|
||||
PIC_FLAGS = @PIC_FLAGS@
|
||||
DEFINES = @DEFINES@
|
||||
CFLAGS = @CPPFLAGS@ @CFLAGS@ \
|
||||
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
|
||||
CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ \
|
||||
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
|
||||
LDFLAGS = @LDFLAGS@
|
||||
EXTRA_LIB_PATH = @EXTRA_LIB_PATH@
|
||||
|
||||
# Assembler
|
||||
ASM_SOURCES = @ASM_SOURCES@
|
||||
ASM_API = @ASM_API@
|
||||
|
||||
# Misc tools and flags
|
||||
MAKE = @MAKE@
|
||||
MKLIB_OPTIONS = @MKLIB_OPTIONS@
|
||||
MKDEP = @MKDEP@
|
||||
MKDEP_OPTIONS = @MKDEP_OPTIONS@
|
||||
INSTALL = $(TOP)/bin/minstall
|
||||
|
||||
# Python and flags (generally only needed by the developers)
|
||||
PYTHON2 = python
|
||||
PYTHON_FLAGS = -t -O -O
|
||||
|
||||
# Library names (base name)
|
||||
GL_LIB = GL
|
||||
GLU_LIB = GLU
|
||||
GLUT_LIB = glut
|
||||
GLW_LIB = GLw
|
||||
OSMESA_LIB = @OSMESA_LIB@
|
||||
|
||||
# Library names (actual file names)
|
||||
GL_LIB_NAME = @GL_LIB_NAME@
|
||||
GLU_LIB_NAME = @GLU_LIB_NAME@
|
||||
GLUT_LIB_NAME = @GLUT_LIB_NAME@
|
||||
GLW_LIB_NAME = @GLW_LIB_NAME@
|
||||
OSMESA_LIB_NAME = @OSMESA_LIB_NAME@
|
||||
|
||||
# Directories to build
|
||||
LIB_DIR = @LIB_DIR@
|
||||
SRC_DIRS = @SRC_DIRS@
|
||||
GLU_DIRS = @GLU_DIRS@
|
||||
DRIVER_DIRS = @DRIVER_DIRS@
|
||||
# Which subdirs under $(TOP)/progs/ to enter:
|
||||
PROGRAM_DIRS = @PROGRAM_DIRS@
|
||||
|
||||
# Driver specific build vars
|
||||
DRI_DIRS = @DRI_DIRS@
|
||||
WINDOW_SYSTEM = @WINDOW_SYSTEM@
|
||||
USING_EGL = @USING_EGL@
|
||||
|
||||
# Dependencies
|
||||
X11_INCLUDES = @X11_INCLUDES@
|
||||
|
||||
# Library/program dependencies
|
||||
GL_LIB_DEPS = $(EXTRA_LIB_PATH) @GL_LIB_DEPS@
|
||||
OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @OSMESA_MESA_DEPS@ \
|
||||
$(EXTRA_LIB_PATH) @OSMESA_LIB_DEPS@
|
||||
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLU_MESA_DEPS@ \
|
||||
$(EXTRA_LIB_PATH) @GLU_LIB_DEPS@
|
||||
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLUT_MESA_DEPS@ \
|
||||
$(EXTRA_LIB_PATH) @GLUT_LIB_DEPS@
|
||||
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \
|
||||
$(EXTRA_LIB_PATH) @GLW_LIB_DEPS@
|
||||
APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@
|
||||
|
||||
# DRI dependencies
|
||||
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
|
||||
LIBDRM_CFLAGS = @LIBDRM_CFLAGS@
|
||||
LIBDRM_LIB = @LIBDRM_LIBS@
|
||||
DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
|
||||
EXPAT_INCLUDES = @EXPAT_INCLUDES@
|
||||
|
||||
# Autoconf directories
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
libdir = @libdir@
|
||||
|
||||
# Installation directories (for make install)
|
||||
INSTALL_DIR = $(prefix)
|
||||
|
||||
# DRI installation directories
|
||||
DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@
|
||||
|
||||
# Where libGL will look for DRI hardware drivers
|
||||
DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)
|
||||
@@ -1,42 +0,0 @@
|
||||
# MinGW config include file updated for Mesa 7.0
|
||||
#
|
||||
# Updated : by Heromyth, on 2007-7-21
|
||||
# Email : zxpmyth@yahoo.com.cn
|
||||
# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
|
||||
# The others havn't been tested yet.
|
||||
# 2) The generated DLLs are *not* compatible with the ones built
|
||||
# with the other compilers like VC8, especially for GLUT.
|
||||
# 3) Although more tests are needed, it can be used individually!
|
||||
|
||||
# The generated DLLs by MingW with STDCALL are not totally compatible
|
||||
# with the ones linked by Microsoft's compilers.
|
||||
#
|
||||
# xxx_USING_STDCALL = 1 Compiling MESA with __stdcall. This is default!
|
||||
#
|
||||
# xxx_USING_STDCALL = 0 Compiling MESA without __stdcall. I like this:)
|
||||
#
|
||||
|
||||
# In fact, GL_USING_STDCALL and GLUT_USING_STDCALL can be
|
||||
# different. For example:
|
||||
#
|
||||
# GL_USING_STDCALL = 0
|
||||
# GLUT_USING_STDCALL = 1
|
||||
#
|
||||
# Suggested setting:
|
||||
#
|
||||
# ALL_USING_STDCALL = 1
|
||||
#
|
||||
# That's default!
|
||||
#
|
||||
|
||||
|
||||
ALL_USING_STDCALL = 1
|
||||
|
||||
|
||||
ifeq ($(ALL_USING_STDCALL),1)
|
||||
GL_USING_STDCALL = 1
|
||||
GLUT_USING_STDCALL = 1
|
||||
else
|
||||
GL_USING_STDCALL = 0
|
||||
GLUT_USING_STDCALL = 0
|
||||
endif
|
||||
@@ -9,9 +9,8 @@ CONFIG_NAME = default
|
||||
|
||||
# Version info
|
||||
MESA_MAJOR=7
|
||||
MESA_MINOR=1
|
||||
MESA_TINY=0
|
||||
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
|
||||
MESA_MINOR=0
|
||||
MESA_TINY=3
|
||||
|
||||
# external projects. This should be useless now that we use libdrm.
|
||||
DRM_SOURCE_PATH=$(TOP)/../drm
|
||||
@@ -75,16 +74,17 @@ PROGRAM_DIRS = demos redbook samples glsl xdemos
|
||||
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
|
||||
OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
|
||||
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
|
||||
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lX11 -lXmu -lXi -lm
|
||||
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lm
|
||||
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lXt -lX11
|
||||
|
||||
# Program dependencies - specific GL/glut libraries added in Makefiles
|
||||
APP_LIB_DEPS = -lm
|
||||
|
||||
|
||||
|
||||
# Installation directories (for make install)
|
||||
INSTALL_DIR = /usr/local
|
||||
DRI_DRIVER_INSTALL_DIR = $(INSTALL_DIR)/$(LIB_DIR)/dri
|
||||
DRI_DRIVER_INSTALL_DIR = /usr/X11R6/lib/modules/dri
|
||||
|
||||
# Where libGL will look for DRI hardware drivers
|
||||
DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)
|
||||
|
||||
@@ -15,7 +15,7 @@ PIC_FLAGS = -fPIC
|
||||
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -DUSE_XSHM \
|
||||
-DHZ=100
|
||||
|
||||
X11_INCLUDES = -I/usr/local/include
|
||||
X11_INCLUDES = -I/usr/X11R6/include
|
||||
|
||||
CFLAGS += $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) $(X11_INCLUDES) -ffast-math -pedantic
|
||||
|
||||
@@ -27,5 +27,5 @@ GLUT_CFLAGS = -fexceptions
|
||||
CFLAGS += -fno-strict-aliasing
|
||||
CXXFLAGS += -fno-strict-aliasing
|
||||
|
||||
EXTRA_LIB_PATH = -L/usr/local/lib
|
||||
EXTRA_LIB_PATH = -L/usr/X11R6/lib
|
||||
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) $(EXTRA_LIB_PATH) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lXext -lXmu -lXi -lX11 -lm
|
||||
|
||||
@@ -9,10 +9,10 @@ CONFIG_NAME = freebsd-dri
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
WARN_FLAGS = -Wall
|
||||
OPT_FLAGS = -O -g
|
||||
OPT_FLAGS = -O
|
||||
|
||||
EXPAT_INCLUDES = -I/usr/local/include
|
||||
X11_INCLUDES = -I/usr/local/include
|
||||
X11_INCLUDES = -I/usr/X11R6/include
|
||||
DEFINES = -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
|
||||
-DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \
|
||||
-DHAVE_ALIAS
|
||||
@@ -32,11 +32,11 @@ ASM_SOURCES =
|
||||
LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
|
||||
LIBDRM_LIB = `pkg-config --libs libdrm`
|
||||
DRI_LIB_DEPS = -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB)
|
||||
GL_LIB_DEPS = -L/usr/local/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
|
||||
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
|
||||
-lm -pthread $(LIBDRM_LIB)
|
||||
|
||||
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm
|
||||
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGL -lXt -lX11
|
||||
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm
|
||||
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lGL -lXt -lX11
|
||||
|
||||
|
||||
# Directories
|
||||
|
||||
@@ -47,7 +47,8 @@ LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
|
||||
LIBDRM_LIB = `pkg-config --libs libdrm`
|
||||
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
|
||||
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
|
||||
-lm -lpthread -ldl $(LIBDRM_LIB)
|
||||
-lm -lpthread -ldl \
|
||||
$(LIBDRM_LIB)
|
||||
|
||||
|
||||
# This is now 0 by default since it seems to confuse the hell out of people
|
||||
@@ -70,5 +71,5 @@ WINDOW_SYSTEM=dri
|
||||
|
||||
# gamma are missing because they have not been converted to use the new
|
||||
# interface.
|
||||
DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
|
||||
DRI_DIRS = i810 i915tex i915 i965 mach64 mga r128 r200 r300 radeon s3v \
|
||||
savage sis tdfx trident unichrome ffb
|
||||
|
||||
@@ -20,5 +20,5 @@ EXTRA_LIB_PATH=-L/usr/X11R6/lib64
|
||||
# the new interface. i810 are missing because there is no x86-64
|
||||
# system where they could *ever* be used.
|
||||
#
|
||||
DRI_DIRS = i915 i965 mach64 mga r128 r200 r300 radeon savage tdfx unichrome
|
||||
DRI_DIRS = i915tex i915 i965 mach64 mga r128 r200 radeon tdfx unichrome savage r300
|
||||
|
||||
|
||||
@@ -25,4 +25,4 @@ PROGRAM_DIRS = osdemos
|
||||
# Dependencies
|
||||
OSMESA_LIB_DEPS = -lm -lpthread
|
||||
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
|
||||
APP_LIB_DEPS = -lm -lpthread
|
||||
APP_LIB_DEPS = -lOSMesa -lGLU
|
||||
|
||||
@@ -28,4 +28,4 @@ PROGRAM_DIRS =
|
||||
# Dependencies
|
||||
OSMESA_LIB_DEPS = -lm -lpthread
|
||||
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
|
||||
APP_LIB_DEPS = -lm -lpthread
|
||||
APP_LIB_DEPS = -lOSMesa16
|
||||
|
||||
@@ -29,4 +29,4 @@ PROGRAM_DIRS =
|
||||
|
||||
# Dependencies
|
||||
OSMESA_LIB_DEPS = -lm -lpthread
|
||||
APP_LIB_DEPS = -lm -lpthread
|
||||
APP_LIB_DEPS = -lOSMesa16
|
||||
|
||||
@@ -28,4 +28,4 @@ PROGRAM_DIRS =
|
||||
# Dependencies
|
||||
OSMESA_LIB_DEPS = -lm -lpthread
|
||||
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
|
||||
APP_LIB_DEPS = -lm -lpthread
|
||||
APP_LIB_DEPS = -lOSMesa32
|
||||
|
||||
@@ -24,8 +24,7 @@ PCIACCESS_LIB = `pkg-config --libs pciaccess`
|
||||
|
||||
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
|
||||
-D_BSD_SOURCE -D_GNU_SOURCE -DHAVE_POSIX_MEMALIGN \
|
||||
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
|
||||
-DHAVE_ALIAS
|
||||
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DDRM_USE_MALLOC -DIN_DRI_DRIVER
|
||||
|
||||
CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
|
||||
$(ASM_FLAGS) -std=c99 -ffast-math
|
||||
|
||||
970
configure.ac
970
configure.ac
@@ -1,970 +0,0 @@
|
||||
dnl Process this file with autoconf to create configure.
|
||||
|
||||
AC_PREREQ([2.59])
|
||||
|
||||
dnl Versioning - scrape the version from configs/default
|
||||
m4_define([mesa_version],
|
||||
[m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n'])])
|
||||
m4_ifval(mesa_version,[],[
|
||||
m4_errprint([Error: Failed to get the Mesa version from the output of
|
||||
running `make -f bin/version.mk version'
|
||||
])
|
||||
m4_exit([1])
|
||||
])
|
||||
|
||||
AC_INIT([Mesa],[mesa_version],
|
||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
|
||||
AC_CONFIG_AUX_DIR([bin])
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
dnl Versions for external dependencies
|
||||
LIBDRM_REQUIRED=2.3.1
|
||||
DRI2PROTO_REQUIRED=1.1
|
||||
|
||||
dnl Check for progs
|
||||
AC_PROG_CPP
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
AC_CHECK_PROGS([MAKE], [gmake make])
|
||||
AC_PATH_PROG([MKDEP], [makedepend])
|
||||
AC_PATH_PROG([SED], [sed])
|
||||
|
||||
MKDEP_OPTIONS=-fdepend
|
||||
dnl Ask gcc where it's keeping its secret headers
|
||||
if test "x$GCC" = xyes; then
|
||||
GCC_INCLUDES=`$CC -print-file-name=include`
|
||||
if test "x$GCC_INCLUDES" != x; then
|
||||
MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([MKDEP_OPTIONS])
|
||||
|
||||
dnl Check to see if dlopen is in default libraries (like Solaris, which
|
||||
dnl has it in libc), or if libdl is needed to get it.
|
||||
AC_CHECK_FUNC([dlopen], [],
|
||||
[AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])])
|
||||
|
||||
dnl Make sure the pkg-config macros are defined
|
||||
m4_ifdef([PKG_PROG_PKG_CONFIG],[],[
|
||||
m4_errprint([Error: Could not locate the pkg-config autoconf macros.
|
||||
These are usually located in /usr/share/aclocal/pkg.m4. If your
|
||||
macros are in a different location, try setting the environment
|
||||
variable ACLOCAL="aclocal -I/other/macro/dir" before running
|
||||
autoreconf.
|
||||
])
|
||||
m4_exit([1])
|
||||
])
|
||||
PKG_PROG_PKG_CONFIG()
|
||||
|
||||
dnl LIB_DIR - library basename
|
||||
LIB_DIR=`echo $libdir | $SED 's%.*/%%'`
|
||||
AC_SUBST([LIB_DIR])
|
||||
|
||||
dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later
|
||||
_SAVE_LDFLAGS="$LDFLAGS"
|
||||
AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker])
|
||||
AC_SUBST([EXTRA_LIB_PATH])
|
||||
|
||||
dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later
|
||||
_SAVE_CPPFLAGS="$CPPFLAGS"
|
||||
AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers])
|
||||
AC_SUBST([X11_INCLUDES])
|
||||
|
||||
dnl Compiler macros
|
||||
DEFINES=""
|
||||
AC_SUBST([DEFINES])
|
||||
case "$host_os" in
|
||||
linux*)
|
||||
if test "x$GCC" = xyes; then
|
||||
DEFINES="$DEFINES -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE"
|
||||
fi
|
||||
DEFINES="$DEFINES -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS -DHAVE_POSIX_MEMALIGN"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Add flags for gcc and g++
|
||||
if test "x$GCC" = xyes; then
|
||||
CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math"
|
||||
|
||||
# Work around aliasing bugs - developers should comment this out
|
||||
CFLAGS="$CFLAGS -fno-strict-aliasing"
|
||||
fi
|
||||
if test "x$GXX" = xyes; then
|
||||
CXXFLAGS="$CXXFLAGS -Wall"
|
||||
|
||||
# Work around aliasing bugs - developers should comment this out
|
||||
CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
|
||||
fi
|
||||
|
||||
dnl These should be unnecessary, but let the user set them if they want
|
||||
AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler.
|
||||
Default is to use CFLAGS.])
|
||||
AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the
|
||||
compiler. Default is to use CFLAGS.])
|
||||
AC_SUBST([OPT_FLAGS])
|
||||
AC_SUBST([ARCH_FLAGS])
|
||||
|
||||
dnl
|
||||
dnl Hacks to enable 32 or 64 bit build
|
||||
dnl
|
||||
AC_ARG_ENABLE([32-bit],
|
||||
[AS_HELP_STRING([--enable-32-bit],
|
||||
[build 32-bit libraries @<:@default=auto@:>@])],
|
||||
[enable_32bit="$enableval"],
|
||||
[enable_32bit=auto]
|
||||
)
|
||||
if test "x$enable_32bit" = xyes; then
|
||||
if test "x$GCC" = xyes; then
|
||||
CFLAGS="$CFLAGS -m32"
|
||||
fi
|
||||
if test "x$GXX" = xyes; then
|
||||
CXXFLAGS="$CXXFLAGS -m32"
|
||||
fi
|
||||
fi
|
||||
AC_ARG_ENABLE([64-bit],
|
||||
[AS_HELP_STRING([--enable-64-bit],
|
||||
[build 64-bit libraries @<:@default=auto@:>@])],
|
||||
[enable_64bit="$enableval"],
|
||||
[enable_64bit=auto]
|
||||
)
|
||||
if test "x$enable_64bit" = xyes; then
|
||||
if test "x$GCC" = xyes; then
|
||||
CFLAGS="$CFLAGS -m64"
|
||||
fi
|
||||
if test "x$GXX" = xyes; then
|
||||
CXXFLAGS="$CXXFLAGS -m64"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl shared/static libraries, mimic libtool options
|
||||
dnl
|
||||
AC_ARG_ENABLE([static],
|
||||
[AS_HELP_STRING([--enable-static],
|
||||
[build static libraries @<:@default=disabled@:>@])],
|
||||
[enable_static="$enableval"],
|
||||
[enable_static=no]
|
||||
)
|
||||
case "x$enable_static" in
|
||||
xyes|xno ) ;;
|
||||
x ) enable_static=no ;;
|
||||
* )
|
||||
AC_MSG_ERROR([Static library option '$enable_static' is not a valid])
|
||||
;;
|
||||
esac
|
||||
AC_ARG_ENABLE([shared],
|
||||
[AS_HELP_STRING([--disable-shared],
|
||||
[build shared libraries @<:@default=enabled@:>@])],
|
||||
[enable_shared="$enableval"],
|
||||
[enable_shared=yes]
|
||||
)
|
||||
case "x$enable_shared" in
|
||||
xyes|xno ) ;;
|
||||
x ) enable_shared=yes ;;
|
||||
* )
|
||||
AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid])
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Can't have static and shared libraries, default to static if user
|
||||
dnl explicitly requested. If both disabled, set to static since shared
|
||||
dnl was explicitly requirested.
|
||||
case "x$enable_static$enable_shared" in
|
||||
xyesyes )
|
||||
AC_MSG_WARN([Can't build static and shared libraries, disabling shared])
|
||||
enable_shared=no
|
||||
;;
|
||||
xnono )
|
||||
AC_MSG_WARN([Can't disable both static and shared libraries, enabling static])
|
||||
enable_static=yes
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl mklib options
|
||||
dnl
|
||||
AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib])
|
||||
if test "$enable_static" = yes; then
|
||||
MKLIB_OPTIONS="$MKLIB_OPTIONS -static"
|
||||
fi
|
||||
AC_SUBST([MKLIB_OPTIONS])
|
||||
|
||||
dnl
|
||||
dnl other compiler options
|
||||
dnl
|
||||
AC_ARG_ENABLE([debug],
|
||||
[AS_HELP_STRING([--enable-debug],
|
||||
[use debug compiler flags and macros @<:@default=disabled@:>@])],
|
||||
[enable_debug="$enableval"],
|
||||
[enable_debug=no]
|
||||
)
|
||||
if test "x$enable_debug" = xyes; then
|
||||
DEFINES="$DEFINES -DDEBUG"
|
||||
if test "x$GCC" = xyes; then
|
||||
CFLAGS="$CFLAGS -g"
|
||||
fi
|
||||
if test "x$GXX" = xyes; then
|
||||
CXXFLAGS="$CXXFLAGS -g"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl library names
|
||||
dnl
|
||||
if test "$enable_static" = yes; then
|
||||
GL_LIB_NAME='lib$(GL_LIB).a'
|
||||
GLU_LIB_NAME='lib$(GLU_LIB).a'
|
||||
GLUT_LIB_NAME='lib$(GLUT_LIB).a'
|
||||
GLW_LIB_NAME='lib$(GLW_LIB).a'
|
||||
OSMESA_LIB_NAME='lib$(OSMESA_LIB).a'
|
||||
else
|
||||
GL_LIB_NAME='lib$(GL_LIB).so'
|
||||
GLU_LIB_NAME='lib$(GLU_LIB).so'
|
||||
GLUT_LIB_NAME='lib$(GLUT_LIB).so'
|
||||
GLW_LIB_NAME='lib$(GLW_LIB).so'
|
||||
OSMESA_LIB_NAME='lib$(OSMESA_LIB).so'
|
||||
fi
|
||||
AC_SUBST([GL_LIB_NAME])
|
||||
AC_SUBST([GLU_LIB_NAME])
|
||||
AC_SUBST([GLUT_LIB_NAME])
|
||||
AC_SUBST([GLW_LIB_NAME])
|
||||
AC_SUBST([OSMESA_LIB_NAME])
|
||||
|
||||
dnl
|
||||
dnl Driver configuration. Options are xlib, dri and osmesa right now.
|
||||
dnl More later: directfb, fbdev, ...
|
||||
dnl
|
||||
default_driver="xlib"
|
||||
|
||||
case "$host_os" in
|
||||
linux*)
|
||||
case "$host_cpu" in
|
||||
i*86|x86_64|powerpc*) default_driver="dri";;
|
||||
esac
|
||||
;;
|
||||
freebsd* | dragonfly*)
|
||||
case "$host_cpu" in
|
||||
i*86|x86_64) default_driver="dri";;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_WITH([driver],
|
||||
[AS_HELP_STRING([--with-driver=DRIVER],
|
||||
[driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])],
|
||||
[mesa_driver="$withval"],
|
||||
[mesa_driver="$default_driver"])
|
||||
dnl Check for valid option
|
||||
case "x$mesa_driver" in
|
||||
xxlib|xdri|xosmesa)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option])
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl Driver specific build directories
|
||||
dnl
|
||||
SRC_DIRS="mesa"
|
||||
GLU_DIRS="sgi"
|
||||
WINDOW_SYSTEM=""
|
||||
case "$mesa_driver" in
|
||||
xlib)
|
||||
DRIVER_DIRS="x11"
|
||||
;;
|
||||
dri)
|
||||
SRC_DIRS="glx/x11 $SRC_DIRS"
|
||||
DRIVER_DIRS="dri"
|
||||
WINDOW_SYSTEM="dri"
|
||||
;;
|
||||
osmesa)
|
||||
DRIVER_DIRS="osmesa"
|
||||
;;
|
||||
esac
|
||||
AC_SUBST([SRC_DIRS])
|
||||
AC_SUBST([GLU_DIRS])
|
||||
AC_SUBST([DRIVER_DIRS])
|
||||
AC_SUBST([WINDOW_SYSTEM])
|
||||
|
||||
dnl
|
||||
dnl User supplied program configuration
|
||||
dnl
|
||||
if test -d "$srcdir/progs/demos"; then
|
||||
default_demos=yes
|
||||
else
|
||||
default_demos=no
|
||||
fi
|
||||
AC_ARG_WITH([demos],
|
||||
[AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@],
|
||||
[optional comma delimited demo directories to build
|
||||
@<:@default=auto if source available@:>@])],
|
||||
[with_demos="$withval"],
|
||||
[with_demos="$default_demos"])
|
||||
if test "x$with_demos" = x; then
|
||||
with_demos=no
|
||||
fi
|
||||
|
||||
dnl If $with_demos is yes, directories will be added as libs available
|
||||
PROGRAM_DIRS=""
|
||||
case "$with_demos" in
|
||||
no) ;;
|
||||
yes)
|
||||
# If the driver isn't osmesa, we have libGL and can build xdemos
|
||||
if test "$mesa_driver" != osmesa; then
|
||||
PROGRAM_DIRS="xdemos"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# verify the requested demos directories exist
|
||||
demos=`IFS=,; echo $with_demos`
|
||||
for demo in $demos; do
|
||||
test -d "$srcdir/progs/$demo" || \
|
||||
AC_MSG_ERROR([Program directory '$demo' doesn't exist])
|
||||
done
|
||||
PROGRAM_DIRS="$demos"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl
|
||||
dnl Find out if X is available. The variable have_x is set if libX11 is
|
||||
dnl to mimic AC_PATH_XTRA.
|
||||
dnl
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
AC_MSG_CHECKING([pkg-config files for X11 are available])
|
||||
PKG_CHECK_EXISTS([x11],[
|
||||
x11_pkgconfig=yes
|
||||
have_x=yes
|
||||
],[
|
||||
x11_pkgconfig=no
|
||||
])
|
||||
AC_MSG_RESULT([$x11_pkgconfig])
|
||||
else
|
||||
x11_pkgconfig=no
|
||||
fi
|
||||
dnl Use the autoconf macro if no pkg-config files
|
||||
if test "$x11_pkgconfig" = no; then
|
||||
AC_PATH_XTRA
|
||||
fi
|
||||
|
||||
dnl We need X for xlib and dri, so bomb now if it's not found
|
||||
case "$mesa_driver" in
|
||||
xlib|dri)
|
||||
if test "$no_x" = yes; then
|
||||
AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl XCB - this is only used for GLX right now
|
||||
AC_ARG_ENABLE([xcb],
|
||||
[AS_HELP_STRING([--enable-xcb],
|
||||
[use XCB for GLX @<:@default=disabled@:>@])],
|
||||
[enable_xcb="$enableval"],
|
||||
[enable_xcb=no])
|
||||
if test "x$enable_xcb" = xyes; then
|
||||
DEFINES="$DEFINES -DUSE_XCB"
|
||||
else
|
||||
enable_xcb=no
|
||||
fi
|
||||
|
||||
# SELinux awareness.
|
||||
AC_ARG_ENABLE([selinux],
|
||||
[AS_HELP_STRING([--enable-selinux],
|
||||
[Build SELinux-aware Mesa (default: disabled)])],
|
||||
[MESA_SELINUX="$enableval"],
|
||||
[MESA_SELINUX=no])
|
||||
if test "x$enable_selinux" = "xyes"; then
|
||||
AC_CHECK_HEADER([selinux/selinux.h],[],
|
||||
[AC_MSG_ERROR([SELinux headers not found])])
|
||||
AC_CHECK_LIB([selinux],[is_selinux_enabled],[],
|
||||
[AC_MSG_ERROR([SELinux library not found])])
|
||||
SELINUX_LIBS="-lselinux"
|
||||
DEFINES="$DEFINES -DMESA_SELINUX"
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl libGL configuration per driver
|
||||
dnl
|
||||
case "$mesa_driver" in
|
||||
xlib)
|
||||
if test "$x11_pkgconfig" = yes; then
|
||||
PKG_CHECK_MODULES([XLIBGL], [x11 xext])
|
||||
X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS"
|
||||
GL_LIB_DEPS="$XLIBGL_LIBS"
|
||||
else
|
||||
# should check these...
|
||||
X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
|
||||
GL_LIB_DEPS="$X_LIBS -lX11 -lXext"
|
||||
fi
|
||||
GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
|
||||
|
||||
# if static, move the external libraries to the programs
|
||||
# and empty the libraries for libGL
|
||||
if test "$enable_static" = yes; then
|
||||
APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS"
|
||||
GL_LIB_DEPS=""
|
||||
fi
|
||||
;;
|
||||
dri)
|
||||
# DRI must be shared, I think
|
||||
if test "$enable_static" = yes; then
|
||||
AC_MSG_ERROR([Can't use static libraries for DRI drivers])
|
||||
fi
|
||||
|
||||
# Check for libdrm
|
||||
PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED])
|
||||
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED])
|
||||
|
||||
# find the DRI deps for libGL
|
||||
if test "$x11_pkgconfig" = yes; then
|
||||
# add xcb modules if necessary
|
||||
dri_modules="x11 xext xxf86vm xdamage xfixes"
|
||||
if test "$enable_xcb" = yes; then
|
||||
dri_modules="$dri_modules x11-xcb xcb-glx"
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES([DRIGL], [$dri_modules])
|
||||
X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS"
|
||||
GL_LIB_DEPS="$DRIGL_LIBS"
|
||||
else
|
||||
# should check these...
|
||||
X11_INCLUDES="$X11_INCLUDES $X_CFLAGS"
|
||||
GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes"
|
||||
|
||||
# XCB can only be used from pkg-config
|
||||
if test "$enable_xcb" = yes; then
|
||||
PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx])
|
||||
X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS"
|
||||
GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS"
|
||||
fi
|
||||
fi
|
||||
|
||||
# need DRM libs, -lpthread, etc.
|
||||
GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
|
||||
;;
|
||||
osmesa)
|
||||
# No libGL for osmesa
|
||||
GL_LIB_DEPS=""
|
||||
;;
|
||||
esac
|
||||
AC_SUBST([GL_LIB_DEPS])
|
||||
|
||||
dnl
|
||||
dnl More X11 setup
|
||||
dnl
|
||||
if test "$mesa_driver" = xlib; then
|
||||
DEFINES="$DEFINES -DUSE_XSHM"
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl More DRI setup
|
||||
dnl
|
||||
AC_ARG_ENABLE([glx-tls],
|
||||
[AS_HELP_STRING([--enable-glx-tls],
|
||||
[enable TLS support in GLX @<:@default=disabled@:>@])],
|
||||
[GLX_USE_TLS="$enableval"],
|
||||
[GLX_USE_TLS=no])
|
||||
dnl Directory for DRI drivers
|
||||
AC_ARG_WITH([dri-driverdir],
|
||||
[AS_HELP_STRING([--with-dri-driverdir=DIR],
|
||||
[directory for the DRI drivers @<:@${libdir}/dri@:>@])],
|
||||
[DRI_DRIVER_INSTALL_DIR="$withval"],
|
||||
[DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
|
||||
AC_SUBST([DRI_DRIVER_INSTALL_DIR])
|
||||
dnl Direct rendering or just indirect rendering
|
||||
AC_ARG_ENABLE([driglx-direct],
|
||||
[AS_HELP_STRING([--disable-driglx-direct],
|
||||
[enable direct rendering in GLX for DRI @<:@default=enabled@:>@])],
|
||||
[driglx_direct="$enableval"],
|
||||
[driglx_direct="yes"])
|
||||
|
||||
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, e.g. "i965,radeon,nouveau" @<:@default=auto@:>@])],
|
||||
[with_dri_drivers="$withval"],
|
||||
[with_dri_drivers=yes])
|
||||
if test "x$with_dri_drivers" = x; then
|
||||
with_dri_drivers=no
|
||||
fi
|
||||
|
||||
dnl If $with_dri_drivers is yes, directories will be added through
|
||||
dnl platform checks
|
||||
DRI_DIRS=""
|
||||
case "$with_dri_drivers" in
|
||||
no|yes) ;;
|
||||
*)
|
||||
# verify the requested driver directories exist
|
||||
dri_drivers=`IFS=,; echo $with_dri_drivers`
|
||||
for driver in $dri_drivers; do
|
||||
test -d "$srcdir/src/mesa/drivers/dri/$driver" || \
|
||||
AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist])
|
||||
done
|
||||
DRI_DIRS="$dri_drivers"
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Just default to no EGL for now
|
||||
USING_EGL=0
|
||||
AC_SUBST([USING_EGL])
|
||||
|
||||
dnl Set DRI_DIRS, DEFINES and LIB_DEPS
|
||||
if test "$mesa_driver" = dri; then
|
||||
# Use TLS in GLX?
|
||||
if test "x$GLX_USE_TLS" = xyes; then
|
||||
DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS"
|
||||
fi
|
||||
|
||||
if test "x$USING_EGL" = x1; then
|
||||
PROGRAM_DIRS="egl"
|
||||
fi
|
||||
|
||||
# Platform specific settings and drivers to build
|
||||
case "$host_os" in
|
||||
linux*)
|
||||
DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER"
|
||||
DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS"
|
||||
if test "x$driglx_direct" = xyes; then
|
||||
DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
|
||||
fi
|
||||
|
||||
case "$host_cpu" in
|
||||
x86_64)
|
||||
# ffb, gamma, and sis are missing because they have not be
|
||||
# converted to use the new interface. i810 are missing
|
||||
# because there is no x86-64 system where they could *ever*
|
||||
# be used.
|
||||
if test "x$DRI_DIRS" = x; then
|
||||
DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 radeon \
|
||||
savage tdfx unichrome swrast"
|
||||
fi
|
||||
;;
|
||||
powerpc*)
|
||||
# Build only the drivers for cards that exist on PowerPC.
|
||||
# At some point MGA will be added, but not yet.
|
||||
if test "x$DRI_DIRS" = x; then
|
||||
DRI_DIRS="mach64 r128 r200 r300 radeon tdfx swrast"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
freebsd* | dragonfly*)
|
||||
DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1"
|
||||
DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS"
|
||||
DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING"
|
||||
if test "x$driglx_direct" = xyes; then
|
||||
DEFINES="$DEFINES -DGLX_DIRECT_RENDERING"
|
||||
fi
|
||||
if test "x$GXX" = xyes; then
|
||||
CXXFLAGS="$CXXFLAGS -ansi -pedantic"
|
||||
fi
|
||||
|
||||
# ffb and gamma are missing because they have not been converted
|
||||
# to use the new interface.
|
||||
if test "x$DRI_DIRS" = x; then
|
||||
DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
|
||||
unichrome savage sis swrast"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# default drivers
|
||||
if test "x$DRI_DIRS" = x; then
|
||||
DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
|
||||
savage sis tdfx trident unichrome ffb swrast"
|
||||
fi
|
||||
|
||||
DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'`
|
||||
|
||||
# Check for expat
|
||||
EXPAT_INCLUDES=""
|
||||
EXPAT_LIB=-lexpat
|
||||
AC_ARG_WITH([expat],
|
||||
[AS_HELP_STRING([--with-expat=DIR],
|
||||
[expat install directory])],[
|
||||
EXPAT_INCLUDES="-I$withval/include"
|
||||
CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES"
|
||||
LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR"
|
||||
EXPAT_LIB="-L$withval/$LIB_DIR -lexpat"
|
||||
])
|
||||
AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])])
|
||||
AC_CHECK_LIB([expat],[XML_ParserCreate],[],
|
||||
[AC_MSG_ERROR([Expat required for DRI.])])
|
||||
|
||||
# put all the necessary libs together
|
||||
DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS"
|
||||
fi
|
||||
AC_SUBST([DRI_DIRS])
|
||||
AC_SUBST([EXPAT_INCLUDES])
|
||||
AC_SUBST([DRI_LIB_DEPS])
|
||||
|
||||
dnl
|
||||
dnl OSMesa configuration
|
||||
dnl
|
||||
if test "$mesa_driver" = xlib; then
|
||||
default_gl_osmesa=yes
|
||||
else
|
||||
default_gl_osmesa=no
|
||||
fi
|
||||
AC_ARG_ENABLE([gl-osmesa],
|
||||
[AS_HELP_STRING([--enable-gl-osmesa],
|
||||
[enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])],
|
||||
[gl_osmesa="$enableval"],
|
||||
[gl_osmesa="$default_gl_osmesa"])
|
||||
if test "x$gl_osmesa" = xyes; then
|
||||
if test "$mesa_driver" = osmesa; then
|
||||
AC_MSG_ERROR([libGL is not available for OSMesa driver])
|
||||
else
|
||||
DRIVER_DIRS="$DRIVER_DIRS osmesa"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...)
|
||||
AC_ARG_WITH([osmesa-bits],
|
||||
[AS_HELP_STRING([--with-osmesa-bits=BITS],
|
||||
[OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])],
|
||||
[osmesa_bits="$withval"],
|
||||
[osmesa_bits=8])
|
||||
if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then
|
||||
AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver])
|
||||
osmesa_bits=8
|
||||
fi
|
||||
case "x$osmesa_bits" in
|
||||
x8)
|
||||
OSMESA_LIB=OSMesa
|
||||
;;
|
||||
x16|x32)
|
||||
OSMESA_LIB="OSMesa$osmesa_bits"
|
||||
DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31"
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option])
|
||||
;;
|
||||
esac
|
||||
AC_SUBST([OSMESA_LIB])
|
||||
|
||||
case "$mesa_driver" in
|
||||
osmesa)
|
||||
# only link librararies with osmesa if shared
|
||||
if test "$enable_static" = no; then
|
||||
OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
|
||||
else
|
||||
OSMESA_LIB_DEPS=""
|
||||
fi
|
||||
OSMESA_MESA_DEPS=""
|
||||
;;
|
||||
*)
|
||||
# Link OSMesa to libGL otherwise
|
||||
OSMESA_LIB_DEPS=""
|
||||
# only link librararies with osmesa if shared
|
||||
if test "$enable_static" = no; then
|
||||
OSMESA_MESA_DEPS='-l$(GL_LIB)'
|
||||
else
|
||||
OSMESA_MESA_DEPS=""
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
AC_SUBST([OSMESA_LIB_DEPS])
|
||||
AC_SUBST([OSMESA_MESA_DEPS])
|
||||
|
||||
dnl
|
||||
dnl GLU configuration
|
||||
dnl
|
||||
AC_ARG_ENABLE([glu],
|
||||
[AS_HELP_STRING([--disable-glu],
|
||||
[enable OpenGL Utility library @<:@default=enabled@:>@])],
|
||||
[enable_glu="$enableval"],
|
||||
[enable_glu=yes])
|
||||
if test "x$enable_glu" = xyes; then
|
||||
SRC_DIRS="$SRC_DIRS glu"
|
||||
|
||||
case "$mesa_driver" in
|
||||
osmesa)
|
||||
# If GLU is available and we have libOSMesa (not 16 or 32),
|
||||
# we can build the osdemos
|
||||
if test "$with_demos" = yes && test "$osmesa_bits" = 8; then
|
||||
PROGRAM_DIRS="$PROGRAM_DIRS osdemos"
|
||||
fi
|
||||
|
||||
# Link libGLU to libOSMesa instead of libGL
|
||||
GLU_LIB_DEPS=""
|
||||
if test "$enable_static" = no; then
|
||||
GLU_MESA_DEPS='-l$(OSMESA_LIB)'
|
||||
else
|
||||
GLU_MESA_DEPS=""
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# If static, empty GLU_LIB_DEPS and add libs for programs to link
|
||||
if test "$enable_static" = no; then
|
||||
GLU_LIB_DEPS="-lm"
|
||||
GLU_MESA_DEPS='-l$(GL_LIB)'
|
||||
else
|
||||
GLU_LIB_DEPS=""
|
||||
GLU_MESA_DEPS=""
|
||||
APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_SUBST([GLU_LIB_DEPS])
|
||||
AC_SUBST([GLU_MESA_DEPS])
|
||||
|
||||
dnl
|
||||
dnl GLw configuration
|
||||
dnl
|
||||
AC_ARG_ENABLE([glw],
|
||||
[AS_HELP_STRING([--disable-glw],
|
||||
[enable Xt/Motif widget library @<:@default=enabled@:>@])],
|
||||
[enable_glw="$enableval"],
|
||||
[enable_glw=yes])
|
||||
dnl Don't build GLw on osmesa
|
||||
if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then
|
||||
AC_MSG_WARN([Disabling GLw since the driver is OSMesa])
|
||||
enable_glw=no
|
||||
fi
|
||||
if test "x$enable_glw" = xyes; then
|
||||
SRC_DIRS="$SRC_DIRS glw"
|
||||
if test "$x11_pkgconfig" = yes; then
|
||||
PKG_CHECK_MODULES([GLW],[x11 xt])
|
||||
GLW_LIB_DEPS="$GLW_LIBS"
|
||||
else
|
||||
# should check these...
|
||||
GLW_LIB_DEPS="$X_LIBS -lX11 -lXt"
|
||||
fi
|
||||
|
||||
# If static, empty GLW_LIB_DEPS and add libs for programs to link
|
||||
if test "$enable_static" = no; then
|
||||
GLW_MESA_DEPS='-l$(GL_LIB)'
|
||||
else
|
||||
APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
|
||||
GLW_LIB_DEPS=""
|
||||
GLW_MESA_DEPS=""
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([GLW_LIB_DEPS])
|
||||
AC_SUBST([GLW_MESA_DEPS])
|
||||
|
||||
dnl
|
||||
dnl GLUT configuration
|
||||
dnl
|
||||
if test -f "$srcdir/include/GL/glut.h"; then
|
||||
default_glut=yes
|
||||
else
|
||||
default_glut=no
|
||||
fi
|
||||
AC_ARG_ENABLE([glut],
|
||||
[AS_HELP_STRING([--disable-glut],
|
||||
[enable GLUT library @<:@default=enabled if source available@:>@])],
|
||||
[enable_glut="$enableval"],
|
||||
[enable_glut="$default_glut"])
|
||||
|
||||
dnl Can't build glut if GLU not available
|
||||
if test "x$enable_glu$enable_glut" = xnoyes; then
|
||||
AC_MSG_WARN([Disabling glut since GLU is disabled])
|
||||
enable_glut=no
|
||||
fi
|
||||
dnl Don't build glut on osmesa
|
||||
if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then
|
||||
AC_MSG_WARN([Disabling glut since the driver is OSMesa])
|
||||
enable_glut=no
|
||||
fi
|
||||
|
||||
if test "x$enable_glut" = xyes; then
|
||||
SRC_DIRS="$SRC_DIRS glut/glx"
|
||||
GLUT_CFLAGS=""
|
||||
if test "x$GCC" = xyes; then
|
||||
GLUT_CFLAGS="-fexceptions"
|
||||
fi
|
||||
if test "$x11_pkgconfig" = yes; then
|
||||
PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
|
||||
GLUT_LIB_DEPS="$GLUT_LIBS"
|
||||
else
|
||||
# should check these...
|
||||
GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
|
||||
fi
|
||||
GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
|
||||
|
||||
# If glut is available, we can build most programs
|
||||
if test "$with_demos" = yes; then
|
||||
PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl"
|
||||
fi
|
||||
|
||||
# If static, empty GLUT_LIB_DEPS and add libs for programs to link
|
||||
if test "$enable_static" = no; then
|
||||
GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
|
||||
else
|
||||
APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
|
||||
GLUT_LIB_DEPS=""
|
||||
GLUT_MESA_DEPS=""
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([GLUT_LIB_DEPS])
|
||||
AC_SUBST([GLUT_MESA_DEPS])
|
||||
AC_SUBST([GLUT_CFLAGS])
|
||||
|
||||
dnl
|
||||
dnl Program library dependencies
|
||||
dnl Only libm is added here if necessary as the libraries should
|
||||
dnl be pulled in by the linker
|
||||
dnl
|
||||
if test "x$APP_LIB_DEPS" = x; then
|
||||
APP_LIB_DEPS="-lm"
|
||||
fi
|
||||
AC_SUBST([APP_LIB_DEPS])
|
||||
AC_SUBST([PROGRAM_DIRS])
|
||||
|
||||
dnl
|
||||
dnl Arch/platform-specific settings
|
||||
dnl
|
||||
AC_ARG_ENABLE([asm],
|
||||
[AS_HELP_STRING([--disable-asm],
|
||||
[disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
|
||||
[enable_asm="$enableval"],
|
||||
[enable_asm=yes]
|
||||
)
|
||||
asm_arch=""
|
||||
ASM_FLAGS=""
|
||||
ASM_SOURCES=""
|
||||
ASM_API=""
|
||||
AC_MSG_CHECKING([whether to enable assembly])
|
||||
test "x$enable_asm" = xno && AC_MSG_RESULT([no])
|
||||
# disable if cross compiling on x86/x86_64 since we must run gen_matypes
|
||||
if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
|
||||
case "$host_cpu" in
|
||||
i?86 | x86_64)
|
||||
enable_asm=no
|
||||
AC_MSG_RESULT([no, cross compiling])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
# check for supported arches
|
||||
if test "x$enable_asm" = xyes; then
|
||||
case "$host_cpu" in
|
||||
i?86)
|
||||
case "$host_os" in
|
||||
linux* | freebsd* | dragonfly*)
|
||||
test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
x86_64)
|
||||
case "$host_os" in
|
||||
linux* | freebsd* | dragonfly*)
|
||||
test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
powerpc)
|
||||
case "$host_os" in
|
||||
linux*)
|
||||
asm_arch=ppc
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$asm_arch" in
|
||||
x86)
|
||||
ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
|
||||
ASM_SOURCES='$(X86_SOURCES)'
|
||||
ASM_API='$(X86_API)'
|
||||
AC_MSG_RESULT([yes, x86])
|
||||
;;
|
||||
x86_64)
|
||||
ASM_FLAGS="-DUSE_X86_64_ASM"
|
||||
ASM_SOURCES='$(X86-64_SOURCES)'
|
||||
ASM_API='$(X86-64_API)'
|
||||
AC_MSG_RESULT([yes, x86_64])
|
||||
;;
|
||||
ppc)
|
||||
ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
|
||||
ASM_SOURCES='$(PPC_SOURCES)'
|
||||
AC_MSG_RESULT([yes, ppc])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([no, platform not supported])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_SUBST([ASM_FLAGS])
|
||||
AC_SUBST([ASM_SOURCES])
|
||||
AC_SUBST([ASM_API])
|
||||
|
||||
dnl PIC code macro
|
||||
MESA_PIC_FLAGS
|
||||
|
||||
|
||||
dnl Restore LDFLAGS and CPPFLAGS
|
||||
LDFLAGS="$_SAVE_LDFLAGS"
|
||||
CPPFLAGS="$_SAVE_CPPFLAGS"
|
||||
|
||||
dnl Substitute the config
|
||||
AC_CONFIG_FILES([configs/autoconf])
|
||||
|
||||
dnl Replace the configs/current symlink
|
||||
AC_CONFIG_COMMANDS([configs],[
|
||||
if test -f configs/current || test -L configs/current; then
|
||||
rm -f configs/current
|
||||
fi
|
||||
ln -s autoconf configs/current
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
dnl
|
||||
dnl Output some configuration info for the user
|
||||
dnl
|
||||
echo ""
|
||||
echo " prefix: $prefix"
|
||||
echo " exec_prefix: $exec_prefix"
|
||||
echo " libdir: $libdir"
|
||||
|
||||
dnl Driver info
|
||||
echo ""
|
||||
echo " Driver: $mesa_driver"
|
||||
if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then
|
||||
echo " OSMesa: lib$OSMESA_LIB"
|
||||
else
|
||||
echo " OSMesa: no"
|
||||
fi
|
||||
if test "$mesa_driver" = dri; then
|
||||
# cleanup the drivers var
|
||||
dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
|
||||
echo " DRI drivers: $dri_dirs"
|
||||
echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR"
|
||||
fi
|
||||
|
||||
dnl Libraries
|
||||
echo ""
|
||||
echo " Shared libs: $enable_shared"
|
||||
echo " Static libs: $enable_static"
|
||||
echo " GLU: $enable_glu"
|
||||
echo " GLw: $enable_glw"
|
||||
echo " glut: $enable_glut"
|
||||
|
||||
dnl Programs
|
||||
# cleanup the programs var for display
|
||||
program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'`
|
||||
if test "x$program_dirs" = x; then
|
||||
echo " Demos: no"
|
||||
else
|
||||
echo " Demos: $program_dirs"
|
||||
fi
|
||||
|
||||
dnl Compiler options
|
||||
# cleanup the CFLAGS/CXXFLAGS/DEFINES vars
|
||||
cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
|
||||
$SED 's/^ *//;s/ */ /;s/ *$//'`
|
||||
cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \
|
||||
$SED 's/^ *//;s/ */ /;s/ *$//'`
|
||||
defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'`
|
||||
echo ""
|
||||
echo " CFLAGS: $cflags"
|
||||
echo " CXXFLAGS: $cxxflags"
|
||||
echo " Macros: $defines"
|
||||
|
||||
echo ""
|
||||
echo " Run '${MAKE-make}' to build Mesa"
|
||||
echo ""
|
||||
@@ -1,805 +0,0 @@
|
||||
Name
|
||||
|
||||
MESA_texture_array
|
||||
|
||||
Name Strings
|
||||
|
||||
GL_MESA_texture_array
|
||||
|
||||
Contact
|
||||
|
||||
Ian Romanick, IBM (idr 'at' us.ibm.com)
|
||||
|
||||
IP Status
|
||||
|
||||
No known IP issues.
|
||||
|
||||
Status
|
||||
|
||||
Shipping in Mesa 7.1
|
||||
|
||||
Version
|
||||
|
||||
$Date: 2007/05/16$ $Revision: 0.4$
|
||||
|
||||
Number
|
||||
|
||||
TBD
|
||||
|
||||
Dependencies
|
||||
|
||||
OpenGL 1.2 or GL_EXT_texture3D is required.
|
||||
|
||||
Support for ARB_fragment_program is assumed, but not required.
|
||||
|
||||
Support for ARB_fragment_program_shadow is assumed, but not required.
|
||||
|
||||
Support for EXT_framebuffer_object is assumed, but not required.
|
||||
|
||||
Written based on the wording of the OpenGL 2.0 specification and
|
||||
ARB_fragment_program_shadow but not dependent on them.
|
||||
|
||||
Overview
|
||||
|
||||
There are a number of circumstances where an application may wish to
|
||||
blend two textures out of a larger set of textures. Moreover, in some
|
||||
cases the selected textures may vary on a per-fragment basis within
|
||||
a polygon. Several examples include:
|
||||
|
||||
1. High dynamic range textures. The application stores several
|
||||
different "exposures" of an image as different textures. On a
|
||||
per-fragment basis, the application selects which exposures are
|
||||
used.
|
||||
|
||||
2. A terrain engine where the altitude of a point determines the
|
||||
texture applied to it. If the transition is from beach sand to
|
||||
grass to rocks to snow, the application will store each texture
|
||||
in a different texture map, and dynamically select which two
|
||||
textures to blend at run-time.
|
||||
|
||||
3. Storing short video clips in textures. Each depth slice is a
|
||||
single frame of video.
|
||||
|
||||
Several solutions to this problem have been proposed, but they either
|
||||
involve using a separate texture unit for each texture map or using 3D
|
||||
textures without mipmaps. Both of these options have major drawbacks.
|
||||
|
||||
This extension provides a third alternative that eliminates the major
|
||||
drawbacks of both previous methods. A new texture target,
|
||||
TEXTURE_2D_ARRAY, is added that functions identically to TEXTURE_3D in
|
||||
all aspects except the sizes of the non-base level images. In
|
||||
traditional 3D texturing, the size of the N+1 LOD is half the size
|
||||
of the N LOD in all three dimensions. For the TEXTURE_2D_ARRAY target,
|
||||
the height and width of the N+1 LOD is halved, but the depth is the
|
||||
same for all levels of detail. The texture then becomes an array of
|
||||
2D textures. The per-fragment texel is selected by the R texture
|
||||
coordinate.
|
||||
|
||||
References:
|
||||
|
||||
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011557
|
||||
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=000516
|
||||
http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011903
|
||||
http://www.delphi3d.net/articles/viewarticle.php?article=terraintex.htm
|
||||
|
||||
New Procedures and Functions
|
||||
|
||||
All functions come directly from EXT_texture_array.
|
||||
|
||||
void FramebufferTextureLayerEXT(enum target, enum attachment,
|
||||
uint texture, int level, int layer);
|
||||
|
||||
New Tokens
|
||||
|
||||
All token names and values come directly from EXT_texture_array.
|
||||
|
||||
Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, by
|
||||
the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and
|
||||
GetDoublev, and by the <target> parameter of TexImage3D, GetTexImage,
|
||||
GetTexLevelParameteriv, GetTexLevelParameterfv, GetTexParameteriv, and
|
||||
GetTexParameterfv:
|
||||
|
||||
TEXTURE_1D_ARRAY_EXT 0x8C18
|
||||
TEXTURE_2D_ARRAY_EXT 0x8C1A
|
||||
|
||||
Accepted by the <target> parameter of TexImage2D, TexSubImage2D,
|
||||
CopyTexImage2D, CopyTexSubImage2D, CompressedTexImage2D,
|
||||
CompressedTexSubImage2D, GetTexLevelParameteriv, and
|
||||
GetTexLevelParameterfv:
|
||||
|
||||
TEXTURE_1D_ARRAY_EXT
|
||||
PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19
|
||||
|
||||
Accepted by the <target> parameter of TexImage3D, TexSubImage3D,
|
||||
CopyTexSubImage3D, CompressedTexImage3D, CompressedTexSubImage3D,
|
||||
GetTexLevelParameteriv, and GetTexLevelParameterfv:
|
||||
|
||||
TEXTURE_2D_ARRAY_EXT
|
||||
PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B
|
||||
|
||||
Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
|
||||
GetFloatv, and GetDoublev
|
||||
|
||||
TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C
|
||||
TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
|
||||
MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
|
||||
|
||||
Accepted by the <param> parameter of TexParameterf, TexParameteri,
|
||||
TexParameterfv, and TexParameteriv when the <pname> parameter is
|
||||
TEXTURE_COMPARE_MODE_ARB:
|
||||
|
||||
COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E
|
||||
|
||||
(Note: COMPARE_REF_DEPTH_TO_TEXTURE_EXT is simply an alias for the
|
||||
existing COMPARE_R_TO_TEXTURE token in OpenGL 2.0; the alternate name
|
||||
reflects the fact that the R coordinate is not always used.)
|
||||
|
||||
Accepted by the <internalformat> parameter of TexImage3D and
|
||||
CompressedTexImage3D, and by the <format> parameter of
|
||||
CompressedTexSubImage3D:
|
||||
|
||||
COMPRESSED_RGB_S3TC_DXT1_EXT
|
||||
COMPRESSED_RGBA_S3TC_DXT1_EXT
|
||||
COMPRESSED_RGBA_S3TC_DXT3_EXT
|
||||
COMPRESSED_RGBA_S3TC_DXT5_EXT
|
||||
|
||||
Accepted by the <pname> parameter of
|
||||
GetFramebufferAttachmentParameterivEXT:
|
||||
|
||||
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
|
||||
|
||||
(Note: FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER is simply an alias for the
|
||||
FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT token provided in
|
||||
EXT_framebuffer_object. This extension generalizes the notion of
|
||||
"<zoffset>" to include layers of an array texture.)
|
||||
|
||||
Additions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation)
|
||||
|
||||
None
|
||||
|
||||
Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization)
|
||||
|
||||
-- Section 3.8.1 "Texture Image Specification"
|
||||
|
||||
Change the first paragraph (page 150) to say (spec changes identical to
|
||||
EXT_texture_array):
|
||||
|
||||
"The command
|
||||
|
||||
void TexImage3D(enum target, int level, int internalformat,
|
||||
sizei width, sizei height, sizei depth, int border,
|
||||
enum format, enum type, void *data);
|
||||
|
||||
is used to specify a three-dimensional texture image. target must be one
|
||||
one of TEXTURE_3D for a three-dimensional texture or
|
||||
TEXTURE_2D_ARRAY_EXT for an two-dimensional array texture.
|
||||
Additionally, target may be either PROXY_TEXTURE_3D for a
|
||||
three-dimensional proxy texture, or PROXY_TEXTURE_2D_ARRAY_EXT for a
|
||||
two-dimensional proxy array texture."
|
||||
|
||||
Change the fourth paragraph on page 151 to say (spec changes identical
|
||||
to EXT_texture_array):
|
||||
|
||||
"Textures with a base internal format of DEPTH_COMPONENT are supported
|
||||
by texture image specification commands only if target is TEXTURE_1D,
|
||||
TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, TEXTURE_2D_ARRAY_EXT,
|
||||
PROXY_TEXTURE_1D, PROXY_TEXTURE_2D, PROXY_TEXTURE_1D_ARRAY_EXT, or
|
||||
PROXY_TEXTURE_2D_ARRAY_EXT. Using this format in conjunction with any
|
||||
other target will result in an INVALID_OPERATION error."
|
||||
|
||||
|
||||
Change the fourth paragraph on page 156 to say (spec changes identical
|
||||
to EXT_texture_array):
|
||||
|
||||
"The command
|
||||
|
||||
void TexImage2D(enum target, int level,
|
||||
int internalformat, sizei width, sizei height,
|
||||
int border, enum format, enum type, void *data);
|
||||
|
||||
is used to specify a two-dimensional texture image. target must be one
|
||||
of TEXTURE_2D for a two-dimensional texture, TEXTURE_1D_ARRAY_EXT for a
|
||||
one-dimensional array texture, or one of TEXTURE_CUBE_MAP_POSITIVE_X,
|
||||
TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE_MAP_POSITIVE_Y,
|
||||
TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, or
|
||||
TEXTURE_CUBE_MAP_NEGATIVE_Z for a cube map texture. Additionally,
|
||||
target may be either PROXY_TEXTURE_2D for a two-dimensional proxy
|
||||
texture, PROXY_TEXTURE_1D_ARRAY_EXT for a one-dimensional proxy array
|
||||
texture, or PROXY TEXTURE_CUBE_MAP for a cube map proxy texture in the
|
||||
special case discussed in section 3.8.11. The other parameters match
|
||||
the corresponding parameters of TexImage3D.
|
||||
|
||||
For the purposes of decoding the texture image, TexImage2D is
|
||||
equivalent to calling TexImage3D with corresponding arguments and depth
|
||||
of 1, except that
|
||||
|
||||
* The border depth, d_b, is zero, and the depth of the image is
|
||||
always 1 regardless of the value of border.
|
||||
|
||||
* The border height, h_b, is zero if <target> is
|
||||
TEXTURE_1D_ARRAY_EXT, and <border> otherwise.
|
||||
|
||||
* Convolution will be performed on the image (possibly changing its
|
||||
width and height) if SEPARABLE 2D or CONVOLUTION 2D is enabled.
|
||||
|
||||
* UNPACK SKIP IMAGES is ignored."
|
||||
|
||||
-- Section 3.8.2 "Alternate Texture Image Specification Commands"
|
||||
|
||||
Change the second paragraph (page 159) (spec changes identical
|
||||
to EXT_texture_array):
|
||||
|
||||
"The command
|
||||
|
||||
void CopyTexImage2D(enum target, int level,
|
||||
enum internalformat, int x, int y, sizei width,
|
||||
sizei height, int border);
|
||||
|
||||
defines a two-dimensional texture image in exactly the manner of
|
||||
TexImage2D, except that the image data are taken from the framebuffer
|
||||
rather than from client memory. Currently, target must be one of
|
||||
TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, TEXTURE_CUBE_MAP_POSITIVE_X,
|
||||
TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE MAP_POSITIVE_Y,
|
||||
TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, or
|
||||
TEXTURE_CUBE_MAP_NEGATIVE_Z.
|
||||
|
||||
|
||||
Change the last paragraph on page 160 to say (spec changes identical
|
||||
to EXT_texture_array):
|
||||
|
||||
"Currently the target arguments of TexSubImage1D and CopyTexSubImage1D
|
||||
must be TEXTURE_1D, the target arguments of TexSubImage2D and
|
||||
CopyTexSubImage2D must be one of TEXTURE_2D, TEXTURE_1D_ARRAY_EXT,
|
||||
TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_X,
|
||||
TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Y,
|
||||
TEXTURE_CUBE_MAP_POSITIVE_Z, or TEXTURE_CUBE_MAP_NEGATIVE_Z, and the
|
||||
target arguments of TexSubImage3D and CopyTexSubImage3D must be
|
||||
TEXTURE_3D or TEXTURE_2D_ARRAY_EXT. ..."
|
||||
|
||||
|
||||
-- Section 3.8.4 "Texture Parameters"
|
||||
|
||||
Change the first paragraph (page 166) to say:
|
||||
|
||||
"Various parameters control how the texel array is treated when
|
||||
specified or changed, and when applied to a fragment. Each parameter is
|
||||
set by calling
|
||||
|
||||
void TexParameter{if}(enum target, enum pname, T param);
|
||||
void TexParameter{if}v(enum target, enum pname, T params);
|
||||
|
||||
target is the target, either TEXTURE_1D, TEXTURE_2D, TEXTURE_3D,
|
||||
TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT."
|
||||
|
||||
|
||||
-- Section 3.8.8 "Texture Minification" in the section "Scale Factor and Level of Detail"
|
||||
|
||||
Change the first paragraph (page 172) to say:
|
||||
|
||||
"Let s(x,y) be the function that associates an s texture coordinate
|
||||
with each set of window coordinates (x,y) that lie within a primitive;
|
||||
define t(x,y) and r(x,y) analogously. Let u(x,y) = w_t * s(x,y),
|
||||
v(x,y) = h_t * t(x,y), and w(x,y) = d_t * r(x,y), where w_t, h_t,
|
||||
and d_t are as defined by equations 3.15, 3.16, and 3.17 with
|
||||
w_s, h_s, and d_s equal to the width, height, and depth of the
|
||||
image array whose level is level_base. For a one-dimensional
|
||||
texture or a one-dimensional array texture, define v(x,y) = 0 and
|
||||
w(x,y) = 0; for a two-dimensional texture or a two-dimensional array
|
||||
texture, define w(x,y) = 0..."
|
||||
|
||||
-- Section 3.8.8 "Texture Minification" in the section "Mipmapping"
|
||||
|
||||
Change the third paragraph (page 174) to say:
|
||||
|
||||
"For a two-dimensional texture, two-dimensional array texture, or
|
||||
cube map texture,"
|
||||
|
||||
Change the fourth paragraph (page 174) to say:
|
||||
|
||||
"And for a one-dimensional texture or a one-dimensional array texture,"
|
||||
|
||||
After the first paragraph (page 175) add:
|
||||
|
||||
"For one-dimensional array textures, h_b and d_b are treated as 1,
|
||||
regardless of the actual values, when performing mipmap calculations.
|
||||
For two-dimensional array textures, d_b is always treated as one,
|
||||
regardless of the actual value, when performing mipmap calculations."
|
||||
|
||||
-- Section 3.8.8 "Automatic Mipmap Generation" in the section "Mipmapping"
|
||||
|
||||
Change the third paragraph (page 176) to say (spec changes identical
|
||||
to EXT_texture_array):
|
||||
|
||||
"The contents of the derived arrays are computed by repeated, filtered
|
||||
reduction of the level_base array. For one- and two-dimensional array
|
||||
textures, each layer is filtered independently. ..."
|
||||
|
||||
-- Section 3.8.8 "Manual Mipmap Generation" in the section "Mipmapping"
|
||||
|
||||
Change first paragraph to say (spec changes identical to
|
||||
EXT_texture_array):
|
||||
|
||||
"Mipmaps can be generated manually with the command
|
||||
|
||||
void GenerateMipmapEXT(enum target);
|
||||
|
||||
where <target> is one of TEXTURE_1D, TEXTURE_2D, TEXTURE_CUBE_MAP,
|
||||
TEXTURE_3D, TEXTURE_1D_ARRAY, or TEXTURE_2D_ARRAY. Mipmap generation
|
||||
affects the texture image attached to <target>. ..."
|
||||
|
||||
-- Section 3.8.10 "Texture Completeness"
|
||||
|
||||
Change the second paragaph (page 177) to say (spec changes identical
|
||||
to EXT_texture_array):
|
||||
|
||||
"For one-, two-, or three-dimensional textures and one- or
|
||||
two-dimensional array textures, a texture is complete if the following
|
||||
conditions all hold true:"
|
||||
|
||||
-- Section 3.8.11 "Texture State and Proxy State"
|
||||
|
||||
Change the second and third paragraphs (page 179) to say (spec changes
|
||||
identical to EXT_texture_array):
|
||||
|
||||
"In addition to image arrays for one-, two-, and three-dimensional
|
||||
textures, one- and two-dimensional array textures, and the six image
|
||||
arrays for the cube map texture, partially instantiated image arrays
|
||||
are maintained for one-, two-, and three-dimensional textures and one-
|
||||
and two-dimensional array textures. Additionally, a single proxy image
|
||||
array is maintained for the cube map texture. Each proxy image array
|
||||
includes width, height, depth, border width, and internal format state
|
||||
values, as well as state for the red, green, blue, alpha, luminance,
|
||||
and intensity component resolutions. Proxy image arrays do not include
|
||||
image data, nor do they include texture properties. When TexImage3D is
|
||||
executed with target specified as PROXY_TEXTURE_3D, the
|
||||
three-dimensional proxy state values of the specified level-of-detail
|
||||
are recomputed and updated. If the image array would not be supported
|
||||
by TexImage3D called with target set to TEXTURE 3D, no error is
|
||||
generated, but the proxy width, height, depth, border width, and
|
||||
component resolutions are set to zero. If the image array would be
|
||||
supported by such a call to TexImage3D, the proxy state values are set
|
||||
exactly as though the actual image array were being specified. No pixel
|
||||
data are transferred or processed in either case.
|
||||
|
||||
Proxy arrays for one- and two-dimensional textures and one- and
|
||||
two-dimensional array textures are operated on in the same way when
|
||||
TexImage1D is executed with target specified as PROXY_TEXTURE_1D,
|
||||
TexImage2D is executed with target specified as PROXY_TEXTURE_2D or
|
||||
PROXY_TEXTURE_1D_ARRAY_EXT, or TexImage3D is executed with target
|
||||
specified as PROXY_TETXURE_2D_ARRAY_EXT."
|
||||
|
||||
-- Section 3.8.12 "Texture Objects"
|
||||
|
||||
Change section (page 180) to say (spec changes identical to
|
||||
EXT_texture_array):
|
||||
|
||||
"In addition to the default textures TEXTURE_1D, TEXTURE_2D,
|
||||
TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and TEXTURE_2D_EXT,
|
||||
named one-, two-, and three-dimensional, cube map, and one- and
|
||||
two-dimensional array texture objects can be created and operated upon.
|
||||
The name space for texture objects is the unsigned integers, with zero
|
||||
reserved by the GL.
|
||||
|
||||
A texture object is created by binding an unused name to TEXTURE_1D,
|
||||
TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or
|
||||
TEXTURE_2D_ARRAY_EXT. The binding is effected by calling
|
||||
|
||||
void BindTexture(enum target, uint texture);
|
||||
|
||||
with <target> set to the desired texture target and <texture> set to
|
||||
the unused name. The resulting texture object is a new state vector,
|
||||
comprising all the state values listed in section 3.8.11, set to the
|
||||
same initial values. If the new texture object is bound to TEXTURE_1D,
|
||||
TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or
|
||||
TEXTURE_2D_ARRAY_EXT, it is and remains a one-, two-,
|
||||
three-dimensional, cube map, one- or two-dimensional array texture
|
||||
respectively until it is deleted.
|
||||
|
||||
BindTexture may also be used to bind an existing texture object to
|
||||
either TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP,
|
||||
TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT. The error
|
||||
INVALID_OPERATION is generated if an attempt is made to bind a texture
|
||||
object of different dimensionality than the specified target. If the
|
||||
bind is successful no change is made to the state of the bound texture
|
||||
object, and any previous binding to target is broken.
|
||||
|
||||
While a texture object is bound, GL operations on the target to which
|
||||
it is bound affect the bound object, and queries of the target to which
|
||||
it is bound return state from the bound object. If texture mapping of
|
||||
the dimensionality of the target to which a texture object is bound is
|
||||
enabled, the state of the bound texture object directs the texturing
|
||||
operation.
|
||||
|
||||
In the initial state, TEXTURE_1D, TEXTURE_2D, TEXTURE_3D,
|
||||
TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and TEXTURE_2D_ARRAY_EXT have
|
||||
one-, two-, three-dimensional, cube map, and one- and two-dimensional
|
||||
array texture state vectors respectively associated with them. In order
|
||||
that access to these initial textures not be lost, they are treated as
|
||||
texture objects all of whose names are 0. The initial one-, two-,
|
||||
three-dimensional, cube map, one- and two-dimensional array textures
|
||||
are therefore operated upon, queried, and applied as TEXTURE_1D,
|
||||
TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and
|
||||
TEXTURE_2D_ARRAY_EXT respectively while 0 is bound to the corresponding
|
||||
targets.
|
||||
|
||||
Change second paragraph on page 181 to say (spec changes identical to
|
||||
EXT_texture_array):
|
||||
|
||||
"... If a texture that is currently bound to one of the targets
|
||||
TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP,
|
||||
TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT is deleted, it is as
|
||||
though BindTexture had been executed with the same target and texture
|
||||
zero. ..."
|
||||
|
||||
Change second paragraph on page 182 to say (spec changes identical to
|
||||
EXT_texture_array):
|
||||
|
||||
"The texture object name space, including the initial one-, two-, and
|
||||
three dimensional, cube map, and one- and two-dimensional array texture
|
||||
objects, is shared among all texture units. ..."
|
||||
|
||||
|
||||
-- Section 3.8.14 "Depth Texture Comparison Modes" in "Texture Comparison Modes"
|
||||
|
||||
Change second through fourth paragraphs (page 188) to say:
|
||||
|
||||
"Let D_t be the depth texture value, in the range [0, 1]. For
|
||||
texture lookups from one- and two-dimesional, rectangle, and
|
||||
one-dimensional array targets, let R be the interpolated <r>
|
||||
texture coordinate, clamped to the range [0, 1]. For texture lookups
|
||||
from two-dimesional array texture targets, let R be the interpolated
|
||||
<q> texture coordinate, clamped to the range [0, 1]. Then the
|
||||
effective texture value L_t, I_t, or A_t is computed as follows:
|
||||
|
||||
If the value of TEXTURE_COMPARE_MODE is NONE, then
|
||||
|
||||
r = Dt
|
||||
|
||||
If the value of TEXTURE_COMPARE_MODE is
|
||||
COMPARE_REF_DEPTH_TO_TEXTURE_EXT), then r depends on the texture
|
||||
comparison function as shown in table 3.27."
|
||||
|
||||
-- Section 3.8.15 "Texture Application"
|
||||
|
||||
Change the first paragraph (page 189) to say:
|
||||
|
||||
"Texturing is enabled or disabled using the generic Enable and Disable
|
||||
commands, respectively, with the symbolic constants TEXTURE_1D,
|
||||
TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or
|
||||
TEXTURE_2D_ARRAY_EXT to enable one-, two-, three-dimensional, cube
|
||||
map, one-dimensional array, or two-dimensional array texture,
|
||||
respectively. If both two- and one-dimensional textures are enabled,
|
||||
the two-dimensional texture is used. If the three-dimensional and
|
||||
either of the two- or one-dimensional textures is enabled, the
|
||||
three-dimensional texture is used. If the cube map texture and any of
|
||||
the three-, two-, or one-dimensional textures is enabled, then cube map
|
||||
texturing is used. If one-dimensional array texture is enabled and any
|
||||
of cube map, three-, two-, or one-dimensional textures is enabled,
|
||||
one-dimensional array texturing is used. If two-dimensional array
|
||||
texture is enabled and any of cube map, three-, two-, one-dimensional
|
||||
textures or one-dimensional array texture is enabled, two-dimensional
|
||||
array texturing is used..."
|
||||
|
||||
-- Section 3.11.2 of ARB_fragment_program (Fragment Program Grammar and Restrictions):
|
||||
|
||||
(mostly add to existing grammar rules)
|
||||
|
||||
<optionName> ::= "MESA_texture_array"
|
||||
|
||||
<texTarget> ::= "1D"
|
||||
| "2D"
|
||||
| "3D"
|
||||
| "CUBE"
|
||||
| "RECT"
|
||||
| <arrayTarget> (if program option is present)
|
||||
| <shadowTarget> (if program option is present)
|
||||
|
||||
<arrayTarget> ::= "ARRAY1D"
|
||||
| "ARRAY2D"
|
||||
|
||||
<shadowTarget> ::= "SHADOW1D"
|
||||
| "SHADOW2D"
|
||||
| "SHADOWRECT"
|
||||
| <shadowArrayTarget> (if program option is present)
|
||||
|
||||
<shadowArrayTarget> ::= "SHADOWARRAY1D"
|
||||
| "SHADOWARRAY2D"
|
||||
|
||||
|
||||
-- Add Section 3.11.4.5.4 "Texture Stack Option"
|
||||
|
||||
"If a fragment program specifies the "MESA_texture_array" program
|
||||
option, the <texTarget> rule is modified to add the texture targets
|
||||
ARRAY1D and ARRAY2D (See Section 3.11.2)."
|
||||
|
||||
-- Section 3.11.6 "Fragment Program Texture Instruction Set"
|
||||
|
||||
(replace 1st and 2nd paragraphs with the following paragraphs)
|
||||
|
||||
"The first three texture instructions described below specify the
|
||||
mapping of 4-tuple input vectors to 4-tuple output vectors.
|
||||
The sampling of the texture works as described in section 3.8,
|
||||
except that texture environments and texture functions are not
|
||||
applicable, and the texture enables hierarchy is replaced by explicit
|
||||
references to the desired texture target (i.e., 1D, 2D, 3D, cube map,
|
||||
rectangle, ARRAY1D, ARRAY2D). These texture instructions specify
|
||||
how the 4-tuple is mapped into the coordinates used for sampling. The
|
||||
following function is used to describe the texture sampling in the
|
||||
descriptions below:
|
||||
|
||||
vec4 TextureSample(vec4 coord, float lodBias, int texImageUnit,
|
||||
enum texTarget);
|
||||
|
||||
Note that not all four components of the texture coordinates <coord>
|
||||
are used by all texture targets. Component usage for each <texTarget>
|
||||
is defined in table X.
|
||||
|
||||
coordinates used
|
||||
texTarget Texture Type s t r layer shadow
|
||||
---------------- --------------------- ----- ----- ------
|
||||
1D TEXTURE_1D x - - - -
|
||||
2D TEXTURE_2D x y - - -
|
||||
3D TEXTURE_3D x y z - -
|
||||
CUBE TEXTURE_CUBE_MAP x y z - -
|
||||
RECT TEXTURE_RECTANGLE_ARB x y - - -
|
||||
ARRAY1D TEXTURE_1D_ARRAY_EXT x - - y -
|
||||
ARRAY2D TEXTURE_2D_ARRAY_EXT x y - z -
|
||||
SHADOW1D TEXTURE_1D x - - - z
|
||||
SHADOW2D TEXTURE_2D x y - - z
|
||||
SHADOWRECT TEXTURE_RECTANGLE_ARB x y - - z
|
||||
SHADOWARRAY1D TEXTURE_1D_ARRAY_EXT x - - y z
|
||||
SHADOWARRAY2D TEXTURE_2D_ARRAY_EXT x y - z w
|
||||
|
||||
Table X: Texture types accessed for each of the <texTarget>, and
|
||||
coordinate mappings. The "coordinates used" column indicate the
|
||||
input values used for each coordinate of the texture lookup, the
|
||||
layer selector for array textures, and the reference value for
|
||||
texture comparisons."
|
||||
|
||||
-- Section 3.11.6.2 "TXP: Project coordinate and map to color"
|
||||
|
||||
Add to the end of the section:
|
||||
|
||||
"A program will fail to load if the TXP instruction is used in
|
||||
conjunction with the SHADOWARRAY2D target."
|
||||
|
||||
Additions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment Operations)
|
||||
|
||||
-- Section 4.4.2.3 "Attaching Texture Images to a Framebuffer"
|
||||
|
||||
Add to the end of the section (spec changes identical to
|
||||
EXT_texture_array):
|
||||
|
||||
"The command
|
||||
|
||||
void FramebufferTextureLayerEXT(enum target, enum attachment,
|
||||
uint texture, int level, int layer);
|
||||
|
||||
operates identically to FramebufferTexture3DEXT, except that it
|
||||
attaches a single layer of a three-dimensional texture or a one- or
|
||||
two-dimensional array texture. <layer> is an integer indicating the
|
||||
layer number, and is treated identically to the <zoffset> parameter in
|
||||
FramebufferTexture3DEXT. The error INVALID_VALUE is generated if
|
||||
<layer> is negative. The error INVALID_OPERATION is generated if
|
||||
<texture> is non-zero and is not the name of a three dimensional
|
||||
texture or one- or two-dimensional array texture. Unlike
|
||||
FramebufferTexture3D, no <textarget> parameter is accepted.
|
||||
|
||||
If <texture> is non-zero and the command does not result in an error,
|
||||
the framebuffer attachment state corresponding to <attachment> is
|
||||
updated as in the other FramebufferTexture commands, except that
|
||||
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT is set to <layer>."
|
||||
|
||||
-- Section 4.4.4.1 "Framebuffer Attachment Completeness"
|
||||
|
||||
Add to the end of the list of completeness rules (spec changes
|
||||
identical to EXT_texture_array):
|
||||
|
||||
"* If FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE and
|
||||
FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT names a one- or
|
||||
two-dimensional array texture, then
|
||||
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT must be smaller than the
|
||||
number of layers in the texture."
|
||||
|
||||
Additions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions)
|
||||
|
||||
-- Section 5.4 "Display Lists"
|
||||
|
||||
Change the first paragraphi on page 242 to say (spec changes
|
||||
identical to EXT_texture_array):
|
||||
|
||||
"TexImage3D, TexImage2D, TexImage1D, Histogram, and ColorTable are
|
||||
executed immediately when called with the corresponding proxy arguments
|
||||
PROXY_TEXTURE_3D or PROXY_TEXTURE_2D_ARRAY_EXT; PROXY_TEXTURE_2D,
|
||||
PROXY_TEXTURE_CUBE_MAP, or PROXY_TEXTURE_1D_ARRAY_EXT;
|
||||
PROXY_TEXTURE_1D; PROXY_HISTOGRAM; and PROXY_COLOR_TABLE,
|
||||
PROXY_POST_CONVOLUTION_COLOR_TABLE, or
|
||||
PROXY_POST_COLOR_MATRIX_COLOR_TABLE."
|
||||
|
||||
Additions to Chapter 6 of the OpenGL 2.0 Specification (State and State Requests)
|
||||
|
||||
-- Section 6.1.3 "Enumerated Queries"
|
||||
|
||||
Add after the line beginning "If the value of
|
||||
FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE" (spec changes
|
||||
identical to EXT_texture_array):
|
||||
|
||||
"If <pname> is FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT and the
|
||||
texture object named FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is a
|
||||
three-dimensional texture or a one- or two-dimensional array texture,
|
||||
then <params> will contain the number of texture layer attached to the
|
||||
attachment point. Otherwise, <params> will contain the value zero."
|
||||
|
||||
-- Section 6.1.4 "Texture Queries"
|
||||
|
||||
Change the first three paragraphs (page 248) to say (spec changes
|
||||
identical to EXT_texture_array):
|
||||
|
||||
"The command
|
||||
|
||||
void GetTexImage(enum tex, int lod, enum format,
|
||||
enum type, void *img);
|
||||
|
||||
is used to obtain texture images. It is somewhat different from the
|
||||
other get commands; tex is a symbolic value indicating which texture
|
||||
(or texture face in the case of a cube map texture target name) is to
|
||||
be obtained. TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_1D_ARRAY_EXT,
|
||||
and TEXTURE_2D_ARRAY_EXT indicate a one-, two-, or three-dimensional
|
||||
texture, or one- or two-dimensional array texture, respectively.
|
||||
TEXTURE_CUBE_MAP_POSITIVE_X, ...
|
||||
|
||||
GetTexImage obtains... from the first image to the last for
|
||||
three-dimensional textures. One- and two-dimensional array textures
|
||||
are treated as two- and three-dimensional images, respectively, where
|
||||
the layers are treated as rows or images. These groups are then...
|
||||
|
||||
For three-dimensional and two-dimensional array textures, pixel storage
|
||||
operations are applied as if the image were two-dimensional, except
|
||||
that the additional pixel storage state values PACK_IMAGE_HEIGHT and
|
||||
PACK_SKIP_IMAGES are applied. ..."
|
||||
|
||||
Additions to Appendix A of the OpenGL 2.0 Specification (Invariance)
|
||||
|
||||
None
|
||||
|
||||
Additions to the AGL/GLX/WGL Specifications
|
||||
|
||||
None
|
||||
|
||||
GLX Protocol
|
||||
|
||||
None
|
||||
|
||||
Dependencies on ARB_fragment_program
|
||||
|
||||
If ARB_fragment_program is not supported, the changes to section 3.11
|
||||
should be ignored.
|
||||
|
||||
Dependencies on EXT_framebuffer_object
|
||||
|
||||
If EXT_framebuffer_object is not supported, the changes to section
|
||||
3.8.8 ("Manual Mipmap Generation"), 4.4.2.3, and 6.1.3 should be ignored.
|
||||
|
||||
Dependencies on EXT_texture_compression_s3tc and NV_texture_compression_vtc
|
||||
|
||||
(Identical dependency as EXT_texture_array.)
|
||||
|
||||
S3TC texture compression is supported for two-dimensional array textures.
|
||||
When <target> is TEXTURE_2D_ARRAY_EXT, each layer is stored independently
|
||||
as a compressed two-dimensional textures. When specifying or querying
|
||||
compressed images using one of the S3TC formats, the images are provided
|
||||
and/or returned as a series of two-dimensional textures stored
|
||||
consecutively in memory, with the layer closest to zero specified first.
|
||||
For array textures, images are not arranged in 4x4x4 or 4x4x2 blocks as in
|
||||
the three-dimensional compression format provided in the
|
||||
EXT_texture_compression_vtc extension. Pixel store parameters, including
|
||||
those specific to three-dimensional images, are ignored when compressed
|
||||
image data are provided or returned, as in the
|
||||
EXT_texture_compression_s3tc extension.
|
||||
|
||||
S3TC compression is not supported for one-dimensional texture targets in
|
||||
EXT_texture_compression_s3tc, and is not supported for one-dimensional
|
||||
array textures in this extension. If compressed one-dimensional arrays
|
||||
are needed, use a two-dimensional texture with a height of one.
|
||||
|
||||
This extension allows the use of the four S3TC internal format types in
|
||||
TexImage3D, CompressedTexImage3D, and CompressedTexSubImage3D calls.
|
||||
|
||||
Errors
|
||||
|
||||
None
|
||||
|
||||
New State
|
||||
|
||||
(add to table 6.15, p. 276)
|
||||
|
||||
Initial
|
||||
Get Value Type Get Command Value Description Sec. Attribute
|
||||
---------------------------- ----- ----------- ----- -------------------- ------ ---------
|
||||
TEXTURE_BINDING_1D_ARRAY_EXT 2*xZ+ GetIntegerv 0 texture object bound 3.8.12 texture
|
||||
to TEXTURE_1D_ARRAY
|
||||
TEXTURE_BINDING_2D_ARRAY_EXT 2*xZ+ GetIntegerv 0 texture object bound 3.8.12 texture
|
||||
to TEXTURE_2D_ARRAY
|
||||
|
||||
|
||||
New Implementation Dependent State
|
||||
|
||||
(add to Table 6.32, p. 293)
|
||||
|
||||
Minimum
|
||||
Get Value Type Get Command Value Description Sec. Attribute
|
||||
---------------------------- ---- ----------- ------- ------------------ ----- ---------
|
||||
MAX_TEXTURE_ARRAY_LAYERS_EXT Z+ GetIntegerv 64 maximum number of 3.8.1 -
|
||||
layers for texture
|
||||
arrays
|
||||
|
||||
Issues
|
||||
|
||||
(1) Is "texture stack" a good name for this functionality?
|
||||
|
||||
NO. The name is changed to "array texture" to match the
|
||||
nomenclature used by GL_EXT_texture_array.
|
||||
|
||||
(2) Should the R texture coordinate be treated as normalized or
|
||||
un-normalized? If it were un-normalized, floor(R) could be thought
|
||||
of as a direct index into the array texture. This may be more
|
||||
convenient for applications.
|
||||
|
||||
RESOLVED. All texture coordinates are normalized. The issue of
|
||||
un-normalized texture coordinates has been discussed in the ARB
|
||||
before and should be left for a layered extension.
|
||||
|
||||
RE-RESOLVED. The R coordinate is un-normalized. Accessing an array
|
||||
using [0, layers-1] coordinates is much more natural.
|
||||
|
||||
(3) How does LOD selection work for stacked textures?
|
||||
|
||||
RESOLVED. For 2D array textures the R coordinate is ignored, and
|
||||
the LOD selection equations for 2D textures are used. For 1D
|
||||
array textures the T coordinate is ignored, and the LOD selection
|
||||
equations for 1D textures are used. The expected usage is in a
|
||||
fragment program with an explicit LOD selection.
|
||||
|
||||
(4) What is the maximum size of a 2D array texture? Is it the same
|
||||
as for a 3D texture, or should a new query be added? How about for 1D
|
||||
array textures?
|
||||
|
||||
RESOLVED. A new query is added.
|
||||
|
||||
(5) How are array textures exposed in GLSL?
|
||||
|
||||
RESOLVED. Use GL_EXT_texture_array.
|
||||
|
||||
(6) Should a 1D array texture also be exposed?
|
||||
|
||||
RESOLVED. For orthogonality, yes.
|
||||
|
||||
(7) How are stacked textures attached to framebuffer objects?
|
||||
|
||||
RESOLVED. Layers of both one- and two-dimensional array textures
|
||||
are attached using FreambufferTextureLayerEXT. Once attached, the
|
||||
array texture layer behaves exactly as either a one- or
|
||||
two-dimensional texture.
|
||||
|
||||
(8) How is this extension related to GL_EXT_texture_array?
|
||||
|
||||
This extension adapats GL_MESAX_texture_stack to the notation,
|
||||
indexing, and FBO access of GL_EXT_texture_array. This extension
|
||||
replaces the GLSL support of GL_EXT_texture_array with
|
||||
GL_ARB_fragment_program support.
|
||||
|
||||
Assembly program support is also provided by GL_NV_gpu_program4.
|
||||
GL_NV_gpu_program4 also adds support for other features that are
|
||||
specific to Nvidia hardware, while this extension adds only support
|
||||
for array textures.
|
||||
|
||||
Much of text of this extension that has changed since
|
||||
GL_MESAX_texture_stack comes directly from either
|
||||
GL_EXT_texture_array or GL_NV_gpu_program4.
|
||||
|
||||
Revision History
|
||||
|
||||
||2005/11/15||0.1||idr||Initial draft MESAX version.||
|
||||
||2005/12/07||0.2||idr||Added framebuffer object interactions.||
|
||||
||2005/12/12||0.3||idr||Updated fragment program interactions.||
|
||||
||2007/05/16||0.4||idr||Converted to MESA_texture_array. Brought in line with EXT_texture_array and NV_gpu_program4.||
|
||||
@@ -1,163 +1,163 @@
|
||||
File: docs/README.WIN32
|
||||
|
||||
Last updated: Apr 25, 2007 - Karl Schultz - kschultz@users.sourceforge.net
|
||||
|
||||
Quick Start
|
||||
----- -----
|
||||
|
||||
Unzip the MesaLib, MesaGLUT, and MesaDemos ZIP files into the same
|
||||
directory. The libs and demos build separately, so if you do not care
|
||||
about the demos or GLUT, you only need to unzip MesaLib. If you unzip
|
||||
more than one ZIP file, they all need to be unzipped into the same
|
||||
directory. Don't worry, you will not overwrite anything.
|
||||
|
||||
The Windows build system uses Microsoft Visual Studio. Project files
|
||||
for a specific version of Visual Studio are in their own directory in
|
||||
the top-level "windows" directory. For example, Visual Studio 8 files
|
||||
are in windows/VC8.
|
||||
|
||||
Support has been dropped for versions of Visual Studio prior to 8. The
|
||||
main reason is because Microsoft now provides a free compiler and
|
||||
developer environment. Visual Studio Express can be found at
|
||||
|
||||
http://msdn.microsoft.com/vstudio/express/visualc/default.aspx
|
||||
|
||||
You'll also need the Platform SDK. Instructions for obtaining and
|
||||
using the SDK with Visual Studio Express can be found at
|
||||
|
||||
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
|
||||
|
||||
If you are stuck using VC6 or VC7, you may start with these project
|
||||
files, but you may need to modify them to reflect changes in the
|
||||
Mesa source code tree. If you sucessfully update the project files,
|
||||
please submit them to the author of this document so that they may
|
||||
be included in the next distribution.
|
||||
|
||||
The project files to build the core Mesa library, Windows Mesa
|
||||
drivers, OSMesa, and GLU are in the mesa directory. The project files
|
||||
to build GLUT and some demo programs are in the progs directory.
|
||||
|
||||
Makefiles are no longer shipped or supported, but can be generated
|
||||
from the projects using Visual Studio.
|
||||
|
||||
|
||||
Windows Drivers
|
||||
------- -------
|
||||
|
||||
At this time, only the GDI driver is known to work. Most of the demos
|
||||
in progs/demos should work with this driver.
|
||||
|
||||
Source code also exists in the tree for other drivers in
|
||||
src/mesa/drivers/windows, but the status of this code is unknown.
|
||||
|
||||
The GDI driver operates basically by writing pixel spans into a DIB
|
||||
section and then blitting the DIB to the window. The driver was
|
||||
recently cleaned up and rewitten and so may have bugs or may be
|
||||
missing some functionality. The older versions of the CVS source may
|
||||
be useful in figuring out any problems, or report them to me.
|
||||
|
||||
To build Mesa with the GDI driver, build the mesa, gdi, and glu
|
||||
projects in the Visual Studio workspace found at
|
||||
|
||||
windows/VC8/mesa/mesa.sln
|
||||
|
||||
The osmesa DLL can also be built with the osmesa project.
|
||||
|
||||
The build system creates a lib top-level directory and copies
|
||||
resulting LIB and DLL files to this lib directory. The files are:
|
||||
|
||||
OPENGL32.LIB, GLU32.LIB, OSMESA32.LIB
|
||||
OPENGL32.DLL, GLU32.DLL, OSMESA32.DLL
|
||||
|
||||
If the MesaDemos ZIP file was extracted, the DLL files are also copied
|
||||
to the demos directory. This facilitates running the demos as described
|
||||
below.
|
||||
|
||||
|
||||
GLUT and Demos
|
||||
---- --- -----
|
||||
|
||||
A Visual Studio workspace can be found at
|
||||
|
||||
windows/VC8/progs/progs.sln
|
||||
|
||||
It can be used to build GLUT and a few demos. The GLUT lib and DLL
|
||||
are copied to the top-level lib directory, along with the Mesa libs.
|
||||
|
||||
The demo build system expects to find the LIB files in the top level
|
||||
lib directory, so you must build the Mesa libs first. The demo
|
||||
executables are placed in the demos directory, because some of them
|
||||
rely on data files found there. Also, the Mesa lib DLL's were copied
|
||||
there by the Mesa lib build process. Therefore, you should be able to
|
||||
simply run the demo executables from the demo directory.
|
||||
|
||||
If you want to run the demos from the Visual Studio, you may have to
|
||||
change the startup directory and explicitly state where the executables are.
|
||||
|
||||
You may also build all the demo programs by using a makefile. Go to
|
||||
the progs/demos directory and make sure you have executed VCVARS32.BAT
|
||||
or whatever setup script is appropriate for your compiler. Then,
|
||||
|
||||
nmake -f Makefile.win
|
||||
|
||||
should build all the demos.
|
||||
|
||||
|
||||
Build System Notes
|
||||
----- ------ -----
|
||||
|
||||
VC6 (not actively supported)
|
||||
---
|
||||
|
||||
Visual Studio 6 does not recognize files with the .cc extension as C++
|
||||
language files, without a lot of unnatural tweaking. So, the VC6
|
||||
build process uses custom build steps to compile these files in the
|
||||
GLU library.
|
||||
|
||||
Two additional configurations are provided, Debug x86 and Release x86
|
||||
that activate the shader code compilation by defining SLANG_86. It is
|
||||
unknown if and how this works.
|
||||
|
||||
VC7 (not actively supported)
|
||||
---
|
||||
|
||||
The above-mentioned .cc problem does not exist in this version.
|
||||
|
||||
VC8
|
||||
---
|
||||
|
||||
No notes.
|
||||
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
After building, you can copy the above DLL files to a place in your
|
||||
PATH such as $SystemRoot/SYSTEM32. If you don't like putting things
|
||||
in a system directory, place them in the same directory as the
|
||||
executable(s). Be careful about accidentially overwriting files of
|
||||
the same name in the SYSTEM32 directory.
|
||||
|
||||
The DLL files are built so that the external entry points use the
|
||||
stdcall calling convention.
|
||||
|
||||
Static LIB files are not built. The LIB files that are built with are
|
||||
the linker import files associated with the DLL files.
|
||||
|
||||
The si-glu sources are used to build the GLU libs. This was done
|
||||
mainly to get the better tessellator code.
|
||||
|
||||
To build "mangled" Mesa, add the preprocessor define USE_MGL_NAMESPACE
|
||||
to the project settings. You will also need to edit src/mesa.def to
|
||||
change all the gl* symbols to mgl*. Because this is easy to do with a
|
||||
global replace operation in a text editor, no additional mangled
|
||||
version of mesa.def is maintained or shipped.
|
||||
|
||||
If you have a Windows-related build problem or question, it is
|
||||
probably better to direct it to me (kschultz@users.sourceforge.net),
|
||||
rather than directly to the other Mesa developers. I will help you as
|
||||
much as I can. I also monitor the Mesa mailing lists and will answer
|
||||
questions in this area there as well.
|
||||
|
||||
|
||||
Karl Schultz
|
||||
File: docs/README.WIN32
|
||||
|
||||
Last updated: Apr 25, 2007 - Karl Schultz - kschultz@users.sourceforge.net
|
||||
|
||||
Quick Start
|
||||
----- -----
|
||||
|
||||
Unzip the MesaLib, MesaGLUT, and MesaDemos ZIP files into the same
|
||||
directory. The libs and demos build separately, so if you do not care
|
||||
about the demos or GLUT, you only need to unzip MesaLib. If you unzip
|
||||
more than one ZIP file, they all need to be unzipped into the same
|
||||
directory. Don't worry, you will not overwrite anything.
|
||||
|
||||
The Windows build system uses Microsoft Visual Studio. Project files
|
||||
for a specific version of Visual Studio are in their own directory in
|
||||
the top-level "windows" directory. For example, Visual Studio 8 files
|
||||
are in windows/VC8.
|
||||
|
||||
Support has been dropped for versions of Visual Studio prior to 8. The
|
||||
main reason is because Microsoft now provides a free compiler and
|
||||
developer environment. Visual Studio Express can be found at
|
||||
|
||||
http://msdn.microsoft.com/vstudio/express/visualc/default.aspx
|
||||
|
||||
You'll also need the Platform SDK. Instructions for obtaining and
|
||||
using the SDK with Visual Studio Express can be found at
|
||||
|
||||
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
|
||||
|
||||
If you are stuck using VC6 or VC7, you may start with these project
|
||||
files, but you may need to modify them to reflect changes in the
|
||||
Mesa source code tree. If you sucessfully update the project files,
|
||||
please submit them to the author of this document so that they may
|
||||
be included in the next distribution.
|
||||
|
||||
The project files to build the core Mesa library, Windows Mesa
|
||||
drivers, OSMesa, and GLU are in the mesa directory. The project files
|
||||
to build GLUT and some demo programs are in the progs directory.
|
||||
|
||||
Makefiles are no longer shipped or supported, but can be generated
|
||||
from the projects using Visual Studio.
|
||||
|
||||
|
||||
Windows Drivers
|
||||
------- -------
|
||||
|
||||
At this time, only the GDI driver is known to work. Most of the demos
|
||||
in progs/demos should work with this driver.
|
||||
|
||||
Source code also exists in the tree for other drivers in
|
||||
src/mesa/drivers/windows, but the status of this code is unknown.
|
||||
|
||||
The GDI driver operates basically by writing pixel spans into a DIB
|
||||
section and then blitting the DIB to the window. The driver was
|
||||
recently cleaned up and rewitten and so may have bugs or may be
|
||||
missing some functionality. The older versions of the CVS source may
|
||||
be useful in figuring out any problems, or report them to me.
|
||||
|
||||
To build Mesa with the GDI driver, build the mesa, gdi, and glu
|
||||
projects in the Visual Studio workspace found at
|
||||
|
||||
windows/VC8/mesa/mesa.sln
|
||||
|
||||
The osmesa DLL can also be built with the osmesa project.
|
||||
|
||||
The build system creates a lib top-level directory and copies
|
||||
resulting LIB and DLL files to this lib directory. The files are:
|
||||
|
||||
OPENGL32.LIB, GLU32.LIB, OSMESA32.LIB
|
||||
OPENGL32.DLL, GLU32.DLL, OSMESA32.DLL
|
||||
|
||||
If the MesaDemos ZIP file was extracted, the DLL files are also copied
|
||||
to the demos directory. This facilitates running the demos as described
|
||||
below.
|
||||
|
||||
|
||||
GLUT and Demos
|
||||
---- --- -----
|
||||
|
||||
A Visual Studio workspace can be found at
|
||||
|
||||
windows/VC8/progs/progs.sln
|
||||
|
||||
It can be used to build GLUT and a few demos. The GLUT lib and DLL
|
||||
are copied to the top-level lib directory, along with the Mesa libs.
|
||||
|
||||
The demo build system expects to find the LIB files in the top level
|
||||
lib directory, so you must build the Mesa libs first. The demo
|
||||
executables are placed in the demos directory, because some of them
|
||||
rely on data files found there. Also, the Mesa lib DLL's were copied
|
||||
there by the Mesa lib build process. Therefore, you should be able to
|
||||
simply run the demo executables from the demo directory.
|
||||
|
||||
If you want to run the demos from the Visual Studio, you may have to
|
||||
change the startup directory and explicitly state where the executables are.
|
||||
|
||||
You may also build all the demo programs by using a makefile. Go to
|
||||
the progs/demos directory and make sure you have executed VCVARS32.BAT
|
||||
or whatever setup script is appropriate for your compiler. Then,
|
||||
|
||||
nmake -f Makefile.win
|
||||
|
||||
should build all the demos.
|
||||
|
||||
|
||||
Build System Notes
|
||||
----- ------ -----
|
||||
|
||||
VC6 (not actively supported)
|
||||
---
|
||||
|
||||
Visual Studio 6 does not recognize files with the .cc extension as C++
|
||||
language files, without a lot of unnatural tweaking. So, the VC6
|
||||
build process uses custom build steps to compile these files in the
|
||||
GLU library.
|
||||
|
||||
Two additional configurations are provided, Debug x86 and Release x86
|
||||
that activate the shader code compilation by defining SLANG_86. It is
|
||||
unknown if and how this works.
|
||||
|
||||
VC7 (not actively supported)
|
||||
---
|
||||
|
||||
The above-mentioned .cc problem does not exist in this version.
|
||||
|
||||
VC8
|
||||
---
|
||||
|
||||
No notes.
|
||||
|
||||
|
||||
General
|
||||
-------
|
||||
|
||||
After building, you can copy the above DLL files to a place in your
|
||||
PATH such as $SystemRoot/SYSTEM32. If you don't like putting things
|
||||
in a system directory, place them in the same directory as the
|
||||
executable(s). Be careful about accidentially overwriting files of
|
||||
the same name in the SYSTEM32 directory.
|
||||
|
||||
The DLL files are built so that the external entry points use the
|
||||
stdcall calling convention.
|
||||
|
||||
Static LIB files are not built. The LIB files that are built with are
|
||||
the linker import files associated with the DLL files.
|
||||
|
||||
The si-glu sources are used to build the GLU libs. This was done
|
||||
mainly to get the better tessellator code.
|
||||
|
||||
To build "mangled" Mesa, add the preprocessor define USE_MGL_NAMESPACE
|
||||
to the project settings. You will also need to edit src/mesa.def to
|
||||
change all the gl* symbols to mgl*. Because this is easy to do with a
|
||||
global replace operation in a text editor, no additional mangled
|
||||
version of mesa.def is maintained or shipped.
|
||||
|
||||
If you have a Windows-related build problem or question, it is
|
||||
probably better to direct it to me (kschultz@users.sourceforge.net),
|
||||
rather than directly to the other Mesa developers. I will help you as
|
||||
much as I can. I also monitor the Mesa mailing lists and will answer
|
||||
questions in this area there as well.
|
||||
|
||||
|
||||
Karl Schultz
|
||||
|
||||
@@ -1,288 +0,0 @@
|
||||
<html>
|
||||
|
||||
<title>Compilation and Installation using Autoconf</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<h1>Compilation and Installation using Autoconf</h1>
|
||||
|
||||
<ol>
|
||||
<li><a href="#basic">Basic Usage</a></li>
|
||||
<li><a href="#driver">Driver Options</a></li>
|
||||
<ul>
|
||||
<li><a href="#xlib">Xlib Driver Options</a></li>
|
||||
<li><a href="#dri">DRI Driver Options</a></li>
|
||||
<li><a href="#osmesa">OSMesa Driver Options</a></li>
|
||||
</ul>
|
||||
<li><a href="#library">Library Options</a></li>
|
||||
<ul>
|
||||
<li><a href="#glu">GLU</a></li>
|
||||
<li><a href="#glw">GLw</a></li>
|
||||
<li><a href="#glut">GLUT</a></li>
|
||||
</ul>
|
||||
<li><a href="#demos">Demo Program Options</a></li>
|
||||
</ol>
|
||||
|
||||
|
||||
<a name="basic">
|
||||
<h2>1. Basic Usage</h2>
|
||||
|
||||
<p>
|
||||
The autoconf generated configure script can be used to guess your
|
||||
platform and change various options for building Mesa. To use the
|
||||
configure script, type:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
./configure
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
To see a short description of all the options, type <code>./configure
|
||||
--help</code>. If you are using a development snapshot and the configure
|
||||
script does not exist, type <code>./autogen.sh</code> to generate it
|
||||
first. If you know the options you want to pass to
|
||||
<code>configure</code>, you can pass them to <code>autogen.sh</code>. It
|
||||
will run <code>configure</code> with these options after it is
|
||||
generated. Once you have run <code>configure</code> and set the options
|
||||
to your preference, type:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
make
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This will produce libGL.so and several other libraries depending on the
|
||||
options you have chosen. Later, if you want to rebuild for a different
|
||||
configuration run <code>make realclean</code> before rebuilding.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Some of the generic autoconf options are used with Mesa:
|
||||
|
||||
<ul>
|
||||
<li><code>--prefix=PREFIX</code> - This is the root directory where
|
||||
files will be installed by <code>make install</code>. The default is
|
||||
<code>/usr/local</code>.
|
||||
</li>
|
||||
<li><code>--exec-prefix=EPREFIX</code> - This is the root directory
|
||||
where architecture-dependent files will be installed. In Mesa, this is
|
||||
only used to derive the directory for the libraries. The default is
|
||||
<code>${prefix}</code>.
|
||||
</li>
|
||||
<li><code>--libdir=LIBDIR</code> - This option specifies the directory
|
||||
where the GL libraries will be installed. The default is
|
||||
<code>${exec_prefix}/lib</code>. It also serves as the name of the
|
||||
library staging area in the source tree. For instance, if the option
|
||||
<code>--libdir=/usr/local/lib64</code> is used, the libraries will be
|
||||
created in a <code>lib64</code> directory at the top of the Mesa source
|
||||
tree.
|
||||
</li>
|
||||
<li><code>--enable-static, --disable-shared</code> - By default, Mesa
|
||||
will build shared libraries. Either of these options will force static
|
||||
libraries to be built. It is not currently possible to build static and
|
||||
shared libraries in a single pass.
|
||||
</li>
|
||||
<li><code>CC, CFLAGS, CXX, CXXFLAGS</code> - These environment variables
|
||||
control the C and C++ compilers used during the build. By default,
|
||||
<code>gcc</code> and <code>g++</code> are used with the options
|
||||
<code>"-g -O2"</code>.
|
||||
</li>
|
||||
<li><code>LDFLAGS</code> - An environment variable specifying flags to
|
||||
pass when linking programs. These are normally empty, but can be used
|
||||
to direct the linker to use libraries in nonstandard directories. For
|
||||
example, <code>LDFLAGS="-L/usr/X11R6/lib"</code>.
|
||||
</li>
|
||||
<li><code>PKG_CONFIG_PATH</code> - When available, the
|
||||
<code>pkg-config</code> utility is used to search for external libraries
|
||||
on the system. This environment variable is used to control the search
|
||||
path for <code>pkg-config</code>. For instance, setting
|
||||
<code>PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig</code> will search for
|
||||
package metadata in <code>/usr/X11R6</code> before the standard
|
||||
directories.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
There are also a few general options for altering the Mesa build:
|
||||
<ul>
|
||||
<li><code>--with-x</code> - When the X11 development libraries are
|
||||
needed, the <code>pkg-config</code> utility <a href="#pkg-config">will
|
||||
be used</a> for locating them. If they cannot be found through
|
||||
<code>pkg-config</code> a fallback routing using <code>imake</code> will
|
||||
be used. In this case, the <code>--with-x</code>,
|
||||
<code>--x-includes</code> and <code>--x-libraries</code> options can
|
||||
control the use of X for Mesa.
|
||||
</li>
|
||||
<li><code>--enable-gl-osmesa</code> - The <a href="osmesa.html">OSMesa
|
||||
library</a> can be built on top of libGL for drivers that provide it.
|
||||
This option controls whether to build libOSMesa. By default, this is
|
||||
enabled for the Xlib driver and disabled otherwise. Note that this
|
||||
option is different than using OSMesa as the driver.
|
||||
</li>
|
||||
<li><code>--enable-debug</code> - This option will enable compiler
|
||||
options and macros to aid in debugging the Mesa libraries.
|
||||
</li>
|
||||
<li><code>--disable-asm</code> - There are assembly routines
|
||||
available for a few architectures. These will be used by default if
|
||||
one of these architectures is detected. This option ensures that
|
||||
assembly will not be used.
|
||||
</li>
|
||||
<li><code>--enable-32-bit, --enable-64-bit</code> - By default, the
|
||||
build will compile code as directed by the environment variables
|
||||
<code>CC</code>, <code>CFLAGS</code>, etc. If the compiler is
|
||||
<code>gcc</code>, these options offer a helper to add the compiler flags
|
||||
to force 32- or 64-bit code generation as used on the x86 and x86_64
|
||||
architectures.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
|
||||
<a name="driver">
|
||||
<h2>2. Driver Options</h2>
|
||||
|
||||
<p>
|
||||
There are several different driver modes that Mesa can use. These are
|
||||
described in more detail in the <a href="install.html">basic
|
||||
installation instructions</a>. The Mesa driver is controlled through the
|
||||
configure option --with-driver. There are currently three supported
|
||||
options in the configure script.
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
|
||||
<a name="xlib">
|
||||
<li><b><em>Xlib</em></b> - This is the default mode for building Mesa.
|
||||
It uses Xlib as a software renderer to do all rendering. It corresponds
|
||||
to the option <code>--with-driver=xlib</code>. The libX11 and libXext
|
||||
libraries, as well as the X11 development headers, will be need to
|
||||
support the Xlib driver.
|
||||
</li>
|
||||
|
||||
<a name="dri">
|
||||
<li><b><em>DRI</em></b> - This mode uses the DRI hardware drivers for
|
||||
accelerated OpenGL rendering. Enable the DRI drivers with the option
|
||||
<code>--with-driver=dri</code>. See the <a href="install.html">basic
|
||||
installation instructions</a> for details on prerequisites for the DRI
|
||||
drivers.
|
||||
</li>
|
||||
|
||||
<!-- DRI specific options -->
|
||||
<p>
|
||||
<ul>
|
||||
<li><code>--with-dri-driverdir=DIR</code> - This option specifies the
|
||||
location the DRI drivers will be installed to and the location libGL
|
||||
will search for DRI drivers. The default is <code>${libdir}/dri</code>.
|
||||
</li>
|
||||
<li><code>--with-dri-drivers=DRIVER,DRIVER,...</code> - This option
|
||||
allows a specific set of DRI drivers to be built. For example,
|
||||
<code>--with-dri-drivers="i965,radeon,nouveau"</code>. By default,
|
||||
the drivers will be chosen depending on the target platform. See the
|
||||
directory <code>src/mesa/drivers/dri</code> in the source tree for
|
||||
available drivers.
|
||||
</li>
|
||||
<!-- This explanation might be totally bogus. Kristian? -->
|
||||
<li><code>--disable-driglx-direct</code> - Disable direct rendering in
|
||||
GLX. Normally, direct hardware rendering through the DRI drivers and
|
||||
indirect software rendering are enabled in GLX. This option disables
|
||||
direct rendering entirely. It can be useful on architectures where
|
||||
kernel DRM modules are not available.
|
||||
</li>
|
||||
<li><code>--enable-glx-tls</code> - Enable Thread Local Storage (TLS) in
|
||||
GLX.
|
||||
</li>
|
||||
<li><code>--with-expat=DIR</code> - The DRI-enabled libGL uses expat to
|
||||
parse the DRI configuration files in <code>/etc/drirc</code> and
|
||||
<code>~/.drirc</code>. This option allows a specific expat installation
|
||||
to be used. For example, <code>--with-expat=/usr/local</code> will
|
||||
search for expat headers and libraries in <code>/usr/local/include</code>
|
||||
and <code>/usr/local/lib</code>, respectively.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<a name="osmesa">
|
||||
<li><b><em>OSMesa</em></b> - No libGL is built in this
|
||||
mode. Instead, the driver code is built into the Off-Screen Mesa
|
||||
(OSMesa) library. See the <a href="osmesa.html">Off-Screen Rendering</a>
|
||||
page for more details.
|
||||
</li>
|
||||
|
||||
<!-- OSMesa specific options -->
|
||||
<p>
|
||||
<ul>
|
||||
<li><code>--with-osmesa-bits=BITS</code> - This option allows the size
|
||||
of the color channel in bits to be specified. By default, an 8-bit
|
||||
channel will be used, and the driver will be named libOSMesa. Other
|
||||
options are 16- and 32-bit color channels, which will add the bit size
|
||||
to the library name. For example, <code>--with-osmesa-bits=16</code>
|
||||
will create the libOSMesa16 library with a 16-bit color channel.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
<a name="library">
|
||||
<h2>3. Library Options</h2>
|
||||
|
||||
<p>
|
||||
The configure script provides more fine grained control over the GL
|
||||
libraries that will be built. More details on the specific GL libraries
|
||||
can be found in the <a href="install.html">basic installation
|
||||
instructions</a>.
|
||||
|
||||
<ul>
|
||||
<a name="glu">
|
||||
<li><b><em>GLU</em></b> - The libGLU library will be built by default
|
||||
on all drivers. This can be disable with the option
|
||||
<code>--disable-glu</code>.
|
||||
</li>
|
||||
|
||||
<a name="glw">
|
||||
<li><b><em>GLw</em></b> - The libGLw library will be built by default
|
||||
if libGLU has been enabled. This can be disable with the option
|
||||
<code>--disable-glw</code>.
|
||||
</li>
|
||||
|
||||
<a name="glut">
|
||||
<li><b><em>GLUT</em></b> - The libglut library will be built by default
|
||||
if libGLU has been enabled and the glut source code from the MesaGLUT
|
||||
tarball is available. This can be disable with the option
|
||||
<code>--disable-glut</code>.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
|
||||
<a name="demos">
|
||||
<h2>4. Demo Program Options</h2>
|
||||
|
||||
<p>
|
||||
There are many demonstration programs in the MesaDemos tarball. If the
|
||||
programs are available when <code>./configure</code> is run, a subset of
|
||||
the programs will be built depending on the driver and library options
|
||||
chosen. See the directory <code>progs</code> for the full set of demos.
|
||||
|
||||
<ul>
|
||||
<li><code>--with-demos=DEMOS,DEMOS,...</code> - This option allows a
|
||||
specific set of demo programs to be built. For example,
|
||||
<code>--with-demos="xdemos,slang"</code>. Beware that if this option is
|
||||
used, it will not be ensured that the necessary GL libraries will be
|
||||
available.
|
||||
</li>
|
||||
<li><code>--without-demos</code> - This completely disables building the
|
||||
demo programs. It is equivalent to <code>--with-demos=no</code>.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -9,9 +9,9 @@
|
||||
<H1>Bug Database</H1>
|
||||
|
||||
<p>
|
||||
The Mesa bug database is hosted on
|
||||
<a href="http://freedesktop.org" target="_parent">freedesktop.org</a>.
|
||||
The old bug database on SourceForge is no longer used.
|
||||
The Mesa bug database is now hosted on
|
||||
<a href="http://freedesktop.org" target="_parent">freedesktop.org</a>
|
||||
instead of SourceForge.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -26,20 +26,16 @@ Please follow these bug reporting guidelines:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Check if a new version of Mesa is available which might have fixed
|
||||
the problem.
|
||||
<li>Check if your bug is already reported in the database.
|
||||
<li>Monitor your bug report for requests for additional information, etc.
|
||||
<li>If you're reporting a crash, try to use your debugger (gdb) to get a stack
|
||||
trace. Also, recompile Mesa in debug mode to get more detailed information.
|
||||
<li>Describe in detail how to reproduce the bug, especially with games
|
||||
and applications that the Mesa developers might not be familiar with.
|
||||
<li>Make sure you're using the most recent version of Mesa
|
||||
<li>Make sure your bug isn't already reported
|
||||
<li>Include as much information as possible in the report
|
||||
<li>Provide a simple GLUT-based test program if possible
|
||||
<li>Check back for follow-ups to the report
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Bug reports will automatically be forwarded by bugzilla to the Mesa
|
||||
developer's mailing list.
|
||||
Bug reports will automatically be forwarded to the Mesa developer's mailing
|
||||
list.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
107
docs/cell.html
107
docs/cell.html
@@ -1,107 +0,0 @@
|
||||
<HTML>
|
||||
|
||||
<TITLE>Cell Driver</TITLE>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<H1>Mesa Cell Driver</H1>
|
||||
|
||||
<p>
|
||||
The Mesa
|
||||
<a href="http://en.wikipedia.org/wiki/Cell_%28microprocessor%29" target="_parent">Cell</a>
|
||||
driver is part of the
|
||||
<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D" target="_parent">Gallium3D</a>
|
||||
architecture.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="http://www.tungstengraphics.com/" target="_parent">Tungsten Graphics</a>
|
||||
is leading the project.
|
||||
Two phases are planned.
|
||||
First, to implement the framework for parallel rasterization using the Cell
|
||||
SPEs, including texture mapping.
|
||||
Second, to implement a full-featured OpenGL driver with support for GLSL, etc.
|
||||
</p>
|
||||
|
||||
|
||||
<H2>Source Code</H2>
|
||||
|
||||
<p>
|
||||
The Cell driver source code is on the <code>gallium-0.1</code> branch of the
|
||||
git repository.
|
||||
After you've cloned the repository, check out the branch with:
|
||||
</p>
|
||||
<pre>
|
||||
git-checkout -b gallium-0.1 origin/gallium-0.1
|
||||
</pre>
|
||||
<p>
|
||||
To build the driver you'll need the IBM Cell SDK (version 2.1 or 3.0).
|
||||
To use the driver you'll need a Cell system, such as a PS3 running Linux,
|
||||
or the Cell Simulator (untested, though).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If using Cell SDK 3.0, first edit configs/linux-cell and add
|
||||
<code>-DSPU_MAIN_PARAM_LONG_LONG</code> to the SPU_CFLAGS.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To compile the code, run <code>make linux-cell</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To use the library, make sure <code>LD_LIBRARY_PATH</code> points the Mesa/lib/
|
||||
directory that contains <code>libGL.so</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Verify that the Cell driver is being used by running <code>glxinfo</code>
|
||||
and looking for:
|
||||
<pre>
|
||||
OpenGL renderer string: Gallium 0.1, Cell on Xlib
|
||||
</pre>
|
||||
|
||||
|
||||
<H2>Driver Implementation Summary</H2>
|
||||
|
||||
<p>
|
||||
Rasterization is parallelized across the SPUs in a tiled-based manner.
|
||||
Batches of transformed triangles are sent to the SPUs (actually, pulled by from
|
||||
main memory by the SPUs).
|
||||
Each SPU loops over a set of 32x32-pixel screen tiles, rendering the triangles
|
||||
into each tile.
|
||||
Because of the limited SPU memory, framebuffer tiles are paged in/out of
|
||||
SPU local store as needed.
|
||||
Similarly, textures are tiled and brought into local store as needed.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
More recently, vertex transformation has been parallelized across the SPUs
|
||||
as well.
|
||||
</p>
|
||||
|
||||
|
||||
<H2>Status</H2>
|
||||
|
||||
<p>
|
||||
As of February 2008 the driver supports smooth/flat shaded triangle rendering
|
||||
with Z testing and simple texture mapping.
|
||||
Simple demos like gears run successfully.
|
||||
To test texture mapping, try progs/demos/texcyl (press right mouse button for
|
||||
rendering options).
|
||||
</p>
|
||||
|
||||
|
||||
<H2>Contributing</H2>
|
||||
|
||||
<p>
|
||||
If you're interested in contributing to the effort, familiarize yourself
|
||||
with the code, join the <a href="lists.html">mesa3d-dev mailing list</a>,
|
||||
and describe what you'd like to do.
|
||||
</p>
|
||||
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
@@ -75,7 +75,6 @@ a:visited {
|
||||
<li><a href="subset.html" target="MainFrame">Mesa Subset Driver</a>
|
||||
<li><a href="glfbdev-driver.html" target="MainFrame">glFBDev Driver</a>
|
||||
<LI><A HREF="dispatch.html" target="MainFrame">GL Dispatch</A>
|
||||
<li><a href="cell.html" target="MainFrame">Cell Driver</A>
|
||||
</ul>
|
||||
|
||||
<b>Links</b>
|
||||
|
||||
@@ -135,12 +135,12 @@ Update the docs/VERSIONS file too.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Edit the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
|
||||
configs/default.
|
||||
Edit configs/default and change the MESA_MAJOR, MESA_MINOR and MESA_TINY
|
||||
version numbers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Make sure the values in src/mesa/main/version.h are correct.
|
||||
Make sure the values in src/mesa/main/version.h is correct.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<H1>Downloading</H1>
|
||||
|
||||
<p>
|
||||
Last stable release: <b>7.0.3</b>
|
||||
Last stable release: <b>7.0.2</b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -187,7 +187,24 @@ has Mesa packages (like RPM or DEB) which you can easily install.
|
||||
</a></p>
|
||||
|
||||
|
||||
<h2><a name="part2">2.2 I get undefined symbols such as bgnpolygon, v3f, etc...</a></h2>
|
||||
<h2><a name="part2">2.2 Running <code>configure; make</code> doesn't Work</a></h2>
|
||||
<p>
|
||||
Mesa no longer supports GNU autoconf/automake. Why?
|
||||
<ul>
|
||||
<li>It seemed to seldom work on anything but Linux
|
||||
<li>The config files were hard to maintain and hard to understand
|
||||
<li>libtool caused a lot of grief
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Now Mesa again uses a conventional Makefile system (as it did originally).
|
||||
Basically, each Makefile in the tree includes one of the configuration
|
||||
files from the config/ directory.
|
||||
The config files specify all the variables for a variety of popular systems.
|
||||
</p>
|
||||
|
||||
|
||||
<h2><a name="part2">2.3 I get undefined symbols such as bgnpolygon, v3f, etc...</a></h2>
|
||||
<p>
|
||||
<a name="part2">You're application is written in IRIS GL, not OpenGL.
|
||||
IRIS GL was the predecessor to OpenGL and is a different thing (almost)
|
||||
@@ -196,7 +213,7 @@ Mesa's not the solution.
|
||||
</a></p>
|
||||
|
||||
|
||||
<h2><a name="part2">2.3 Where is the GLUT library?</a></h2>
|
||||
<h2><a name="part2">2.4 Where is the GLUT library?</a></h2>
|
||||
<p>
|
||||
<a name="part2">GLUT (OpenGL Utility Toolkit) is in the separate MesaGLUT-x.y.z.tar.gz file.
|
||||
If you don't already have GLUT installed, you should grab the MesaGLUT
|
||||
@@ -205,7 +222,7 @@ package and compile it with the rest of Mesa.
|
||||
|
||||
|
||||
|
||||
<h2><a name="part2">2.4 What's the proper place for the libraries and headers?</a></h2>
|
||||
<h2><a name="part2">2.5 What's the proper place for the libraries and headers?</a></h2>
|
||||
<p>
|
||||
<a name="part2">On Linux-based systems you'll want to follow the
|
||||
</a><a href="http://oss.sgi.com/projects/ogl-sample/ABI/index.html"
|
||||
@@ -328,9 +345,9 @@ will fix the problem.
|
||||
First, join the <a href="http://www.mesa3d.org/lists.html">Mesa3d-dev
|
||||
mailing list</a>.
|
||||
That's where Mesa development is discussed.
|
||||
</p>
|
||||
</a></p>
|
||||
<p>
|
||||
The <a href="http://www.opengl.org/documentation" target="_parent">
|
||||
The </a><a href="http://www.opengl.org/documentation" target="_parent">
|
||||
OpenGL Specification</a> is the bible for OpenGL implemention work.
|
||||
You should read it.
|
||||
</p>
|
||||
|
||||
@@ -21,53 +21,10 @@
|
||||
<a name="unix-x11">
|
||||
<H2>1. Unix/X11 Compilation and Installation</H1>
|
||||
|
||||
|
||||
<h3>1.1 Prerequisites for DRI and Hardware Acceleration</h3>
|
||||
<h3>1.1 Compilation</h3>
|
||||
|
||||
<p>
|
||||
To build Mesa with DRI-based hardware acceleration you must first have
|
||||
the right version of DRM.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For Mesa 7.1 a particular snapshot of
|
||||
<a href="http://dri.freedesktop.org/libdrm/">DRM</a> from git is required:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
git-clone git://anongit.freedesktop.org/git/mesa/drm
|
||||
git-checkout (XXXX HASH ID TBD)
|
||||
</pre>
|
||||
</li>
|
||||
|
||||
<p>
|
||||
You should also be using Xorg server version 1.4
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<h3>1.2 Autoconf Compilation</h3>
|
||||
|
||||
<p>
|
||||
Mesa may be <a href="autoconf.html">built using autoconf</a>.
|
||||
This should work well on most GNU-based systems.
|
||||
When that fails, the traditional Mesa build system is available.
|
||||
|
||||
|
||||
|
||||
<h3>1.3 Traditional Compilation</h3>
|
||||
|
||||
<p>
|
||||
The traditional Mesa build system is based on a collection of pre-defined
|
||||
system configurations.
|
||||
</p>
|
||||
<p>
|
||||
To see the list of configurations, type <b>make</b> alone.
|
||||
Then choose a configuration from the list and type <b>make configname</b>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Mesa may be built in several different ways using the predefined configurations:
|
||||
Mesa may be compiled in several different ways:
|
||||
</p>
|
||||
<ul>
|
||||
<li><b><em>Stand-alone/Xlib mode</em></b> - Mesa will be compiled as
|
||||
@@ -92,6 +49,43 @@ accelerated OpenGL rendering (for ATI, Intel, Matrox, etc) will be built.
|
||||
The libGL.so library will support the GLX extension and will load/use
|
||||
the DRI hardware drivers.
|
||||
|
||||
<p>
|
||||
<b>Prerequisites:</b>
|
||||
</p>
|
||||
|
||||
<ol>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
For Mesa 7.0.2 <a href="http://dri.freedesktop.org/libdrm/">
|
||||
DRM version 2.3</a> is required.
|
||||
</p>
|
||||
<p>
|
||||
To check if you already have it, run:
|
||||
<br>
|
||||
<code>pkg-config --modversion libdrm</code>
|
||||
</p>
|
||||
<p>
|
||||
You can download and install a <a href="http://dri.freedesktop.org/libdrm/">
|
||||
tarball release</a> or get the code from git with:
|
||||
<br>
|
||||
<code>git clone git://anongit.freedesktop.org/git/mesa/drm</code>
|
||||
<br>
|
||||
Then revert to the drm-2.3.0 tag with:
|
||||
<br>
|
||||
<code>git-reset --hard drm-2.3.0</code>
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Relatively recent
|
||||
<a href="http://freedesktop.org/wiki/Software_2fXserver" target="_parent">
|
||||
X.org</a> release.
|
||||
Mesa depends on a number of X header and library files.
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
<p>
|
||||
Build Mesa and the DRI hardware drivers by running
|
||||
@@ -104,13 +98,8 @@ There are also <code>linux-dri-x86</code>, <code>linux-dri-x86-64</code>,
|
||||
and <code>linux-ppc</code> configurations which are optimized for those
|
||||
architectures.
|
||||
</p>
|
||||
<p>
|
||||
Make sure you have the prerequisite versions of DRM and Xserver mentioned
|
||||
above.
|
||||
</p>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -120,7 +109,7 @@ Later, if you want to rebuild for a different configuration run
|
||||
</p>
|
||||
|
||||
|
||||
<h3>1.4 The libraries</h3>
|
||||
<h3>1.2 The libraries</h3>
|
||||
|
||||
<p>
|
||||
When compilation has finished, look in the top-level <code>lib/</code>
|
||||
@@ -161,15 +150,15 @@ lrwxrwxrwx 1 brian users 23 Mar 26 07:53 libOSMesa.so.6 -> libOSM
|
||||
If you built the DRI hardware drivers, you'll also see the DRI drivers:
|
||||
</p>
|
||||
<pre>
|
||||
-rwxr-xr-x 1 brian users 15607851 Jul 21 12:11 ffb_dri.so
|
||||
-rwxr-xr-x 1 brian users 15148747 Jul 21 12:11 i810_dri.so
|
||||
-rwxr-xr-x 1 brian users 14497814 Jul 21 12:11 i830_dri.so
|
||||
-rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i915_dri.so
|
||||
-rwxr-xr-x 1 brian users 15607851 Jul 21 12:11 ffb_dri.so*
|
||||
-rwxr-xr-x 1 brian users 15148747 Jul 21 12:11 i810_dri.so*
|
||||
-rwxr-xr-x 1 brian users 14497814 Jul 21 12:11 i830_dri.so*
|
||||
-rwxr-xr-x 1 brian users 16895413 Jul 21 12:11 i915_dri.so*
|
||||
-rwxr-xr-x 1 brian users 11320803 Jul 21 12:11 mach64_dri.so
|
||||
-rwxr-xr-x 1 brian users 11418014 Jul 21 12:12 mga_dri.so
|
||||
-rwxr-xr-x 1 brian users 11064426 Jul 21 12:12 r128_dri.so
|
||||
-rwxr-xr-x 1 brian users 11849858 Jul 21 12:12 r200_dri.so
|
||||
-rwxr-xr-x 1 brian users 16050488 Jul 21 12:11 r300_dri.so
|
||||
-rwxr-xr-x 1 brian users 16050488 Jul 21 12:11 r300_dri.so*
|
||||
-rwxr-xr-x 1 brian users 11757388 Jul 21 12:12 radeon_dri.so
|
||||
-rwxr-xr-x 1 brian users 11232304 Jul 21 12:13 s3v_dri.so
|
||||
-rwxr-xr-x 1 brian users 11062970 Jul 21 12:13 savage_dri.so
|
||||
@@ -180,7 +169,7 @@ If you built the DRI hardware drivers, you'll also see the DRI drivers:
|
||||
</pre>
|
||||
|
||||
|
||||
<h3>1.5 Running the demos</h3>
|
||||
<h3>1.3 Running the demos</h3>
|
||||
|
||||
<p>
|
||||
If you downloaded/unpacked the MesaDemos-x.y.z.tar.gz archive or
|
||||
@@ -189,15 +178,18 @@ bunch of demonstration programs.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Before running a demo, you'll probably have to set two environment variables
|
||||
to indicate where the libraries are located. For example:
|
||||
Before running a demo, you may have to set an environment variable
|
||||
(such as <b>LD_LIBRARY_PATH</b> on Linux) to indicate where the
|
||||
libraries are located. For example:
|
||||
<p>
|
||||
<blockquote>
|
||||
<b>cd lib/</b>
|
||||
<b>cd</b> into the Mesa <b>lib/</b> directory.
|
||||
<br>
|
||||
<b>export LD_LIBRARY_PATH=${PWD}</b>
|
||||
<b>setenv LD_LIBRARY_PATH ${cwd}</b> (if using csh or tcsh shell)
|
||||
<br>
|
||||
<b>export LIBGL_DRIVERS_PATH=${PWD}</b> (if using DRI drivers)
|
||||
or,
|
||||
<br>
|
||||
<b>export LD_LIBRARY_PATH=${PWD}</b> (if using bash or sh shell)
|
||||
</blockquote>
|
||||
|
||||
<p>
|
||||
@@ -255,7 +247,7 @@ Retrace your steps if this doesn't look right.
|
||||
</p>
|
||||
|
||||
|
||||
<H3>1.6 Installing the header and library files</H3>
|
||||
<H3>1.4 Installing the header and library files</H3>
|
||||
|
||||
<p>
|
||||
The standard location for the OpenGL header files on Unix-type systems is
|
||||
@@ -295,7 +287,7 @@ This is a handy way to compare multiple OpenGL implementations.
|
||||
</p>
|
||||
|
||||
|
||||
<H3>1.7 Building OpenGL Programs With pkg-config</H3>
|
||||
<H3>1.5 pkg-config support</H3>
|
||||
|
||||
<p>
|
||||
Running <code>make install</code> will install package configuration files
|
||||
|
||||
21
docs/memory.html
Normal file
21
docs/memory.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<HTML>
|
||||
|
||||
<TITLE>Mesa News</TITLE>
|
||||
|
||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>DRI Memory Management</H1>
|
||||
|
||||
<p>
|
||||
Thomas Hellström's
|
||||
<a href="http://www.tungstengraphics.com/mm.pdf">Memory Management
|
||||
whitepaper</a> describes the goals, design and implementation of the
|
||||
new DRI memory management system.
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -11,21 +11,6 @@
|
||||
<H1>News</H1>
|
||||
|
||||
|
||||
<h2>April 4, 2008</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.0.3.html">Mesa 7.0.3</a> is released.
|
||||
This is a bug-fix release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>January 24, 2008</h2>
|
||||
|
||||
<p>
|
||||
Added a new page describing the <a href="cell.html">Mesa Cell driver</a>.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<h2>November 13, 2007</h2>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.0.3 Release Notes / April 4, 2008</H1>
|
||||
<H1>Mesa 7.0.3 Release Notes / March TBD, 2008</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.0.3 is a stable release with bug fixes since version 7.0.2.
|
||||
@@ -17,15 +17,6 @@ Mesa 7.0.3 is a stable release with bug fixes since version 7.0.2.
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
3fd1cb76531b2515ef7db92d9a93dbf8 MesaLib-7.0.3.tar.gz
|
||||
e6e6379d7793af40a6bc3ce1bace572e MesaLib-7.0.3.tar.bz2
|
||||
97882bac195229ee0b78cab82e0e3be1 MesaLib-7.0.3.zip
|
||||
8abf6bbcb1661e7dd4ce73b3fbb85898 MesaDemos-7.0.3.tar.gz
|
||||
47fd6863621d3c9c7dbb870ab7f0c303 MesaDemos-7.0.3.tar.bz2
|
||||
99e442e14da1928f76a7297bb421a3af MesaDemos-7.0.3.zip
|
||||
2b50fe9fadc4709b57c52adef09fce3c MesaGLUT-7.0.3.tar.gz
|
||||
0ff23c4e91b238abae63a5fc9fa003e7 MesaGLUT-7.0.3.tar.bz2
|
||||
70e83554a4462dad28e0d6e20f79aada MesaGLUT-7.0.3.zip
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
<HTML>
|
||||
|
||||
<TITLE>Mesa Release Notes</TITLE>
|
||||
|
||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.1 Release Notes / May XX, 2008</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.1 is a new development release.
|
||||
There have been many internal code changes since Mesa 7.0.x.
|
||||
It should be relatively stable, but those who are especially concerned about
|
||||
stability should wait for Mesa 7.2.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
TBD
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>New features</h2>
|
||||
<ul>
|
||||
<li>autoconf-based configuration
|
||||
<li>Reduced dependencies between X server and Mesa
|
||||
<li>GL_EXT_texture_from_pixmap extension for Xlib driver
|
||||
<li>Support for the GL shading language with i965 driver (implemented by Intel)
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>To Do (someday) items</h2>
|
||||
<ul>
|
||||
<li>Remove the MEMCPY() and _mesa_memcpy() wrappers and just use memcpy().
|
||||
Probably do the same for malloc, calloc, etc.
|
||||
The wrappers were useful in the past for memory debugging but now we
|
||||
have valgrind. Not worried about SunOS 4 support anymore either...
|
||||
<li>Switch to freeglut
|
||||
<li>Fix linux-glide target/driver.
|
||||
<li>Improved lambda and derivative calculation for frag progs.
|
||||
</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>
|
||||
@@ -20,7 +20,6 @@ The release notes summarize what's new or changed in each Mesa release.
|
||||
</p>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="relnotes-7.1.html">7.1 release notes</A>
|
||||
<LI><A HREF="relnotes-7.0.3.html">7.0.3 release notes</A>
|
||||
<LI><A HREF="relnotes-7.0.2.html">7.0.2 release notes</A>
|
||||
<LI><A HREF="relnotes-7.0.1.html">7.0.1 release notes</A>
|
||||
|
||||
@@ -85,27 +85,6 @@ Once your account is established:
|
||||
</ol>
|
||||
|
||||
|
||||
<H2>Windows Users</H2>
|
||||
|
||||
<p>
|
||||
If you're <a href="http://git.or.cz/gitwiki/WindowsInstall" target="_parent">
|
||||
using git on Windows</a> you'll want to enable automatic CR/LF conversion in
|
||||
your local copy of the repository:
|
||||
</p>
|
||||
<pre>
|
||||
git config --global core.autocrlf true
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
This will cause git to convert all text files to CR+LF on checkout,
|
||||
and to LF on commit.
|
||||
</p>
|
||||
<p>
|
||||
Unix users don't need to set this option.
|
||||
</p>
|
||||
<br>
|
||||
|
||||
|
||||
<a name="developer">
|
||||
<H2>Development Branches</H2>
|
||||
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
|
||||
default: full
|
||||
|
||||
all: full subset
|
||||
|
||||
%.tag: %.doxy
|
||||
doxygen $<
|
||||
|
||||
FULL = \
|
||||
main.doxy \
|
||||
math.doxy \
|
||||
vbo.doxy \
|
||||
glapi.doxy \
|
||||
shader.doxy \
|
||||
swrast.doxy \
|
||||
swrast_setup.doxy \
|
||||
tnl.doxy \
|
||||
tnl_dd.doxy
|
||||
|
||||
full: $(FULL:.doxy=.tag)
|
||||
$(foreach FILE,$(FULL),doxygen $(FILE);)
|
||||
|
||||
SUBSET = \
|
||||
main.doxy \
|
||||
math.doxy \
|
||||
miniglx.doxy
|
||||
|
||||
subset: $(SUBSET:.doxy=.tag)
|
||||
$(foreach FILE,$(SUBSET),doxygen $(FILE);)
|
||||
|
||||
clean:
|
||||
-rm -rf $(FULL:.doxy=) $(SUBSET:.doxy=)
|
||||
-rm -rf *.tag
|
||||
|
||||
default: full
|
||||
|
||||
all: full subset
|
||||
|
||||
%.tag: %.doxy
|
||||
doxygen $<
|
||||
|
||||
FULL = \
|
||||
main.doxy \
|
||||
math.doxy \
|
||||
vbo.doxy \
|
||||
glapi.doxy \
|
||||
shader.doxy \
|
||||
swrast.doxy \
|
||||
swrast_setup.doxy \
|
||||
tnl.doxy \
|
||||
tnl_dd.doxy
|
||||
|
||||
full: $(FULL:.doxy=.tag)
|
||||
$(foreach FILE,$(FULL),doxygen $(FILE);)
|
||||
|
||||
SUBSET = \
|
||||
main.doxy \
|
||||
math.doxy \
|
||||
miniglx.doxy
|
||||
|
||||
subset: $(SUBSET:.doxy=.tag)
|
||||
$(foreach FILE,$(SUBSET),doxygen $(FILE);)
|
||||
|
||||
clean:
|
||||
rm -rf $(FULL:.doxy=) $(SUBSET:.doxy=)
|
||||
rm -rf *.tag
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
doxygen tnl_dd.doxy
|
||||
doxygen vbo.doxy
|
||||
doxygen math.doxy
|
||||
doxygen swrast.doxy
|
||||
doxygen swrast_setup.doxy
|
||||
doxygen tnl.doxy
|
||||
doxygen core.doxy
|
||||
doxygen glapi.doxy
|
||||
doxygen shader.doxy
|
||||
|
||||
echo Building again, to resolve tags
|
||||
doxygen tnl_dd.doxy
|
||||
doxygen vbo.doxy
|
||||
doxygen math.doxy
|
||||
doxygen swrast.doxy
|
||||
doxygen swrast_setup.doxy
|
||||
doxygen tnl.doxy
|
||||
doxygen glapi.doxy
|
||||
doxygen shader.doxy
|
||||
doxygen tnl_dd.doxy
|
||||
doxygen vbo.doxy
|
||||
doxygen math.doxy
|
||||
doxygen swrast.doxy
|
||||
doxygen swrast_setup.doxy
|
||||
doxygen tnl.doxy
|
||||
doxygen core.doxy
|
||||
doxygen glapi.doxy
|
||||
doxygen shader.doxy
|
||||
|
||||
echo Building again, to resolve tags
|
||||
doxygen tnl_dd.doxy
|
||||
doxygen vbo.doxy
|
||||
doxygen math.doxy
|
||||
doxygen swrast.doxy
|
||||
doxygen swrast_setup.doxy
|
||||
doxygen tnl.doxy
|
||||
doxygen glapi.doxy
|
||||
doxygen shader.doxy
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5.1
|
||||
* Version: 7.0
|
||||
*
|
||||
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -2210,39 +2210,6 @@ GLAPI void GLAPIENTRY glGetProgramRegisterfvMESA(GLenum target, GLsizei len, con
|
||||
#endif /* GL_MESA_program_debug */
|
||||
|
||||
|
||||
#ifndef GL_MESA_texture_array
|
||||
#define GL_MESA_texture_array 1
|
||||
|
||||
/* GL_MESA_texture_array uses the same enum values as GL_EXT_texture_array.
|
||||
*/
|
||||
#ifndef GL_EXT_texture_array
|
||||
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glFramebufferTextureLayerEXT(GLenum target,
|
||||
GLenum attachment, GLuint texture, GLint level, GLint layer);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
|
||||
#if 0
|
||||
/* (temporarily) disabled because of collision with typedef in glext.h
|
||||
* that happens if apps include both gl.h and glext.h
|
||||
*/
|
||||
typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target,
|
||||
GLenum attachment, GLuint texture, GLint level, GLint layer);
|
||||
#endif
|
||||
|
||||
#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18
|
||||
#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19
|
||||
#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A
|
||||
#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B
|
||||
#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C
|
||||
#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
|
||||
#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef GL_ATI_blend_equation_separate
|
||||
#define GL_ATI_blend_equation_separate 1
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
* Copyright 2007-2008 Red Hat, Inc.
|
||||
* (C) Copyright IBM Corporation 2004
|
||||
* All Rights Reserved.
|
||||
*
|
||||
@@ -34,12 +33,12 @@
|
||||
*
|
||||
* \author Kevin E. Martin <kevin@precisioninsight.com>
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
* \author Kristian Høgsberg <krh@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef DRI_INTERFACE_H
|
||||
#define DRI_INTERFACE_H
|
||||
|
||||
#include <GL/internal/glcore.h>
|
||||
#include <drm.h>
|
||||
|
||||
/**
|
||||
@@ -49,190 +48,65 @@
|
||||
* side library and the DRI (direct rendering infrastructure).
|
||||
*/
|
||||
/*@{*/
|
||||
typedef struct __DRIdisplayRec __DRIdisplay;
|
||||
typedef struct __DRIscreenRec __DRIscreen;
|
||||
typedef struct __DRIcontextRec __DRIcontext;
|
||||
typedef struct __DRIdrawableRec __DRIdrawable;
|
||||
typedef struct __DRIconfigRec __DRIconfig;
|
||||
typedef struct __DRIframebufferRec __DRIframebuffer;
|
||||
typedef struct __DRIversionRec __DRIversion;
|
||||
|
||||
typedef struct __DRIcoreExtensionRec __DRIcoreExtension;
|
||||
typedef struct __DRIextensionRec __DRIextension;
|
||||
typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension;
|
||||
typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension;
|
||||
typedef struct __DRIallocateExtensionRec __DRIallocateExtension;
|
||||
typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension;
|
||||
typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtension;
|
||||
typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension;
|
||||
typedef struct __DRItexBufferExtensionRec __DRItexBufferExtension;
|
||||
typedef struct __DRIlegacyExtensionRec __DRIlegacyExtension;
|
||||
typedef struct __DRIswrastExtensionRec __DRIswrastExtension;
|
||||
typedef struct __DRIdisplayRec __DRIdisplay;
|
||||
typedef struct __DRIscreenRec __DRIscreen;
|
||||
typedef struct __DRIcontextRec __DRIcontext;
|
||||
typedef struct __DRIdrawableRec __DRIdrawable;
|
||||
typedef struct __DRIdriverRec __DRIdriver;
|
||||
typedef struct __DRIframebufferRec __DRIframebuffer;
|
||||
typedef struct __DRIversionRec __DRIversion;
|
||||
typedef struct __DRIinterfaceMethodsRec __DRIinterfaceMethods;
|
||||
typedef unsigned long __DRIid;
|
||||
typedef void __DRInativeDisplay;
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* Extension struct. Drivers 'inherit' from this struct by embedding
|
||||
* it as the first element in the extension struct.
|
||||
* \name Functions provided by the driver loader.
|
||||
*/
|
||||
/*@{*/
|
||||
/**
|
||||
* Type of a pointer to \c glXGetScreenDriver, as returned by
|
||||
* \c glXGetProcAddress. This function is used to get the name of the DRI
|
||||
* driver for the specified screen of the specified display. The driver
|
||||
* name is typically used with \c glXGetDriverConfig.
|
||||
*
|
||||
* We never break API in for a DRI extension. If we need to change
|
||||
* the way things work in a non-backwards compatible manner, we
|
||||
* introduce a new extension. During a transition period, we can
|
||||
* leave both the old and the new extension in the driver, which
|
||||
* allows us to move to the new interface without having to update the
|
||||
* loader(s) in lock step.
|
||||
* \sa glXGetScreenDriver, glXGetProcAddress, glXGetDriverConfig
|
||||
*/
|
||||
typedef const char * (* PFNGLXGETSCREENDRIVERPROC) (__DRInativeDisplay *dpy, int scrNum);
|
||||
|
||||
/**
|
||||
* Type of a pointer to \c glXGetDriverConfig, as returned by
|
||||
* \c glXGetProcAddress. This function is used to get the XML document
|
||||
* describing the configuration options available for the specified driver.
|
||||
*
|
||||
* However, we can add entry points to an extension over time as long
|
||||
* as we don't break the old ones. As we add entry points to an
|
||||
* extension, we increase the version number. The corresponding
|
||||
* #define can be used to guard code that accesses the new entry
|
||||
* points at compile time and the version field in the extension
|
||||
* struct can be used at run-time to determine how to use the
|
||||
* extension.
|
||||
* \sa glXGetDriverConfig, glXGetProcAddress, glXGetScreenDriver
|
||||
*/
|
||||
struct __DRIextensionRec {
|
||||
const char *name;
|
||||
int version;
|
||||
};
|
||||
typedef const char * (* PFNGLXGETDRIVERCONFIGPROC) (const char *driverName);
|
||||
|
||||
/**
|
||||
* The first set of extension are the screen extensions, returned by
|
||||
* __DRIcore::getExtensions(). This entry point will return a list of
|
||||
* extensions and the loader can use the ones it knows about by
|
||||
* casting them to more specific extensions and advertising any GLX
|
||||
* extensions the DRI extensions enables.
|
||||
* Type of a pointer to \c glxEnableExtension, as returned by
|
||||
* \c __DRIinterfaceMethods::getProcAddress. This function is used to enable
|
||||
* a GLX extension on the specified screen.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Used by drivers to indicate support for setting the read drawable.
|
||||
*/
|
||||
#define __DRI_READ_DRAWABLE "DRI_ReadDrawable"
|
||||
#define __DRI_READ_DRAWABLE_VERSION 1
|
||||
|
||||
/**
|
||||
* Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
|
||||
*/
|
||||
#define __DRI_COPY_SUB_BUFFER "DRI_CopySubBuffer"
|
||||
#define __DRI_COPY_SUB_BUFFER_VERSION 1
|
||||
struct __DRIcopySubBufferExtensionRec {
|
||||
__DRIextension base;
|
||||
void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h);
|
||||
};
|
||||
|
||||
/**
|
||||
* Used by drivers that implement the GLX_SGI_swap_control or
|
||||
* GLX_MESA_swap_control extension.
|
||||
*/
|
||||
#define __DRI_SWAP_CONTROL "DRI_SwapControl"
|
||||
#define __DRI_SWAP_CONTROL_VERSION 1
|
||||
struct __DRIswapControlExtensionRec {
|
||||
__DRIextension base;
|
||||
void (*setSwapInterval)(__DRIdrawable *drawable, unsigned int inteval);
|
||||
unsigned int (*getSwapInterval)(__DRIdrawable *drawable);
|
||||
};
|
||||
|
||||
/**
|
||||
* Used by drivers that implement the GLX_MESA_allocate_memory.
|
||||
*/
|
||||
#define __DRI_ALLOCATE "DRI_Allocate"
|
||||
#define __DRI_ALLOCATE_VERSION 1
|
||||
struct __DRIallocateExtensionRec {
|
||||
__DRIextension base;
|
||||
|
||||
void *(*allocateMemory)(__DRIscreen *screen, GLsizei size,
|
||||
GLfloat readfreq, GLfloat writefreq,
|
||||
GLfloat priority);
|
||||
|
||||
void (*freeMemory)(__DRIscreen *screen, GLvoid *pointer);
|
||||
|
||||
GLuint (*memoryOffset)(__DRIscreen *screen, const GLvoid *pointer);
|
||||
};
|
||||
|
||||
/**
|
||||
* Used by drivers that implement the GLX_MESA_swap_frame_usage extension.
|
||||
*/
|
||||
#define __DRI_FRAME_TRACKING "DRI_FrameTracking"
|
||||
#define __DRI_FRAME_TRACKING_VERSION 1
|
||||
struct __DRIframeTrackingExtensionRec {
|
||||
__DRIextension base;
|
||||
|
||||
/**
|
||||
* Enable or disable frame usage tracking.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable);
|
||||
|
||||
/**
|
||||
* Retrieve frame usage information.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int (*queryFrameTracking)(__DRIdrawable *drawable,
|
||||
int64_t * sbc, int64_t * missedFrames,
|
||||
float * lastMissedUsage, float * usage);
|
||||
};
|
||||
typedef void (* PFNGLXSCRENABLEEXTENSIONPROC) ( void *psc, const char * name );
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* Used by drivers that implement the GLX_SGI_video_sync extension.
|
||||
* \name Functions and data provided by the driver.
|
||||
*/
|
||||
#define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter"
|
||||
#define __DRI_MEDIA_STREAM_COUNTER_VERSION 1
|
||||
struct __DRImediaStreamCounterExtensionRec {
|
||||
__DRIextension base;
|
||||
/*@{*/
|
||||
|
||||
/**
|
||||
* Wait for the MSC to equal target_msc, or, if that has already passed,
|
||||
* the next time (MSC % divisor) is equal to remainder. If divisor is
|
||||
* zero, the function will return as soon as MSC is greater than or equal
|
||||
* to target_msc.
|
||||
*/
|
||||
int (*waitForMSC)(__DRIdrawable *drawable,
|
||||
int64_t target_msc, int64_t divisor, int64_t remainder,
|
||||
int64_t * msc, int64_t * sbc);
|
||||
|
||||
/**
|
||||
* Get the number of vertical refreshes since some point in time before
|
||||
* this function was first called (i.e., system start up).
|
||||
*/
|
||||
int (*getDrawableMSC)(__DRIscreen *screen, __DRIdrawable *drawable,
|
||||
int64_t *msc);
|
||||
};
|
||||
|
||||
|
||||
#define __DRI_TEX_OFFSET "DRI_TexOffset"
|
||||
#define __DRI_TEX_OFFSET_VERSION 1
|
||||
struct __DRItexOffsetExtensionRec {
|
||||
__DRIextension base;
|
||||
|
||||
/**
|
||||
* Method to override base texture image with a driver specific 'offset'.
|
||||
* The depth passed in allows e.g. to ignore the alpha channel of texture
|
||||
* images where the non-alpha components don't occupy a whole texel.
|
||||
*
|
||||
* For GLX_EXT_texture_from_pixmap with AIGLX.
|
||||
*/
|
||||
void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
|
||||
unsigned long long offset, GLint depth, GLuint pitch);
|
||||
};
|
||||
|
||||
|
||||
#define __DRI_TEX_BUFFER "DRI_TexBuffer"
|
||||
#define __DRI_TEX_BUFFER_VERSION 1
|
||||
struct __DRItexBufferExtensionRec {
|
||||
__DRIextension base;
|
||||
|
||||
/**
|
||||
* Method to override base texture image with the contents of a
|
||||
* __DRIdrawable.
|
||||
*
|
||||
* For GLX_EXT_texture_from_pixmap with AIGLX.
|
||||
*/
|
||||
void (*setTexBuffer)(__DRIcontext *pDRICtx,
|
||||
GLint target,
|
||||
__DRIdrawable *pDraw);
|
||||
};
|
||||
typedef void *(CREATENEWSCREENFUNC)(__DRInativeDisplay *dpy, int scrn,
|
||||
__DRIscreen *psc, const __GLcontextModes * modes,
|
||||
const __DRIversion * ddx_version, const __DRIversion * dri_version,
|
||||
const __DRIversion * drm_version, const __DRIframebuffer * frame_buffer,
|
||||
void * pSAREA, int fd, int internal_api_version,
|
||||
const __DRIinterfaceMethods * interface,
|
||||
__GLcontextModes ** driver_modes);
|
||||
typedef CREATENEWSCREENFUNC* PFNCREATENEWSCREENFUNC;
|
||||
extern CREATENEWSCREENFUNC __driCreateNewScreen_20050727;
|
||||
|
||||
|
||||
/**
|
||||
@@ -243,289 +117,6 @@ extern const char __driConfigOptions[];
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* The following extensions describe loader features that the DRI
|
||||
* driver can make use of. Some of these are mandatory, such as the
|
||||
* getDrawableInfo extension for DRI and the DRI Loader extensions for
|
||||
* DRI2, while others are optional, and if present allow the driver to
|
||||
* expose certain features. The loader pass in a NULL terminated
|
||||
* array of these extensions to the driver in the createNewScreen
|
||||
* constructor.
|
||||
*/
|
||||
|
||||
typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension;
|
||||
typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension;
|
||||
typedef struct __DRIdamageExtensionRec __DRIdamageExtension;
|
||||
typedef struct __DRIloaderExtensionRec __DRIloaderExtension;
|
||||
typedef struct __DRIswrastLoaderExtensionRec __DRIswrastLoaderExtension;
|
||||
|
||||
|
||||
/**
|
||||
* Callback to getDrawableInfo protocol
|
||||
*/
|
||||
#define __DRI_GET_DRAWABLE_INFO "DRI_GetDrawableInfo"
|
||||
#define __DRI_GET_DRAWABLE_INFO_VERSION 1
|
||||
struct __DRIgetDrawableInfoExtensionRec {
|
||||
__DRIextension base;
|
||||
|
||||
/**
|
||||
* This function is used to get information about the position, size, and
|
||||
* clip rects of a drawable.
|
||||
*/
|
||||
GLboolean (* getDrawableInfo) ( __DRIdrawable *drawable,
|
||||
unsigned int * index, unsigned int * stamp,
|
||||
int * x, int * y, int * width, int * height,
|
||||
int * numClipRects, drm_clip_rect_t ** pClipRects,
|
||||
int * backX, int * backY,
|
||||
int * numBackClipRects, drm_clip_rect_t ** pBackClipRects,
|
||||
void *loaderPrivate);
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback to get system time for media stream counter extensions.
|
||||
*/
|
||||
#define __DRI_SYSTEM_TIME "DRI_SystemTime"
|
||||
#define __DRI_SYSTEM_TIME_VERSION 1
|
||||
struct __DRIsystemTimeExtensionRec {
|
||||
__DRIextension base;
|
||||
|
||||
/**
|
||||
* Get the 64-bit unadjusted system time (UST).
|
||||
*/
|
||||
int (*getUST)(int64_t * ust);
|
||||
|
||||
/**
|
||||
* Get the media stream counter (MSC) rate.
|
||||
*
|
||||
* Matching the definition in GLX_OML_sync_control, this function returns
|
||||
* the rate of the "media stream counter". In practical terms, this is
|
||||
* the frame refresh rate of the display.
|
||||
*/
|
||||
GLboolean (*getMSCRate)(__DRIdrawable *draw,
|
||||
int32_t * numerator, int32_t * denominator,
|
||||
void *loaderPrivate);
|
||||
};
|
||||
|
||||
/**
|
||||
* Damage reporting
|
||||
*/
|
||||
#define __DRI_DAMAGE "DRI_Damage"
|
||||
#define __DRI_DAMAGE_VERSION 1
|
||||
struct __DRIdamageExtensionRec {
|
||||
__DRIextension base;
|
||||
|
||||
/**
|
||||
* Reports areas of the given drawable which have been modified by the
|
||||
* driver.
|
||||
*
|
||||
* \param drawable which the drawing was done to.
|
||||
* \param rects rectangles affected, with the drawable origin as the
|
||||
* origin.
|
||||
* \param x X offset of the drawable within the screen (used in the
|
||||
* front_buffer case)
|
||||
* \param y Y offset of the drawable within the screen.
|
||||
* \param front_buffer boolean flag for whether the drawing to the
|
||||
* drawable was actually done directly to the front buffer (instead
|
||||
* of backing storage, for example)
|
||||
* \param loaderPrivate the data passed in at createNewDrawable time
|
||||
*/
|
||||
void (*reportDamage)(__DRIdrawable *draw,
|
||||
int x, int y,
|
||||
drm_clip_rect_t *rects, int num_rects,
|
||||
GLboolean front_buffer,
|
||||
void *loaderPrivate);
|
||||
};
|
||||
|
||||
/**
|
||||
* DRI2 Loader extension. This extension describes the basic
|
||||
* functionality the loader needs to provide for the DRI driver.
|
||||
*/
|
||||
#define __DRI_LOADER "DRI_Loader"
|
||||
#define __DRI_LOADER_VERSION 1
|
||||
struct __DRIloaderExtensionRec {
|
||||
__DRIextension base;
|
||||
|
||||
/**
|
||||
* Ping the windowing system to get it to reemit info for the
|
||||
* specified drawable in the DRI2 event buffer.
|
||||
*
|
||||
* \param draw the drawable for which to request info
|
||||
* \param tail the new event buffer tail pointer
|
||||
*/
|
||||
void (*reemitDrawableInfo)(__DRIdrawable *draw, unsigned int *tail,
|
||||
void *loaderPrivate);
|
||||
|
||||
void (*postDamage)(__DRIdrawable *draw, struct drm_clip_rect *rects,
|
||||
int num_rects, void *loaderPrivate);
|
||||
};
|
||||
|
||||
#define __DRI_SWRAST_IMAGE_OP_DRAW 1
|
||||
#define __DRI_SWRAST_IMAGE_OP_CLEAR 2
|
||||
#define __DRI_SWRAST_IMAGE_OP_SWAP 3
|
||||
|
||||
/**
|
||||
* SWRast Loader extension.
|
||||
*/
|
||||
#define __DRI_SWRAST_LOADER "DRI_SWRastLoader"
|
||||
#define __DRI_SWRAST_LOADER_VERSION 1
|
||||
struct __DRIswrastLoaderExtensionRec {
|
||||
__DRIextension base;
|
||||
|
||||
/*
|
||||
* Drawable position and size
|
||||
*/
|
||||
void (*getDrawableInfo)(__DRIdrawable *drawable,
|
||||
int *x, int *y, int *width, int *height,
|
||||
void *loaderPrivate);
|
||||
|
||||
/**
|
||||
* Put image to drawable
|
||||
*/
|
||||
void (*putImage)(__DRIdrawable *drawable, int op,
|
||||
int x, int y, int width, int height, char *data,
|
||||
void *loaderPrivate);
|
||||
|
||||
/**
|
||||
* Get image from drawable
|
||||
*/
|
||||
void (*getImage)(__DRIdrawable *drawable,
|
||||
int x, int y, int width, int height, char *data,
|
||||
void *loaderPrivate);
|
||||
};
|
||||
|
||||
/**
|
||||
* The remaining extensions describe driver extensions, immediately
|
||||
* available interfaces provided by the driver. To start using the
|
||||
* driver, dlsym() for the __DRI_DRIVER_EXTENSIONS symbol and look for
|
||||
* the extension you need in the array.
|
||||
*/
|
||||
#define __DRI_DRIVER_EXTENSIONS "__driDriverExtensions"
|
||||
|
||||
/**
|
||||
* Tokens for __DRIconfig attribs. A number of attributes defined by
|
||||
* GLX or EGL standards are not in the table, as they must be provided
|
||||
* by the loader. For example, FBConfig ID or visual ID, drawable type.
|
||||
*/
|
||||
|
||||
#define __DRI_ATTRIB_BUFFER_SIZE 1
|
||||
#define __DRI_ATTRIB_LEVEL 2
|
||||
#define __DRI_ATTRIB_RED_SIZE 3
|
||||
#define __DRI_ATTRIB_GREEN_SIZE 4
|
||||
#define __DRI_ATTRIB_BLUE_SIZE 5
|
||||
#define __DRI_ATTRIB_LUMINANCE_SIZE 6
|
||||
#define __DRI_ATTRIB_ALPHA_SIZE 7
|
||||
#define __DRI_ATTRIB_ALPHA_MASK_SIZE 8
|
||||
#define __DRI_ATTRIB_DEPTH_SIZE 9
|
||||
#define __DRI_ATTRIB_STENCIL_SIZE 10
|
||||
#define __DRI_ATTRIB_ACCUM_RED_SIZE 11
|
||||
#define __DRI_ATTRIB_ACCUM_GREEN_SIZE 12
|
||||
#define __DRI_ATTRIB_ACCUM_BLUE_SIZE 13
|
||||
#define __DRI_ATTRIB_ACCUM_ALPHA_SIZE 14
|
||||
#define __DRI_ATTRIB_SAMPLE_BUFFERS 15
|
||||
#define __DRI_ATTRIB_SAMPLES 16
|
||||
#define __DRI_ATTRIB_RENDER_TYPE 17
|
||||
#define __DRI_ATTRIB_CONFIG_CAVEAT 18
|
||||
#define __DRI_ATTRIB_CONFORMANT 19
|
||||
#define __DRI_ATTRIB_DOUBLE_BUFFER 20
|
||||
#define __DRI_ATTRIB_STEREO 21
|
||||
#define __DRI_ATTRIB_AUX_BUFFERS 22
|
||||
#define __DRI_ATTRIB_TRANSPARENT_TYPE 23
|
||||
#define __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE 24
|
||||
#define __DRI_ATTRIB_TRANSPARENT_RED_VALUE 25
|
||||
#define __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE 26
|
||||
#define __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE 27
|
||||
#define __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE 28
|
||||
#define __DRI_ATTRIB_FLOAT_MODE 29
|
||||
#define __DRI_ATTRIB_RED_MASK 30
|
||||
#define __DRI_ATTRIB_GREEN_MASK 31
|
||||
#define __DRI_ATTRIB_BLUE_MASK 32
|
||||
#define __DRI_ATTRIB_ALPHA_MASK 33
|
||||
#define __DRI_ATTRIB_MAX_PBUFFER_WIDTH 34
|
||||
#define __DRI_ATTRIB_MAX_PBUFFER_HEIGHT 35
|
||||
#define __DRI_ATTRIB_MAX_PBUFFER_PIXELS 36
|
||||
#define __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH 37
|
||||
#define __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT 38
|
||||
#define __DRI_ATTRIB_VISUAL_SELECT_GROUP 39
|
||||
#define __DRI_ATTRIB_SWAP_METHOD 40
|
||||
#define __DRI_ATTRIB_MAX_SWAP_INTERVAL 41
|
||||
#define __DRI_ATTRIB_MIN_SWAP_INTERVAL 42
|
||||
#define __DRI_ATTRIB_BIND_TO_TEXTURE_RGB 43
|
||||
#define __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA 44
|
||||
#define __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE 45
|
||||
#define __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS 46
|
||||
#define __DRI_ATTRIB_YINVERTED 47
|
||||
|
||||
/* __DRI_ATTRIB_RENDER_TYPE */
|
||||
#define __DRI_ATTRIB_RGBA_BIT 0x01
|
||||
#define __DRI_ATTRIB_COLOR_INDEX_BIT 0x02
|
||||
#define __DRI_ATTRIB_LUMINANCE_BIT 0x04
|
||||
|
||||
/* __DRI_ATTRIB_CONFIG_CAVEAT */
|
||||
#define __DRI_ATTRIB_SLOW_BIT 0x01
|
||||
#define __DRI_ATTRIB_NON_CONFORMANT_CONFIG 0x02
|
||||
|
||||
/* __DRI_ATTRIB_TRANSPARENT_TYPE */
|
||||
#define __DRI_ATTRIB_TRANSPARENT_RGB 0x00
|
||||
#define __DRI_ATTRIB_TRANSPARENT_INDEX 0x01
|
||||
|
||||
/* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */
|
||||
#define __DRI_ATTRIB_TEXTURE_1D_BIT 0x01
|
||||
#define __DRI_ATTRIB_TEXTURE_2D_BIT 0x02
|
||||
#define __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT 0x04
|
||||
|
||||
/**
|
||||
* This extension defines the core DRI functionality.
|
||||
*/
|
||||
#define __DRI_CORE "DRI_Core"
|
||||
#define __DRI_CORE_VERSION 1
|
||||
|
||||
struct __DRIcoreExtensionRec {
|
||||
__DRIextension base;
|
||||
|
||||
__DRIscreen *(*createNewScreen)(int screen, int fd,
|
||||
unsigned int sarea_handle,
|
||||
const __DRIextension **extensions,
|
||||
const __DRIconfig ***driverConfigs,
|
||||
void *loaderPrivate);
|
||||
|
||||
void (*destroyScreen)(__DRIscreen *screen);
|
||||
|
||||
const __DRIextension **(*getExtensions)(__DRIscreen *screen);
|
||||
|
||||
int (*getConfigAttrib)(const __DRIconfig *config,
|
||||
unsigned int attrib,
|
||||
unsigned int *value);
|
||||
|
||||
int (*indexConfigAttrib)(const __DRIconfig *config, int index,
|
||||
unsigned int *attrib, unsigned int *value);
|
||||
|
||||
__DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
|
||||
const __DRIconfig *config,
|
||||
unsigned int drawable_id,
|
||||
unsigned int head,
|
||||
void *loaderPrivate);
|
||||
|
||||
void (*destroyDrawable)(__DRIdrawable *drawable);
|
||||
|
||||
void (*swapBuffers)(__DRIdrawable *drawable);
|
||||
|
||||
__DRIcontext *(*createNewContext)(__DRIscreen *screen,
|
||||
const __DRIconfig *config,
|
||||
__DRIcontext *shared,
|
||||
void *loaderPrivate);
|
||||
|
||||
int (*copyContext)(__DRIcontext *dest,
|
||||
__DRIcontext *src,
|
||||
unsigned long mask);
|
||||
|
||||
void (*destroyContext)(__DRIcontext *context);
|
||||
|
||||
int (*bindContext)(__DRIcontext *ctx,
|
||||
__DRIdrawable *pdraw,
|
||||
__DRIdrawable *pread);
|
||||
|
||||
int (*unbindContext)(__DRIcontext *ctx);
|
||||
};
|
||||
|
||||
/**
|
||||
* Stored version of some component (i.e., server-side DRI module, kernel-side
|
||||
@@ -542,6 +133,133 @@ struct __DRIversionRec {
|
||||
int patch; /**< Patch-level. */
|
||||
};
|
||||
|
||||
|
||||
typedef void (*__DRIfuncPtr)(void);
|
||||
|
||||
struct __DRIinterfaceMethodsRec {
|
||||
/**
|
||||
* Get pointer to named function.
|
||||
*/
|
||||
__DRIfuncPtr (*getProcAddress)( const char * proc_name );
|
||||
|
||||
/**
|
||||
* Create a list of \c __GLcontextModes structures.
|
||||
*/
|
||||
__GLcontextModes * (*createContextModes)(unsigned count,
|
||||
size_t minimum_bytes_per_struct);
|
||||
|
||||
/**
|
||||
* Destroy a list of \c __GLcontextModes structures.
|
||||
*
|
||||
* \todo
|
||||
* Determine if the drivers actually need to call this.
|
||||
*/
|
||||
void (*destroyContextModes)( __GLcontextModes * modes );
|
||||
|
||||
/**
|
||||
* Get the \c __DRIscreen for a given display and screen number.
|
||||
*/
|
||||
__DRIscreen *(*getScreen)(__DRInativeDisplay *dpy, int screenNum);
|
||||
|
||||
|
||||
/**
|
||||
* \name Client/server protocol functions.
|
||||
*
|
||||
* These functions implement the DRI client/server protocol for
|
||||
* context and drawable operations. Platforms that do not implement
|
||||
* the wire protocol (e.g., EGL) will implement glorified no-op functions.
|
||||
*/
|
||||
/*@{*/
|
||||
/**
|
||||
* Determine if the specified window ID still exists.
|
||||
*
|
||||
* \note
|
||||
* Implementations may assume that the driver will only pass an ID into
|
||||
* this function that actually corresponds to a window. On
|
||||
* implementations where windows can only be destroyed by the DRI driver
|
||||
* (e.g., EGL), this function is allowed to always return \c GL_TRUE.
|
||||
*/
|
||||
GLboolean (*windowExists)(__DRInativeDisplay *dpy, __DRIid draw);
|
||||
|
||||
/**
|
||||
* Create the server-side portion of the GL context.
|
||||
*/
|
||||
GLboolean (* createContext)( __DRInativeDisplay *dpy, int screenNum,
|
||||
int configID, void * contextID, drm_context_t * hw_context );
|
||||
|
||||
/**
|
||||
* Destroy the server-side portion of the GL context.
|
||||
*/
|
||||
GLboolean (* destroyContext)( __DRInativeDisplay *dpy, int screenNum,
|
||||
__DRIid context );
|
||||
|
||||
/**
|
||||
* Create the server-side portion of the drawable.
|
||||
*/
|
||||
GLboolean (*createDrawable)( __DRInativeDisplay * ndpy, int screen,
|
||||
__DRIid drawable, drm_drawable_t * hHWDrawable );
|
||||
|
||||
/**
|
||||
* Destroy the server-side portion of the drawable.
|
||||
*/
|
||||
GLboolean (*destroyDrawable)( __DRInativeDisplay * ndpy, int screen,
|
||||
__DRIid drawable );
|
||||
|
||||
/**
|
||||
* This function is used to get information about the position, size, and
|
||||
* clip rects of a drawable.
|
||||
*/
|
||||
GLboolean (* getDrawableInfo) ( __DRInativeDisplay *dpy, int scrn,
|
||||
__DRIid draw, unsigned int * index, unsigned int * stamp,
|
||||
int * x, int * y, int * width, int * height,
|
||||
int * numClipRects, drm_clip_rect_t ** pClipRects,
|
||||
int * backX, int * backY,
|
||||
int * numBackClipRects, drm_clip_rect_t ** pBackClipRects );
|
||||
/*@}*/
|
||||
|
||||
|
||||
/**
|
||||
* \name Timing related functions.
|
||||
*/
|
||||
/*@{*/
|
||||
/**
|
||||
* Get the 64-bit unadjusted system time (UST).
|
||||
*/
|
||||
int (*getUST)(int64_t * ust);
|
||||
|
||||
/**
|
||||
* Get the media stream counter (MSC) rate.
|
||||
*
|
||||
* Matching the definition in GLX_OML_sync_control, this function returns
|
||||
* the rate of the "media stream counter". In practical terms, this is
|
||||
* the frame refresh rate of the display.
|
||||
*/
|
||||
GLboolean (*getMSCRate)(__DRInativeDisplay * dpy, __DRIid drawable,
|
||||
int32_t * numerator, int32_t * denominator);
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Reports areas of the given drawable which have been modified by the
|
||||
* driver.
|
||||
*
|
||||
* \param drawable which the drawing was done to.
|
||||
* \param rects rectangles affected, with the drawable origin as the
|
||||
* origin.
|
||||
* \param x X offset of the drawable within the screen (used in the
|
||||
* front_buffer case)
|
||||
* \param y Y offset of the drawable within the screen.
|
||||
* \param front_buffer boolean flag for whether the drawing to the
|
||||
* drawable was actually done directly to the front buffer (instead
|
||||
* of backing storage, for example)
|
||||
*/
|
||||
void (*reportDamage)(__DRInativeDisplay * dpy, int screen,
|
||||
__DRIid drawable,
|
||||
int x, int y,
|
||||
drm_clip_rect_t *rects, int num_rects,
|
||||
int front_buffer);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Framebuffer information record. Used by libGL to communicate information
|
||||
* about the framebuffer to the driver's \c __driCreateNewScreen function.
|
||||
@@ -571,59 +289,229 @@ struct __DRIframebufferRec {
|
||||
|
||||
|
||||
/**
|
||||
* This extension provides alternative screen, drawable and context
|
||||
* constructors for legacy DRI functionality. This is used in
|
||||
* conjunction with the core extension.
|
||||
* Screen dependent methods. This structure is initialized during the
|
||||
* \c __DRIdisplayRec::createScreen call.
|
||||
*/
|
||||
#define __DRI_LEGACY "DRI_Legacy"
|
||||
#define __DRI_LEGACY_VERSION 1
|
||||
struct __DRIscreenRec {
|
||||
/**
|
||||
* Method to destroy the private DRI screen data.
|
||||
*/
|
||||
void (*destroyScreen)(__DRInativeDisplay *dpy, int scrn, void *screenPrivate);
|
||||
|
||||
struct __DRIlegacyExtensionRec {
|
||||
__DRIextension base;
|
||||
/**
|
||||
* Method to create the private DRI drawable data and initialize the
|
||||
* drawable dependent methods.
|
||||
*/
|
||||
void *(*createNewDrawable)(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
|
||||
__DRIid draw, __DRIdrawable *pdraw,
|
||||
int renderType, const int *attrs);
|
||||
|
||||
__DRIscreen *(*createNewScreen)(int screen,
|
||||
const __DRIversion *ddx_version,
|
||||
const __DRIversion *dri_version,
|
||||
const __DRIversion *drm_version,
|
||||
const __DRIframebuffer *frame_buffer,
|
||||
void *pSAREA, int fd,
|
||||
const __DRIextension **extensions,
|
||||
const __DRIconfig ***driver_configs,
|
||||
void *loaderPrivate);
|
||||
/**
|
||||
* Method to return a pointer to the DRI drawable data.
|
||||
*/
|
||||
__DRIdrawable *(*getDrawable)(__DRInativeDisplay *dpy, __DRIid draw,
|
||||
void *drawablePrivate);
|
||||
|
||||
__DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
|
||||
const __DRIconfig *config,
|
||||
drm_drawable_t hwDrawable,
|
||||
int renderType, const int *attrs,
|
||||
void *loaderPrivate);
|
||||
/**
|
||||
* Opaque pointer to private per screen direct rendering data. \c NULL
|
||||
* if direct rendering is not supported on this screen. Never
|
||||
* dereferenced in libGL.
|
||||
*/
|
||||
void *private;
|
||||
|
||||
__DRIcontext *(*createNewContext)(__DRIscreen *screen,
|
||||
const __DRIconfig *config,
|
||||
int render_type,
|
||||
__DRIcontext *shared,
|
||||
drm_context_t hwContext,
|
||||
void *loaderPrivate);
|
||||
/**
|
||||
* Get the number of vertical refreshes since some point in time before
|
||||
* this function was first called (i.e., system start up).
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int (*getMSC)( void *screenPrivate, int64_t *msc );
|
||||
|
||||
/**
|
||||
* Opaque pointer that points back to the containing
|
||||
* \c __GLXscreenConfigs. This data structure is shared with DRI drivers
|
||||
* but \c __GLXscreenConfigs is not. However, they are needed by some GLX
|
||||
* functions called by DRI drivers.
|
||||
*
|
||||
* \since Internal API version 20030813.
|
||||
*/
|
||||
void *screenConfigs;
|
||||
|
||||
/**
|
||||
* Functions associated with MESA_allocate_memory.
|
||||
*
|
||||
* \since Internal API version 20030815.
|
||||
*/
|
||||
/*@{*/
|
||||
void *(*allocateMemory)(__DRInativeDisplay *dpy, int scrn, GLsizei size,
|
||||
GLfloat readfreq, GLfloat writefreq,
|
||||
GLfloat priority);
|
||||
|
||||
void (*freeMemory)(__DRInativeDisplay *dpy, int scrn, GLvoid *pointer);
|
||||
|
||||
GLuint (*memoryOffset)(__DRInativeDisplay *dpy, int scrn, const GLvoid *pointer);
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Method to create the private DRI context data and initialize the
|
||||
* context dependent methods.
|
||||
*
|
||||
* \since Internal API version 20031201.
|
||||
*/
|
||||
void * (*createNewContext)(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
|
||||
int render_type,
|
||||
void *sharedPrivate, __DRIcontext *pctx);
|
||||
|
||||
/**
|
||||
* Method to override base texture image with a driver specific 'offset'.
|
||||
* The depth passed in allows e.g. to ignore the alpha channel of texture
|
||||
* images where the non-alpha components don't occupy a whole texel.
|
||||
*
|
||||
* For GLX_EXT_texture_from_pixmap with AIGLX.
|
||||
*
|
||||
* \since Internal API version 20070121.
|
||||
*/
|
||||
void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
|
||||
unsigned long long offset, GLint depth, GLuint pitch);
|
||||
};
|
||||
|
||||
/**
|
||||
* This extension provides alternative screen, drawable and context
|
||||
* constructors for swrast DRI functionality. This is used in
|
||||
* conjunction with the core extension.
|
||||
* Context dependent methods. This structure is initialized during the
|
||||
* \c __DRIscreenRec::createContext call.
|
||||
*/
|
||||
#define __DRI_SWRAST "DRI_SWRast"
|
||||
#define __DRI_SWRAST_VERSION 1
|
||||
struct __DRIcontextRec {
|
||||
/**
|
||||
* Method to destroy the private DRI context data.
|
||||
*/
|
||||
void (*destroyContext)(__DRInativeDisplay *dpy, int scrn, void *contextPrivate);
|
||||
|
||||
struct __DRIswrastExtensionRec {
|
||||
__DRIextension base;
|
||||
/**
|
||||
* Opaque pointer to private per context direct rendering data.
|
||||
* \c NULL if direct rendering is not supported on the display or
|
||||
* screen used to create this context. Never dereferenced in libGL.
|
||||
*/
|
||||
void *private;
|
||||
|
||||
__DRIscreen *(*createNewScreen)(int screen,
|
||||
const __DRIextension **extensions,
|
||||
const __DRIconfig ***driver_configs,
|
||||
void *loaderPrivate);
|
||||
/**
|
||||
* Pointer to the mode used to create this context.
|
||||
*
|
||||
* \since Internal API version 20040317.
|
||||
*/
|
||||
const __GLcontextModes * mode;
|
||||
|
||||
__DRIdrawable *(*createNewDrawable)(__DRIscreen *screen,
|
||||
const __DRIconfig *config,
|
||||
void *loaderPrivate);
|
||||
/**
|
||||
* Method to bind a DRI drawable to a DRI graphics context.
|
||||
*
|
||||
* \since Internal API version 20050727.
|
||||
*/
|
||||
GLboolean (*bindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw,
|
||||
__DRIid read, __DRIcontext *ctx);
|
||||
|
||||
/**
|
||||
* Method to unbind a DRI drawable from a DRI graphics context.
|
||||
*
|
||||
* \since Internal API version 20050727.
|
||||
*/
|
||||
GLboolean (*unbindContext)(__DRInativeDisplay *dpy, int scrn, __DRIid draw,
|
||||
__DRIid read, __DRIcontext *ctx);
|
||||
};
|
||||
|
||||
/**
|
||||
* Drawable dependent methods. This structure is initialized during the
|
||||
* \c __DRIscreenRec::createDrawable call. \c createDrawable is not called
|
||||
* by libGL at this time. It's currently used via the dri_util.c utility code
|
||||
* instead.
|
||||
*/
|
||||
struct __DRIdrawableRec {
|
||||
/**
|
||||
* Method to destroy the private DRI drawable data.
|
||||
*/
|
||||
void (*destroyDrawable)(__DRInativeDisplay *dpy, void *drawablePrivate);
|
||||
|
||||
/**
|
||||
* Method to swap the front and back buffers.
|
||||
*/
|
||||
void (*swapBuffers)(__DRInativeDisplay *dpy, void *drawablePrivate);
|
||||
|
||||
/**
|
||||
* Opaque pointer to private per drawable direct rendering data.
|
||||
* \c NULL if direct rendering is not supported on the display or
|
||||
* screen used to create this drawable. Never dereferenced in libGL.
|
||||
*/
|
||||
void *private;
|
||||
|
||||
/**
|
||||
* Get the number of completed swap buffers for this drawable.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int (*getSBC)(__DRInativeDisplay *dpy, void *drawablePrivate, int64_t *sbc );
|
||||
|
||||
/**
|
||||
* Wait for the SBC to be greater than or equal target_sbc.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int (*waitForSBC)( __DRInativeDisplay * dpy, void *drawablePriv,
|
||||
int64_t target_sbc,
|
||||
int64_t * msc, int64_t * sbc );
|
||||
|
||||
/**
|
||||
* Wait for the MSC to equal target_msc, or, if that has already passed,
|
||||
* the next time (MSC % divisor) is equal to remainder. If divisor is
|
||||
* zero, the function will return as soon as MSC is greater than or equal
|
||||
* to target_msc.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int (*waitForMSC)( __DRInativeDisplay * dpy, void *drawablePriv,
|
||||
int64_t target_msc, int64_t divisor, int64_t remainder,
|
||||
int64_t * msc, int64_t * sbc );
|
||||
|
||||
/**
|
||||
* Like \c swapBuffers, but does NOT have an implicit \c glFlush. Once
|
||||
* rendering is complete, waits until MSC is equal to target_msc, or
|
||||
* if that has already passed, waits until (MSC % divisor) is equal
|
||||
* to remainder. If divisor is zero, the swap will happen as soon as
|
||||
* MSC is greater than or equal to target_msc.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int64_t (*swapBuffersMSC)(__DRInativeDisplay *dpy, void *drawablePrivate,
|
||||
int64_t target_msc,
|
||||
int64_t divisor, int64_t remainder);
|
||||
|
||||
/**
|
||||
* Enable or disable frame usage tracking.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int (*frameTracking)(__DRInativeDisplay *dpy, void *drawablePrivate, GLboolean enable);
|
||||
|
||||
/**
|
||||
* Retrieve frame usage information.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
int (*queryFrameTracking)(__DRInativeDisplay *dpy, void *drawablePrivate,
|
||||
int64_t * sbc, int64_t * missedFrames,
|
||||
float * lastMissedUsage, float * usage );
|
||||
|
||||
/**
|
||||
* Used by drivers that implement the GLX_SGI_swap_control or
|
||||
* GLX_MESA_swap_control extension.
|
||||
*
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
unsigned swap_interval;
|
||||
|
||||
/**
|
||||
* Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
|
||||
*
|
||||
* \since Internal API version 20060314.
|
||||
*/
|
||||
void (*copySubBuffer)(__DRInativeDisplay *dpy, void *drawablePrivate,
|
||||
int x, int y, int w, int h);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007 Red Hat, Inc
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||
* license, 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 (including the next
|
||||
* paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS 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.
|
||||
*/
|
||||
|
||||
#ifndef DRI_SAREA_H
|
||||
#define DRI_SAREA_H
|
||||
|
||||
#include <drm.h>
|
||||
|
||||
/* The DRI2 SAREA holds a list of self-describing blocks. Each block
|
||||
* is 8 byte aligned and has a common 32-bit header word. The upper
|
||||
* 16 bits describe the type of the block and the lower 16 bits the
|
||||
* size. DRI2 only defines a couple of blocks and allows drivers to
|
||||
* define driver specific blocks using type codes from 0x8000 and up.
|
||||
* The type code 0x0000 defines the end of the sarea. */
|
||||
|
||||
#define DRI2_SAREA_BLOCK_HEADER(type, size) (((type) << 16) | (size))
|
||||
#define DRI2_SAREA_BLOCK_TYPE(b) ((b) >> 16)
|
||||
#define DRI2_SAREA_BLOCK_SIZE(b) ((b) & 0xffff)
|
||||
#define DRI2_SAREA_BLOCK_NEXT(p) \
|
||||
((void *) ((unsigned char *) (p) + \
|
||||
DRI2_SAREA_BLOCK_SIZE(*(unsigned int *) p)))
|
||||
|
||||
#define DRI2_SAREA_BLOCK_END 0x0000
|
||||
#define DRI2_SAREA_BLOCK_LOCK 0x0001
|
||||
#define DRI2_SAREA_BLOCK_EVENT_BUFFER 0x0002
|
||||
|
||||
/* Chipset specific blocks start at 0x8000, 0xffff is reserved. */
|
||||
|
||||
typedef struct __DRILock __DRILock;
|
||||
typedef struct __DRIEventBuffer __DRIEventBuffer;
|
||||
typedef struct __DRIDrawableBuffer __DRIDrawableBuffer;
|
||||
typedef struct __DRIDrawableConfigEvent __DRIDrawableConfigEvent;
|
||||
typedef struct __DRIBufferAttachEvent __DRIBufferAttachEvent;
|
||||
|
||||
struct __DRILock {
|
||||
unsigned int block_header;
|
||||
drm_hw_lock_t lock;
|
||||
|
||||
/* We use this with DRM_CAS to allocate lock IDs for the real lock.*/
|
||||
unsigned int next_id;
|
||||
};
|
||||
|
||||
struct __DRIEventBuffer {
|
||||
unsigned int block_header;
|
||||
unsigned int head; /* last valid event */
|
||||
unsigned int prealloc; /* event currently being written */
|
||||
unsigned int size; /* size of data */
|
||||
unsigned char data[0];
|
||||
};
|
||||
|
||||
enum {
|
||||
/* the four standard color buffers */
|
||||
DRI_DRAWABLE_BUFFER_FRONT_LEFT = 0,
|
||||
DRI_DRAWABLE_BUFFER_BACK_LEFT = 1,
|
||||
DRI_DRAWABLE_BUFFER_FRONT_RIGHT = 2,
|
||||
DRI_DRAWABLE_BUFFER_BACK_RIGHT = 3,
|
||||
/* optional aux buffer */
|
||||
DRI_DRAWABLE_BUFFER_AUX0 = 4,
|
||||
DRI_DRAWABLE_BUFFER_AUX1 = 5,
|
||||
DRI_DRAWABLE_BUFFER_AUX2 = 6,
|
||||
DRI_DRAWABLE_BUFFER_AUX3 = 7,
|
||||
DRI_DRAWABLE_BUFFER_DEPTH = 8,
|
||||
DRI_DRAWABLE_BUFFER_STENCIL = 9,
|
||||
DRI_DRAWABLE_BUFFER_ACCUM = 10,
|
||||
/* generic renderbuffers */
|
||||
DRI_DRAWABLE_BUFFER_COLOR0 = 11,
|
||||
DRI_DRAWABLE_BUFFER_COLOR1 = 12,
|
||||
DRI_DRAWABLE_BUFFER_COLOR2 = 13,
|
||||
DRI_DRAWABLE_BUFFER_COLOR3 = 14,
|
||||
DRI_DRAWABLE_BUFFER_COLOR4 = 15,
|
||||
DRI_DRAWABLE_BUFFER_COLOR5 = 16,
|
||||
DRI_DRAWABLE_BUFFER_COLOR6 = 17,
|
||||
DRI_DRAWABLE_BUFFER_COLOR7 = 18,
|
||||
DRI_DRAWABLE_BUFFER_COUNT = 19
|
||||
};
|
||||
|
||||
struct __DRIDrawableBuffer {
|
||||
unsigned int attachment;
|
||||
unsigned int handle;
|
||||
unsigned int pitch;
|
||||
unsigned short cpp;
|
||||
|
||||
/* Upper 8 bits are driver specific, lower 8 bits generic. The
|
||||
* bits can inidicate buffer properties such as tiled, swizzled etc. */
|
||||
unsigned short flags;
|
||||
};
|
||||
|
||||
#define DRI2_EVENT_HEADER(type, size) (((type) << 16) | (size))
|
||||
#define DRI2_EVENT_TYPE(b) ((b) >> 16)
|
||||
#define DRI2_EVENT_SIZE(b) ((b) & 0xffff)
|
||||
|
||||
#define DRI2_EVENT_PAD 0x0000
|
||||
#define DRI2_EVENT_DRAWABLE_CONFIG 0x0001
|
||||
#define DRI2_EVENT_BUFFER_ATTACH 0x0002
|
||||
|
||||
struct __DRIDrawableConfigEvent {
|
||||
unsigned int event_header;
|
||||
unsigned int drawable;
|
||||
short x;
|
||||
short y;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int num_rects;
|
||||
struct drm_clip_rect rects[0];
|
||||
};
|
||||
|
||||
struct __DRIBufferAttachEvent {
|
||||
unsigned int event_header;
|
||||
unsigned int drawable;
|
||||
__DRIDrawableBuffer buffer;
|
||||
};
|
||||
|
||||
#endif /* DRI_SAREA_H */
|
||||
@@ -41,7 +41,6 @@
|
||||
#define GL_CORE_SGI 1
|
||||
#define GL_CORE_MESA 2
|
||||
#define GL_CORE_APPLE 4
|
||||
#define GL_CORE_WINDOWS 8
|
||||
|
||||
typedef struct __GLcontextRec __GLcontext;
|
||||
|
||||
|
||||
@@ -1,79 +1,79 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Mesa bindings for SciTech MGL
|
||||
*
|
||||
* Copyright (C) 1996 SciTech Software.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Filename: mglmesa.h
|
||||
* Version: Revision: 1.1.1.1
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: Header file for the Mesa/OpenGL interface bindings for the
|
||||
* SciTech MGL graphics library. Uses the MGL internal
|
||||
* device context structures to get direct access to the
|
||||
* high performance MGL rasterization functions for maximum
|
||||
* performance. Utilizes the VESA VBE/AF Accelerator Functions
|
||||
* via the MGL's accelerated device driver functions, as well
|
||||
* as basic DirectDraw accelerated functions provided by the
|
||||
* MGL.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __MGLMESA_H
|
||||
#define __MGLMESA_H
|
||||
|
||||
#include "mgraph.h"
|
||||
|
||||
/*------------------------- Function Prototypes ---------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
#define GLAPIENTRY
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
bool GLAPIENTRY MGLMesaInitDLL(MGLCallbacks *cb,char *version);
|
||||
#endif
|
||||
void GLAPIENTRY MGLMesaChooseVisual(MGLDC *dc,MGLVisual *visual);
|
||||
bool GLAPIENTRY MGLMesaSetVisual(MGLDC *dc,MGLVisual *visual);
|
||||
bool GLAPIENTRY MGLMesaCreateContext(MGLDC *dc,bool forceMemDC);
|
||||
void GLAPIENTRY MGLMesaDestroyContext(MGLDC *dc);
|
||||
void GLAPIENTRY MGLMesaMakeCurrent(MGLDC *dc);
|
||||
void GLAPIENTRY MGLMesaSwapBuffers(MGLDC *dc,bool waitVRT);
|
||||
|
||||
/* Palette manipulation support. The reason we provide palette manipulation
|
||||
* routines is so that when rendering in double buffered modes with a
|
||||
* software backbuffer, the palette for the backbuffer is kept consistent
|
||||
* with the hardware front buffer.
|
||||
*/
|
||||
|
||||
void GLAPIENTRY MGLMesaSetPaletteEntry(MGLDC *dc,int entry,uchar red,uchar green,uchar blue);
|
||||
void GLAPIENTRY MGLMesaSetPalette(MGLDC *dc,palette_t *pal,int numColors,int startIndex);
|
||||
void GLAPIENTRY MGLMesaRealizePalette(MGLDC *dc,int numColors,int startIndex,int waitVRT);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MGLMESA_H */
|
||||
/****************************************************************************
|
||||
*
|
||||
* Mesa bindings for SciTech MGL
|
||||
*
|
||||
* Copyright (C) 1996 SciTech Software.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Filename: mglmesa.h
|
||||
* Version: Revision: 1.1.1.1
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: Header file for the Mesa/OpenGL interface bindings for the
|
||||
* SciTech MGL graphics library. Uses the MGL internal
|
||||
* device context structures to get direct access to the
|
||||
* high performance MGL rasterization functions for maximum
|
||||
* performance. Utilizes the VESA VBE/AF Accelerator Functions
|
||||
* via the MGL's accelerated device driver functions, as well
|
||||
* as basic DirectDraw accelerated functions provided by the
|
||||
* MGL.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __MGLMESA_H
|
||||
#define __MGLMESA_H
|
||||
|
||||
#include "mgraph.h"
|
||||
|
||||
/*------------------------- Function Prototypes ---------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
#define GLAPIENTRY
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
bool GLAPIENTRY MGLMesaInitDLL(MGLCallbacks *cb,char *version);
|
||||
#endif
|
||||
void GLAPIENTRY MGLMesaChooseVisual(MGLDC *dc,MGLVisual *visual);
|
||||
bool GLAPIENTRY MGLMesaSetVisual(MGLDC *dc,MGLVisual *visual);
|
||||
bool GLAPIENTRY MGLMesaCreateContext(MGLDC *dc,bool forceMemDC);
|
||||
void GLAPIENTRY MGLMesaDestroyContext(MGLDC *dc);
|
||||
void GLAPIENTRY MGLMesaMakeCurrent(MGLDC *dc);
|
||||
void GLAPIENTRY MGLMesaSwapBuffers(MGLDC *dc,bool waitVRT);
|
||||
|
||||
/* Palette manipulation support. The reason we provide palette manipulation
|
||||
* routines is so that when rendering in double buffered modes with a
|
||||
* software backbuffer, the palette for the backbuffer is kept consistent
|
||||
* with the hardware front buffer.
|
||||
*/
|
||||
|
||||
void GLAPIENTRY MGLMesaSetPaletteEntry(MGLDC *dc,int entry,uchar red,uchar green,uchar blue);
|
||||
void GLAPIENTRY MGLMesaSetPalette(MGLDC *dc,palette_t *pal,int numColors,int startIndex);
|
||||
void GLAPIENTRY MGLMesaRealizePalette(MGLDC *dc,int numColors,int startIndex,int waitVRT);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MGLMESA_H */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 7.1
|
||||
* Version: 4.1
|
||||
*
|
||||
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -397,25 +397,6 @@ extern XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Texture from Pixmap
|
||||
* New in Mesa 7.1
|
||||
*/
|
||||
extern void
|
||||
XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer,
|
||||
const int *attrib_list);
|
||||
|
||||
extern void
|
||||
XMesaReleaseTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer);
|
||||
|
||||
|
||||
extern XMesaBuffer
|
||||
XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p,
|
||||
XMesaColormap cmap,
|
||||
int format, int target, int mipmap);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -66,7 +66,6 @@ typedef XColor XMesaColor;
|
||||
#define XMesaDrawPoints XDrawPoints
|
||||
#define XMesaDrawLine XDrawLine
|
||||
#define XMesaFillRectangle XFillRectangle
|
||||
#define XMesaGetImage XGetImage
|
||||
#define XMesaPutImage XPutImage
|
||||
#define XMesaCopyArea XCopyArea
|
||||
|
||||
|
||||
@@ -39,19 +39,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#ifndef _XMESA_XF86_H_
|
||||
#define _XMESA_XF86_H_
|
||||
|
||||
#include "GL/glxtokens.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmapstr.h"
|
||||
#include "gcstruct.h"
|
||||
#include "servermd.h"
|
||||
|
||||
|
||||
typedef struct _XMesaImageRec {
|
||||
int width, height;
|
||||
char *data;
|
||||
int bytes_per_line; /* Padded to 32 bits */
|
||||
int bits_per_pixel;
|
||||
} XMesaImage;
|
||||
typedef struct _XMesaImageRec XMesaImage;
|
||||
|
||||
typedef ScreenRec XMesaDisplay;
|
||||
typedef PixmapPtr XMesaPixmap;
|
||||
@@ -128,26 +120,6 @@ do { \
|
||||
(*__gc->ops->PolyFillRect)((DrawablePtr)__b, __gc, 1, __r); \
|
||||
} while (0)
|
||||
|
||||
static _X_INLINE XMesaImage *XMesaGetImage(XMesaDisplay *dpy, PixmapPtr p, int x,
|
||||
int y, unsigned int width,
|
||||
unsigned int height,
|
||||
unsigned long plane_mask, int format)
|
||||
{
|
||||
XMesaImage *img = Xcalloc(sizeof(*img));
|
||||
|
||||
img->width = p->drawable.width;
|
||||
img->height = p->drawable.height;
|
||||
img->bits_per_pixel = p->drawable.bitsPerPixel;
|
||||
img->bytes_per_line = PixmapBytePad(width, p->drawable.depth);
|
||||
img->data = malloc(height * img->bytes_per_line);
|
||||
|
||||
/* Assumes: Images are always in ZPixmap format */
|
||||
(*p->drawable.pScreen->GetImage)(&p->drawable, x, y, width, height,
|
||||
plane_mask, ZPixmap, img->data);
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
#define XMesaPutImage(__d,__b,__gc,__i,__sx,__sy,__x,__y,__w,__h) \
|
||||
do { \
|
||||
/* Assumes: Images are always in ZPixmap format */ \
|
||||
@@ -169,13 +141,8 @@ do { \
|
||||
|
||||
|
||||
/* CreatePixmap returns a PixmapPtr; so, it cannot be inside braces */
|
||||
#ifdef CREATE_PIXMAP_USAGE_SCRATCH
|
||||
#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
|
||||
(*__d->CreatePixmap)(__d, __w, __h, __depth, 0)
|
||||
#else
|
||||
#define XMesaCreatePixmap(__d,__b,__w,__h,__depth) \
|
||||
(*__d->CreatePixmap)(__d, __w, __h, __depth)
|
||||
#endif
|
||||
|
||||
#define XMesaFreePixmap(__d,__b) \
|
||||
(*__d->DestroyPixmap)(__b)
|
||||
|
||||
@@ -25,7 +25,7 @@ subdirs:
|
||||
install:
|
||||
|
||||
clean:
|
||||
-@for dir in $(SUBDIRS) tests ; do \
|
||||
@for dir in $(SUBDIRS) tests ; do \
|
||||
if [ -d $$dir ] ; then \
|
||||
(cd $$dir && $(MAKE) clean) ; \
|
||||
fi \
|
||||
|
||||
@@ -19,8 +19,8 @@ INCLUDES = -I. -I- -I../../include
|
||||
default: demo sample GLInfo
|
||||
|
||||
clean:
|
||||
-rm -f demo sample GLInfo
|
||||
-rm -f *.o
|
||||
rm -f demo sample GLInfo
|
||||
rm -f *.o
|
||||
|
||||
demo: demo.o
|
||||
$(LD) demo.o $(LDFLAGS) $(LIBS) -o $@
|
||||
|
||||
1
progs/demos/.gitignore
vendored
1
progs/demos/.gitignore
vendored
@@ -32,7 +32,6 @@ osdemo
|
||||
paltex
|
||||
pixeltex
|
||||
pointblast
|
||||
rain
|
||||
ray
|
||||
readpix
|
||||
readtex.c
|
||||
|
||||
@@ -11,11 +11,9 @@ OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa16 -lGLU -lGL $(APP_LIB_DEPS)
|
||||
|
||||
OSMESA32_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa32 -lGLU -lGL $(APP_LIB_DEPS)
|
||||
|
||||
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \
|
||||
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
|
||||
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
|
||||
|
||||
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \
|
||||
$(APP_LIB_DEPS)
|
||||
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
|
||||
|
||||
PROGS = \
|
||||
arbfplight \
|
||||
@@ -23,7 +21,6 @@ PROGS = \
|
||||
arbocclude \
|
||||
bounce \
|
||||
clearspd \
|
||||
copypix \
|
||||
cubemap \
|
||||
drawpix \
|
||||
engine \
|
||||
@@ -47,7 +44,6 @@ PROGS = \
|
||||
multiarb \
|
||||
paltex \
|
||||
pointblast \
|
||||
rain \
|
||||
ray \
|
||||
readpix \
|
||||
reflect \
|
||||
@@ -76,7 +72,7 @@ PROGS = \
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c
|
||||
.SUFFIXES: .cxx
|
||||
|
||||
|
||||
# make executable from .c file:
|
||||
.c: $(LIB_DEP) readtex.o
|
||||
@@ -157,18 +153,6 @@ fslight: fslight.o
|
||||
fslight.o: fslight.c extfuncs.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) fslight.c
|
||||
|
||||
rain: particles.o rain.o readtex.o
|
||||
$(CXX) $(LDFLAGS) $^ $(LIBS) -o $@
|
||||
|
||||
rain.o: rain.cxx readtex.h
|
||||
$(CXX) -c -I$(INCDIR) $(CXXFLAGS) $<
|
||||
|
||||
particles.o: particles.cxx
|
||||
$(CXX) -c -I$(INCDIR) $(CXXFLAGS) $<
|
||||
|
||||
|
||||
viewdds: viewdds.c
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $< readtex.o $(LIBS) -L. -lgltc -o $@
|
||||
|
||||
|
||||
clean:
|
||||
|
||||
@@ -1,248 +0,0 @@
|
||||
/**
|
||||
* glCopyPixels test
|
||||
*
|
||||
* Brian Paul
|
||||
* 14 Sep 2007
|
||||
*/
|
||||
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "readtex.h"
|
||||
|
||||
#define IMAGE_FILE "../images/arch.rgb"
|
||||
|
||||
static int ImgWidth, ImgHeight;
|
||||
static GLenum ImgFormat;
|
||||
static GLubyte *Image = NULL;
|
||||
|
||||
static int WinWidth = 800, WinHeight = 800;
|
||||
static int Xpos, Ypos;
|
||||
static int Scissor = 0;
|
||||
static float Xzoom, Yzoom;
|
||||
static GLboolean DrawFront = GL_FALSE;
|
||||
static GLboolean Dither = GL_TRUE;
|
||||
|
||||
|
||||
static void Reset( void )
|
||||
{
|
||||
Xpos = Ypos = 20;
|
||||
Scissor = 0;
|
||||
Xzoom = Yzoom = 1.0;
|
||||
}
|
||||
|
||||
|
||||
static void Display( void )
|
||||
{
|
||||
const int dx = (WinWidth - ImgWidth) / 2;
|
||||
const int dy = (WinHeight - ImgHeight) / 2;
|
||||
|
||||
if (DrawFront) {
|
||||
glDrawBuffer(GL_FRONT);
|
||||
glReadBuffer(GL_FRONT);
|
||||
}
|
||||
else {
|
||||
glDrawBuffer(GL_BACK);
|
||||
glReadBuffer(GL_BACK);
|
||||
}
|
||||
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
/* draw original image */
|
||||
glWindowPos2iARB(dx, dy);
|
||||
glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
|
||||
|
||||
if (Scissor)
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
/* draw copy */
|
||||
glPixelZoom(Xzoom, Yzoom);
|
||||
glWindowPos2iARB(Xpos, Ypos);
|
||||
glCopyPixels(dx, dy, ImgWidth, ImgHeight, GL_COLOR);
|
||||
glPixelZoom(1, 1);
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
if (DrawFront)
|
||||
glFinish();
|
||||
else
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
WinWidth = width;
|
||||
WinHeight = height;
|
||||
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glOrtho( 0.0, width, 0.0, height, 0.0, 2.0 );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
glScissor(width/4, height/4, width/2, height/2);
|
||||
}
|
||||
|
||||
|
||||
static void Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case ' ':
|
||||
Reset();
|
||||
break;
|
||||
case 'd':
|
||||
Dither = !Dither;
|
||||
if (Dither)
|
||||
glEnable(GL_DITHER);
|
||||
else
|
||||
glDisable(GL_DITHER);
|
||||
break;
|
||||
case 's':
|
||||
Scissor = !Scissor;
|
||||
break;
|
||||
case 'x':
|
||||
Xzoom -= 0.1;
|
||||
break;
|
||||
case 'X':
|
||||
Xzoom += 0.1;
|
||||
break;
|
||||
case 'y':
|
||||
Yzoom -= 0.1;
|
||||
break;
|
||||
case 'Y':
|
||||
Yzoom += 0.1;
|
||||
break;
|
||||
case 'f':
|
||||
DrawFront = !DrawFront;
|
||||
printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK");
|
||||
break;
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void SpecialKey( int key, int x, int y )
|
||||
{
|
||||
const int step = (glutGetModifiers() & GLUT_ACTIVE_SHIFT) ? 10 : 1;
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case GLUT_KEY_UP:
|
||||
Ypos += step;
|
||||
break;
|
||||
case GLUT_KEY_DOWN:
|
||||
Ypos -= step;
|
||||
break;
|
||||
case GLUT_KEY_LEFT:
|
||||
Xpos -= step;
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
Xpos += step;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void Init( GLboolean ciMode, const char *filename )
|
||||
{
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
||||
Image = LoadRGBImage( filename, &ImgWidth, &ImgHeight, &ImgFormat );
|
||||
if (!Image) {
|
||||
printf("Couldn't read %s\n", filename);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (ciMode) {
|
||||
/* Convert RGB image to grayscale */
|
||||
GLubyte *indexImage = (GLubyte *) malloc( ImgWidth * ImgHeight );
|
||||
GLint i;
|
||||
for (i=0; i<ImgWidth*ImgHeight; i++) {
|
||||
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];
|
||||
indexImage[i] = gray / 3;
|
||||
}
|
||||
free(Image);
|
||||
Image = indexImage;
|
||||
ImgFormat = GL_COLOR_INDEX;
|
||||
|
||||
for (i=0;i<255;i++) {
|
||||
float g = i / 255.0;
|
||||
glutSetColor(i, g, g, g);
|
||||
}
|
||||
}
|
||||
|
||||
printf("Loaded %d by %d image\n", ImgWidth, ImgHeight );
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth);
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
|
||||
static void Usage(void)
|
||||
{
|
||||
printf("Keys:\n");
|
||||
printf(" SPACE Reset Parameters\n");
|
||||
printf(" Up/Down Move image up/down (SHIFT for large step)\n");
|
||||
printf(" Left/Right Move image left/right (SHIFT for large step)\n");
|
||||
printf(" x Decrease X-axis PixelZoom\n");
|
||||
printf(" X Increase X-axis PixelZoom\n");
|
||||
printf(" y Decrease Y-axis PixelZoom\n");
|
||||
printf(" Y Increase Y-axis PixelZoom\n");
|
||||
printf(" s Toggle GL_SCISSOR_TEST\n");
|
||||
printf(" f Toggle front/back buffer drawing\n");
|
||||
printf(" ESC Exit\n");
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
GLboolean ciMode = GL_FALSE;
|
||||
const char *filename = IMAGE_FILE;
|
||||
int i = 1;
|
||||
|
||||
if (argc > i && strcmp(argv[i], "-ci")==0) {
|
||||
ciMode = GL_TRUE;
|
||||
i++;
|
||||
}
|
||||
if (argc > i) {
|
||||
filename = argv[i];
|
||||
}
|
||||
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( WinWidth, WinHeight );
|
||||
|
||||
if (ciMode)
|
||||
glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE );
|
||||
else
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
|
||||
|
||||
glutCreateWindow(argv[0]);
|
||||
|
||||
Init(ciMode, filename);
|
||||
Usage();
|
||||
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutSpecialFunc( SpecialKey );
|
||||
glutDisplayFunc( Display );
|
||||
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -47,8 +47,6 @@ static GLfloat Xrot = 0, Yrot = 0;
|
||||
static GLfloat EyeDist = 10;
|
||||
static GLboolean use_vertex_arrays = GL_FALSE;
|
||||
static GLboolean anim = GL_TRUE;
|
||||
static GLboolean NoClear = GL_FALSE;
|
||||
static GLint FrameParity = 0;
|
||||
|
||||
#define eps1 0.99
|
||||
#define br 20.0 /* box radius */
|
||||
@@ -158,30 +156,7 @@ static void draw_skybox( void )
|
||||
|
||||
static void draw( void )
|
||||
{
|
||||
if (NoClear) {
|
||||
/* This demonstrates how we can avoid calling glClear.
|
||||
* This method only works if every pixel in the window is painted for
|
||||
* every frame.
|
||||
* We can simply skip clearing of the color buffer in this case.
|
||||
* For the depth buffer, we alternately use a different subrange of
|
||||
* the depth buffer for each frame. For the odd frame use the range
|
||||
* [0, 0.5] with GL_LESS. For the even frames, use the range [1, 0.5]
|
||||
* with GL_GREATER.
|
||||
*/
|
||||
FrameParity = 1 - FrameParity;
|
||||
if (FrameParity) {
|
||||
glDepthRange(0.0, 0.5);
|
||||
glDepthFunc(GL_LESS);
|
||||
}
|
||||
else {
|
||||
glDepthRange(1.0, 0.5);
|
||||
glDepthFunc(GL_GREATER);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* ordinary clearing */
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix(); /*MODELVIEW*/
|
||||
glTranslatef( 0.0, 0.0, -EyeDist );
|
||||
@@ -477,24 +452,6 @@ static void usage(void)
|
||||
}
|
||||
|
||||
|
||||
static void parse_args(int argc, char *argv[])
|
||||
{
|
||||
int initFlag = 0;
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-i") == 0)
|
||||
initFlag = 1;
|
||||
else if (strcmp(argv[i], "--noclear") == 0)
|
||||
NoClear = GL_TRUE;
|
||||
else {
|
||||
fprintf(stderr, "Bad option: %s\n", argv[i]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
init (initFlag);
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
@@ -502,13 +459,17 @@ int main( int argc, char *argv[] )
|
||||
glutInitWindowSize(600, 500);
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
|
||||
glutCreateWindow("Texture Cube Mapping");
|
||||
|
||||
if (argc > 1 && strcmp(argv[1] , "-i") == 0)
|
||||
init( 1 );
|
||||
else
|
||||
init( 0 );
|
||||
glutReshapeFunc( reshape );
|
||||
glutKeyboardFunc( key );
|
||||
glutSpecialFunc( specialkey );
|
||||
glutDisplayFunc( draw );
|
||||
if (anim)
|
||||
glutIdleFunc(idle);
|
||||
parse_args(argc, argv);
|
||||
usage();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Makefile for GLUT-based demo programs for VMS
|
||||
# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl
|
||||
# Last update : 30 November 2007
|
||||
# contributed by Jouk Jansen joukj@hrem.stm.tudelft.nl
|
||||
# Last update : 20 May 2005
|
||||
|
||||
.first
|
||||
define gl [--.include.gl]
|
||||
@@ -21,10 +21,10 @@ LIB_DEP = [--.lib]$(GL_LIB) [--.lib]$(GLU_LIB) [--.lib]$(GLUT_LIB)
|
||||
.endif
|
||||
|
||||
|
||||
PROGS = bounce.exe,clearspd.exe,drawpix.exe,gamma.exe,gears.exe,\
|
||||
glinfo.exe,glutfx.exe,isosurf.exe,morph3d.exe,\
|
||||
paltex.exe,pointblast.exe,reflect.exe,spectex.exe,stex3d.exe,\
|
||||
tessdemo.exe,texcyl.exe,texobj.exe,trispd.exe,winpos.exe
|
||||
PROGS = bounce.exe;,clearspd.exe;,drawpix.exe;,gamma.exe;,gears.exe;,\
|
||||
glinfo.exe;,glutfx.exe;,isosurf.exe;,morph3d.exe;,\
|
||||
paltex.exe;,pointblast.exe;,reflect.exe;,spectex.exe;,stex3d.exe;,\
|
||||
tessdemo.exe;,texcyl.exe;,texobj.exe;,trispd.exe;,winpos.exe;
|
||||
|
||||
|
||||
##### RULES #####
|
||||
@@ -39,33 +39,33 @@ clean :
|
||||
delete *.obj;*
|
||||
|
||||
realclean :
|
||||
delete *.exe;*
|
||||
delete $(PROGS)
|
||||
delete *.obj;*
|
||||
|
||||
bounce.exe : bounce.obj $(LIB_DEP)
|
||||
clearspd.exe : clearspd.obj $(LIB_DEP)
|
||||
drawpix.exe : drawpix.obj $(LIB_DEP) [-.util]readtex.obj
|
||||
bounce.exe; : bounce.obj $(LIB_DEP)
|
||||
clearspd.exe; : clearspd.obj $(LIB_DEP)
|
||||
drawpix.exe; : drawpix.obj $(LIB_DEP) [-.util]readtex.obj
|
||||
cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS)
|
||||
gamma.exe : gamma.obj $(LIB_DEP)
|
||||
gears.exe : gears.obj $(LIB_DEP)
|
||||
glinfo.exe : glinfo.obj $(LIB_DEP)
|
||||
glutfx.exe : glutfx.obj $(LIB_DEP)
|
||||
isosurf.exe : isosurf.obj $(LIB_DEP) [-.util]readtex.obj
|
||||
gamma.exe; : gamma.obj $(LIB_DEP)
|
||||
gears.exe; : gears.obj $(LIB_DEP)
|
||||
glinfo.exe; : glinfo.obj $(LIB_DEP)
|
||||
glutfx.exe; : glutfx.obj $(LIB_DEP)
|
||||
isosurf.exe; : isosurf.obj $(LIB_DEP) [-.util]readtex.obj
|
||||
cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS)
|
||||
morph3d.exe : morph3d.obj $(LIB_DEP)
|
||||
paltex.exe : paltex.obj $(LIB_DEP)
|
||||
pointblast.exe : pointblast.obj $(LIB_DEP)
|
||||
reflect.exe : reflect.obj [-.util]readtex.obj [-.util]showbuffer.obj\
|
||||
morph3d.exe; : morph3d.obj $(LIB_DEP)
|
||||
paltex.exe; : paltex.obj $(LIB_DEP)
|
||||
pointblast.exe; : pointblast.obj $(LIB_DEP)
|
||||
reflect.exe; : reflect.obj [-.util]readtex.obj [-.util]showbuffer.obj\
|
||||
$(LIB_DEP)
|
||||
cxxlink $(MMS$TARGET_NAME),[-.util]readtex,showbuffer,$(GL_LIBS)
|
||||
spectex.exe : spectex.obj $(LIB_DEP)
|
||||
stex3d.exe : stex3d.obj $(LIB_DEP)
|
||||
tessdemo.exe : tessdemo.obj $(LIB_DEP)
|
||||
texcyl.exe : texcyl.obj [-.util]readtex.obj $(LIB_DEP)
|
||||
spectex.exe; : spectex.obj $(LIB_DEP)
|
||||
stex3d.exe; : stex3d.obj $(LIB_DEP)
|
||||
tessdemo.exe; : tessdemo.obj $(LIB_DEP)
|
||||
texcyl.exe; : texcyl.obj [-.util]readtex.obj $(LIB_DEP)
|
||||
cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS)
|
||||
texobj.exe : texobj.obj $(LIB_DEP)
|
||||
trispd.exe : trispd.obj $(LIB_DEP)
|
||||
winpos.exe : winpos.obj [-.util]readtex.obj $(LIB_DEP)
|
||||
texobj.exe; : texobj.obj $(LIB_DEP)
|
||||
trispd.exe; : trispd.obj $(LIB_DEP)
|
||||
winpos.exe; : winpos.obj [-.util]readtex.obj $(LIB_DEP)
|
||||
cxxlink $(MMS$TARGET_NAME),[-.util]readtex.obj,$(GL_LIBS)
|
||||
|
||||
|
||||
|
||||
@@ -445,8 +445,8 @@ DrawConnector(float length, float thickness,
|
||||
for (i = 0; i <= 36; i++) {
|
||||
const int j = i % 36;
|
||||
glNormal3f(normals[j][0], normals[j][1], 0);
|
||||
glVertex3f(points[j][0], points[j][1], z1);
|
||||
glVertex3f(points[j][0], points[j][1], z0);
|
||||
glVertex3f(points[j][0], points[j][1], z1);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
@@ -745,7 +745,7 @@ DrawEngine(const Engine *eng, float crankAngle)
|
||||
glTranslatef(0, 0, -0.5 * crankLen);
|
||||
|
||||
/* crankshaft */
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, CrankshaftColor);
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, CrankshaftColor);
|
||||
glColor4fv(CrankshaftColor);
|
||||
DrawPositionedCrankshaft(eng, crankAngle);
|
||||
|
||||
@@ -764,12 +764,12 @@ DrawEngine(const Engine *eng, float crankAngle)
|
||||
rot += k * eng->V_Angle;
|
||||
|
||||
/* piston */
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, PistonColor);
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, PistonColor);
|
||||
glColor4fv(PistonColor);
|
||||
DrawPositionedPiston(eng, rot);
|
||||
|
||||
/* connecting rod */
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, ConnRodColor);
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, ConnRodColor);
|
||||
glColor4fv(ConnRodColor);
|
||||
DrawPositionedConnectingRod(eng, rot);
|
||||
glPopMatrix();
|
||||
@@ -784,7 +784,7 @@ DrawEngine(const Engine *eng, float crankAngle)
|
||||
}
|
||||
glEnable(GL_CULL_FACE);
|
||||
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, BlockColor);
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, BlockColor);
|
||||
glColor4fv(BlockColor);
|
||||
if (eng->CrankList)
|
||||
glCallList(eng->BlockList);
|
||||
@@ -1254,7 +1254,6 @@ Init(void)
|
||||
{
|
||||
const GLfloat lightColor[4] = { 0.7, 0.7, 0.7, 1.0 };
|
||||
const GLfloat specular[4] = { 0.8, 0.8, 0.8, 1.0 };
|
||||
const GLfloat backColor[4] = { 1, 1, 0, 0 };
|
||||
|
||||
Q = gluNewQuadric();
|
||||
gluQuadricNormals(Q, GLU_SMOOTH);
|
||||
@@ -1266,14 +1265,10 @@ Init(void)
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor);
|
||||
glMaterialf(GL_FRONT, GL_SHININESS, 40);
|
||||
glMaterialfv(GL_FRONT, GL_SPECULAR, specular);
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 40);
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular);
|
||||
glEnable(GL_NORMALIZE);
|
||||
|
||||
glMaterialfv(GL_BACK, GL_DIFFUSE, backColor);
|
||||
#if 0
|
||||
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1);
|
||||
#endif
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
InitViewInfo(&View);
|
||||
|
||||
@@ -27,9 +27,6 @@ static GLint T0 = 0;
|
||||
static GLint Frames = 0;
|
||||
static GLint autoexit = 0;
|
||||
static GLint win = 0;
|
||||
static GLboolean Visible = GL_TRUE;
|
||||
static GLboolean Animate = GL_TRUE;
|
||||
static GLfloat viewDist = 40.0;
|
||||
|
||||
|
||||
/**
|
||||
@@ -182,9 +179,6 @@ draw(void)
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
glTranslatef(0.0, 0.0, -viewDist);
|
||||
|
||||
glRotatef(view_rotx, 1.0, 0.0, 0.0);
|
||||
glRotatef(view_roty, 0.0, 1.0, 0.0);
|
||||
glRotatef(view_rotz, 0.0, 0.0, 1.0);
|
||||
@@ -246,15 +240,6 @@ idle(void)
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
static void
|
||||
update_idle_func(void)
|
||||
{
|
||||
if (Visible && Animate)
|
||||
glutIdleFunc(idle);
|
||||
else
|
||||
glutIdleFunc(NULL);
|
||||
}
|
||||
|
||||
/* change view angle, exit upon ESC */
|
||||
/* ARGSUSED1 */
|
||||
static void
|
||||
@@ -267,16 +252,6 @@ key(unsigned char k, int x, int y)
|
||||
case 'Z':
|
||||
view_rotz -= 5.0;
|
||||
break;
|
||||
case 'd':
|
||||
viewDist += 1.0;
|
||||
break;
|
||||
case 'D':
|
||||
viewDist -= 1.0;
|
||||
break;
|
||||
case 'a':
|
||||
Animate = !Animate;
|
||||
update_idle_func();
|
||||
break;
|
||||
case 27: /* Escape */
|
||||
cleanup();
|
||||
exit(0);
|
||||
@@ -320,8 +295,10 @@ reshape(int width, int height)
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-1.0, 1.0, -h, h, 5.0, 200.0);
|
||||
glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -40.0);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -374,12 +351,13 @@ init(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
visible(int vis)
|
||||
{
|
||||
Visible = vis;
|
||||
update_idle_func();
|
||||
if (vis == GLUT_VISIBLE)
|
||||
glutIdleFunc(idle);
|
||||
else
|
||||
glutIdleFunc(NULL);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@@ -397,7 +375,6 @@ int main(int argc, char *argv[])
|
||||
glutKeyboardFunc(key);
|
||||
glutSpecialFunc(special);
|
||||
glutVisibilityFunc(visible);
|
||||
update_idle_func();
|
||||
|
||||
glutMainLoop();
|
||||
return 0; /* ANSI C requires main to return int. */
|
||||
|
||||
@@ -1,119 +1,119 @@
|
||||
BACKGROUND = 0.000 0.500 0.700
|
||||
|
||||
ANAME = AXLE1
|
||||
ARADIUS = 1.000
|
||||
AAXIS = 2
|
||||
APOSITION = -7.000 0.000 0.000
|
||||
ACOLOR = 0.800 0.500 0.200
|
||||
ALENGTH = 6.000
|
||||
AMOTORED = 1
|
||||
AANGULARVELOCITY = 90.000
|
||||
ADIRECTION = 1
|
||||
|
||||
ANAME = AXLE2
|
||||
ARADIUS = 1.000
|
||||
AAXIS = 2
|
||||
APOSITION = -3.000 0.000 0.000
|
||||
ACOLOR = 0.800 0.500 0.200
|
||||
ALENGTH = 12.000
|
||||
AMOTORED = 0
|
||||
|
||||
ANAME = AXLE3
|
||||
ARADIUS = 1.000
|
||||
AAXIS = 2
|
||||
APOSITION = 1.000 0.000 0.000
|
||||
ACOLOR = 0.800 0.500 0.200
|
||||
ALENGTH = 6.000
|
||||
AMOTORED = 0
|
||||
|
||||
ANAME = AXLE4
|
||||
ARADIUS = 1.000
|
||||
AAXIS = 2
|
||||
APOSITION = 8.000 0.000 0.000
|
||||
ACOLOR = 0.800 0.500 0.200
|
||||
ALENGTH = 18.000
|
||||
AMOTORED = 0
|
||||
|
||||
ANAME = AXLE5
|
||||
ARADIUS = 1.000
|
||||
AAXIS = 1
|
||||
APOSITION = 8.000 -8.200 -7.400
|
||||
ACOLOR = 0.800 0.500 0.200
|
||||
ALENGTH = 12.000
|
||||
AMOTORED = 0
|
||||
|
||||
GNAME = GEAR1
|
||||
GTYPE = NORMAL
|
||||
GRADIUS = 2.200
|
||||
GWIDTH = 3.000
|
||||
GTEETH = 40
|
||||
GTOOTHDEPTH = 0.500
|
||||
GCOLOR = 0.500 0.500 0.500
|
||||
GAXLE = AXLE1
|
||||
GPOSITION = 0.000
|
||||
|
||||
GNAME = GEAR2
|
||||
GTYPE = NORMAL
|
||||
GRADIUS = 2.200
|
||||
GWIDTH = 3.000
|
||||
GTEETH = 30
|
||||
GTOOTHDEPTH = 0.500
|
||||
GCOLOR = 0.500 0.500 0.500
|
||||
GAXLE = AXLE2
|
||||
GPOSITION = 0.000
|
||||
|
||||
GNAME = GEAR3
|
||||
GTYPE = NORMAL
|
||||
GRADIUS = 2.200
|
||||
GWIDTH = 3.000
|
||||
GTEETH = 20
|
||||
GTOOTHDEPTH = 0.500
|
||||
GCOLOR = 0.500 0.500 0.500
|
||||
GAXLE = AXLE3
|
||||
GPOSITION = 0.000
|
||||
|
||||
GNAME = GEAR4
|
||||
GTYPE = NORMAL
|
||||
GRADIUS = 1.700
|
||||
GWIDTH = 1.000
|
||||
GTEETH = 20
|
||||
GTOOTHDEPTH = 0.500
|
||||
GCOLOR = 0.500 0.500 0.500
|
||||
GAXLE = AXLE2
|
||||
GPOSITION = 5.000
|
||||
|
||||
GNAME = GEAR5
|
||||
GTYPE = NORMAL
|
||||
GRADIUS = 3.000
|
||||
GWIDTH = 1.000
|
||||
GTEETH = 20
|
||||
GTOOTHDEPTH = 0.500
|
||||
GCOLOR = 0.500 0.500 0.500
|
||||
GAXLE = AXLE4
|
||||
GPOSITION = 5.000
|
||||
|
||||
GNAME = GEAR6
|
||||
GTYPE = BEVEL
|
||||
GFACE = 0
|
||||
GRADIUS = 4.000
|
||||
GWIDTH = 1.000
|
||||
GTEETH = 20
|
||||
GTOOTHDEPTH = 1.700
|
||||
GCOLOR = 0.500 0.500 0.500
|
||||
GAXLE = AXLE4
|
||||
GPOSITION = -4.000
|
||||
|
||||
GNAME = GEAR7
|
||||
GTYPE = BEVEL
|
||||
GFACE = 0
|
||||
GRADIUS = 4.000
|
||||
GWIDTH = 1.000
|
||||
GTEETH = 20
|
||||
GTOOTHDEPTH = 1.700
|
||||
GCOLOR = 0.500 0.500 0.500
|
||||
GAXLE = AXLE5
|
||||
GPOSITION = 5.000
|
||||
|
||||
BELTNAME = BELT1
|
||||
GEAR1NAME = GEAR5
|
||||
GEAR2NAME = GEAR4
|
||||
BACKGROUND = 0.000 0.500 0.700
|
||||
|
||||
ANAME = AXLE1
|
||||
ARADIUS = 1.000
|
||||
AAXIS = 2
|
||||
APOSITION = -7.000 0.000 0.000
|
||||
ACOLOR = 0.800 0.500 0.200
|
||||
ALENGTH = 6.000
|
||||
AMOTORED = 1
|
||||
AANGULARVELOCITY = 90.000
|
||||
ADIRECTION = 1
|
||||
|
||||
ANAME = AXLE2
|
||||
ARADIUS = 1.000
|
||||
AAXIS = 2
|
||||
APOSITION = -3.000 0.000 0.000
|
||||
ACOLOR = 0.800 0.500 0.200
|
||||
ALENGTH = 12.000
|
||||
AMOTORED = 0
|
||||
|
||||
ANAME = AXLE3
|
||||
ARADIUS = 1.000
|
||||
AAXIS = 2
|
||||
APOSITION = 1.000 0.000 0.000
|
||||
ACOLOR = 0.800 0.500 0.200
|
||||
ALENGTH = 6.000
|
||||
AMOTORED = 0
|
||||
|
||||
ANAME = AXLE4
|
||||
ARADIUS = 1.000
|
||||
AAXIS = 2
|
||||
APOSITION = 8.000 0.000 0.000
|
||||
ACOLOR = 0.800 0.500 0.200
|
||||
ALENGTH = 18.000
|
||||
AMOTORED = 0
|
||||
|
||||
ANAME = AXLE5
|
||||
ARADIUS = 1.000
|
||||
AAXIS = 1
|
||||
APOSITION = 8.000 -8.200 -7.400
|
||||
ACOLOR = 0.800 0.500 0.200
|
||||
ALENGTH = 12.000
|
||||
AMOTORED = 0
|
||||
|
||||
GNAME = GEAR1
|
||||
GTYPE = NORMAL
|
||||
GRADIUS = 2.200
|
||||
GWIDTH = 3.000
|
||||
GTEETH = 40
|
||||
GTOOTHDEPTH = 0.500
|
||||
GCOLOR = 0.500 0.500 0.500
|
||||
GAXLE = AXLE1
|
||||
GPOSITION = 0.000
|
||||
|
||||
GNAME = GEAR2
|
||||
GTYPE = NORMAL
|
||||
GRADIUS = 2.200
|
||||
GWIDTH = 3.000
|
||||
GTEETH = 30
|
||||
GTOOTHDEPTH = 0.500
|
||||
GCOLOR = 0.500 0.500 0.500
|
||||
GAXLE = AXLE2
|
||||
GPOSITION = 0.000
|
||||
|
||||
GNAME = GEAR3
|
||||
GTYPE = NORMAL
|
||||
GRADIUS = 2.200
|
||||
GWIDTH = 3.000
|
||||
GTEETH = 20
|
||||
GTOOTHDEPTH = 0.500
|
||||
GCOLOR = 0.500 0.500 0.500
|
||||
GAXLE = AXLE3
|
||||
GPOSITION = 0.000
|
||||
|
||||
GNAME = GEAR4
|
||||
GTYPE = NORMAL
|
||||
GRADIUS = 1.700
|
||||
GWIDTH = 1.000
|
||||
GTEETH = 20
|
||||
GTOOTHDEPTH = 0.500
|
||||
GCOLOR = 0.500 0.500 0.500
|
||||
GAXLE = AXLE2
|
||||
GPOSITION = 5.000
|
||||
|
||||
GNAME = GEAR5
|
||||
GTYPE = NORMAL
|
||||
GRADIUS = 3.000
|
||||
GWIDTH = 1.000
|
||||
GTEETH = 20
|
||||
GTOOTHDEPTH = 0.500
|
||||
GCOLOR = 0.500 0.500 0.500
|
||||
GAXLE = AXLE4
|
||||
GPOSITION = 5.000
|
||||
|
||||
GNAME = GEAR6
|
||||
GTYPE = BEVEL
|
||||
GFACE = 0
|
||||
GRADIUS = 4.000
|
||||
GWIDTH = 1.000
|
||||
GTEETH = 20
|
||||
GTOOTHDEPTH = 1.700
|
||||
GCOLOR = 0.500 0.500 0.500
|
||||
GAXLE = AXLE4
|
||||
GPOSITION = -4.000
|
||||
|
||||
GNAME = GEAR7
|
||||
GTYPE = BEVEL
|
||||
GFACE = 0
|
||||
GRADIUS = 4.000
|
||||
GWIDTH = 1.000
|
||||
GTEETH = 20
|
||||
GTOOTHDEPTH = 1.700
|
||||
GCOLOR = 0.500 0.500 0.500
|
||||
GAXLE = AXLE5
|
||||
GPOSITION = 5.000
|
||||
|
||||
BELTNAME = BELT1
|
||||
GEAR1NAME = GEAR5
|
||||
GEAR2NAME = GEAR4
|
||||
|
||||
0
progs/demos/glslnoise.c
Normal file → Executable file
0
progs/demos/glslnoise.c
Normal file → Executable file
@@ -159,18 +159,6 @@ static void Key( unsigned char key, int x, int y )
|
||||
case 'B':
|
||||
Bias += 10;
|
||||
break;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
Bias = 100.0 * (key - '0');
|
||||
break;
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
/*
|
||||
* GL_ARB_multitexture demo
|
||||
*
|
||||
@@ -31,6 +32,7 @@ static GLint NumUnits = 1;
|
||||
static GLboolean TexEnabled[8];
|
||||
|
||||
static GLfloat Drift = 0.0;
|
||||
static GLfloat drift_increment = 0.005;
|
||||
static GLfloat Xrot = 20.0, Yrot = 30.0, Zrot = 0.0;
|
||||
|
||||
|
||||
@@ -39,7 +41,9 @@ static void Idle( void )
|
||||
if (Animate) {
|
||||
GLint i;
|
||||
|
||||
Drift = glutGet(GLUT_ELAPSED_TIME) * 0.001;
|
||||
Drift += drift_increment;
|
||||
if (Drift >= 1.0)
|
||||
Drift = 0.0;
|
||||
|
||||
for (i = 0; i < NumUnits; i++) {
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
@@ -53,11 +57,10 @@ static void Idle( void )
|
||||
glTranslatef(0.0, Drift, 0.0);
|
||||
}
|
||||
else {
|
||||
float tx = 0.5, ty = 0.5;
|
||||
glTranslatef(tx, ty, 0.0);
|
||||
glTranslatef(0.5, 0.5, 0.0);
|
||||
glRotatef(180.0 * Drift, 0, 0, 1);
|
||||
glScalef(1.0/i, 1.0/i, 1.0/i);
|
||||
glTranslatef(-tx, -ty + i * 0.1, 0.0);
|
||||
glTranslatef(-0.5, -0.5, 0.0);
|
||||
}
|
||||
}
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
@@ -69,9 +72,10 @@ static void Idle( void )
|
||||
|
||||
static void DrawObject(void)
|
||||
{
|
||||
static const GLfloat tex_coords[] = { 0.0, 0.0, 1.0, 1.0, 0.0 };
|
||||
static const GLfloat vtx_coords[] = { -1.0, -1.0, 1.0, 1.0, -1.0 };
|
||||
GLint i, j;
|
||||
GLint i;
|
||||
GLint j;
|
||||
static const GLfloat tex_coords[] = { 0.0, 0.0, 1.0, 1.0, 0.0 };
|
||||
static const GLfloat vtx_coords[] = { -1.0, -1.0, 1.0, 1.0, -1.0 };
|
||||
|
||||
if (!TexEnabled[0] && !TexEnabled[1])
|
||||
glColor3f(0.1, 0.1, 0.1); /* add onto this */
|
||||
@@ -79,20 +83,37 @@ static void DrawObject(void)
|
||||
glColor3f(1, 1, 1); /* modulate this */
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
for (j = 0; j < 4; j++ ) {
|
||||
for (i = 0; i < NumUnits; i++) {
|
||||
if (TexEnabled[i])
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i,
|
||||
tex_coords[j], tex_coords[j+1]);
|
||||
|
||||
/* Toggle between the vector and scalar entry points. This is done purely
|
||||
* to hit multiple paths in the driver.
|
||||
*/
|
||||
if ( Drift > 0.49 ) {
|
||||
for (j = 0; j < 4; j++ ) {
|
||||
for (i = 0; i < NumUnits; i++)
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB + i,
|
||||
tex_coords[j], tex_coords[j+1]);
|
||||
glVertex2f( vtx_coords[j], vtx_coords[j+1] );
|
||||
}
|
||||
glVertex2f( vtx_coords[j], vtx_coords[j+1] );
|
||||
}
|
||||
else {
|
||||
for (j = 0; j < 4; j++ ) {
|
||||
for (i = 0; i < NumUnits; i++)
|
||||
glMultiTexCoord2fvARB(GL_TEXTURE0_ARB + i, & tex_coords[j]);
|
||||
glVertex2fv( & vtx_coords[j] );
|
||||
}
|
||||
}
|
||||
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void Display( void )
|
||||
{
|
||||
static GLint T0 = 0;
|
||||
static GLint Frames = 0;
|
||||
GLint t;
|
||||
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
glPushMatrix();
|
||||
@@ -104,6 +125,16 @@ static void Display( void )
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
|
||||
Frames++;
|
||||
|
||||
t = glutGet(GLUT_ELAPSED_TIME);
|
||||
if (t - T0 >= 250) {
|
||||
GLfloat seconds = (t - T0) / 1000.0;
|
||||
drift_increment = 2.2 * seconds / Frames;
|
||||
T0 = t;
|
||||
Frames = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,34 +151,24 @@ static void Reshape( int width, int height )
|
||||
}
|
||||
|
||||
|
||||
static void ToggleUnit(int unit)
|
||||
{
|
||||
TexEnabled[unit] = !TexEnabled[unit];
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + unit);
|
||||
if (TexEnabled[unit])
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
else
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
printf("Enabled: ");
|
||||
for (unit = 0; unit < NumUnits; unit++)
|
||||
printf("%d ", (int) TexEnabled[unit]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
static void ModeMenu(int entry)
|
||||
{
|
||||
if (entry >= TEX0 && entry <= TEX7) {
|
||||
/* toggle */
|
||||
GLint i = entry - TEX0;
|
||||
ToggleUnit(i);
|
||||
TexEnabled[i] = !TexEnabled[i];
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + i);
|
||||
if (TexEnabled[i])
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
else
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
printf("Enabled: ");
|
||||
for (i = 0; i < NumUnits; i++)
|
||||
printf("%d ", (int) TexEnabled[i]);
|
||||
printf("\n");
|
||||
}
|
||||
else if (entry==ANIMATE) {
|
||||
Animate = !Animate;
|
||||
if (Animate)
|
||||
glutIdleFunc(Idle);
|
||||
else
|
||||
glutIdleFunc(NULL);
|
||||
}
|
||||
else if (entry==QUIT) {
|
||||
exit(0);
|
||||
@@ -162,36 +183,9 @@ static void Key( unsigned char key, int x, int y )
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 'a':
|
||||
Animate = !Animate;
|
||||
break;
|
||||
case '0':
|
||||
ToggleUnit(0);
|
||||
break;
|
||||
case '1':
|
||||
ToggleUnit(1);
|
||||
break;
|
||||
case '2':
|
||||
ToggleUnit(2);
|
||||
break;
|
||||
case '3':
|
||||
ToggleUnit(3);
|
||||
break;
|
||||
case '4':
|
||||
ToggleUnit(4);
|
||||
break;
|
||||
case '5':
|
||||
ToggleUnit(5);
|
||||
break;
|
||||
case '6':
|
||||
ToggleUnit(6);
|
||||
break;
|
||||
case '7':
|
||||
ToggleUnit(7);
|
||||
break;
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
@@ -333,8 +327,7 @@ int main( int argc, char *argv[] )
|
||||
glutKeyboardFunc( Key );
|
||||
glutSpecialFunc( SpecialKey );
|
||||
glutDisplayFunc( Display );
|
||||
if (Animate)
|
||||
glutIdleFunc(Idle);
|
||||
glutIdleFunc( Idle );
|
||||
|
||||
glutCreateMenu(ModeMenu);
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
* Added GL_EXT_packed_depth_stencil support on 15 March 2006.
|
||||
* Added GL_EXT_framebuffer_object support on 27 March 2006.
|
||||
* Removed old SGIX extension support on 5 April 2006.
|
||||
* Added vertex / fragment program support on 7 June 2007 (Ian Romanick).
|
||||
*
|
||||
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
|
||||
*
|
||||
@@ -35,7 +34,6 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <GL/glut.h>
|
||||
#include "showbuffer.h"
|
||||
@@ -69,28 +67,8 @@ static GLboolean NeedNewShadowMap = GL_FALSE;
|
||||
static GLuint ShadowTexture, GrayTexture;
|
||||
static GLuint ShadowFBO;
|
||||
|
||||
static GLfloat lightModelview[16];
|
||||
static GLfloat lightProjection[16];
|
||||
|
||||
static GLuint vert_prog;
|
||||
static GLuint frag_progs[3];
|
||||
static GLuint curr_frag = 0;
|
||||
static GLuint max_frag = 1;
|
||||
|
||||
#define NUM_FRAG_MODES 3
|
||||
static const char *FragProgNames[] = {
|
||||
"fixed-function",
|
||||
"program without \"OPTION ARB_fragment_program_shadow\"",
|
||||
"program with \"OPTION ARB_fragment_program_shadow\"",
|
||||
};
|
||||
|
||||
static GLboolean HaveShadow = GL_FALSE;
|
||||
static GLboolean HaveFBO = GL_FALSE;
|
||||
static GLboolean UseFBO = GL_FALSE;
|
||||
static GLboolean HaveVP = GL_FALSE;
|
||||
static GLboolean HaveFP = GL_FALSE;
|
||||
static GLboolean HaveFP_Shadow = GL_FALSE;
|
||||
static GLboolean UseVP = GL_FALSE;
|
||||
static GLboolean HavePackedDepthStencil = GL_FALSE;
|
||||
static GLboolean UsePackedDepthStencil = GL_FALSE;
|
||||
static GLboolean HaveEXTshadowFuncs = GL_FALSE;
|
||||
@@ -113,103 +91,6 @@ static GLuint DisplayMode;
|
||||
|
||||
|
||||
|
||||
#define MAT4_MUL(dest_vec, src_mat, src_vec) \
|
||||
"DP4 " dest_vec ".x, " src_mat "[0], " src_vec ";\n" \
|
||||
"DP4 " dest_vec ".y, " src_mat "[1], " src_vec ";\n" \
|
||||
"DP4 " dest_vec ".z, " src_mat "[2], " src_vec ";\n" \
|
||||
"DP4 " dest_vec ".w, " src_mat "[3], " src_vec ";\n"
|
||||
|
||||
#define MAT3_MUL(dest_vec, src_mat, src_vec) \
|
||||
"DP3 " dest_vec ".x, " src_mat "[0], " src_vec ";\n" \
|
||||
"DP3 " dest_vec ".y, " src_mat "[1], " src_vec ";\n" \
|
||||
"DP3 " dest_vec ".z, " src_mat "[2], " src_vec ";\n"
|
||||
|
||||
#define NORMALIZE(dest, src) \
|
||||
"DP3 " dest ".w, " src ", " src ";\n" \
|
||||
"RSQ " dest ".w, " dest ".w;\n" \
|
||||
"MUL " dest ", " src ", " dest ".w;\n"
|
||||
|
||||
/**
|
||||
* Vertex program for shadow mapping.
|
||||
*/
|
||||
static const char vert_code[] =
|
||||
"!!ARBvp1.0\n"
|
||||
"ATTRIB iPos = vertex.position;\n"
|
||||
"ATTRIB iNorm = vertex.normal;\n"
|
||||
|
||||
"PARAM mvinv[4] = { state.matrix.modelview.invtrans };\n"
|
||||
"PARAM mvp[4] = { state.matrix.mvp };\n"
|
||||
"PARAM mv[4] = { state.matrix.modelview };\n"
|
||||
"PARAM texmat[4] = { state.matrix.texture[0] };\n"
|
||||
"PARAM lightPos = state.light[0].position;\n"
|
||||
"PARAM ambientCol = state.lightprod[0].ambient;\n"
|
||||
"PARAM diffuseCol = state.lightprod[0].diffuse;\n"
|
||||
|
||||
"TEMP n, lightVec;\n"
|
||||
"ALIAS V = lightVec;\n"
|
||||
"ALIAS NdotL = n;\n"
|
||||
|
||||
"OUTPUT oPos = result.position;\n"
|
||||
"OUTPUT oColor = result.color;\n"
|
||||
"OUTPUT oTex = result.texcoord[0];\n"
|
||||
|
||||
/* Transform the vertex to clip coordinates. */
|
||||
MAT4_MUL("oPos", "mvp", "iPos")
|
||||
|
||||
/* Transform the vertex to eye coordinates. */
|
||||
MAT4_MUL("V", "mv", "iPos")
|
||||
|
||||
/* Transform the vertex to projected light coordinates. */
|
||||
MAT4_MUL("oTex", "texmat", "iPos")
|
||||
|
||||
/* Transform the normal to eye coordinates. */
|
||||
MAT3_MUL("n", "mvinv", "iNorm")
|
||||
|
||||
/* Calculate the vector from the vertex to the light in eye
|
||||
* coordinates.
|
||||
*/
|
||||
"SUB lightVec, lightPos, V;\n"
|
||||
NORMALIZE("lightVec", "lightVec")
|
||||
|
||||
/* Compute diffuse lighting coefficient.
|
||||
*/
|
||||
"DP3 NdotL.x, n, lightVec;\n"
|
||||
"MAX NdotL.x, NdotL.x, {0.0};\n"
|
||||
"MIN NdotL.x, NdotL.x, {1.0};\n"
|
||||
|
||||
/* Accumulate color contributions.
|
||||
*/
|
||||
"MOV oColor, diffuseCol;\n"
|
||||
"MAD oColor.xyz, NdotL.x, diffuseCol, ambientCol;\n"
|
||||
"END\n"
|
||||
;
|
||||
|
||||
static const char frag_code[] =
|
||||
"!!ARBfp1.0\n"
|
||||
|
||||
"TEMP shadow, temp;\n"
|
||||
|
||||
"TXP shadow, fragment.texcoord[0], texture[0], 2D;\n"
|
||||
"RCP temp.x, fragment.texcoord[0].w;\n"
|
||||
"MUL temp.x, temp.x, fragment.texcoord[0].z;\n"
|
||||
"SGE shadow, shadow.x, temp.x;\n"
|
||||
"MUL result.color.rgb, fragment.color, shadow.x;\n"
|
||||
"MOV result.color.a, fragment.color;\n"
|
||||
"END\n"
|
||||
;
|
||||
|
||||
static const char frag_shadow_code[] =
|
||||
"!!ARBfp1.0\n"
|
||||
"OPTION ARB_fragment_program_shadow;\n"
|
||||
|
||||
"TEMP shadow;\n"
|
||||
|
||||
"TXP shadow, fragment.texcoord[0], texture[0], SHADOW2D;\n"
|
||||
"MUL result.color.rgb, fragment.color, shadow.x;\n"
|
||||
"MOV result.color.a, fragment.color.a;\n"
|
||||
"END\n"
|
||||
;
|
||||
|
||||
static void
|
||||
DrawScene(void)
|
||||
{
|
||||
@@ -253,56 +134,27 @@ DrawScene(void)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate modelview and project matrices for the light
|
||||
*
|
||||
* Stores the results in \c lightProjection (projection matrix) and
|
||||
* \c lightModelview (modelview matrix).
|
||||
/*
|
||||
* Load the GL_TEXTURE matrix with the projection from the light
|
||||
* source's point of view.
|
||||
*/
|
||||
static void
|
||||
MakeShadowMatrix(const GLfloat lightPos[4], const GLfloat spotDir[3],
|
||||
GLfloat spotAngle, GLfloat shadowNear, GLfloat shadowFar)
|
||||
{
|
||||
/* compute frustum to enclose spot light cone */
|
||||
const GLfloat d = shadowNear * tan(spotAngle);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
GLfloat d;
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.5, 0.5, 0.5 + Bias);
|
||||
glScalef(0.5, 0.5, 0.5);
|
||||
d = shadowNear * tan(spotAngle);
|
||||
glFrustum(-d, d, -d, d, shadowNear, shadowFar);
|
||||
glGetFloatv(GL_PROJECTION_MATRIX, lightProjection);
|
||||
glPopMatrix();
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
gluLookAt(lightPos[0], lightPos[1], lightPos[2],
|
||||
lightPos[0] + spotDir[0],
|
||||
lightPos[1] + spotDir[1],
|
||||
lightPos[2] + spotDir[2],
|
||||
0.0, 1.0, 0.0);
|
||||
glGetFloatv(GL_MODELVIEW_MATRIX, lightModelview);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load \c GL_TEXTURE matrix with light's MVP matrix.
|
||||
*/
|
||||
static void SetShadowTextureMatrix(void)
|
||||
{
|
||||
static const GLfloat biasMatrix[16] = {
|
||||
0.5, 0.0, 0.0, 0.0,
|
||||
0.0, 0.5, 0.0, 0.0,
|
||||
0.0, 0.0, 0.5, 0.0,
|
||||
0.5, 0.5, 0.5, 1.0,
|
||||
};
|
||||
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadMatrixf(biasMatrix);
|
||||
glTranslatef(0.0, 0.0, Bias);
|
||||
glMultMatrixf(lightProjection);
|
||||
glMultMatrixf(lightModelview);
|
||||
0, 1, 0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
@@ -406,6 +258,7 @@ RenderShadowMap(void)
|
||||
{
|
||||
GLenum depthFormat; /* GL_DEPTH_COMPONENT or GL_DEPTH_STENCIL_EXT */
|
||||
GLenum depthType; /* GL_UNSIGNED_INT_24_8_EXT or GL_UNSIGNED_INT */
|
||||
float d;
|
||||
|
||||
if (WindowWidth >= 1024 && WindowHeight >= 1024) {
|
||||
ShadowTexWidth = ShadowTexHeight = 1024;
|
||||
@@ -430,11 +283,17 @@ RenderShadowMap(void)
|
||||
depthType = GL_UNSIGNED_INT;
|
||||
}
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadMatrixf(lightProjection);
|
||||
/* compute frustum to enclose spot light cone */
|
||||
d = ShadowNear * tan(SpotAngle);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-d, d, -d, d, ShadowNear, ShadowFar);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadMatrixf(lightModelview);
|
||||
glLoadIdentity();
|
||||
gluLookAt(LightPos[0], LightPos[1], LightPos[2], /* from */
|
||||
0, 0, 0, /* target */
|
||||
0, 1, 0); /* up */
|
||||
|
||||
if (UseFBO) {
|
||||
GLenum fbo_status;
|
||||
@@ -530,11 +389,10 @@ ShowShadowMap(void)
|
||||
DisableTexgen();
|
||||
|
||||
/* interpret texture's depth values as luminance values */
|
||||
if (HaveShadow) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
|
||||
}
|
||||
|
||||
#if defined(GL_ARB_shadow)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_LUMINANCE);
|
||||
#endif
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
@@ -562,7 +420,6 @@ Display(void)
|
||||
LightPos, SpotDir);
|
||||
|
||||
if (NeedNewShadowMap) {
|
||||
MakeShadowMatrix(LightPos, SpotDir, SpotAngle, ShadowNear, ShadowFar);
|
||||
RenderShadowMap();
|
||||
NeedNewShadowMap = GL_FALSE;
|
||||
}
|
||||
@@ -600,13 +457,12 @@ Display(void)
|
||||
}
|
||||
|
||||
if (DisplayMode == SHOW_DEPTH_MAPPING) {
|
||||
if (HaveShadow) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
|
||||
}
|
||||
#if defined(GL_ARB_shadow)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE);
|
||||
#endif
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
SetShadowTextureMatrix();
|
||||
MakeShadowMatrix(LightPos, SpotDir, SpotAngle, ShadowNear, ShadowFar);
|
||||
EnableIdentityTexgen();
|
||||
}
|
||||
else if (DisplayMode == SHOW_DISTANCE) {
|
||||
@@ -620,44 +476,19 @@ Display(void)
|
||||
}
|
||||
else {
|
||||
assert(DisplayMode == SHOW_SHADOWS);
|
||||
if (HaveShadow) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB,
|
||||
GL_COMPARE_R_TO_TEXTURE_ARB);
|
||||
}
|
||||
|
||||
if (curr_frag > 0) {
|
||||
glEnable(GL_FRAGMENT_PROGRAM_ARB);
|
||||
}
|
||||
else {
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
}
|
||||
#if defined(GL_ARB_shadow)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB,
|
||||
GL_COMPARE_R_TO_TEXTURE_ARB);
|
||||
#endif
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
SetShadowTextureMatrix();
|
||||
|
||||
if (UseVP) {
|
||||
glEnable(GL_VERTEX_PROGRAM_ARB);
|
||||
}
|
||||
else {
|
||||
glEnable(GL_LIGHTING);
|
||||
EnableIdentityTexgen();
|
||||
}
|
||||
MakeShadowMatrix(LightPos, SpotDir, SpotAngle, ShadowNear, ShadowFar);
|
||||
EnableIdentityTexgen();
|
||||
}
|
||||
|
||||
DrawScene();
|
||||
|
||||
if (UseVP) {
|
||||
glDisable(GL_VERTEX_PROGRAM_ARB);
|
||||
}
|
||||
else {
|
||||
DisableTexgen();
|
||||
glDisable(GL_LIGHTING);
|
||||
}
|
||||
|
||||
if (curr_frag > 0) {
|
||||
glDisable(GL_FRAGMENT_PROGRAM_ARB);
|
||||
}
|
||||
|
||||
DisableTexgen();
|
||||
glDisable(GL_TEXTURE_1D);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
@@ -730,18 +561,6 @@ Key(unsigned char key, int x, int y)
|
||||
case 'm':
|
||||
DisplayMode = SHOW_DEPTH_MAPPING;
|
||||
break;
|
||||
case 'M':
|
||||
curr_frag = (1 + curr_frag) % max_frag;
|
||||
if (!HaveShadow && (curr_frag == 0)) {
|
||||
curr_frag = 1;
|
||||
}
|
||||
|
||||
printf("Using fragment %s\n", FragProgNames[curr_frag]);
|
||||
|
||||
if (HaveFP) {
|
||||
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, frag_progs[curr_frag]);
|
||||
}
|
||||
break;
|
||||
case 'n':
|
||||
case 's':
|
||||
case ' ':
|
||||
@@ -753,10 +572,10 @@ Key(unsigned char key, int x, int y)
|
||||
if (Operator >= 8)
|
||||
Operator = 0;
|
||||
printf("Operator: %s\n", OperatorName[Operator]);
|
||||
if (HaveShadow) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB,
|
||||
OperatorFunc[Operator]);
|
||||
}
|
||||
#if defined(GL_ARB_shadow)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB,
|
||||
OperatorFunc[Operator]);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
@@ -773,11 +592,6 @@ Key(unsigned char key, int x, int y)
|
||||
NeedNewShadowMap = GL_TRUE;
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
UseVP = !UseVP && HaveVP;
|
||||
printf("Using vertex %s mode.\n",
|
||||
UseVP ? "program" : "fixed-function");
|
||||
break;
|
||||
case 'z':
|
||||
Zrot -= step;
|
||||
break;
|
||||
@@ -832,76 +646,28 @@ SpecialKey(int key, int x, int y)
|
||||
}
|
||||
|
||||
|
||||
/* A helper for finding errors in program strings */
|
||||
static int FindLine( const char *program, int position )
|
||||
{
|
||||
int i, line = 1;
|
||||
for (i = 0; i < position; i++) {
|
||||
if (program[i] == '\n')
|
||||
line++;
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
static GLuint
|
||||
compile_program(GLenum target, const char *code)
|
||||
{
|
||||
GLuint p;
|
||||
GLint errorPos;
|
||||
|
||||
|
||||
glGenProgramsARB(1, & p);
|
||||
|
||||
glBindProgramARB(target, p);
|
||||
glProgramStringARB(target, GL_PROGRAM_FORMAT_ASCII_ARB,
|
||||
strlen(code), code);
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
|
||||
if (glGetError() != GL_NO_ERROR || errorPos != -1) {
|
||||
int l = FindLine(code, errorPos);
|
||||
printf("Fragment Program Error (pos=%d line=%d): %s\n", errorPos, l,
|
||||
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
glBindProgramARB(target, 0);
|
||||
return p;
|
||||
}
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
static const GLfloat borderColor[4] = {1.0, 0.0, 0.0, 0.0};
|
||||
|
||||
if (!glutExtensionSupported("GL_ARB_depth_texture")) {
|
||||
printf("Sorry, this demo requires the GL_ARB_depth_texture extension\n");
|
||||
#if defined(GL_ARB_depth_texture) && defined(GL_ARB_shadow)
|
||||
if (!glutExtensionSupported("GL_ARB_depth_texture") ||
|
||||
!glutExtensionSupported("GL_ARB_shadow")) {
|
||||
#else
|
||||
if (1) {
|
||||
#endif
|
||||
printf("Sorry, this demo requires the GL_ARB_depth_texture and GL_ARB_shadow extensions\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("Using GL_ARB_depth_texture and GL_ARB_shadow\n");
|
||||
|
||||
HaveShadow = glutExtensionSupported("GL_ARB_shadow");
|
||||
HaveVP = glutExtensionSupported("GL_ARB_vertex_program");
|
||||
HaveFP = glutExtensionSupported("GL_ARB_fragment_program");
|
||||
HaveFP_Shadow = glutExtensionSupported("GL_ARB_fragment_program_shadow");
|
||||
|
||||
if (!HaveShadow && !HaveFP) {
|
||||
printf("Sorry, this demo requires either the GL_ARB_shadow extension "
|
||||
"or the GL_ARB_fragment_program extension\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("Using GL_ARB_depth_texture\n");
|
||||
if (HaveShadow) {
|
||||
printf("and GL_ARB_shadow\n");
|
||||
}
|
||||
|
||||
if (HaveFP) {
|
||||
printf("and GL_ARB_fragment_program\n");
|
||||
}
|
||||
|
||||
#if defined(GL_ARB_shadow_ambient)
|
||||
HaveShadowAmbient = glutExtensionSupported("GL_ARB_shadow_ambient");
|
||||
if (HaveShadowAmbient) {
|
||||
printf("and GL_ARB_shadow_ambient\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
HaveEXTshadowFuncs = glutExtensionSupported("GL_EXT_shadow_funcs");
|
||||
|
||||
@@ -924,15 +690,15 @@ Init(void)
|
||||
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||
|
||||
if (HaveShadow) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB,
|
||||
GL_COMPARE_R_TO_TEXTURE_ARB);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);
|
||||
}
|
||||
|
||||
#if defined(GL_ARB_shadow)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB,
|
||||
GL_COMPARE_R_TO_TEXTURE_ARB);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);
|
||||
#endif
|
||||
if (HaveShadowAmbient) {
|
||||
#if defined(GL_ARB_shadow_ambient)
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FAIL_VALUE_ARB, 0.3);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(GL_EXT_framebuffer_object)
|
||||
@@ -967,30 +733,6 @@ Init(void)
|
||||
256, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, image);
|
||||
}
|
||||
|
||||
if (HaveVP) {
|
||||
vert_prog = compile_program(GL_VERTEX_PROGRAM_ARB, vert_code);
|
||||
glBindProgramARB(GL_VERTEX_PROGRAM_ARB, vert_prog);
|
||||
}
|
||||
|
||||
max_frag = 1;
|
||||
frag_progs[0] = 0;
|
||||
|
||||
if (HaveFP) {
|
||||
frag_progs[1] = compile_program(GL_FRAGMENT_PROGRAM_ARB, frag_code);
|
||||
max_frag = 2;
|
||||
}
|
||||
|
||||
if (HaveFP && HaveFP_Shadow) {
|
||||
frag_progs[2] = compile_program(GL_FRAGMENT_PROGRAM_ARB,
|
||||
frag_shadow_code);
|
||||
max_frag = 3;
|
||||
}
|
||||
|
||||
if (!HaveShadow) {
|
||||
curr_frag = 1;
|
||||
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, frag_progs[curr_frag]);
|
||||
}
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
@@ -1009,8 +751,6 @@ PrintHelp(void)
|
||||
printf(" f = toggle nearest/bilinear texture filtering\n");
|
||||
printf(" b/B = decrease/increase shadow map Z bias\n");
|
||||
printf(" p = toggle use of packed depth/stencil\n");
|
||||
printf(" M = cycle through fragment program modes\n");
|
||||
printf(" v = toggle vertex program modes\n");
|
||||
printf(" cursor keys = rotate scene\n");
|
||||
printf(" <shift> + cursor keys = rotate light source\n");
|
||||
if (HaveEXTshadowFuncs)
|
||||
|
||||
@@ -333,13 +333,13 @@ menu(int option)
|
||||
smooth = 0;
|
||||
break;
|
||||
case 10:
|
||||
glPointSize(16.0);
|
||||
glPointSize(4.0);
|
||||
break;
|
||||
case 11:
|
||||
glPointSize(32.0);
|
||||
glPointSize(8.0);
|
||||
break;
|
||||
case 12:
|
||||
glPointSize(64.0);
|
||||
glPointSize(16.0);
|
||||
break;
|
||||
case 13:
|
||||
spin = 1 - spin;
|
||||
@@ -411,19 +411,19 @@ key(unsigned char c, int x, int y)
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case '1':
|
||||
glPointSize(16.0);
|
||||
glPointSize(2.0);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case '2':
|
||||
glPointSize(32.0);
|
||||
glPointSize(4.0);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case '3':
|
||||
glPointSize(64.0);
|
||||
glPointSize(8.0);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case '4':
|
||||
glPointSize(128.0);
|
||||
glPointSize(16.0);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 27:
|
||||
@@ -526,9 +526,9 @@ main(int argc, char **argv)
|
||||
glutAddMenuEntry("Threshold 10", 7);
|
||||
glutAddMenuEntry("Point smooth on", 8);
|
||||
glutAddMenuEntry("Point smooth off", 9);
|
||||
glutAddMenuEntry("Point size 16", 10);
|
||||
glutAddMenuEntry("Point size 32", 11);
|
||||
glutAddMenuEntry("Point size 64", 12);
|
||||
glutAddMenuEntry("Point size 4", 10);
|
||||
glutAddMenuEntry("Point size 8", 11);
|
||||
glutAddMenuEntry("Point size 16", 12);
|
||||
glutAddMenuEntry("Toggle spin", 13);
|
||||
glutAddMenuEntry("200 points ", 14);
|
||||
glutAddMenuEntry("500 points ", 15);
|
||||
@@ -544,7 +544,7 @@ main(int argc, char **argv)
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glPointSize(32.0);
|
||||
glPointSize(16.0);
|
||||
#ifdef GL_ARB_point_parameters
|
||||
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
|
||||
#endif
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
|
||||
/*
|
||||
* GL_ARB_pixel_buffer_object test
|
||||
* GL_ARB_multitexture demo
|
||||
*
|
||||
* Command line options:
|
||||
* -w WIDTH -h HEIGHT sets window size
|
||||
* -info print GL implementation information
|
||||
*
|
||||
*
|
||||
* Brian Paul November 1998 This program is in the public domain.
|
||||
* Modified on 12 Feb 2002 for > 2 texture units.
|
||||
*/
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
@@ -21,8 +25,6 @@
|
||||
#define PBO 11
|
||||
#define QUIT 100
|
||||
|
||||
static GLuint DrawPBO;
|
||||
|
||||
static GLboolean Animate = GL_TRUE;
|
||||
static GLboolean use_pbo = 1;
|
||||
static GLboolean whole_rect = 1;
|
||||
@@ -47,7 +49,7 @@ static void Idle( void )
|
||||
}
|
||||
}
|
||||
|
||||
/*static int max( int a, int b ) { return a > b ? a : b; }*/
|
||||
static int max( int a, int b ) { return a > b ? a : b; }
|
||||
static int min( int a, int b ) { return a < b ? a : b; }
|
||||
|
||||
static void DrawObject()
|
||||
@@ -60,7 +62,6 @@ static void DrawObject()
|
||||
* release the old copy of the texture and allocate a new one
|
||||
* without waiting for outstanding rendering to complete.
|
||||
*/
|
||||
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO);
|
||||
glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_EXT, size, NULL, GL_STREAM_DRAW_ARB);
|
||||
|
||||
{
|
||||
@@ -68,7 +69,7 @@ static void DrawObject()
|
||||
|
||||
printf("char %d\n", (unsigned char)(Drift * 255));
|
||||
|
||||
memset(image, (unsigned char)(Drift * 255), size);
|
||||
memset(image, size, (unsigned char)(Drift * 255));
|
||||
|
||||
glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT);
|
||||
}
|
||||
@@ -85,9 +86,7 @@ static void DrawObject()
|
||||
if (image == NULL)
|
||||
image = malloc(size);
|
||||
|
||||
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0);
|
||||
|
||||
memset(image, (unsigned char)(Drift * 255), size);
|
||||
memset(image, size, (unsigned char)(Drift * 255));
|
||||
|
||||
/* BGRA should be the fast path for regular uploads as well.
|
||||
*/
|
||||
@@ -228,12 +227,12 @@ static void SpecialKey( int key, int x, int y )
|
||||
static void Init( int argc, char *argv[] )
|
||||
{
|
||||
const char *exten = (const char *) glGetString(GL_EXTENSIONS);
|
||||
GLuint texObj;
|
||||
GLuint texObj, DrawPBO;
|
||||
GLint size;
|
||||
|
||||
|
||||
if (!strstr(exten, "GL_ARB_pixel_buffer_object")) {
|
||||
printf("Sorry, GL_ARB_pixel_buffer_object not supported by this renderer.\n");
|
||||
if (!strstr(exten, "GL_ARB_multitexture")) {
|
||||
printf("Sorry, GL_ARB_multitexture not supported by this renderer.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,6 @@ eglgears.o: eglgears.c $(HEADERS)
|
||||
|
||||
|
||||
clean:
|
||||
-rm -f *.o *~
|
||||
-rm -f *.so
|
||||
-rm -f $(PROGRAMS)
|
||||
rm -f *.o *~
|
||||
rm -f *.so
|
||||
rm -f $(PROGRAMS)
|
||||
|
||||
@@ -37,8 +37,8 @@ LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
|
||||
default: depend $(PROGS)
|
||||
|
||||
clean:
|
||||
-rm -f $(PROGS)
|
||||
-rm -f *.o
|
||||
rm -f $(PROGS)
|
||||
rm -f *.o
|
||||
|
||||
|
||||
depend: $(SOURCES)
|
||||
|
||||
@@ -23,21 +23,11 @@
|
||||
#include <GL/glfbdev.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
/**
|
||||
* Choose one of these modes
|
||||
*/
|
||||
/*static const int XRes = 1280, YRes = 1024, Hz = 75;*/
|
||||
/*static const int XRes = 1280, YRes = 1024, Hz = 70;*/
|
||||
/*static const int XRes = 1280, YRes = 1024, Hz = 60;*/
|
||||
static const int XRes = 1024, YRes = 768, Hz = 70;
|
||||
|
||||
static int DesiredDepth = 32;
|
||||
|
||||
static int NumFrames = 100;
|
||||
#define DEFAULT_DEPTH 8
|
||||
|
||||
static struct fb_fix_screeninfo FixedInfo;
|
||||
static struct fb_var_screeninfo VarInfo, OrigVarInfo;
|
||||
static int DesiredDepth = 0;
|
||||
static int OriginalVT = -1;
|
||||
static int ConsoleFD = -1;
|
||||
static int FrameBufferFD = -1;
|
||||
@@ -237,6 +227,7 @@ initialize_fbdev( void )
|
||||
VarInfo = OrigVarInfo;
|
||||
|
||||
/* set the depth, resolution, etc */
|
||||
DesiredDepth = 32;
|
||||
if (DesiredDepth)
|
||||
VarInfo.bits_per_pixel = DesiredDepth;
|
||||
|
||||
@@ -260,60 +251,16 @@ initialize_fbdev( void )
|
||||
VarInfo.blue.length = 8;
|
||||
VarInfo.transp.length = 8;
|
||||
}
|
||||
|
||||
/* timing values taken from /etc/fb.modes */
|
||||
if (XRes == 1280 && YRes == 1024) {
|
||||
VarInfo.xres_virtual = VarInfo.xres = XRes;
|
||||
VarInfo.yres_virtual = VarInfo.yres = YRes;
|
||||
if (Hz == 75) {
|
||||
VarInfo.pixclock = 7408;
|
||||
VarInfo.left_margin = 248;
|
||||
VarInfo.right_margin = 16;
|
||||
VarInfo.upper_margin = 38;
|
||||
VarInfo.lower_margin = 1;
|
||||
VarInfo.hsync_len = 144;
|
||||
VarInfo.vsync_len = 3;
|
||||
}
|
||||
else if (Hz == 70) {
|
||||
VarInfo.pixclock = 7937;
|
||||
VarInfo.left_margin = 216;
|
||||
VarInfo.right_margin = 80;
|
||||
VarInfo.upper_margin = 36;
|
||||
VarInfo.lower_margin = 1;
|
||||
VarInfo.hsync_len = 112;
|
||||
VarInfo.vsync_len = 5;
|
||||
}
|
||||
else if (Hz == 60) {
|
||||
VarInfo.pixclock = 9260;
|
||||
VarInfo.left_margin = 248;
|
||||
VarInfo.right_margin = 48;
|
||||
VarInfo.upper_margin = 38;
|
||||
VarInfo.lower_margin = 1;
|
||||
VarInfo.hsync_len = 112;
|
||||
VarInfo.vsync_len = 3;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "invalid rate for 1280x1024\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else if (XRes == 1024 && YRes == 768 && Hz == 70) {
|
||||
VarInfo.xres_virtual = VarInfo.xres = XRes;
|
||||
VarInfo.yres_virtual = VarInfo.yres = YRes;
|
||||
if (Hz == 70) {
|
||||
VarInfo.pixclock = 13334;
|
||||
VarInfo.left_margin = 144;
|
||||
VarInfo.right_margin = 24;
|
||||
VarInfo.upper_margin = 29;
|
||||
VarInfo.lower_margin = 3;
|
||||
VarInfo.hsync_len = 136;
|
||||
VarInfo.vsync_len = 6;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "invalid rate for 1024x768\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
/* timing values taken from /etc/fb.modes (1280x1024 @ 75Hz) */
|
||||
VarInfo.xres_virtual = VarInfo.xres = 1280;
|
||||
VarInfo.yres_virtual = VarInfo.yres = 1024;
|
||||
VarInfo.pixclock = 7408;
|
||||
VarInfo.left_margin = 248;
|
||||
VarInfo.right_margin = 16;
|
||||
VarInfo.upper_margin = 38;
|
||||
VarInfo.lower_margin = 1;
|
||||
VarInfo.hsync_len = 144;
|
||||
VarInfo.vsync_len = 3;
|
||||
|
||||
VarInfo.xoffset = 0;
|
||||
VarInfo.yoffset = 0;
|
||||
@@ -391,7 +338,7 @@ initialize_fbdev( void )
|
||||
printf("MMIOAddress = %p\n", MMIOAddress);
|
||||
|
||||
/* try out some simple MMIO register reads */
|
||||
if (0)
|
||||
if (1)
|
||||
{
|
||||
typedef unsigned int CARD32;
|
||||
typedef unsigned char CARD8;
|
||||
@@ -505,7 +452,6 @@ gltest( void )
|
||||
GLFBDevVisualPtr vis;
|
||||
int bytes, r, g, b, a;
|
||||
float ang;
|
||||
int i;
|
||||
|
||||
printf("GLFBDEV_VENDOR = %s\n", glFBDevGetString(GLFBDEV_VENDOR));
|
||||
printf("GLFBDEV_VERSION = %s\n", glFBDevGetString(GLFBDEV_VERSION));
|
||||
@@ -545,17 +491,13 @@ gltest( void )
|
||||
glEnable(GL_LIGHT0);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
printf("Drawing %d frames...\n", NumFrames);
|
||||
|
||||
ang = 0.0;
|
||||
for (i = 0; i < NumFrames; i++) {
|
||||
for (ang = 0; ang <= 180; ang += 15) {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glPushMatrix();
|
||||
glRotatef(ang, 1, 0, 0);
|
||||
doughnut(1, 3, 40, 20);
|
||||
glPopMatrix();
|
||||
glFBDevSwapBuffers(buf);
|
||||
ang += 15.0;
|
||||
}
|
||||
|
||||
/* clean up */
|
||||
@@ -568,29 +510,12 @@ gltest( void )
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
parse_args(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-f") == 0) {
|
||||
NumFrames = atoi(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main( int argc, char *argv[] )
|
||||
{
|
||||
signal(SIGUSR1, signal_handler); /* exit if someone tries a vt switch */
|
||||
signal(SIGSEGV, signal_handler); /* catch segfaults */
|
||||
|
||||
parse_args(argc, argv);
|
||||
|
||||
printf("Setting mode to %d x %d @ %d Hz, %d bpp\n", XRes, YRes, Hz, DesiredDepth);
|
||||
initialize_fbdev();
|
||||
gltest();
|
||||
shutdown_fbdev();
|
||||
|
||||
@@ -86,9 +86,9 @@ UTIL_FILES = readtex.h readtex.c
|
||||
default: $(UTIL_FILES) $(PROGS)
|
||||
|
||||
clean:
|
||||
-rm -f $(PROGS)
|
||||
-rm -f *.o
|
||||
-rm -f getproclist.h
|
||||
rm -f $(PROGS)
|
||||
rm -f *.o
|
||||
rm -f getproclist.h
|
||||
|
||||
|
||||
# auto code generation
|
||||
|
||||
@@ -1,132 +1,132 @@
|
||||
Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
|
||||
|
||||
Named object: "Object01"
|
||||
Tri-mesh, Vertices: 20 Faces: 36
|
||||
Vertex list:
|
||||
Vertex 0: X: -210 Y: -432.781738 Z: 180.000031
|
||||
Vertex 1: X: -610.810303 Y: 144.260559 Z: 103.580154
|
||||
Vertex 2: X: 56.586655 Y: 144.260544 Z: -128.902023
|
||||
Vertex 3: X: -75.776352 Y: 144.260605 Z: 565.321838
|
||||
Vertex 4: X: -462.815979 Y: -347.937683 Z: 131.797302
|
||||
Vertex 5: X: -616.506042 Y: -126.67173 Z: 102.494209
|
||||
Vertex 6: X: -41.847229 Y: -347.937683 Z: -14.843644
|
||||
Vertex 7: X: 60.375015 Y: -126.671753 Z: -133.291641
|
||||
Vertex 8: X: -125.336807 Y: -347.937653 Z: 423.046448
|
||||
Vertex 9: X: -73.868958 Y: -126.671692 Z: 570.797424
|
||||
Vertex 10: X: -448.353271 Y: 237.304672 Z: -92.34951
|
||||
Vertex 11: X: -192.440964 Y: 237.304672 Z: -181.494431
|
||||
Vertex 12: X: 145.038193 Y: 237.304672 Z: 109.754745
|
||||
Vertex 13: X: 94.283768 Y: 237.304688 Z: 375.953766
|
||||
Vertex 14: X: -326.684937 Y: 237.304733 Z: 522.594727
|
||||
Vertex 15: X: -531.842834 Y: 237.304718 Z: 345.540588
|
||||
Vertex 16: X: -331.419525 Y: -225.964966 Z: -168.564438
|
||||
Vertex 17: X: 152.575485 Y: -225.964935 Z: 249.129868
|
||||
Vertex 18: X: -451.155914 Y: -225.964905 Z: 459.434662
|
||||
Vertex 19: X: -298.413483 Y: 423.31897 Z: 163.142761
|
||||
Face list:
|
||||
Face 0: A:0 B:4 C:6 AB:1 BC:1 CA:1
|
||||
Face 1: A:4 B:5 C:16 AB:1 BC:1 CA:1
|
||||
Face 2: A:4 B:16 C:6 AB:1 BC:1 CA:1
|
||||
Face 3: A:6 B:16 C:7 AB:1 BC:1 CA:1
|
||||
Face 4: A:5 B:1 C:10 AB:1 BC:1 CA:1
|
||||
Face 5: A:5 B:10 C:16 AB:1 BC:1 CA:1
|
||||
Face 6: A:16 B:10 C:11 AB:1 BC:1 CA:1
|
||||
Face 7: A:16 B:11 C:7 AB:1 BC:1 CA:1
|
||||
Face 8: A:7 B:11 C:2 AB:1 BC:1 CA:1
|
||||
Face 9: A:0 B:6 C:8 AB:1 BC:1 CA:1
|
||||
Face 10: A:6 B:7 C:17 AB:1 BC:1 CA:1
|
||||
Face 11: A:6 B:17 C:8 AB:1 BC:1 CA:1
|
||||
Face 12: A:8 B:17 C:9 AB:1 BC:1 CA:1
|
||||
Face 13: A:7 B:2 C:12 AB:1 BC:1 CA:1
|
||||
Face 14: A:7 B:12 C:17 AB:1 BC:1 CA:1
|
||||
Face 15: A:17 B:12 C:13 AB:1 BC:1 CA:1
|
||||
Face 16: A:17 B:13 C:9 AB:1 BC:1 CA:1
|
||||
Face 17: A:9 B:13 C:3 AB:1 BC:1 CA:1
|
||||
Face 18: A:0 B:8 C:4 AB:1 BC:1 CA:1
|
||||
Face 19: A:8 B:9 C:18 AB:1 BC:1 CA:1
|
||||
Face 20: A:8 B:18 C:4 AB:1 BC:1 CA:1
|
||||
Face 21: A:4 B:18 C:5 AB:1 BC:1 CA:1
|
||||
Face 22: A:9 B:3 C:14 AB:1 BC:1 CA:1
|
||||
Face 23: A:9 B:14 C:18 AB:1 BC:1 CA:1
|
||||
Face 24: A:18 B:14 C:15 AB:1 BC:1 CA:1
|
||||
Face 25: A:18 B:15 C:5 AB:1 BC:1 CA:1
|
||||
Face 26: A:5 B:15 C:1 AB:1 BC:1 CA:1
|
||||
Face 27: A:1 B:15 C:10 AB:1 BC:1 CA:1
|
||||
Face 28: A:15 B:14 C:19 AB:1 BC:1 CA:1
|
||||
Face 29: A:15 B:19 C:10 AB:1 BC:1 CA:1
|
||||
Face 30: A:10 B:19 C:11 AB:1 BC:1 CA:1
|
||||
Face 31: A:14 B:3 C:13 AB:1 BC:1 CA:1
|
||||
Face 32: A:14 B:13 C:19 AB:1 BC:1 CA:1
|
||||
Face 33: A:19 B:13 C:12 AB:1 BC:1 CA:1
|
||||
Face 34: A:19 B:12 C:11 AB:1 BC:1 CA:1
|
||||
|
||||
Page 1
|
||||
|
||||
|
||||
|
||||
Face 35: A:11 B:12 C:2 AB:1 BC:1 CA:1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Page 2
|
||||
|
||||
|
||||
|
||||
Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
|
||||
|
||||
Named object: "Object01"
|
||||
Tri-mesh, Vertices: 20 Faces: 36
|
||||
Vertex list:
|
||||
Vertex 0: X: -210 Y: -432.781738 Z: 180.000031
|
||||
Vertex 1: X: -610.810303 Y: 144.260559 Z: 103.580154
|
||||
Vertex 2: X: 56.586655 Y: 144.260544 Z: -128.902023
|
||||
Vertex 3: X: -75.776352 Y: 144.260605 Z: 565.321838
|
||||
Vertex 4: X: -462.815979 Y: -347.937683 Z: 131.797302
|
||||
Vertex 5: X: -616.506042 Y: -126.67173 Z: 102.494209
|
||||
Vertex 6: X: -41.847229 Y: -347.937683 Z: -14.843644
|
||||
Vertex 7: X: 60.375015 Y: -126.671753 Z: -133.291641
|
||||
Vertex 8: X: -125.336807 Y: -347.937653 Z: 423.046448
|
||||
Vertex 9: X: -73.868958 Y: -126.671692 Z: 570.797424
|
||||
Vertex 10: X: -448.353271 Y: 237.304672 Z: -92.34951
|
||||
Vertex 11: X: -192.440964 Y: 237.304672 Z: -181.494431
|
||||
Vertex 12: X: 145.038193 Y: 237.304672 Z: 109.754745
|
||||
Vertex 13: X: 94.283768 Y: 237.304688 Z: 375.953766
|
||||
Vertex 14: X: -326.684937 Y: 237.304733 Z: 522.594727
|
||||
Vertex 15: X: -531.842834 Y: 237.304718 Z: 345.540588
|
||||
Vertex 16: X: -331.419525 Y: -225.964966 Z: -168.564438
|
||||
Vertex 17: X: 152.575485 Y: -225.964935 Z: 249.129868
|
||||
Vertex 18: X: -451.155914 Y: -225.964905 Z: 459.434662
|
||||
Vertex 19: X: -298.413483 Y: 423.31897 Z: 163.142761
|
||||
Face list:
|
||||
Face 0: A:0 B:4 C:6 AB:1 BC:1 CA:1
|
||||
Face 1: A:4 B:5 C:16 AB:1 BC:1 CA:1
|
||||
Face 2: A:4 B:16 C:6 AB:1 BC:1 CA:1
|
||||
Face 3: A:6 B:16 C:7 AB:1 BC:1 CA:1
|
||||
Face 4: A:5 B:1 C:10 AB:1 BC:1 CA:1
|
||||
Face 5: A:5 B:10 C:16 AB:1 BC:1 CA:1
|
||||
Face 6: A:16 B:10 C:11 AB:1 BC:1 CA:1
|
||||
Face 7: A:16 B:11 C:7 AB:1 BC:1 CA:1
|
||||
Face 8: A:7 B:11 C:2 AB:1 BC:1 CA:1
|
||||
Face 9: A:0 B:6 C:8 AB:1 BC:1 CA:1
|
||||
Face 10: A:6 B:7 C:17 AB:1 BC:1 CA:1
|
||||
Face 11: A:6 B:17 C:8 AB:1 BC:1 CA:1
|
||||
Face 12: A:8 B:17 C:9 AB:1 BC:1 CA:1
|
||||
Face 13: A:7 B:2 C:12 AB:1 BC:1 CA:1
|
||||
Face 14: A:7 B:12 C:17 AB:1 BC:1 CA:1
|
||||
Face 15: A:17 B:12 C:13 AB:1 BC:1 CA:1
|
||||
Face 16: A:17 B:13 C:9 AB:1 BC:1 CA:1
|
||||
Face 17: A:9 B:13 C:3 AB:1 BC:1 CA:1
|
||||
Face 18: A:0 B:8 C:4 AB:1 BC:1 CA:1
|
||||
Face 19: A:8 B:9 C:18 AB:1 BC:1 CA:1
|
||||
Face 20: A:8 B:18 C:4 AB:1 BC:1 CA:1
|
||||
Face 21: A:4 B:18 C:5 AB:1 BC:1 CA:1
|
||||
Face 22: A:9 B:3 C:14 AB:1 BC:1 CA:1
|
||||
Face 23: A:9 B:14 C:18 AB:1 BC:1 CA:1
|
||||
Face 24: A:18 B:14 C:15 AB:1 BC:1 CA:1
|
||||
Face 25: A:18 B:15 C:5 AB:1 BC:1 CA:1
|
||||
Face 26: A:5 B:15 C:1 AB:1 BC:1 CA:1
|
||||
Face 27: A:1 B:15 C:10 AB:1 BC:1 CA:1
|
||||
Face 28: A:15 B:14 C:19 AB:1 BC:1 CA:1
|
||||
Face 29: A:15 B:19 C:10 AB:1 BC:1 CA:1
|
||||
Face 30: A:10 B:19 C:11 AB:1 BC:1 CA:1
|
||||
Face 31: A:14 B:3 C:13 AB:1 BC:1 CA:1
|
||||
Face 32: A:14 B:13 C:19 AB:1 BC:1 CA:1
|
||||
Face 33: A:19 B:13 C:12 AB:1 BC:1 CA:1
|
||||
Face 34: A:19 B:12 C:11 AB:1 BC:1 CA:1
|
||||
|
||||
Page 1
|
||||
|
||||
|
||||
|
||||
Face 35: A:11 B:12 C:2 AB:1 BC:1 CA:1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Page 2
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,264 +1,264 @@
|
||||
Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
|
||||
|
||||
Named object: "Object01"
|
||||
Tri-mesh, Vertices: 40 Faces: 80
|
||||
Vertex list:
|
||||
Vertex 0: X: -50.170624 Y: -0.000026 Z: -240.147842
|
||||
Vertex 1: X: -80.584503 Y: -63.958851 Z: -205.014572
|
||||
Vertex 2: X: -129.795166 Y: -39.528744 Z: -148.16774
|
||||
Vertex 3: X: -129.795166 Y: 39.528721 Z: -148.16774
|
||||
Vertex 4: X: -80.584503 Y: 63.958797 Z: -205.014572
|
||||
Vertex 5: X: 85.963654 Y: -0.000002 Z: 31.490465
|
||||
Vertex 6: X: 39.614838 Y: -63.958828 Z: 34.827602
|
||||
Vertex 7: X: -35.37915 Y: -39.528728 Z: 40.227196
|
||||
Vertex 8: X: -35.37912 Y: 39.528736 Z: 40.227188
|
||||
Vertex 9: X: 39.614838 Y: 63.95882 Z: 34.827595
|
||||
Vertex 10: X: -9.852051 Y: 0.000023 Z: 319.829254
|
||||
Vertex 11: X: -44.985352 Y: -63.958805 Z: 289.415405
|
||||
Vertex 12: X: -101.832199 Y: -39.528709 Z: 240.204758
|
||||
Vertex 13: X: -101.832184 Y: 39.528755 Z: 240.204773
|
||||
Vertex 14: X: -44.985352 Y: 63.958843 Z: 289.415405
|
||||
Vertex 15: X: -281.490326 Y: 0.000035 Z: 455.963654
|
||||
Vertex 16: X: -284.827484 Y: -63.958794 Z: 409.614868
|
||||
Vertex 17: X: -290.227112 Y: -39.528702 Z: 334.62085
|
||||
Vertex 18: X: -290.227112 Y: 39.528763 Z: 334.62088
|
||||
Vertex 19: X: -284.827484 Y: 63.958855 Z: 409.614838
|
||||
Vertex 20: X: -569.829163 Y: 0.000026 Z: 360.14798
|
||||
Vertex 21: X: -539.415344 Y: -63.958801 Z: 325.014709
|
||||
Vertex 22: X: -490.204712 Y: -39.528709 Z: 268.167847
|
||||
Vertex 23: X: -490.204712 Y: 39.528755 Z: 268.167847
|
||||
Vertex 24: X: -539.415344 Y: 63.958847 Z: 325.014679
|
||||
Vertex 25: X: -705.963684 Y: 0.000002 Z: 88.509598
|
||||
Vertex 26: X: -659.614807 Y: -63.958824 Z: 85.172462
|
||||
Vertex 27: X: -584.62085 Y: -39.528725 Z: 79.77285
|
||||
Vertex 28: X: -584.62085 Y: 39.52874 Z: 79.77285
|
||||
Vertex 29: X: -659.614868 Y: 63.958824 Z: 85.172447
|
||||
Vertex 30: X: -610.147827 Y: -0.000023 Z: -199.829361
|
||||
Vertex 31: X: -575.014587 Y: -63.958847 Z: -169.415497
|
||||
Vertex 32: X: -518.167725 Y: -39.528744 Z: -120.204819
|
||||
Vertex 33: X: -518.167725 Y: 39.528721 Z: -120.204834
|
||||
Vertex 34: X: -575.014587 Y: 63.958801 Z: -169.415497
|
||||
Vertex 35: X: -338.509338 Y: -0.000035 Z: -335.963745
|
||||
Vertex 36: X: -335.172241 Y: -63.958858 Z: -289.614868
|
||||
Vertex 37: X: -329.772675 Y: -39.528751 Z: -214.620865
|
||||
Vertex 38: X: -329.772675 Y: 39.528713 Z: -214.620865
|
||||
Vertex 39: X: -335.172241 Y: 63.95879 Z: -289.614899
|
||||
Face list:
|
||||
Face 0: A:0 B:6 C:1 AB:0 BC:1 CA:1
|
||||
Smoothing: 1
|
||||
Face 1: A:0 B:5 C:6 AB:1 BC:1 CA:0
|
||||
Smoothing: 1
|
||||
Face 2: A:1 B:7 C:2 AB:0 BC:1 CA:1
|
||||
Smoothing: 2
|
||||
Face 3: A:1 B:6 C:7 AB:1 BC:1 CA:0
|
||||
Smoothing: 2
|
||||
Face 4: A:2 B:8 C:3 AB:0 BC:1 CA:1
|
||||
Smoothing: 3
|
||||
Face 5: A:2 B:7 C:8 AB:1 BC:1 CA:0
|
||||
Smoothing: 3
|
||||
Face 6: A:3 B:9 C:4 AB:0 BC:1 CA:1
|
||||
Smoothing: 4
|
||||
Face 7: A:3 B:8 C:9 AB:1 BC:1 CA:0
|
||||
|
||||
Page 1
|
||||
|
||||
|
||||
|
||||
Smoothing: 4
|
||||
Face 8: A:4 B:5 C:0 AB:0 BC:1 CA:1
|
||||
Smoothing: 5
|
||||
Face 9: A:4 B:9 C:5 AB:1 BC:1 CA:0
|
||||
Smoothing: 5
|
||||
Face 10: A:5 B:11 C:6 AB:0 BC:1 CA:1
|
||||
Smoothing: 6
|
||||
Face 11: A:5 B:10 C:11 AB:1 BC:1 CA:0
|
||||
Smoothing: 6
|
||||
Face 12: A:6 B:12 C:7 AB:0 BC:1 CA:1
|
||||
Smoothing: 7
|
||||
Face 13: A:6 B:11 C:12 AB:1 BC:1 CA:0
|
||||
Smoothing: 7
|
||||
Face 14: A:7 B:13 C:8 AB:0 BC:1 CA:1
|
||||
Smoothing: 8
|
||||
Face 15: A:7 B:12 C:13 AB:1 BC:1 CA:0
|
||||
Smoothing: 8
|
||||
Face 16: A:8 B:14 C:9 AB:0 BC:1 CA:1
|
||||
Smoothing: 9
|
||||
Face 17: A:8 B:13 C:14 AB:1 BC:1 CA:0
|
||||
Smoothing: 9
|
||||
Face 18: A:9 B:10 C:5 AB:0 BC:1 CA:1
|
||||
Smoothing: 10
|
||||
Face 19: A:9 B:14 C:10 AB:1 BC:1 CA:0
|
||||
Smoothing: 10
|
||||
Face 20: A:10 B:16 C:11 AB:0 BC:1 CA:1
|
||||
Smoothing: 11
|
||||
Face 21: A:10 B:15 C:16 AB:1 BC:1 CA:0
|
||||
Smoothing: 11
|
||||
Face 22: A:11 B:17 C:12 AB:0 BC:1 CA:1
|
||||
Smoothing: 12
|
||||
Face 23: A:11 B:16 C:17 AB:1 BC:1 CA:0
|
||||
Smoothing: 12
|
||||
Face 24: A:12 B:18 C:13 AB:0 BC:1 CA:1
|
||||
Smoothing: 13
|
||||
Face 25: A:12 B:17 C:18 AB:1 BC:1 CA:0
|
||||
Smoothing: 13
|
||||
Face 26: A:13 B:19 C:14 AB:0 BC:1 CA:1
|
||||
Smoothing: 14
|
||||
Face 27: A:13 B:18 C:19 AB:1 BC:1 CA:0
|
||||
Smoothing: 14
|
||||
Face 28: A:14 B:15 C:10 AB:0 BC:1 CA:1
|
||||
Smoothing: 15
|
||||
Face 29: A:14 B:19 C:15 AB:1 BC:1 CA:0
|
||||
Smoothing: 15
|
||||
Face 30: A:15 B:21 C:16 AB:0 BC:1 CA:1
|
||||
Smoothing: 16
|
||||
Face 31: A:15 B:20 C:21 AB:1 BC:1 CA:0
|
||||
Smoothing: 16
|
||||
Face 32: A:16 B:22 C:17 AB:0 BC:1 CA:1
|
||||
Smoothing: 17
|
||||
Face 33: A:16 B:21 C:22 AB:1 BC:1 CA:0
|
||||
Smoothing: 17
|
||||
Face 34: A:17 B:23 C:18 AB:0 BC:1 CA:1
|
||||
Smoothing: 18
|
||||
Face 35: A:17 B:22 C:23 AB:1 BC:1 CA:0
|
||||
Smoothing: 18
|
||||
Face 36: A:18 B:24 C:19 AB:0 BC:1 CA:1
|
||||
Smoothing: 19
|
||||
Face 37: A:18 B:23 C:24 AB:1 BC:1 CA:0
|
||||
Smoothing: 19
|
||||
|
||||
Page 2
|
||||
|
||||
|
||||
|
||||
Face 38: A:19 B:20 C:15 AB:0 BC:1 CA:1
|
||||
Smoothing: 20
|
||||
Face 39: A:19 B:24 C:20 AB:1 BC:1 CA:0
|
||||
Smoothing: 20
|
||||
Face 40: A:20 B:26 C:21 AB:0 BC:1 CA:1
|
||||
Smoothing: 21
|
||||
Face 41: A:20 B:25 C:26 AB:1 BC:1 CA:0
|
||||
Smoothing: 21
|
||||
Face 42: A:21 B:27 C:22 AB:0 BC:1 CA:1
|
||||
Smoothing: 22
|
||||
Face 43: A:21 B:26 C:27 AB:1 BC:1 CA:0
|
||||
Smoothing: 22
|
||||
Face 44: A:22 B:28 C:23 AB:0 BC:1 CA:1
|
||||
Smoothing: 23
|
||||
Face 45: A:22 B:27 C:28 AB:1 BC:1 CA:0
|
||||
Smoothing: 23
|
||||
Face 46: A:23 B:29 C:24 AB:0 BC:1 CA:1
|
||||
Smoothing: 24
|
||||
Face 47: A:23 B:28 C:29 AB:1 BC:1 CA:0
|
||||
Smoothing: 24
|
||||
Face 48: A:24 B:25 C:20 AB:0 BC:1 CA:1
|
||||
Smoothing: 25
|
||||
Face 49: A:24 B:29 C:25 AB:1 BC:1 CA:0
|
||||
Smoothing: 25
|
||||
Face 50: A:25 B:31 C:26 AB:0 BC:1 CA:1
|
||||
Smoothing: 26
|
||||
Face 51: A:25 B:30 C:31 AB:1 BC:1 CA:0
|
||||
Smoothing: 26
|
||||
Face 52: A:26 B:32 C:27 AB:0 BC:1 CA:1
|
||||
Smoothing: 27
|
||||
Face 53: A:26 B:31 C:32 AB:1 BC:1 CA:0
|
||||
Smoothing: 27
|
||||
Face 54: A:27 B:33 C:28 AB:0 BC:1 CA:1
|
||||
Smoothing: 28
|
||||
Face 55: A:27 B:32 C:33 AB:1 BC:1 CA:0
|
||||
Smoothing: 28
|
||||
Face 56: A:28 B:34 C:29 AB:0 BC:1 CA:1
|
||||
Smoothing: 29
|
||||
Face 57: A:28 B:33 C:34 AB:1 BC:1 CA:0
|
||||
Smoothing: 29
|
||||
Face 58: A:29 B:30 C:25 AB:0 BC:1 CA:1
|
||||
Smoothing: 30
|
||||
Face 59: A:29 B:34 C:30 AB:1 BC:1 CA:0
|
||||
Smoothing: 30
|
||||
Face 60: A:30 B:36 C:31 AB:0 BC:1 CA:1
|
||||
Smoothing: 31
|
||||
Face 61: A:30 B:35 C:36 AB:1 BC:1 CA:0
|
||||
Smoothing: 31
|
||||
Face 62: A:31 B:37 C:32 AB:0 BC:1 CA:1
|
||||
Smoothing: 32
|
||||
Face 63: A:31 B:36 C:37 AB:1 BC:1 CA:0
|
||||
Smoothing: 32
|
||||
Face 64: A:32 B:38 C:33 AB:0 BC:1 CA:1
|
||||
Smoothing: 1
|
||||
Face 65: A:32 B:37 C:38 AB:1 BC:1 CA:0
|
||||
Smoothing: 1
|
||||
Face 66: A:33 B:39 C:34 AB:0 BC:1 CA:1
|
||||
Smoothing: 2
|
||||
Face 67: A:33 B:38 C:39 AB:1 BC:1 CA:0
|
||||
Smoothing: 2
|
||||
Face 68: A:34 B:35 C:30 AB:0 BC:1 CA:1
|
||||
|
||||
Page 3
|
||||
|
||||
|
||||
|
||||
Smoothing: 3
|
||||
Face 69: A:34 B:39 C:35 AB:1 BC:1 CA:0
|
||||
Smoothing: 3
|
||||
Face 70: A:35 B:1 C:36 AB:0 BC:1 CA:1
|
||||
Smoothing: 4
|
||||
Face 71: A:35 B:0 C:1 AB:1 BC:1 CA:0
|
||||
Smoothing: 4
|
||||
Face 72: A:36 B:2 C:37 AB:0 BC:1 CA:1
|
||||
Smoothing: 5
|
||||
Face 73: A:36 B:1 C:2 AB:1 BC:1 CA:0
|
||||
Smoothing: 5
|
||||
Face 74: A:37 B:3 C:38 AB:0 BC:1 CA:1
|
||||
Smoothing: 6
|
||||
Face 75: A:37 B:2 C:3 AB:1 BC:1 CA:0
|
||||
Smoothing: 6
|
||||
Face 76: A:38 B:4 C:39 AB:0 BC:1 CA:1
|
||||
Smoothing: 7
|
||||
Face 77: A:38 B:3 C:4 AB:1 BC:1 CA:0
|
||||
Smoothing: 7
|
||||
Face 78: A:39 B:0 C:35 AB:0 BC:1 CA:1
|
||||
Smoothing: 8
|
||||
Face 79: A:39 B:4 C:0 AB:1 BC:1 CA:0
|
||||
Smoothing: 8
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Page 4
|
||||
|
||||
|
||||
|
||||
Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
|
||||
|
||||
Named object: "Object01"
|
||||
Tri-mesh, Vertices: 40 Faces: 80
|
||||
Vertex list:
|
||||
Vertex 0: X: -50.170624 Y: -0.000026 Z: -240.147842
|
||||
Vertex 1: X: -80.584503 Y: -63.958851 Z: -205.014572
|
||||
Vertex 2: X: -129.795166 Y: -39.528744 Z: -148.16774
|
||||
Vertex 3: X: -129.795166 Y: 39.528721 Z: -148.16774
|
||||
Vertex 4: X: -80.584503 Y: 63.958797 Z: -205.014572
|
||||
Vertex 5: X: 85.963654 Y: -0.000002 Z: 31.490465
|
||||
Vertex 6: X: 39.614838 Y: -63.958828 Z: 34.827602
|
||||
Vertex 7: X: -35.37915 Y: -39.528728 Z: 40.227196
|
||||
Vertex 8: X: -35.37912 Y: 39.528736 Z: 40.227188
|
||||
Vertex 9: X: 39.614838 Y: 63.95882 Z: 34.827595
|
||||
Vertex 10: X: -9.852051 Y: 0.000023 Z: 319.829254
|
||||
Vertex 11: X: -44.985352 Y: -63.958805 Z: 289.415405
|
||||
Vertex 12: X: -101.832199 Y: -39.528709 Z: 240.204758
|
||||
Vertex 13: X: -101.832184 Y: 39.528755 Z: 240.204773
|
||||
Vertex 14: X: -44.985352 Y: 63.958843 Z: 289.415405
|
||||
Vertex 15: X: -281.490326 Y: 0.000035 Z: 455.963654
|
||||
Vertex 16: X: -284.827484 Y: -63.958794 Z: 409.614868
|
||||
Vertex 17: X: -290.227112 Y: -39.528702 Z: 334.62085
|
||||
Vertex 18: X: -290.227112 Y: 39.528763 Z: 334.62088
|
||||
Vertex 19: X: -284.827484 Y: 63.958855 Z: 409.614838
|
||||
Vertex 20: X: -569.829163 Y: 0.000026 Z: 360.14798
|
||||
Vertex 21: X: -539.415344 Y: -63.958801 Z: 325.014709
|
||||
Vertex 22: X: -490.204712 Y: -39.528709 Z: 268.167847
|
||||
Vertex 23: X: -490.204712 Y: 39.528755 Z: 268.167847
|
||||
Vertex 24: X: -539.415344 Y: 63.958847 Z: 325.014679
|
||||
Vertex 25: X: -705.963684 Y: 0.000002 Z: 88.509598
|
||||
Vertex 26: X: -659.614807 Y: -63.958824 Z: 85.172462
|
||||
Vertex 27: X: -584.62085 Y: -39.528725 Z: 79.77285
|
||||
Vertex 28: X: -584.62085 Y: 39.52874 Z: 79.77285
|
||||
Vertex 29: X: -659.614868 Y: 63.958824 Z: 85.172447
|
||||
Vertex 30: X: -610.147827 Y: -0.000023 Z: -199.829361
|
||||
Vertex 31: X: -575.014587 Y: -63.958847 Z: -169.415497
|
||||
Vertex 32: X: -518.167725 Y: -39.528744 Z: -120.204819
|
||||
Vertex 33: X: -518.167725 Y: 39.528721 Z: -120.204834
|
||||
Vertex 34: X: -575.014587 Y: 63.958801 Z: -169.415497
|
||||
Vertex 35: X: -338.509338 Y: -0.000035 Z: -335.963745
|
||||
Vertex 36: X: -335.172241 Y: -63.958858 Z: -289.614868
|
||||
Vertex 37: X: -329.772675 Y: -39.528751 Z: -214.620865
|
||||
Vertex 38: X: -329.772675 Y: 39.528713 Z: -214.620865
|
||||
Vertex 39: X: -335.172241 Y: 63.95879 Z: -289.614899
|
||||
Face list:
|
||||
Face 0: A:0 B:6 C:1 AB:0 BC:1 CA:1
|
||||
Smoothing: 1
|
||||
Face 1: A:0 B:5 C:6 AB:1 BC:1 CA:0
|
||||
Smoothing: 1
|
||||
Face 2: A:1 B:7 C:2 AB:0 BC:1 CA:1
|
||||
Smoothing: 2
|
||||
Face 3: A:1 B:6 C:7 AB:1 BC:1 CA:0
|
||||
Smoothing: 2
|
||||
Face 4: A:2 B:8 C:3 AB:0 BC:1 CA:1
|
||||
Smoothing: 3
|
||||
Face 5: A:2 B:7 C:8 AB:1 BC:1 CA:0
|
||||
Smoothing: 3
|
||||
Face 6: A:3 B:9 C:4 AB:0 BC:1 CA:1
|
||||
Smoothing: 4
|
||||
Face 7: A:3 B:8 C:9 AB:1 BC:1 CA:0
|
||||
|
||||
Page 1
|
||||
|
||||
|
||||
|
||||
Smoothing: 4
|
||||
Face 8: A:4 B:5 C:0 AB:0 BC:1 CA:1
|
||||
Smoothing: 5
|
||||
Face 9: A:4 B:9 C:5 AB:1 BC:1 CA:0
|
||||
Smoothing: 5
|
||||
Face 10: A:5 B:11 C:6 AB:0 BC:1 CA:1
|
||||
Smoothing: 6
|
||||
Face 11: A:5 B:10 C:11 AB:1 BC:1 CA:0
|
||||
Smoothing: 6
|
||||
Face 12: A:6 B:12 C:7 AB:0 BC:1 CA:1
|
||||
Smoothing: 7
|
||||
Face 13: A:6 B:11 C:12 AB:1 BC:1 CA:0
|
||||
Smoothing: 7
|
||||
Face 14: A:7 B:13 C:8 AB:0 BC:1 CA:1
|
||||
Smoothing: 8
|
||||
Face 15: A:7 B:12 C:13 AB:1 BC:1 CA:0
|
||||
Smoothing: 8
|
||||
Face 16: A:8 B:14 C:9 AB:0 BC:1 CA:1
|
||||
Smoothing: 9
|
||||
Face 17: A:8 B:13 C:14 AB:1 BC:1 CA:0
|
||||
Smoothing: 9
|
||||
Face 18: A:9 B:10 C:5 AB:0 BC:1 CA:1
|
||||
Smoothing: 10
|
||||
Face 19: A:9 B:14 C:10 AB:1 BC:1 CA:0
|
||||
Smoothing: 10
|
||||
Face 20: A:10 B:16 C:11 AB:0 BC:1 CA:1
|
||||
Smoothing: 11
|
||||
Face 21: A:10 B:15 C:16 AB:1 BC:1 CA:0
|
||||
Smoothing: 11
|
||||
Face 22: A:11 B:17 C:12 AB:0 BC:1 CA:1
|
||||
Smoothing: 12
|
||||
Face 23: A:11 B:16 C:17 AB:1 BC:1 CA:0
|
||||
Smoothing: 12
|
||||
Face 24: A:12 B:18 C:13 AB:0 BC:1 CA:1
|
||||
Smoothing: 13
|
||||
Face 25: A:12 B:17 C:18 AB:1 BC:1 CA:0
|
||||
Smoothing: 13
|
||||
Face 26: A:13 B:19 C:14 AB:0 BC:1 CA:1
|
||||
Smoothing: 14
|
||||
Face 27: A:13 B:18 C:19 AB:1 BC:1 CA:0
|
||||
Smoothing: 14
|
||||
Face 28: A:14 B:15 C:10 AB:0 BC:1 CA:1
|
||||
Smoothing: 15
|
||||
Face 29: A:14 B:19 C:15 AB:1 BC:1 CA:0
|
||||
Smoothing: 15
|
||||
Face 30: A:15 B:21 C:16 AB:0 BC:1 CA:1
|
||||
Smoothing: 16
|
||||
Face 31: A:15 B:20 C:21 AB:1 BC:1 CA:0
|
||||
Smoothing: 16
|
||||
Face 32: A:16 B:22 C:17 AB:0 BC:1 CA:1
|
||||
Smoothing: 17
|
||||
Face 33: A:16 B:21 C:22 AB:1 BC:1 CA:0
|
||||
Smoothing: 17
|
||||
Face 34: A:17 B:23 C:18 AB:0 BC:1 CA:1
|
||||
Smoothing: 18
|
||||
Face 35: A:17 B:22 C:23 AB:1 BC:1 CA:0
|
||||
Smoothing: 18
|
||||
Face 36: A:18 B:24 C:19 AB:0 BC:1 CA:1
|
||||
Smoothing: 19
|
||||
Face 37: A:18 B:23 C:24 AB:1 BC:1 CA:0
|
||||
Smoothing: 19
|
||||
|
||||
Page 2
|
||||
|
||||
|
||||
|
||||
Face 38: A:19 B:20 C:15 AB:0 BC:1 CA:1
|
||||
Smoothing: 20
|
||||
Face 39: A:19 B:24 C:20 AB:1 BC:1 CA:0
|
||||
Smoothing: 20
|
||||
Face 40: A:20 B:26 C:21 AB:0 BC:1 CA:1
|
||||
Smoothing: 21
|
||||
Face 41: A:20 B:25 C:26 AB:1 BC:1 CA:0
|
||||
Smoothing: 21
|
||||
Face 42: A:21 B:27 C:22 AB:0 BC:1 CA:1
|
||||
Smoothing: 22
|
||||
Face 43: A:21 B:26 C:27 AB:1 BC:1 CA:0
|
||||
Smoothing: 22
|
||||
Face 44: A:22 B:28 C:23 AB:0 BC:1 CA:1
|
||||
Smoothing: 23
|
||||
Face 45: A:22 B:27 C:28 AB:1 BC:1 CA:0
|
||||
Smoothing: 23
|
||||
Face 46: A:23 B:29 C:24 AB:0 BC:1 CA:1
|
||||
Smoothing: 24
|
||||
Face 47: A:23 B:28 C:29 AB:1 BC:1 CA:0
|
||||
Smoothing: 24
|
||||
Face 48: A:24 B:25 C:20 AB:0 BC:1 CA:1
|
||||
Smoothing: 25
|
||||
Face 49: A:24 B:29 C:25 AB:1 BC:1 CA:0
|
||||
Smoothing: 25
|
||||
Face 50: A:25 B:31 C:26 AB:0 BC:1 CA:1
|
||||
Smoothing: 26
|
||||
Face 51: A:25 B:30 C:31 AB:1 BC:1 CA:0
|
||||
Smoothing: 26
|
||||
Face 52: A:26 B:32 C:27 AB:0 BC:1 CA:1
|
||||
Smoothing: 27
|
||||
Face 53: A:26 B:31 C:32 AB:1 BC:1 CA:0
|
||||
Smoothing: 27
|
||||
Face 54: A:27 B:33 C:28 AB:0 BC:1 CA:1
|
||||
Smoothing: 28
|
||||
Face 55: A:27 B:32 C:33 AB:1 BC:1 CA:0
|
||||
Smoothing: 28
|
||||
Face 56: A:28 B:34 C:29 AB:0 BC:1 CA:1
|
||||
Smoothing: 29
|
||||
Face 57: A:28 B:33 C:34 AB:1 BC:1 CA:0
|
||||
Smoothing: 29
|
||||
Face 58: A:29 B:30 C:25 AB:0 BC:1 CA:1
|
||||
Smoothing: 30
|
||||
Face 59: A:29 B:34 C:30 AB:1 BC:1 CA:0
|
||||
Smoothing: 30
|
||||
Face 60: A:30 B:36 C:31 AB:0 BC:1 CA:1
|
||||
Smoothing: 31
|
||||
Face 61: A:30 B:35 C:36 AB:1 BC:1 CA:0
|
||||
Smoothing: 31
|
||||
Face 62: A:31 B:37 C:32 AB:0 BC:1 CA:1
|
||||
Smoothing: 32
|
||||
Face 63: A:31 B:36 C:37 AB:1 BC:1 CA:0
|
||||
Smoothing: 32
|
||||
Face 64: A:32 B:38 C:33 AB:0 BC:1 CA:1
|
||||
Smoothing: 1
|
||||
Face 65: A:32 B:37 C:38 AB:1 BC:1 CA:0
|
||||
Smoothing: 1
|
||||
Face 66: A:33 B:39 C:34 AB:0 BC:1 CA:1
|
||||
Smoothing: 2
|
||||
Face 67: A:33 B:38 C:39 AB:1 BC:1 CA:0
|
||||
Smoothing: 2
|
||||
Face 68: A:34 B:35 C:30 AB:0 BC:1 CA:1
|
||||
|
||||
Page 3
|
||||
|
||||
|
||||
|
||||
Smoothing: 3
|
||||
Face 69: A:34 B:39 C:35 AB:1 BC:1 CA:0
|
||||
Smoothing: 3
|
||||
Face 70: A:35 B:1 C:36 AB:0 BC:1 CA:1
|
||||
Smoothing: 4
|
||||
Face 71: A:35 B:0 C:1 AB:1 BC:1 CA:0
|
||||
Smoothing: 4
|
||||
Face 72: A:36 B:2 C:37 AB:0 BC:1 CA:1
|
||||
Smoothing: 5
|
||||
Face 73: A:36 B:1 C:2 AB:1 BC:1 CA:0
|
||||
Smoothing: 5
|
||||
Face 74: A:37 B:3 C:38 AB:0 BC:1 CA:1
|
||||
Smoothing: 6
|
||||
Face 75: A:37 B:2 C:3 AB:1 BC:1 CA:0
|
||||
Smoothing: 6
|
||||
Face 76: A:38 B:4 C:39 AB:0 BC:1 CA:1
|
||||
Smoothing: 7
|
||||
Face 77: A:38 B:3 C:4 AB:1 BC:1 CA:0
|
||||
Smoothing: 7
|
||||
Face 78: A:39 B:0 C:35 AB:0 BC:1 CA:1
|
||||
Smoothing: 8
|
||||
Face 79: A:39 B:4 C:0 AB:1 BC:1 CA:0
|
||||
Smoothing: 8
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Page 4
|
||||
|
||||
|
||||
|
||||
|
||||
3
progs/glsl/.gitignore
vendored
3
progs/glsl/.gitignore
vendored
@@ -9,6 +9,5 @@ points
|
||||
readtex.c
|
||||
readtex.h
|
||||
texdemo1
|
||||
toyball
|
||||
trirast
|
||||
twoside
|
||||
toyball
|
||||
|
||||
@@ -10,18 +10,13 @@ LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(T
|
||||
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
|
||||
|
||||
PROGS = \
|
||||
bitmap \
|
||||
brick \
|
||||
bump \
|
||||
deriv \
|
||||
mandelbrot \
|
||||
multitex \
|
||||
noise \
|
||||
points \
|
||||
texdemo1 \
|
||||
toyball \
|
||||
twoside \
|
||||
trirast
|
||||
texdemo1
|
||||
|
||||
|
||||
##### RULES #####
|
||||
@@ -46,7 +41,6 @@ default: $(PROGS)
|
||||
extfuncs.h: $(TOP)/progs/util/extfuncs.h
|
||||
cp $< .
|
||||
|
||||
|
||||
readtex.c: $(TOP)/progs/util/readtex.c
|
||||
cp $< .
|
||||
|
||||
@@ -56,107 +50,22 @@ readtex.h: $(TOP)/progs/util/readtex.h
|
||||
readtex.o: readtex.c readtex.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) readtex.c
|
||||
|
||||
brick.c: extfuncs.h
|
||||
|
||||
shaderutil.c: $(TOP)/progs/util/shaderutil.c
|
||||
cp $< .
|
||||
bump.c: extfuncs.h
|
||||
|
||||
shaderutil.h: $(TOP)/progs/util/shaderutil.h
|
||||
cp $< .
|
||||
mandelbrot.c: extfuncs.h
|
||||
|
||||
shaderutil.o: shaderutil.c shaderutil.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) shaderutil.c
|
||||
toyball.c: extfuncs.h
|
||||
|
||||
texdemo1: texdemo1.o readtex.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) texdemo1.o readtex.o $(LIBS) -o $@
|
||||
|
||||
|
||||
bitmap.o: bitmap.c extfuncs.h shaderutil.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) bitmap.c
|
||||
|
||||
bitmap: bitmap.o shaderutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) bitmap.o shaderutil.o $(LIBS) -o $@
|
||||
|
||||
|
||||
brick.o: brick.c extfuncs.h shaderutil.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) brick.c
|
||||
|
||||
brick: brick.o shaderutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) brick.o shaderutil.o $(LIBS) -o $@
|
||||
|
||||
|
||||
bump.o: bump.c extfuncs.h shaderutil.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) bump.c
|
||||
|
||||
bump: bump.o shaderutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) bump.o shaderutil.o $(LIBS) -o $@
|
||||
|
||||
|
||||
deriv.o: deriv.c extfuncs.h shaderutil.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) deriv.c
|
||||
|
||||
deriv: deriv.o shaderutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) deriv.o shaderutil.o $(LIBS) -o $@
|
||||
|
||||
|
||||
mandelbrot.o: mandelbrot.c extfuncs.h shaderutil.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) mandelbrot.c
|
||||
|
||||
mandelbrot: mandelbrot.o shaderutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) mandelbrot.o shaderutil.o $(LIBS) -o $@
|
||||
|
||||
|
||||
multitex.o: multitex.c extfuncs.h readtex.h shaderutil.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) multitex.c
|
||||
|
||||
multitex: multitex.o readtex.o shaderutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) multitex.o readtex.o shaderutil.o $(LIBS) -o $@
|
||||
|
||||
|
||||
noise.o: noise.c extfuncs.h shaderutil.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) noise.c
|
||||
|
||||
noise: noise.o shaderutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) noise.o shaderutil.o $(LIBS) -o $@
|
||||
|
||||
|
||||
points.o: points.c extfuncs.h shaderutil.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) points.c
|
||||
|
||||
points: points.o shaderutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) points.o shaderutil.o $(LIBS) -o $@
|
||||
|
||||
|
||||
texdemo1.o: texdemo1.c readtex.h extfuncs.h shaderutil.h
|
||||
texdemo1.o: texdemo1.c readtex.h extfuncs.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) texdemo1.c
|
||||
|
||||
texdemo1: texdemo1.o readtex.o shaderutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) texdemo1.o readtex.o shaderutil.o $(LIBS) -o $@
|
||||
|
||||
|
||||
toyball.o: toyball.c extfuncs.h shaderutil.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) toyball.c
|
||||
|
||||
toyball: toyball.o shaderutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) toyball.o shaderutil.o $(LIBS) -o $@
|
||||
|
||||
|
||||
twoside.o: twoside.c extfuncs.h shaderutil.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) twoside.c
|
||||
|
||||
twoside: twoside.o shaderutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) twoside.o shaderutil.o $(LIBS) -o $@
|
||||
|
||||
|
||||
trirast.o: trirast.c extfuncs.h shaderutil.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) trirast.c
|
||||
|
||||
trirast: trirast.o shaderutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) trirast.o shaderutil.o $(LIBS) -o $@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
-rm -f $(PROGS)
|
||||
-rm -f *.o *~
|
||||
-rm -f extfuncs.h
|
||||
-rm -f shaderutil.*
|
||||
|
||||
@@ -1,323 +0,0 @@
|
||||
/**
|
||||
* Implement glRasterPos + glBitmap with textures + shaders.
|
||||
* Brian Paul
|
||||
* 14 May 2007
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
static GLuint FragShader;
|
||||
static GLuint VertShader;
|
||||
static GLuint Program;
|
||||
|
||||
static GLint Win = 0;
|
||||
static GLint WinWidth = 500, WinHeight = 500;
|
||||
static GLboolean Anim = GL_TRUE;
|
||||
static GLboolean Bitmap = GL_FALSE;
|
||||
static GLfloat Xrot = 20.0f, Yrot = 70.0f;
|
||||
static GLint uTex, uScale;
|
||||
static GLuint Textures[2];
|
||||
|
||||
#define TEX_WIDTH 16
|
||||
#define TEX_HEIGHT 8
|
||||
|
||||
|
||||
static void
|
||||
BitmapText(const char *s)
|
||||
{
|
||||
while (*s) {
|
||||
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Redisplay(void)
|
||||
{
|
||||
static const GLfloat px[3] = { 1.2, 0, 0};
|
||||
static const GLfloat nx[3] = {-1.2, 0, 0};
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(Xrot, 1.0f, 0.0f, 0.0f);
|
||||
glRotatef(Yrot, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
|
||||
glPushMatrix();
|
||||
glScalef(0.5, 0.5, 0.5);
|
||||
glutSolidDodecahedron();
|
||||
glPopMatrix();
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
|
||||
glColor3f(0, 1, 0);
|
||||
glBegin(GL_LINES);
|
||||
glVertex3f(-1, 0, 0);
|
||||
glVertex3f( 1, 0, 0);
|
||||
glEnd();
|
||||
|
||||
glColor3f(1, 1, 0);
|
||||
|
||||
if (Bitmap) {
|
||||
glRasterPos3fv(px);
|
||||
BitmapText("+X");
|
||||
glRasterPos3fv(nx);
|
||||
BitmapText("-X");
|
||||
}
|
||||
else {
|
||||
glUseProgram_func(Program);
|
||||
|
||||
/* vertex positions (deltas) depend on texture size and window size */
|
||||
if (uScale != -1) {
|
||||
glUniform2f_func(uScale,
|
||||
2.0 * TEX_WIDTH / WinWidth,
|
||||
2.0 * TEX_HEIGHT / WinHeight);
|
||||
}
|
||||
|
||||
/* draw +X */
|
||||
glBindTexture(GL_TEXTURE_2D, Textures[0]);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0); glVertex3fv(px);
|
||||
glTexCoord2f(1, 0); glVertex3fv(px);
|
||||
glTexCoord2f(1, 1); glVertex3fv(px);
|
||||
glTexCoord2f(0, 1); glVertex3fv(px);
|
||||
glEnd();
|
||||
|
||||
/* draw -X */
|
||||
glBindTexture(GL_TEXTURE_2D, Textures[1]);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0); glVertex3fv(nx);
|
||||
glTexCoord2f(1, 0); glVertex3fv(nx);
|
||||
glTexCoord2f(1, 1); glVertex3fv(nx);
|
||||
glTexCoord2f(0, 1); glVertex3fv(nx);
|
||||
glEnd();
|
||||
|
||||
glUseProgram_func(0);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Idle(void)
|
||||
{
|
||||
Yrot = glutGet(GLUT_ELAPSED_TIME) * 0.01;
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape(int width, int height)
|
||||
{
|
||||
WinWidth = width;
|
||||
WinHeight = height;
|
||||
glViewport(0, 0, width, height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0f, 0.0f, -10.0f);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Key(unsigned char key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
|
||||
switch(key) {
|
||||
case ' ':
|
||||
case 'a':
|
||||
Anim = !Anim;
|
||||
if (Anim)
|
||||
glutIdleFunc(Idle);
|
||||
else
|
||||
glutIdleFunc(NULL);
|
||||
break;
|
||||
case 'b':
|
||||
Bitmap = !Bitmap;
|
||||
if (Bitmap)
|
||||
printf("Using glBitmap\n");
|
||||
else
|
||||
printf("Using billboard texture\n");
|
||||
break;
|
||||
case 27:
|
||||
glDeleteShader_func(FragShader);
|
||||
glDeleteShader_func(VertShader);
|
||||
glDeleteProgram_func(Program);
|
||||
glutDestroyWindow(Win);
|
||||
exit(0);
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
SpecialKey(int key, int x, int y)
|
||||
{
|
||||
const GLfloat step = 0.125f;
|
||||
switch(key) {
|
||||
case GLUT_KEY_UP:
|
||||
Xrot -= step;
|
||||
break;
|
||||
case GLUT_KEY_DOWN:
|
||||
Xrot += step;
|
||||
break;
|
||||
case GLUT_KEY_LEFT:
|
||||
Yrot -= step;
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
Yrot += step;
|
||||
break;
|
||||
}
|
||||
/*printf("Xrot: %f Yrot: %f\n", Xrot, Yrot);*/
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
MakeTexImage(const char *p, GLuint texobj)
|
||||
{
|
||||
GLubyte image[TEX_HEIGHT][TEX_WIDTH];
|
||||
GLuint i, j, k;
|
||||
|
||||
for (i = 0; i < TEX_HEIGHT; i++) {
|
||||
for (j = 0; j < TEX_WIDTH; j++) {
|
||||
k = i * TEX_WIDTH + j;
|
||||
if (p[k] == ' ') {
|
||||
image[i][j] = 0;
|
||||
}
|
||||
else {
|
||||
image[i][j] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texobj);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY, TEX_WIDTH, TEX_HEIGHT, 0,
|
||||
GL_RED, GL_UNSIGNED_BYTE, image);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
MakeBitmapTextures(void)
|
||||
{
|
||||
const char *px =
|
||||
" X X "
|
||||
" X X X "
|
||||
" X X X "
|
||||
" XXXXX X "
|
||||
" X X X "
|
||||
" X X X "
|
||||
" X X "
|
||||
" X X ";
|
||||
const char *nx =
|
||||
" X X "
|
||||
" X X "
|
||||
" X X "
|
||||
" XXXXX X "
|
||||
" X X "
|
||||
" X X "
|
||||
" X X "
|
||||
" X X ";
|
||||
glGenTextures(2, Textures);
|
||||
MakeTexImage(px, Textures[0]);
|
||||
MakeTexImage(nx, Textures[1]);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
/* Fragment shader: modulate raster color by texture, discard fragments
|
||||
* with alpha < 1.0
|
||||
*/
|
||||
static const char *fragShaderText =
|
||||
"uniform sampler2D tex2d; \n"
|
||||
"void main() {\n"
|
||||
" vec4 c = texture2D(tex2d, gl_TexCoord[0].xy); \n"
|
||||
" if (c.w < 1.0) \n"
|
||||
" discard; \n"
|
||||
" gl_FragColor = c * gl_Color; \n"
|
||||
"}\n";
|
||||
/* Vertex shader: compute new vertex position based on incoming vertex pos,
|
||||
* texcoords and special scale factor.
|
||||
*/
|
||||
static const char *vertShaderText =
|
||||
"uniform vec2 scale; \n"
|
||||
"void main() {\n"
|
||||
" vec4 p = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||
" gl_Position.xy = p.xy + gl_MultiTexCoord0.xy * scale * p.w; \n"
|
||||
" gl_Position.zw = p.zw; \n"
|
||||
" gl_TexCoord[0] = gl_MultiTexCoord0; \n"
|
||||
" gl_FrontColor = gl_Color; \n"
|
||||
"}\n";
|
||||
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
|
||||
FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
|
||||
Program = LinkShaders(VertShader, FragShader);
|
||||
|
||||
glUseProgram_func(Program);
|
||||
|
||||
uScale = glGetUniformLocation_func(Program, "scale");
|
||||
uTex = glGetUniformLocation_func(Program, "tex2d");
|
||||
if (uTex != -1) {
|
||||
glUniform1i_func(uTex, 0); /* tex unit 0 */
|
||||
}
|
||||
|
||||
glUseProgram_func(0);
|
||||
|
||||
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_NORMALIZE);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
||||
MakeBitmapTextures();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
glutDisplayFunc(Redisplay);
|
||||
if (Anim)
|
||||
glutIdleFunc(Idle);
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
static char *FragProgFile = "CH06-brick.frag.txt";
|
||||
@@ -24,15 +23,23 @@ static GLuint fragShader;
|
||||
static GLuint vertShader;
|
||||
static GLuint program;
|
||||
|
||||
|
||||
struct uniform_info {
|
||||
const char *name;
|
||||
GLuint size;
|
||||
GLint location;
|
||||
GLfloat value[4];
|
||||
};
|
||||
|
||||
static struct uniform_info Uniforms[] = {
|
||||
/* vert */
|
||||
{ "LightPosition", 3, GL_FLOAT, { 0.1, 0.1, 9.0, 0}, -1 },
|
||||
{ "LightPosition", 3, -1, { 0.1, 0.1, 9.0, 0} },
|
||||
/* frag */
|
||||
{ "BrickColor", 3, GL_FLOAT, { 0.8, 0.2, 0.2, 0 }, -1 },
|
||||
{ "MortarColor", 3, GL_FLOAT, { 0.6, 0.6, 0.6, 0 }, -1 },
|
||||
{ "BrickSize", 2, GL_FLOAT, { 1.0, 0.3, 0, 0 }, -1 },
|
||||
{ "BrickPct", 2, GL_FLOAT, { 0.9, 0.8, 0, 0 }, -1 },
|
||||
END_OF_UNIFORMS
|
||||
{ "BrickColor", 3, -1, { 0.8, 0.2, 0.2, 0 } },
|
||||
{ "MortarColor", 3, -1, { 0.6, 0.6, 0.6, 0 } },
|
||||
{ "BrickSize", 2, -1, { 1.0, 0.3, 0, 0 } },
|
||||
{ "BrickPct", 2, -1, { 0.9, 0.8, 0, 0 } },
|
||||
{ NULL, 0, 0, { 0, 0, 0, 0 } }
|
||||
};
|
||||
|
||||
static GLint win = 0;
|
||||
@@ -138,21 +145,122 @@ SpecialKey(int key, int x, int y)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
LoadAndCompileShader(GLuint shader, const char *text)
|
||||
{
|
||||
GLint stat;
|
||||
|
||||
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
|
||||
|
||||
glCompileShader_func(shader);
|
||||
|
||||
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog_func(shader, 1000, &len, log);
|
||||
fprintf(stderr, "brick: problem compiling shader: %s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
printf("Shader compiled OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read a shader from a file.
|
||||
*/
|
||||
static void
|
||||
ReadShader(GLuint shader, const char *filename)
|
||||
{
|
||||
const int max = 100*1000;
|
||||
int n;
|
||||
char *buffer = (char*) malloc(max);
|
||||
FILE *f = fopen(filename, "r");
|
||||
if (!f) {
|
||||
fprintf(stderr, "brick: Unable to open shader file %s\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
n = fread(buffer, 1, max, f);
|
||||
printf("brick: read %d bytes from shader file %s\n", n, filename);
|
||||
if (n > 0) {
|
||||
buffer[n] = 0;
|
||||
LoadAndCompileShader(shader, buffer);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CheckLink(GLuint prog)
|
||||
{
|
||||
GLint stat;
|
||||
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog_func(prog, 1000, &len, log);
|
||||
fprintf(stderr, "Linker error:\n%s\n", log);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Link success!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
const char *version;
|
||||
GLint i;
|
||||
|
||||
version = (const char *) glGetString(GL_VERSION);
|
||||
if (version[0] != '2' || version[1] != '.') {
|
||||
printf("Warning: this program expects OpenGL 2.0\n");
|
||||
/*exit(1);*/
|
||||
}
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
|
||||
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
|
||||
ReadShader(vertShader, VertProgFile);
|
||||
|
||||
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
|
||||
ReadShader(fragShader, FragProgFile);
|
||||
|
||||
program = glCreateProgram_func();
|
||||
glAttachShader_func(program, fragShader);
|
||||
glAttachShader_func(program, vertShader);
|
||||
glLinkProgram_func(program);
|
||||
CheckLink(program);
|
||||
glUseProgram_func(program);
|
||||
|
||||
InitUniforms(program, Uniforms);
|
||||
for (i = 0; Uniforms[i].name; i++) {
|
||||
Uniforms[i].location
|
||||
= glGetUniformLocation_func(program, Uniforms[i].name);
|
||||
printf("Uniform %s location: %d\n", Uniforms[i].name,
|
||||
Uniforms[i].location);
|
||||
switch (Uniforms[i].size) {
|
||||
case 1:
|
||||
glUniform1fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 2:
|
||||
glUniform2fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 3:
|
||||
glUniform3fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 4:
|
||||
glUniform4fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
assert(glGetError() == 0);
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <GL/glu.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
static char *FragProgFile = "CH11-bumpmap.frag.txt";
|
||||
@@ -25,13 +24,20 @@ static GLuint vertShader;
|
||||
static GLuint program;
|
||||
|
||||
|
||||
struct uniform_info {
|
||||
const char *name;
|
||||
GLuint size;
|
||||
GLint location;
|
||||
GLfloat value[4];
|
||||
};
|
||||
|
||||
static struct uniform_info Uniforms[] = {
|
||||
{ "LightPosition", 3, GL_FLOAT, { 0.57737, 0.57735, 0.57735, 0.0 }, -1 },
|
||||
{ "SurfaceColor", 3, GL_FLOAT, { 0.8, 0.8, 0.2, 0 }, -1 },
|
||||
{ "BumpDensity", 1, GL_FLOAT, { 10.0, 0, 0, 0 }, -1 },
|
||||
{ "BumpSize", 1, GL_FLOAT, { 0.125, 0, 0, 0 }, -1 },
|
||||
{ "SpecularFactor", 1, GL_FLOAT, { 0.5, 0, 0, 0 }, -1 },
|
||||
END_OF_UNIFORMS
|
||||
{ "LightPosition", 3, -1, { 0.57737, 0.57735, 0.57735, 0.0 } },
|
||||
{ "SurfaceColor", 3, -1, { 0.8, 0.8, 0.2, 0 } },
|
||||
{ "BumpDensity", 1, -1, { 10.0, 0, 0, 0 } },
|
||||
{ "BumpSize", 1, -1, { 0.125, 0, 0, 0 } },
|
||||
{ "SpecularFactor", 1, -1, { 0.5, 0, 0, 0 } },
|
||||
{ NULL, 0, 0, { 0, 0, 0, 0 } }
|
||||
};
|
||||
|
||||
static GLint win = 0;
|
||||
@@ -226,18 +232,100 @@ SpecialKey(int key, int x, int y)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
LoadAndCompileShader(GLuint shader, const char *text)
|
||||
{
|
||||
GLint stat;
|
||||
|
||||
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
|
||||
|
||||
glCompileShader_func(shader);
|
||||
|
||||
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog_func(shader, 1000, &len, log);
|
||||
fprintf(stderr, "bump: problem compiling shader: %s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
printf("Shader compiled OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read a shader from a file.
|
||||
*/
|
||||
static void
|
||||
ReadShader(GLuint shader, const char *filename)
|
||||
{
|
||||
const int max = 100*1000;
|
||||
int n;
|
||||
char *buffer = (char*) malloc(max);
|
||||
FILE *f = fopen(filename, "r");
|
||||
if (!f) {
|
||||
fprintf(stderr, "bump: Unable to open shader file %s\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
n = fread(buffer, 1, max, f);
|
||||
printf("bump: read %d bytes from shader file %s\n", n, filename);
|
||||
if (n > 0) {
|
||||
buffer[n] = 0;
|
||||
LoadAndCompileShader(shader, buffer);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CheckLink(GLuint prog)
|
||||
{
|
||||
GLint stat;
|
||||
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog_func(prog, 1000, &len, log);
|
||||
fprintf(stderr, "Linker error:\n%s\n", log);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Link success!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
const char *version;
|
||||
GLint i;
|
||||
|
||||
version = (const char *) glGetString(GL_VERSION);
|
||||
if (version[0] != '2' || version[1] != '.') {
|
||||
printf("Warning: this program expects OpenGL 2.0\n");
|
||||
/*exit(1);*/
|
||||
}
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
|
||||
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
|
||||
ReadShader(vertShader, VertProgFile);
|
||||
|
||||
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
|
||||
ReadShader(fragShader, FragProgFile);
|
||||
|
||||
program = glCreateProgram_func();
|
||||
glAttachShader_func(program, fragShader);
|
||||
glAttachShader_func(program, vertShader);
|
||||
glLinkProgram_func(program);
|
||||
CheckLink(program);
|
||||
glUseProgram_func(program);
|
||||
|
||||
assert(glIsProgram_func(program));
|
||||
@@ -248,7 +336,28 @@ Init(void)
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
InitUniforms(program, Uniforms);
|
||||
for (i = 0; Uniforms[i].name; i++) {
|
||||
Uniforms[i].location
|
||||
= glGetUniformLocation_func(program, Uniforms[i].name);
|
||||
printf("Uniform %s location: %d\n", Uniforms[i].name,
|
||||
Uniforms[i].location);
|
||||
switch (Uniforms[i].size) {
|
||||
case 1:
|
||||
glUniform1fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 2:
|
||||
glUniform2fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 3:
|
||||
glUniform3fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 4:
|
||||
glUniform4fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
static char *FragProgFile = NULL;
|
||||
@@ -160,6 +159,68 @@ MakeRect(void)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
LoadAndCompileShader(GLuint shader, const char *text)
|
||||
{
|
||||
GLint stat;
|
||||
|
||||
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
|
||||
|
||||
glCompileShader_func(shader);
|
||||
|
||||
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog_func(shader, 1000, &len, log);
|
||||
fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read a shader from a file.
|
||||
*/
|
||||
static void
|
||||
ReadShader(GLuint shader, const char *filename)
|
||||
{
|
||||
const int max = 100*1000;
|
||||
int n;
|
||||
char *buffer = (char*) malloc(max);
|
||||
FILE *f = fopen(filename, "r");
|
||||
if (!f) {
|
||||
fprintf(stderr, "fslight: Unable to open shader file %s\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
n = fread(buffer, 1, max, f);
|
||||
printf("fslight: read %d bytes from shader file %s\n", n, filename);
|
||||
if (n > 0) {
|
||||
buffer[n] = 0;
|
||||
LoadAndCompileShader(shader, buffer);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CheckLink(GLuint prog)
|
||||
{
|
||||
GLint stat;
|
||||
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog_func(prog, 1000, &len, log);
|
||||
fprintf(stderr, "Linker error:\n%s\n", log);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
@@ -173,16 +234,33 @@ Init(void)
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||
" gl_TexCoord[0] = gl_MultiTexCoord0;\n"
|
||||
"}\n";
|
||||
const char *version;
|
||||
|
||||
if (!ShadersSupported())
|
||||
version = (const char *) glGetString(GL_VERSION);
|
||||
if (version[0] != '2' || version[1] != '.') {
|
||||
printf("This program requires OpenGL 2.x, found %s\n", version);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
|
||||
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
|
||||
if (FragProgFile)
|
||||
ReadShader(fragShader, FragProgFile);
|
||||
else
|
||||
LoadAndCompileShader(fragShader, fragShaderText);
|
||||
|
||||
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
|
||||
if (VertProgFile)
|
||||
ReadShader(vertShader, VertProgFile);
|
||||
else
|
||||
LoadAndCompileShader(vertShader, vertShaderText);
|
||||
|
||||
program = glCreateProgram_func();
|
||||
glAttachShader_func(program, fragShader);
|
||||
glAttachShader_func(program, vertShader);
|
||||
glLinkProgram_func(program);
|
||||
CheckLink(program);
|
||||
glUseProgram_func(program);
|
||||
|
||||
/*assert(glGetError() == 0);*/
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
static char *FragProgFile = "CH18-mandel.frag.txt";
|
||||
@@ -25,21 +24,28 @@ static GLuint vertShader;
|
||||
static GLuint program;
|
||||
|
||||
|
||||
struct uniform_info {
|
||||
const char *name;
|
||||
GLuint size;
|
||||
GLint location;
|
||||
GLfloat value[4];
|
||||
};
|
||||
|
||||
static struct uniform_info Uniforms[] = {
|
||||
/* vert */
|
||||
{ "LightPosition", 3, GL_FLOAT, { 0.1, 0.1, 9.0, 0}, -1 },
|
||||
{ "SpecularContribution", 1, GL_FLOAT, { 0.5, 0, 0, 0 }, -1 },
|
||||
{ "DiffuseContribution", 1, GL_FLOAT, { 0.5, 0, 0, 0 }, -1 },
|
||||
{ "Shininess", 1, GL_FLOAT, { 20.0, 0, 0, 0 }, -1 },
|
||||
{ "LightPosition", 3, -1, { 0.1, 0.1, 9.0, 0} },
|
||||
{ "SpecularContribution", 1, -1, { 0.5, 0, 0, 0 } },
|
||||
{ "DiffuseContribution", 1, -1, { 0.5, 0, 0, 0 } },
|
||||
{ "Shininess", 1, -1, { 20.0, 0, 0, 0 } },
|
||||
/* frag */
|
||||
{ "MaxIterations", 1, GL_FLOAT, { 12, 0, 0, 0 }, -1 },
|
||||
{ "Zoom", 1, GL_FLOAT, { 0.125, 0, 0, 0 }, -1 },
|
||||
{ "Xcenter", 1, GL_FLOAT, { -1.5, 0, 0, 0 }, -1 },
|
||||
{ "Ycenter", 1, GL_FLOAT, { .005, 0, 0, 0 }, -1 },
|
||||
{ "InnerColor", 3, GL_FLOAT, { 1, 0, 0, 0 }, -1 },
|
||||
{ "OuterColor1", 3, GL_FLOAT, { 0, 1, 0, 0 }, -1 },
|
||||
{ "OuterColor2", 3, GL_FLOAT, { 0, 0, 1, 0 }, -1 },
|
||||
END_OF_UNIFORMS
|
||||
{ "MaxIterations", 1, -1, { 12, 0, 0, 0 } },
|
||||
{ "Zoom", 1, -1, { 0.125, 0, 0, 0 } },
|
||||
{ "Xcenter", 1, -1, { -1.5, 0, 0, 0 } },
|
||||
{ "Ycenter", 1, -1, { .005, 0, 0, 0 } },
|
||||
{ "InnerColor", 3, -1, { 1, 0, 0, 0 } },
|
||||
{ "OuterColor1", 3, -1, { 0, 1, 0, 0 } },
|
||||
{ "OuterColor2", 3, -1, { 0, 0, 1, 0 } },
|
||||
{ NULL, 0, 0, { 0, 0, 0, 0 } }
|
||||
};
|
||||
|
||||
static GLint win = 0;
|
||||
@@ -151,21 +157,123 @@ SpecialKey(int key, int x, int y)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
LoadAndCompileShader(GLuint shader, const char *text)
|
||||
{
|
||||
GLint stat;
|
||||
|
||||
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
|
||||
|
||||
glCompileShader_func(shader);
|
||||
|
||||
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog_func(shader, 1000, &len, log);
|
||||
fprintf(stderr, "mandelbrot: problem compiling shader: %s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
printf("Shader compiled OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read a shader from a file.
|
||||
*/
|
||||
static void
|
||||
ReadShader(GLuint shader, const char *filename)
|
||||
{
|
||||
const int max = 100*1000;
|
||||
int n;
|
||||
char *buffer = (char*) malloc(max);
|
||||
FILE *f = fopen(filename, "r");
|
||||
if (!f) {
|
||||
fprintf(stderr, "mandelbrot: Unable to open shader file %s\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
n = fread(buffer, 1, max, f);
|
||||
printf("mandelbrot: read %d bytes from shader file %s\n", n, filename);
|
||||
if (n > 0) {
|
||||
buffer[n] = 0;
|
||||
LoadAndCompileShader(shader, buffer);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CheckLink(GLuint prog)
|
||||
{
|
||||
GLint stat;
|
||||
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog_func(prog, 1000, &len, log);
|
||||
fprintf(stderr, "Linker error:\n%s\n", log);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Link success!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
const char *version;
|
||||
GLint i;
|
||||
|
||||
version = (const char *) glGetString(GL_VERSION);
|
||||
if (version[0] != '2' || version[1] != '.') {
|
||||
printf("Warning: this program expects OpenGL 2.0\n");
|
||||
/*exit(1);*/
|
||||
}
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
|
||||
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
|
||||
ReadShader(vertShader, VertProgFile);
|
||||
|
||||
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
|
||||
ReadShader(fragShader, FragProgFile);
|
||||
|
||||
program = glCreateProgram_func();
|
||||
glAttachShader_func(program, fragShader);
|
||||
glAttachShader_func(program, vertShader);
|
||||
glLinkProgram_func(program);
|
||||
CheckLink(program);
|
||||
glUseProgram_func(program);
|
||||
|
||||
InitUniforms(program, Uniforms);
|
||||
for (i = 0; Uniforms[i].name; i++) {
|
||||
Uniforms[i].location
|
||||
= glGetUniformLocation_func(program, Uniforms[i].name);
|
||||
printf("Uniform %s location: %d\n", Uniforms[i].name,
|
||||
Uniforms[i].location);
|
||||
switch (Uniforms[i].size) {
|
||||
case 1:
|
||||
glUniform1fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 2:
|
||||
glUniform2fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 3:
|
||||
glUniform3fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 4:
|
||||
glUniform4fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
uZoom = glGetUniformLocation_func(program, "Zoom");
|
||||
uXcenter = glGetUniformLocation_func(program, "Xcenter");
|
||||
|
||||
@@ -1,285 +0,0 @@
|
||||
/**
|
||||
* Test multi-texturing with GL shading language.
|
||||
*
|
||||
* Copyright (C) 2008 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "GL/glut.h"
|
||||
#include "readtex.h"
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
static const char *Demo = "multitex";
|
||||
|
||||
static const char *VertFile = "multitex.vert.txt";
|
||||
static const char *FragFile = "multitex.frag.txt";
|
||||
|
||||
static const char *TexFiles[2] =
|
||||
{
|
||||
"../images/tile.rgb",
|
||||
"../images/tree2.rgba"
|
||||
};
|
||||
|
||||
|
||||
static GLuint Program;
|
||||
|
||||
static GLfloat Xrot = -90.0, Yrot = .0, Zrot = 0.0;
|
||||
static GLfloat EyeDist = 10;
|
||||
static GLboolean Anim = GL_TRUE;
|
||||
|
||||
|
||||
/* value[0] = tex unit */
|
||||
static struct uniform_info Uniforms[] = {
|
||||
{ "tex1", 1, GL_INT, { 0, 0, 0, 0 }, -1 },
|
||||
{ "tex2", 1, GL_INT, { 1, 0, 0, 0 }, -1 },
|
||||
END_OF_UNIFORMS
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
DrawPolygon(GLfloat size)
|
||||
{
|
||||
glPushMatrix();
|
||||
glRotatef(90, 1, 0, 0);
|
||||
glNormal3f(0, 0, 1);
|
||||
glBegin(GL_POLYGON);
|
||||
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 0, 0);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, 0, 0);
|
||||
glVertex2f(-size, -size);
|
||||
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 2, 0);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, 1, 0);
|
||||
glVertex2f( size, -size);
|
||||
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 2, 2);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, 1, 1);
|
||||
glVertex2f( size, size);
|
||||
|
||||
glMultiTexCoord2f(GL_TEXTURE0, 0, 2);
|
||||
glMultiTexCoord2f(GL_TEXTURE1, 0, 1);
|
||||
glVertex2f(-size, size);
|
||||
|
||||
glEnd();
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix(); /* modelview matrix */
|
||||
glTranslatef(0.0, 0.0, -EyeDist);
|
||||
glRotatef(Zrot, 0, 0, 1);
|
||||
glRotatef(Yrot, 0, 1, 0);
|
||||
glRotatef(Xrot, 1, 0, 0);
|
||||
|
||||
DrawPolygon(3.0);
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
idle(void)
|
||||
{
|
||||
GLfloat t = 0.05 * glutGet(GLUT_ELAPSED_TIME);
|
||||
Yrot = t;
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
key(unsigned char k, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (k) {
|
||||
case ' ':
|
||||
case 'a':
|
||||
Anim = !Anim;
|
||||
if (Anim)
|
||||
glutIdleFunc(idle);
|
||||
else
|
||||
glutIdleFunc(NULL);
|
||||
break;
|
||||
case 'z':
|
||||
EyeDist -= 0.5;
|
||||
if (EyeDist < 3.0)
|
||||
EyeDist = 3.0;
|
||||
break;
|
||||
case 'Z':
|
||||
EyeDist += 0.5;
|
||||
if (EyeDist > 90.0)
|
||||
EyeDist = 90;
|
||||
break;
|
||||
case 27:
|
||||
exit(0);
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
specialkey(int key, int x, int y)
|
||||
{
|
||||
GLfloat step = 2.0;
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case GLUT_KEY_UP:
|
||||
Xrot += step;
|
||||
break;
|
||||
case GLUT_KEY_DOWN:
|
||||
Xrot -= step;
|
||||
break;
|
||||
case GLUT_KEY_LEFT:
|
||||
Yrot -= step;
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
Yrot += step;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
Reshape(int width, int height)
|
||||
{
|
||||
GLfloat ar = (float) width / (float) height;
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-2.0*ar, 2.0*ar, -2.0, 2.0, 4.0, 100.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
InitTextures(void)
|
||||
{
|
||||
GLenum filter = GL_LINEAR;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
GLint imgWidth, imgHeight;
|
||||
GLenum imgFormat;
|
||||
GLubyte *image = NULL;
|
||||
|
||||
image = LoadRGBImage(TexFiles[i], &imgWidth, &imgHeight, &imgFormat);
|
||||
if (!image) {
|
||||
printf("Couldn't read %s\n", TexFiles[i]);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE0 + i);
|
||||
glBindTexture(GL_TEXTURE_2D, 42 + i);
|
||||
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, imgWidth, imgHeight,
|
||||
imgFormat, GL_UNSIGNED_BYTE, image);
|
||||
free(image);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static GLuint
|
||||
CreateProgram(const char *vertProgFile, const char *fragProgFile,
|
||||
struct uniform_info *uniforms)
|
||||
{
|
||||
GLuint fragShader, vertShader, program;
|
||||
|
||||
vertShader = CompileShaderFile(GL_VERTEX_SHADER, vertProgFile);
|
||||
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, fragProgFile);
|
||||
assert(vertShader);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
|
||||
InitUniforms(program, uniforms);
|
||||
|
||||
return program;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
InitPrograms(void)
|
||||
{
|
||||
Program = CreateProgram(VertFile, FragFile, Uniforms);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
InitGL(void)
|
||||
{
|
||||
const char *version = (const char *) glGetString(GL_VERSION);
|
||||
|
||||
if (version[0] != '2' || version[1] != '.') {
|
||||
printf("Warning: this program expects OpenGL 2.0\n");
|
||||
/*exit(1);*/
|
||||
}
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
InitTextures();
|
||||
InitPrograms();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glClearColor(.6, .6, .9, 0);
|
||||
glColor3f(1.0, 1.0, 1.0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowSize(500, 400);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
|
||||
glutCreateWindow(Demo);
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(key);
|
||||
glutSpecialFunc(specialkey);
|
||||
glutDisplayFunc(draw);
|
||||
if (Anim)
|
||||
glutIdleFunc(idle);
|
||||
InitGL();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// Multi-texture fragment shader
|
||||
// Brian Paul
|
||||
|
||||
// Composite second texture over first.
|
||||
// We're assuming the 2nd texture has a meaningful alpha channel.
|
||||
|
||||
uniform sampler2D tex1;
|
||||
uniform sampler2D tex2;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 t1 = texture2D(tex1, gl_TexCoord[0].xy, 0.0);
|
||||
vec4 t2 = texture2D(tex2, gl_TexCoord[1].xy, 0.0);
|
||||
gl_FragColor = mix(t1, t2, t2.w);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// Multi-texture vertex shader
|
||||
// Brian Paul
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_TexCoord[1] = gl_MultiTexCoord1;
|
||||
gl_Position = ftransform();
|
||||
}
|
||||
@@ -12,7 +12,6 @@
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
static const char *VertShaderText =
|
||||
@@ -35,11 +34,18 @@ static const char *FragShaderText =
|
||||
"}\n";
|
||||
|
||||
|
||||
struct uniform_info {
|
||||
const char *name;
|
||||
GLuint size;
|
||||
GLint location;
|
||||
GLfloat value[4];
|
||||
};
|
||||
|
||||
static struct uniform_info Uniforms[] = {
|
||||
{ "Scale", 4, GL_FLOAT, { 0.5, 0.4, 0.0, 0}, -1 },
|
||||
{ "Bias", 4, GL_FLOAT, { 0.5, 0.3, 0.0, 0}, -1 },
|
||||
{ "Slice", 1, GL_FLOAT, { 0.5, 0, 0, 0}, -1 },
|
||||
END_OF_UNIFORMS
|
||||
{ "Scale", 4, -1, { 0.5, 0.4, 0.0, 0} },
|
||||
{ "Bias", 4, -1, { 0.5, 0.3, 0.0, 0} },
|
||||
{ "Slice", 1, -1, { 0.5, 0, 0, 0} },
|
||||
{ NULL, 0, 0, { 0, 0, 0, 0 } }
|
||||
};
|
||||
|
||||
/* program/shader objects */
|
||||
@@ -168,21 +174,95 @@ SpecialKey(int key, int x, int y)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
LoadAndCompileShader(GLuint shader, const char *text)
|
||||
{
|
||||
GLint stat;
|
||||
|
||||
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
|
||||
|
||||
glCompileShader_func(shader);
|
||||
|
||||
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog_func(shader, 1000, &len, log);
|
||||
fprintf(stderr, "noise: problem compiling shader: %s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
printf("Shader compiled OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CheckLink(GLuint prog)
|
||||
{
|
||||
GLint stat;
|
||||
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog_func(prog, 1000, &len, log);
|
||||
fprintf(stderr, "Linker error:\n%s\n", log);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Link success!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
const char *version;
|
||||
GLint i;
|
||||
|
||||
version = (const char *) glGetString(GL_VERSION);
|
||||
if (version[0] != '2' || version[1] != '.') {
|
||||
printf("Warning: this program expects OpenGL 2.0\n");
|
||||
/*exit(1);*/
|
||||
}
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderText(GL_VERTEX_SHADER, VertShaderText);
|
||||
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderText);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
|
||||
LoadAndCompileShader(vertShader, VertShaderText);
|
||||
|
||||
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
|
||||
LoadAndCompileShader(fragShader, FragShaderText);
|
||||
|
||||
program = glCreateProgram_func();
|
||||
glAttachShader_func(program, fragShader);
|
||||
glAttachShader_func(program, vertShader);
|
||||
glLinkProgram_func(program);
|
||||
CheckLink(program);
|
||||
glUseProgram_func(program);
|
||||
|
||||
InitUniforms(program, Uniforms);
|
||||
for (i = 0; Uniforms[i].name; i++) {
|
||||
Uniforms[i].location
|
||||
= glGetUniformLocation_func(program, Uniforms[i].name);
|
||||
printf("Uniform %s location: %d\n", Uniforms[i].name,
|
||||
Uniforms[i].location);
|
||||
switch (Uniforms[i].size) {
|
||||
case 1:
|
||||
glUniform1fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 2:
|
||||
glUniform2fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 3:
|
||||
glUniform3fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 4:
|
||||
glUniform4fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
assert(glGetError() == 0);
|
||||
|
||||
|
||||
@@ -1,260 +0,0 @@
|
||||
/**
|
||||
* Implement smooth (AA) points with shaders.
|
||||
* A simple variation could be used for sprite points.
|
||||
* Brian Paul
|
||||
* 29 July 2007
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
static GLuint FragShader;
|
||||
static GLuint VertShader;
|
||||
static GLuint Program;
|
||||
|
||||
static GLint Win = 0;
|
||||
static GLint WinWidth = 500, WinHeight = 200;
|
||||
static GLfloat Xpos = 0.0f, Ypos = 0.0f;
|
||||
static GLint uViewportInv;
|
||||
static GLboolean Smooth = GL_TRUE, Blend = GL_TRUE;
|
||||
|
||||
|
||||
/**
|
||||
* Issue vertices for a "shader point".
|
||||
* The position is duplicated, only texcoords (or other vertex attrib) change.
|
||||
* The vertex program will compute the "real" quad corners.
|
||||
*/
|
||||
static void
|
||||
PointVertex3f(GLfloat x, GLfloat y, GLfloat z)
|
||||
{
|
||||
glTexCoord2f(-1, -1);
|
||||
glVertex3f(x, y, z);
|
||||
|
||||
glTexCoord2f( 1, -1);
|
||||
glVertex3f(x, y, z);
|
||||
|
||||
glTexCoord2f( 1, 1);
|
||||
glVertex3f(x, y, z);
|
||||
|
||||
glTexCoord2f(-1, 1);
|
||||
glVertex3f(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
DrawPoints(GLboolean shaderPoints)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 9; i++) {
|
||||
GLfloat x = i - 4, y = 0, z = 0;
|
||||
/* note: can't call glPointSize inside Begin/End :( */
|
||||
glPointSize( 2 + i * 5 );
|
||||
if (shaderPoints) {
|
||||
glBegin(GL_QUADS);
|
||||
PointVertex3f(x, y, z);
|
||||
glEnd();
|
||||
}
|
||||
else {
|
||||
glBegin(GL_POINTS);
|
||||
glVertex3f(x, y, z);
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Top row of points rendered convetionally,
|
||||
* bottom row rendered with shaders.
|
||||
*/
|
||||
static void
|
||||
Redisplay(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
if (Smooth)
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
else
|
||||
glDisable(GL_POINT_SMOOTH);
|
||||
|
||||
if (Blend)
|
||||
glEnable(GL_BLEND);
|
||||
else
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(Xpos, Ypos, 0);
|
||||
|
||||
/*
|
||||
* regular points
|
||||
*/
|
||||
glPushMatrix();
|
||||
glTranslatef(0, 1.2, 0);
|
||||
glUseProgram_func(0);
|
||||
DrawPoints(GL_FALSE);
|
||||
glPopMatrix();
|
||||
|
||||
/*
|
||||
* shader points
|
||||
*/
|
||||
glPushMatrix();
|
||||
glTranslatef(0, -1.2, 0);
|
||||
glUseProgram_func(Program);
|
||||
if (uViewportInv != -1) {
|
||||
glUniform2f_func(uViewportInv, 1.0 / WinWidth, 1.0 / WinHeight);
|
||||
}
|
||||
DrawPoints(GL_TRUE);
|
||||
glPopMatrix();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape(int width, int height)
|
||||
{
|
||||
WinWidth = width;
|
||||
WinHeight = height;
|
||||
glViewport(0, 0, width, height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-1.0, 1.0, -1.0, 1.0, 4.0, 30.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0f, 0.0f, -20.0f);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Key(unsigned char key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
|
||||
switch(key) {
|
||||
case 'b':
|
||||
Blend = !Blend;
|
||||
break;
|
||||
case 's':
|
||||
Smooth = !Smooth;
|
||||
break;
|
||||
case 27:
|
||||
glDeleteShader_func(FragShader);
|
||||
glDeleteShader_func(VertShader);
|
||||
glDeleteProgram_func(Program);
|
||||
glutDestroyWindow(Win);
|
||||
exit(0);
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
SpecialKey(int key, int x, int y)
|
||||
{
|
||||
const GLfloat step = 1/100.0;
|
||||
switch(key) {
|
||||
case GLUT_KEY_UP:
|
||||
Ypos += step;
|
||||
break;
|
||||
case GLUT_KEY_DOWN:
|
||||
Ypos -= step;
|
||||
break;
|
||||
case GLUT_KEY_LEFT:
|
||||
Xpos -= step;
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
Xpos += step;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
/* Fragment shader: compute distance of fragment from center of point
|
||||
* (we're using texcoords but another varying could be used).
|
||||
* if dist > 1, discard (coverage==0)
|
||||
* if dist < k, coverage = 1
|
||||
* else, coverage = func(dist)
|
||||
* Note: length() uses sqrt() and may be expensive. The distance could
|
||||
* be squared instead (with adjustments to the threshold (k) test)
|
||||
*/
|
||||
static const char *fragShaderText =
|
||||
"void main() {\n"
|
||||
" float cover; \n"
|
||||
" float k = 2.0 / gl_Point.size; \n"
|
||||
" float d = length(gl_TexCoord[0].xy); \n"
|
||||
" if (d >= 1.0) \n"
|
||||
" discard; \n"
|
||||
" if (d < 1.0 - k) \n"
|
||||
" cover = 1.0; \n"
|
||||
" else \n"
|
||||
" cover = (1.0 - d) * 0.5 * gl_Point.size; \n"
|
||||
" gl_FragColor.rgb = gl_Color.rgb; \n"
|
||||
" gl_FragColor.a = cover; \n"
|
||||
"}\n";
|
||||
/* Vertex shader: compute new vertex position based on incoming vertex pos,
|
||||
* texcoords, point size, and inverse viewport scale factor.
|
||||
* Note: should compute point size attenuation here too.
|
||||
*/
|
||||
static const char *vertShaderText =
|
||||
"uniform vec2 viewportInv; \n"
|
||||
"void main() {\n"
|
||||
" vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||
" gl_Position.xy = pos.xy + gl_MultiTexCoord0.xy * viewportInv \n"
|
||||
" * gl_Point.size * pos.w; \n"
|
||||
" gl_Position.zw = pos.zw; \n"
|
||||
" gl_TexCoord[0] = gl_MultiTexCoord0; \n"
|
||||
" gl_FrontColor = gl_Color; \n"
|
||||
"}\n";
|
||||
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
VertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
|
||||
FragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
|
||||
Program = LinkShaders(VertShader, FragShader);
|
||||
|
||||
glUseProgram_func(Program);
|
||||
|
||||
uViewportInv = glGetUniformLocation_func(Program, "viewportInv");
|
||||
|
||||
glUseProgram_func(0);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
glutDisplayFunc(Redisplay);
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "GL/glut.h"
|
||||
#include "readtex.h"
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
static const char *Demo = "texdemo1";
|
||||
|
||||
@@ -51,19 +50,38 @@ static GLfloat EyeDist = 10;
|
||||
static GLboolean Anim = GL_TRUE;
|
||||
|
||||
|
||||
struct uniform_info {
|
||||
const char *name;
|
||||
GLuint size;
|
||||
GLint location;
|
||||
GLenum type; /**< GL_FLOAT or GL_INT */
|
||||
GLfloat value[4];
|
||||
};
|
||||
|
||||
static struct uniform_info ReflectUniforms[] = {
|
||||
{ "cubeTex", 1, GL_INT, { 0, 0, 0, 0 }, -1 },
|
||||
{ "lightPos", 3, GL_FLOAT, { 10, 10, 20, 0 }, -1 },
|
||||
END_OF_UNIFORMS
|
||||
{ "cubeTex", 1, -1, GL_INT, { 0, 0, 0, 0 } },
|
||||
{ "lightPos", 3, -1, GL_FLOAT, { 10, 10, 20, 0 } },
|
||||
{ NULL, 0, 0, 0, { 0, 0, 0, 0 } }
|
||||
};
|
||||
|
||||
static struct uniform_info SimpleUniforms[] = {
|
||||
{ "tex2d", 1, GL_INT, { 1, 0, 0, 0 }, -1 },
|
||||
{ "lightPos", 3, GL_FLOAT, { 10, 10, 20, 0 }, -1 },
|
||||
END_OF_UNIFORMS
|
||||
{ "tex2d", 1, -1, GL_INT, { 1, 0, 0, 0 } },
|
||||
{ "lightPos", 3, -1, GL_FLOAT, { 10, 10, 20, 0 } },
|
||||
{ NULL, 0, 0, 0, { 0, 0, 0, 0 } }
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
CheckError(int line)
|
||||
{
|
||||
GLenum err = glGetError();
|
||||
if (err) {
|
||||
printf("GL Error %s (0x%x) at line %d\n",
|
||||
gluErrorString(err), (int) err, line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
DrawGround(GLfloat size)
|
||||
{
|
||||
@@ -368,19 +386,132 @@ InitTextures(GLboolean useImageFiles)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
LoadAndCompileShader(GLuint shader, const char *text)
|
||||
{
|
||||
GLint stat;
|
||||
|
||||
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
|
||||
|
||||
glCompileShader_func(shader);
|
||||
|
||||
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog_func(shader, 1000, &len, log);
|
||||
fprintf(stderr, "%s: problem compiling shader: %s\n", Demo, log);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
printf("Shader compiled OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read a shader from a file.
|
||||
*/
|
||||
static void
|
||||
ReadShader(GLuint shader, const char *filename)
|
||||
{
|
||||
const int max = 100*1000;
|
||||
int n;
|
||||
char *buffer = (char*) malloc(max);
|
||||
FILE *f = fopen(filename, "r");
|
||||
if (!f) {
|
||||
fprintf(stderr, "%s: Unable to open shader file %s\n", Demo, filename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
n = fread(buffer, 1, max, f);
|
||||
printf("%s: read %d bytes from shader file %s\n", Demo, n, filename);
|
||||
if (n > 0) {
|
||||
buffer[n] = 0;
|
||||
LoadAndCompileShader(shader, buffer);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CheckLink(GLuint prog)
|
||||
{
|
||||
GLint stat;
|
||||
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog_func(prog, 1000, &len, log);
|
||||
fprintf(stderr, "Linker error:\n%s\n", log);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Link success!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static GLuint
|
||||
CreateProgram(const char *vertProgFile, const char *fragProgFile,
|
||||
struct uniform_info *uniforms)
|
||||
{
|
||||
GLuint fragShader, vertShader, program;
|
||||
GLuint fragShader = 0, vertShader = 0, program = 0;
|
||||
GLint i;
|
||||
|
||||
vertShader = CompileShaderFile(GL_VERTEX_SHADER, vertProgFile);
|
||||
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, fragProgFile);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
program = glCreateProgram_func();
|
||||
if (vertProgFile) {
|
||||
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
|
||||
ReadShader(vertShader, vertProgFile);
|
||||
glAttachShader_func(program, vertShader);
|
||||
}
|
||||
|
||||
if (fragProgFile) {
|
||||
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
|
||||
ReadShader(fragShader, fragProgFile);
|
||||
glAttachShader_func(program, fragShader);
|
||||
}
|
||||
|
||||
glLinkProgram_func(program);
|
||||
CheckLink(program);
|
||||
|
||||
glUseProgram_func(program);
|
||||
|
||||
InitUniforms(program, uniforms);
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
|
||||
CheckError(__LINE__);
|
||||
for (i = 0; uniforms[i].name; i++) {
|
||||
uniforms[i].location
|
||||
= glGetUniformLocation_func(program, uniforms[i].name);
|
||||
printf("Uniform %s location: %d\n", uniforms[i].name,
|
||||
uniforms[i].location);
|
||||
|
||||
switch (uniforms[i].size) {
|
||||
case 1:
|
||||
if (uniforms[i].type == GL_INT)
|
||||
glUniform1i_func(uniforms[i].location,
|
||||
(GLint) uniforms[i].value[0]);
|
||||
else
|
||||
glUniform1fv_func(uniforms[i].location, 1, uniforms[i].value);
|
||||
break;
|
||||
case 2:
|
||||
glUniform2fv_func(uniforms[i].location, 1, uniforms[i].value);
|
||||
break;
|
||||
case 3:
|
||||
glUniform3fv_func(uniforms[i].location, 1, uniforms[i].value);
|
||||
break;
|
||||
case 4:
|
||||
glUniform4fv_func(uniforms[i].location, 1, uniforms[i].value);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
return program;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
static char *FragProgFile = "CH11-toyball.frag.txt";
|
||||
@@ -25,23 +24,30 @@ static GLuint vertShader;
|
||||
static GLuint program;
|
||||
|
||||
|
||||
struct uniform_info {
|
||||
const char *name;
|
||||
GLuint size;
|
||||
GLint location;
|
||||
GLfloat value[4];
|
||||
};
|
||||
|
||||
static struct uniform_info Uniforms[] = {
|
||||
{ "LightDir", 4, GL_FLOAT, { 0.57737, 0.57735, 0.57735, 0.0 }, -1 },
|
||||
{ "HVector", 4, GL_FLOAT, { 0.32506, 0.32506, 0.88808, 0.0 }, -1 },
|
||||
{ "BallCenter", 4, GL_FLOAT, { 0.0, 0.0, 0.0, 1.0 }, -1 },
|
||||
{ "SpecularColor", 4, GL_FLOAT, { 0.4, 0.4, 0.4, 60.0 }, -1 },
|
||||
{ "Red", 4, GL_FLOAT, { 0.6, 0.0, 0.0, 1.0 }, -1 },
|
||||
{ "Blue", 4, GL_FLOAT, { 0.0, 0.3, 0.6, 1.0 }, -1 },
|
||||
{ "Yellow", 4, GL_FLOAT, { 0.6, 0.5, 0.0, 1.0 }, -1 },
|
||||
{ "HalfSpace0", 4, GL_FLOAT, { 1.0, 0.0, 0.0, 0.2 }, -1 },
|
||||
{ "HalfSpace1", 4, GL_FLOAT, { 0.309016994, 0.951056516, 0.0, 0.2 }, -1 },
|
||||
{ "HalfSpace2", 4, GL_FLOAT, { -0.809016994, 0.587785252, 0.0, 0.2 }, -1 },
|
||||
{ "HalfSpace3", 4, GL_FLOAT, { -0.809016994, -0.587785252, 0.0, 0.2 }, -1 },
|
||||
{ "HalfSpace4", 4, GL_FLOAT, { 0.309116994, -0.951056516, 0.0, 0.2 }, -1 },
|
||||
{ "InOrOutInit", 1, GL_FLOAT, { -3.0, 0, 0, 0 }, -1 },
|
||||
{ "StripeWidth", 1, GL_FLOAT, { 0.3, 0, 0, 0 }, -1 },
|
||||
{ "FWidth", 1, GL_FLOAT, { 0.005, 0, 0, 0 }, -1 },
|
||||
END_OF_UNIFORMS
|
||||
{ "LightDir", 4, -1, { 0.57737, 0.57735, 0.57735, 0.0 } },
|
||||
{ "HVector", 4, -1, { 0.32506, 0.32506, 0.88808, 0.0 } },
|
||||
{ "BallCenter", 4, -1, { 0.0, 0.0, 0.0, 1.0 } },
|
||||
{ "SpecularColor", 4, -1, { 0.4, 0.4, 0.4, 60.0 } },
|
||||
{ "Red", 4, -1, { 0.6, 0.0, 0.0, 1.0 } },
|
||||
{ "Blue", 4, -1, { 0.0, 0.3, 0.6, 1.0 } },
|
||||
{ "Yellow", 4, -1, { 0.6, 0.5, 0.0, 1.0 } },
|
||||
{ "HalfSpace0", 4, -1, { 1.0, 0.0, 0.0, 0.2 } },
|
||||
{ "HalfSpace1", 4, -1, { 0.309016994, 0.951056516, 0.0, 0.2 } },
|
||||
{ "HalfSpace2", 4, -1, { -0.809016994, 0.587785252, 0.0, 0.2 } },
|
||||
{ "HalfSpace3", 4, -1, { -0.809016994, -0.587785252, 0.0, 0.2 } },
|
||||
{ "HalfSpace4", 4, -1, { 0.309116994, -0.951056516, 0.0, 0.2 } },
|
||||
{ "InOrOutInit", 1, -1, { -3.0, 0, 0, 0 } },
|
||||
{ "StripeWidth", 1, -1, { 0.3, 0, 0, 0 } },
|
||||
{ "FWidth", 1, -1, { 0.005, 0, 0, 0 } },
|
||||
{ NULL, 0, 0, { 0, 0, 0, 0 } }
|
||||
};
|
||||
|
||||
static GLint win = 0;
|
||||
@@ -165,21 +171,128 @@ SpecialKey(int key, int x, int y)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
LoadAndCompileShader(GLuint shader, const char *text)
|
||||
{
|
||||
GLint stat;
|
||||
|
||||
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
|
||||
|
||||
glCompileShader_func(shader);
|
||||
|
||||
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog_func(shader, 1000, &len, log);
|
||||
fprintf(stderr, "toyball: problem compiling shader: %s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
printf("Shader compiled OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read a shader from a file.
|
||||
*/
|
||||
static void
|
||||
ReadShader(GLuint shader, const char *filename)
|
||||
{
|
||||
const int max = 100*1000;
|
||||
int n;
|
||||
char *buffer = (char*) malloc(max);
|
||||
FILE *f = fopen(filename, "r");
|
||||
if (!f) {
|
||||
fprintf(stderr, "toyball: Unable to open shader file %s\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
n = fread(buffer, 1, max, f);
|
||||
printf("toyball: read %d bytes from shader file %s\n", n, filename);
|
||||
if (n > 0) {
|
||||
buffer[n] = 0;
|
||||
LoadAndCompileShader(shader, buffer);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CheckLink(GLuint prog)
|
||||
{
|
||||
GLint stat;
|
||||
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog_func(prog, 1000, &len, log);
|
||||
fprintf(stderr, "Linker error:\n%s\n", log);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Link success!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
const char *version;
|
||||
GLint i;
|
||||
|
||||
version = (const char *) glGetString(GL_VERSION);
|
||||
if (version[0] != '2' || version[1] != '.') {
|
||||
printf("Warning: this program expects OpenGL 2.0\n");
|
||||
/*exit(1);*/
|
||||
}
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderFile(GL_VERTEX_SHADER, VertProgFile);
|
||||
fragShader = CompileShaderFile(GL_FRAGMENT_SHADER, FragProgFile);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
|
||||
ReadShader(vertShader, VertProgFile);
|
||||
|
||||
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
|
||||
ReadShader(fragShader, FragProgFile);
|
||||
|
||||
program = glCreateProgram_func();
|
||||
glAttachShader_func(program, fragShader);
|
||||
glAttachShader_func(program, vertShader);
|
||||
glLinkProgram_func(program);
|
||||
CheckLink(program);
|
||||
glUseProgram_func(program);
|
||||
|
||||
InitUniforms(program, Uniforms);
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
|
||||
|
||||
for (i = 0; Uniforms[i].name; i++) {
|
||||
Uniforms[i].location
|
||||
= glGetUniformLocation_func(program, Uniforms[i].name);
|
||||
printf("Uniform %s location: %d\n", Uniforms[i].name,
|
||||
Uniforms[i].location);
|
||||
switch (Uniforms[i].size) {
|
||||
case 1:
|
||||
glUniform1fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 2:
|
||||
glUniform2fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 3:
|
||||
glUniform3fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
case 4:
|
||||
glUniform4fv_func(Uniforms[i].location, 1, Uniforms[i].value);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
assert(glGetError() == 0);
|
||||
|
||||
|
||||
@@ -1,259 +0,0 @@
|
||||
/**
|
||||
* Demonstration of doing triangle rasterization with a fragment program.
|
||||
* Basic idea:
|
||||
* 1. Draw screen-aligned quad / bounding box around the triangle verts.
|
||||
* 2. For each pixel in the quad, determine if pixel is inside/outside
|
||||
* the triangle edges.
|
||||
*
|
||||
* Brian Paul
|
||||
* 1 Aug 2007
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
static GLint WinWidth = 300, WinHeight = 300;
|
||||
static char *FragProgFile = NULL;
|
||||
static char *VertProgFile = NULL;
|
||||
static GLuint fragShader;
|
||||
static GLuint vertShader;
|
||||
static GLuint program;
|
||||
static GLint win = 0;
|
||||
static GLboolean anim = GL_TRUE;
|
||||
static GLfloat Zrot = 0.0f;
|
||||
static GLint uv0, uv1, uv2;
|
||||
|
||||
|
||||
static const GLfloat TriVerts[3][2] = {
|
||||
{ 50, 50 },
|
||||
{ 250, 50 },
|
||||
{ 150, 250 }
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
RotateVerts(GLfloat a,
|
||||
GLuint n, const GLfloat vertsIn[][2], GLfloat vertsOut[][2])
|
||||
{
|
||||
GLuint i;
|
||||
GLfloat cx = WinWidth / 2, cy = WinHeight / 2;
|
||||
for (i = 0; i < n; i++) {
|
||||
float x = vertsIn[i][0] - cx;
|
||||
float y = vertsIn[i][1] - cy;
|
||||
|
||||
vertsOut[i][0] = x * cos(a) + y * sin(a) + cx;
|
||||
vertsOut[i][1] = -x * sin(a) + y * cos(a) + cy;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ComputeBounds(GLuint n, GLfloat vertsIn[][2],
|
||||
GLfloat *xmin, GLfloat *ymin,
|
||||
GLfloat *xmax, GLfloat *ymax)
|
||||
{
|
||||
GLuint i;
|
||||
*xmin = *xmax = vertsIn[0][0];
|
||||
*ymin = *ymax = vertsIn[0][1];
|
||||
for (i = 1; i < n; i++) {
|
||||
if (vertsIn[i][0] < *xmin)
|
||||
*xmin = vertsIn[i][0];
|
||||
else if (vertsIn[i][0] > *xmax)
|
||||
*xmax = vertsIn[i][0];
|
||||
if (vertsIn[i][1] < *ymin)
|
||||
*ymin = vertsIn[i][1];
|
||||
else if (vertsIn[i][1] > *ymax)
|
||||
*ymax = vertsIn[i][1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Redisplay(void)
|
||||
{
|
||||
GLfloat v[3][2], xmin, ymin, xmax, ymax;
|
||||
|
||||
RotateVerts(Zrot, 3, TriVerts, v);
|
||||
ComputeBounds(3, v, &xmin, &ymin, &xmax, &ymax);
|
||||
|
||||
glUniform2fv_func(uv0, 1, v[0]);
|
||||
glUniform2fv_func(uv1, 1, v[1]);
|
||||
glUniform2fv_func(uv2, 1, v[2]);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex2f(xmin, ymin);
|
||||
glVertex2f(xmax, ymin);
|
||||
glVertex2f(xmax, ymax);
|
||||
glVertex2f(xmin, ymax);
|
||||
glEnd();
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Idle(void)
|
||||
{
|
||||
if (anim) {
|
||||
Zrot = glutGet(GLUT_ELAPSED_TIME) * 0.0005;
|
||||
glutPostRedisplay();
|
||||
}
|
||||
else
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, width, 0, height, -1, 1);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Key(unsigned char key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
|
||||
switch(key) {
|
||||
case ' ':
|
||||
case 'a':
|
||||
anim = !anim;
|
||||
if (anim)
|
||||
glutIdleFunc(Idle);
|
||||
else
|
||||
glutIdleFunc(NULL);
|
||||
break;
|
||||
case 'z':
|
||||
Zrot = 0;
|
||||
break;
|
||||
case 's':
|
||||
Zrot += 0.05;
|
||||
break;
|
||||
case 27:
|
||||
CleanUp();
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
static const char *fragShaderText =
|
||||
"uniform vec2 v0, v1, v2; \n"
|
||||
"float crs(const vec2 u, const vec2 v) \n"
|
||||
"{ \n"
|
||||
" return u.x * v.y - u.y * v.x; \n"
|
||||
"} \n"
|
||||
"\n"
|
||||
"void main() {\n"
|
||||
" vec2 p = gl_FragCoord.xy; \n"
|
||||
" if (crs(v1 - v0, p - v0) >= 0 && \n"
|
||||
" crs(v2 - v1, p - v1) >= 0 && \n"
|
||||
" crs(v0 - v2, p - v2) >= 0) \n"
|
||||
" gl_FragColor = vec4(1.0); \n"
|
||||
" else \n"
|
||||
" gl_FragColor = vec4(0.5); \n"
|
||||
"}\n";
|
||||
static const char *vertShaderText =
|
||||
"void main() {\n"
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||
"}\n";
|
||||
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
|
||||
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
|
||||
uv0 = glGetUniformLocation_func(program, "v0");
|
||||
uv1 = glGetUniformLocation_func(program, "v1");
|
||||
uv2 = glGetUniformLocation_func(program, "v2");
|
||||
printf("Uniforms: %d %d %d\n", uv0, uv1, uv2);
|
||||
|
||||
/*assert(glGetError() == 0);*/
|
||||
|
||||
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
|
||||
glColor3f(1, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ParseOptions(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-fs") == 0) {
|
||||
FragProgFile = argv[i+1];
|
||||
}
|
||||
else if (strcmp(argv[i], "-vs") == 0) {
|
||||
VertProgFile = argv[i+1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowPosition( 0, 0);
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Redisplay);
|
||||
if (anim)
|
||||
glutIdleFunc(Idle);
|
||||
ParseOptions(argc, argv);
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -1,270 +0,0 @@
|
||||
/**
|
||||
* Test two-sided lighting with shaders.
|
||||
* Both GL_VERTEX_PROGRAM_TWO_SIDE and gl_FrontFacing can be tested
|
||||
* (see keys below).
|
||||
*
|
||||
* Brian Paul
|
||||
* 18 Dec 2007
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
#include "shaderutil.h"
|
||||
|
||||
|
||||
static GLint WinWidth = 300, WinHeight = 300;
|
||||
static char *FragProgFile = NULL;
|
||||
static char *VertProgFile = NULL;
|
||||
static GLuint fragShader;
|
||||
static GLuint vertShader;
|
||||
static GLuint program;
|
||||
static GLint win = 0;
|
||||
static GLboolean anim = 0*GL_TRUE;
|
||||
static GLboolean DetermineInFragProg = GL_TRUE;
|
||||
static GLfloat Yrot = 0.0f;
|
||||
static GLint u_fragface;
|
||||
static GLenum FrontWinding = GL_CCW;
|
||||
static int prevTime = 0;
|
||||
|
||||
|
||||
static const GLfloat Red[4] = {1, 0, 0, 0};
|
||||
static const GLfloat Green[4] = {0, 1, 0, 0};
|
||||
|
||||
|
||||
static void
|
||||
Redisplay(void)
|
||||
{
|
||||
float xmin = -1, xmax = 1, ymin = -1, ymax = 1;
|
||||
|
||||
glFrontFace(FrontWinding);
|
||||
|
||||
if (DetermineInFragProg) {
|
||||
glUniform1i_func(u_fragface, 1);
|
||||
glDisable(GL_VERTEX_PROGRAM_TWO_SIDE);
|
||||
}
|
||||
else {
|
||||
glUniform1i_func(u_fragface, 0);
|
||||
glEnable(GL_VERTEX_PROGRAM_TWO_SIDE);
|
||||
}
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(Yrot, 0, 1, 0);
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
glColor4fv(Red);
|
||||
glSecondaryColor3fv_func(Green);
|
||||
glVertex2f(xmin, ymin);
|
||||
glVertex2f(xmax, ymin);
|
||||
glVertex2f(xmax, ymax);
|
||||
glVertex2f(xmin, ymax);
|
||||
glEnd();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Idle(void)
|
||||
{
|
||||
int curTime = glutGet(GLUT_ELAPSED_TIME);
|
||||
int dt = curTime - prevTime;
|
||||
|
||||
if (prevTime == 0) {
|
||||
prevTime = curTime;
|
||||
return;
|
||||
}
|
||||
prevTime = curTime;
|
||||
|
||||
Yrot += dt * 0.1;
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape(int width, int height)
|
||||
{
|
||||
float ar = (float) width / height;
|
||||
glViewport(0, 0, width, height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-ar, ar, -1, 1, 5, 15);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0, 0, -10);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Key(unsigned char key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
|
||||
switch(key) {
|
||||
case ' ':
|
||||
case 'a':
|
||||
anim = !anim;
|
||||
if (anim) {
|
||||
prevTime = glutGet(GLUT_ELAPSED_TIME);
|
||||
glutIdleFunc(Idle);
|
||||
}
|
||||
else
|
||||
glutIdleFunc(NULL);
|
||||
break;
|
||||
case 'f':
|
||||
printf("Using frag shader gl_FrontFacing\n");
|
||||
DetermineInFragProg = GL_TRUE;
|
||||
break;
|
||||
case 'v':
|
||||
printf("Using vert shader Two-sided lighting\n");
|
||||
DetermineInFragProg = GL_FALSE;
|
||||
break;
|
||||
case 'r':
|
||||
Yrot = 0;
|
||||
anim = 0;
|
||||
glutIdleFunc(NULL);
|
||||
break;
|
||||
case 's':
|
||||
Yrot += 5;
|
||||
break;
|
||||
case 'w':
|
||||
if (FrontWinding == GL_CCW) {
|
||||
FrontWinding = GL_CW;
|
||||
printf("FrontFace = GL_CW\n");
|
||||
}
|
||||
else {
|
||||
FrontWinding = GL_CCW;
|
||||
printf("FrontFace = GL_CCW\n");
|
||||
}
|
||||
break;
|
||||
case 27:
|
||||
CleanUp();
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
static const char *fragShaderText =
|
||||
"uniform bool fragface; \n"
|
||||
"void main() { \n"
|
||||
" if (!fragface || gl_FrontFacing) { \n"
|
||||
" gl_FragColor = gl_Color; \n"
|
||||
" } \n"
|
||||
" else { \n"
|
||||
" gl_FragColor = 0.8 * gl_SecondaryColor; \n"
|
||||
" } \n"
|
||||
"} \n";
|
||||
static const char *vertShaderText =
|
||||
"uniform bool fragface; \n"
|
||||
"void main() { \n"
|
||||
" gl_FrontColor = gl_Color; \n"
|
||||
" if (fragface) { \n"
|
||||
" // front/back chosen in frag prog \n"
|
||||
" gl_FrontSecondaryColor = gl_SecondaryColor; \n"
|
||||
" } \n"
|
||||
" else { \n"
|
||||
" // front/back chosen in prim setup \n"
|
||||
" gl_BackColor = gl_SecondaryColor; \n"
|
||||
" } \n"
|
||||
" gl_Position = ftransform(); \n"
|
||||
"} \n";
|
||||
|
||||
if (!ShadersSupported())
|
||||
exit(1);
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
vertShader = CompileShaderText(GL_VERTEX_SHADER, vertShaderText);
|
||||
fragShader = CompileShaderText(GL_FRAGMENT_SHADER, fragShaderText);
|
||||
program = LinkShaders(vertShader, fragShader);
|
||||
|
||||
glUseProgram_func(program);
|
||||
|
||||
u_fragface = glGetUniformLocation_func(program, "fragface");
|
||||
printf("Uniforms: %d\n", u_fragface);
|
||||
|
||||
/*assert(glGetError() == 0);*/
|
||||
|
||||
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ParseOptions(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-fs") == 0) {
|
||||
FragProgFile = argv[i+1];
|
||||
}
|
||||
else if (strcmp(argv[i], "-vs") == 0) {
|
||||
VertProgFile = argv[i+1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Usage(void)
|
||||
{
|
||||
printf("Keys:\n");
|
||||
printf(" f - do front/back determination in fragment shader\n");
|
||||
printf(" v - do front/back determination in vertex shader\n");
|
||||
printf(" r - reset, show front\n");
|
||||
printf(" a - toggle animation\n");
|
||||
printf(" s - step rotation\n");
|
||||
printf(" w - toggle CW, CCW front-face winding\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowPosition( 0, 0);
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Redisplay);
|
||||
if (anim)
|
||||
glutIdleFunc(Idle);
|
||||
ParseOptions(argc, argv);
|
||||
Init();
|
||||
Usage();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -43,8 +43,8 @@ LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS
|
||||
default: depend $(PROGS)
|
||||
|
||||
clean:
|
||||
-rm -f $(PROGS)
|
||||
-rm -f *.o
|
||||
rm -f $(PROGS)
|
||||
rm -f *.o
|
||||
|
||||
|
||||
depend: $(SOURCES)
|
||||
|
||||
@@ -5,19 +5,15 @@ include $(TOP)/configs/current
|
||||
|
||||
INCDIR = $(TOP)/include
|
||||
|
||||
OSMESA_LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(OSMESA_LIB) $(APP_LIB_DEPS)
|
||||
OSMESA_LIBS = -L$(TOP)/$(LIB_DIR) -lOSMesa $(APP_LIB_DEPS)
|
||||
|
||||
OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -lOSMesa16 -l$(GLU_LIB) \
|
||||
-l$(GL_LIB) $(APP_LIB_DEPS)
|
||||
OSMESA16_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa16 -lGLU -lGL $(APP_LIB_DEPS)
|
||||
|
||||
OSMESA32_LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -lOSMesa32 -l$(GLU_LIB) \
|
||||
-l$(GL_LIB) $(APP_LIB_DEPS)
|
||||
OSMESA32_LIBS = -L$(TOP)/$(LIB_DIR) -lglut -lOSMesa32 -lGLU -lGL $(APP_LIB_DEPS)
|
||||
|
||||
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \
|
||||
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
|
||||
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
|
||||
|
||||
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \
|
||||
$(APP_LIB_DEPS)
|
||||
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
|
||||
|
||||
PROGS = \
|
||||
osdemo \
|
||||
|
||||
@@ -25,27 +25,6 @@ static int doPrint = 1;
|
||||
static int deltaY;
|
||||
GLint windW, windH;
|
||||
|
||||
static const struct {
|
||||
GLenum mode;
|
||||
const char *name;
|
||||
} LogicOpModes[] = {
|
||||
{ GL_SET, "GL_SET" },
|
||||
{ GL_COPY, "GL_COPY" },
|
||||
{ GL_NOOP, "GL_NOOP" },
|
||||
{ GL_AND, "GL_AND" },
|
||||
{ GL_INVERT, "GL_INVERT" },
|
||||
{ GL_OR, "GL_OR" },
|
||||
{ GL_XOR, "GL_XOR" },
|
||||
{ GL_NOR, "GL_NOR" },
|
||||
{ GL_NAND, "GL_NAND" },
|
||||
{ GL_OR_REVERSE, "GL_OR_REVERSE" },
|
||||
{ GL_OR_INVERTED, "GL_OR_INVERTED" },
|
||||
{ GL_AND_INVERTED, "GL_AND_INVERTED" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
|
||||
static void DrawString(const char *string)
|
||||
{
|
||||
int i;
|
||||
@@ -68,7 +47,7 @@ static void Reshape(int width, int height)
|
||||
windH = (GLint)height;
|
||||
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
deltaY = windH /20;
|
||||
deltaY = windH /16;
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
@@ -126,7 +105,7 @@ static void Draw(void)
|
||||
{
|
||||
int stringOffset = 5, stringx = 8;
|
||||
int x1, x2, xleft, xright;
|
||||
int i, k;
|
||||
int i;
|
||||
|
||||
(dithering) ? glEnable(GL_DITHER) : glDisable(GL_DITHER);
|
||||
glDisable(GL_BLEND);
|
||||
@@ -143,7 +122,6 @@ static void Draw(void)
|
||||
/* Draw labels */
|
||||
glColor3f(0.8, 0.8, 0.0);
|
||||
i = windH - deltaY + stringOffset;
|
||||
|
||||
glRasterPos2f(stringx, i); i -= deltaY;
|
||||
DrawString("SOURCE");
|
||||
glRasterPos2f(stringx, i); i -= deltaY;
|
||||
@@ -158,12 +136,21 @@ static void Draw(void)
|
||||
DrawString("reverse_subtract");
|
||||
glRasterPos2f(stringx, i); i -= deltaY;
|
||||
DrawString("clear");
|
||||
glRasterPos2f(stringx, i); i -= deltaY;
|
||||
DrawString("set");
|
||||
glRasterPos2f(stringx, i); i -= deltaY;
|
||||
DrawString("copy");
|
||||
glRasterPos2f(stringx, i); i -= deltaY;
|
||||
DrawString("noop");
|
||||
glRasterPos2f(stringx, i); i -= deltaY;
|
||||
DrawString("and");
|
||||
glRasterPos2f(stringx, i); i -= deltaY;
|
||||
DrawString("invert");
|
||||
glRasterPos2f(stringx, i); i -= deltaY;
|
||||
DrawString("or");
|
||||
glRasterPos2f(stringx, i); i -= deltaY;
|
||||
DrawString("xor");
|
||||
|
||||
for (k = 0; LogicOpModes[k].name; k++) {
|
||||
glRasterPos2f(stringx, i);
|
||||
i -= deltaY;
|
||||
DrawString(LogicOpModes[k].name);
|
||||
}
|
||||
|
||||
i = windH - deltaY;
|
||||
x1 = windW/4;
|
||||
@@ -206,23 +193,43 @@ static void Draw(void)
|
||||
glLogicOp(GL_CLEAR);
|
||||
glRectf(x1, i, x2, i+deltaY);
|
||||
|
||||
for (k = 0; LogicOpModes[k].name; k++) {
|
||||
i -= deltaY;
|
||||
glLogicOp(LogicOpModes[k].mode);
|
||||
glRectf(x1, i, x2, i+deltaY);
|
||||
if (LogicOpModes[k].mode == GL_XOR) {
|
||||
glRectf(x1, i+10, x2, i+5);
|
||||
}
|
||||
}
|
||||
i -= deltaY;
|
||||
glLogicOp(GL_SET);
|
||||
glRectf(x1, i, x2, i+deltaY);
|
||||
|
||||
if (doPrint) {
|
||||
glDisable(GL_BLEND);
|
||||
if (supportlogops & 2)
|
||||
i -= deltaY;
|
||||
glLogicOp(GL_COPY);
|
||||
glRectf(x1, i, x2, i+deltaY);
|
||||
|
||||
i -= deltaY;
|
||||
glLogicOp(GL_NOOP);
|
||||
glRectf(x1, i, x2, i+deltaY);
|
||||
|
||||
i -= deltaY;
|
||||
glLogicOp(GL_AND);
|
||||
glRectf(x1, i, x2, i+deltaY);
|
||||
|
||||
i -= deltaY;
|
||||
glLogicOp(GL_INVERT);
|
||||
glRectf(x1, i, x2, i+deltaY);
|
||||
|
||||
i -= deltaY;
|
||||
glLogicOp(GL_OR);
|
||||
glRectf(x1, i, x2, i+deltaY);
|
||||
|
||||
i -= deltaY;
|
||||
glLogicOp(GL_XOR);
|
||||
glRectf(x1, i, x2, i+deltaY);
|
||||
glRectf(x1, i+10, x2, i+5);
|
||||
|
||||
if (doPrint) {
|
||||
glDisable(GL_BLEND);
|
||||
if (supportlogops & 2)
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glColor3f(1.0, 1.0, 1.0);
|
||||
PrintColorStrings();
|
||||
}
|
||||
glFlush();
|
||||
glColor3f(1.0, 1.0, 1.0);
|
||||
PrintColorStrings();
|
||||
}
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
glutSwapBuffers();
|
||||
@@ -264,7 +271,7 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 800, 520);
|
||||
glutInitWindowPosition(0, 0); glutInitWindowSize( 800, 400);
|
||||
|
||||
type = GLUT_RGB;
|
||||
type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
|
||||
|
||||
@@ -24,7 +24,7 @@ tests: default
|
||||
! ./cltest 2> /dev/null | (grep -e ^[*][*][*])
|
||||
|
||||
clean:
|
||||
-rm -f cltest.o sotest.o vstest.o framework.o cltest sotest vstest
|
||||
rm -f cltest.o sotest.o vstest.o framework.o cltest sotest vstest
|
||||
|
||||
#
|
||||
# executables
|
||||
|
||||
18
progs/tests/.gitignore
vendored
18
progs/tests/.gitignore
vendored
@@ -5,28 +5,19 @@ arbfpspec
|
||||
arbfptest1
|
||||
arbfptexture
|
||||
arbfptrig
|
||||
arbnpot
|
||||
arbnpot-mipmap
|
||||
arbvptest1
|
||||
arbvptest3
|
||||
arbvptorus
|
||||
arbvpwarpmesh
|
||||
arraytexture
|
||||
blendminmax
|
||||
blendsquare
|
||||
bufferobj
|
||||
bug_3050
|
||||
bug_3101
|
||||
bug_3195
|
||||
copypixrate
|
||||
crossbar
|
||||
cva
|
||||
dinoshade
|
||||
drawbuffers
|
||||
extfuncs.h
|
||||
exactrast
|
||||
fbotest1
|
||||
fbotest2
|
||||
fbotexture
|
||||
floattex
|
||||
fog
|
||||
@@ -38,9 +29,7 @@ getproclist.h
|
||||
interleave
|
||||
invert
|
||||
jkrahntest
|
||||
lineclip
|
||||
manytex
|
||||
mipmap_limits
|
||||
multipal
|
||||
no_s3tc
|
||||
packedpixels
|
||||
@@ -54,22 +43,15 @@ readtex.h
|
||||
seccolor
|
||||
sharedtex
|
||||
shader_api
|
||||
stencil_twoside
|
||||
stencil_wrap
|
||||
stencilwrap
|
||||
subtexrate
|
||||
tex1d
|
||||
texcmp
|
||||
texcompress2
|
||||
texfilt
|
||||
texgenmix
|
||||
texline
|
||||
texobjshare
|
||||
texrect
|
||||
texwrap
|
||||
unfilledclip
|
||||
vao-01
|
||||
vao-02
|
||||
vparray
|
||||
vptest1
|
||||
vptest2
|
||||
|
||||
@@ -23,7 +23,6 @@ SOURCES = \
|
||||
arbvptest3.c \
|
||||
arbvptorus.c \
|
||||
arbvpwarpmesh.c \
|
||||
arraytexture.c \
|
||||
blendminmax.c \
|
||||
blendsquare.c \
|
||||
bufferobj.c \
|
||||
@@ -35,7 +34,6 @@ SOURCES = \
|
||||
cva.c \
|
||||
dinoshade.c \
|
||||
drawbuffers.c \
|
||||
exactrast.c \
|
||||
floattex.c \
|
||||
fbotest1.c \
|
||||
fbotest2.c \
|
||||
@@ -48,9 +46,7 @@ SOURCES = \
|
||||
interleave.c \
|
||||
invert.c \
|
||||
jkrahntest.c \
|
||||
lineclip.c \
|
||||
manytex.c \
|
||||
minmag.c \
|
||||
mipmap_limits.c \
|
||||
multipal.c \
|
||||
no_s3tc.c \
|
||||
@@ -58,12 +54,10 @@ SOURCES = \
|
||||
pbo.c \
|
||||
prog_parameter.c \
|
||||
projtex.c \
|
||||
random.c \
|
||||
readrate.c \
|
||||
seccolor.c \
|
||||
shader_api.c \
|
||||
sharedtex.c \
|
||||
stencil_twoside.c \
|
||||
stencilwrap.c \
|
||||
stencil_wrap.c \
|
||||
subtexrate.c \
|
||||
@@ -74,7 +68,6 @@ SOURCES = \
|
||||
texobjshare.c \
|
||||
texrect.c \
|
||||
texwrap.c \
|
||||
unfilledclip.c \
|
||||
vao-01.c \
|
||||
vao-02.c \
|
||||
vparray.c \
|
||||
@@ -94,15 +87,6 @@ INCLUDES = -I. -I$(TOP)/include
|
||||
UTIL_FILES = readtex.h readtex.c
|
||||
|
||||
|
||||
##### TARGETS #####
|
||||
|
||||
default: $(UTIL_FILES) $(PROGS)
|
||||
|
||||
clean:
|
||||
-rm -f $(PROGS)
|
||||
-rm -f *.o
|
||||
-rm -f getproclist.h
|
||||
|
||||
##### RULES #####
|
||||
|
||||
.SUFFIXES:
|
||||
@@ -117,50 +101,55 @@ clean:
|
||||
.S.o:
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
|
||||
|
||||
|
||||
##### TARGETS #####
|
||||
|
||||
default: $(UTIL_FILES) $(PROGS)
|
||||
|
||||
clean:
|
||||
rm -f $(PROGS)
|
||||
rm -f *.o
|
||||
rm -f getproclist.h
|
||||
|
||||
|
||||
# auto code generation
|
||||
getprocaddress: getprocaddress.c getproclist.h
|
||||
|
||||
getproclist.h: $(TOP)/src/mesa/glapi/gl_API.xml getprocaddress.c getprocaddress.py
|
||||
python getprocaddress.py > getproclist.h
|
||||
|
||||
arraytexture: arraytexture.o readtex.o
|
||||
$(CC) $(CFLAGS) arraytexture.o readtex.o $(LIBS) -o $@
|
||||
|
||||
arraytexture.o: arraytexture.c readtex.h
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) arraytexture.c -o $@
|
||||
|
||||
afsmultiarb: afsmultiarb.o readtex.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) afsmultiarb.o readtex.o $(LIBS) -o $@
|
||||
|
||||
afsmultiarb.o: afsmultiarb.c readtex.h
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) afsmultiarb.c -o $@
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(DEFINES) $< -o $@
|
||||
|
||||
drawbuffers: drawbuffers.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) drawbuffers.o $(LIBS) -o $@
|
||||
|
||||
drawbuffers.o: drawbuffers.c extfuncs.h
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) drawbuffers.c -o $@
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(DEFINES) $< -o $@
|
||||
|
||||
texrect: texrect.o readtex.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) texrect.o readtex.o $(LIBS) -o $@
|
||||
|
||||
texrect.o: texrect.c readtex.h
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) texrect.c -o $@
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(DEFINES) $< -o $@
|
||||
|
||||
bug_3195: bug_3195.o readtex.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) bug_3195.o readtex.o $(LIBS) -o $@
|
||||
|
||||
bug_3195.o: bug_3195.c readtex.h
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) bug_3195.c -o $@
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(DEFINES) $< -o $@
|
||||
|
||||
invert: invert.o readtex.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) invert.o readtex.o $(LIBS) -o $@
|
||||
|
||||
invert.o: invert.c readtex.h
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) invert.c -o $@
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(DEFINES) $< -o $@
|
||||
|
||||
readtex.o: readtex.c
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) readtex.c -o $@
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(DEFINES) $< -o $@
|
||||
|
||||
|
||||
readtex.h: $(TOP)/progs/util/readtex.h
|
||||
|
||||
@@ -113,67 +113,44 @@ static void Init( void )
|
||||
minDim = imgWidth < imgHeight ? imgWidth : imgHeight;
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB, imgWidth, 0,
|
||||
imgFormat, GL_UNSIGNED_BYTE, image);
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
|
||||
/*
|
||||
* 1D Texture. Test proxy first, if that works, test non-proxy target.
|
||||
*/
|
||||
glTexImage1D(GL_PROXY_TEXTURE_1D, 0, GL_RGB, imgWidth, 0,
|
||||
imgFormat, GL_UNSIGNED_BYTE, image);
|
||||
glGetTexLevelParameteriv(GL_PROXY_TEXTURE_1D, 0, GL_TEXTURE_WIDTH, &w);
|
||||
assert(w == imgWidth || w == 0);
|
||||
assert(w == imgWidth);
|
||||
|
||||
if (w) {
|
||||
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB, imgWidth, 0,
|
||||
imgFormat, GL_UNSIGNED_BYTE, image);
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
}
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, imgWidth, imgHeight, 0,
|
||||
imgFormat, GL_UNSIGNED_BYTE, image);
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
|
||||
|
||||
/*
|
||||
* 2D Texture
|
||||
*/
|
||||
glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGB, imgWidth, imgHeight, 0,
|
||||
imgFormat, GL_UNSIGNED_BYTE, image);
|
||||
glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
|
||||
assert(w == imgWidth || w == 0);
|
||||
assert(w == imgWidth);
|
||||
|
||||
if (w) {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, imgWidth, imgHeight, 0,
|
||||
imgFormat, GL_UNSIGNED_BYTE, image);
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
}
|
||||
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, imgWidth, imgHeight, 1, 0,
|
||||
imgFormat, GL_UNSIGNED_BYTE, image);
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
|
||||
|
||||
/*
|
||||
* 3D Texture
|
||||
*/
|
||||
glTexImage3D(GL_PROXY_TEXTURE_3D, 0, GL_RGB, imgWidth, imgHeight, 1, 0,
|
||||
imgFormat, GL_UNSIGNED_BYTE, image);
|
||||
glGetTexLevelParameteriv(GL_PROXY_TEXTURE_3D, 0, GL_TEXTURE_WIDTH, &w);
|
||||
assert(w == imgWidth || w == 0);
|
||||
assert(w == imgWidth);
|
||||
|
||||
if (w) {
|
||||
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGB, imgWidth, imgHeight, 1, 0,
|
||||
imgFormat, GL_UNSIGNED_BYTE, image);
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
}
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB,
|
||||
minDim, minDim, 0,
|
||||
imgFormat, GL_UNSIGNED_BYTE, image);
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
|
||||
|
||||
/*
|
||||
* Cube Texture
|
||||
*/
|
||||
glTexImage2D(GL_PROXY_TEXTURE_CUBE_MAP, 0, GL_RGB,
|
||||
minDim, minDim, 0,
|
||||
imgFormat, GL_UNSIGNED_BYTE, image);
|
||||
glGetTexLevelParameteriv(GL_PROXY_TEXTURE_CUBE_MAP, 0, GL_TEXTURE_WIDTH, &w);
|
||||
assert(w == minDim || w == 0);
|
||||
assert(w == minDim);
|
||||
|
||||
if (w) {
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL_RGB,
|
||||
minDim, minDim, 0,
|
||||
imgFormat, GL_UNSIGNED_BYTE, image);
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
}
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
@@ -1,337 +0,0 @@
|
||||
/*
|
||||
* (C) Copyright IBM Corporation 2007
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||
* license, 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 (including the next
|
||||
* paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* IBM AND/OR ITS SUPPLIERS 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file arraytexture.c
|
||||
*
|
||||
*
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
|
||||
#if !defined(GL_EXT_texture_array) && !defined(GL_MESA_texture_array)
|
||||
# error "This demo requires enums for either GL_EXT_texture_array or GL_MESA_texture_array to build."
|
||||
#endif
|
||||
|
||||
#include "readtex.h"
|
||||
|
||||
#define GL_CHECK_ERROR() \
|
||||
do { \
|
||||
GLenum err = glGetError(); \
|
||||
if (err) { \
|
||||
printf("%s:%u: %s (0x%04x)\n", __FILE__, __LINE__, \
|
||||
gluErrorString(err), err); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static const char *const textures[] = {
|
||||
"../images/girl.rgb",
|
||||
"../images/girl2.rgb",
|
||||
"../images/arch.rgb",
|
||||
"../images/s128.rgb",
|
||||
|
||||
"../images/tree3.rgb",
|
||||
"../images/bw.rgb",
|
||||
"../images/reflect.rgb",
|
||||
"../images/wrs_logo.rgb",
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char frag_prog[] =
|
||||
"!!ARBfp1.0\n"
|
||||
"OPTION MESA_texture_array;\n"
|
||||
"TEX result.color, fragment.texcoord[0], texture[0], ARRAY2D;\n"
|
||||
"END\n";
|
||||
|
||||
static GLfloat Xrot = 0, Yrot = -30, Zrot = 0;
|
||||
static GLfloat texZ = 0.0;
|
||||
static GLfloat texZ_dir = 0.01;
|
||||
static GLint num_layers;
|
||||
|
||||
static PFNGLBINDPROGRAMARBPROC bind_program;
|
||||
static PFNGLPROGRAMSTRINGARBPROC program_string;
|
||||
static PFNGLGENPROGRAMSARBPROC gen_programs;
|
||||
|
||||
|
||||
static void
|
||||
PrintString(const char *s)
|
||||
{
|
||||
while (*s) {
|
||||
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void Idle(void)
|
||||
{
|
||||
static int lastTime = 0;
|
||||
int t = glutGet(GLUT_ELAPSED_TIME);
|
||||
|
||||
if (lastTime == 0)
|
||||
lastTime = t;
|
||||
else if (t - lastTime < 10)
|
||||
return;
|
||||
|
||||
lastTime = t;
|
||||
|
||||
texZ += texZ_dir;
|
||||
if ((texZ < 0.0) || ((GLint) texZ > num_layers)) {
|
||||
texZ_dir = -texZ_dir;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void Display(void)
|
||||
{
|
||||
char str[100];
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1, 1, -1, 1, -1, 1);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
(*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0);
|
||||
glColor3f(1,1,1);
|
||||
glRasterPos3f(-0.9, -0.9, 0.0);
|
||||
sprintf(str, "Texture Z coordinate = %4.1f", texZ);
|
||||
PrintString(str);
|
||||
|
||||
(*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 1);
|
||||
GL_CHECK_ERROR();
|
||||
glEnable(GL_TEXTURE_2D_ARRAY_EXT);
|
||||
GL_CHECK_ERROR();
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -8.0);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(Xrot, 1, 0, 0);
|
||||
glRotatef(Yrot, 0, 1, 0);
|
||||
glRotatef(Zrot, 0, 0, 1);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord3f(0.0, 0.0, texZ); glVertex2f(-1.0, -1.0);
|
||||
glTexCoord3f(2.0, 0.0, texZ); glVertex2f(1.0, -1.0);
|
||||
glTexCoord3f(2.0, 2.0, texZ); glVertex2f(1.0, 1.0);
|
||||
glTexCoord3f(0.0, 2.0, texZ); glVertex2f(-1.0, 1.0);
|
||||
glEnd();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glDisable(GL_TEXTURE_2D_ARRAY_EXT);
|
||||
GL_CHECK_ERROR();
|
||||
(*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0);
|
||||
GL_CHECK_ERROR();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void Reshape(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
|
||||
static void Key(unsigned char key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void SpecialKey(int key, int x, int y)
|
||||
{
|
||||
const GLfloat step = 3.0;
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case GLUT_KEY_UP:
|
||||
Xrot -= step;
|
||||
break;
|
||||
case GLUT_KEY_DOWN:
|
||||
Xrot += step;
|
||||
break;
|
||||
case GLUT_KEY_LEFT:
|
||||
Yrot -= step;
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
Yrot += step;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static int FindLine(const char *program, int position)
|
||||
{
|
||||
int i, line = 1;
|
||||
for (i = 0; i < position; i++) {
|
||||
if (program[i] == '\n')
|
||||
line++;
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
compile_fragment_program(GLuint id, const char *prog)
|
||||
{
|
||||
int errorPos;
|
||||
int err;
|
||||
|
||||
err = glGetError();
|
||||
(*bind_program)(GL_FRAGMENT_PROGRAM_ARB, id);
|
||||
(*program_string)(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
|
||||
strlen(prog), (const GLubyte *) prog);
|
||||
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
|
||||
err = glGetError();
|
||||
if (err != GL_NO_ERROR || errorPos != -1) {
|
||||
int l = FindLine(prog, errorPos);
|
||||
|
||||
printf("Fragment Program Error (err=%d, pos=%d line=%d): %s\n",
|
||||
err, errorPos, l,
|
||||
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void require_extension(const char *ext)
|
||||
{
|
||||
if (!glutExtensionSupported(ext)) {
|
||||
printf("Sorry, %s not supported by this renderer.\n", ext);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
const char *const ver_string = (const char *const) glGetString(GL_VERSION);
|
||||
unsigned i;
|
||||
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", ver_string);
|
||||
|
||||
require_extension("GL_ARB_fragment_program");
|
||||
require_extension("GL_MESA_texture_array");
|
||||
require_extension("GL_SGIS_generate_mipmap");
|
||||
|
||||
bind_program = glutGetProcAddress("glBindProgramARB");
|
||||
program_string = glutGetProcAddress("glProgramStringARB");
|
||||
gen_programs = glutGetProcAddress("glGenProgramsARB");
|
||||
|
||||
|
||||
for (num_layers = 0; textures[num_layers] != NULL; num_layers++)
|
||||
/* empty */ ;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, 1);
|
||||
glTexImage3D(GL_TEXTURE_2D_ARRAY_EXT, 0, GL_RGB8,
|
||||
256, 256, num_layers, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
||||
GL_CHECK_ERROR();
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_GENERATE_MIPMAP_SGIS,
|
||||
GL_TRUE);
|
||||
|
||||
for (i = 0; textures[i] != NULL; i++) {
|
||||
GLint width, height;
|
||||
GLenum format;
|
||||
|
||||
GLubyte *image = LoadRGBImage(textures[i], &width, &height, &format);
|
||||
if (!image) {
|
||||
printf("Error: could not load texture image %s\n", textures[i]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* resize to 256 x 256 */
|
||||
if (width != 256 || height != 256) {
|
||||
GLubyte *newImage = malloc(256 * 256 * 4);
|
||||
gluScaleImage(format, width, height, GL_UNSIGNED_BYTE, image,
|
||||
256, 256, GL_UNSIGNED_BYTE, newImage);
|
||||
free(image);
|
||||
image = newImage;
|
||||
}
|
||||
|
||||
glTexSubImage3D(GL_TEXTURE_2D_ARRAY_EXT, 0,
|
||||
0, 0, i, 256, 256, 1,
|
||||
format, GL_UNSIGNED_BYTE, image);
|
||||
free(image);
|
||||
}
|
||||
GL_CHECK_ERROR();
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
GL_CHECK_ERROR();
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
GL_CHECK_ERROR();
|
||||
|
||||
compile_fragment_program(1, frag_prog);
|
||||
GL_CHECK_ERROR();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowPosition(0, 0);
|
||||
glutInitWindowSize(350, 350);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
|
||||
glutCreateWindow("Array texture test");
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
glutDisplayFunc(Display);
|
||||
glutIdleFunc(Idle);
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
@@ -11,13 +11,17 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stddef.h> /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */
|
||||
#ifdef __VMS
|
||||
# include <stddef.h> /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */
|
||||
#else
|
||||
# include <malloc.h> /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#define GL_GLEXT_LEGACY
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
|
||||
|
||||
GLfloat verts[][4] = {
|
||||
{ -0.5, -0.5, -2.0, 0.0 },
|
||||
|
||||
@@ -38,7 +38,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h> /* for cos(), sin(), and sqrt() */
|
||||
#include <stddef.h> /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */
|
||||
#ifdef __VMS
|
||||
# include <stddef.h> /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */
|
||||
#else
|
||||
# include <malloc.h> /* for ptrdiff_t, referenced by GL.h when GL_GLEXT_LEGACY defined */
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user