Compare commits
249 Commits
mesa_4_0_1
...
mesa_4_0_4
Author | SHA1 | Date | |
---|---|---|---|
|
61b226a4f4 | ||
|
adc4d21dbb | ||
|
efaa8be77f | ||
|
ed7b3b61f5 | ||
|
17d73e49c8 | ||
|
032341cbea | ||
|
53170a3af0 | ||
|
57181b2c0a | ||
|
00a1ff66e2 | ||
|
635e8c3459 | ||
|
6d99cffed3 | ||
|
9c16911e06 | ||
|
0de37dcc2e | ||
|
a53dccf9c5 | ||
|
3291a3c69c | ||
|
d2fba8a633 | ||
|
8d7ed801a5 | ||
|
689a803c90 | ||
|
8365cbbc85 | ||
|
baa9451a93 | ||
|
79c9cca366 | ||
|
14b30bace0 | ||
|
1c6b172c01 | ||
|
da1a6739fe | ||
|
15b418be49 | ||
|
33629a0d70 | ||
|
d8f5422a37 | ||
|
b83df71385 | ||
|
b7f6f84fc2 | ||
|
50cd089a7f | ||
|
7e22bad6da | ||
|
7d46390bd4 | ||
|
3580b7a3d3 | ||
|
c383ce0e0f | ||
|
a10727eedc | ||
|
d4c7dd076c | ||
|
1e57a87e6a | ||
|
6080451f93 | ||
|
5419097b37 | ||
|
889b6c4e7a | ||
|
58be490b08 | ||
|
d314643448 | ||
|
a28d96bd0e | ||
|
6d3c1ec7cd | ||
|
aa80a17ad0 | ||
|
1509a4399a | ||
|
c2065e3ea5 | ||
|
ba35bb6897 | ||
|
eefdfddd3e | ||
|
00068e6686 | ||
|
1c1f60d437 | ||
|
476c1fdbc6 | ||
|
5613f469d7 | ||
|
6338c52cd4 | ||
|
c4c5e26cc7 | ||
|
b6454b19ae | ||
|
84c56fef84 | ||
|
a2bb621983 | ||
|
d057db7942 | ||
|
5c04890c5f | ||
|
fb3475078d | ||
|
ea214a755b | ||
|
8af93aa529 | ||
|
ab81956422 | ||
|
38a30cfef0 | ||
|
e95e02331e | ||
|
9636b9aa25 | ||
|
f610b8f418 | ||
|
601fd74868 | ||
|
36ee4317c2 | ||
|
9d4181cd56 | ||
|
cf1dc9faf9 | ||
|
6fa2c761a1 | ||
|
d9c191f2ad | ||
|
36b477442f | ||
|
95358c87ef | ||
|
829ca52b1a | ||
|
767b8b6b81 | ||
|
634d720426 | ||
|
72dcd2b1b0 | ||
|
b60335f125 | ||
|
3e78e05a4c | ||
|
1099dcdc09 | ||
|
a73bc7e9ce | ||
|
19f17185bd | ||
|
22f431fc84 | ||
|
5538b98051 | ||
|
f2acb26f16 | ||
|
6d0fd19a71 | ||
|
670ea9f590 | ||
|
c3be87b84b | ||
|
a4d34a5688 | ||
|
e64e5f5529 | ||
|
4266ec91fe | ||
|
8a5bdd826a | ||
|
20cbbf8459 | ||
|
2847895a03 | ||
|
79d05b5649 | ||
|
a0ad8d5a8a | ||
|
1a9198f118 | ||
|
dd8fbed413 | ||
|
972cc7827f | ||
|
263d8ff8e3 | ||
|
363c8b9048 | ||
|
eb7b122807 | ||
|
6306085c69 | ||
|
7e20f99f81 | ||
|
a79f7f8838 | ||
|
d1d4f6bd34 | ||
|
640f61ba13 | ||
|
07e3f72bf8 | ||
|
d06d24f497 | ||
|
3fa786c175 | ||
|
984bb590df | ||
|
67c5effe5c | ||
|
fbe488cb76 | ||
|
dbd36a0ca0 | ||
|
076870f384 | ||
|
c1fba8241b | ||
|
690798ae3b | ||
|
89e91fcc9a | ||
|
d5a8eeaeeb | ||
|
b118f433e1 | ||
|
fbbb780e1f | ||
|
9429860763 | ||
|
531af3f17f | ||
|
054f415f45 | ||
|
b1b4382283 | ||
|
3aef708b56 | ||
|
d63730d087 | ||
|
2469fc9672 | ||
|
86ab257a46 | ||
|
d7e7d8ec74 | ||
|
fe4edce605 | ||
|
b0f477e5dd | ||
|
ce4c38fe2e | ||
|
09760a9563 | ||
|
d7abab5c67 | ||
|
e900da049b | ||
|
9def08ad3d | ||
|
978731595d | ||
|
00e5cb4120 | ||
|
b338ee265a | ||
|
8d3f06a565 | ||
|
0d1785c6db | ||
|
79474dc528 | ||
|
43e90c0053 | ||
|
c748b6c3d8 | ||
|
2c109c15e0 | ||
|
22fcb86432 | ||
|
70c5d68365 | ||
|
1b0fcb2124 | ||
|
6668d2fcb1 | ||
|
e3c2d6bd0c | ||
|
655e0ad0c1 | ||
|
d99fa29b94 | ||
|
7229861a46 | ||
|
f5130e3473 | ||
|
a5ed2460e9 | ||
|
e2130abf8f | ||
|
bf6a6f1d59 | ||
|
abd10c99e5 | ||
|
c3bc8a9c1e | ||
|
aa5698e8ed | ||
|
cf4c9ada0d | ||
|
13c751a1c2 | ||
|
2af71a9acf | ||
|
5e0316f1a8 | ||
|
2366fb3b89 | ||
|
4ad3511865 | ||
|
44f6191507 | ||
|
aaf89c1cc7 | ||
|
7350dd7395 | ||
|
972815c414 | ||
|
0bb0b4df73 | ||
|
e07b4252ad | ||
|
b8855675ca | ||
|
6bf823ac2d | ||
|
af3f3080f9 | ||
|
bb47715320 | ||
|
cef9cdf3bb | ||
|
4493f41577 | ||
|
a4f3130a7f | ||
|
b2c3daa875 | ||
|
3d6951c097 | ||
|
db0ed6252b | ||
|
e6c59e8d0c | ||
|
378fcdb818 | ||
|
cd3f5d807a | ||
|
c3e908891c | ||
|
fdbaf407a7 | ||
|
5a86d3852c | ||
|
96d0be5cf2 | ||
|
0bd26c3c55 | ||
|
9f7053e913 | ||
|
9fa55ac457 | ||
|
101092ea11 | ||
|
da648d9afd | ||
|
7a3b7c9687 | ||
|
55f8fcba10 | ||
|
7419597f2f | ||
|
e784671997 | ||
|
c2165e799c | ||
|
40519b3eb3 | ||
|
dcda68de33 | ||
|
8308199e5d | ||
|
3b029b0c7d | ||
|
bff7677bd9 | ||
|
41796ecc25 | ||
|
94865a95b1 | ||
|
b8b23d4552 | ||
|
3245cfdf41 | ||
|
69e043158a | ||
|
3ce17ffb84 | ||
|
33b483f882 | ||
|
308a036114 | ||
|
4c97c84f7e | ||
|
d7bde06097 | ||
|
a00292bcfe | ||
|
7d729ffb58 | ||
|
aeb6c0af5e | ||
|
41110917d7 | ||
|
a58b1ed0a3 | ||
|
27b503cab8 | ||
|
d38cdd33d0 | ||
|
851acc6ea7 | ||
|
6115d784a7 | ||
|
fcca385bec | ||
|
06743cf365 | ||
|
b372b40bd1 | ||
|
3e3bd40614 | ||
|
3fb6d0bfde | ||
|
b36acc0423 | ||
|
287d6127d2 | ||
|
a8290d3a95 | ||
|
b26f972618 | ||
|
5bd6bad38d | ||
|
1ae3437156 | ||
|
93665403aa | ||
|
04613cb0bc | ||
|
e0a30e9d2d | ||
|
fd3da01ec3 | ||
|
40bbb8b7f3 | ||
|
00b7772bda | ||
|
0fc4d7e46d | ||
|
1261fed2c3 | ||
|
4f4f542bd7 | ||
|
550169ab62 | ||
|
ad83c33a4d |
52
Make-config
52
Make-config
@@ -1,13 +1,13 @@
|
||||
# $Id: Make-config,v 1.50.2.4 2001/12/14 17:46:20 kschultz Exp $
|
||||
# $Id: Make-config,v 1.50.2.11 2002/09/03 17:50:19 brianp Exp $
|
||||
|
||||
MESA_MAJOR=4
|
||||
MESA_MINOR=0
|
||||
MESA_TINY=0
|
||||
MESA_TINY=4
|
||||
VERSION=$(MESA_MAJOR).$(MESA_MINOR)
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
#
|
||||
# Copyright (C) 1999-2001 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"),
|
||||
@@ -606,6 +606,32 @@ linux-x86:
|
||||
X86/sse_xform3.S X86/sse_xform4.S \
|
||||
X86/sse_normal.S X86/sse_vertex.S"
|
||||
|
||||
linux-icc:
|
||||
$(MAKE) $(MFLAGS) -f Makefile.X11 targets \
|
||||
"GL_LIB = libGL.so" \
|
||||
"GLU_LIB = libGLU.so" \
|
||||
"GLUT_LIB = libglut.so" \
|
||||
"GLW_LIB = libGLw.so" \
|
||||
"OSMESA_LIB = libOSMesa.so" \
|
||||
"CC = icc" \
|
||||
"CPLUSPLUS = g++" \
|
||||
"CFLAGS = -O3 -tpp6 -KPIC -D_GCC_LIMITS_H_ -D__GNUC__ -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DPTHREADS -I/usr/X11R6/include" \
|
||||
"MAKELIB = ../bin/mklib.linux" \
|
||||
"GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lm -lpthread" \
|
||||
"GLU_LIB_DEPS = -L../lib -lGL -lm" \
|
||||
"GLUT_LIB_DEPS = -L../lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \
|
||||
"APP_LIB_DEPS = -lm" \
|
||||
"ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \
|
||||
X86/x86_xform2.S X86/x86_xform3.S X86/x86_xform4.S \
|
||||
X86/x86_cliptest.S X86/x86_vertex.S \
|
||||
X86/mmx_blend.S \
|
||||
X86/3dnow_xform1.S X86/3dnow_xform2.S \
|
||||
X86/3dnow_xform3.S X86/3dnow_xform4.S \
|
||||
X86/3dnow_normal.S X86/3dnow_vertex.S \
|
||||
X86/sse_xform1.S X86/sse_xform2.S \
|
||||
X86/sse_xform3.S X86/sse_xform4.S \
|
||||
X86/sse_normal.S X86/sse_vertex.S"
|
||||
|
||||
linux-x86-static:
|
||||
$(MAKE) $(MFLAGS) -f Makefile.X11 targets \
|
||||
"GL_LIB = libGL.a" \
|
||||
@@ -697,7 +723,7 @@ linux-386-glide:
|
||||
"GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -L/usr/local/glide/lib -lglide2x -lm -lpthread" \
|
||||
"GLU_LIB_DEPS = -L../lib -lGL -lm" \
|
||||
"GLUT_LIB_DEPS = -L../lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \
|
||||
"APP_LIB_DEPS = -L/usr/local/glide/lib -lglide2x -lglut -lGLU -lGL"
|
||||
"APP_LIB_DEPS = -L/usr/local/glide/lib -lglide2x -lglut -lGLU -lGL -lm" \
|
||||
"ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \
|
||||
X86/x86_xform2.S X86/x86_xform3.S X86/x86_xform4.S \
|
||||
X86/x86_cliptest.S X86/x86_vertex.S"
|
||||
@@ -717,7 +743,7 @@ linux-386-opt-glide:
|
||||
"GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -L/usr/local/glide/lib -lglide2x -lm -lpthread" \
|
||||
"GLU_LIB_DEPS = -L../lib -lGL -lm" \
|
||||
"GLUT_LIB_DEPS = -L../lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \
|
||||
"APP_LIB_DEPS = -lm" \
|
||||
"APP_LIB_DEPS = -L/usr/local/glide/lib -lglide2x -lglut -lGLU -lGL -lm" \
|
||||
"ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \
|
||||
X86/x86_xform2.S X86/x86_xform3.S X86/x86_xform4.S \
|
||||
X86/x86_cliptest.S X86/x86_vertex.S"
|
||||
@@ -736,7 +762,7 @@ linux-x86-glide:
|
||||
"GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -L/usr/local/glide/lib -lglide2x -lm -lpthread" \
|
||||
"GLU_LIB_DEPS = -L../lib -lGL -lm" \
|
||||
"GLUT_LIB_DEPS = -L../lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \
|
||||
"APP_LIB_DEPS = -lm" \
|
||||
"APP_LIB_DEPS = -L/usr/local/glide/lib -lglide2x -lglut -lGLU -lGL -lm" \
|
||||
"ASM_SOURCES = X86/common_x86_asm.S X86/glapi_x86.S \
|
||||
X86/x86_xform2.S X86/x86_xform3.S X86/x86_xform4.S \
|
||||
X86/x86_cliptest.S X86/x86_vertex.S \
|
||||
@@ -867,7 +893,7 @@ linux-osmesa16:
|
||||
"OSMESA16_LIB = libOSMesa16.so" \
|
||||
"CC = gcc" \
|
||||
"CPLUSPLUS = g++" \
|
||||
"CFLAGS = -g -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG -DCHAN_BITS=16 -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \
|
||||
"CFLAGS = -O3 -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG -DCHAN_BITS=16 -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \
|
||||
"CCFLAGS = $(CFLAGS)" \
|
||||
"MAKELIB = ../bin/mklib.linux" \
|
||||
"GL_LIB_DEPS = -lm -lpthread" \
|
||||
@@ -879,7 +905,7 @@ linux-osmesa32:
|
||||
"OSMESA16_LIB = libOSMesa32.so" \
|
||||
"CC = gcc" \
|
||||
"CPLUSPLUS = g++" \
|
||||
"CFLAGS = -g -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG -DCHAN_BITS=32 -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \
|
||||
"CFLAGS = -O3 -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG -DCHAN_BITS=32 -DDEFAULT_SOFTWARE_DEPTH_BITS=31" \
|
||||
"CCFLAGS = $(CFLAGS)" \
|
||||
"MAKELIB = ../bin/mklib.linux" \
|
||||
"GL_LIB_DEPS = -lm -lpthread" \
|
||||
@@ -1212,6 +1238,7 @@ sunos5:
|
||||
"GLW_LIB = libGLw.a" \
|
||||
"OSMESA_LIB = libOSMesa.a" \
|
||||
"CC = cc" \
|
||||
"CPLUSPLUS = CC" \
|
||||
"CFLAGS = -Xa -fast -xO4 -native -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DSOLARIS_2_4_BUG" \
|
||||
"MAKELIB = ../bin/mklib.ar-ruv" \
|
||||
"APP_LIB_DEPS = -L/usr/openwin/lib -L/usr/dt/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
|
||||
@@ -1224,6 +1251,7 @@ sunos5-sl:
|
||||
"GLW_LIB = libGLw.so" \
|
||||
"OSMESA_LIB = libOSMesa.so" \
|
||||
"CC = cc" \
|
||||
"CPLUSPLUS = CC" \
|
||||
"CFLAGS = -KPIC -Xa -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DSOLARIS_2_4_BUG" \
|
||||
"MAKELIB = ../bin/mklib.sunos5" \
|
||||
"APP_LIB_DEPS = -L/usr/openwin/lib -L/usr/dt/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
|
||||
@@ -1236,6 +1264,7 @@ sunos5-ultra:
|
||||
"GLW_LIB = libGLw.a" \
|
||||
"OSMESA_LIB = libOSMesa.a" \
|
||||
"CC = cc" \
|
||||
"CPLUSPLUS = CC" \
|
||||
"CFLAGS = -Xa -fast -xO5 -xtarget=ultra -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DSOLARIS_2_4_BUG" \
|
||||
"MAKELIB = ../bin/mklib.ar-ruv" \
|
||||
"APP_LIB_DEPS = -L/usr/openwin/lib -L/usr/dt/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
|
||||
@@ -1248,6 +1277,7 @@ sunos5-ultra-sl:
|
||||
"GLW_LIB = libGLw.so" \
|
||||
"OSMESA_LIB = libOSMesa.so" \
|
||||
"CC = cc" \
|
||||
"CPLUSPLUS = CC" \
|
||||
"CFLAGS = -KPIC -Xa -fast -xO5 -xtarget=ultra -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DSOLARIS_2_4_BUG" \
|
||||
"MAKELIB = ../bin/mklib.sunos5" \
|
||||
"APP_LIB_DEPS = -L/usr/openwin/lib -L/usr/dt/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm"
|
||||
@@ -1487,13 +1517,13 @@ linux-debug:
|
||||
"OSMESA_LIB = libOSMesa.so" \
|
||||
"CC = gcc" \
|
||||
"CPLUSPLUS = g++" \
|
||||
"CFLAGS = -g -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG -DSVGA -I/usr/include/glide -DFX -DMESA_TRACE" \
|
||||
"CFLAGS = -g -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG -DSVGA_foo -I/usr/include/glide -DFX_foo -DMESA_TRACE" \
|
||||
"CCFLAGS = $(CFLAGS)" \
|
||||
"MAKELIB = ../bin/mklib.linux" \
|
||||
"GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread -L/usr/local/glide/lib -lglide2x -lvga" \
|
||||
"GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread" \
|
||||
"GLU_LIB_DEPS = -L../lib -lGL -lm" \
|
||||
"GLUT_LIB_DEPS = -L../lib -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm" \
|
||||
"APP_LIB_DEPS = -lglut -lGLU -lGL -L/usr/local/glide/lib -lglide2x"
|
||||
"APP_LIB_DEPS = -lglut -lGLU -lGL"
|
||||
|
||||
linux-x11-debug:
|
||||
$(MAKE) $(MFLAGS) -f Makefile.X11 targets \
|
||||
|
27
Makefile.X11
27
Makefile.X11
@@ -1,9 +1,9 @@
|
||||
# $Id: Makefile.X11,v 1.56.2.3 2001/12/14 17:11:46 kschultz Exp $
|
||||
# $Id: Makefile.X11,v 1.56.2.13 2002/09/19 16:36:35 brianp Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 4.0
|
||||
# Version: 4.0.4
|
||||
#
|
||||
# Copyright (C) 1999-2001 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"),
|
||||
@@ -87,6 +87,7 @@ default:
|
||||
@echo " make linux-sparc-ultra for UltraSparc systems, make ELF shared libs"
|
||||
@echo " make linux-osmesa16 for 16-bit/channel OSMesa"
|
||||
@echo " make linux-osmesa32 for 32-bit/channel OSMesa"
|
||||
@echo " make linux-icc for Linux with the Intel C/C++ compiler"
|
||||
@echo " make lynxos for LynxOS systems with GCC"
|
||||
@echo " make macintosh for Macintosh"
|
||||
@echo " make machten-2.2 for Macs w/ MachTen 2.2 (68k w/ FPU)"
|
||||
@@ -143,7 +144,7 @@ hpux9 hpux9-sl hpux9-gcc hpux9-gcc-sl \
|
||||
hpux10 hpux10-sl hpux10-gcc hpux10-gcc-sl \
|
||||
irix4 irix5 irix5-gcc irix5-dso \
|
||||
linux linux-static linux-debug linux-x11-debug linux-static-debug linux-prof \
|
||||
linux-x86 linux-x86-static linux-x86-debug \
|
||||
linux-x86 linux-icc linux-x86-static linux-x86-debug \
|
||||
linux-glide linux-386-glide linux-386-opt-glide \
|
||||
linux-x86-glide linux-glide-debug linux-glide-prof \
|
||||
linux-alpha-static linux-alpha \
|
||||
@@ -329,10 +330,10 @@ realclean: clean
|
||||
|
||||
|
||||
|
||||
DIRECTORY = Mesa-4.0
|
||||
LIB_NAME = MesaLib-4.0
|
||||
DEMO_NAME = MesaDemos-4.0
|
||||
GLU_NAME = MesaGLU-4.0
|
||||
DIRECTORY = Mesa-4.0.4
|
||||
LIB_NAME = MesaLib-4.0.4
|
||||
DEMO_NAME = MesaDemos-4.0.4
|
||||
GLU_NAME = MesaGLU-4.0.4
|
||||
GLUT_NAME = GLUT-3.7
|
||||
|
||||
|
||||
@@ -377,7 +378,7 @@ LIB_FILES = \
|
||||
$(DIRECTORY)/include/GL/internal/glcore.h \
|
||||
$(DIRECTORY)/include/GL/Makefile.in \
|
||||
$(DIRECTORY)/include/GL/Makefile.am \
|
||||
$(DIRECTORY)/include/GL/dosmesa.h \
|
||||
$(DIRECTORY)/include/GL/dmesa.h \
|
||||
$(DIRECTORY)/include/GL/amesa.h \
|
||||
$(DIRECTORY)/include/GL/fxmesa.h \
|
||||
$(DIRECTORY)/include/GL/ggimesa.h \
|
||||
@@ -400,6 +401,7 @@ LIB_FILES = \
|
||||
$(DIRECTORY)/include/GL/xmesa_x.h \
|
||||
$(DIRECTORY)/include/GL/xmesa_xf86.h \
|
||||
$(DIRECTORY)/include/GLView.h \
|
||||
$(DIRECTORY)/include/dmesadxe.h \
|
||||
$(DIRECTORY)/include/Makefile.in \
|
||||
$(DIRECTORY)/include/Makefile.am \
|
||||
$(DIRECTORY)/src/Makefile* \
|
||||
@@ -430,6 +432,9 @@ LIB_FILES = \
|
||||
$(DIRECTORY)/src/windml/tornado/*.cdf \
|
||||
$(DIRECTORY)/src/windml/man3/*.3 \
|
||||
$(DIRECTORY)/src/windml/man3/*.html \
|
||||
$(DIRECTORY)/src/DOS/*.[chS] \
|
||||
$(DIRECTORY)/src/DOS/vesa/*.[ch] \
|
||||
$(DIRECTORY)/src/BeOS/*.h \
|
||||
$(DIRECTORY)/src/BeOS/*.cpp \
|
||||
$(DIRECTORY)/src/FX/Makefile.am \
|
||||
$(DIRECTORY)/src/FX/Makefile.in \
|
||||
@@ -578,7 +583,6 @@ OBSOLETE_LIB_FILES = \
|
||||
$(DIRECTORY)/src/D3D/*bat \
|
||||
$(DIRECTORY)/src/D3D/*DEF \
|
||||
$(DIRECTORY)/src/DOS/DEPEND.DOS \
|
||||
$(DIRECTORY)/src/DOS/*.c \
|
||||
$(DIRECTORY)/src/S3/*.[ch] \
|
||||
$(DIRECTORY)/src/S3/*.def \
|
||||
$(DIRECTORY)/src/S3/*.mak \
|
||||
@@ -611,6 +615,9 @@ DEMO_FILES = \
|
||||
$(DIRECTORY)/src-glut/descrip.mms \
|
||||
$(DIRECTORY)/src-glut/mms_depend \
|
||||
$(DIRECTORY)/src-glut/*.[ch] \
|
||||
$(DIRECTORY)/src-glut.dos/*.[ch] \
|
||||
$(DIRECTORY)/src-glut.dos/Makefile.DJ \
|
||||
$(DIRECTORY)/src-glut.dos/PC_HW/*.[chS] \
|
||||
$(DIRECTORY)/images/* \
|
||||
$(DIRECTORY)/demos/Makefile* \
|
||||
$(DIRECTORY)/demos/descrip.mms \
|
||||
|
94
docs/MESA_agp_offset.spec
Normal file
94
docs/MESA_agp_offset.spec
Normal file
@@ -0,0 +1,94 @@
|
||||
Name
|
||||
|
||||
MESA_agp_offset
|
||||
|
||||
Name Strings
|
||||
|
||||
GLX_MESA_agp_offset
|
||||
|
||||
Contact
|
||||
|
||||
Brian Paul, Tungsten Graphics, Inc. (brian 'at' tungstengraphics.com)
|
||||
Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com)
|
||||
|
||||
Status
|
||||
|
||||
Shipping (Mesa 4.0.4 and later. Only implemented in particular
|
||||
XFree86/DRI drivers.)
|
||||
|
||||
Version
|
||||
|
||||
1.0
|
||||
|
||||
Number
|
||||
|
||||
TBD
|
||||
|
||||
Dependencies
|
||||
|
||||
OpenGL 1.0 or later is required
|
||||
GLX_NV_vertex_array_range is required.
|
||||
This extensions is written against the OpenGL 1.4 Specification.
|
||||
|
||||
Overview
|
||||
|
||||
This extensions provides a way to convert pointers in an AGP memory
|
||||
region into byte offsets into the AGP aperture.
|
||||
Note, this extension depends on GLX_NV_vertex_array_range, for which
|
||||
no real specification exists. See GL_NV_vertex_array_range for more
|
||||
information.
|
||||
|
||||
IP Status
|
||||
|
||||
None
|
||||
|
||||
Issues
|
||||
|
||||
None
|
||||
|
||||
New Procedures and Functions
|
||||
|
||||
GLuint glXGetAGPOffsetMESA( const GLvoid *pointer )
|
||||
|
||||
New Tokens
|
||||
|
||||
None
|
||||
|
||||
Additions to the OpenGL 1.4 Specification
|
||||
|
||||
None
|
||||
|
||||
Additions to Chapter 3 the GLX 1.4 Specification (Functions and Errors)
|
||||
|
||||
Add a new section, 3.6 as follows:
|
||||
|
||||
3.6 AGP Memory Access
|
||||
|
||||
On "PC" computers, AGP memory can be allocated with glXAllocateMemoryNV
|
||||
and freed with glXFreeMemoryNV. Sometimes it's useful to know where a
|
||||
block of AGP memory is located with respect to the start of the AGP
|
||||
aperature. The function
|
||||
|
||||
GLuint glXGetAGPOffsetMESA( const GLvoid *pointer )
|
||||
|
||||
Returns the offset of the given memory block from the start of AGP
|
||||
memory in basic machine units (i.e. bytes). If pointer is invalid
|
||||
the value ~0 will be returned.
|
||||
|
||||
GLX Protocol
|
||||
|
||||
None. This is a client side-only extension.
|
||||
|
||||
Errors
|
||||
|
||||
glXGetAGPOffsetMESA will return ~0 if the pointer does not point to
|
||||
an AGP memory region.
|
||||
|
||||
New State
|
||||
|
||||
None
|
||||
|
||||
Revision History
|
||||
|
||||
20 September 2002 - Initial draft
|
||||
2 October 2002 - finished GLX chapter 3 additions
|
138
docs/MESA_pack_invert.spec
Normal file
138
docs/MESA_pack_invert.spec
Normal file
@@ -0,0 +1,138 @@
|
||||
Name
|
||||
|
||||
MESA_pack_invert
|
||||
|
||||
Name Strings
|
||||
|
||||
GL_MESA_pack_invert
|
||||
|
||||
Contact
|
||||
|
||||
Brian Paul, Tungsten Graphics, Inc. (brian 'at' tungstengraphics.com)
|
||||
Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com)
|
||||
|
||||
Status
|
||||
|
||||
Shipping (Mesa 4.0.4 and later)
|
||||
|
||||
Version
|
||||
|
||||
1.0
|
||||
|
||||
Number
|
||||
|
||||
TBD
|
||||
|
||||
Dependencies
|
||||
|
||||
OpenGL 1.0 or later is required
|
||||
This extensions is written against the OpenGL 1.4 Specification.
|
||||
|
||||
Overview
|
||||
|
||||
This extension adds a new pixel storage parameter to indicate that
|
||||
images are to be packed in top-to-bottom order instead of OpenGL's
|
||||
conventional bottom-to-top order. Only pixel packing can be
|
||||
inverted (i.e. for glReadPixels, glGetTexImage, glGetConvolutionFilter,
|
||||
etc).
|
||||
|
||||
Almost all known image file formats store images in top-to-bottom
|
||||
order. As it is, OpenGL reads images from the frame buffer in
|
||||
bottom-to-top order. Thus, images usually have to be inverted before
|
||||
writing them to a file with image I/O libraries. This extension
|
||||
allows images to be read such that inverting isn't needed.
|
||||
|
||||
IP Status
|
||||
|
||||
None
|
||||
|
||||
Issues
|
||||
|
||||
1. Should we also defined UNPACK_INVERT_MESA for glDrawPixels, etc?
|
||||
|
||||
Resolved: No, we're only concerned with pixel packing. There are other
|
||||
solutions for inverting images when using glDrawPixels (negative Y pixel
|
||||
zoom) or glTexImage (invert the vertex T coordinates). It would be easy
|
||||
enough to define a complementary extension for pixel packing in the
|
||||
future if needed.
|
||||
|
||||
New Procedures and Functions
|
||||
|
||||
None
|
||||
|
||||
New Tokens
|
||||
|
||||
Accepted by the <pname> parameter of PixelStorei and PixelStoref
|
||||
and the <pname> parameter of GetIntegerv, GetFloatv, GetDoublev
|
||||
and GetBooleanv:
|
||||
|
||||
PACK_INVERT_MESA 0x8758
|
||||
|
||||
Additions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation)
|
||||
|
||||
None
|
||||
|
||||
Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization)
|
||||
|
||||
None
|
||||
|
||||
Additions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment
|
||||
Operations and the Frame Buffer)
|
||||
|
||||
Add the following entry to table 4.4 (PixelStore parameters) on page 182:
|
||||
|
||||
Parameter Name Type Initial Value Valid Range
|
||||
---------------------------------------------------------
|
||||
PACK_INVERT_MESA boolean FALSE TRUE/FALSE
|
||||
|
||||
In the section labeled "Placement in Client Memory" on page 184
|
||||
insert the following text into the paragraph before the sentence
|
||||
that starts with "If the format is RED, GREEN, BLUE...":
|
||||
|
||||
"The parameter PACK_INVERT_MESA controls whether the image is packed
|
||||
in bottom-to-top order (the default) or top-to-bottom order. Equation
|
||||
3.8 is modified as follows:
|
||||
|
||||
... the first element of the Nth row is indicated by
|
||||
|
||||
p + Nk, if PACK_INVERT_MESA is false
|
||||
p + k * (H - 1) - Nk, if PACK_INVERT_MESA is true, where H is the
|
||||
image height
|
||||
"
|
||||
|
||||
Additions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions)
|
||||
|
||||
None
|
||||
|
||||
Additions to Chapter 6 of the OpenGL 1.4 Specification (State and
|
||||
State Requests)
|
||||
|
||||
None
|
||||
|
||||
Additions to Appendix A of the OpenGL 1.4 Specification (Invariance)
|
||||
|
||||
None
|
||||
|
||||
Additions to the AGL/GLX/WGL Specifications
|
||||
|
||||
None
|
||||
|
||||
GLX Protocol
|
||||
|
||||
None
|
||||
|
||||
Errors
|
||||
|
||||
None
|
||||
|
||||
New State
|
||||
|
||||
Add the following entry to table 6.20 (Pixels) on page 235:
|
||||
|
||||
Get Value Type Get Cmd Initial Value Description Sec Attribute
|
||||
--------------------------------------------------------------------------------------------------
|
||||
PACK_INVERT_MESA boolean GetBoolean FALSE Value of PACK_INVERT_MESA 4.3.2 pixel-store
|
||||
|
||||
Revision History
|
||||
|
||||
21 September 2002 - Initial draft
|
@@ -15,11 +15,11 @@ Contact
|
||||
|
||||
Status
|
||||
|
||||
Not yet shipping.
|
||||
OBSOLETE - NEVER SHIPPED (use GL_NV_packed_depth_stencil)
|
||||
|
||||
Version
|
||||
|
||||
$Id: MESA_packed_depth_stencil.spec,v 1.1 2000/11/03 14:58:45 brianp Exp $
|
||||
$Id: MESA_packed_depth_stencil.spec,v 1.1.2.1 2002/09/20 19:14:11 brianp Exp $
|
||||
|
||||
Number
|
||||
|
||||
|
@@ -14,11 +14,11 @@ Contact
|
||||
|
||||
Status
|
||||
|
||||
Not yet shipping.
|
||||
OBSOLETE - NEVER SHIPPED (use GL_NV_point_sprite)
|
||||
|
||||
Version
|
||||
|
||||
$Id: MESA_sprite_point.spec,v 1.1 2000/12/08 00:21:02 brianp Exp $
|
||||
$Id: MESA_sprite_point.spec,v 1.1.2.1 2002/09/20 19:14:11 brianp Exp $
|
||||
|
||||
Number
|
||||
|
||||
|
197
docs/MESA_ycbcr_texture.spec
Normal file
197
docs/MESA_ycbcr_texture.spec
Normal file
@@ -0,0 +1,197 @@
|
||||
Name
|
||||
|
||||
MESA_ycbcr_texture
|
||||
|
||||
Name Strings
|
||||
|
||||
GL_MESA_ycbcr_texture
|
||||
|
||||
Contact
|
||||
|
||||
Brian Paul, Tungsten Graphics, Inc. (brian 'at' tungstengraphics.com)
|
||||
Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com)
|
||||
|
||||
Status
|
||||
|
||||
Shipping (Mesa 4.0.4 and later)
|
||||
|
||||
Version
|
||||
|
||||
1.0
|
||||
|
||||
Number
|
||||
|
||||
TBD
|
||||
|
||||
Dependencies
|
||||
|
||||
OpenGL 1.0 or later is required
|
||||
This extensions is written against the OpenGL 1.4 Specification.
|
||||
NV_texture_rectangle effects the definition of this extension.
|
||||
|
||||
Overview
|
||||
|
||||
This extension supports texture images in the YCbCr format. There is
|
||||
no support for converting YCbCr images to RGB or vice versa. The
|
||||
intention is for YCbCr image data to be directly sent to the renderer
|
||||
without any pixel transfer operations. Only 2D texture images are
|
||||
supported (not glDrawPixels, glReadPixels, etc).
|
||||
|
||||
A YCbCr pixel (texel) is a 16-bit unsigned short with two components.
|
||||
The first component is luminance (Y). For pixels in even-numbered
|
||||
image columns, the second component is Cb. For pixels in odd-numbered
|
||||
image columns, the second component is Cr. If one were to convert the
|
||||
data to RGB one would need to examine two pixels from columns N and N+1
|
||||
(where N is even) to deduce the RGB color.
|
||||
|
||||
IP Status
|
||||
|
||||
None
|
||||
|
||||
Issues
|
||||
|
||||
None
|
||||
|
||||
New Procedures and Functions
|
||||
|
||||
None
|
||||
|
||||
New Tokens
|
||||
|
||||
Accepted by the <internalFormat> and <format> parameters of
|
||||
TexImage2D and TexSubImage2D:
|
||||
|
||||
GL_YCBCR_MESA 0x8757
|
||||
|
||||
Accepted by the <type> parameter of TexImage2D and TexSubImage2D:
|
||||
|
||||
GL_UNSIGNED_SHORT_8_8_MESA 0x85BA /* same as Apple's */
|
||||
GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB /* same as Apple's */
|
||||
|
||||
Additions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation)
|
||||
|
||||
None
|
||||
|
||||
Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization)
|
||||
|
||||
In section 3.6.4, Rasterization of Pixel Rectangles, on page 102,
|
||||
add the following to Table 3.8 (Packed pixel formats):
|
||||
|
||||
type Parameter GL Data Number of Matching
|
||||
Token Name Type Components Pixel Formats
|
||||
-------------- ------- ---------- -------------
|
||||
UNSIGNED_SHORT_8_8_MESA ushort 3 YCBCR_422_MESA
|
||||
UNSIGNED_SHORT_8_8_REV_MESA ushort 3 YCBCR_422_MESA
|
||||
|
||||
|
||||
In section 3.6.4, Rasterization of Pixel Rectangles, on page 102,
|
||||
add the following to Table 3.10 (UNSIGNED_SHORT formats):
|
||||
|
||||
UNSIGNED_SHORT_8_8_MESA:
|
||||
|
||||
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
|
||||
+-------------------------------+-------------------------------+
|
||||
| 1st | 2nd |
|
||||
+-------------------------------+-------------------------------+
|
||||
|
||||
UNSIGNED_SHORT_8_8_REV_MESA:
|
||||
|
||||
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
|
||||
+-------------------------------+-------------------------------+
|
||||
| 2nd | 1st |
|
||||
+-------------------------------+-------------------------------+
|
||||
|
||||
|
||||
In section 3.6.4, Rasterization of Pixel Rectangles, on page 102,
|
||||
add the following to Table 3.12 (Packed pixel fiedl assignments):
|
||||
|
||||
First Second Third Fourth
|
||||
Format Element Element Element Element
|
||||
------ ------- ------- ------- -------
|
||||
YCBCR_422_MESA luminance chroma
|
||||
|
||||
|
||||
In section 3.8.1, Texture Image Specification, on page 125, add
|
||||
another item to the list of TexImage2D and TexImage3D equivalence
|
||||
exceptions:
|
||||
|
||||
* The value of internalformat and format may be YCBCR_MESA to
|
||||
indicate that the image data is in YCbCr format. type must
|
||||
be either UNSIGNED_SHORT_8_8_MESA or UNSIGNED_SHORT_8_8_REV_MESA
|
||||
as seen in tables 3.8 and 3.10. Table 3.12 describes the mapping
|
||||
between Y and Cb/Cr to the components.
|
||||
If NV_texture_rectangle is supported target may also be
|
||||
TEXTURE_RECTANGLE_NV or PROXY_TEXTURE_RECTANGLE_NV.
|
||||
All pixel transfer operations are bypassed. The texture is stored as
|
||||
YCbCr, not RGB. Queries of the texture's red, green and blue component
|
||||
sizes will return zero.
|
||||
|
||||
|
||||
In section 3.8.1, Texture Image Specification, on page 126, add
|
||||
another item to the list of TexImage1D and TexImage2D equivalence
|
||||
exceptions:
|
||||
|
||||
* The value of internalformat and format can not be YCBCR_MESA.
|
||||
|
||||
|
||||
In section 3.8.2, Alternate Texture Image Specification Commands, on
|
||||
page 129, insert this paragraph after the first full paragraph on the
|
||||
page:
|
||||
|
||||
"If the internal storage format of the image being updated by
|
||||
TexSubImage2D is YCBCR_MESA then format must be YCBCR_MESA.
|
||||
The error INVALID_OPERATION will be generated otherwise."
|
||||
|
||||
|
||||
Additions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment
|
||||
Operations and the Frame Buffer)
|
||||
|
||||
None
|
||||
|
||||
Additions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions)
|
||||
|
||||
None
|
||||
|
||||
Additions to Chapter 6 of the OpenGL 1.4 Specification (State and
|
||||
State Requests)
|
||||
|
||||
None
|
||||
|
||||
Additions to Appendix A of the OpenGL 1.4 Specification (Invariance)
|
||||
|
||||
None
|
||||
|
||||
Additions to the AGL/GLX/WGL Specifications
|
||||
|
||||
None
|
||||
|
||||
GLX Protocol
|
||||
|
||||
None
|
||||
|
||||
Errors
|
||||
|
||||
INVALID_ENUM is generated by TexImage2D if <internalFormat> is
|
||||
MESA_YCBCR but <format> is not MESA_YCBCR.
|
||||
|
||||
INVALID_ENUM is generated by TexImage2D if <format> is MESA_YCBCR but
|
||||
<internalFormat> is not MESA_YCBCR.
|
||||
|
||||
INVALID_VALUE is generated by TexImage2D if <format> is MESA_YCBCR and
|
||||
<internalFormat> is MESA_YCBCR and <border> is not zero.
|
||||
|
||||
INVALID_OPERATION is generated by TexSubImage2D if the internal image
|
||||
format is YCBCR_MESA and format is not YCBCR_MESA.
|
||||
|
||||
INVALID_OPERATION is generated by CopyTexSubImage2D if the internal
|
||||
image is YCBCR_MESA.
|
||||
|
||||
New State
|
||||
|
||||
Edit table 6.16 on page 231: change the type of TEXTURE_INTERNAL_FORMAT
|
||||
from n x Z42 to n x Z43 to indicate that internal format may also be
|
||||
YCBCR_MESA.
|
||||
|
||||
Revision History
|
||||
|
||||
20 September 2002 - Initial draft
|
141
docs/README.BEOS
141
docs/README.BEOS
@@ -1,102 +1,65 @@
|
||||
Mesa-4.0.3 BeOS R5 driver patch
|
||||
Version alpha v0.3
|
||||
|
||||
Mesa / BeOS Information
|
||||
HOW TO BUILD:
|
||||
|
||||
1) You need gcc 2.95.3 to be installed:
|
||||
http://www.bebits.com/app/2157
|
||||
Check your installed gcc version by running this command from a Terminal:
|
||||
gcc -v
|
||||
|
||||
2) Download Mesa-4.0.3 sources
|
||||
http://prdownloads.sourceforge.net/mesa3d/MesaLib-4.0.3.tar.gz?download
|
||||
|
||||
Introduction
|
||||
3) Extract official 4.0.3 sources code somewhere
|
||||
|
||||
Mesa 3.1 features a new driver for the BeOS. The new driver implements
|
||||
a clone of the BGLView class. This class, derived from BView, allows
|
||||
OpenGL rendering into a BeOS window.
|
||||
4) Then, extract the BeOS driver patch at same place. This will
|
||||
overwrite modified sources and add BeOS-specific ones.
|
||||
|
||||
Any application which uses the BGLView should be able to use Mesa
|
||||
instead of Be's OpenGL without changing any code.
|
||||
5) Open a new Terminal window:
|
||||
$ cd /path/to/Mesa-4.0.3/src
|
||||
$ make -f Makefile.BeOS-R5
|
||||
|
||||
Since Be's OpenGL implementation (as of R4) is basically just the
|
||||
SGI sample implementation, it's pretty slow. You'll see that Mesa
|
||||
is considerably faster.
|
||||
6) Take a cup of coffee!
|
||||
|
||||
7) When done, you should find a obj.x86/libGL.so
|
||||
|
||||
8) To test this library as a Be Inc's one:
|
||||
- rename /boot/beos/system/lib/libGL.so into libGL.so.r5
|
||||
- put/copy obj.x86/libGL.so file into /boot/home/config/lib directory
|
||||
- run GLTeapot...
|
||||
|
||||
Source Code
|
||||
To see more information, run your(s) GL app(s) from Terminal:
|
||||
$ export MESA_INFO=1
|
||||
$ export MESA_DEBUG=1
|
||||
$ myGLapp
|
||||
MMX cpu detected.
|
||||
Not testing OS support for SSE, leaving enabled.
|
||||
SSE cpu detected.
|
||||
Mesa GL_VERSION = 1.2 Mesa 4.0.3
|
||||
Mesa GL_RENDERER = BGLView
|
||||
Mesa GL_VENDOR = Brian Paul
|
||||
Mesa GL_EXTENSIONS = GL_ARB_imaging GL_ARB_multitexture
|
||||
[...]
|
||||
GL_SGIX_shadow GL_SGIX_shadow_ambient
|
||||
Mesa thread-safe: NO
|
||||
Mesa x86-optimized: YES
|
||||
Mesa sparc-optimized: NO
|
||||
|
||||
The source code for the driver is in Mesa-3.1/src/BeOS/GLView.cpp
|
||||
It's not 100% finished at this time but many GLUT-based demos are
|
||||
working. No optimizations have been made at this time.
|
||||
BUILD ISSUES:
|
||||
- If the build stop on math/m_*.c files, you're not using gcc 2.95.3.
|
||||
- The Makefile.BeOS-R5 is set currently to build a non-debug x86/mmx/sse/3dnow optimized libGL.so.
|
||||
It's a modified BeOS standard makefile, so editing it to follow your needs should be easy...
|
||||
- NASM support instead of built-in gcc assembler (GAS) is not supported yet...
|
||||
- "Mesa thread-safe: NO" is correct: the Mesa multithread support don't allow to share a gl context
|
||||
between any thread, only give you one thread <-> one context, which is inaccurate under BeOS...
|
||||
|
||||
KNOWN LIMITATIONS & BUGS:
|
||||
- BeOS driver only support software rendition ATM
|
||||
- No BDirectWindow support yet, too. GLLife will not work for this reason.
|
||||
- 3dnow support untested
|
||||
- GLTeapot: object mouse control don't work
|
||||
- GLTeapot: window resizing don't work
|
||||
- many others: ALPHA VERSION, remember.
|
||||
|
||||
|
||||
Compiling
|
||||
|
||||
In the Mesa-3.x directory type "make -f Makefile.X11 beos-r4".
|
||||
When it finishes the libMesaGL.so and libMesaGLU.so libraries for
|
||||
BeOS will be in the Mesa-3.x/lib/ directory.
|
||||
|
||||
|
||||
|
||||
Example Programs
|
||||
|
||||
Look in the Mesa-3.x/BeOS/ directory for one or two BGLView demo
|
||||
programs. They should have been compiled along with the Mesa
|
||||
library.
|
||||
|
||||
|
||||
|
||||
GLUT
|
||||
|
||||
A version of GLUT 2.5 for BeOS can be found in src-glut.beos/.
|
||||
The original distribution can be obtained from
|
||||
http://home.beoscentral.com/jehamby/Glut-3.5-x86.zip
|
||||
|
||||
This is a special version of GLUT adapted for the BeOS. I don't
|
||||
believe Mark Kilgard's normal GLUT distribution includes BeOS
|
||||
support.
|
||||
|
||||
It seems that you have to recompile GLUT with libMesaGL.so instead
|
||||
of libGL.so in order for everything to work. I'm not sure why.
|
||||
|
||||
|
||||
|
||||
Special Features
|
||||
|
||||
Mesa's implementation of the BGLView class has an extra member
|
||||
function: CopySubBufferMESA(). It basically works like SwapBuffers()
|
||||
but it only copies a sub region from the back buffer to the front
|
||||
buffer. This is a useful optimization for some applications.
|
||||
If you use this method in your code be sure that you check at runtime
|
||||
that you're actually using Mesa (with glGetString) so you don't
|
||||
cause a fatal error when running with Be's OpenGL.
|
||||
|
||||
|
||||
|
||||
Work Left To Do
|
||||
|
||||
Color index mode is not implemented yet.
|
||||
|
||||
Reading pixels from the front buffer not implemented yet.
|
||||
|
||||
There is also a BGLScreen class in BeOS for full-screen OpenGL
|
||||
rendering. This should also be implemented for Mesa.
|
||||
|
||||
|
||||
|
||||
Old BeOS Driver
|
||||
|
||||
Mesa 2.6 had an earlier BeOS driver. It was based on Mesa's Off-screen
|
||||
rendering interface, not BGLView. If you're interested in the older
|
||||
driver you should get Mesa 2.6.
|
||||
|
||||
|
||||
|
||||
BeOS and Glide
|
||||
|
||||
Mesa 3.0 supported the 3Dfx/Glide library on Beos. Download Mesa 3.0
|
||||
if interested. Ideally, the 3Dfx/Glide support should be updated to
|
||||
work with the new Mesa 3.1 BGLView implementation.
|
||||
|
||||
The Glide library hasn't been updated for BeOS R4, to my knowledge, as
|
||||
of February, 1999.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
$Id: README.BEOS,v 1.6 1999/11/27 01:40:40 brianp Exp $
|
||||
philippe.houdoin@free.fr
|
||||
|
211
docs/README.DJ
Normal file
211
docs/README.DJ
Normal file
@@ -0,0 +1,211 @@
|
||||
Mesa 4.0 DOS/DJGPP Port v1.1
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
||||
Description:
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Well, guess what... this is the DOS port of Mesa 4.0.4, for DJGPP fans... Whoa!
|
||||
The driver has its origins in ddsample.c, written by Brian Paul and found by me
|
||||
in Mesa 3.4.2.
|
||||
|
||||
|
||||
|
||||
Legal:
|
||||
~~~~~~
|
||||
|
||||
Mesa copyright applies, provided this package is used within Mesa. For anything
|
||||
else, see GPL.
|
||||
|
||||
|
||||
|
||||
Installation:
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
Unzip and type:
|
||||
|
||||
make -f Makefile.DJ [OPTIONS...]
|
||||
|
||||
Available options:
|
||||
|
||||
Environment variables:
|
||||
CPU optimize for the given processor.
|
||||
default = k6
|
||||
BIG_OPT=1 crazy optimizations; not very useful, though...
|
||||
default = no
|
||||
GLIDE absolute path to Glide library; used with FX.
|
||||
default = $(TOP)/include/glide3
|
||||
FX=1 build for 3dfx Glide3; use it if you have the Glide
|
||||
SDK (designed for your platform), and, of course, a
|
||||
3dfx card... Note that this disables compilation of
|
||||
actual DMesa code, as Glide does all the stuff!
|
||||
default = no
|
||||
HAVE_X86=1 optimize for i386.
|
||||
default = no
|
||||
HAVE_MMX=1 MMX instructions; use only if you assembler/compiler
|
||||
supports MMX instruction set; backwards compatibility
|
||||
with older processors is still preserved.
|
||||
default = no
|
||||
HAVE_SSE=1 (see HAVE_MMX)
|
||||
default = no
|
||||
HAVE_3DNOW=1 (see HAVE_MMX)
|
||||
default = no
|
||||
|
||||
Targets:
|
||||
all: build everything
|
||||
libgl: build GL
|
||||
libglu: build GLU
|
||||
libglut: build GLUT
|
||||
clean: remove object files
|
||||
realclean: remove all generated files
|
||||
|
||||
|
||||
|
||||
Tested on:
|
||||
CPU: K6-2 (CXT) @500(412.5) MHz
|
||||
Mainboard: ViA Apollo VP2/97 w/ 128 MB SDRAM
|
||||
Video card: PowerColor Evil King3 (Voodoo3 3000) w/ 16384 kB SDRAM
|
||||
DJGPP: djdev 2.03 + gcc v3.1 + make v3.79.1
|
||||
|
||||
|
||||
|
||||
FAQ:
|
||||
~~~~
|
||||
|
||||
1. Compilation
|
||||
|
||||
Q) I tried to run `make' and it exits because `gcc' complains it cannot find
|
||||
some stupid file.
|
||||
A) You need LFN support.
|
||||
A) When compiling for Glide (FX=1), pay attention to Glide path.
|
||||
|
||||
2. Dynamic modules
|
||||
|
||||
Q) What are you mumbling about dynamic modules?
|
||||
A) You must have the DXE2 package (available on SimTel.Net, courtesy of
|
||||
Andrew Zabolotny) installed in order to build the dynamic modules.
|
||||
|
||||
Q) I have DXE2, but I couln'd build the `dxe2gen.exe'.
|
||||
Q) I built `dxe2gen.exe', but it doesn't do the job right.
|
||||
A) There is a patched version on my web page.
|
||||
|
||||
Q) DXE2 modules give me headaches...
|
||||
A) The DXE2 modules are not compulsory. The static libraries are still built
|
||||
and you can use them in the old-fashioned, classic way. For example:
|
||||
gcc -o OUT.exe IN.c -lglut -lglu -lgl
|
||||
|
||||
Q) Okay, DXE2 modules are built. How can I use them?
|
||||
A) Usage of the dynamic modules requires three things:
|
||||
- include DMESADXE.H in one of the sources, so references inside
|
||||
dynamic modules will get resolved (or use `-include' directive).
|
||||
- link against import libraries (libI*.a) and LIBDL.A, which will do
|
||||
the dynamic linkage job for you
|
||||
- put the DXEs somewhere along the library path (LD_LIBRARY_PATH) or
|
||||
in the current directory
|
||||
For example:
|
||||
gcc -o OUT.exe -include dmesadxe.h IN.c -ligl -liglu -liglut -ldl
|
||||
|
||||
Q) The application dies with "Abort!" due to unresolved symbols.
|
||||
A) This is bad! Extract the unresolved symbol list from this module. For
|
||||
example:
|
||||
dxe2gen --show-unres gl.dxe > u
|
||||
Check DMESADXE.H; the symbols in `u' must either be present here or be
|
||||
exported from another module that has to be loaded before your faulting
|
||||
one. Then recompile.
|
||||
|
||||
3. Using Mesa for DJGPP
|
||||
|
||||
Q) Does this build work in Win9x?
|
||||
A) Yes.
|
||||
|
||||
Q) Does it work under NT (W2k, XP) core?
|
||||
A) Uh... probably not!
|
||||
|
||||
Q) I made a simple application and it does nothing. It exits right away. Not
|
||||
even a blank screen.
|
||||
A) The current version supports only RGB[A] modes, for it made no sense to
|
||||
me to endorse color-index (aka palette) modes.
|
||||
A) Single-buffered is not allowed at all. Until I can find a way to use
|
||||
*REAL* hardware acceleration, it won't get implemented.
|
||||
A) Another weird "feature" is that buffer width must be multiple of 4 (I'm a
|
||||
lazy programmer and I found that the easiest way to keep buffer handling
|
||||
at peak performance ;-).
|
||||
|
||||
Q) My demo doesn't display text. I know I used the glut font routines!
|
||||
A) Then you probably use GLUT as a DXE. Well, there is no direct access to
|
||||
variables due to the way DXE works. Read the documentation. The author of
|
||||
GLUT took this into account for _WIN32 DLL's only; I don't want to modify
|
||||
his headers. The only workaround is to link GLUT the old way :-(
|
||||
|
||||
Q) The DJGPP port of Mesa is so SLOOOW! The Win32 OpenGL performs so much
|
||||
better...
|
||||
A) Is that a question? If you have a Voodoo3/Banshee card, you're lucky. The
|
||||
Glide port is on my web page. If you haven't, sorry; everything is done
|
||||
in software. Suggestions?
|
||||
|
||||
Q) I have a super/mega/ultra monitor and all you can do is 60Hz? My eyes are
|
||||
leaking from the orbits...
|
||||
A) If you were compiling for Glide, see Glide info. If not, be aware that
|
||||
refresh rate control works only for VESA 3.0. The environment variable
|
||||
DMESA_REFRESH sets the default screen refresh. For example:
|
||||
set DMESA_REFRESH=75
|
||||
|
||||
|
||||
|
||||
libGLUT (the toolkit):
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Well, this "skeletal" GLUT implementation is not mine. Thanks should go to
|
||||
Bernhard Tschirren, Mark Kilgard, Brian Paul and probably others (or probably
|
||||
not ;-). I only changed it to be self-standing (Allegro-free). The keyboard,
|
||||
mouse and timer drivers were inspired from an old project of mine (D3Xl) and
|
||||
fixed with many Allegro "infusions"; I deeply thank to Shawn Hargreaves et co.
|
||||
|
||||
My keyboard driver used only scancodes, but since GLUT requires ASCII values
|
||||
for keys, I borrowed the translation tables (and maybe more) from Allegro.
|
||||
Ctrl-Alt-Del (plus Ctrl-Alt-End, for Windows users) will shut down the GLUT
|
||||
engine unconditionally: it will raise SIGINT, which in turn will call the
|
||||
destructors (let's hope), thus cleaning up your/my mess ;-) NB: since the
|
||||
DJGPP guys ensured signal handlers won't go beyond program's space (and since
|
||||
dynamic modules shall) the SIGINT can't be hooked (well, it can, but it is
|
||||
useless), therefore you must live with the 'Exiting due to signal SIGINT'
|
||||
message...
|
||||
|
||||
The mouse driver is far from complete (lack of positioning, drawing, etc),
|
||||
but is enough to make almost all the demos work.
|
||||
|
||||
The timer is pretty versatile for it supports multiple timers with different
|
||||
frequencies. It may not be the most accurate timer in the known universe, but
|
||||
I think it's OK. Take this example: you have timer A with a very high rate,
|
||||
and then you have timer B with very low rate compared to A; now, A ticks OK,
|
||||
but timer B will probably loose precision!
|
||||
|
||||
As an addition, stdout and stderr are redirected and dumped upon exit. This
|
||||
means that printf can be safely called during graphics, but all messages come
|
||||
in bulk! A bit of a hack, I know, but I think it's better than to miss them
|
||||
at all. "Borrowed" from RHIDE (Robert Hoehne) or SETEDIT (Salvador Eduardo
|
||||
Tropea)... I'm not sure.
|
||||
|
||||
Window creating defaults: 640x480x16 at (0,0), 8-bit stencil, 16-bit accum.
|
||||
However, the video mode is chosen in such a way that first window will fit.
|
||||
|
||||
|
||||
|
||||
History:
|
||||
~~~~~~~~
|
||||
|
||||
v1.0 mar-2002 initial release
|
||||
v1.1 sep-2002 + added 3dfx Glide3 support
|
||||
+ added refresh rate control
|
||||
+ added fonts in glut
|
||||
* lots of minor changes
|
||||
|
||||
|
||||
|
||||
Contact:
|
||||
~~~~~~~~
|
||||
|
||||
Name: Borca Daniel
|
||||
E-mail: dborca@yahoo.com
|
||||
WWW: http://www.geocities.com/dborca/
|
@@ -1,12 +1,13 @@
|
||||
File: docs/README.WIN32
|
||||
|
||||
Last updated: Nov 29, 2001 - Karl Schultz - kschultz@users.sourceforge.net
|
||||
Last updated: Aug 15, 2002 - Karl Schultz - kschultz@users.sourceforge.net
|
||||
|
||||
Quick Start
|
||||
|
||||
If you have Microsoft Visual C++ 6.0 installed, simply go to the top directory
|
||||
of the Mesa distribution and type 'nmake -f Makefile.win NODEBUG=1' for
|
||||
an optimized build.
|
||||
an optimized build. Note that you may have to run ...VC98/BIN/VCVARS32.BAT
|
||||
to set up the appropriate compiler environment variables.
|
||||
|
||||
Details and Notes
|
||||
|
||||
@@ -17,9 +18,12 @@ Details and Notes
|
||||
demos a handful of demo executables.
|
||||
|
||||
- After building, you can copy the above DLL files to a place in your PATH
|
||||
or to the demos directory if you just want to give the demos a try.
|
||||
The DLL and LIB files are copied to the ./lib directory. The makefile
|
||||
creates this directory if it does not already exist.
|
||||
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).
|
||||
For example, you can copy the DLL files to the demos directory if you
|
||||
just want to run the demos. The build process places the DLL and LIB files
|
||||
in the ./lib directory. The makefile creates this directory if it does
|
||||
not already exist.
|
||||
|
||||
- The make targets 'clean' and 'clobber' will remove objects and libraries.
|
||||
But the files in ./lib are never cleaned.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
|
||||
Mesa 4.0.1 Unix/X11 Information
|
||||
Mesa 4.0.4 Unix/X11 Information
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ There are two ways to compile Mesa on Unix/X11 systems:
|
||||
|
||||
|
||||
The top-level makefile will execute the makefiles in a number of sub-
|
||||
directories. When finished, the Mesa libraries will be in the Mesa-4.0.1/lib/
|
||||
directories. When finished, the Mesa libraries will be in the Mesa-4.0.4/lib/
|
||||
directory. A few GLUT demos in the demos/ directory should be ready to run.
|
||||
|
||||
If you also downloaded and unpacked the demos there should be executables
|
||||
@@ -323,4 +323,4 @@ Summary of X-related environment variables:
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
$Id: README.X11,v 3.8.2.1 2001/11/23 20:47:25 brianp Exp $
|
||||
$Id: README.X11,v 3.8.2.4 2002/09/03 17:50:21 brianp Exp $
|
||||
|
22
docs/RELNOTES-3.4
Normal file
22
docs/RELNOTES-3.4
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
Mesa 3.4 release notes
|
||||
|
||||
November 3, 2000
|
||||
|
||||
PLEASE READ!!!!
|
||||
|
||||
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Mesa uses an even/odd version number scheme like the Linux kernel.
|
||||
Odd numbered versions (such as 3.3) designate new developmental releases.
|
||||
Even numbered versions (such as 3.4) designate stable releases.
|
||||
|
||||
Mesa 3.4 simply fixes bugs found in the Mesa 3.3 release. For details,
|
||||
see the VERSIONS file.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
$Id: RELNOTES-3.4,v 1.1.4.1 2002/03/23 02:36:52 brianp Exp $
|
50
docs/RELNOTES-4.0.2
Normal file
50
docs/RELNOTES-4.0.2
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
Mesa 4.0.2 release notes
|
||||
|
||||
April 2, 2002
|
||||
|
||||
PLEASE READ!!!!
|
||||
|
||||
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Mesa uses an even/odd version number scheme like the Linux kernel.
|
||||
Odd numbered versions (such as 3.3) designate new developmental releases.
|
||||
Even numbered versions (such as 3.4) designate stable releases.
|
||||
|
||||
Mesa 4.0.2 only contains bug fixes and a new DOS driver since version 4.0.1.
|
||||
|
||||
See the docs/VERSIONS file for the list of bug fixes.
|
||||
|
||||
|
||||
Device Drivers
|
||||
--------------
|
||||
|
||||
Mesa advertises itself as either OpenGL 1.2 or OpenGL 1.3 depending on the
|
||||
device driver. If the driver enables all the ARB extensions which are part
|
||||
of OpenGL 1.3 then glGetString(GL_VERSION) will return "1.3". Otherwise,
|
||||
it'll return "1.2".
|
||||
|
||||
A number of Mesa's software drivers haven't been actively maintained for
|
||||
some time. We rely on volunteers to maintain many of the drivers.
|
||||
Here's the current status of all included drivers:
|
||||
|
||||
Driver Status
|
||||
---------------------- ---------------------
|
||||
XMesa (Xlib) implements OpenGL 1.3
|
||||
OSMesa (off-screen) implements OpenGL 1.3
|
||||
FX (3dfx Voodoo1/2) implements OpenGL 1.3
|
||||
SVGA implements OpenGL 1.3
|
||||
Wind River UGL implements OpenGL 1.3
|
||||
Windows/Win32 implements OpenGL 1.3
|
||||
DOS/DJGPP implements OpenGL 1.3 (new in Mesa 4.0.2)
|
||||
GGI needs updating
|
||||
BeOS needs updating
|
||||
Allegro needs updating
|
||||
D3D needs updating
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
$Id: RELNOTES-4.0.2,v 1.1.2.3 2002/04/01 16:54:11 brianp Exp $
|
52
docs/RELNOTES-4.0.3
Normal file
52
docs/RELNOTES-4.0.3
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
Mesa 4.0.3 release notes
|
||||
|
||||
June 25, 2002
|
||||
|
||||
PLEASE READ!!!!
|
||||
|
||||
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Mesa uses an even/odd version number scheme like the Linux kernel.
|
||||
Odd numbered versions (such as 3.3) designate new developmental releases.
|
||||
Even numbered versions (such as 3.4) designate stable releases.
|
||||
|
||||
Mesa 4.0.3 basically just contains bug fixes version 4.0.2.
|
||||
|
||||
See the docs/VERSIONS file for the list of bug fixes.
|
||||
|
||||
The GGI driver has been updated, thanks to Filip Spacek.
|
||||
|
||||
|
||||
Device Drivers
|
||||
--------------
|
||||
|
||||
Mesa advertises itself as either OpenGL 1.2 or OpenGL 1.3 depending on the
|
||||
device driver. If the driver enables all the ARB extensions which are part
|
||||
of OpenGL 1.3 then glGetString(GL_VERSION) will return "1.3". Otherwise,
|
||||
it'll return "1.2".
|
||||
|
||||
A number of Mesa's software drivers haven't been actively maintained for
|
||||
some time. We rely on volunteers to maintain many of the drivers.
|
||||
Here's the current status of all included drivers:
|
||||
|
||||
Driver Status
|
||||
---------------------- ---------------------
|
||||
XMesa (Xlib) implements OpenGL 1.3
|
||||
OSMesa (off-screen) implements OpenGL 1.3
|
||||
FX (3dfx Voodoo1/2) implements OpenGL 1.3
|
||||
SVGA implements OpenGL 1.3
|
||||
Wind River UGL implements OpenGL 1.3
|
||||
Windows/Win32 implements OpenGL 1.3
|
||||
DOS/DJGPP implements OpenGL 1.3 (new in Mesa 4.0.2)
|
||||
GGI implements OpenGL 1.3
|
||||
BeOS needs updating
|
||||
Allegro needs updating
|
||||
D3D needs updating
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
$Id: RELNOTES-4.0.3,v 1.1.2.3 2002/06/24 20:44:58 brianp Exp $
|
@@ -1,4 +1,4 @@
|
||||
$Id: VERSIONS,v 1.73.2.14 2001/12/15 00:50:55 brianp Exp $
|
||||
$Id: VERSIONS,v 1.73.2.41 2002/10/02 17:36:59 brianp Exp $
|
||||
|
||||
|
||||
Mesa Version History
|
||||
@@ -898,7 +898,8 @@ Mesa Version History
|
||||
- lighting didn't always produce the correct alpha value
|
||||
- fixed 3DNow! code to not read past end of arrays (Andrew Lewycky)
|
||||
|
||||
4.0.1 December 17, 2001
|
||||
|
||||
4.0.1 December 17, 2001
|
||||
New:
|
||||
- better sub-pixel sample positions for AA triangles (Ray Tice)
|
||||
- slightly faster blending for (GL_ZERO, GL_ONE) and (GL_ONE, GL_ZERO)
|
||||
@@ -924,3 +925,88 @@ Mesa Version History
|
||||
- glTexParameter didn't flush the vertex buffer (Ray Tice)
|
||||
- feedback attributes for glDraw/CopyPixels and glBitmap were wrong
|
||||
- fixed bug in normal length caching (ParaView lighting bug)
|
||||
- fixed separate_specular color bug found in Chimera (18 Dec 2001)
|
||||
|
||||
|
||||
4.0.2 April 2, 2002
|
||||
New:
|
||||
- New DOS (DJGPP) driver written by Daniel Borca
|
||||
- New driver interface functions for TCL drivers (such as Radeon DRI)
|
||||
- GL_RENDERER string returns "Mesa Offscreen16" or "Mesa Offscreen32"
|
||||
if using deep color channels
|
||||
- latest GL/glext.h and GL/glxext.h headers from SGI
|
||||
Bug fixes:
|
||||
- GL_BLEND with non-black texture env color wasn't always correct
|
||||
- GL_REPLACE with GL_RGB texture format wasn't always correct (alpha)
|
||||
- glTexEnviv( pname != GL_TEXTURE_ENV_COLOR ) was broken
|
||||
- glReadPixels was sometimes mistakenly clipped by the scissor box
|
||||
- glDraw/ReadPixels didn't catch all the errors that they should have
|
||||
- Fixed 24bpp rendering problem in Windows driver (Karl Schultz)
|
||||
- 16-bit GLchan mode fixes (m_trans_tmp.h, s_triangle.c)
|
||||
- Fixed 1-bit float->int conversion bug in glDrawPixels(GL_DEPTH_COMP)
|
||||
- glColorMask as sometimes effecting glXSwapBuffers()
|
||||
- fixed a potential bug in XMesaGarbageCollect()
|
||||
- N threads rendering into one window didn't work reliably
|
||||
- glCopyPixels didn't work for deep color channels
|
||||
- improved 8 -> 16bit/channel texture image conversion (Gerk Huisma)
|
||||
- glPopAttrib() didn't correctly restore user clip planes
|
||||
- user clip planes failed for some perspective projections (Chromium)
|
||||
Known bugs:
|
||||
- mipmap LOD computation
|
||||
|
||||
|
||||
4.0.3 June 25, 2002
|
||||
New:
|
||||
- updated GL/glext.h file (version 15)
|
||||
- corrected MMX blend code (Jose Fonseca)
|
||||
- support for software-based alpha planes in Windows driver
|
||||
- updated GGI driver (Filip Spacek)
|
||||
Bug fixes:
|
||||
- glext.h had wrong values for GL_DOT3_RGB[A]_EXT tokens
|
||||
- OSMesaMakeCurrent() didn't recognize buffer size changes
|
||||
- assorted conformance fixes for 16-bit/channel rendering
|
||||
- texcombine alpha subtraction mode was broken
|
||||
- fixed lighting bug with non-uniform scaling and display lists
|
||||
- fixed bug when deleting shared display lists
|
||||
- disabled SPARC cliptest assembly code (Mesa bug 544665)
|
||||
- fixed a couple Solaris compilation/link problems
|
||||
- blending clipped glDrawPixels didn't always work
|
||||
- glGetTexImage() didn't accept packed pixel types
|
||||
- glPixelMapu[is]v() could explode given too large of pixelmap
|
||||
- glGetTexParameter[if]v() didn't accept GL_TEXTURE_MAX_ANISOTROPY_EXT
|
||||
- glXCopyContext() could lead to segfaults
|
||||
- glCullFace(GL_FRONT_AND_BACK) didn't work (bug 572665)
|
||||
Changes:
|
||||
- lots of C++ (g++) code clean-ups
|
||||
- lots of T&L updates for the Radeon DRI driver
|
||||
Known bugs:
|
||||
- mipmap LOD computation (fixed for Mesa 4.1)
|
||||
|
||||
|
||||
4.0.4 October 3, 2002
|
||||
New:
|
||||
- GL_NV_texture_rectangle extension
|
||||
- updated glext.h header (version 17)
|
||||
- updated DOS driver (Daniel Borca)
|
||||
- updated BeOS R5 driver (Philippe Houdoin)
|
||||
- added GL_IBM_texture_mirror_repeat
|
||||
- glxinfo now takes -l option to print interesting OpenGL limits info
|
||||
- GL_MESA_ycbcr_texture extension
|
||||
- GL_APPLE_client_storage extension (for some DRI drivers only)
|
||||
- GL_MESA_pack_invert extension
|
||||
Bug fixes:
|
||||
- fixed GL_LINEAR fog bug by adding clamping
|
||||
- fixed FP exceptions found using Alpha CPU
|
||||
- 3dfx MESA_GLX_FX=window (render to window) didn't work
|
||||
- fixed memory leak in wglCreateContest (Karl Schultz)
|
||||
- define GLAPIENTRY and GLAPI if undefined in glu.h
|
||||
- wglGetProcAddress didn't handle all API functions
|
||||
- when testing for OpenGL 1.2 vs 1.3, check for GL_ARB_texture_cube_map
|
||||
- removed GL_MAX_CONVOLUTION_WIDTH/HEIGHT from glGetInteger/Float/etc()
|
||||
- error checking in compressed tex image functions had some glitches
|
||||
- fixed AIX compile problem in src/config.c
|
||||
- glGetTexImage was using pixel unpacking instead of packing params
|
||||
- auto-mipmap generation for cube maps was incorrect
|
||||
Changes:
|
||||
- max texture units reduced to six to accomodate texture rectangles
|
||||
- removed unfinished GL_MESA_sprite_point extension code
|
||||
|
77
include/GL/dmesa.h
Normal file
77
include/GL/dmesa.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.0
|
||||
*
|
||||
* Copyright (C) 1999 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP device driver v1.0 for Mesa 4.0
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DMESA_included
|
||||
#define DMESA_included
|
||||
|
||||
#define DMESA_MAJOR_VERSION 4
|
||||
#define DMESA_MINOR_VERSION 0
|
||||
|
||||
typedef struct dmesa_context *DMesaContext;
|
||||
typedef struct dmesa_visual *DMesaVisual;
|
||||
typedef struct dmesa_buffer *DMesaBuffer;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DMesaVisual DMesaCreateVisual (GLint width, GLint height, GLint colDepth,
|
||||
GLboolean dbFlag, GLint depthSize,
|
||||
GLint stencilSize,
|
||||
GLint accumSize);
|
||||
|
||||
void DMesaDestroyVisual (DMesaVisual v);
|
||||
|
||||
DMesaBuffer DMesaCreateBuffer (DMesaVisual visual,
|
||||
GLint xpos, GLint ypos,
|
||||
GLint width, GLint height);
|
||||
|
||||
void DMesaDestroyBuffer (DMesaBuffer b);
|
||||
|
||||
DMesaContext DMesaCreateContext (DMesaVisual visual, DMesaContext share);
|
||||
|
||||
void DMesaDestroyContext (DMesaContext c);
|
||||
|
||||
GLboolean DMesaViewport (DMesaBuffer b,
|
||||
GLint xpos, GLint ypos,
|
||||
GLint width, GLint height);
|
||||
|
||||
GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b);
|
||||
|
||||
void DMesaSwapBuffers (DMesaBuffer b);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -1,10 +1,11 @@
|
||||
/* $Id: ggimesa.h,v 1.3 2000/02/09 19:03:28 brianp Exp $ */
|
||||
/* $Id: ggimesa.h,v 1.3.6.1 2002/06/10 15:16:16 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.3
|
||||
* Mesa 3-D graphics library GGI bindings (GGIGL [giggle])
|
||||
* Version: 4.0
|
||||
* Copyright (C) 1995-2000 Brian Paul
|
||||
* Copyright (C) 1998 Uwe Maurer
|
||||
* Copyrigth (C) 2001 Filip Spacek
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
@@ -25,34 +26,59 @@
|
||||
#ifndef GGIMESA_H
|
||||
#define GGIMESA_H
|
||||
|
||||
|
||||
#define GGIMESA_MAJOR_VERSION 3
|
||||
#define GGIMESA_MINOR_VERSION 3
|
||||
|
||||
#define GGIMESA_MAJOR_VERSION 4
|
||||
#define GGIMESA_MINOR_VERSION 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "GL/gl.h"
|
||||
|
||||
|
||||
typedef struct ggi_mesa_context *GGIMesaContext;
|
||||
|
||||
#include <ggi/ggi.h>
|
||||
#include "GL/gl.h"
|
||||
|
||||
typedef struct ggi_mesa_context *ggi_mesa_context_t;
|
||||
|
||||
extern GGIMesaContext GGIMesaCreateContext(void);
|
||||
/*
|
||||
* Initialize Mesa GGI extension
|
||||
*/
|
||||
int ggiMesaInit(void);
|
||||
/*
|
||||
* Clean up Mesa GGI exension
|
||||
*/
|
||||
int ggiMesaExit(void);
|
||||
|
||||
extern void GGIMesaDestroyContext(GGIMesaContext ctx);
|
||||
/*
|
||||
* Attach Mesa GGI extension to the visual 'vis'
|
||||
*/
|
||||
int ggiMesaAttach(ggi_visual_t vis);
|
||||
/*
|
||||
* Detach Mesa GGI extension from the visual 'vis'
|
||||
*/
|
||||
int ggiMesaDetach(ggi_visual_t vis);
|
||||
|
||||
extern void GGIMesaMakeCurrent(GGIMesaContext ctx);
|
||||
int ggiMesaExtendVisual(ggi_visual_t vis, GLboolean alpha_flag,
|
||||
GLboolean stereo_flag, GLint depth_size,
|
||||
GLint stencil_size, GLint accum_red_size,
|
||||
GLint accum_green_size, GLint accum_blue_size,
|
||||
GLint accum_alpha_size, GLint num_samples);
|
||||
|
||||
extern GGIMesaContext GGIMesaGetCurrentContext(void);
|
||||
/*
|
||||
* Create a new context capable of displaying on the visual vis.
|
||||
*/
|
||||
ggi_mesa_context_t ggiMesaCreateContext(ggi_visual_t vis);
|
||||
/*
|
||||
* Destroy the context 'ctx'
|
||||
*/
|
||||
void ggiMesaDestroyContext(ggi_mesa_context_t ctx);
|
||||
|
||||
extern void GGIMesaSwapBuffers(void);
|
||||
/*
|
||||
* Make context 'ctx' the current context and bind it to visual 'vis'.
|
||||
* Note that the context must have been created with respect to that visual.
|
||||
*/
|
||||
void ggiMesaMakeCurrent(ggi_mesa_context_t ctx, ggi_visual_t vis);
|
||||
|
||||
void ggiMesaSwapBuffers(void);
|
||||
|
||||
extern int GGIMesaSetVisual(GGIMesaContext ctx, ggi_visual_t vis,
|
||||
GLboolean rgb_flag, GLboolean db_flag);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
/* $Id: gl.h,v 1.59.2.1 2001/11/09 21:54:05 brianp Exp $ */
|
||||
/* $Id: gl.h,v 1.59.2.11 2002/09/21 17:12:10 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.0
|
||||
* Version: 4.0.4
|
||||
*
|
||||
* Copyright (C) 1999-2001 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"),
|
||||
@@ -63,6 +63,10 @@
|
||||
# define GLAPIENTRY
|
||||
#endif /* WIN32 / CYGWIN bracket */
|
||||
|
||||
#if (defined(__BEOS__) && defined(__POWERPC__)) || defined(__QUICKDRAW__)
|
||||
# define PRAGMA_EXPORT_SUPPORTED 1
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__)
|
||||
#include <gl/mesa_wgl.h>
|
||||
#endif
|
||||
@@ -1912,7 +1916,8 @@ GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] );
|
||||
|
||||
GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert );
|
||||
|
||||
GLAPI void GLAPIENTRY glSamplePass( GLenum pass );
|
||||
|
||||
#if defined(GL_GLEXT_LEGACY)
|
||||
|
||||
|
||||
/*
|
||||
@@ -1992,14 +1997,45 @@ GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v);
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v);
|
||||
|
||||
typedef void (GLAPIENTRY * PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
|
||||
typedef void (GLAPIENTRY * PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
|
||||
typedef void (GLAPIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
|
||||
|
||||
#endif /* GL_ARB_multitexture */
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(GL_GLEXT_LEGACY)
|
||||
|
||||
|
||||
/*
|
||||
* 1. GL_EXT_abgr
|
||||
*/
|
||||
@@ -2372,8 +2408,6 @@ GLAPI void GLAPIENTRY glUnlockArraysEXT( void );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* 197. GL_MESA_window_pos
|
||||
*/
|
||||
@@ -2488,21 +2522,50 @@ GLAPI void GLAPIENTRY glTracePointerRangeMESA( const GLvoid* first, const GLvoid
|
||||
#endif /* GL_MESA_packed_depth_stencil */
|
||||
|
||||
|
||||
/*
|
||||
* ??. GL_MESA_sprite_point
|
||||
*/
|
||||
#ifndef GL_MESA_sprite_point
|
||||
#define GL_MESA_sprite_point 1
|
||||
|
||||
#define GL_SPRITE_POINT_MESA 0x8757 /* XXX not finalized! */
|
||||
#ifndef GL_MESA_ycbcr_texture
|
||||
#define GL_MESA_ycbcr_texture 1
|
||||
|
||||
#endif
|
||||
#define GL_YCBCR_MESA 0x8757
|
||||
#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA /* same as Apple */
|
||||
#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB /* same as Apple */
|
||||
|
||||
#endif /* GL_MESA_texture_ycbcr */
|
||||
|
||||
|
||||
|
||||
#ifndef GL_MESA_pack_invert
|
||||
#define GL_MESA_pack_invert 1
|
||||
|
||||
#define GL_PACK_INVERT_MESA 0x8758
|
||||
|
||||
#endif /* GL_MESA_pack_invert */
|
||||
|
||||
|
||||
|
||||
#ifndef GL_APPLE_client_storage
|
||||
#define GL_APPLE_client_storage 1
|
||||
|
||||
#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2
|
||||
|
||||
#endif /* GL_APPLE_client_storage */
|
||||
|
||||
|
||||
|
||||
#ifndef GL_APPLE_ycbcr_422
|
||||
#define GL_APPLE_ycbcr_422 1
|
||||
|
||||
#define GL_YCBCR_422_APPLE 0x85B9
|
||||
#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
|
||||
#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
|
||||
|
||||
#endif /* GL_APPLE_ycbcr_422 */
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Begin system-specific stuff
|
||||
*/
|
||||
#if defined(__BEOS__) || defined(__QUICKDRAW__)
|
||||
#if defined(PRAGMA_EXPORT_SUPPORTED)
|
||||
#pragma export off
|
||||
#endif
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
1244
include/GL/glext.h
1244
include/GL/glext.h
File diff suppressed because it is too large
Load Diff
@@ -36,6 +36,14 @@
|
||||
|
||||
#include <GL/gl.h>
|
||||
|
||||
#ifndef GLAPIENTRY
|
||||
#define GLAPIENTRY
|
||||
#endif
|
||||
|
||||
#ifndef GLAPI
|
||||
#define GLAPI
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@@ -1,10 +1,10 @@
|
||||
/* $Id: glx.h,v 1.33.2.1 2001/12/14 03:20:57 brianp Exp $ */
|
||||
/* $Id: glx.h,v 1.33.2.4 2002/09/20 17:36:33 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.0
|
||||
* Version: 4.0.3
|
||||
*
|
||||
* Copyright (C) 1999-2001 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"),
|
||||
@@ -297,7 +297,6 @@ extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
|
||||
extern void (*glXGetProcAddress(const GLubyte *procname))();
|
||||
|
||||
|
||||
|
||||
#ifndef GLX_GLXEXT_LEGACY
|
||||
|
||||
#include <GL/glxext.h>
|
||||
@@ -453,6 +452,38 @@ extern void (*glXGetProcAddressARB(const GLubyte *procName))();
|
||||
#endif /* GLX_GLXEXT_LEGACY */
|
||||
|
||||
|
||||
/**
|
||||
** The following aren't in glxext.h yet.
|
||||
**/
|
||||
|
||||
|
||||
/*
|
||||
* ???. GLX_NV_vertex_array_range
|
||||
*/
|
||||
#ifndef GLX_NV_vertex_array_range
|
||||
#define GLX_NV_vertex_array_range
|
||||
|
||||
extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
extern void glXFreeMemoryNV(GLvoid *pointer);
|
||||
typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
|
||||
typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer);
|
||||
|
||||
#endif /* GLX_NV_vertex_array_range */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ???. GLX_MESA_agp_offset
|
||||
*/
|
||||
#ifndef GLX_MESA_agp_offset
|
||||
#define GLX_MESA_agp_offset 1
|
||||
|
||||
extern GLuint glXGetAGPOffsetMESA(const GLvoid *pointer);
|
||||
typedef GLuint (* PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *pointer);
|
||||
|
||||
#endif /* GLX_MESA_agp_offset */
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: glx_mangle.h,v 1.1.1.1.8.1 2001/11/09 22:00:26 brianp Exp $ */
|
||||
/* $Id: glx_mangle.h,v 1.1.1.1.8.2 2002/09/20 18:32:17 kschultz Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -41,17 +41,133 @@
|
||||
#define glXWaitGL mglXWaitGL
|
||||
#define glXWaitX mglXWaitX
|
||||
#define glXUseXFont mglXUseXFont
|
||||
|
||||
/* GLX 1.1 */
|
||||
#define glXQueryExtensionsString mglXQueryExtensionsString
|
||||
#define glXQueryServerString mglXQueryServerString
|
||||
#define glXGetClientString mglXGetClientString
|
||||
#define glXCreateGLXPixmapMESA mglXCreateGLXPixmapMESA
|
||||
#define glXReleaseBuffersMESA mglXReleaseBuffersMESA
|
||||
#define glXCopySubBufferMESA mglXCopySubBufferMESA
|
||||
#define glXGetVideoSyncSGI mglXGetVideoSyncSGI
|
||||
#define glXWaitVideoSyncSGI mglXWaitVideoSyncSGI
|
||||
|
||||
/* GLX 1.2 */
|
||||
#define glXGetCurrentDisplay mglXGetCurrentDisplay
|
||||
|
||||
/* GLX 1.3 */
|
||||
#define glXChooseFBConfig mglXChooseFBConfig
|
||||
#define glXGetFBConfigAttrib mglXGetFBConfigAttrib
|
||||
#define glXGetFBConfigs mglXGetFBConfigs
|
||||
#define glXGetVisualFromFBConfig mglXGetVisualFromFBConfig
|
||||
#define glXCreateWindow mglXCreateWindow
|
||||
#define glXDestroyWindow mglXDestroyWindow
|
||||
#define glXCreatePixmap mglXCreatePixmap
|
||||
#define glXDestroyPixmap mglXDestroyPixmap
|
||||
#define glXCreatePbuffer mglXCreatePbuffer
|
||||
#define glXDestroyPbuffer mglXDestroyPbuffer
|
||||
#define glXQueryDrawable mglXQueryDrawable
|
||||
#define glXCreateNewContext mglXCreateNewContext
|
||||
#define glXMakeContextCurrent mglXMakeContextCurrent
|
||||
#define glXGetCurrentReadDrawable mglXGetCurrentReadDrawable
|
||||
#define glXQueryContext mglXQueryContext
|
||||
#define glXSelectEvent mglXSelectEvent
|
||||
#define glXGetSelectedEvent mglXGetSelectedEvent
|
||||
|
||||
/* GLX 1.4 */
|
||||
#define glXGetProcAddress mglXGetProcAddress
|
||||
|
||||
/*
|
||||
* 41. GLX_SGI_video_sync
|
||||
*/
|
||||
#define glXGetVideoSyncSGI mglXGetVideoSyncSGI
|
||||
#define glXWaitVideoSyncSGI mglXWaitVideoSyncSGI
|
||||
|
||||
/*
|
||||
* 47. GLX_EXT_import_context
|
||||
*/
|
||||
#define glXFreeContextEXT mglXFreeContextEXT
|
||||
#define glXGetContextIDEXT mglXGetContextIDEXT
|
||||
#define glXGetCurrentDisplayEXT mglXGetCurrentDisplayEXT
|
||||
#define glXImportContextEXT mglXImportContextEXT
|
||||
#define glXQueryContextInfoEXT mglXQueryContextInfoEXT
|
||||
|
||||
/*
|
||||
* 215. GLX_MESA_copy_sub_buffer
|
||||
*/
|
||||
#define glXCopySubBufferMESA mglXCopySubBufferMESA
|
||||
|
||||
/*
|
||||
* 216. GLX_MESA_pixmap_colormap
|
||||
*/
|
||||
#define glXCreateGLXPixmapMESA mglXCreateGLXPixmapMESA
|
||||
|
||||
/*
|
||||
* 217. GLX_MESA_release_buffers
|
||||
*/
|
||||
#define glXReleaseBuffersMESA mglXReleaseBuffersMESA
|
||||
|
||||
/*
|
||||
* 218. GLX_MESA_set_3dfx_mode
|
||||
*/
|
||||
#define glXSet3DfxModeMESA mglXSet3DfxModeMESA
|
||||
|
||||
/*
|
||||
* ARB 2. GLX_ARB_get_proc_address
|
||||
*/
|
||||
#define glXGetProcAddressARB mglXGetProcAddressARB
|
||||
|
||||
/**
|
||||
** The following aren't in glxext.h yet.
|
||||
**/
|
||||
|
||||
/*
|
||||
* ???. GLX_NV_vertex_array_range
|
||||
*/
|
||||
#define glXAllocateMemoryNV mglXAllocateMemoryNV
|
||||
#define glXFreeMemoryNV mglXFreeMemoryNV
|
||||
|
||||
/*
|
||||
* ???. GLX_MESA_agp_offset
|
||||
*/
|
||||
#define glXGetAGPOffsetMESA mglXGetAGPOffsetMESA
|
||||
|
||||
/*
|
||||
* Other extensions implemented and in glxext.h
|
||||
*/
|
||||
|
||||
#define glXSwapIntervalSGI mglXSwapIntervalSGI
|
||||
#define glXGetVideoSyncSGI mglXGetVideoSyncSGI
|
||||
#define glXWaitVideoSyncSGI mglXWaitVideoSyncSGI
|
||||
#define glXMakeCurrentReadSGI mglXMakeCurrentReadSGI
|
||||
#define glXCushionSGI mglXCushionSGI
|
||||
|
||||
#define glXCreateGLXPixmapMESA mglXCreateGLXPixmapMESA
|
||||
#define glXReleaseBuffersMESA mglXReleaseBuffersMESA
|
||||
#define glXCopySubBufferMESA mglXCopySubBufferMESA
|
||||
|
||||
#define glXGetTransparentIndexSUN mglXGetTransparentIndexSUN
|
||||
|
||||
#define glXBindChannelToWindowSGIX mglXBindChannelToWindowSGIX
|
||||
#define glXBindSwapBarrierSGIX mglXBindSwapBarrierSGIX
|
||||
#define glXChannelRectSGIX mglXChannelRectSGIX
|
||||
#define glXChannelRectSyncSGIX mglXChannelRectSyncSGIX
|
||||
#define glXChooseFBConfigSGIX mglXChooseFBConfigSGIX
|
||||
#define glXCreateContextWithConfigSGIX mglXCreateContextWithConfigSGIX
|
||||
#define glXCreateGLXPbufferSGIX mglXCreateGLXPbufferSGIX
|
||||
#define glXCreateGLXPixmapWithConfigSGIX mglXCreateGLXPixmapWithConfigSGIX
|
||||
#define glXDestroyGLXPbufferSGIX mglXDestroyGLXPbufferSGIX
|
||||
#define glXGetCurrentReadDrawableSGI mglXGetCurrentReadDrawableSGI
|
||||
#define glXGetFBConfigAttribSGIX mglXGetFBConfigAttribSGIX
|
||||
#define glXGetFBConfigFromVisualSGIX mglXGetFBConfigFromVisualSGIX
|
||||
#define glXGetSelectedEventSGIX mglXGetSelectedEventSGIX
|
||||
#define glXGetVisualFromFBConfigSGIX mglXGetVisualFromFBConfigSGIX
|
||||
#define glXJoinSwapGroupSGIX mglXJoinSwapGroupSGIX
|
||||
#define glXQueryChannelDeltasSGIX mglXQueryChannelDeltasSGIX
|
||||
#define glXQueryChannelRectSGIX mglXQueryChannelRectSGIX
|
||||
#define glXQueryGLXPbufferSGIX mglXQueryGLXPbufferSGIX
|
||||
#define glXQueryMaxSwapBarriersSGIX mglXQueryMaxSwapBarriersSGIX
|
||||
#define glXSelectEventSGIX mglXSelectEventSGIX
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -42,12 +42,16 @@ extern "C" {
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
#ifndef GLAPI
|
||||
#define GLAPI extern
|
||||
#endif
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/* Header file version number, required by OpenGL ABI for Linux */
|
||||
/* glxext.h last updated 2001/09/26 */
|
||||
#define GLX_GLXEXT_VERSION 3
|
||||
/* glxext.h last updated 2002/03/22 */
|
||||
/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */
|
||||
#define GLX_GLXEXT_VERSION 5
|
||||
|
||||
#ifndef GLX_VERSION_1_3
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
@@ -113,6 +117,9 @@ extern "C" {
|
||||
#define GLX_SAMPLES 100001
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_get_proc_address
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_multisample
|
||||
#define GLX_SAMPLE_BUFFERS_ARB 100000
|
||||
#define GLX_SAMPLES_ARB 100001
|
||||
@@ -276,7 +283,6 @@ extern "C" {
|
||||
/*************************************************************/
|
||||
|
||||
#ifndef GLX_ARB_get_proc_address
|
||||
/* XXX Added void parameter to silence many, many warnings (BrianP) */
|
||||
typedef void (*__GLXextFuncPtr)(void);
|
||||
#endif
|
||||
|
||||
@@ -348,6 +354,14 @@ typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigne
|
||||
typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_VERSION_1_4
|
||||
#define GLX_VERSION_1_4 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_get_proc_address
|
||||
#define GLX_ARB_get_proc_address 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
@@ -356,6 +370,10 @@ extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *);
|
||||
typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_multisample
|
||||
#define GLX_ARB_multisample 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIS_multisample
|
||||
#define GLX_SGIS_multisample 1
|
||||
#endif
|
||||
@@ -419,7 +437,7 @@ extern void glXFreeContextEXT (Display *, GLXContext);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void);
|
||||
typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value);
|
||||
typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (GLXContext context);
|
||||
typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context);
|
||||
typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID);
|
||||
typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context);
|
||||
#endif
|
||||
@@ -554,14 +572,33 @@ typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode);
|
||||
#define GLX_SGIX_visual_select_group 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_GLX_OML_swap_method
|
||||
#define GLX_GLX_OML_swap_method 1
|
||||
#ifndef GLX_OML_swap_method
|
||||
#define GLX_OML_swap_method 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_GLX_OML_sync_control
|
||||
#define GLX_GLX_OML_sync_control 1
|
||||
#if defined(__STDC_VERSION__)
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
/* Include ISO C99 integer types for OML_sync_control; need a better test */
|
||||
#include <inttypes.h>
|
||||
|
||||
#ifndef GLX_OML_sync_control
|
||||
#define GLX_OML_sync_control 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXGetSyncValuesOML (Display *, GLXDrawable, int64_t *, int64_t *, int64_t *);
|
||||
extern Bool glXGetMscRateOML (Display *, GLXDrawable, int32_t *, int32_t *);
|
||||
extern int64_t glXSwapBuffersMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t);
|
||||
extern Bool glXWaitForMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t, int64_t *, int64_t *, int64_t *);
|
||||
extern Bool glXWaitForSbcOML (Display *, GLXDrawable, int64_t, int64_t *, int64_t *, int64_t *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
|
||||
typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
|
||||
typedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
|
||||
typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
|
||||
typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
|
||||
#endif
|
||||
|
||||
#endif /* C99 version test */
|
||||
#endif /* STDC test */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
/* $Id: osmesa.h,v 1.9 2001/09/23 16:06:13 brianp Exp $ */
|
||||
/* $Id: osmesa.h,v 1.9.2.1 2002/04/26 13:53:09 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.0
|
||||
* Version: 4.0.3
|
||||
*
|
||||
* Copyright (C) 1999-2001 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"),
|
||||
@@ -64,7 +64,7 @@ extern "C" {
|
||||
|
||||
#define OSMESA_MAJOR_VERSION 4
|
||||
#define OSMESA_MINOR_VERSION 0
|
||||
#define OSMESA_PATCH_VERSION 0
|
||||
#define OSMESA_PATCH_VERSION 3
|
||||
|
||||
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: wmesa.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
|
||||
/* $Id: wmesa.h,v 1.1.1.1.8.1 2002/04/23 18:24:41 kschultz Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
@@ -24,8 +24,17 @@
|
||||
|
||||
/*
|
||||
* $Log: wmesa.h,v $
|
||||
* Revision 1.1 1999/08/19 00:55:40 jtg
|
||||
* Initial revision
|
||||
* Revision 1.1.1.1.8.1 2002/04/23 18:24:41 kschultz
|
||||
* Fix up alpha buffer handling for Windows.
|
||||
* - add two new Pixel Format Descriptors that do not have alpha bits to
|
||||
* mirror the two that do.
|
||||
* - add logic to wglChoosePixelFormat to match PFD's with respect to alpha.
|
||||
* - Create/clear software alpha buffer as required.
|
||||
* Now a wgl or GLUT program can control the creation of a software alpha
|
||||
* buffer via the PFD or GLUT parms, respectively.
|
||||
*
|
||||
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
|
||||
* Imported sources
|
||||
*
|
||||
* Revision 3.2 1999/01/03 02:54:45 brianp
|
||||
* updated per Ted Jump
|
||||
@@ -101,13 +110,17 @@ typedef struct wmesa_context *WMesaContext;
|
||||
* GL_FALSE = color index mode
|
||||
* db_flag - GL_TRUE = double-buffered,
|
||||
* GL_FALSE = single buffered
|
||||
* alpha_flag - GL_TRUE = create software alpha buffer,
|
||||
* GL_FALSE = no software alpha buffer
|
||||
*
|
||||
* Note: Indexed mode requires double buffering under Windows.
|
||||
*
|
||||
* Return: a WMesa_context or NULL if error.
|
||||
*/
|
||||
extern WMesaContext WMesaCreateContext(HWND hWnd,HPALETTE* pPal,
|
||||
GLboolean rgb_flag,GLboolean db_flag);
|
||||
GLboolean rgb_flag,
|
||||
GLboolean db_flag,
|
||||
GLboolean alpha_flag);
|
||||
|
||||
|
||||
/*
|
||||
|
@@ -1,10 +1,10 @@
|
||||
/* $Id: xmesa.h,v 1.12 2001/09/23 16:06:13 brianp Exp $ */
|
||||
/* $Id: xmesa.h,v 1.12.2.2 2002/04/26 13:53:09 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.0
|
||||
* Version: 4.0.3
|
||||
*
|
||||
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -365,6 +365,15 @@ extern GLboolean XMesaSetFXmode( GLint mode );
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Reallocate the back/depth/stencil/accum/etc/ buffers associated with
|
||||
* buffer <b> if its size has changed.
|
||||
*
|
||||
* New in Mesa 4.0.2
|
||||
*/
|
||||
extern void XMesaResizeBuffers( XMesaBuffer b );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.win,v 1.5.2.1 2001/10/26 21:03:15 kschultz Exp $
|
||||
# $Id: Makefile.win,v 1.5.2.2 2002/04/15 22:14:09 kschultz Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.5
|
||||
@@ -67,12 +67,41 @@ SRCS = \
|
||||
geartrain.c \
|
||||
glinfo.c \
|
||||
gloss.c \
|
||||
gltestperf.c \
|
||||
glutfx.c \
|
||||
isosurf.c \
|
||||
lodbias.c \
|
||||
morph3d.c \
|
||||
teapot.c
|
||||
multiarb.c \
|
||||
occlude.c \
|
||||
paltex.c \
|
||||
pixeltex.c \
|
||||
pointblast.c \
|
||||
ray.c \
|
||||
readpix.c \
|
||||
reflect.c \
|
||||
renormal.c \
|
||||
shadowtex.c \
|
||||
spectex.c \
|
||||
stex3d.c \
|
||||
teapot.c \
|
||||
terrain.c \
|
||||
tessdemo.c \
|
||||
texcyl.c \
|
||||
texdown.c \
|
||||
texenv.c \
|
||||
texobj.c \
|
||||
trispd.c \
|
||||
tunnel.c \
|
||||
tunnel2.c \
|
||||
winpos.c
|
||||
|
||||
CXXSRCS = \
|
||||
rain.cxx
|
||||
|
||||
OSMESASRCS = osdemo.c
|
||||
|
||||
IPERSSRCS = ipers.c
|
||||
IPERSEXES = $(IPERSSRCS:.c=.exe)
|
||||
!include "../mesawin32.mak"
|
||||
|
||||
##### TARGETS #####
|
||||
@@ -90,9 +119,12 @@ $(OSMESAEXES) : $*.obj
|
||||
@echo $@
|
||||
$(link) $(lcommon) -out:$@ $* /LIBPATH:$(LIBDIR) $(LIBS) $(EXTRALIBS)
|
||||
|
||||
$(IPERSEXES) : $*.obj
|
||||
@echo $@
|
||||
$(link) -out:$@ $* /LIBPATH:$(LIBDIR) $(LIBS) winmm.lib
|
||||
|
||||
readtex.c:
|
||||
-copy ..\util\readtex.c .
|
||||
|
||||
readtex.h:
|
||||
-copy ..\util\readtex.h .
|
||||
|
||||
-copy ..\util\readtex.h .
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: drawpix.c,v 1.5 2000/12/24 22:53:54 pesco Exp $ */
|
||||
/* $Id: drawpix.c,v 1.5.2.2 2002/09/13 18:15:09 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* glDrawPixels demo/test/benchmark
|
||||
@@ -6,60 +6,6 @@
|
||||
* Brian Paul September 25, 1997 This file is in the public domain.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: drawpix.c,v $
|
||||
* Revision 1.5 2000/12/24 22:53:54 pesco
|
||||
* * demos/Makefile.am (INCLUDES): Added -I$(top_srcdir)/util.
|
||||
* * demos/Makefile.X11, demos/Makefile.BeOS-R4, demos/Makefile.cygnus:
|
||||
* Essentially the same.
|
||||
* Program files updated to include "readtex.c", not "../util/readtex.c".
|
||||
* * demos/reflect.c: Likewise for "showbuffer.c".
|
||||
*
|
||||
*
|
||||
* * Makefile.am (EXTRA_DIST): Added top-level regular files.
|
||||
*
|
||||
* * include/GL/Makefile.am (INC_X11): Added glxext.h.
|
||||
*
|
||||
*
|
||||
* * src/GGI/include/ggi/mesa/Makefile.am (EXTRA_HEADERS): Include
|
||||
* Mesa GGI headers in dist even if HAVE_GGI is not given.
|
||||
*
|
||||
* * configure.in: Look for GLUT and demo source dirs in $srcdir.
|
||||
*
|
||||
* * src/swrast/Makefile.am (libMesaSwrast_la_SOURCES): Set to *.[ch].
|
||||
* More source list updates in various Makefile.am's.
|
||||
*
|
||||
* * Makefile.am (dist-hook): Remove CVS directory from distribution.
|
||||
* (DIST_SUBDIRS): List all possible subdirs here.
|
||||
* (SUBDIRS): Only list subdirs selected for build again.
|
||||
* The above two applied to all subdir Makefile.am's also.
|
||||
*
|
||||
* Revision 1.4 2000/09/08 21:45:21 brianp
|
||||
* added dither key option
|
||||
*
|
||||
* Revision 1.3 1999/10/28 18:23:29 brianp
|
||||
* minor changes to Usage() function
|
||||
*
|
||||
* Revision 1.2 1999/10/21 22:13:58 brianp
|
||||
* added f key to toggle front/back drawing
|
||||
*
|
||||
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
|
||||
* Imported sources
|
||||
*
|
||||
* Revision 3.3 1999/03/28 18:18:33 brianp
|
||||
* minor clean-up
|
||||
*
|
||||
* Revision 3.2 1998/11/05 04:34:04 brianp
|
||||
* moved image files to ../images/ directory
|
||||
*
|
||||
* Revision 3.1 1998/02/22 16:43:17 brianp
|
||||
* added a few casts to silence compiler warnings
|
||||
*
|
||||
* Revision 3.0 1998/02/14 18:42:29 brianp
|
||||
* initial rev
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -287,7 +233,7 @@ static void Init( GLboolean ciMode )
|
||||
|
||||
if (ciMode) {
|
||||
/* Convert RGB image to grayscale */
|
||||
GLubyte *indexImage = malloc( ImgWidth * ImgHeight );
|
||||
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];
|
||||
|
@@ -752,7 +752,7 @@ main(int ac, char **av)
|
||||
glFogfv(GL_FOG_COLOR, fogcolor);
|
||||
glFogf(GL_FOG_DENSITY, 0.1);
|
||||
|
||||
p = malloc(sizeof(part) * np);
|
||||
p = (part *) malloc(sizeof(part) * np);
|
||||
|
||||
for (i = 0; i < np; i++)
|
||||
setnewpart(&p[i]);
|
||||
|
@@ -11,7 +11,7 @@
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined (WIN32)|| defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
#endif
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: isosurf.c,v 1.13 2001/10/04 19:14:26 kschultz Exp $ */
|
||||
/* $Id: isosurf.c,v 1.13.2.2 2002/09/10 23:35:38 kschultz Exp $ */
|
||||
|
||||
/*
|
||||
* Display an isosurface of 3-D wind speed volume.
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <math.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#undef CLIP_MASK
|
||||
#endif
|
||||
#define GL_GLEXT_LEGACY
|
||||
#include "GL/glut.h"
|
||||
@@ -39,34 +40,36 @@
|
||||
#include "readtex.c" /* I know, this is a hack. KW: me too. */
|
||||
#define TEXTURE_FILE "../images/reflect.rgb"
|
||||
|
||||
#define LIT 0x1
|
||||
#define UNLIT 0x2
|
||||
#define REFLECT 0x10
|
||||
#define POINT_FILTER 0x40
|
||||
#define LINEAR_FILTER 0x80
|
||||
#define GLVERTEX 0x100
|
||||
#define DRAW_ELTS 0x4
|
||||
#define DRAW_ARRAYS 0x200
|
||||
#define ARRAY_ELT 0x400
|
||||
#define LOCKED 0x800
|
||||
#define UNLOCKED 0x8
|
||||
#define IMMEDIATE 0x1000
|
||||
#define DISPLAYLIST 0x2000000
|
||||
#define SHADE_SMOOTH 0x2000
|
||||
#define SHADE_FLAT 0x4000
|
||||
#define TRIANGLES 0x8000
|
||||
#define STRIPS 0x10000
|
||||
#define POINTS 0x20000
|
||||
#define USER_CLIP 0x40000
|
||||
#define NO_USER_CLIP 0x80000
|
||||
#define MATERIALS 0x100000
|
||||
#define NO_MATERIALS 0x200000
|
||||
#define FOG 0x400000
|
||||
#define NO_FOG 0x800000
|
||||
#define QUIT 0x1000000
|
||||
#define GLINFO 0x4000000
|
||||
#define STIPPLE 0x8000000
|
||||
#define NO_STIPPLE 0x20
|
||||
#define LIT 0x00000001
|
||||
#define UNLIT 0x00000002
|
||||
#define REFLECT 0x00000004
|
||||
#define POINT_FILTER 0x00000008
|
||||
#define LINEAR_FILTER 0x00000010
|
||||
#define GLVERTEX 0x00000020
|
||||
#define DRAW_ELTS 0x00000040
|
||||
#define DRAW_ARRAYS 0x00000080
|
||||
#define ARRAY_ELT 0x00000100
|
||||
#define LOCKED 0x00000200
|
||||
#define UNLOCKED 0x00000400
|
||||
#define IMMEDIATE 0x00000800
|
||||
#define DISPLAYLIST 0x00001000
|
||||
#define SHADE_SMOOTH 0x00002000
|
||||
#define SHADE_FLAT 0x00004000
|
||||
#define TRIANGLES 0x00008000
|
||||
#define STRIPS 0x00010000
|
||||
#define POINTS 0x00020000
|
||||
#define USER_CLIP 0x00040000
|
||||
#define NO_USER_CLIP 0x00080000
|
||||
#define MATERIALS 0x00100000
|
||||
#define NO_MATERIALS 0x00200000
|
||||
#define FOG 0x00400000
|
||||
#define NO_FOG 0x00800000
|
||||
#define QUIT 0x01000000
|
||||
#define GLINFO 0x02000000
|
||||
#define STIPPLE 0x04000000
|
||||
#define NO_STIPPLE 0x08000000
|
||||
#define POLYGON_FILL 0x10000000
|
||||
#define POLYGON_LINE 0x20000000
|
||||
|
||||
#define LIGHT_MASK (LIT|UNLIT|REFLECT)
|
||||
#define FILTER_MASK (POINT_FILTER|LINEAR_FILTER)
|
||||
@@ -79,9 +82,10 @@
|
||||
#define SHADE_MASK (SHADE_SMOOTH|SHADE_FLAT)
|
||||
#define FOG_MASK (FOG|NO_FOG)
|
||||
#define STIPPLE_MASK (STIPPLE|NO_STIPPLE)
|
||||
#define POLYGON_MASK (POLYGON_FILL|POLYGON_LINE)
|
||||
|
||||
#define MAXVERTS 10000
|
||||
static GLuint maxverts = MAXVERTS;
|
||||
static GLint maxverts = MAXVERTS;
|
||||
static float data[MAXVERTS][6];
|
||||
static float compressed_data[MAXVERTS][6];
|
||||
static float expanded_data[MAXVERTS*3][6];
|
||||
@@ -144,7 +148,7 @@ static void read_surface( char *filename )
|
||||
static void print_flags( const char *msg, GLuint flags )
|
||||
{
|
||||
fprintf(stderr,
|
||||
"%s (0x%x): %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
||||
"%s (0x%x): %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
||||
msg, flags,
|
||||
(flags & GLVERTEX) ? "glVertex, " : "",
|
||||
(flags & DRAW_ARRAYS) ? "glDrawArrays, " : "",
|
||||
@@ -162,7 +166,8 @@ static void print_flags( const char *msg, GLuint flags )
|
||||
(flags & USER_CLIP) ? "user_clip, " : "",
|
||||
(flags & MATERIALS) ? "materials, " : "",
|
||||
(flags & FOG) ? "fog, " : "",
|
||||
(flags & STIPPLE) ? "stipple, " : "");
|
||||
(flags & STIPPLE) ? "stipple, " : "",
|
||||
(flags & POLYGON_LINE) ? "polygon mode line, " : "");
|
||||
}
|
||||
|
||||
|
||||
@@ -333,7 +338,7 @@ static void make_tri_indices( void )
|
||||
{
|
||||
unsigned int *v = tri_indices;
|
||||
unsigned int parity = 0;
|
||||
unsigned int i, j;
|
||||
int i, j;
|
||||
|
||||
for (j=2;j<numverts;j++,parity^=1) {
|
||||
if (parity) {
|
||||
@@ -363,9 +368,9 @@ static void make_tri_indices( void )
|
||||
|
||||
#define MIN(x,y) (x < y) ? x : y
|
||||
|
||||
static void draw_surface( int with_state )
|
||||
static void draw_surface( unsigned int with_state )
|
||||
{
|
||||
GLuint i, j;
|
||||
GLint i, j;
|
||||
|
||||
if (with_state & DISPLAYLIST) {
|
||||
if ((with_state & (RENDER_STYLE_MASK|PRIMITIVE_MASK|MATERIAL_MASK)) !=
|
||||
@@ -684,28 +689,34 @@ static void ModeMenu(int m)
|
||||
|
||||
if (CHANGED(state, m, FOG_MASK)) {
|
||||
UPDATE(state, m, FOG_MASK);
|
||||
if (m & FOG)
|
||||
{
|
||||
if (m & FOG) {
|
||||
glEnable(GL_FOG);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
glDisable(GL_FOG);
|
||||
}
|
||||
}
|
||||
|
||||
if (CHANGED(state, m, STIPPLE_MASK)) {
|
||||
UPDATE(state, m, STIPPLE_MASK);
|
||||
if (m & STIPPLE)
|
||||
{
|
||||
if (m & STIPPLE) {
|
||||
glEnable(GL_POLYGON_STIPPLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
glDisable(GL_POLYGON_STIPPLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (CHANGED(state, m, POLYGON_MASK)) {
|
||||
UPDATE(state, m, POLYGON_MASK);
|
||||
if (m & POLYGON_FILL) {
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
}
|
||||
else {
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GL_EXT_vertex_array
|
||||
if (CHANGED(state, m, (LOCK_MASK|RENDER_STYLE_MASK|PRIMITIVE_MASK)))
|
||||
{
|
||||
@@ -1077,6 +1088,9 @@ int main(int argc, char **argv)
|
||||
glutAddMenuEntry("Stipple", STIPPLE);
|
||||
glutAddMenuEntry("No Stipple", NO_STIPPLE);
|
||||
glutAddMenuEntry("", 0);
|
||||
glutAddMenuEntry("Polygon Mode Fill", POLYGON_FILL);
|
||||
glutAddMenuEntry("Polygon Mode Line", POLYGON_LINE);
|
||||
glutAddMenuEntry("", 0);
|
||||
glutAddMenuEntry("Point Filtered", POINT_FILTER);
|
||||
glutAddMenuEntry("Linear Filtered", LINEAR_FILTER);
|
||||
glutAddMenuEntry("", 0);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: multiarb.c,v 1.10 2001/06/20 19:12:30 brianp Exp $ */
|
||||
/* $Id: multiarb.c,v 1.10.2.2 2002/09/13 18:15:09 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* GL_ARB_multitexture demo
|
||||
@@ -10,77 +10,12 @@
|
||||
* Brian Paul November 1998 This program is in the public domain.
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Log: multiarb.c,v $
|
||||
* Revision 1.10 2001/06/20 19:12:30 brianp
|
||||
* also print GL_MAX_TEXTURE_SIZE
|
||||
*
|
||||
* Revision 1.9 2001/06/13 14:33:16 brianp
|
||||
* moved glTexEnvi calls to better logical locations
|
||||
*
|
||||
* Revision 1.8 2000/12/24 22:53:54 pesco
|
||||
* * demos/Makefile.am (INCLUDES): Added -I$(top_srcdir)/util.
|
||||
* * demos/Makefile.X11, demos/Makefile.BeOS-R4, demos/Makefile.cygnus:
|
||||
* Essentially the same.
|
||||
* Program files updated to include "readtex.c", not "../util/readtex.c".
|
||||
* * demos/reflect.c: Likewise for "showbuffer.c".
|
||||
*
|
||||
*
|
||||
* * Makefile.am (EXTRA_DIST): Added top-level regular files.
|
||||
*
|
||||
* * include/GL/Makefile.am (INC_X11): Added glxext.h.
|
||||
*
|
||||
*
|
||||
* * src/GGI/include/ggi/mesa/Makefile.am (EXTRA_HEADERS): Include
|
||||
* Mesa GGI headers in dist even if HAVE_GGI is not given.
|
||||
*
|
||||
* * configure.in: Look for GLUT and demo source dirs in $srcdir.
|
||||
*
|
||||
* * src/swrast/Makefile.am (libMesaSwrast_la_SOURCES): Set to *.[ch].
|
||||
* More source list updates in various Makefile.am's.
|
||||
*
|
||||
* * Makefile.am (dist-hook): Remove CVS directory from distribution.
|
||||
* (DIST_SUBDIRS): List all possible subdirs here.
|
||||
* (SUBDIRS): Only list subdirs selected for build again.
|
||||
* The above two applied to all subdir Makefile.am's also.
|
||||
*
|
||||
* Revision 1.7 2000/11/01 16:02:01 brianp
|
||||
* print number of texture units
|
||||
*
|
||||
* Revision 1.6 2000/05/23 23:21:00 brianp
|
||||
* set default window pos
|
||||
*
|
||||
* Revision 1.5 2000/02/02 17:31:45 brianp
|
||||
* changed > to >=
|
||||
*
|
||||
* Revision 1.4 2000/02/02 01:07:21 brianp
|
||||
* limit Drift to [0, 1]
|
||||
*
|
||||
* Revision 1.3 1999/10/21 16:40:32 brianp
|
||||
* added -info command line option
|
||||
*
|
||||
* Revision 1.2 1999/10/13 12:02:13 brianp
|
||||
* use texture objects now
|
||||
*
|
||||
* Revision 1.1.1.1 1999/08/19 00:55:40 jtg
|
||||
* Imported sources
|
||||
*
|
||||
* Revision 1.3 1999/03/28 18:20:49 brianp
|
||||
* minor clean-up
|
||||
*
|
||||
* Revision 1.2 1998/11/05 04:34:04 brianp
|
||||
* moved image files to ../images/ directory
|
||||
*
|
||||
* Revision 1.1 1998/11/03 01:36:33 brianp
|
||||
* Initial revision
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "readtex.c" /* I know, this is a hack. */
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: osdemo.c,v 1.7 2001/09/24 15:29:27 kschultz Exp $ */
|
||||
/* $Id: osdemo.c,v 1.7.2.1 2002/04/15 21:22:36 kschultz Exp $ */
|
||||
|
||||
/*
|
||||
* Demo of off-screen Mesa rendering
|
||||
@@ -14,6 +14,11 @@
|
||||
*
|
||||
* PPM output provided by Joerg Schmalzl.
|
||||
* ASCII PPM output added by Brian Paul.
|
||||
*
|
||||
* Usage: osdemo [-perf] [filename]
|
||||
*
|
||||
* -perf: Redraws the image 1000 times, displaying the FPS every 5 secs.
|
||||
* filename: file to store the TGA or PPM output
|
||||
*/
|
||||
|
||||
|
||||
@@ -29,7 +34,9 @@
|
||||
#define WIDTH 400
|
||||
#define HEIGHT 400
|
||||
|
||||
|
||||
static GLint T0 = 0;
|
||||
static GLint Frames = 0;
|
||||
static int perf = 0;
|
||||
|
||||
static void render_image( void )
|
||||
{
|
||||
@@ -76,7 +83,7 @@ static void render_image( void )
|
||||
glPopMatrix();
|
||||
|
||||
#ifdef GL_HP_occlusion_test
|
||||
{
|
||||
if (perf == 0) {
|
||||
GLboolean bRet;
|
||||
glDepthMask(GL_FALSE);
|
||||
glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
|
||||
@@ -105,7 +112,7 @@ static void render_image( void )
|
||||
glPopMatrix();
|
||||
|
||||
#ifdef GL_HP_occlusion_test
|
||||
{
|
||||
if (perf == 0){
|
||||
GLboolean bRet;
|
||||
|
||||
glDepthMask(GL_FALSE);
|
||||
@@ -130,6 +137,18 @@ static void render_image( void )
|
||||
#endif
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
Frames++;
|
||||
if (perf) {
|
||||
GLint t = glutGet(GLUT_ELAPSED_TIME);
|
||||
if (t - T0 >= 5000) {
|
||||
GLfloat seconds = (t - T0) / 1000.0;
|
||||
GLfloat fps = Frames / seconds;
|
||||
printf("%d frames in %6.3f seconds = %6.3f FPS\n", Frames, seconds, fps);
|
||||
T0 = t;
|
||||
Frames = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -224,6 +243,8 @@ write_ppm(const char *filename, const GLubyte *buffer, int width, int height)
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
void *buffer;
|
||||
int i;
|
||||
char *filename = NULL;
|
||||
|
||||
/* Create an RGBA-mode context */
|
||||
#if OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 305
|
||||
@@ -237,6 +258,11 @@ int main( int argc, char *argv[] )
|
||||
return 0;
|
||||
}
|
||||
|
||||
for ( i=1; i<argc; i++ ) {
|
||||
if (argv[i][0] != '-') filename = argv[i];
|
||||
if (strcmp(argv[i], "-perf")==0) perf = 1;
|
||||
}
|
||||
|
||||
/* Allocate the image buffer */
|
||||
buffer = malloc( WIDTH * HEIGHT * 4 * sizeof(GLubyte) );
|
||||
if (!buffer) {
|
||||
@@ -256,16 +282,19 @@ int main( int argc, char *argv[] )
|
||||
glGetIntegerv(GL_DEPTH_BITS, &z);
|
||||
glGetIntegerv(GL_STENCIL_BITS, &s);
|
||||
glGetIntegerv(GL_ACCUM_RED_BITS, &a);
|
||||
printf("%d %d %d\n", z, s, a);
|
||||
printf("Depth=%d Stencil=%d Accum=%d\n", z, s, a);
|
||||
}
|
||||
|
||||
render_image();
|
||||
if (perf)
|
||||
for(i=0; i< 1000; i++)
|
||||
render_image();
|
||||
|
||||
if (argc>1) {
|
||||
if (filename != NULL) {
|
||||
#ifdef SAVE_TARGA
|
||||
write_targa(argv[1], buffer, WIDTH, HEIGHT);
|
||||
write_targa(filename, buffer, WIDTH, HEIGHT);
|
||||
#else
|
||||
write_ppm(argv[1], buffer, WIDTH, HEIGHT);
|
||||
write_ppm(filename, buffer, WIDTH, HEIGHT);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: paltex.c,v 1.6 2000/10/05 07:17:43 joukj Exp $ */
|
||||
/* $Id: paltex.c,v 1.6.2.3 2002/07/22 13:45:45 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Paletted texture demo. Written by Brian Paul.
|
||||
@@ -9,6 +9,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#define GL_GLEXT_LEGACY
|
||||
#include <GL/glut.h>
|
||||
|
||||
@@ -91,15 +94,16 @@ static void Init( void )
|
||||
{
|
||||
#define HEIGHT 8
|
||||
#define WIDTH 32
|
||||
static char texture[HEIGHT][WIDTH] = {
|
||||
" ",
|
||||
" MMM EEEE SSS AAA ",
|
||||
" M M M E S S A A ",
|
||||
" M M M EEEE SS A A ",
|
||||
" M M M E SS AAAAA ",
|
||||
" M M E S S A A ",
|
||||
" M M EEEE SSS A A ",
|
||||
" "
|
||||
/* 257 = HEIGHT * WIDTH + 1 (for trailing '\0') */
|
||||
static char texture[257] = {"\
|
||||
\
|
||||
MMM EEEE SSS AAA \
|
||||
M M M E S S A A \
|
||||
M M M EEEE SS A A \
|
||||
M M M E SS AAAAA \
|
||||
M M E S S A A \
|
||||
M M EEEE SSS A A \
|
||||
"
|
||||
};
|
||||
GLubyte table[256][4];
|
||||
|
||||
@@ -158,7 +162,7 @@ static void Init( void )
|
||||
0, /* border */
|
||||
GL_COLOR_INDEX, /* texture format */
|
||||
GL_UNSIGNED_BYTE, /* texture type */
|
||||
texture); /* teh texture */
|
||||
texture); /* the texture */
|
||||
#endif
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
@@ -13,6 +13,13 @@
|
||||
|
||||
/*
|
||||
* $Log: pointblast.c,v $
|
||||
* Revision 1.2.6.1 2002/04/15 22:14:09 kschultz
|
||||
* Build demos/samples correctly on Windows (Robert Bergkvist) to sync up
|
||||
* with the main branch. (I should have done this for 4.0.2)
|
||||
*
|
||||
* Revision 1.3 2002/01/16 00:48:43 kschultz
|
||||
* Demo updates for Windows (Robert Bergkvist)
|
||||
*
|
||||
* Revision 1.2 2000/06/27 17:04:43 brianp
|
||||
* fixed compiler warnings
|
||||
*
|
||||
@@ -38,6 +45,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h> /* for cos(), sin(), and sqrt() */
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#define GL_GLEXT_LEGACY
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
@@ -11,15 +11,20 @@
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <GL/glut.h>
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265
|
||||
#endif
|
||||
|
||||
#include "particles.h"
|
||||
extern "C" {
|
||||
#include "image.h"
|
||||
#include "readtex.h"
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
#include "particles.cxx"
|
||||
#include "readtex.c"
|
||||
#endif
|
||||
|
||||
#ifdef XMESA
|
||||
@@ -297,20 +302,21 @@ static void key(unsigned char key, int x, int y)
|
||||
|
||||
static void inittextures(void)
|
||||
{
|
||||
IMAGE *img;
|
||||
GLubyte *img;
|
||||
GLint width,height;
|
||||
GLenum format;
|
||||
GLenum gluerr;
|
||||
|
||||
glGenTextures(1,&groundid);
|
||||
glBindTexture(GL_TEXTURE_2D,groundid);
|
||||
|
||||
if(!(img=ImageLoad("s128.rgb"))) {
|
||||
fprintf(stderr,"Error reading a texture.\n");
|
||||
exit(-1);
|
||||
if(!(img=LoadRGBImage("../images/s128.rgb",&width,&height,&format))){
|
||||
fprintf(stderr,"Error reading a texture.\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT,4);
|
||||
if((gluerr=(GLenum)gluBuild2DMipmaps(GL_TEXTURE_2D, 3, img->sizeX, img->sizeY, GL_RGB,
|
||||
GL_UNSIGNED_BYTE, (GLvoid *)(img->data)))) {
|
||||
if((gluerr=(GLenum)gluBuild2DMipmaps(GL_TEXTURE_2D, 3, width, height,GL_RGB,
|
||||
GL_UNSIGNED_BYTE, (GLvoid *)(img)))) {
|
||||
fprintf(stderr,"GLULib%s\n",gluErrorString(gluerr));
|
||||
exit(-1);
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: readpix.c,v 1.4 2000/10/16 21:24:39 brianp Exp $ */
|
||||
/* $Id: readpix.c,v 1.4.2.2 2002/07/12 15:50:46 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* glReadPixels and glCopyPixels test
|
||||
@@ -8,6 +8,16 @@
|
||||
|
||||
/*
|
||||
* $Log: readpix.c,v $
|
||||
* Revision 1.4.2.2 2002/07/12 15:50:46 brianp
|
||||
* Pedantic compiler fixes (Sven Panne)
|
||||
*
|
||||
* Revision 1.4.2.1 2002/05/01 14:53:52 alanh
|
||||
* glutSwapBuffers implicitly does a glFinish when swapping back to the front
|
||||
* buffer. We now issue a glFinish when not issuing SwapBuffers to ensure
|
||||
* the pipeline is complete.
|
||||
*
|
||||
* (Problem found with Chromium).
|
||||
*
|
||||
* Revision 1.4 2000/10/16 21:24:39 brianp
|
||||
* use gray background, memset TempImage to white to help with debugging
|
||||
*
|
||||
@@ -173,6 +183,8 @@ Display( void )
|
||||
|
||||
if (!DrawFront)
|
||||
glutSwapBuffers();
|
||||
else
|
||||
glFinish();
|
||||
}
|
||||
|
||||
|
||||
@@ -234,7 +246,7 @@ Init( GLboolean ciMode )
|
||||
|
||||
if (ciMode) {
|
||||
/* Convert RGB image to grayscale */
|
||||
GLubyte *indexImage = malloc( ImgWidth * ImgHeight );
|
||||
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];
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: shadowtex.c,v 1.4 2001/02/28 18:41:50 brianp Exp $ */
|
||||
/* $Id: shadowtex.c,v 1.4.2.1 2002/07/12 15:50:46 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Shadow demo using the GL_SGIX_depth_texture, GL_SGIX_shadow and
|
||||
@@ -257,8 +257,8 @@ Display(void)
|
||||
*/
|
||||
if (DisplayMode == SHOW_DEPTH_MAPPING) {
|
||||
/* load depth image as gray-scale luminance texture */
|
||||
GLfloat *depth = malloc(ShadowTexWidth * ShadowTexHeight
|
||||
* sizeof(GLfloat));
|
||||
GLfloat *depth = (GLfloat *) malloc(ShadowTexWidth * ShadowTexHeight
|
||||
* sizeof(GLfloat));
|
||||
if (depth) {
|
||||
glReadPixels(0, 0, ShadowTexWidth, ShadowTexHeight,
|
||||
GL_DEPTH_COMPONENT, GL_FLOAT, depth);
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: tessdemo.c,v 1.11 2001/03/21 02:47:32 gareth Exp $ */
|
||||
/* $Id: tessdemo.c,v 1.11.2.2 2002/09/11 00:09:01 kschultz Exp $ */
|
||||
|
||||
/*
|
||||
* A demo of the GLU polygon tesselation functions written by Bogdan Sikorski.
|
||||
@@ -90,7 +90,7 @@ static void GLCALLBACK edge_callback( GLenum flag )
|
||||
|
||||
static void GLCALLBACK end_callback()
|
||||
{
|
||||
GLint i;
|
||||
GLuint i;
|
||||
|
||||
glBegin( GL_LINES );
|
||||
|
||||
@@ -165,6 +165,8 @@ static void set_screen_wh( GLsizei w, GLsizei h )
|
||||
height = h;
|
||||
}
|
||||
|
||||
typedef void (GLAPIENTRY *callback_t)();
|
||||
|
||||
static void tesse( void )
|
||||
{
|
||||
GLUtesselator *tobj;
|
||||
@@ -177,11 +179,11 @@ static void tesse( void )
|
||||
|
||||
if ( tobj != NULL ) {
|
||||
gluTessNormal( tobj, 0.0, 0.0, 1.0 );
|
||||
gluTessCallback( tobj, GLU_TESS_BEGIN, glBegin );
|
||||
gluTessCallback( tobj, GLU_TESS_VERTEX, glVertex2fv );
|
||||
gluTessCallback( tobj, GLU_TESS_END, glEnd );
|
||||
gluTessCallback( tobj, GLU_TESS_ERROR, error_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_COMBINE, combine_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_BEGIN, (callback_t) glBegin );
|
||||
gluTessCallback( tobj, GLU_TESS_VERTEX, (callback_t) glVertex2fv );
|
||||
gluTessCallback( tobj, GLU_TESS_END, (callback_t) glEnd );
|
||||
gluTessCallback( tobj, GLU_TESS_ERROR, (callback_t) error_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_COMBINE, (callback_t) combine_callback );
|
||||
|
||||
glNewList( list_start, GL_COMPILE );
|
||||
gluBeginPolygon( tobj );
|
||||
@@ -201,10 +203,10 @@ static void tesse( void )
|
||||
gluEndPolygon( tobj );
|
||||
glEndList();
|
||||
|
||||
gluTessCallback( tobj, GLU_TESS_BEGIN, begin_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_VERTEX, vertex_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_END, end_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_EDGE_FLAG, edge_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_BEGIN, (callback_t) begin_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_VERTEX, (callback_t) vertex_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_END, (callback_t) end_callback );
|
||||
gluTessCallback( tobj, GLU_TESS_EDGE_FLAG, (callback_t) edge_callback );
|
||||
|
||||
glNewList( list_start + 1, GL_COMPILE );
|
||||
gluBeginPolygon( tobj );
|
||||
@@ -308,6 +310,7 @@ static void mouse_clicked( int button, int state, int x, int y )
|
||||
static void display( void )
|
||||
{
|
||||
GLuint i,j;
|
||||
GLsizei ii, jj;
|
||||
GLuint point_cnt;
|
||||
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
@@ -319,12 +322,12 @@ static void display( void )
|
||||
|
||||
glBegin( GL_LINES );
|
||||
|
||||
for ( i = 0 ; i < width ; i += 10 ) {
|
||||
for ( j = 0 ; j < height ; j += 10 ) {
|
||||
glVertex2i( 0, j );
|
||||
glVertex2i( width, j );
|
||||
glVertex2i( i, height );
|
||||
glVertex2i( i, 0 );
|
||||
for ( ii = 0 ; ii < width ; ii += 10 ) {
|
||||
for ( jj = 0 ; jj < height ; jj += 10 ) {
|
||||
glVertex2i( 0, jj );
|
||||
glVertex2i( width, jj );
|
||||
glVertex2i( ii, height );
|
||||
glVertex2i( ii, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: trispd.c,v 1.2 2000/10/26 15:26:14 brianp Exp $ */
|
||||
/* $Id: trispd.c,v 1.2.2.1 2002/07/12 15:50:46 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Simple GLUT program to measure triangle strip rendering speed.
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
/*
|
||||
* $Log: trispd.c,v $
|
||||
* Revision 1.2.2.1 2002/07/12 15:50:46 brianp
|
||||
* Pedantic compiler fixes (Sven Panne)
|
||||
*
|
||||
* Revision 1.2 2000/10/26 15:26:14 brianp
|
||||
* added a glFinish() call
|
||||
*
|
||||
@@ -158,7 +161,7 @@ static void LoadTex(int comp, int filter)
|
||||
{
|
||||
GLubyte *pixels;
|
||||
int x, y;
|
||||
pixels = malloc(4*256*256);
|
||||
pixels = (GLubyte *) malloc(4*256*256);
|
||||
for (y = 0; y < 256; ++y)
|
||||
for (x = 0; x < 256; ++x) {
|
||||
pixels[(y*256+x)*4+0] = (int)(128.5 + 127.0 * cos(0.024544 * x));
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: winpos.c,v 1.3 2000/12/24 22:53:54 pesco Exp $ */
|
||||
/* $Id: winpos.c,v 1.3.2.1 2002/04/15 22:14:09 kschultz Exp $ */
|
||||
|
||||
/*
|
||||
* Example of how to use the GL_MESA_window_pos extension.
|
||||
@@ -8,6 +8,13 @@
|
||||
|
||||
/*
|
||||
* $Log: winpos.c,v $
|
||||
* Revision 1.3.2.1 2002/04/15 22:14:09 kschultz
|
||||
* Build demos/samples correctly on Windows (Robert Bergkvist) to sync up
|
||||
* with the main branch. (I should have done this for 4.0.2)
|
||||
*
|
||||
* Revision 1.4 2002/01/16 00:48:43 kschultz
|
||||
* Demo updates for Windows (Robert Bergkvist)
|
||||
*
|
||||
* Revision 1.3 2000/12/24 22:53:54 pesco
|
||||
* * demos/Makefile.am (INCLUDES): Added -I$(top_srcdir)/util.
|
||||
* * demos/Makefile.X11, demos/Makefile.BeOS-R4, demos/Makefile.cygnus:
|
||||
@@ -59,6 +66,9 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#define GL_GLEXT_LEGACY
|
||||
#include "GL/glut.h"
|
||||
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
ggi_visual_t vis;
|
||||
char text[100];
|
||||
int db_flag,vis_x, vis_y, vir_x, vir_y, gt;
|
||||
|
||||
/*
|
||||
* Draw a gear wheel. You'll probably want to call this function when
|
||||
@@ -157,6 +158,7 @@ static GLuint count = 1;
|
||||
|
||||
static void draw( void )
|
||||
{
|
||||
static int n = 0;
|
||||
glClearColor(0,0,0,0);
|
||||
glClearIndex(0);
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
@@ -197,12 +199,25 @@ static void draw( void )
|
||||
ggiPuts(vis,0,ggiGetInfo(vis)->mode->visible.y+16,text);
|
||||
#endif
|
||||
|
||||
GGIMesaSwapBuffers();
|
||||
if(db_flag)
|
||||
ggiMesaSwapBuffers();
|
||||
|
||||
count++;
|
||||
if (count==limit) {
|
||||
exit(1);
|
||||
}
|
||||
++n;
|
||||
/*
|
||||
if (!(n%10)){
|
||||
ggi_color rgb = { 10000, 10000, 10000 };
|
||||
ggiSetSimpleMode(vis,vis_x+(n/10),vis_y+(n/10),db_flag?2:1, gt);
|
||||
glViewport(0, 0,vis_x+(n/10),vis_y+(n/10));
|
||||
ggiSetGCForeground(vis, ggiMapColor(vis, &rgb));
|
||||
ggiDrawBox(vis, 20, 20, 100, 100);
|
||||
if(db_flag)
|
||||
ggiSetWriteFrame(vis, 1);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
static void idle( void )
|
||||
@@ -216,6 +231,10 @@ static void reshape( int width, int height )
|
||||
{
|
||||
GLfloat h = (GLfloat) height / (GLfloat) width;
|
||||
|
||||
if(db_flag)
|
||||
glDrawBuffer(GL_BACK);
|
||||
else
|
||||
glDrawBuffer(GL_FRONT);
|
||||
glViewport(0, 0, (GLint)width, (GLint)height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
@@ -231,8 +250,8 @@ static void reshape( int width, int height )
|
||||
static void init( void )
|
||||
{
|
||||
static GLfloat pos[4] = {5.0, 5.0, 10.0, 0.0 };
|
||||
static GLfloat red[4] = {0.8, 0.1, 0.0, 1.0 };
|
||||
static GLfloat green[4] = {0.0, 0.8, 0.2, 1.0 };
|
||||
static GLfloat red[4] = {0.9, 0.9, 0.9, 1.0 };
|
||||
static GLfloat green[4] = {0.0, 0.8, 0.9, 1.0 };
|
||||
static GLfloat blue[4] = {0.2, 0.2, 1.0, 1.0 };
|
||||
|
||||
glLightfv( GL_LIGHT0, GL_POSITION, pos );
|
||||
@@ -276,9 +295,9 @@ static void usage(char *s)
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
GGIMesaContext ctx;
|
||||
int vis_x,vis_y,vir_x,vir_y,bpp,db_flag,gt;
|
||||
ggi_mesa_context_t ctx;
|
||||
ggi_mode mode;
|
||||
int bpp;
|
||||
|
||||
limit=0;
|
||||
|
||||
@@ -313,13 +332,12 @@ int main( int argc, char *argv[] )
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ctx=GGIMesaCreateContext();
|
||||
if (ctx==NULL)
|
||||
if (ggiMesaInit() < 0)
|
||||
{
|
||||
printf("GGIMesaCreateContext() failed\n");
|
||||
printf("ggiMesaInit failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
vis=ggiOpen(NULL);
|
||||
if (vis==NULL)
|
||||
{
|
||||
@@ -327,29 +345,42 @@ int main( int argc, char *argv[] )
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ggiSetGraphMode(vis,vis_x,vis_y,vir_x,vir_y,gt)<0)
|
||||
if (ggiSetSimpleMode(vis,vis_x,vis_y,db_flag ? 2 : 1,gt)<0)
|
||||
{
|
||||
printf("%s: can't set graphmode (%i %i %i %i) %i BPP\n",
|
||||
argv[0],vis_x,vis_y,vir_x,vir_y,bpp);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (GGIMesaSetVisual(ctx,vis,GL_TRUE,db_flag)<0)
|
||||
if (ggiMesaAttach(vis) < 0)
|
||||
{
|
||||
printf("ggiMesaAttach failed\n");
|
||||
exit(1);
|
||||
}
|
||||
if (ggiMesaExtendVisual(vis, GL_FALSE, GL_FALSE, 16,
|
||||
0, 0, 0, 0, 0, 1) < 0)
|
||||
{
|
||||
printf ("GGIMesaSetVisual() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
GGIMesaMakeCurrent(ctx);
|
||||
ctx = ggiMesaCreateContext(vis);
|
||||
if (ctx==NULL)
|
||||
{
|
||||
printf("GGIMesaCreateContext() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ggiMesaMakeCurrent(ctx, vis);
|
||||
ggiGetMode(vis,&mode);
|
||||
|
||||
reshape(mode.visible.x,mode.visible.y);
|
||||
|
||||
init();
|
||||
|
||||
while (!ggiKbhit(vis)) idle();
|
||||
while (!ggiKbhit(vis)) { /*sleep(1);*/ idle(); }
|
||||
|
||||
GGIMesaDestroyContext(ctx);
|
||||
ggiMesaDestroyContext(ctx);
|
||||
ggiClose(vis);
|
||||
|
||||
printf("%s\n",text);
|
||||
|
@@ -1,62 +1,51 @@
|
||||
# Makefile for Win32
|
||||
|
||||
TOP = ..
|
||||
|
||||
!include "$(TOP)/names.win"
|
||||
TOP = ..
|
||||
INCDIR = ..\include
|
||||
LIBDIR = ..\lib
|
||||
|
||||
!include <win32.mak>
|
||||
|
||||
SRCS= \
|
||||
aaindex.c \
|
||||
aapoly.c \
|
||||
aargb.c \
|
||||
accanti.c \
|
||||
accnot.c \
|
||||
accum.c \
|
||||
aim.c \
|
||||
accpersp.c \
|
||||
alpha.c \
|
||||
alpha3D.c \
|
||||
anti.c \
|
||||
antiindex.c \
|
||||
antipindex.c \
|
||||
antipoint.c \
|
||||
antipoly.c \
|
||||
bezcurve.c \
|
||||
bezmesh.c \
|
||||
bezsurf.c \
|
||||
checker.c \
|
||||
checker2.c \
|
||||
chess.c \
|
||||
clip.c \
|
||||
colormat.c \
|
||||
cone.c \
|
||||
cube.c \
|
||||
curve.c \
|
||||
depthcue.c \
|
||||
disk.c \
|
||||
dof.c \
|
||||
dofnot.c \
|
||||
double.c \
|
||||
drawf.c \
|
||||
feedback.c \
|
||||
fog.c \
|
||||
fogindex.c \
|
||||
font.c \
|
||||
hello.c \
|
||||
image.c \
|
||||
light.c \
|
||||
linelist.c \
|
||||
lines.c \
|
||||
list.c \
|
||||
list2.c \
|
||||
maplight.c \
|
||||
material.c \
|
||||
mipmap.c \
|
||||
model.c \
|
||||
movelight.c \
|
||||
nurbs.c \
|
||||
pickdepth.c \
|
||||
pickline.c \
|
||||
picksquare.c \
|
||||
plane.c \
|
||||
planet.c \
|
||||
planetup.c \
|
||||
polyoff.c \
|
||||
polys.c \
|
||||
quadric.c \
|
||||
robot.c \
|
||||
sccolorlight.c \
|
||||
scene.c \
|
||||
@@ -64,18 +53,26 @@ SRCS= \
|
||||
sceneflat.c \
|
||||
select.c \
|
||||
smooth.c \
|
||||
sphere.c \
|
||||
stencil.c \
|
||||
stroke.c \
|
||||
surface.c \
|
||||
tea.c \
|
||||
teaambient.c \
|
||||
teapots.c \
|
||||
tess.c \
|
||||
tesswind.c \
|
||||
texbind.c \
|
||||
texgen.c \
|
||||
texprox.c \
|
||||
texsub.c \
|
||||
texturesurf.c \
|
||||
trim.c
|
||||
|
||||
EXTRALIBS = $(MESAGL).lib $(MESAGLU).lib $(MESATK).lib $(MESAAUX).lib
|
||||
torus.c \
|
||||
trim.c \
|
||||
unproject.c \
|
||||
varray.c \
|
||||
wrap.c
|
||||
|
||||
!include "$(TOP)/mesawin32.mak"
|
||||
|
||||
$(EXES) : $*.obj
|
||||
@echo $@
|
||||
$(link) -out:$@ $* /LIBPATH:$(LIBDIR) $(LIBS)
|
@@ -42,6 +42,7 @@
|
||||
* two rectangles. This program clamps the texture, if
|
||||
* the texture coordinates fall outside 0.0 and 1.0.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
/* Create checkerboard texture */
|
||||
|
@@ -62,7 +62,7 @@ selectFog(int mode)
|
||||
/* falls through */
|
||||
case GL_EXP2:
|
||||
case GL_EXP:
|
||||
glFogi(GL_FOG_MODE, mode);
|
||||
glFogiv(GL_FOG_MODE, (int *) &mode);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 0:
|
||||
@@ -190,7 +190,7 @@ main(int argc, char **argv)
|
||||
glutDisplayFunc(display);
|
||||
glutCreateMenu(selectFog);
|
||||
glutAddMenuEntry("Fog EXP", GL_EXP);
|
||||
glutAddMenuEntry("Fog EXP2", GL_EXP2);
|
||||
glutAddMenuEntry("Fog EXP2", /*GL_EXP2*/ 0xffff);
|
||||
glutAddMenuEntry("Fog LINEAR", GL_LINEAR);
|
||||
glutAddMenuEntry("Quit", 0);
|
||||
glutAttachMenu(GLUT_RIGHT_BUTTON);
|
||||
|
@@ -39,6 +39,7 @@
|
||||
* hello.c
|
||||
* This is a simple, introductory OpenGL program.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
void display(void)
|
||||
|
@@ -103,8 +103,8 @@ drawRects(GLenum mode)
|
||||
void
|
||||
processHits(GLint hits, GLuint buffer[])
|
||||
{
|
||||
unsigned int i, j;
|
||||
GLuint names, *ptr;
|
||||
GLint i;
|
||||
GLuint j, names, *ptr;
|
||||
|
||||
printf("hits = %d\n", hits);
|
||||
ptr = (GLuint *) buffer;
|
||||
|
@@ -87,8 +87,8 @@ void drawSquares(GLenum mode)
|
||||
*/
|
||||
void processHits (GLint hits, GLuint buffer[])
|
||||
{
|
||||
unsigned int i, j;
|
||||
GLuint ii = 0, jj = 0, names, *ptr;
|
||||
GLint i;
|
||||
GLuint j, ii = 0, jj = 0, names, *ptr;
|
||||
|
||||
printf ("hits = %d\n", hits);
|
||||
ptr = (GLuint *) buffer;
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include <GL/glut.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef GL_VERSION_1_1
|
||||
GLuint list;
|
||||
@@ -149,7 +150,7 @@ static void Benchmark( float xdiff, float ydiff )
|
||||
{
|
||||
int startTime, endTime;
|
||||
int draws;
|
||||
double seconds, fps, triPerSecond;
|
||||
double seconds, fps;
|
||||
|
||||
printf("Benchmarking...\n");
|
||||
|
||||
|
@@ -124,8 +124,8 @@ void drawScene (void)
|
||||
*/
|
||||
void processHits (GLint hits, GLuint buffer[])
|
||||
{
|
||||
unsigned int i, j;
|
||||
GLuint names, *ptr;
|
||||
GLint i;
|
||||
GLuint j, names, *ptr;
|
||||
|
||||
printf ("hits = %d\n", hits);
|
||||
ptr = (GLuint *) buffer;
|
||||
|
@@ -41,6 +41,7 @@
|
||||
* This program draws a NURBS surface in the shape of a
|
||||
* symmetrical hill.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
GLfloat ctlpoints[4][4][3];
|
||||
|
@@ -94,7 +94,7 @@ void CALLBACK vertexCallback(GLvoid *vertex)
|
||||
|
||||
pointer = (GLdouble *) vertex;
|
||||
glColor3dv(pointer+3);
|
||||
glVertex3dv(vertex);
|
||||
glVertex3dv(pointer);
|
||||
}
|
||||
|
||||
/* combineCallback is used to create a new vertex when edges
|
||||
|
42
progs/samples/Makefile.win
Normal file
42
progs/samples/Makefile.win
Normal file
@@ -0,0 +1,42 @@
|
||||
# $Id: Makefile.win,v 1.1.2.1 2002/04/15 22:13:31 kschultz Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.5
|
||||
# Copyright (C) 1995-2001 Brian Paul
|
||||
|
||||
# Makefile for GLUT-based demo programs for Windows
|
||||
|
||||
!include <win32.mak>
|
||||
|
||||
##### MACROS #####
|
||||
|
||||
TOP = ..
|
||||
INCDIR = ..\include
|
||||
LIBDIR = ..\lib
|
||||
|
||||
PROGS = accum bitmap1 bitmap2 blendeq blendxor copy cursor depth eval fog \
|
||||
font line logo nurb oglinfo olympic overlay point prim quad select \
|
||||
shape sphere star stencil stretch texture tri wave
|
||||
|
||||
SRCS = \
|
||||
accum.c \
|
||||
bitmap1.c \
|
||||
bitmap2.c \
|
||||
blendeq.c \
|
||||
blendxor.c \
|
||||
copy.c \
|
||||
cursor.c depth.c eval.c fog.c \
|
||||
font.c line.c logo.c nurb.c olympic.c overlay.c point.c prim.c quad.c select.c \
|
||||
shape.c sphere.c star.c stencil.c stretch.c texture.c tri.c wave.c
|
||||
|
||||
!include "../mesawin32.mak"
|
||||
|
||||
##### TARGETS #####
|
||||
|
||||
clean::
|
||||
|
||||
clobber::
|
||||
|
||||
$(EXES) : $*.obj
|
||||
@echo $@
|
||||
$(link) -out:$@ $* /LIBPATH:$(LIBDIR) $(LIBS)
|
@@ -11,6 +11,10 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#define GL_GLEXT_LEGACY
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
|
@@ -10,6 +10,10 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#define GL_GLEXT_LEGACY
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
|
||||
typedef struct {
|
||||
int sizeX, sizeY;
|
||||
size_t sizeX, sizeY;
|
||||
GLubyte *data;
|
||||
} PPMImage;
|
||||
|
||||
@@ -30,7 +30,7 @@ static PPMImage *LoadPPM(const char *filename)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
result = malloc(sizeof(PPMImage));
|
||||
result = (PPMImage *) malloc(sizeof(PPMImage));
|
||||
if (!result)
|
||||
{
|
||||
fprintf(stderr, "Unable to allocate memory\n");
|
||||
@@ -52,14 +52,15 @@ static PPMImage *LoadPPM(const char *filename)
|
||||
while (fgetc(fp) != '\n')
|
||||
;
|
||||
|
||||
result->data = malloc(3 * result->sizeX * result->sizeY);
|
||||
result->data = (GLubyte *) malloc(3 * result->sizeX * result->sizeY);
|
||||
if (!result)
|
||||
{
|
||||
fprintf(stderr, "Unable to allocate memory\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (fread(result->data, 3 * result->sizeX, result->sizeY, fp) != result->sizeY)
|
||||
if (fread(result->data, 3 * result->sizeX, result->sizeY, fp) !=
|
||||
result->sizeY)
|
||||
{
|
||||
fprintf(stderr, "Error loading image `%s'\n", filename);
|
||||
exit(1);
|
||||
|
@@ -216,11 +216,13 @@ static void CALLBACK ErrorCallback(GLenum which)
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (GLAPIENTRY *callback_t)();
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
|
||||
theNurbs = gluNewNurbsRenderer();
|
||||
gluNurbsCallback(theNurbs, GLU_ERROR, ErrorCallback);
|
||||
gluNurbsCallback(theNurbs, GLU_ERROR, (callback_t) ErrorCallback);
|
||||
|
||||
gluNurbsProperty(theNurbs, GLU_SAMPLING_TOLERANCE, 15.0);
|
||||
gluNurbsProperty(theNurbs, GLU_DISPLAY_MODE, GLU_OUTLINE_PATCH);
|
||||
|
@@ -102,6 +102,8 @@ static void CALLBACK ErrorHandler(GLenum which)
|
||||
fprintf(stderr, "Quad Error: %s\n", gluErrorString(which));
|
||||
}
|
||||
|
||||
typedef void (GLAPIENTRY *callback_t)();
|
||||
|
||||
static void Init(void)
|
||||
{
|
||||
static GLint colorIndexes[3] = {0, 200, 255};
|
||||
@@ -163,7 +165,7 @@ static void Init(void)
|
||||
}
|
||||
|
||||
quadObj = gluNewQuadric();
|
||||
gluQuadricCallback(quadObj, GLU_ERROR, ErrorHandler);
|
||||
gluQuadricCallback(quadObj, GLU_ERROR, (callback_t) ErrorHandler);
|
||||
|
||||
radius1 = 10;
|
||||
radius2 = 5;
|
||||
|
@@ -174,7 +174,7 @@ static void DeleteTri(GLint h)
|
||||
static void GrowTri(GLint h)
|
||||
{
|
||||
float v[2];
|
||||
float *oldV;
|
||||
float *oldV = NULL;
|
||||
GLint i;
|
||||
|
||||
v[0] = objects[h].v1[0] + objects[h].v2[0] + objects[h].v3[0];
|
||||
|
@@ -6,18 +6,17 @@
|
||||
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -g -I../include
|
||||
CFLAGS = -g -I../include -I../util
|
||||
LIBS = -L../lib -lglut -lGLU -lGL -L/usr/X11R6/lib -lX11 -lXext -lm
|
||||
|
||||
PROGS = cva \
|
||||
dinoshade \
|
||||
fogcoord \
|
||||
manytex \
|
||||
multipal \
|
||||
projtex \
|
||||
seccolor \
|
||||
sharedtex \
|
||||
texline
|
||||
seccolor \
|
||||
texline texwrap fogcoord multiwindow
|
||||
|
||||
|
||||
##### RULES #####
|
||||
|
39
progs/tests/Makefile.win
Normal file
39
progs/tests/Makefile.win
Normal file
@@ -0,0 +1,39 @@
|
||||
# $Id: Makefile.win,v 1.1.2.1 2002/04/15 22:13:00 kschultz Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.5
|
||||
# Copyright (C) 1995-2001 Brian Paul
|
||||
|
||||
# Makefile for GLUT-based demo programs for Windows
|
||||
|
||||
!include <win32.mak>
|
||||
|
||||
##### MACROS #####
|
||||
|
||||
TOP = ..
|
||||
INCDIR = ..\include
|
||||
LIBDIR = ..\lib
|
||||
|
||||
SRCS = cva.c \
|
||||
dinoshade.c \
|
||||
fogcoord.c \
|
||||
manytex.c \
|
||||
multipal.c \
|
||||
projtex.c \
|
||||
seccolor.c \
|
||||
# sharedtex.c \
|
||||
texline.c \
|
||||
texwrap.c
|
||||
|
||||
!include "../mesawin32.mak"
|
||||
|
||||
##### TARGETS #####
|
||||
|
||||
clean::
|
||||
|
||||
clobber::
|
||||
@del readtex.c readtex.h
|
||||
|
||||
$(EXES) :$*.obj
|
||||
@echo $@
|
||||
$(link) -out:$@ $* /LIBPATH:$(LIBDIR) $(LIBS)
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: cva.c,v 1.3 2000/11/30 03:06:56 gareth Exp $ */
|
||||
/* $Id: cva.c,v 1.3.2.1 2002/04/15 22:13:00 kschultz Exp $ */
|
||||
|
||||
/*
|
||||
* Trivial CVA test, good for testing driver fastpaths (especially
|
||||
@@ -11,6 +11,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#define GL_GLEXT_LEGACY
|
||||
#include <GL/glut.h>
|
||||
|
||||
@@ -130,7 +133,7 @@ int main( int argc, char **argv )
|
||||
*/
|
||||
string = (char *) glGetString( GL_VERSION );
|
||||
|
||||
if ( !strstr( string, "1.2" ) ) {
|
||||
if ( (!strstr( string, "1.2" ))&&(!strstr(string,"1.3"))) {
|
||||
fprintf( stderr, "This program requires OpenGL 1.2 vertex arrays.\n" );
|
||||
exit( -1 );
|
||||
}
|
||||
|
@@ -38,6 +38,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h> /* for cos(), sin(), and sqrt() */
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#define GL_GLEXT_LEGACY
|
||||
#include <GL/glut.h> /* OpenGL Utility Toolkit header */
|
||||
|
||||
/* Some <math.h> files do not define M_PI... */
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: multipal.c,v 1.1 2000/11/18 17:12:33 brianp Exp $ */
|
||||
/* $Id: multipal.c,v 1.1.2.1 2002/04/15 22:13:00 kschultz Exp $ */
|
||||
|
||||
/*
|
||||
* GL_ARB_multitexture demo
|
||||
@@ -12,6 +12,13 @@
|
||||
|
||||
/*
|
||||
* $Log: multipal.c,v $
|
||||
* Revision 1.1.2.1 2002/04/15 22:13:00 kschultz
|
||||
* Build demos/samples correctly on Windows (Robert Bergkvist) to sync up
|
||||
* with the main branch. (I should have done this for 4.0.2)
|
||||
*
|
||||
* Revision 1.2 2002/01/16 01:03:25 kschultz
|
||||
* get tests working on windows (Robert Bergkvist)
|
||||
*
|
||||
* Revision 1.1 2000/11/18 17:12:33 brianp
|
||||
* test texture palettes with multitexture
|
||||
*
|
||||
@@ -52,6 +59,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#define GL_GLEXT_LEGACY
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "../util/readtex.c" /* I know, this is a hack. */
|
||||
|
237
progs/tests/yuv.c
Normal file
237
progs/tests/yuv.c
Normal file
@@ -0,0 +1,237 @@
|
||||
/*
|
||||
* Test the GL_NV_texture_rectangle and GL_MESA_ycrcb_texture extensions.
|
||||
*
|
||||
* Brian Paul 13 September 2002
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "readtex.c" /* I know, this is a hack. */
|
||||
|
||||
#define TEXTURE_FILE "../images/girl.rgb"
|
||||
|
||||
static GLfloat Xrot = 0, Yrot = 0, Zrot = 0;
|
||||
static GLint ImgWidth, ImgHeight;
|
||||
static GLenum ImgFormat;
|
||||
static GLubyte *Image = NULL;
|
||||
static GLushort *ImageYUV = NULL;
|
||||
|
||||
|
||||
static void DrawObject(void)
|
||||
{
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(-1.0, -1.0);
|
||||
|
||||
glTexCoord2f(ImgWidth, 0);
|
||||
glVertex2f(1.0, -1.0);
|
||||
|
||||
glTexCoord2f(ImgWidth, ImgHeight);
|
||||
glVertex2f(1.0, 1.0);
|
||||
|
||||
glTexCoord2f(0, ImgHeight);
|
||||
glVertex2f(-1.0, 1.0);
|
||||
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
static void Display( void )
|
||||
{
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(Xrot, 1.0, 0.0, 0.0);
|
||||
glRotatef(Yrot, 0.0, 1.0, 0.0);
|
||||
glRotatef(Zrot, 0.0, 0.0, 1.0);
|
||||
DrawObject();
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
glTranslatef( 0.0, 0.0, -15.0 );
|
||||
}
|
||||
|
||||
|
||||
static void Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void SpecialKey( int key, int x, int y )
|
||||
{
|
||||
float step = 3.0;
|
||||
(void) x;
|
||||
(void) y;
|
||||
|
||||
switch (key) {
|
||||
case GLUT_KEY_UP:
|
||||
Xrot += step;
|
||||
break;
|
||||
case GLUT_KEY_DOWN:
|
||||
Xrot -= step;
|
||||
break;
|
||||
case GLUT_KEY_LEFT:
|
||||
Yrot += step;
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
Yrot -= step;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
|
||||
|
||||
static void ConvertRGBtoYUV(GLint w, GLint h, const GLubyte *src,
|
||||
GLushort *dest)
|
||||
{
|
||||
GLint i, j;
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
for (j = 0; j < w; j++) {
|
||||
const GLfloat r = (*src++) / 255.0;
|
||||
const GLfloat g = (*src++) / 255.0;
|
||||
const GLfloat b = (*src++) / 255.0;
|
||||
GLfloat y, cr, cb;
|
||||
GLint iy, icr, icb;
|
||||
|
||||
y = r * 65.481 + g * 128.553 + b * 24.966 + 16;
|
||||
cb = r * -37.797 + g * -74.203 + b * 112.0 + 128;
|
||||
cr = r * 112.0 + g * -93.786 + b * -18.214 + 128;
|
||||
/*printf("%f %f %f -> %f %f %f\n", r, g, b, y, cb, cr);*/
|
||||
iy = (GLint) CLAMP(y, 0, 254);
|
||||
icb = (GLint) CLAMP(cb, 0, 254);
|
||||
icr = (GLint) CLAMP(cr, 0, 254);
|
||||
|
||||
if (j & 1) {
|
||||
/* odd */
|
||||
*dest = (iy << 8) | icr;
|
||||
}
|
||||
else {
|
||||
/* even */
|
||||
*dest = (iy << 8) | icb;
|
||||
}
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void Init( int argc, char *argv[] )
|
||||
{
|
||||
GLuint texObj = 100;
|
||||
const char *file;
|
||||
|
||||
if (!glutExtensionSupported("GL_NV_texture_rectangle")) {
|
||||
printf("Sorry, GL_NV_texture_rectangle is required\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (!glutExtensionSupported("GL_MESA_ycbcr_texture")) {
|
||||
printf("Sorry, GL_MESA_ycbcr_texture is required\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_NV, texObj);
|
||||
#ifdef LINEAR_FILTER
|
||||
/* linear filtering looks much nicer but is much slower for Mesa */
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
#else
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
#endif
|
||||
|
||||
if (argc > 1)
|
||||
file = argv[1];
|
||||
else
|
||||
file = TEXTURE_FILE;
|
||||
|
||||
Image = LoadRGBImage(file, &ImgWidth, &ImgHeight, &ImgFormat);
|
||||
if (!Image) {
|
||||
printf("Couldn't read %s\n", TEXTURE_FILE);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0,
|
||||
GL_RGB, ImgWidth, ImgHeight, 0,
|
||||
ImgFormat, GL_UNSIGNED_BYTE, Image);
|
||||
#else
|
||||
ImageYUV = (GLushort *) malloc(ImgWidth * ImgHeight * sizeof(GLushort));
|
||||
ConvertRGBtoYUV(ImgWidth, ImgHeight, Image, ImageYUV);
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0,
|
||||
GL_YCBCR_MESA, ImgWidth, ImgHeight, 0,
|
||||
GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, ImageYUV);
|
||||
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
glTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0,
|
||||
0, 0, ImgWidth, ImgHeight,
|
||||
GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_MESA, ImageYUV);
|
||||
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
#endif
|
||||
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
glEnable(GL_TEXTURE_RECTANGLE_NV);
|
||||
|
||||
glShadeModel(GL_FLAT);
|
||||
glClearColor(0.3, 0.3, 0.4, 1.0);
|
||||
|
||||
if (argc > 1 && strcmp(argv[1], "-info")==0) {
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowSize( 300, 300 );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
|
||||
glutCreateWindow(argv[0] );
|
||||
|
||||
Init( argc, argv );
|
||||
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutSpecialFunc( SpecialKey );
|
||||
glutDisplayFunc( Display );
|
||||
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
# $Id: Makefile.X11,v 1.11 2001/03/23 22:48:35 brianp Exp $
|
||||
# $Id: Makefile.X11,v 1.11.2.1 2002/01/30 21:54:47 brianp Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.5
|
||||
# Version: 4.0.2
|
||||
# Copyright (C) 1995-2001 Brian Paul
|
||||
|
||||
# Makefile for non-GLUT (X11, SVGA, etc) demo programs
|
||||
@@ -12,9 +12,9 @@
|
||||
INCDIR = ../include
|
||||
LIBDIR = ../lib
|
||||
|
||||
GL_LIBS = -L$(LIBDIR) -lglut -lGLU -lGL $(APP_LIB_DEPS)
|
||||
GL_LIBS = -L$(LIBDIR) -lGLU -lGL $(APP_LIB_DEPS)
|
||||
|
||||
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLUT_LIB)
|
||||
LIB_DEP = $(LIBDIR)/$(GL_LIB) $(LIBDIR)/$(GLU_LIB)
|
||||
|
||||
PROGS = glthreads \
|
||||
glxdemo \
|
||||
@@ -43,7 +43,7 @@ PROGS = glthreads \
|
||||
##### TARGETS #####
|
||||
|
||||
default:
|
||||
@echo "Specify a target configuration"
|
||||
@echo "Specify a target configuration (i.e. make -f Makefile.X11 linux)"
|
||||
|
||||
clean:
|
||||
-rm *.o *~
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: glthreads.c,v 1.1 2000/07/20 20:12:17 brianp Exp $ */
|
||||
/* $Id: glthreads.c,v 1.1.4.1 2002/03/08 19:43:36 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000 Brian Paul All Rights Reserved.
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <GL/glx.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: glxheads.c,v 1.2 2000/11/10 17:23:07 brianp Exp $ */
|
||||
/* $Id: glxheads.c,v 1.2.2.1 2002/03/08 19:43:36 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Exercise multiple GLX connections on multiple X displays.
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <GL/glx.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
@@ -247,9 +248,9 @@ static void
|
||||
PrintInfo(const struct head *h)
|
||||
{
|
||||
printf("Name: %s\n", h->DisplayName);
|
||||
printf(" Display: 0x%x\n", h->Dpy);
|
||||
printf(" Window: 0x%x\n", h->Win);
|
||||
printf(" Context: 0x%x\n", h->Context);
|
||||
printf(" Display: 0x%x\n", (int) h->Dpy);
|
||||
printf(" Window: 0x%x\n", (int) h->Win);
|
||||
printf(" Context: 0x%x\n", (int) h->Context);
|
||||
printf(" GL_VERSION: %s\n", h->Version);
|
||||
printf(" GL_VENDOR: %s\n", h->Vendor);
|
||||
printf(" GL_RENDERER: %s\n", h->Renderer);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/* $Id: glxinfo.c,v 1.14 2001/04/24 20:57:36 brianp Exp $ */
|
||||
/* $Id: glxinfo.c,v 1.14.2.5 2002/09/06 12:59:14 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1999-2001 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"),
|
||||
@@ -29,6 +29,8 @@
|
||||
* -v print verbose information
|
||||
* -display DisplayName specify the X display to interogate
|
||||
* -b only print ID of "best" visual on screen 0
|
||||
* -i use indirect rendering connection only
|
||||
* -l print interesting OpenGL limits (added 5 Sep 2002)
|
||||
*
|
||||
* Brian Paul 26 January 2000
|
||||
*/
|
||||
@@ -148,7 +150,59 @@ print_display_info(Display *dpy)
|
||||
|
||||
|
||||
static void
|
||||
print_screen_info(Display *dpy, int scrnum, Bool allowDirect)
|
||||
print_limits(void)
|
||||
{
|
||||
struct token_name {
|
||||
GLuint count;
|
||||
GLenum token;
|
||||
const char *name;
|
||||
};
|
||||
static const struct token_name limits[] = {
|
||||
{ 1, GL_MAX_ATTRIB_STACK_DEPTH, "GL_MAX_ATTRIB_STACK_DEPTH" },
|
||||
{ 1, GL_MAX_CLIENT_ATTRIB_STACK_DEPTH, "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH" },
|
||||
{ 1, GL_MAX_CLIP_PLANES, "GL_MAX_CLIP_PLANES" },
|
||||
{ 1, GL_MAX_COLOR_MATRIX_STACK_DEPTH, "GL_MAX_COLOR_MATRIX_STACK_DEPTH" },
|
||||
{ 1, GL_MAX_ELEMENTS_VERTICES, "GL_MAX_ELEMENTS_VERTICES" },
|
||||
{ 1, GL_MAX_ELEMENTS_INDICES, "GL_MAX_ELEMENTS_INDICES" },
|
||||
{ 1, GL_MAX_EVAL_ORDER, "GL_MAX_EVAL_ORDER" },
|
||||
{ 1, GL_MAX_LIGHTS, "GL_MAX_LIGHTS" },
|
||||
{ 1, GL_MAX_LIST_NESTING, "GL_MAX_LIST_NESTING" },
|
||||
{ 1, GL_MAX_MODELVIEW_STACK_DEPTH, "GL_MAX_MODELVIEW_STACK_DEPTH" },
|
||||
{ 1, GL_MAX_NAME_STACK_DEPTH, "GL_MAX_NAME_STACK_DEPTH" },
|
||||
{ 1, GL_MAX_PIXEL_MAP_TABLE, "GL_MAX_PIXEL_MAP_TABLE" },
|
||||
{ 1, GL_MAX_PROJECTION_STACK_DEPTH, "GL_MAX_PROJECTION_STACK_DEPTH" },
|
||||
{ 1, GL_MAX_TEXTURE_STACK_DEPTH, "GL_MAX_TEXTURE_STACK_DEPTH" },
|
||||
{ 1, GL_MAX_TEXTURE_SIZE, "GL_MAX_TEXTURE_SIZE" },
|
||||
{ 1, GL_MAX_3D_TEXTURE_SIZE, "GL_MAX_3D_TEXTURE_SIZE" },
|
||||
{ 1, GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB" },
|
||||
{ 1, GL_MAX_RECTANGLE_TEXTURE_SIZE_NV, "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV" },
|
||||
{ 1, GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB, "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB" },
|
||||
{ 1, GL_MAX_TEXTURE_UNITS_ARB, "GL_MAX_TEXTURE_UNITS_ARB" },
|
||||
{ 1, GL_MAX_TEXTURE_LOD_BIAS_EXT, "GL_MAX_TEXTURE_LOD_BIAS_EXT" },
|
||||
{ 1, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT" },
|
||||
{ 2, GL_MAX_VIEWPORT_DIMS, "GL_MAX_VIEWPORT_DIMS" },
|
||||
{ 2, GL_ALIASED_LINE_WIDTH_RANGE, "GL_ALIASED_LINE_WIDTH_RANGE" },
|
||||
{ 2, GL_SMOOTH_LINE_WIDTH_RANGE, "GL_SMOOTH_LINE_WIDTH_RANGE" },
|
||||
{ 2, GL_ALIASED_POINT_SIZE_RANGE, "GL_ALIASED_POINT_SIZE_RANGE" },
|
||||
{ 2, GL_SMOOTH_POINT_SIZE_RANGE, "GL_SMOOTH_POINT_SIZE_RANGE" },
|
||||
{ 0, (GLenum) 0, NULL }
|
||||
};
|
||||
GLint i, max[2];
|
||||
printf("OpenGL limits:\n");
|
||||
for (i = 0; limits[i].count; i++) {
|
||||
glGetIntegerv(limits[i].token, max);
|
||||
if (glGetError() == GL_NONE) {
|
||||
if (limits[i].count == 1)
|
||||
printf(" %s = %d\n", limits[i].name, max[0]);
|
||||
else /* XXX fix if we ever query something with more than 2 values */
|
||||
printf(" %s = %d, %d\n", limits[i].name, max[0], max[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits)
|
||||
{
|
||||
Window win;
|
||||
int attribSingle[] = {
|
||||
@@ -218,7 +272,7 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect)
|
||||
const char *gluExtensions = (const char *) gluGetString(GLU_EXTENSIONS);
|
||||
#endif
|
||||
/* Strip the screen number from the display name, if present. */
|
||||
if (!(displayName = malloc(strlen(DisplayString(dpy)) + 1))) {
|
||||
if (!(displayName = (char *) malloc(strlen(DisplayString(dpy)) + 1))) {
|
||||
fprintf(stderr, "Error: malloc() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -247,6 +301,8 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect)
|
||||
printf("OpenGL version string: %s\n", glVersion);
|
||||
printf("OpenGL extensions:\n");
|
||||
print_extension_list(glExtensions);
|
||||
if (limits)
|
||||
print_limits();
|
||||
#ifdef DO_GLU
|
||||
printf("glu version: %s\n", gluVersion);
|
||||
printf("glu extensions:\n");
|
||||
@@ -408,7 +464,7 @@ print_visual_attribs_short_header(void)
|
||||
static void
|
||||
print_visual_attribs_short(const struct visual_attribs *attribs)
|
||||
{
|
||||
char *caveat;
|
||||
char *caveat = NULL;
|
||||
#ifdef GLX_EXT_visual_rating
|
||||
if (attribs->visualCaveat == GLX_NONE_EXT || attribs->visualCaveat == 0)
|
||||
caveat = "None";
|
||||
@@ -416,6 +472,8 @@ print_visual_attribs_short(const struct visual_attribs *attribs)
|
||||
caveat = "Slow";
|
||||
else if (attribs->visualCaveat == GLX_NON_CONFORMANT_VISUAL_EXT)
|
||||
caveat = "Ncon";
|
||||
else
|
||||
caveat = "None";
|
||||
#else
|
||||
caveat = "None";
|
||||
#endif
|
||||
@@ -486,16 +544,16 @@ print_visual_attribs_long(const struct visual_attribs *attribs)
|
||||
static void
|
||||
print_visual_info(Display *dpy, int scrnum, InfoMode mode)
|
||||
{
|
||||
XVisualInfo template;
|
||||
XVisualInfo theTemplate;
|
||||
XVisualInfo *visuals;
|
||||
int numVisuals;
|
||||
long mask;
|
||||
int i;
|
||||
|
||||
/* get list of all visuals on this screen */
|
||||
template.screen = scrnum;
|
||||
theTemplate.screen = scrnum;
|
||||
mask = VisualScreenMask;
|
||||
visuals = XGetVisualInfo(dpy, mask, &template, &numVisuals);
|
||||
visuals = XGetVisualInfo(dpy, mask, &theTemplate, &numVisuals);
|
||||
|
||||
if (mode == Verbose) {
|
||||
for (i = 0; i < numVisuals; i++) {
|
||||
@@ -569,7 +627,7 @@ mesa_hack(Display *dpy, int scrnum)
|
||||
static int
|
||||
find_best_visual(Display *dpy, int scrnum)
|
||||
{
|
||||
XVisualInfo template;
|
||||
XVisualInfo theTemplate;
|
||||
XVisualInfo *visuals;
|
||||
int numVisuals;
|
||||
long mask;
|
||||
@@ -577,9 +635,9 @@ find_best_visual(Display *dpy, int scrnum)
|
||||
struct visual_attribs bestVis;
|
||||
|
||||
/* get list of all visuals on this screen */
|
||||
template.screen = scrnum;
|
||||
theTemplate.screen = scrnum;
|
||||
mask = VisualScreenMask;
|
||||
visuals = XGetVisualInfo(dpy, mask, &template, &numVisuals);
|
||||
visuals = XGetVisualInfo(dpy, mask, &theTemplate, &numVisuals);
|
||||
|
||||
/* init bestVis with first visual info */
|
||||
get_visual_attribs(dpy, &visuals[0], &bestVis);
|
||||
@@ -627,6 +685,7 @@ usage(void)
|
||||
printf("\t-h: This information.\n");
|
||||
printf("\t-i: Force an indirect rendering context.\n");
|
||||
printf("\t-b: Find the 'best' visual and print it's number.\n");
|
||||
printf("\t-l: Print interesting OpenGLl imits.\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -638,6 +697,7 @@ main(int argc, char *argv[])
|
||||
int numScreens, scrnum;
|
||||
InfoMode mode = Normal;
|
||||
GLboolean findBest = GL_FALSE;
|
||||
GLboolean limits = GL_FALSE;
|
||||
Bool allowDirect = True;
|
||||
int i;
|
||||
|
||||
@@ -658,6 +718,9 @@ main(int argc, char *argv[])
|
||||
else if (strcmp(argv[i], "-i") == 0) {
|
||||
allowDirect = False;
|
||||
}
|
||||
else if (strcmp(argv[i], "-l") == 0) {
|
||||
limits = GL_TRUE;
|
||||
}
|
||||
else if (strcmp(argv[i], "-h") == 0) {
|
||||
usage();
|
||||
return 0;
|
||||
@@ -686,7 +749,7 @@ main(int argc, char *argv[])
|
||||
print_display_info(dpy);
|
||||
for (scrnum = 0; scrnum < numScreens; scrnum++) {
|
||||
mesa_hack(dpy, scrnum);
|
||||
print_screen_info(dpy, scrnum, allowDirect);
|
||||
print_screen_info(dpy, scrnum, allowDirect, limits);
|
||||
printf("\n");
|
||||
print_visual_info(dpy, scrnum, mode);
|
||||
if (scrnum + 1 < numScreens)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: glxpixmap.c,v 1.2 2000/07/11 16:05:29 brianp Exp $ */
|
||||
/* $Id: glxpixmap.c,v 1.2.6.1 2002/07/12 15:50:46 brianp Exp $ */
|
||||
|
||||
|
||||
/*
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
|
||||
#include <GL/gl.h>
|
||||
#define GLX_GLXEXT_PROTOTYPES
|
||||
#include <GL/glx.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
99
src/glu/mesa/Makefile.DJ
Normal file
99
src/glu/mesa/Makefile.DJ
Normal file
@@ -0,0 +1,99 @@
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 4.0
|
||||
#
|
||||
# Copyright (C) 1999 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.
|
||||
|
||||
# DOS/DJGPP glu makefile v1.1 for Mesa 4.0
|
||||
#
|
||||
# Copyright (C) 2002 - Borca Daniel
|
||||
# Email : dborca@yahoo.com
|
||||
# Web : http://www.geocities.com/dborca
|
||||
|
||||
|
||||
#
|
||||
# Available options:
|
||||
#
|
||||
# Environment variables:
|
||||
# CFLAGS
|
||||
#
|
||||
# Targets:
|
||||
# all: build GLU
|
||||
# clean: remove object files
|
||||
#
|
||||
|
||||
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
TOP = ..
|
||||
LIBDIR = $(TOP)/lib
|
||||
GLU_LIB = libglu.a
|
||||
GLU_DXE = glu.dxe
|
||||
GLU_IMP = libiglu.a
|
||||
|
||||
CC = gcc
|
||||
CFLAGS += -I$(TOP)/include
|
||||
|
||||
AR = ar
|
||||
ARFLAGS = ru
|
||||
|
||||
ifneq ($(wildcard $(DJDIR)/lib/dxe2.ld),)
|
||||
DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))
|
||||
endif
|
||||
|
||||
RM = del
|
||||
|
||||
CORE_SOURCES = \
|
||||
glu.c \
|
||||
mipmap.c \
|
||||
nurbs.c \
|
||||
nurbscrv.c \
|
||||
nurbssrf.c \
|
||||
nurbsutl.c \
|
||||
polytest.c \
|
||||
project.c \
|
||||
quadric.c \
|
||||
tess.c \
|
||||
tesselat.c
|
||||
|
||||
SOURCES = $(CORE_SOURCES)
|
||||
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
|
||||
.c.o:
|
||||
$(CC) -o $@ -c $(CFLAGS) $<
|
||||
|
||||
all: $(LIBDIR)/$(GLU_LIB) $(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP)
|
||||
|
||||
$(LIBDIR)/$(GLU_LIB): $(OBJECTS)
|
||||
$(AR) $(ARFLAGS) $(LIBDIR)/$(GLU_LIB) $(OBJECTS)
|
||||
|
||||
$(LIBDIR)/$(GLU_DXE) $(LIBDIR)/$(GLU_IMP): $(OBJECTS)
|
||||
ifeq ($(DXE2GEN),)
|
||||
$(warning Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN)
|
||||
$(warning somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.)
|
||||
else
|
||||
-dxe2gen -o $(LIBDIR)/$(GLU_DXE) -I $(LIBDIR)/$(GLU_IMP) $(OBJECTS) -E djgpp_ -E glu -D "Mesa DJGPP GLU" -U
|
||||
endif
|
||||
|
||||
clean:
|
||||
-$(RM) $(subst /,\,*.o)
|
||||
|
||||
-include depend
|
@@ -1,9 +1,9 @@
|
||||
/* $Id: glu.c,v 1.24 2001/03/20 17:56:10 brianp Exp $ */
|
||||
/* $Id: glu.c,v 1.24.2.1 2002/02/12 03:13:42 brianp Exp $ */
|
||||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.5
|
||||
* Copyright (C) 1995-2001 Brian Paul
|
||||
* Version: 4.0.2
|
||||
* Copyright (C) 1995-2002 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
@@ -330,7 +330,7 @@ const GLubyte *GLAPIENTRY
|
||||
gluGetString(GLenum name)
|
||||
{
|
||||
static char *extensions = "GL_EXT_abgr";
|
||||
static char *version = "1.1 Mesa 3.5";
|
||||
static char *version = "1.1 Mesa 4.0.2";
|
||||
|
||||
switch (name) {
|
||||
case GLU_EXTENSIONS:
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# $Id: Makefile.X11,v 1.5.2.1 2001/12/14 17:18:08 kschultz Exp $
|
||||
# $Id: Makefile.X11,v 1.5.2.2 2002/01/08 15:58:11 brianp Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 3.5
|
||||
# Version: 4.0.1
|
||||
# Copyright (C) 1995-2001 Brian Paul
|
||||
|
||||
# Makefile for SGI SI GLU library
|
||||
@@ -122,10 +122,10 @@ OBJECTS = $(C_OBJECTS) $(CC_OBJECTS)
|
||||
##### RULES #####
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(INCDIRS) $(CFLAGS) -DLIBRARYBUILD $< -o $@
|
||||
$(CC) -c $(INCDIRS) $(CFLAGS) -DNDEBUG -DLIBRARYBUILD $< -o $@
|
||||
|
||||
.cc.o:
|
||||
$(CPLUSPLUS) -c $(INCDIRS) $(CCFLAGS) -DLIBRARYBUILD $< -o $@
|
||||
$(CPLUSPLUS) -c $(INCDIRS) $(CCFLAGS) -DNDEBUG -DLIBRARYBUILD $< -o $@
|
||||
|
||||
|
||||
##### TARGETS #####
|
||||
|
@@ -31,10 +31,10 @@
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
** $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
** $Date: 2002/02/12 03:14:58 $ $Revision: 1.1.2.1 $
|
||||
*/
|
||||
/*
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/insurfeval.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/insurfeval.cc,v 1.1.2.1 2002/02/12 03:14:58 brianp Exp $
|
||||
*/
|
||||
|
||||
#include "gluos.h"
|
||||
@@ -528,11 +528,11 @@ void OpenGLSurfaceEvaluator::inComputeNormal2(REAL *pu, REAL *pv, REAL *n)
|
||||
|
||||
mag = sqrt(n[0]*n[0] + n[1]*n[1] + n[2]*n[2]);
|
||||
|
||||
assert(mag > 0.0); /*better be some threshold*/
|
||||
n[0] /= mag;
|
||||
n[1] /= mag;
|
||||
n[2] /= mag;
|
||||
|
||||
if (mag > 0.0) {
|
||||
n[0] /= mag;
|
||||
n[1] /= mag;
|
||||
n[2] /= mag;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* slicer.c++
|
||||
*
|
||||
* $Date: 2001/05/01 14:56:00 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/slicer.cc,v 1.2 2001/05/01 14:56:00 brianp Exp $
|
||||
* $Date: 2002/06/30 16:58:50 $ $Revision: 1.2.2.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/slicer.cc,v 1.2.2.1 2002/06/30 16:58:50 brianp Exp $
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -309,7 +309,6 @@ static void triangulateRectAux(PwlArc* top, PwlArc* bot, PwlArc* left, PwlArc* r
|
||||
|
||||
static void triangulateRect(Arc_ptr loop, Backend& backend, int TB_or_LR, int ulinear, int vlinear)
|
||||
{
|
||||
int i;
|
||||
//we know the loop is a rectangle, but not sure which is top
|
||||
Arc_ptr top, bot, left, right;
|
||||
if(loop->tail()[1] == loop->head()[1])
|
||||
@@ -572,8 +571,6 @@ static void triangulateRectCenter(int n_ulines, REAL* u_val,
|
||||
int n_vlines, REAL* v_val,
|
||||
Backend& backend)
|
||||
{
|
||||
TrimVertex trimVert;
|
||||
trimVert.nuid = 0;//????
|
||||
|
||||
// XXX this code was patched by Diego Santa Cruz <Diego.SantaCruz@epfl.ch>
|
||||
// to fix a problem in which glMapGrid2f() was called with bad parameters.
|
||||
@@ -1075,18 +1072,21 @@ void Slicer::slice_new(Arc_ptr loop)
|
||||
mydu = (du>0)? du: -du;
|
||||
mydv = (dv>0)? dv: -dv;
|
||||
|
||||
for(Arc_ptr jarc=loop->next; jarc != loop; jarc = jarc->next)
|
||||
{
|
||||
for(Arc_ptr jarc=loop->next; jarc != loop; jarc = jarc->next)
|
||||
{
|
||||
|
||||
if(jarc->tail()[0] < uMin)
|
||||
uMin = jarc->tail()[0];
|
||||
if(jarc->tail()[0] > uMax)
|
||||
uMax = jarc->tail()[0];
|
||||
if(jarc->tail()[1] < vMin)
|
||||
vMin = jarc->tail()[1];
|
||||
if(jarc->tail()[1] > vMax)
|
||||
vMax = jarc->tail()[1];
|
||||
}
|
||||
if(jarc->tail()[0] < uMin)
|
||||
uMin = jarc->tail()[0];
|
||||
if(jarc->tail()[0] > uMax)
|
||||
uMax = jarc->tail()[0];
|
||||
if(jarc->tail()[1] < vMin)
|
||||
vMin = jarc->tail()[1];
|
||||
if(jarc->tail()[1] > vMax)
|
||||
vMax = jarc->tail()[1];
|
||||
}
|
||||
|
||||
if (uMax == uMin)
|
||||
return; // prevent divide-by-zero. Jon Perry. 17 June 2002
|
||||
|
||||
if(mydu > uMax - uMin)
|
||||
num_ulines = 2;
|
||||
|
@@ -31,16 +31,23 @@
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
**
|
||||
** $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
** $Date: 2002/04/17 19:30:19 $ $Revision: 1.1.2.1 $
|
||||
*/
|
||||
/*
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/quicksort.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
** $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/nurbtess/quicksort.cc,v 1.1.2.1 2002/04/17 19:30:19 brianp Exp $
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static void swap(void *v[], int i, int j);
|
||||
|
||||
static void swap(void *v[], int i, int j)
|
||||
{
|
||||
void *temp;
|
||||
temp = v[i];
|
||||
v[i] = v[j];
|
||||
v[j] = temp;
|
||||
}
|
||||
|
||||
/*as an example to use this function to
|
||||
*sort integers, you need to supply the function
|
||||
@@ -58,7 +65,6 @@ void quicksort(void *v[], int left, int right,
|
||||
int (*comp) (void *, void *))
|
||||
{
|
||||
int i, last;
|
||||
void swap(void *v[], int , int);
|
||||
if(left >= right) /*do nothing if array contains */
|
||||
return; /*fewer than two elements*/
|
||||
|
||||
@@ -71,12 +77,3 @@ void quicksort(void *v[], int left, int right,
|
||||
quicksort(v, left, last-1, comp);
|
||||
quicksort(v, last+1, right, comp);
|
||||
}
|
||||
|
||||
void swap(void *v[], int i, int j)
|
||||
{
|
||||
void *temp;
|
||||
temp = v[i];
|
||||
v[i] = v[j];
|
||||
v[j] = temp;
|
||||
}
|
||||
|
||||
|
136
src/glut/dos/Makefile.DJ
Normal file
136
src/glut/dos/Makefile.DJ
Normal file
@@ -0,0 +1,136 @@
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 4.0
|
||||
#
|
||||
# Copyright (C) 1999 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.
|
||||
|
||||
# DOS/DJGPP glut makefile v1.1 for Mesa 4.0
|
||||
#
|
||||
# Copyright (C) 2002 - Borca Daniel
|
||||
# Email : dborca@yahoo.com
|
||||
# Web : http://www.geocities.com/dborca
|
||||
|
||||
|
||||
#
|
||||
# Available options:
|
||||
#
|
||||
# Environment variables:
|
||||
# CFLAGS
|
||||
#
|
||||
# GLIDE absolute path to Glide SDK; used with FX.
|
||||
# default = $(TOP)/include/glide3
|
||||
# FX=1 build for 3dfx Glide3; use it if you have the glide
|
||||
# SDK (designed for your platform), and, of course, a
|
||||
# 3dfx card... Note that this disables compilation of
|
||||
# actual DMesa code, as Glide does all the stuff!
|
||||
# default = no
|
||||
# MARK absolute path to original GLUT.
|
||||
# default = $(TOP)/src-glut
|
||||
#
|
||||
# Targets:
|
||||
# all: build GLUT
|
||||
# clean: remove object files
|
||||
#
|
||||
|
||||
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
TOP = ..
|
||||
GLIDE ?= $(TOP)/include/glide3
|
||||
MARK ?= $(TOP)/src-glut
|
||||
LIBDIR = $(TOP)/lib
|
||||
GLUT_LIB = libglut.a
|
||||
GLUT_DXE = glut.dxe
|
||||
GLUT_IMP = libiglut.a
|
||||
|
||||
CC = gcc
|
||||
CFLAGS += -I$(TOP)/include -I$(MARK)
|
||||
ifdef FX
|
||||
CFLAGS += -D__DOS__ -I$(GLIDE) -DFX -DFX_GLIDE3 -DFXMESA_USE_ARGB
|
||||
endif
|
||||
|
||||
AR = ar
|
||||
ARFLAGS = ru
|
||||
|
||||
ifneq ($(wildcard $(DJDIR)/lib/dxe2.ld),)
|
||||
DXE2GEN = $(wildcard $(addsuffix /dxe2gen.exe,$(subst ;, ,$(PATH))))
|
||||
endif
|
||||
|
||||
RM = del
|
||||
|
||||
CORE_SOURCES = \
|
||||
bitmap.c \
|
||||
callback.c \
|
||||
color.c \
|
||||
globals.c \
|
||||
init.c \
|
||||
menu.c \
|
||||
models.c \
|
||||
overlay.c \
|
||||
state.c \
|
||||
teapot.c \
|
||||
window.c
|
||||
|
||||
PC_HW_SOURCES = \
|
||||
PC_HW/pc_hw.c \
|
||||
PC_HW/pc_keyb.c \
|
||||
PC_HW/pc_mouse.c \
|
||||
PC_HW/pc_timer.c \
|
||||
PC_HW/pc_irq.S
|
||||
|
||||
MARK_SOURCES = \
|
||||
$(MARK)/glut_8x13.c \
|
||||
$(MARK)/glut_9x15.c \
|
||||
$(MARK)/glut_hel10.c \
|
||||
$(MARK)/glut_hel12.c \
|
||||
$(MARK)/glut_hel18.c \
|
||||
$(MARK)/glut_tr10.c \
|
||||
$(MARK)/glut_tr24.c
|
||||
|
||||
SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES) $(MARK_SOURCES)
|
||||
|
||||
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
|
||||
|
||||
.c.o:
|
||||
$(CC) -o $@ -c $(CFLAGS) $<
|
||||
.S.o:
|
||||
$(CC) -o $@ -c $(CFLAGS) $<
|
||||
.s.o:
|
||||
$(CC) -o $@ -c $(CFLAGS) -x assembler-with-cpp $<
|
||||
|
||||
all: $(LIBDIR)/$(GLUT_LIB) $(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP)
|
||||
|
||||
$(LIBDIR)/$(GLUT_LIB): $(OBJECTS)
|
||||
$(AR) $(ARFLAGS) $(LIBDIR)/$(GLUT_LIB) $(OBJECTS)
|
||||
|
||||
$(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)
|
||||
ifeq ($(DXE2GEN),)
|
||||
$(warning Missing DXE2GEN and/or DXE2.LD! You must have DXE2GEN)
|
||||
$(warning somewhere in PATH, and DXE2.LD in DJGPP/LIB directory.)
|
||||
else
|
||||
-dxe2gen -o $(LIBDIR)/$(GLUT_DXE) -I $(LIBDIR)/$(GLUT_IMP) $(OBJECTS) -E djgpp_ -E glut -D "Mesa DJGPP GLUT" -U
|
||||
endif
|
||||
|
||||
clean:
|
||||
-$(RM) $(subst /,\,*.o)
|
||||
-$(RM) $(subst /,\,PC_HW/*.o)
|
||||
-$(RM) $(subst /,\,$(MARK)/*.o)
|
||||
|
||||
-include depend
|
141
src/glut/dos/PC_HW/pc_hw.c
Normal file
141
src/glut/dos/PC_HW/pc_hw.c
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* PC/HW routine collection v1.0 for DOS/DJGPP
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#include <dpmi.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h> /* for mode definitions */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "pc_hw.h"
|
||||
|
||||
/*
|
||||
* atexit
|
||||
*/
|
||||
#define MAX_ATEXIT 32
|
||||
|
||||
static volatile int atexitcnt;
|
||||
static VFUNC atexittbl[MAX_ATEXIT];
|
||||
|
||||
static void __attribute__((destructor)) doexit (void)
|
||||
{
|
||||
while (atexitcnt) atexittbl[--atexitcnt]();
|
||||
}
|
||||
|
||||
int pc_clexit (VFUNC f)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<atexitcnt;i++) {
|
||||
if (atexittbl[i]==f) {
|
||||
for (atexitcnt--;i<atexitcnt;i++) atexittbl[i] = atexittbl[i+1];
|
||||
atexittbl[i] = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int pc_atexit (VFUNC f)
|
||||
{
|
||||
pc_clexit(f);
|
||||
if (atexitcnt<MAX_ATEXIT) {
|
||||
atexittbl[atexitcnt++] = f;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* locked memory allocation
|
||||
*/
|
||||
void *pc_malloc (size_t size)
|
||||
{
|
||||
void *p = malloc(size);
|
||||
|
||||
if (p) {
|
||||
if (_go32_dpmi_lock_data(p, size)) {
|
||||
free(p);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
* standard redirection
|
||||
*/
|
||||
static char errname[L_tmpnam];
|
||||
static char outname[L_tmpnam];
|
||||
|
||||
static int h_out, h_outbak;
|
||||
static int h_err, h_errbak;
|
||||
|
||||
void pc_open_stderr (void)
|
||||
{
|
||||
if (tmpnam(errname)) {
|
||||
h_err = open(errname, O_WRONLY |/* O_BINARY |*/ O_CREAT | O_TRUNC,
|
||||
S_IREAD | S_IWRITE);
|
||||
h_errbak = dup(2);
|
||||
fflush(stderr);
|
||||
dup2(h_err, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void pc_close_stderr (void)
|
||||
{
|
||||
FILE *f;
|
||||
char *line = alloca(512);
|
||||
|
||||
dup2(h_errbak, 2);
|
||||
close(h_err);
|
||||
close(h_errbak);
|
||||
|
||||
if ((f=fopen(errname, "r"))!=NULL) {
|
||||
while (fgets(line, 512, f)) {
|
||||
fputs(line, stderr);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
remove(errname);
|
||||
}
|
||||
|
||||
void pc_open_stdout (void)
|
||||
{
|
||||
if (tmpnam(outname)) {
|
||||
h_out = open(outname, O_WRONLY |/* O_BINARY |*/ O_CREAT | O_TRUNC,
|
||||
S_IREAD | S_IWRITE);
|
||||
h_outbak = dup(1);
|
||||
fflush(stdout);
|
||||
dup2(h_out, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void pc_close_stdout (void)
|
||||
{
|
||||
FILE *f;
|
||||
char *line = alloca(512);
|
||||
|
||||
dup2(h_outbak, 1);
|
||||
close(h_out);
|
||||
close(h_outbak);
|
||||
|
||||
if ((f=fopen(outname, "r"))!=NULL) {
|
||||
while (fgets(line, 512, f)) {
|
||||
fputs(line, stdout);
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
remove(outname);
|
||||
}
|
225
src/glut/dos/PC_HW/pc_hw.h
Normal file
225
src/glut/dos/PC_HW/pc_hw.h
Normal file
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
* PC/HW routine collection v1.1 for DOS/DJGPP
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#ifndef PC_HW_H_included
|
||||
#define PC_HW_H_included
|
||||
|
||||
#include <dpmi.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* misc C definitions
|
||||
*/
|
||||
#define FALSE 0
|
||||
#define TRUE !FALSE
|
||||
|
||||
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
|
||||
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
|
||||
#define MID(x,y,z) MAX((x), MIN((y), (z)))
|
||||
|
||||
typedef void (*VFUNC) (void);
|
||||
typedef void (*PFUNC) (void *);
|
||||
typedef void (*MFUNC) (int x, int y, int b);
|
||||
|
||||
/*
|
||||
* atexit
|
||||
*/
|
||||
int pc_atexit (VFUNC f);
|
||||
int pc_clexit (VFUNC f);
|
||||
|
||||
/*
|
||||
* locked memory
|
||||
*/
|
||||
#define ENDOFUNC(x) static void x##_end() { }
|
||||
#define LOCKFUNC(x) _go32_dpmi_lock_code((void *)x, (long)x##_end - (long)x)
|
||||
#define LOCKDATA(x) _go32_dpmi_lock_data((void *)&x, sizeof(x))
|
||||
|
||||
void *pc_malloc (size_t size);
|
||||
|
||||
/*
|
||||
* IRQ
|
||||
*/
|
||||
#define ENABLE() __asm __volatile ("sti")
|
||||
#define DISABLE() __asm __volatile ("cli")
|
||||
|
||||
extern int pc_install_irq (int i, int (*handler) ());
|
||||
extern int pc_remove_irq (int i);
|
||||
|
||||
/*
|
||||
* keyboard
|
||||
*/
|
||||
#define KB_SHIFT_FLAG 0x0001
|
||||
#define KB_CTRL_FLAG 0x0002
|
||||
#define KB_ALT_FLAG 0x0004
|
||||
#define KB_LWIN_FLAG 0x0008
|
||||
#define KB_RWIN_FLAG 0x0010
|
||||
#define KB_MENU_FLAG 0x0020
|
||||
#define KB_SCROLOCK_FLAG 0x0100
|
||||
#define KB_NUMLOCK_FLAG 0x0200
|
||||
#define KB_CAPSLOCK_FLAG 0x0400
|
||||
#define KB_INALTSEQ_FLAG 0x0800
|
||||
#define KB_ACCENT1_FLAG 0x1000
|
||||
#define KB_ACCENT2_FLAG 0x2000
|
||||
#define KB_ACCENT3_FLAG 0x4000
|
||||
#define KB_ACCENT4_FLAG 0x8000
|
||||
|
||||
#define KEY_A 1
|
||||
#define KEY_B 2
|
||||
#define KEY_C 3
|
||||
#define KEY_D 4
|
||||
#define KEY_E 5
|
||||
#define KEY_F 6
|
||||
#define KEY_G 7
|
||||
#define KEY_H 8
|
||||
#define KEY_I 9
|
||||
#define KEY_J 10
|
||||
#define KEY_K 11
|
||||
#define KEY_L 12
|
||||
#define KEY_M 13
|
||||
#define KEY_N 14
|
||||
#define KEY_O 15
|
||||
#define KEY_P 16
|
||||
#define KEY_Q 17
|
||||
#define KEY_R 18
|
||||
#define KEY_S 19
|
||||
#define KEY_T 20
|
||||
#define KEY_U 21
|
||||
#define KEY_V 22
|
||||
#define KEY_W 23
|
||||
#define KEY_X 24
|
||||
#define KEY_Y 25
|
||||
#define KEY_Z 26
|
||||
#define KEY_0 27
|
||||
#define KEY_1 28
|
||||
#define KEY_2 29
|
||||
#define KEY_3 30
|
||||
#define KEY_4 31
|
||||
#define KEY_5 32
|
||||
#define KEY_6 33
|
||||
#define KEY_7 34
|
||||
#define KEY_8 35
|
||||
#define KEY_9 36
|
||||
#define KEY_0_PAD 37
|
||||
#define KEY_1_PAD 38
|
||||
#define KEY_2_PAD 39
|
||||
#define KEY_3_PAD 40
|
||||
#define KEY_4_PAD 41
|
||||
#define KEY_5_PAD 42
|
||||
#define KEY_6_PAD 43
|
||||
#define KEY_7_PAD 44
|
||||
#define KEY_8_PAD 45
|
||||
#define KEY_9_PAD 46
|
||||
#define KEY_F1 47
|
||||
#define KEY_F2 48
|
||||
#define KEY_F3 49
|
||||
#define KEY_F4 50
|
||||
#define KEY_F5 51
|
||||
#define KEY_F6 52
|
||||
#define KEY_F7 53
|
||||
#define KEY_F8 54
|
||||
#define KEY_F9 55
|
||||
#define KEY_F10 56
|
||||
#define KEY_F11 57
|
||||
#define KEY_F12 58
|
||||
#define KEY_ESC 59
|
||||
#define KEY_TILDE 60
|
||||
#define KEY_MINUS 61
|
||||
#define KEY_EQUALS 62
|
||||
#define KEY_BACKSPACE 63
|
||||
#define KEY_TAB 64
|
||||
#define KEY_OPENBRACE 65
|
||||
#define KEY_CLOSEBRACE 66
|
||||
#define KEY_ENTER 67
|
||||
#define KEY_COLON 68
|
||||
#define KEY_QUOTE 69
|
||||
#define KEY_BACKSLASH 70
|
||||
#define KEY_BACKSLASH2 71
|
||||
#define KEY_COMMA 72
|
||||
#define KEY_STOP 73
|
||||
#define KEY_SLASH 74
|
||||
#define KEY_SPACE 75
|
||||
#define KEY_INSERT 76
|
||||
#define KEY_DEL 77
|
||||
#define KEY_HOME 78
|
||||
#define KEY_END 79
|
||||
#define KEY_PGUP 80
|
||||
#define KEY_PGDN 81
|
||||
#define KEY_LEFT 82
|
||||
#define KEY_RIGHT 83
|
||||
#define KEY_UP 84
|
||||
#define KEY_DOWN 85
|
||||
#define KEY_SLASH_PAD 86
|
||||
#define KEY_ASTERISK 87
|
||||
#define KEY_MINUS_PAD 88
|
||||
#define KEY_PLUS_PAD 89
|
||||
#define KEY_DEL_PAD 90
|
||||
#define KEY_ENTER_PAD 91
|
||||
#define KEY_PRTSCR 92
|
||||
#define KEY_PAUSE 93
|
||||
#define KEY_ABNT_C1 94
|
||||
#define KEY_YEN 95
|
||||
#define KEY_KANA 96
|
||||
#define KEY_CONVERT 97
|
||||
#define KEY_NOCONVERT 98
|
||||
#define KEY_AT 99
|
||||
#define KEY_CIRCUMFLEX 100
|
||||
#define KEY_COLON2 101
|
||||
#define KEY_KANJI 102
|
||||
|
||||
#define KEY_MODIFIERS 103
|
||||
|
||||
#define KEY_LSHIFT 103
|
||||
#define KEY_RSHIFT 104
|
||||
#define KEY_LCONTROL 105
|
||||
#define KEY_RCONTROL 106
|
||||
#define KEY_ALT 107
|
||||
#define KEY_ALTGR 108
|
||||
#define KEY_LWIN 109
|
||||
#define KEY_RWIN 110
|
||||
#define KEY_MENU 111
|
||||
#define KEY_SCRLOCK 112
|
||||
#define KEY_NUMLOCK 113
|
||||
#define KEY_CAPSLOCK 114
|
||||
|
||||
#define KEY_MAX 115
|
||||
|
||||
int pc_install_keyb (void);
|
||||
void pc_remove_keyb (void);
|
||||
int pc_keypressed (void);
|
||||
int pc_readkey (void);
|
||||
int pc_keydown (int code);
|
||||
|
||||
/*
|
||||
* timer
|
||||
*/
|
||||
int pc_install_int (PFUNC func, void *parm, unsigned int freq);
|
||||
void pc_remove_timer (void);
|
||||
|
||||
/*
|
||||
* mouse
|
||||
*/
|
||||
int pc_install_mouse (void);
|
||||
void pc_remove_mouse (void);
|
||||
MFUNC pc_install_mouse_handler (MFUNC handler);
|
||||
void pc_mouse_area (int x1, int y1, int x2, int y2);
|
||||
void pc_mouse_speed (int xspeed, int yspeed);
|
||||
int pc_query_mouse (int *x, int *y);
|
||||
void pc_show_mouse (void);
|
||||
void pc_scare_mouse (void);
|
||||
void pc_unscare_mouse (void);
|
||||
|
||||
/*
|
||||
* standard redirection
|
||||
*/
|
||||
void pc_open_stdout (void);
|
||||
void pc_open_stderr (void);
|
||||
void pc_close_stdout (void);
|
||||
void pc_close_stderr (void);
|
||||
|
||||
#endif
|
180
src/glut/dos/PC_HW/pc_irq.S
Normal file
180
src/glut/dos/PC_HW/pc_irq.S
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* PC/HW routine collection v1.0 for DOS/DJGPP
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
.file "pc_irq.S"
|
||||
|
||||
.text
|
||||
|
||||
#define IRQ_STACK_SIZE 16384
|
||||
|
||||
#define IRQ_WRAPPER_LEN (__irq_wrapper_1-__irq_wrapper_0)
|
||||
#define IRQ_OLD (__irq_old_0-__irq_wrapper_0)
|
||||
#define IRQ_HOOK (__irq_hook_0-__irq_wrapper_0)
|
||||
#define IRQ_STACK (__irq_stack_0-__irq_wrapper_0)
|
||||
|
||||
.balign 4
|
||||
common:
|
||||
movw $0x0400, %ax
|
||||
int $0x31
|
||||
|
||||
movl %ss:8(%ebp), %ebx
|
||||
cmpl $15, %ebx
|
||||
jbe 0f
|
||||
fail:
|
||||
orl $-1, %eax
|
||||
popl %edi
|
||||
popl %ebx
|
||||
leave
|
||||
ret
|
||||
|
||||
0:
|
||||
movl %ebx, %edi
|
||||
imull $IRQ_WRAPPER_LEN, %edi
|
||||
addl $__irq_wrapper_0, %edi
|
||||
|
||||
cmpb $7, %bl
|
||||
jbe 1f
|
||||
movb %dl, %dh
|
||||
subb $8, %dh
|
||||
1:
|
||||
addb %dh, %bl
|
||||
ret
|
||||
|
||||
.balign 4
|
||||
.global _pc_install_irq
|
||||
_pc_install_irq:
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
pushl %ebx
|
||||
pushl %edi
|
||||
|
||||
call common
|
||||
|
||||
cmpl $0, IRQ_HOOK(%edi)
|
||||
jne fail
|
||||
|
||||
pushl $IRQ_WRAPPER_LEN
|
||||
pushl %edi
|
||||
call __go32_dpmi_lock_code
|
||||
addl $8, %esp
|
||||
testl %eax, %eax
|
||||
jnz fail
|
||||
|
||||
pushl $IRQ_STACK_SIZE
|
||||
call _pc_malloc
|
||||
popl %edx
|
||||
testl %eax, %eax
|
||||
jz fail
|
||||
addl %edx, %eax
|
||||
movl %eax, IRQ_STACK(%edi)
|
||||
|
||||
movl %ss:12(%ebp), %eax
|
||||
movl %eax, IRQ_HOOK(%edi)
|
||||
|
||||
movw $0x0204, %ax
|
||||
int $0x31
|
||||
movl %edx, IRQ_OLD(%edi)
|
||||
movw %cx, IRQ_OLD+4(%edi)
|
||||
movw $0x0205, %ax
|
||||
movl %edi, %edx
|
||||
movl %cs, %ecx
|
||||
int $0x31
|
||||
|
||||
done:
|
||||
xorl %eax, %eax
|
||||
popl %edi
|
||||
popl %ebx
|
||||
leave
|
||||
ret
|
||||
|
||||
.balign 4
|
||||
.global _pc_remove_irq
|
||||
_pc_remove_irq:
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
pushl %ebx
|
||||
pushl %edi
|
||||
|
||||
call common
|
||||
|
||||
cmpl $0, IRQ_HOOK(%edi)
|
||||
je fail
|
||||
|
||||
movl $0, IRQ_HOOK(%edi)
|
||||
|
||||
movw $0x0205, %ax
|
||||
movl IRQ_OLD(%edi), %edx
|
||||
movl IRQ_OLD+4(%edi), %ecx
|
||||
int $0x31
|
||||
|
||||
movl IRQ_STACK(%edi), %eax
|
||||
subl $IRQ_STACK_SIZE, %eax
|
||||
pushl %eax
|
||||
call _free
|
||||
popl %eax
|
||||
|
||||
jmp done
|
||||
|
||||
#define WRAPPER(x) ; \
|
||||
.balign 4 ; \
|
||||
__irq_wrapper_##x: ; \
|
||||
pushal ; \
|
||||
pushl %ds ; \
|
||||
pushl %es ; \
|
||||
pushl %fs ; \
|
||||
pushl %gs ; \
|
||||
movl %ss, %ebx ; \
|
||||
movl %esp, %esi ; \
|
||||
movl %cs:___djgpp_ds_alias, %ss ; \
|
||||
movl %cs:__irq_stack_##x, %esp ; \
|
||||
pushl %ss ; \
|
||||
pushl %ss ; \
|
||||
popl %es ; \
|
||||
popl %ds ; \
|
||||
movl ___djgpp_dos_sel, %fs ; \
|
||||
pushl %fs ; \
|
||||
popl %gs ; \
|
||||
call *__irq_hook_##x ; \
|
||||
movl %ebx, %ss ; \
|
||||
movl %esi, %esp ; \
|
||||
testl %eax, %eax ; \
|
||||
popl %gs ; \
|
||||
popl %fs ; \
|
||||
popl %es ; \
|
||||
popl %ds ; \
|
||||
popal ; \
|
||||
jz __irq_ignore_##x ; \
|
||||
__irq_bypass_##x: ; \
|
||||
ljmp *%cs:__irq_old_##x ; \
|
||||
__irq_ignore_##x: ; \
|
||||
iret ; \
|
||||
.balign 4 ; \
|
||||
__irq_old_##x: ; \
|
||||
.long 0, 0 ; \
|
||||
__irq_hook_##x: ; \
|
||||
.long 0 ; \
|
||||
__irq_stack_##x: ; \
|
||||
.long 0
|
||||
|
||||
WRAPPER(0);
|
||||
WRAPPER(1);
|
||||
WRAPPER(2);
|
||||
WRAPPER(3);
|
||||
WRAPPER(4);
|
||||
WRAPPER(5);
|
||||
WRAPPER(6);
|
||||
WRAPPER(7);
|
||||
WRAPPER(8);
|
||||
WRAPPER(9);
|
||||
WRAPPER(10);
|
||||
WRAPPER(11);
|
||||
WRAPPER(12);
|
||||
WRAPPER(13);
|
||||
WRAPPER(14);
|
||||
WRAPPER(15);
|
541
src/glut/dos/PC_HW/pc_keyb.c
Normal file
541
src/glut/dos/PC_HW/pc_keyb.c
Normal file
@@ -0,0 +1,541 @@
|
||||
/*
|
||||
* PC/HW routine collection v1.1 for DOS/DJGPP
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#include <pc.h>
|
||||
#include <sys/exceptn.h>
|
||||
#include <sys/farptr.h>
|
||||
|
||||
#include "pc_hw.h"
|
||||
|
||||
|
||||
|
||||
#define KEYB_IRQ 1
|
||||
|
||||
#define KEY_BUFFER_SIZE 64
|
||||
|
||||
#define KB_MODIFIERS (KB_SHIFT_FLAG | KB_CTRL_FLAG | KB_ALT_FLAG | KB_LWIN_FLAG | KB_RWIN_FLAG | KB_MENU_FLAG)
|
||||
#define KB_LED_FLAGS (KB_SCROLOCK_FLAG | KB_NUMLOCK_FLAG | KB_CAPSLOCK_FLAG)
|
||||
|
||||
static int keyboard_installed;
|
||||
|
||||
static volatile struct {
|
||||
volatile int start, end;
|
||||
volatile int key[KEY_BUFFER_SIZE];
|
||||
} key_buffer;
|
||||
|
||||
static volatile int key_enhanced, key_pause_loop, key_shifts;
|
||||
static int leds_ok = TRUE;
|
||||
static int in_a_terrupt = FALSE;
|
||||
static volatile char pc_key[KEY_MAX];
|
||||
|
||||
|
||||
|
||||
/* convert Allegro format scancodes into key_shifts flag bits */
|
||||
static unsigned short modifier_table[KEY_MAX - KEY_MODIFIERS] =
|
||||
{
|
||||
KB_SHIFT_FLAG, KB_SHIFT_FLAG, KB_CTRL_FLAG,
|
||||
KB_CTRL_FLAG, KB_ALT_FLAG, KB_ALT_FLAG,
|
||||
KB_LWIN_FLAG, KB_RWIN_FLAG, KB_MENU_FLAG,
|
||||
KB_SCROLOCK_FLAG, KB_NUMLOCK_FLAG, KB_CAPSLOCK_FLAG
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* lookup table for converting hardware scancodes into Allegro format */
|
||||
static unsigned char hw_to_mycode[128] =
|
||||
{
|
||||
/* 0x00 */ 0, KEY_ESC, KEY_1, KEY_2,
|
||||
/* 0x04 */ KEY_3, KEY_4, KEY_5, KEY_6,
|
||||
/* 0x08 */ KEY_7, KEY_8, KEY_9, KEY_0,
|
||||
/* 0x0C */ KEY_MINUS, KEY_EQUALS, KEY_BACKSPACE, KEY_TAB,
|
||||
/* 0x10 */ KEY_Q, KEY_W, KEY_E, KEY_R,
|
||||
/* 0x14 */ KEY_T, KEY_Y, KEY_U, KEY_I,
|
||||
/* 0x18 */ KEY_O, KEY_P, KEY_OPENBRACE, KEY_CLOSEBRACE,
|
||||
/* 0x1C */ KEY_ENTER, KEY_LCONTROL, KEY_A, KEY_S,
|
||||
/* 0x20 */ KEY_D, KEY_F, KEY_G, KEY_H,
|
||||
/* 0x24 */ KEY_J, KEY_K, KEY_L, KEY_COLON,
|
||||
/* 0x28 */ KEY_QUOTE, KEY_TILDE, KEY_LSHIFT, KEY_BACKSLASH,
|
||||
/* 0x2C */ KEY_Z, KEY_X, KEY_C, KEY_V,
|
||||
/* 0x30 */ KEY_B, KEY_N, KEY_M, KEY_COMMA,
|
||||
/* 0x34 */ KEY_STOP, KEY_SLASH, KEY_RSHIFT, KEY_ASTERISK,
|
||||
/* 0x38 */ KEY_ALT, KEY_SPACE, KEY_CAPSLOCK, KEY_F1,
|
||||
/* 0x3C */ KEY_F2, KEY_F3, KEY_F4, KEY_F5,
|
||||
/* 0x40 */ KEY_F6, KEY_F7, KEY_F8, KEY_F9,
|
||||
/* 0x44 */ KEY_F10, KEY_NUMLOCK, KEY_SCRLOCK, KEY_7_PAD,
|
||||
/* 0x48 */ KEY_8_PAD, KEY_9_PAD, KEY_MINUS_PAD, KEY_4_PAD,
|
||||
/* 0x4C */ KEY_5_PAD, KEY_6_PAD, KEY_PLUS_PAD, KEY_1_PAD,
|
||||
/* 0x50 */ KEY_2_PAD, KEY_3_PAD, KEY_0_PAD, KEY_DEL_PAD,
|
||||
/* 0x54 */ KEY_PRTSCR, 0, KEY_BACKSLASH2, KEY_F11,
|
||||
/* 0x58 */ KEY_F12, 0, 0, KEY_LWIN,
|
||||
/* 0x5C */ KEY_RWIN, KEY_MENU, 0, 0,
|
||||
/* 0x60 */ 0, 0, 0, 0,
|
||||
/* 0x64 */ 0, 0, 0, 0,
|
||||
/* 0x68 */ 0, 0, 0, 0,
|
||||
/* 0x6C */ 0, 0, 0, 0,
|
||||
/* 0x70 */ KEY_KANA, 0, 0, KEY_ABNT_C1,
|
||||
/* 0x74 */ 0, 0, 0, 0,
|
||||
/* 0x78 */ 0, KEY_CONVERT, 0, KEY_NOCONVERT,
|
||||
/* 0x7C */ 0, KEY_YEN, 0, 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* lookup table for converting extended hardware codes into Allegro format */
|
||||
static unsigned char hw_to_mycode_ex[128] =
|
||||
{
|
||||
/* 0x00 */ 0, KEY_ESC, KEY_1, KEY_2,
|
||||
/* 0x04 */ KEY_3, KEY_4, KEY_5, KEY_6,
|
||||
/* 0x08 */ KEY_7, KEY_8, KEY_9, KEY_0,
|
||||
/* 0x0C */ KEY_MINUS, KEY_EQUALS, KEY_BACKSPACE, KEY_TAB,
|
||||
/* 0x10 */ KEY_CIRCUMFLEX, KEY_AT, KEY_COLON2, KEY_R,
|
||||
/* 0x14 */ KEY_KANJI, KEY_Y, KEY_U, KEY_I,
|
||||
/* 0x18 */ KEY_O, KEY_P, KEY_OPENBRACE, KEY_CLOSEBRACE,
|
||||
/* 0x1C */ KEY_ENTER_PAD, KEY_RCONTROL, KEY_A, KEY_S,
|
||||
/* 0x20 */ KEY_D, KEY_F, KEY_G, KEY_H,
|
||||
/* 0x24 */ KEY_J, KEY_K, KEY_L, KEY_COLON,
|
||||
/* 0x28 */ KEY_QUOTE, KEY_TILDE, 0, KEY_BACKSLASH,
|
||||
/* 0x2C */ KEY_Z, KEY_X, KEY_C, KEY_V,
|
||||
/* 0x30 */ KEY_B, KEY_N, KEY_M, KEY_COMMA,
|
||||
/* 0x34 */ KEY_STOP, KEY_SLASH_PAD, 0, KEY_PRTSCR,
|
||||
/* 0x38 */ KEY_ALTGR, KEY_SPACE, KEY_CAPSLOCK, KEY_F1,
|
||||
/* 0x3C */ KEY_F2, KEY_F3, KEY_F4, KEY_F5,
|
||||
/* 0x40 */ KEY_F6, KEY_F7, KEY_F8, KEY_F9,
|
||||
/* 0x44 */ KEY_F10, KEY_NUMLOCK, KEY_PAUSE, KEY_HOME,
|
||||
/* 0x48 */ KEY_UP, KEY_PGUP, KEY_MINUS_PAD, KEY_LEFT,
|
||||
/* 0x4C */ KEY_5_PAD, KEY_RIGHT, KEY_PLUS_PAD, KEY_END,
|
||||
/* 0x50 */ KEY_DOWN, KEY_PGDN, KEY_INSERT, KEY_DEL,
|
||||
/* 0x54 */ KEY_PRTSCR, 0, KEY_BACKSLASH2, KEY_F11,
|
||||
/* 0x58 */ KEY_F12, 0, 0, KEY_LWIN,
|
||||
/* 0x5C */ KEY_RWIN, KEY_MENU, 0, 0,
|
||||
/* 0x60 */ 0, 0, 0, 0,
|
||||
/* 0x64 */ 0, 0, 0, 0,
|
||||
/* 0x68 */ 0, 0, 0, 0,
|
||||
/* 0x6C */ 0, 0, 0, 0,
|
||||
/* 0x70 */ 0, 0, 0, 0,
|
||||
/* 0x74 */ 0, 0, 0, 0,
|
||||
/* 0x78 */ 0, 0, 0, 0,
|
||||
/* 0x7C */ 0, 0, 0, 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* default mapping table for the US keyboard layout */
|
||||
static unsigned short standard_key_ascii_table[KEY_MAX] =
|
||||
{
|
||||
/* start */ 0,
|
||||
/* alphabet */ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
|
||||
/* numbers */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
/* numpad */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
/* func keys */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
/* misc chars */ 27, '`', '-', '=', 8, 9, '[', ']', 13, ';', '\'', '\\', '\\', ',', '.', '/', ' ',
|
||||
/* controls */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
/* numpad */ '/', '*', '-', '+', '.', 13,
|
||||
/* modifiers */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* capslock mapping table for the US keyboard layout */
|
||||
static unsigned short standard_key_capslock_table[KEY_MAX] =
|
||||
{
|
||||
/* start */ 0,
|
||||
/* alphabet */ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||
/* numbers */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
/* numpad */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
/* func keys */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
/* misc chars */ 27, '`', '-', '=', 8, 9, '[', ']', 13, ';', '\'', '\\', '\\', ',', '.', '/', ' ',
|
||||
/* controls */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
/* numpad */ '/', '*', '-', '+', '.', 13,
|
||||
/* modifiers */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* shifted mapping table for the US keyboard layout */
|
||||
static unsigned short standard_key_shift_table[KEY_MAX] =
|
||||
{
|
||||
/* start */ 0,
|
||||
/* alphabet */ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||
/* numbers */ ')', '!', '@', '#', '$', '%', '^', '&', '*', '(',
|
||||
/* numpad */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
/* func keys */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
/* misc chars */ 27, '~', '_', '+', 8, 9, '{', '}', 13, ':', '"', '|', '|', '<', '>', '?', ' ',
|
||||
/* controls */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
/* numpad */ '/', '*', '-', '+', '.', 13,
|
||||
/* modifiers */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* ctrl+key mapping table for the US keyboard layout */
|
||||
static unsigned short standard_key_control_table[KEY_MAX] =
|
||||
{
|
||||
/* start */ 0,
|
||||
/* alphabet */ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
|
||||
/* numbers */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
/* numpad */ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
/* func keys */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
/* misc chars */ 27, 2, 2, 2, 127, 127, 2, 2, 10, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
/* controls */ 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
|
||||
/* numpad */ 2, 2, 2, 2, 2, 10,
|
||||
/* modifiers */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* convert numeric pad scancodes into arrow codes */
|
||||
static unsigned char numlock_table[10] =
|
||||
{
|
||||
KEY_INSERT, KEY_END, KEY_DOWN, KEY_PGDN, KEY_LEFT,
|
||||
KEY_5_PAD, KEY_RIGHT, KEY_HOME, KEY_UP, KEY_PGUP
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* kb_wait_for_write_ready:
|
||||
* Wait for the keyboard controller to set the ready-for-write bit.
|
||||
*/
|
||||
static __inline int kb_wait_for_write_ready (void)
|
||||
{
|
||||
int timeout = 4096;
|
||||
|
||||
while ((timeout>0) && (inportb(0x64)&2)) timeout--;
|
||||
|
||||
return (timeout>0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* kb_wait_for_read_ready:
|
||||
* Wait for the keyboard controller to set the ready-for-read bit.
|
||||
*/
|
||||
static __inline int kb_wait_for_read_ready (void)
|
||||
{
|
||||
int timeout = 16384;
|
||||
|
||||
while ((timeout>0) && (!(inportb(0x64)&1))) timeout--;
|
||||
|
||||
return (timeout>0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* kb_send_data:
|
||||
* Sends a byte to the keyboard controller. Returns 1 if all OK.
|
||||
*/
|
||||
static __inline int kb_send_data (unsigned char data)
|
||||
{
|
||||
int resends = 4;
|
||||
int timeout, temp;
|
||||
|
||||
do {
|
||||
if (!kb_wait_for_write_ready())
|
||||
return 0;
|
||||
|
||||
outportb(0x60, data);
|
||||
timeout = 4096;
|
||||
|
||||
while (--timeout>0) {
|
||||
if (!kb_wait_for_read_ready())
|
||||
return 0;
|
||||
|
||||
temp = inportb(0x60);
|
||||
|
||||
if (temp == 0xFA)
|
||||
return 1;
|
||||
|
||||
if (temp == 0xFE)
|
||||
break;
|
||||
}
|
||||
} while ((resends-- > 0) && (timeout > 0));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void update_leds (int leds)
|
||||
{
|
||||
if (leds_ok) {
|
||||
if (!in_a_terrupt)
|
||||
DISABLE();
|
||||
|
||||
if (!kb_send_data(0xED)) {
|
||||
kb_send_data(0xF4);
|
||||
leds_ok = FALSE;
|
||||
} else if (!kb_send_data((leds>>8)&7)) {
|
||||
kb_send_data(0xF4);
|
||||
leds_ok = FALSE;
|
||||
}
|
||||
|
||||
if (!in_a_terrupt)
|
||||
ENABLE();
|
||||
}
|
||||
} ENDOFUNC(update_leds)
|
||||
|
||||
|
||||
|
||||
static void inject_key (int scancode)
|
||||
{
|
||||
unsigned short *table;
|
||||
|
||||
if ((scancode >= KEY_0_PAD) && (scancode <= KEY_9_PAD)) {
|
||||
if (((key_shifts & KB_NUMLOCK_FLAG) != 0) == ((key_shifts & KB_SHIFT_FLAG) != 0)) {
|
||||
scancode = numlock_table[scancode - KEY_0_PAD];
|
||||
}
|
||||
table = standard_key_ascii_table;
|
||||
} else if (key_shifts & KB_CTRL_FLAG) {
|
||||
table = standard_key_control_table;
|
||||
} else if (key_shifts & KB_SHIFT_FLAG) {
|
||||
if (key_shifts & KB_CAPSLOCK_FLAG) {
|
||||
if (standard_key_ascii_table[scancode]==standard_key_capslock_table[scancode]) {
|
||||
table = standard_key_shift_table;
|
||||
} else {
|
||||
table = standard_key_ascii_table;
|
||||
}
|
||||
} else {
|
||||
table = standard_key_shift_table;
|
||||
}
|
||||
} else if (key_shifts & KB_CAPSLOCK_FLAG) {
|
||||
table = standard_key_capslock_table;
|
||||
} else {
|
||||
table = standard_key_ascii_table;
|
||||
}
|
||||
|
||||
key_buffer.key[key_buffer.end++] = (scancode<<16)|table[scancode];
|
||||
|
||||
if (key_buffer.end>=KEY_BUFFER_SIZE)
|
||||
key_buffer.end = 0;
|
||||
if (key_buffer.end==key_buffer.start) {
|
||||
key_buffer.start++;
|
||||
if (key_buffer.start>=KEY_BUFFER_SIZE)
|
||||
key_buffer.start = 0;
|
||||
}
|
||||
} ENDOFUNC(inject_key)
|
||||
|
||||
static void handle_code (int scancode, int keycode)
|
||||
{
|
||||
in_a_terrupt++;
|
||||
|
||||
if (keycode==0) { /* pause */
|
||||
inject_key(scancode);
|
||||
pc_key[KEY_PAUSE] ^= TRUE;
|
||||
} else if (scancode) {
|
||||
int flag;
|
||||
|
||||
if (scancode>=KEY_MODIFIERS) {
|
||||
flag = modifier_table[scancode - KEY_MODIFIERS];
|
||||
} else {
|
||||
flag = 0;
|
||||
}
|
||||
if ((char)keycode<0) { /* release */
|
||||
pc_key[scancode] = FALSE;
|
||||
if (flag&KB_MODIFIERS) {
|
||||
key_shifts &= ~flag;
|
||||
}
|
||||
} else { /* keypress */
|
||||
pc_key[scancode] = TRUE;
|
||||
if (flag&KB_MODIFIERS) {
|
||||
key_shifts |= flag;
|
||||
}
|
||||
if (flag&KB_LED_FLAGS) {
|
||||
key_shifts ^= flag;
|
||||
update_leds(key_shifts);
|
||||
}
|
||||
if (scancode<KEY_MODIFIERS) {
|
||||
inject_key(scancode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in_a_terrupt--;
|
||||
} ENDOFUNC(handle_code)
|
||||
|
||||
static __inline void satisfy (void)
|
||||
{
|
||||
__asm("\n\
|
||||
inb $0x61, %%al \n\
|
||||
movb %%al, %%ah \n\
|
||||
orb $0x80, %%al \n\
|
||||
outb %%al, $0x61 \n\
|
||||
xchgb %%al, %%ah \n\
|
||||
outb %%al, $0x61 \n\
|
||||
movb $0x20, %%al \n\
|
||||
outb %%al, $0x20 \n\
|
||||
":::"%eax");
|
||||
}
|
||||
|
||||
static int keyboard ()
|
||||
{
|
||||
unsigned char temp, scancode;
|
||||
|
||||
temp = inportb(0x60);
|
||||
|
||||
if (temp<=0xe1) {
|
||||
if (key_pause_loop) {
|
||||
if (!--key_pause_loop) handle_code(KEY_PAUSE, 0);
|
||||
} else
|
||||
switch (temp) {
|
||||
case 0xe0:
|
||||
key_enhanced = TRUE;
|
||||
break;
|
||||
case 0xe1:
|
||||
key_pause_loop = 5;
|
||||
break;
|
||||
default:
|
||||
if (key_enhanced) {
|
||||
key_enhanced = FALSE;
|
||||
scancode = hw_to_mycode_ex[temp&0x7f];
|
||||
} else {
|
||||
scancode = hw_to_mycode[temp&0x7f];
|
||||
}
|
||||
handle_code(scancode, temp);
|
||||
}
|
||||
}
|
||||
|
||||
if (((temp==0x4F)||(temp==0x53))&&(key_shifts&KB_CTRL_FLAG)&&(key_shifts&KB_ALT_FLAG)) {
|
||||
/* Hack alert:
|
||||
only SIGINT (but not Ctrl-Break)
|
||||
calls the destructors and will safely clean up
|
||||
*/
|
||||
__asm("\n\
|
||||
movb $0x79, %%al \n\
|
||||
call ___djgpp_hw_exception \n\
|
||||
":::"%eax", "%ebx", "%ecx", "%edx", "%esi", "%edi", "memory");
|
||||
}
|
||||
|
||||
satisfy();
|
||||
return 0;
|
||||
} ENDOFUNC(keyboard)
|
||||
|
||||
|
||||
int pc_keypressed (void)
|
||||
{
|
||||
return (key_buffer.start!=key_buffer.end);
|
||||
}
|
||||
|
||||
int pc_readkey (void)
|
||||
{
|
||||
if (keyboard_installed) {
|
||||
int key;
|
||||
|
||||
do {
|
||||
} while (key_buffer.start==key_buffer.end);
|
||||
|
||||
DISABLE();
|
||||
key = key_buffer.key[key_buffer.start++];
|
||||
if (key_buffer.start>=KEY_BUFFER_SIZE)
|
||||
key_buffer.start = 0;
|
||||
ENABLE();
|
||||
|
||||
return key;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int pc_keydown (int code)
|
||||
{
|
||||
return pc_key[code];
|
||||
}
|
||||
|
||||
void pc_remove_keyb (void)
|
||||
{
|
||||
if (keyboard_installed) {
|
||||
int s1, s2, s3;
|
||||
|
||||
keyboard_installed = FALSE;
|
||||
pc_clexit(pc_remove_keyb);
|
||||
|
||||
DISABLE();
|
||||
_farsetsel(__djgpp_dos_sel);
|
||||
_farnspokew(0x41c, _farnspeekw(0x41a));
|
||||
|
||||
s1 = _farnspeekb(0x417) & 0x80;
|
||||
s2 = _farnspeekb(0x418) & 0xFC;
|
||||
s3 = _farnspeekb(0x496) & 0xF3;
|
||||
|
||||
if (pc_key[KEY_RSHIFT]) { s1 |= 1; }
|
||||
if (pc_key[KEY_LSHIFT]) { s1 |= 2; }
|
||||
if (pc_key[KEY_LCONTROL]) { s2 |= 1; s1 |= 4; }
|
||||
if (pc_key[KEY_ALT]) { s1 |= 8; s2 |= 2; }
|
||||
if (pc_key[KEY_RCONTROL]) { s1 |= 4; s3 |= 4; }
|
||||
if (pc_key[KEY_ALTGR]) { s1 |= 8; s3 |= 8; }
|
||||
|
||||
if (key_shifts&KB_SCROLOCK_FLAG) s1 |= 16;
|
||||
if (key_shifts&KB_NUMLOCK_FLAG) s1 |= 32;
|
||||
if (key_shifts&KB_CAPSLOCK_FLAG) s1 |= 64;
|
||||
|
||||
_farnspokeb(0x417, s1);
|
||||
_farnspokeb(0x418, s2);
|
||||
_farnspokeb(0x496, s3);
|
||||
update_leds(key_shifts);
|
||||
|
||||
ENABLE();
|
||||
pc_remove_irq(KEYB_IRQ);
|
||||
}
|
||||
}
|
||||
|
||||
int pc_install_keyb (void)
|
||||
{
|
||||
if (keyboard_installed||pc_install_irq(KEYB_IRQ, keyboard)) {
|
||||
return -1;
|
||||
} else {
|
||||
int s1, s2, s3;
|
||||
|
||||
LOCKDATA(key_buffer);
|
||||
LOCKDATA(key_enhanced);
|
||||
LOCKDATA(key_pause_loop);
|
||||
LOCKDATA(key_shifts);
|
||||
LOCKDATA(leds_ok);
|
||||
LOCKDATA(in_a_terrupt);
|
||||
LOCKDATA(pc_key);
|
||||
LOCKDATA(modifier_table);
|
||||
LOCKDATA(hw_to_mycode);
|
||||
LOCKDATA(hw_to_mycode_ex);
|
||||
LOCKDATA(standard_key_ascii_table);
|
||||
LOCKDATA(standard_key_capslock_table);
|
||||
LOCKDATA(standard_key_shift_table);
|
||||
LOCKDATA(standard_key_control_table);
|
||||
LOCKDATA(numlock_table);
|
||||
LOCKFUNC(update_leds);
|
||||
LOCKFUNC(inject_key);
|
||||
LOCKFUNC(handle_code);
|
||||
LOCKFUNC(keyboard);
|
||||
|
||||
DISABLE();
|
||||
_farsetsel(__djgpp_dos_sel);
|
||||
_farnspokew(0x41c, _farnspeekw(0x41a));
|
||||
|
||||
key_shifts = 0;
|
||||
s1 = _farnspeekb(0x417);
|
||||
s2 = _farnspeekb(0x418);
|
||||
s3 = _farnspeekb(0x496);
|
||||
|
||||
if (s1&1) { key_shifts |= KB_SHIFT_FLAG; pc_key[KEY_RSHIFT] = TRUE; }
|
||||
if (s1&2) { key_shifts |= KB_SHIFT_FLAG; pc_key[KEY_LSHIFT] = TRUE; }
|
||||
if (s2&1) { key_shifts |= KB_CTRL_FLAG; pc_key[KEY_LCONTROL] = TRUE; }
|
||||
if (s2&2) { key_shifts |= KB_ALT_FLAG; pc_key[KEY_ALT] = TRUE; }
|
||||
if (s3&4) { key_shifts |= KB_CTRL_FLAG; pc_key[KEY_RCONTROL] = TRUE; }
|
||||
if (s3&8) { key_shifts |= KB_ALT_FLAG; pc_key[KEY_ALTGR] = TRUE; }
|
||||
|
||||
if (s1&16) key_shifts |= KB_SCROLOCK_FLAG;
|
||||
if (s1&32) key_shifts |= KB_NUMLOCK_FLAG;
|
||||
if (s1&64) key_shifts |= KB_CAPSLOCK_FLAG;
|
||||
update_leds(key_shifts);
|
||||
|
||||
key_enhanced = key_pause_loop = 0;
|
||||
key_buffer.start = key_buffer.end = 0;
|
||||
ENABLE();
|
||||
|
||||
pc_atexit(pc_remove_keyb);
|
||||
keyboard_installed = TRUE;
|
||||
return 0;
|
||||
}
|
||||
}
|
258
src/glut/dos/PC_HW/pc_mouse.c
Normal file
258
src/glut/dos/PC_HW/pc_mouse.c
Normal file
@@ -0,0 +1,258 @@
|
||||
/*
|
||||
* PC/HW routine collection v1.1 for DOS/DJGPP
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#include <dpmi.h>
|
||||
|
||||
#include "pc_hw.h"
|
||||
|
||||
|
||||
|
||||
#define MOUSE_STACK_SIZE 16384
|
||||
|
||||
#define CLEAR_MICKEYS() \
|
||||
do { \
|
||||
__asm __volatile ("movw $0xb, %%ax; int $0x33":::"%eax", "%ecx", "%edx"); \
|
||||
ox = oy = 0; \
|
||||
} while (0)
|
||||
|
||||
extern void mouse_wrapper (void);
|
||||
extern void mouse_wrapper_end (void);
|
||||
|
||||
static MFUNC mouse_func;
|
||||
static void *mouse_stack;
|
||||
static long mouse_callback;
|
||||
static __dpmi_regs mouse_regs;
|
||||
|
||||
static volatile int pc_mouse_x, pc_mouse_y, pc_mouse_b;
|
||||
|
||||
static int minx = 0;
|
||||
static int maxx = 319;
|
||||
static int miny = 0;
|
||||
static int maxy = 199;
|
||||
|
||||
static int sx = 2;
|
||||
static int sy = 2;
|
||||
|
||||
static int emulat3 = FALSE;
|
||||
|
||||
static int ox, oy;
|
||||
|
||||
static void mouse (__dpmi_regs *r)
|
||||
{
|
||||
int nx = (signed short)r->x.si / sx;
|
||||
int ny = (signed short)r->x.di / sy;
|
||||
int dx = nx - ox;
|
||||
int dy = ny - oy;
|
||||
ox = nx;
|
||||
oy = ny;
|
||||
|
||||
pc_mouse_b = r->x.bx;
|
||||
pc_mouse_x = MID(minx, pc_mouse_x + dx, maxx);
|
||||
pc_mouse_y = MID(miny, pc_mouse_y + dy, maxy);
|
||||
|
||||
if (emulat3) {
|
||||
if ((pc_mouse_b&3)==3) {
|
||||
pc_mouse_b = 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (mouse_func) {
|
||||
mouse_func(pc_mouse_x, pc_mouse_y, pc_mouse_b);
|
||||
}
|
||||
} ENDOFUNC(mouse)
|
||||
|
||||
void pc_remove_mouse (void)
|
||||
{
|
||||
if (mouse_callback) {
|
||||
pc_clexit(pc_remove_mouse);
|
||||
__asm("\n\
|
||||
movl %%edx, %%ecx \n\
|
||||
shrl $16, %%ecx \n\
|
||||
movw $0x0304, %%ax \n\
|
||||
int $0x31 \n\
|
||||
movw $0x000c, %%ax \n\
|
||||
xorl %%ecx, %%ecx \n\
|
||||
int $0x33 \n\
|
||||
"::"d"(mouse_callback):"%eax", "%ecx");
|
||||
|
||||
mouse_callback = 0;
|
||||
|
||||
free((void *)((unsigned long)mouse_stack-MOUSE_STACK_SIZE));
|
||||
}
|
||||
}
|
||||
|
||||
int pc_install_mouse (void)
|
||||
{
|
||||
int buttons;
|
||||
|
||||
/* fail if already call-backed */
|
||||
if (mouse_callback) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* reset mouse and get status */
|
||||
__asm("\n\
|
||||
xorl %%eax, %%eax \n\
|
||||
int $0x33 \n\
|
||||
andl %%ebx, %%eax \n\
|
||||
movl %%eax, %0 \n\
|
||||
":"=g" (buttons)::"%eax", "%ebx");
|
||||
if (!buttons) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* lock wrapper */
|
||||
LOCKDATA(mouse_func);
|
||||
LOCKDATA(mouse_stack);
|
||||
LOCKDATA(mouse_callback);
|
||||
LOCKDATA(mouse_regs);
|
||||
LOCKDATA(pc_mouse_x);
|
||||
LOCKDATA(pc_mouse_y);
|
||||
LOCKDATA(pc_mouse_b);
|
||||
LOCKDATA(minx);
|
||||
LOCKDATA(maxx);
|
||||
LOCKDATA(miny);
|
||||
LOCKDATA(maxy);
|
||||
LOCKDATA(sx);
|
||||
LOCKDATA(sy);
|
||||
LOCKDATA(emulat3);
|
||||
LOCKDATA(ox);
|
||||
LOCKDATA(oy);
|
||||
LOCKFUNC(mouse);
|
||||
LOCKFUNC(mouse_wrapper);
|
||||
|
||||
/* grab a locked stack */
|
||||
if ((mouse_stack=pc_malloc(MOUSE_STACK_SIZE))==NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* try to hook a call-back */
|
||||
__asm("\n\
|
||||
pushl %%ds \n\
|
||||
pushl %%es \n\
|
||||
movw $0x0303, %%ax \n\
|
||||
pushl %%ds \n\
|
||||
pushl %%cs \n\
|
||||
popl %%ds \n\
|
||||
popl %%es \n\
|
||||
int $0x31 \n\
|
||||
popl %%es \n\
|
||||
popl %%ds \n\
|
||||
jc 0f \n\
|
||||
shll $16, %%ecx \n\
|
||||
movw %%dx, %%cx \n\
|
||||
movl %%ecx, %0 \n\
|
||||
0: \n\
|
||||
":"=g"(mouse_callback)
|
||||
:"S" (mouse_wrapper), "D"(&mouse_regs)
|
||||
:"%eax", "%ecx", "%edx");
|
||||
if (!mouse_callback) {
|
||||
free(mouse_stack);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* adjust stack */
|
||||
mouse_stack = (void *)((unsigned long)mouse_stack + MOUSE_STACK_SIZE);
|
||||
|
||||
/* install the handler */
|
||||
mouse_regs.x.ax = 0x000c;
|
||||
mouse_regs.x.cx = 0x007f;
|
||||
mouse_regs.x.dx = mouse_callback&0xffff;
|
||||
mouse_regs.x.es = mouse_callback>>16;
|
||||
__dpmi_int(0x33, &mouse_regs);
|
||||
|
||||
CLEAR_MICKEYS();
|
||||
|
||||
emulat3 = buttons<3;
|
||||
pc_atexit(pc_remove_mouse);
|
||||
return buttons;
|
||||
}
|
||||
|
||||
MFUNC pc_install_mouse_handler (MFUNC handler)
|
||||
{
|
||||
MFUNC old;
|
||||
|
||||
if (!mouse_callback && !pc_install_mouse()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
old = mouse_func;
|
||||
mouse_func = handler;
|
||||
return old;
|
||||
}
|
||||
|
||||
void pc_mouse_area (int x1, int y1, int x2, int y2)
|
||||
{
|
||||
minx = x1;
|
||||
maxx = x2;
|
||||
miny = y1;
|
||||
maxy = y2;
|
||||
}
|
||||
|
||||
void pc_mouse_speed (int xspeed, int yspeed)
|
||||
{
|
||||
DISABLE();
|
||||
|
||||
sx = MAX(1, xspeed);
|
||||
sy = MAX(1, yspeed);
|
||||
|
||||
ENABLE();
|
||||
}
|
||||
|
||||
int pc_query_mouse (int *x, int *y)
|
||||
{
|
||||
*x = pc_mouse_x;
|
||||
*y = pc_mouse_y;
|
||||
return pc_mouse_b;
|
||||
}
|
||||
|
||||
void pc_show_mouse (void)
|
||||
{
|
||||
/* not implemented */
|
||||
}
|
||||
void pc_scare_mouse (void)
|
||||
{
|
||||
/* not implemented */
|
||||
}
|
||||
void pc_unscare_mouse (void)
|
||||
{
|
||||
/* not implemented */
|
||||
}
|
||||
|
||||
__asm("\n\
|
||||
.balign 4 \n\
|
||||
.global _mouse_wrapper \n\
|
||||
_mouse_wrapper: \n\
|
||||
cld \n\
|
||||
lodsl \n\
|
||||
movl %eax, %es:42(%edi) \n\
|
||||
addw $4, %es:46(%edi) \n\
|
||||
pushl %es \n\
|
||||
movl %ss, %ebx \n\
|
||||
movl %esp, %esi \n\
|
||||
movl %cs:___djgpp_ds_alias, %ss \n\
|
||||
movl %cs:_mouse_stack, %esp \n\
|
||||
pushl %ss \n\
|
||||
pushl %ss \n\
|
||||
popl %es \n\
|
||||
popl %ds \n\
|
||||
movl ___djgpp_dos_sel, %fs \n\
|
||||
pushl %fs \n\
|
||||
popl %gs \n\
|
||||
pushl %edi \n\
|
||||
call _mouse \n\
|
||||
popl %edi \n\
|
||||
movl %ebx, %ss \n\
|
||||
movl %esi, %esp \n\
|
||||
popl %es \n\
|
||||
iret \n\
|
||||
\n\
|
||||
.balign 4 \n\
|
||||
.global _mouse_wrapper_end \n\
|
||||
_mouse_wrapper_end:");
|
158
src/glut/dos/PC_HW/pc_timer.c
Normal file
158
src/glut/dos/PC_HW/pc_timer.c
Normal file
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* PC/HW routine collection v1.0 for DOS/DJGPP
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#include <pc.h>
|
||||
|
||||
#include "pc_hw.h"
|
||||
|
||||
#define TIMER_IRQ 0
|
||||
|
||||
#define MAX_TIMERS 8
|
||||
|
||||
#define PIT_FREQ 0x1234DD
|
||||
|
||||
#define unvolatile(__v, __t) __extension__ ({union { volatile __t __cp; __t __p; } __q; __q.__cp = __v; __q.__p;})
|
||||
|
||||
static int timer_installed;
|
||||
|
||||
typedef struct {
|
||||
volatile unsigned int counter, clock_ticks, freq;
|
||||
volatile PFUNC func;
|
||||
volatile void *parm;
|
||||
} TIMER;
|
||||
|
||||
TIMER timer_main, timer_func[MAX_TIMERS];
|
||||
|
||||
static int timer ()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<MAX_TIMERS;i++) {
|
||||
TIMER *t = &timer_func[i];
|
||||
if (t->func) {
|
||||
t->clock_ticks += t->counter;
|
||||
if (t->clock_ticks>=timer_main.counter) {
|
||||
t->clock_ticks -= timer_main.counter;
|
||||
t->func(unvolatile(t->parm, void *));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
timer_main.clock_ticks += timer_main.counter;
|
||||
if (timer_main.clock_ticks>=0x10000) {
|
||||
timer_main.clock_ticks -= 0x10000;
|
||||
return 1;
|
||||
} else {
|
||||
outportb(0x20, 0x20);
|
||||
return 0;
|
||||
}
|
||||
} ENDOFUNC(timer)
|
||||
|
||||
void pc_remove_timer (void)
|
||||
{
|
||||
if (timer_installed) {
|
||||
timer_installed = FALSE;
|
||||
pc_clexit(pc_remove_timer);
|
||||
|
||||
DISABLE();
|
||||
outportb(0x43, 0x34);
|
||||
outportb(0x40, 0);
|
||||
outportb(0x40, 0);
|
||||
ENABLE();
|
||||
|
||||
pc_remove_irq(TIMER_IRQ);
|
||||
}
|
||||
}
|
||||
|
||||
static int install_timer (void)
|
||||
{
|
||||
if (timer_installed||pc_install_irq(TIMER_IRQ, timer)) {
|
||||
return -1;
|
||||
} else {
|
||||
LOCKDATA(timer_func);
|
||||
LOCKDATA(timer_main);
|
||||
LOCKFUNC(timer);
|
||||
|
||||
timer_main.counter = 0x10000;
|
||||
|
||||
DISABLE();
|
||||
outportb(0x43, 0x34);
|
||||
outportb(0x40, 0);
|
||||
outportb(0x40, 0);
|
||||
timer_main.clock_ticks = 0;
|
||||
ENABLE();
|
||||
|
||||
pc_atexit(pc_remove_timer);
|
||||
timer_installed = TRUE;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static TIMER *find_slot (PFUNC func)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<MAX_TIMERS;i++) {
|
||||
if (timer_func[i].func==func) {
|
||||
return &timer_func[i];
|
||||
}
|
||||
}
|
||||
for (i=0;i<MAX_TIMERS;i++) {
|
||||
if (!timer_func[i].func) {
|
||||
return &timer_func[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int pc_install_int (PFUNC func, void *parm, unsigned int freq)
|
||||
{
|
||||
int i;
|
||||
TIMER *t;
|
||||
|
||||
if (!timer_installed) {
|
||||
if (install_timer()) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((t=find_slot(func))!=NULL) {
|
||||
unsigned int new_counter = PIT_FREQ / freq;
|
||||
|
||||
DISABLE();
|
||||
|
||||
t->func = func;
|
||||
t->parm = parm;
|
||||
t->freq = freq;
|
||||
t->clock_ticks = 0;
|
||||
|
||||
if (new_counter < timer_main.counter) {
|
||||
for (i=0;i<MAX_TIMERS;i++) {
|
||||
if (timer_func[i].func) {
|
||||
timer_func[i].counter = new_counter * timer_func[i].freq / freq;
|
||||
}
|
||||
}
|
||||
outportb(0x43, 0x34);
|
||||
outportb(0x40, (unsigned char)new_counter);
|
||||
outportb(0x40, (unsigned char)(new_counter>>8));
|
||||
timer_main.clock_ticks = 0;
|
||||
timer_main.counter = new_counter;
|
||||
timer_main.freq = freq;
|
||||
} else {
|
||||
t->counter = PIT_FREQ * freq / (timer_main.freq * timer_main.freq);
|
||||
}
|
||||
|
||||
ENABLE();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
56
src/glut/dos/bitmap.c
Normal file
56
src/glut/dos/bitmap.c
Normal file
@@ -0,0 +1,56 @@
|
||||
|
||||
/* Copyright (c) Mark J. Kilgard, 1994. */
|
||||
|
||||
/* This program is freely distributable without licensing fees
|
||||
and is provided without guarantee or warrantee expressed or
|
||||
implied. This program is -not- in the public domain. */
|
||||
|
||||
#include "glutbitmap.h"
|
||||
|
||||
void APIENTRY
|
||||
glutBitmapCharacter(GLUTbitmapFont font, int c)
|
||||
{
|
||||
const BitmapCharRec *ch;
|
||||
BitmapFontPtr fontinfo;
|
||||
GLint swapbytes, lsbfirst, rowlength;
|
||||
GLint skiprows, skippixels, alignment;
|
||||
|
||||
#if defined(_WIN32)
|
||||
fontinfo = (BitmapFontPtr) __glutFont(font);
|
||||
#else
|
||||
fontinfo = (BitmapFontPtr) font;
|
||||
#endif
|
||||
|
||||
if (c < fontinfo->first ||
|
||||
c >= fontinfo->first + fontinfo->num_chars)
|
||||
return;
|
||||
ch = fontinfo->ch[c - fontinfo->first];
|
||||
if (ch) {
|
||||
/* Save current modes. */
|
||||
glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes);
|
||||
glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst);
|
||||
glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength);
|
||||
glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows);
|
||||
glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels);
|
||||
glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
|
||||
/* Little endian machines (DEC Alpha for example) could
|
||||
benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE
|
||||
instead of GL_FALSE, but this would require changing the
|
||||
generated bitmaps too. */
|
||||
glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
|
||||
glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glBitmap(ch->width, ch->height, ch->xorig, ch->yorig,
|
||||
ch->advance, 0, ch->bitmap);
|
||||
/* Restore saved modes. */
|
||||
glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes);
|
||||
glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
|
||||
}
|
||||
}
|
152
src/glut/dos/callback.c
Normal file
152
src/glut/dos/callback.c
Normal file
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#include "GL/glut.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
void APIENTRY glutDisplayFunc (void (GLUTCALLBACK *func) (void))
|
||||
{
|
||||
display_func = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutReshapeFunc (void (GLUTCALLBACK *func) (int width, int height))
|
||||
{
|
||||
reshape_func = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutKeyboardFunc (void (GLUTCALLBACK *func) (unsigned char key, int x, int y))
|
||||
{
|
||||
keyboard_func = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutMouseFunc (void (GLUTCALLBACK *func) (int button, int state, int x, int y))
|
||||
{
|
||||
mouse_func = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutMotionFunc (void (GLUTCALLBACK *func) (int x, int y))
|
||||
{
|
||||
motion_func = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutPassiveMotionFunc (void (GLUTCALLBACK *func) (int x, int y))
|
||||
{
|
||||
passive_motion_func = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutEntryFunc (void (GLUTCALLBACK *func) (int state))
|
||||
{
|
||||
entry_func = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutVisibilityFunc (void (GLUTCALLBACK *func) (int state))
|
||||
{
|
||||
visibility_func = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutIdleFunc (void (GLUTCALLBACK *func) (void))
|
||||
{
|
||||
idle_func = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutTimerFunc (unsigned int millis, void (GLUTCALLBACK *func) (int value), int value)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutMenuStateFunc (void (GLUTCALLBACK *func) (int state))
|
||||
{
|
||||
menu_state_func = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutSpecialFunc (void (GLUTCALLBACK *func) (int key, int x, int y))
|
||||
{
|
||||
special_func = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutSpaceballMotionFunc (void (GLUTCALLBACK *func) (int x, int y, int z))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutSpaceballRotateFunc (void (GLUTCALLBACK *func) (int x, int y, int z))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutSpaceballButtonFunc (void (GLUTCALLBACK *func) (int button, int state))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutButtonBoxFunc (void (GLUTCALLBACK *func) (int button, int state))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutDialsFunc (void (GLUTCALLBACK *func) (int dial, int value))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutTabletMotionFunc (void (GLUTCALLBACK *func) (int x, int y))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutTabletButtonFunc (void (GLUTCALLBACK *func) (int button, int state, int x, int y))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutMenuStatusFunc (void (GLUTCALLBACK *func) (int status, int x, int y))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutOverlayDisplayFunc (void (GLUTCALLBACK *func) (void))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutWindowStatusFunc (void (GLUTCALLBACK *func) (int state))
|
||||
{
|
||||
}
|
46
src/glut/dos/color.c
Normal file
46
src/glut/dos/color.c
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#include "GL/glut.h"
|
||||
|
||||
|
||||
void APIENTRY glutSetColor (int ndx, GLfloat red, GLfloat green, GLfloat blue)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
GLfloat APIENTRY glutGetColor (int ndx, int component)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutCopyColormap (int win)
|
||||
{
|
||||
}
|
61
src/glut/dos/globals.c
Normal file
61
src/glut/dos/globals.c
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#include "GL/glut.h"
|
||||
#include "internal.h"
|
||||
|
||||
GLenum g_display_mode = 0;
|
||||
GLuint g_width = DEFAULT_WIDTH;
|
||||
GLuint g_height = DEFAULT_HEIGHT;
|
||||
GLint g_mouse = GL_FALSE;
|
||||
GLboolean g_redisplay = GL_FALSE;
|
||||
GLint g_xpos = 0;
|
||||
GLint g_ypos = 0;
|
||||
|
||||
void (GLUTCALLBACK *display_func) (void) = NULL;
|
||||
void (GLUTCALLBACK *reshape_func) (int width, int height) = NULL;
|
||||
void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y) = NULL;
|
||||
void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y) = NULL;
|
||||
void (GLUTCALLBACK *motion_func) (int x, int y) = NULL;
|
||||
void (GLUTCALLBACK *passive_motion_func) (int x, int y) = NULL;
|
||||
void (GLUTCALLBACK *entry_func) (int state) = NULL;
|
||||
void (GLUTCALLBACK *visibility_func) (int state) = NULL;
|
||||
void (GLUTCALLBACK *idle_func) (void) = NULL;
|
||||
void (GLUTCALLBACK *menu_state_func) (int state) = NULL;
|
||||
void (GLUTCALLBACK *special_func) (int key, int x, int y) = NULL;
|
||||
void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z) = NULL;
|
||||
void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z) = NULL;
|
||||
void (GLUTCALLBACK *spaceball_button_func) (int button, int state) = NULL;
|
||||
void (GLUTCALLBACK *button_box_func) (int button, int state) = NULL;
|
||||
void (GLUTCALLBACK *dials_func) (int dial, int value) = NULL;
|
||||
void (GLUTCALLBACK *tablet_motion_func) (int x, int y) = NULL;
|
||||
void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y) = NULL;
|
||||
void (GLUTCALLBACK *menu_status_func) (int status, int x, int y) = NULL;
|
||||
void (GLUTCALLBACK *overlay_display_func) (void) = NULL;
|
||||
void (GLUTCALLBACK *window_status_func) (int state) = NULL;
|
160
src/glut/dos/init.c
Normal file
160
src/glut/dos/init.c
Normal file
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.0
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#include "GL/glut.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
void APIENTRY glutInit (int *argcp, char **argv)
|
||||
{
|
||||
glutGet(GLUT_ELAPSED_TIME);
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutInitDisplayMode (unsigned int mode)
|
||||
{
|
||||
g_display_mode = mode;
|
||||
|
||||
pc_install_keyb();
|
||||
g_mouse = pc_install_mouse();
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutInitWindowPosition (int x, int y)
|
||||
{
|
||||
g_xpos = x;
|
||||
g_ypos = y;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutInitWindowSize (int width, int height)
|
||||
{
|
||||
g_width = width;
|
||||
g_height = height;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutMainLoop (void)
|
||||
{
|
||||
GLboolean idle;
|
||||
static int old_mouse_x = 0;
|
||||
static int old_mouse_y = 0;
|
||||
static int old_mouse_b = 0;
|
||||
|
||||
glutPostRedisplay();
|
||||
if (reshape_func) reshape_func(g_width, g_height);
|
||||
if (visibility_func) visibility_func(GLUT_VISIBLE);
|
||||
if (g_mouse) pc_show_mouse();
|
||||
|
||||
while (GL_TRUE) {
|
||||
idle = GL_TRUE;
|
||||
|
||||
if (g_redisplay && display_func) {
|
||||
idle = GL_FALSE;
|
||||
g_redisplay = GL_FALSE;
|
||||
|
||||
if (g_mouse && !(g_display_mode & GLUT_DOUBLE)) pc_scare_mouse();
|
||||
display_func();
|
||||
if (g_mouse && !(g_display_mode & GLUT_DOUBLE)) pc_unscare_mouse();
|
||||
}
|
||||
|
||||
if (pc_keypressed()) {
|
||||
int key;
|
||||
|
||||
idle = GL_FALSE;
|
||||
key = pc_readkey();
|
||||
|
||||
switch (key>>16) {
|
||||
case KEY_F1: if (special_func) special_func(GLUT_KEY_F1, 0, 0); break;
|
||||
case KEY_F2: if (special_func) special_func(GLUT_KEY_F2, 0, 0); break;
|
||||
case KEY_F3: if (special_func) special_func(GLUT_KEY_F3, 0, 0); break;
|
||||
case KEY_F4: if (special_func) special_func(GLUT_KEY_F4, 0, 0); break;
|
||||
case KEY_F5: if (special_func) special_func(GLUT_KEY_F5, 0, 0); break;
|
||||
case KEY_F6: if (special_func) special_func(GLUT_KEY_F6, 0, 0); break;
|
||||
case KEY_F7: if (special_func) special_func(GLUT_KEY_F7, 0, 0); break;
|
||||
case KEY_F8: if (special_func) special_func(GLUT_KEY_F8, 0, 0); break;
|
||||
case KEY_F9: if (special_func) special_func(GLUT_KEY_F9, 0, 0); break;
|
||||
case KEY_F10: if (special_func) special_func(GLUT_KEY_F10, 0, 0); break;
|
||||
case KEY_F11: if (special_func) special_func(GLUT_KEY_F11, 0, 0); break;
|
||||
case KEY_F12: if (special_func) special_func(GLUT_KEY_F12, 0, 0); break;
|
||||
case KEY_LEFT: if (special_func) special_func(GLUT_KEY_LEFT, 0, 0); break;
|
||||
case KEY_UP: if (special_func) special_func(GLUT_KEY_UP, 0, 0); break;
|
||||
case KEY_RIGHT: if (special_func) special_func(GLUT_KEY_RIGHT, 0, 0); break;
|
||||
case KEY_DOWN: if (special_func) special_func(GLUT_KEY_DOWN, 0, 0); break;
|
||||
case KEY_PGUP: if (special_func) special_func(GLUT_KEY_PAGE_UP, 0, 0); break;
|
||||
case KEY_PGDN: if (special_func) special_func(GLUT_KEY_PAGE_DOWN, 0, 0); break;
|
||||
case KEY_HOME: if (special_func) special_func(GLUT_KEY_HOME, 0, 0); break;
|
||||
case KEY_END: if (special_func) special_func(GLUT_KEY_END, 0, 0); break;
|
||||
case KEY_INSERT: if (special_func) special_func(GLUT_KEY_INSERT, 0, 0); break;
|
||||
default: if (keyboard_func) keyboard_func(key & 0xFF, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (g_mouse) {
|
||||
int mouse_x;
|
||||
int mouse_y;
|
||||
int mouse_b;
|
||||
|
||||
mouse_b = pc_query_mouse(&mouse_x, &mouse_y);
|
||||
|
||||
if (motion_func && ((mouse_x != old_mouse_x) || (mouse_y != old_mouse_y))) {
|
||||
idle = GL_FALSE;
|
||||
old_mouse_x = mouse_x;
|
||||
old_mouse_y = mouse_y;
|
||||
|
||||
motion_func(old_mouse_x, old_mouse_y);
|
||||
}
|
||||
|
||||
if (mouse_func && (mouse_b != old_mouse_b)) {
|
||||
int new_mouse_b = mouse_b;
|
||||
|
||||
if ((old_mouse_b & 1) && !(new_mouse_b & 1))
|
||||
mouse_func(GLUT_LEFT_BUTTON, GLUT_UP, mouse_x, mouse_y);
|
||||
else if (!(old_mouse_b & 1) && (new_mouse_b & 1))
|
||||
mouse_func(GLUT_LEFT_BUTTON, GLUT_DOWN, mouse_x, mouse_y);
|
||||
|
||||
if ((old_mouse_b & 2) && !(new_mouse_b & 2))
|
||||
mouse_func(GLUT_RIGHT_BUTTON, GLUT_UP, mouse_x, mouse_y);
|
||||
else if (!(old_mouse_b & 2) && (new_mouse_b & 2))
|
||||
mouse_func(GLUT_RIGHT_BUTTON, GLUT_DOWN, mouse_x, mouse_y);
|
||||
|
||||
if ((old_mouse_b & 4) && !(new_mouse_b & 4))
|
||||
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_UP, mouse_x, mouse_y);
|
||||
else if (!(old_mouse_b & 3) && (new_mouse_b & 4))
|
||||
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_DOWN, mouse_x, mouse_y);
|
||||
|
||||
idle = GL_FALSE;
|
||||
old_mouse_b = new_mouse_b;
|
||||
}
|
||||
}
|
||||
|
||||
if (idle && idle_func)
|
||||
idle_func();
|
||||
}
|
||||
}
|
78
src/glut/dos/internal.h
Normal file
78
src/glut/dos/internal.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.0
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERNAL_H_included
|
||||
#define INTERNAL_H_included
|
||||
|
||||
|
||||
#include "GL/glut.h"
|
||||
#include "pc_hw/pc_hw.h"
|
||||
|
||||
|
||||
#define MAX_WINDOWS 4
|
||||
|
||||
#define DEFAULT_WIDTH 640
|
||||
#define DEFAULT_HEIGHT 480
|
||||
#define DEFAULT_BPP 16
|
||||
|
||||
#define DEPTH_SIZE 16
|
||||
#define STENCIL_SIZE 8
|
||||
#define ACCUM_SIZE 16
|
||||
|
||||
extern GLenum g_display_mode;
|
||||
extern GLuint g_width;
|
||||
extern GLuint g_height;
|
||||
extern GLint g_mouse;
|
||||
extern GLboolean g_redisplay;
|
||||
extern GLint g_xpos;
|
||||
extern GLint g_ypos;
|
||||
|
||||
extern void (GLUTCALLBACK *display_func) (void);
|
||||
extern void (GLUTCALLBACK *reshape_func) (int width, int height);
|
||||
extern void (GLUTCALLBACK *keyboard_func) (unsigned char key, int x, int y);
|
||||
extern void (GLUTCALLBACK *mouse_func) (int button, int state, int x, int y);
|
||||
extern void (GLUTCALLBACK *motion_func) (int x, int y);
|
||||
extern void (GLUTCALLBACK *passive_motion_func) (int x, int y);
|
||||
extern void (GLUTCALLBACK *entry_func) (int state);
|
||||
extern void (GLUTCALLBACK *visibility_func) (int state);
|
||||
extern void (GLUTCALLBACK *idle_func) (void);
|
||||
extern void (GLUTCALLBACK *menu_state_func) (int state);
|
||||
extern void (GLUTCALLBACK *special_func) (int key, int x, int y);
|
||||
extern void (GLUTCALLBACK *spaceball_motion_func) (int x, int y, int z);
|
||||
extern void (GLUTCALLBACK *spaceball_rotate_func) (int x, int y, int z);
|
||||
extern void (GLUTCALLBACK *spaceball_button_func) (int button, int state);
|
||||
extern void (GLUTCALLBACK *button_box_func) (int button, int state);
|
||||
extern void (GLUTCALLBACK *dials_func) (int dial, int value);
|
||||
extern void (GLUTCALLBACK *tablet_motion_func) (int x, int y);
|
||||
extern void (GLUTCALLBACK *tabled_button_func) (int button, int state, int x, int y);
|
||||
extern void (GLUTCALLBACK *menu_status_func) (int status, int x, int y);
|
||||
extern void (GLUTCALLBACK *overlay_display_func) (void);
|
||||
extern void (GLUTCALLBACK *window_status_func) (int state);
|
||||
|
||||
#endif
|
86
src/glut/dos/menu.c
Normal file
86
src/glut/dos/menu.c
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#include "GL/glut.h"
|
||||
|
||||
|
||||
int APIENTRY glutCreateMenu (void (GLUTCALLBACK *func) (int))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void APIENTRY glutDestroyMenu (int menu)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY glutGetMenu (void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutSetMenu (int menu)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutAddMenuEntry (const char *label, int value)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutAddSubMenu (const char *label, int submenu)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutChangeToMenuEntry (int item, const char *label, int value)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutChangeToSubMenu (int item, const char *label, int submenu)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutRemoveMenuItem (int item)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutAttachMenu (int button)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutDetachMenu (int button)
|
||||
{
|
||||
}
|
598
src/glut/dos/models.c
Normal file
598
src/glut/dos/models.c
Normal file
@@ -0,0 +1,598 @@
|
||||
|
||||
/* Copyright (c) Mark J. Kilgard, 1994, 1997. */
|
||||
|
||||
/**
|
||||
(c) Copyright 1993, Silicon Graphics, Inc.
|
||||
|
||||
ALL RIGHTS RESERVED
|
||||
|
||||
Permission to use, copy, modify, and distribute this software
|
||||
for any purpose and without fee is hereby granted, provided
|
||||
that the above copyright notice appear in all copies and that
|
||||
both the copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Silicon
|
||||
Graphics, Inc. not be used in advertising or publicity
|
||||
pertaining to distribution of the software without specific,
|
||||
written prior permission.
|
||||
|
||||
THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU
|
||||
"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR
|
||||
OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO
|
||||
EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE
|
||||
ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR
|
||||
CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER,
|
||||
INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE,
|
||||
SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR
|
||||
NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
US Government Users Restricted Rights
|
||||
|
||||
Use, duplication, or disclosure by the Government is subject to
|
||||
restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
||||
(c)(1)(ii) of the Rights in Technical Data and Computer
|
||||
Software clause at DFARS 252.227-7013 and/or in similar or
|
||||
successor clauses in the FAR or the DOD or NASA FAR
|
||||
Supplement. Unpublished-- rights reserved under the copyright
|
||||
laws of the United States. Contractor/manufacturer is Silicon
|
||||
Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA
|
||||
94039-7311.
|
||||
|
||||
OpenGL(TM) is a trademark of Silicon Graphics, Inc.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include "GL/glut.h"
|
||||
|
||||
/* Some <math.h> files do not define M_PI... */
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
static GLUquadricObj *quadObj;
|
||||
|
||||
#define QUAD_OBJ_INIT() { if(!quadObj) initQuadObj(); }
|
||||
|
||||
static void
|
||||
initQuadObj(void)
|
||||
{
|
||||
quadObj = gluNewQuadric();
|
||||
/* if (!quadObj)
|
||||
__glutFatalError("out of memory."); */
|
||||
}
|
||||
|
||||
/* CENTRY */
|
||||
void APIENTRY
|
||||
glutWireSphere(GLdouble radius, GLint slices, GLint stacks)
|
||||
{
|
||||
QUAD_OBJ_INIT();
|
||||
gluQuadricDrawStyle(quadObj, GLU_LINE);
|
||||
gluQuadricNormals(quadObj, GLU_SMOOTH);
|
||||
/* If we ever changed/used the texture or orientation state
|
||||
of quadObj, we'd need to change it to the defaults here
|
||||
with gluQuadricTexture and/or gluQuadricOrientation. */
|
||||
gluSphere(quadObj, radius, slices, stacks);
|
||||
}
|
||||
|
||||
void APIENTRY
|
||||
glutSolidSphere(GLdouble radius, GLint slices, GLint stacks)
|
||||
{
|
||||
QUAD_OBJ_INIT();
|
||||
gluQuadricDrawStyle(quadObj, GLU_FILL);
|
||||
gluQuadricNormals(quadObj, GLU_SMOOTH);
|
||||
/* If we ever changed/used the texture or orientation state
|
||||
of quadObj, we'd need to change it to the defaults here
|
||||
with gluQuadricTexture and/or gluQuadricOrientation. */
|
||||
gluSphere(quadObj, radius, slices, stacks);
|
||||
}
|
||||
|
||||
void APIENTRY
|
||||
glutWireCone(GLdouble base, GLdouble height,
|
||||
GLint slices, GLint stacks)
|
||||
{
|
||||
QUAD_OBJ_INIT();
|
||||
gluQuadricDrawStyle(quadObj, GLU_LINE);
|
||||
gluQuadricNormals(quadObj, GLU_SMOOTH);
|
||||
/* If we ever changed/used the texture or orientation state
|
||||
of quadObj, we'd need to change it to the defaults here
|
||||
with gluQuadricTexture and/or gluQuadricOrientation. */
|
||||
gluCylinder(quadObj, base, 0.0, height, slices, stacks);
|
||||
}
|
||||
|
||||
void APIENTRY
|
||||
glutSolidCone(GLdouble base, GLdouble height,
|
||||
GLint slices, GLint stacks)
|
||||
{
|
||||
QUAD_OBJ_INIT();
|
||||
gluQuadricDrawStyle(quadObj, GLU_FILL);
|
||||
gluQuadricNormals(quadObj, GLU_SMOOTH);
|
||||
/* If we ever changed/used the texture or orientation state
|
||||
of quadObj, we'd need to change it to the defaults here
|
||||
with gluQuadricTexture and/or gluQuadricOrientation. */
|
||||
gluCylinder(quadObj, base, 0.0, height, slices, stacks);
|
||||
}
|
||||
|
||||
/* ENDCENTRY */
|
||||
|
||||
static void
|
||||
drawBox(GLfloat size, GLenum type)
|
||||
{
|
||||
static GLfloat n[6][3] =
|
||||
{
|
||||
{-1.0, 0.0, 0.0},
|
||||
{0.0, 1.0, 0.0},
|
||||
{1.0, 0.0, 0.0},
|
||||
{0.0, -1.0, 0.0},
|
||||
{0.0, 0.0, 1.0},
|
||||
{0.0, 0.0, -1.0}
|
||||
};
|
||||
static GLint faces[6][4] =
|
||||
{
|
||||
{0, 1, 2, 3},
|
||||
{3, 2, 6, 7},
|
||||
{7, 6, 5, 4},
|
||||
{4, 5, 1, 0},
|
||||
{5, 6, 2, 1},
|
||||
{7, 4, 0, 3}
|
||||
};
|
||||
GLfloat v[8][3];
|
||||
GLint i;
|
||||
|
||||
v[0][0] = v[1][0] = v[2][0] = v[3][0] = -size / 2;
|
||||
v[4][0] = v[5][0] = v[6][0] = v[7][0] = size / 2;
|
||||
v[0][1] = v[1][1] = v[4][1] = v[5][1] = -size / 2;
|
||||
v[2][1] = v[3][1] = v[6][1] = v[7][1] = size / 2;
|
||||
v[0][2] = v[3][2] = v[4][2] = v[7][2] = -size / 2;
|
||||
v[1][2] = v[2][2] = v[5][2] = v[6][2] = size / 2;
|
||||
|
||||
for (i = 5; i >= 0; i--) {
|
||||
glBegin(type);
|
||||
glNormal3fv(&n[i][0]);
|
||||
glVertex3fv(&v[faces[i][0]][0]);
|
||||
glVertex3fv(&v[faces[i][1]][0]);
|
||||
glVertex3fv(&v[faces[i][2]][0]);
|
||||
glVertex3fv(&v[faces[i][3]][0]);
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
|
||||
/* CENTRY */
|
||||
void APIENTRY
|
||||
glutWireCube(GLdouble size)
|
||||
{
|
||||
drawBox(size, GL_LINE_LOOP);
|
||||
}
|
||||
|
||||
void APIENTRY
|
||||
glutSolidCube(GLdouble size)
|
||||
{
|
||||
drawBox(size, GL_QUADS);
|
||||
}
|
||||
|
||||
/* ENDCENTRY */
|
||||
|
||||
static void
|
||||
doughnut(GLfloat r, GLfloat R, GLint nsides, GLint rings)
|
||||
{
|
||||
int i, j;
|
||||
GLfloat theta, phi, theta1;
|
||||
GLfloat cosTheta, sinTheta;
|
||||
GLfloat cosTheta1, sinTheta1;
|
||||
GLfloat ringDelta, sideDelta;
|
||||
|
||||
ringDelta = 2.0 * M_PI / rings;
|
||||
sideDelta = 2.0 * M_PI / nsides;
|
||||
|
||||
theta = 0.0;
|
||||
cosTheta = 1.0;
|
||||
sinTheta = 0.0;
|
||||
for (i = rings - 1; i >= 0; i--) {
|
||||
theta1 = theta + ringDelta;
|
||||
cosTheta1 = cos(theta1);
|
||||
sinTheta1 = sin(theta1);
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
phi = 0.0;
|
||||
for (j = nsides; j >= 0; j--) {
|
||||
GLfloat cosPhi, sinPhi, dist;
|
||||
|
||||
phi += sideDelta;
|
||||
cosPhi = cos(phi);
|
||||
sinPhi = sin(phi);
|
||||
dist = R + r * cosPhi;
|
||||
|
||||
glNormal3f(cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
|
||||
glVertex3f(cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
|
||||
glNormal3f(cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
|
||||
glVertex3f(cosTheta * dist, -sinTheta * dist, r * sinPhi);
|
||||
}
|
||||
glEnd();
|
||||
theta = theta1;
|
||||
cosTheta = cosTheta1;
|
||||
sinTheta = sinTheta1;
|
||||
}
|
||||
}
|
||||
|
||||
/* CENTRY */
|
||||
void APIENTRY
|
||||
glutWireTorus(GLdouble innerRadius, GLdouble outerRadius,
|
||||
GLint nsides, GLint rings)
|
||||
{
|
||||
glPushAttrib(GL_POLYGON_BIT);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
doughnut(innerRadius, outerRadius, nsides, rings);
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
void APIENTRY
|
||||
glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius,
|
||||
GLint nsides, GLint rings)
|
||||
{
|
||||
doughnut(innerRadius, outerRadius, nsides, rings);
|
||||
}
|
||||
|
||||
/* ENDCENTRY */
|
||||
|
||||
static GLfloat dodec[20][3];
|
||||
|
||||
static void
|
||||
initDodecahedron(void)
|
||||
{
|
||||
GLfloat alpha, beta;
|
||||
|
||||
alpha = sqrt(2.0 / (3.0 + sqrt(5.0)));
|
||||
beta = 1.0 + sqrt(6.0 / (3.0 + sqrt(5.0)) -
|
||||
2.0 + 2.0 * sqrt(2.0 / (3.0 + sqrt(5.0))));
|
||||
/* *INDENT-OFF* */
|
||||
dodec[0][0] = -alpha; dodec[0][1] = 0; dodec[0][2] = beta;
|
||||
dodec[1][0] = alpha; dodec[1][1] = 0; dodec[1][2] = beta;
|
||||
dodec[2][0] = -1; dodec[2][1] = -1; dodec[2][2] = -1;
|
||||
dodec[3][0] = -1; dodec[3][1] = -1; dodec[3][2] = 1;
|
||||
dodec[4][0] = -1; dodec[4][1] = 1; dodec[4][2] = -1;
|
||||
dodec[5][0] = -1; dodec[5][1] = 1; dodec[5][2] = 1;
|
||||
dodec[6][0] = 1; dodec[6][1] = -1; dodec[6][2] = -1;
|
||||
dodec[7][0] = 1; dodec[7][1] = -1; dodec[7][2] = 1;
|
||||
dodec[8][0] = 1; dodec[8][1] = 1; dodec[8][2] = -1;
|
||||
dodec[9][0] = 1; dodec[9][1] = 1; dodec[9][2] = 1;
|
||||
dodec[10][0] = beta; dodec[10][1] = alpha; dodec[10][2] = 0;
|
||||
dodec[11][0] = beta; dodec[11][1] = -alpha; dodec[11][2] = 0;
|
||||
dodec[12][0] = -beta; dodec[12][1] = alpha; dodec[12][2] = 0;
|
||||
dodec[13][0] = -beta; dodec[13][1] = -alpha; dodec[13][2] = 0;
|
||||
dodec[14][0] = -alpha; dodec[14][1] = 0; dodec[14][2] = -beta;
|
||||
dodec[15][0] = alpha; dodec[15][1] = 0; dodec[15][2] = -beta;
|
||||
dodec[16][0] = 0; dodec[16][1] = beta; dodec[16][2] = alpha;
|
||||
dodec[17][0] = 0; dodec[17][1] = beta; dodec[17][2] = -alpha;
|
||||
dodec[18][0] = 0; dodec[18][1] = -beta; dodec[18][2] = alpha;
|
||||
dodec[19][0] = 0; dodec[19][1] = -beta; dodec[19][2] = -alpha;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
}
|
||||
|
||||
#define DIFF3(_a,_b,_c) { \
|
||||
(_c)[0] = (_a)[0] - (_b)[0]; \
|
||||
(_c)[1] = (_a)[1] - (_b)[1]; \
|
||||
(_c)[2] = (_a)[2] - (_b)[2]; \
|
||||
}
|
||||
|
||||
static void
|
||||
crossprod(GLfloat v1[3], GLfloat v2[3], GLfloat prod[3])
|
||||
{
|
||||
GLfloat p[3]; /* in case prod == v1 or v2 */
|
||||
|
||||
p[0] = v1[1] * v2[2] - v2[1] * v1[2];
|
||||
p[1] = v1[2] * v2[0] - v2[2] * v1[0];
|
||||
p[2] = v1[0] * v2[1] - v2[0] * v1[1];
|
||||
prod[0] = p[0];
|
||||
prod[1] = p[1];
|
||||
prod[2] = p[2];
|
||||
}
|
||||
|
||||
static void
|
||||
normalize(GLfloat v[3])
|
||||
{
|
||||
GLfloat d;
|
||||
|
||||
d = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
|
||||
if (d == 0.0) {
|
||||
// __glutWarning("normalize: zero length vector");
|
||||
v[0] = d = 1.0;
|
||||
}
|
||||
d = 1 / d;
|
||||
v[0] *= d;
|
||||
v[1] *= d;
|
||||
v[2] *= d;
|
||||
}
|
||||
|
||||
static void
|
||||
pentagon(int a, int b, int c, int d, int e, GLenum shadeType)
|
||||
{
|
||||
GLfloat n0[3], d1[3], d2[3];
|
||||
|
||||
DIFF3(dodec[a], dodec[b], d1);
|
||||
DIFF3(dodec[b], dodec[c], d2);
|
||||
crossprod(d1, d2, n0);
|
||||
normalize(n0);
|
||||
|
||||
glBegin(shadeType);
|
||||
glNormal3fv(n0);
|
||||
glVertex3fv(&dodec[a][0]);
|
||||
glVertex3fv(&dodec[b][0]);
|
||||
glVertex3fv(&dodec[c][0]);
|
||||
glVertex3fv(&dodec[d][0]);
|
||||
glVertex3fv(&dodec[e][0]);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
static void
|
||||
dodecahedron(GLenum type)
|
||||
{
|
||||
static int inited = 0;
|
||||
|
||||
if (inited == 0) {
|
||||
inited = 1;
|
||||
initDodecahedron();
|
||||
}
|
||||
pentagon(0, 1, 9, 16, 5, type);
|
||||
pentagon(1, 0, 3, 18, 7, type);
|
||||
pentagon(1, 7, 11, 10, 9, type);
|
||||
pentagon(11, 7, 18, 19, 6, type);
|
||||
pentagon(8, 17, 16, 9, 10, type);
|
||||
pentagon(2, 14, 15, 6, 19, type);
|
||||
pentagon(2, 13, 12, 4, 14, type);
|
||||
pentagon(2, 19, 18, 3, 13, type);
|
||||
pentagon(3, 0, 5, 12, 13, type);
|
||||
pentagon(6, 15, 8, 10, 11, type);
|
||||
pentagon(4, 17, 8, 15, 14, type);
|
||||
pentagon(4, 12, 5, 16, 17, type);
|
||||
}
|
||||
|
||||
/* CENTRY */
|
||||
void APIENTRY
|
||||
glutWireDodecahedron(void)
|
||||
{
|
||||
dodecahedron(GL_LINE_LOOP);
|
||||
}
|
||||
|
||||
void APIENTRY
|
||||
glutSolidDodecahedron(void)
|
||||
{
|
||||
dodecahedron(GL_TRIANGLE_FAN);
|
||||
}
|
||||
|
||||
/* ENDCENTRY */
|
||||
|
||||
static void
|
||||
recorditem(GLfloat * n1, GLfloat * n2, GLfloat * n3,
|
||||
GLenum shadeType)
|
||||
{
|
||||
GLfloat q0[3], q1[3];
|
||||
|
||||
DIFF3(n1, n2, q0);
|
||||
DIFF3(n2, n3, q1);
|
||||
crossprod(q0, q1, q1);
|
||||
normalize(q1);
|
||||
|
||||
glBegin(shadeType);
|
||||
glNormal3fv(q1);
|
||||
glVertex3fv(n1);
|
||||
glVertex3fv(n2);
|
||||
glVertex3fv(n3);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
static void
|
||||
subdivide(GLfloat * v0, GLfloat * v1, GLfloat * v2,
|
||||
GLenum shadeType)
|
||||
{
|
||||
int depth;
|
||||
GLfloat w0[3], w1[3], w2[3];
|
||||
GLfloat l;
|
||||
int i, j, k, n;
|
||||
|
||||
depth = 1;
|
||||
for (i = 0; i < depth; i++) {
|
||||
for (j = 0; i + j < depth; j++) {
|
||||
k = depth - i - j;
|
||||
for (n = 0; n < 3; n++) {
|
||||
w0[n] = (i * v0[n] + j * v1[n] + k * v2[n]) / depth;
|
||||
w1[n] = ((i + 1) * v0[n] + j * v1[n] + (k - 1) * v2[n])
|
||||
/ depth;
|
||||
w2[n] = (i * v0[n] + (j + 1) * v1[n] + (k - 1) * v2[n])
|
||||
/ depth;
|
||||
}
|
||||
l = sqrt(w0[0] * w0[0] + w0[1] * w0[1] + w0[2] * w0[2]);
|
||||
w0[0] /= l;
|
||||
w0[1] /= l;
|
||||
w0[2] /= l;
|
||||
l = sqrt(w1[0] * w1[0] + w1[1] * w1[1] + w1[2] * w1[2]);
|
||||
w1[0] /= l;
|
||||
w1[1] /= l;
|
||||
w1[2] /= l;
|
||||
l = sqrt(w2[0] * w2[0] + w2[1] * w2[1] + w2[2] * w2[2]);
|
||||
w2[0] /= l;
|
||||
w2[1] /= l;
|
||||
w2[2] /= l;
|
||||
recorditem(w1, w0, w2, shadeType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
drawtriangle(int i, GLfloat data[][3], int ndx[][3],
|
||||
GLenum shadeType)
|
||||
{
|
||||
GLfloat *x0, *x1, *x2;
|
||||
|
||||
x0 = data[ndx[i][0]];
|
||||
x1 = data[ndx[i][1]];
|
||||
x2 = data[ndx[i][2]];
|
||||
subdivide(x0, x1, x2, shadeType);
|
||||
}
|
||||
|
||||
/* octahedron data: The octahedron produced is centered at the
|
||||
origin and has radius 1.0 */
|
||||
static GLfloat odata[6][3] =
|
||||
{
|
||||
{1.0, 0.0, 0.0},
|
||||
{-1.0, 0.0, 0.0},
|
||||
{0.0, 1.0, 0.0},
|
||||
{0.0, -1.0, 0.0},
|
||||
{0.0, 0.0, 1.0},
|
||||
{0.0, 0.0, -1.0}
|
||||
};
|
||||
|
||||
static int ondex[8][3] =
|
||||
{
|
||||
{0, 4, 2},
|
||||
{1, 2, 4},
|
||||
{0, 3, 4},
|
||||
{1, 4, 3},
|
||||
{0, 2, 5},
|
||||
{1, 5, 2},
|
||||
{0, 5, 3},
|
||||
{1, 3, 5}
|
||||
};
|
||||
|
||||
static void
|
||||
octahedron(GLenum shadeType)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 7; i >= 0; i--) {
|
||||
drawtriangle(i, odata, ondex, shadeType);
|
||||
}
|
||||
}
|
||||
|
||||
/* CENTRY */
|
||||
void APIENTRY
|
||||
glutWireOctahedron(void)
|
||||
{
|
||||
octahedron(GL_LINE_LOOP);
|
||||
}
|
||||
|
||||
void APIENTRY
|
||||
glutSolidOctahedron(void)
|
||||
{
|
||||
octahedron(GL_TRIANGLES);
|
||||
}
|
||||
|
||||
/* ENDCENTRY */
|
||||
|
||||
/* icosahedron data: These numbers are rigged to make an
|
||||
icosahedron of radius 1.0 */
|
||||
|
||||
#define X .525731112119133606
|
||||
#define Z .850650808352039932
|
||||
|
||||
static GLfloat idata[12][3] =
|
||||
{
|
||||
{-X, 0, Z},
|
||||
{X, 0, Z},
|
||||
{-X, 0, -Z},
|
||||
{X, 0, -Z},
|
||||
{0, Z, X},
|
||||
{0, Z, -X},
|
||||
{0, -Z, X},
|
||||
{0, -Z, -X},
|
||||
{Z, X, 0},
|
||||
{-Z, X, 0},
|
||||
{Z, -X, 0},
|
||||
{-Z, -X, 0}
|
||||
};
|
||||
|
||||
static int index[20][3] =
|
||||
{
|
||||
{0, 4, 1},
|
||||
{0, 9, 4},
|
||||
{9, 5, 4},
|
||||
{4, 5, 8},
|
||||
{4, 8, 1},
|
||||
{8, 10, 1},
|
||||
{8, 3, 10},
|
||||
{5, 3, 8},
|
||||
{5, 2, 3},
|
||||
{2, 7, 3},
|
||||
{7, 10, 3},
|
||||
{7, 6, 10},
|
||||
{7, 11, 6},
|
||||
{11, 0, 6},
|
||||
{0, 1, 6},
|
||||
{6, 1, 10},
|
||||
{9, 0, 11},
|
||||
{9, 11, 2},
|
||||
{9, 2, 5},
|
||||
{7, 2, 11},
|
||||
};
|
||||
|
||||
static void
|
||||
icosahedron(GLenum shadeType)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 19; i >= 0; i--) {
|
||||
drawtriangle(i, idata, index, shadeType);
|
||||
}
|
||||
}
|
||||
|
||||
/* CENTRY */
|
||||
void APIENTRY
|
||||
glutWireIcosahedron(void)
|
||||
{
|
||||
icosahedron(GL_LINE_LOOP);
|
||||
}
|
||||
|
||||
void APIENTRY
|
||||
glutSolidIcosahedron(void)
|
||||
{
|
||||
icosahedron(GL_TRIANGLES);
|
||||
}
|
||||
|
||||
/* ENDCENTRY */
|
||||
|
||||
/* tetrahedron data: */
|
||||
|
||||
#define T 1.73205080756887729
|
||||
|
||||
static GLfloat tdata[4][3] =
|
||||
{
|
||||
{T, T, T},
|
||||
{T, -T, -T},
|
||||
{-T, T, -T},
|
||||
{-T, -T, T}
|
||||
};
|
||||
|
||||
static int tndex[4][3] =
|
||||
{
|
||||
{0, 1, 3},
|
||||
{2, 1, 0},
|
||||
{3, 2, 0},
|
||||
{1, 2, 3}
|
||||
};
|
||||
|
||||
static void
|
||||
tetrahedron(GLenum shadeType)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 3; i >= 0; i--)
|
||||
drawtriangle(i, tdata, tndex, shadeType);
|
||||
}
|
||||
|
||||
/* CENTRY */
|
||||
void APIENTRY
|
||||
glutWireTetrahedron(void)
|
||||
{
|
||||
tetrahedron(GL_LINE_LOOP);
|
||||
}
|
||||
|
||||
void APIENTRY
|
||||
glutSolidTetrahedron(void)
|
||||
{
|
||||
tetrahedron(GL_TRIANGLES);
|
||||
}
|
||||
|
||||
/* ENDCENTRY */
|
60
src/glut/dos/overlay.c
Normal file
60
src/glut/dos/overlay.c
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#include "GL/glut.h"
|
||||
|
||||
|
||||
void APIENTRY glutEstablishOverlay (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutRemoveOverlay (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutUseLayer (GLenum layer)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutPostOverlayRedisplay (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutShowOverlay (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutHideOverlay (void)
|
||||
{
|
||||
}
|
70
src/glut/dos/state.c
Normal file
70
src/glut/dos/state.c
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.0 for Mesa 4.0
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#include "GL/glut.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
#define FREQUENCY 100
|
||||
|
||||
|
||||
static int timer_installed;
|
||||
static volatile int ticks;
|
||||
|
||||
static void ticks_timer (void *p)
|
||||
{
|
||||
(void)p;
|
||||
ticks++;
|
||||
} ENDOFUNC(ticks_timer)
|
||||
|
||||
|
||||
|
||||
int APIENTRY glutGet (GLenum type)
|
||||
{
|
||||
switch (type) {
|
||||
case GLUT_WINDOW_RGBA:
|
||||
return 1;
|
||||
case GLUT_ELAPSED_TIME:
|
||||
if (!timer_installed) {
|
||||
timer_installed = !timer_installed;
|
||||
LOCKDATA(ticks);
|
||||
LOCKFUNC(ticks_timer);
|
||||
pc_install_int(ticks_timer, NULL, FREQUENCY);
|
||||
}
|
||||
return ticks*1000/FREQUENCY;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY glutDeviceGet (GLenum type)
|
||||
{
|
||||
return 0;
|
||||
}
|
212
src/glut/dos/teapot.c
Normal file
212
src/glut/dos/teapot.c
Normal file
@@ -0,0 +1,212 @@
|
||||
|
||||
/* Copyright (c) Mark J. Kilgard, 1994. */
|
||||
|
||||
/**
|
||||
(c) Copyright 1993, Silicon Graphics, Inc.
|
||||
|
||||
ALL RIGHTS RESERVED
|
||||
|
||||
Permission to use, copy, modify, and distribute this software
|
||||
for any purpose and without fee is hereby granted, provided
|
||||
that the above copyright notice appear in all copies and that
|
||||
both the copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Silicon
|
||||
Graphics, Inc. not be used in advertising or publicity
|
||||
pertaining to distribution of the software without specific,
|
||||
written prior permission.
|
||||
|
||||
THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU
|
||||
"AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR
|
||||
OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO
|
||||
EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE
|
||||
ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR
|
||||
CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER,
|
||||
INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE,
|
||||
SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR
|
||||
NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
US Government Users Restricted Rights
|
||||
|
||||
Use, duplication, or disclosure by the Government is subject to
|
||||
restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
||||
(c)(1)(ii) of the Rights in Technical Data and Computer
|
||||
Software clause at DFARS 252.227-7013 and/or in similar or
|
||||
successor clauses in the FAR or the DOD or NASA FAR
|
||||
Supplement. Unpublished-- rights reserved under the copyright
|
||||
laws of the United States. Contractor/manufacturer is Silicon
|
||||
Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA
|
||||
94039-7311.
|
||||
|
||||
OpenGL(TM) is a trademark of Silicon Graphics, Inc.
|
||||
*/
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#include "GL/glut.h"
|
||||
|
||||
/* Rim, body, lid, and bottom data must be reflected in x and
|
||||
y; handle and spout data across the y axis only. */
|
||||
|
||||
static int patchdata[][16] =
|
||||
{
|
||||
/* rim */
|
||||
{102, 103, 104, 105, 4, 5, 6, 7, 8, 9, 10, 11,
|
||||
12, 13, 14, 15},
|
||||
/* body */
|
||||
{12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
|
||||
24, 25, 26, 27},
|
||||
{24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36,
|
||||
37, 38, 39, 40},
|
||||
/* lid */
|
||||
{96, 96, 96, 96, 97, 98, 99, 100, 101, 101, 101,
|
||||
101, 0, 1, 2, 3,},
|
||||
{0, 1, 2, 3, 106, 107, 108, 109, 110, 111, 112,
|
||||
113, 114, 115, 116, 117},
|
||||
/* bottom */
|
||||
{118, 118, 118, 118, 124, 122, 119, 121, 123, 126,
|
||||
125, 120, 40, 39, 38, 37},
|
||||
/* handle */
|
||||
{41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
|
||||
53, 54, 55, 56},
|
||||
{53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
|
||||
28, 65, 66, 67},
|
||||
/* spout */
|
||||
{68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
||||
80, 81, 82, 83},
|
||||
{80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
|
||||
92, 93, 94, 95}
|
||||
};
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
static float cpdata[][3] =
|
||||
{
|
||||
{0.2, 0, 2.7}, {0.2, -0.112, 2.7}, {0.112, -0.2, 2.7}, {0,
|
||||
-0.2, 2.7}, {1.3375, 0, 2.53125}, {1.3375, -0.749, 2.53125},
|
||||
{0.749, -1.3375, 2.53125}, {0, -1.3375, 2.53125}, {1.4375,
|
||||
0, 2.53125}, {1.4375, -0.805, 2.53125}, {0.805, -1.4375,
|
||||
2.53125}, {0, -1.4375, 2.53125}, {1.5, 0, 2.4}, {1.5, -0.84,
|
||||
2.4}, {0.84, -1.5, 2.4}, {0, -1.5, 2.4}, {1.75, 0, 1.875},
|
||||
{1.75, -0.98, 1.875}, {0.98, -1.75, 1.875}, {0, -1.75,
|
||||
1.875}, {2, 0, 1.35}, {2, -1.12, 1.35}, {1.12, -2, 1.35},
|
||||
{0, -2, 1.35}, {2, 0, 0.9}, {2, -1.12, 0.9}, {1.12, -2,
|
||||
0.9}, {0, -2, 0.9}, {-2, 0, 0.9}, {2, 0, 0.45}, {2, -1.12,
|
||||
0.45}, {1.12, -2, 0.45}, {0, -2, 0.45}, {1.5, 0, 0.225},
|
||||
{1.5, -0.84, 0.225}, {0.84, -1.5, 0.225}, {0, -1.5, 0.225},
|
||||
{1.5, 0, 0.15}, {1.5, -0.84, 0.15}, {0.84, -1.5, 0.15}, {0,
|
||||
-1.5, 0.15}, {-1.6, 0, 2.025}, {-1.6, -0.3, 2.025}, {-1.5,
|
||||
-0.3, 2.25}, {-1.5, 0, 2.25}, {-2.3, 0, 2.025}, {-2.3, -0.3,
|
||||
2.025}, {-2.5, -0.3, 2.25}, {-2.5, 0, 2.25}, {-2.7, 0,
|
||||
2.025}, {-2.7, -0.3, 2.025}, {-3, -0.3, 2.25}, {-3, 0,
|
||||
2.25}, {-2.7, 0, 1.8}, {-2.7, -0.3, 1.8}, {-3, -0.3, 1.8},
|
||||
{-3, 0, 1.8}, {-2.7, 0, 1.575}, {-2.7, -0.3, 1.575}, {-3,
|
||||
-0.3, 1.35}, {-3, 0, 1.35}, {-2.5, 0, 1.125}, {-2.5, -0.3,
|
||||
1.125}, {-2.65, -0.3, 0.9375}, {-2.65, 0, 0.9375}, {-2,
|
||||
-0.3, 0.9}, {-1.9, -0.3, 0.6}, {-1.9, 0, 0.6}, {1.7, 0,
|
||||
1.425}, {1.7, -0.66, 1.425}, {1.7, -0.66, 0.6}, {1.7, 0,
|
||||
0.6}, {2.6, 0, 1.425}, {2.6, -0.66, 1.425}, {3.1, -0.66,
|
||||
0.825}, {3.1, 0, 0.825}, {2.3, 0, 2.1}, {2.3, -0.25, 2.1},
|
||||
{2.4, -0.25, 2.025}, {2.4, 0, 2.025}, {2.7, 0, 2.4}, {2.7,
|
||||
-0.25, 2.4}, {3.3, -0.25, 2.4}, {3.3, 0, 2.4}, {2.8, 0,
|
||||
2.475}, {2.8, -0.25, 2.475}, {3.525, -0.25, 2.49375},
|
||||
{3.525, 0, 2.49375}, {2.9, 0, 2.475}, {2.9, -0.15, 2.475},
|
||||
{3.45, -0.15, 2.5125}, {3.45, 0, 2.5125}, {2.8, 0, 2.4},
|
||||
{2.8, -0.15, 2.4}, {3.2, -0.15, 2.4}, {3.2, 0, 2.4}, {0, 0,
|
||||
3.15}, {0.8, 0, 3.15}, {0.8, -0.45, 3.15}, {0.45, -0.8,
|
||||
3.15}, {0, -0.8, 3.15}, {0, 0, 2.85}, {1.4, 0, 2.4}, {1.4,
|
||||
-0.784, 2.4}, {0.784, -1.4, 2.4}, {0, -1.4, 2.4}, {0.4, 0,
|
||||
2.55}, {0.4, -0.224, 2.55}, {0.224, -0.4, 2.55}, {0, -0.4,
|
||||
2.55}, {1.3, 0, 2.55}, {1.3, -0.728, 2.55}, {0.728, -1.3,
|
||||
2.55}, {0, -1.3, 2.55}, {1.3, 0, 2.4}, {1.3, -0.728, 2.4},
|
||||
{0.728, -1.3, 2.4}, {0, -1.3, 2.4}, {0, 0, 0}, {1.425,
|
||||
-0.798, 0}, {1.5, 0, 0.075}, {1.425, 0, 0}, {0.798, -1.425,
|
||||
0}, {0, -1.5, 0.075}, {0, -1.425, 0}, {1.5, -0.84, 0.075},
|
||||
{0.84, -1.5, 0.075}
|
||||
};
|
||||
|
||||
static float tex[2][2][2] =
|
||||
{
|
||||
{ {0, 0},
|
||||
{1, 0}},
|
||||
{ {0, 1},
|
||||
{1, 1}}
|
||||
};
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static void
|
||||
teapot(GLint grid, GLdouble scale, GLenum type)
|
||||
{
|
||||
float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3];
|
||||
long i, j, k, l;
|
||||
|
||||
glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT);
|
||||
glEnable(GL_AUTO_NORMAL);
|
||||
glEnable(GL_NORMALIZE);
|
||||
glEnable(GL_MAP2_VERTEX_3);
|
||||
glEnable(GL_MAP2_TEXTURE_COORD_2);
|
||||
glPushMatrix();
|
||||
glRotatef(270.0, 1.0, 0.0, 0.0);
|
||||
glScalef(0.5 * scale, 0.5 * scale, 0.5 * scale);
|
||||
glTranslatef(0.0, 0.0, -1.5);
|
||||
for (i = 0; i < 10; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
for (k = 0; k < 4; k++) {
|
||||
for (l = 0; l < 3; l++) {
|
||||
p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
|
||||
q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l];
|
||||
if (l == 1)
|
||||
q[j][k][l] *= -1.0;
|
||||
if (i < 6) {
|
||||
r[j][k][l] =
|
||||
cpdata[patchdata[i][j * 4 + (3 - k)]][l];
|
||||
if (l == 0)
|
||||
r[j][k][l] *= -1.0;
|
||||
s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
|
||||
if (l == 0)
|
||||
s[j][k][l] *= -1.0;
|
||||
if (l == 1)
|
||||
s[j][k][l] *= -1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2,
|
||||
&tex[0][0][0]);
|
||||
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
|
||||
&p[0][0][0]);
|
||||
glMapGrid2f(grid, 0.0, 1.0, grid, 0.0, 1.0);
|
||||
glEvalMesh2(type, 0, grid, 0, grid);
|
||||
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
|
||||
&q[0][0][0]);
|
||||
glEvalMesh2(type, 0, grid, 0, grid);
|
||||
if (i < 6) {
|
||||
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
|
||||
&r[0][0][0]);
|
||||
glEvalMesh2(type, 0, grid, 0, grid);
|
||||
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
|
||||
&s[0][0][0]);
|
||||
glEvalMesh2(type, 0, grid, 0, grid);
|
||||
}
|
||||
}
|
||||
glPopMatrix();
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
/* CENTRY */
|
||||
void APIENTRY
|
||||
glutSolidTeapot(GLdouble scale)
|
||||
{
|
||||
teapot(7, scale, GL_FILL);
|
||||
}
|
||||
|
||||
void APIENTRY
|
||||
glutWireTeapot(GLdouble scale)
|
||||
{
|
||||
teapot(10, scale, GL_LINE);
|
||||
}
|
||||
|
||||
/* ENDCENTRY */
|
259
src/glut/dos/window.c
Normal file
259
src/glut/dos/window.c
Normal file
@@ -0,0 +1,259 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.0
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.1 for Mesa 4.0
|
||||
*
|
||||
* Copyright (C) 2002 - Borca Daniel
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#include "GL/glut.h"
|
||||
#ifndef FX
|
||||
#include "GL/dmesa.h"
|
||||
#else
|
||||
#include "GL/fxmesa.h"
|
||||
#endif
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
|
||||
static int window;
|
||||
|
||||
#ifndef FX
|
||||
static DMesaVisual visual = NULL;
|
||||
static DMesaContext context = NULL;
|
||||
static DMesaBuffer buffer[MAX_WINDOWS];
|
||||
#else
|
||||
static void *visual = NULL;
|
||||
static fxMesaContext context = NULL;
|
||||
static int fx_attrib[32];
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static void clean (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<MAX_WINDOWS; i++) {
|
||||
glutDestroyWindow(i+1);
|
||||
}
|
||||
#ifndef FX
|
||||
if (context) DMesaDestroyContext(context);
|
||||
if (visual) DMesaDestroyVisual(visual);
|
||||
#else
|
||||
if (context) fxMesaDestroyContext(context);
|
||||
#endif
|
||||
|
||||
pc_close_stdout();
|
||||
pc_close_stderr();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int APIENTRY glutCreateWindow (const char *title)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!visual) {
|
||||
int screen_w = DEFAULT_WIDTH;
|
||||
int screen_h = DEFAULT_HEIGHT;
|
||||
|
||||
if ((g_width<=640) && (g_height<=480)) {
|
||||
screen_w = 640;
|
||||
screen_h = 480;
|
||||
} else if ((g_width<=800) && (g_height<=600)) {
|
||||
screen_w = 800;
|
||||
screen_h = 600;
|
||||
} else if ((g_width<=1024) && (g_height<=768)) {
|
||||
screen_w = 1024;
|
||||
screen_h = 768;
|
||||
}
|
||||
|
||||
#ifndef FX
|
||||
if ((visual=DMesaCreateVisual(screen_w, screen_h, DEFAULT_BPP,
|
||||
g_display_mode & GLUT_DOUBLE,
|
||||
g_display_mode & GLUT_DEPTH ?DEPTH_SIZE :0,
|
||||
g_display_mode & GLUT_STENCIL?STENCIL_SIZE:0,
|
||||
g_display_mode & GLUT_ACCUM ?ACCUM_SIZE :0))==NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((context=DMesaCreateContext(visual, NULL))==NULL) {
|
||||
DMesaDestroyVisual(visual);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
i = 0;
|
||||
if (g_display_mode & GLUT_DOUBLE) fx_attrib[i++] = FXMESA_DOUBLEBUFFER;
|
||||
if (g_display_mode & GLUT_DEPTH) { fx_attrib[i++] = FXMESA_DEPTH_SIZE; fx_attrib[i++] = DEPTH_SIZE; }
|
||||
if (g_display_mode & GLUT_STENCIL) { fx_attrib[i++] = FXMESA_STENCIL_SIZE; fx_attrib[i++] = STENCIL_SIZE; }
|
||||
if (g_display_mode & GLUT_ACCUM) { fx_attrib[i++] = FXMESA_ACCUM_SIZE; fx_attrib[i++] = ACCUM_SIZE; }
|
||||
fx_attrib[i] = FXMESA_NONE;
|
||||
if ((context=fxMesaCreateBestContext(-1, screen_w, screen_h, fx_attrib))==NULL) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
pc_open_stdout();
|
||||
pc_open_stderr();
|
||||
pc_atexit(clean);
|
||||
}
|
||||
|
||||
#ifndef FX
|
||||
for (i=0; i<MAX_WINDOWS; i++) {
|
||||
if (!buffer[i]) {
|
||||
DMesaBuffer b;
|
||||
|
||||
if ((b=DMesaCreateBuffer(visual, g_xpos, g_ypos, g_width, g_height))==NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (!DMesaMakeCurrent(context, b)) {
|
||||
DMesaDestroyBuffer(b);
|
||||
return 0;
|
||||
}
|
||||
if (g_mouse) {
|
||||
pc_mouse_area(g_xpos, g_ypos, g_xpos + g_width - 1, g_ypos + g_height - 1);
|
||||
}
|
||||
|
||||
buffer[window = i] = b;
|
||||
return i+1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
fxMesaMakeCurrent(context);
|
||||
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY glutCreateSubWindow (int win, int x, int y, int width, int height)
|
||||
{
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutDestroyWindow (int win)
|
||||
{
|
||||
#ifndef FX
|
||||
if (buffer[win-1]) {
|
||||
DMesaDestroyBuffer(buffer[win-1]);
|
||||
buffer[win-1] = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutPostRedisplay (void)
|
||||
{
|
||||
g_redisplay = GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutSwapBuffers (void)
|
||||
{
|
||||
if (g_mouse) pc_scare_mouse();
|
||||
#ifndef FX
|
||||
DMesaSwapBuffers(buffer[window]);
|
||||
#else
|
||||
fxMesaSwapBuffers();
|
||||
#endif
|
||||
if (g_mouse) pc_unscare_mouse();
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY glutGetWindow (void)
|
||||
{
|
||||
return window + 1;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutSetWindow (int win)
|
||||
{
|
||||
window = win - 1;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutSetWindowTitle (const char *title)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutSetIconTitle (const char *title)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutPositionWindow (int x, int y)
|
||||
{
|
||||
#ifndef FX
|
||||
if (DMesaViewport(buffer[window], x, y, g_width, g_height)) {
|
||||
g_xpos = x;
|
||||
g_ypos = y;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutReshapeWindow (int width, int height)
|
||||
{
|
||||
#ifndef FX
|
||||
if (DMesaViewport(buffer[window], g_xpos, g_ypos, width, height)) {
|
||||
g_width = width;
|
||||
g_height = height;
|
||||
if (reshape_func) {
|
||||
reshape_func(width, height);
|
||||
} else {
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutPopWindow (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutPushWindow (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutIconifyWindow (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutShowWindow (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY glutHideWindow (void)
|
||||
{
|
||||
}
|
@@ -238,11 +238,6 @@ int glutCreateWindow(const char *title)
|
||||
|
||||
gt = (rgb) ? __glut_gt_rgb : __glut_gt_index;
|
||||
|
||||
__glut_ctx = GGIMesaCreateContext();
|
||||
|
||||
if (__glut_ctx == NULL)
|
||||
ggiPanic("Can't create mesa-context\n");
|
||||
|
||||
__glut_vis = ggiOpen(NULL);
|
||||
if (__glut_vis == NULL)
|
||||
{
|
||||
@@ -261,20 +256,27 @@ int glutCreateWindow(const char *title)
|
||||
/* return GL_FALSE; */
|
||||
}
|
||||
|
||||
ggiGetMode(__glut_vis, &mode);
|
||||
|
||||
if (GGIMesaSetVisual(__glut_ctx, __glut_vis, rgb, frames > 1) < 0)
|
||||
if (ggiMesaExtendVisual(__glut_vis, GL_FALSE, GL_FALSE,
|
||||
16, 0, 0, 0, 0, 0, 1) < 0)
|
||||
{
|
||||
ggiPanic("GGIMesaSetVisual failed!\n");
|
||||
}
|
||||
|
||||
__glut_ctx = ggiMesaCreateContext(__glut_vis);
|
||||
|
||||
if (__glut_ctx == NULL)
|
||||
ggiPanic("Can't create mesa-context\n");
|
||||
|
||||
ggiGetMode(__glut_vis, &mode);
|
||||
|
||||
|
||||
__glut_width = mode.visible.x;
|
||||
__glut_height = mode.visible.y;
|
||||
|
||||
mousex = mode.visible.x / 2;
|
||||
mousey = mode.visible.y / 2;
|
||||
|
||||
GGIMesaMakeCurrent(__glut_ctx);
|
||||
ggiMesaMakeCurrent(__glut_ctx, __glut_vis);
|
||||
|
||||
if (__glut_reshape)
|
||||
__glut_reshape(__glut_width, __glut_height);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile.X11,v 1.58.2.2 2001/12/14 16:33:06 kschultz Exp $
|
||||
# $Id: Makefile.X11,v 1.58.2.4 2002/01/15 20:17:59 brianp Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 4.0.1
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user