Compare commits
314 Commits
texman_0_1
...
mesa_6_5
Author | SHA1 | Date | |
---|---|---|---|
|
482d9dd21d | ||
|
9e8659f346 | ||
|
e3f41ce611 | ||
|
3a3e63dc4f | ||
|
3a46dff27d | ||
|
29d833bd52 | ||
|
9305cba6a7 | ||
|
f2ad1b60c0 | ||
|
df3d4e0bb9 | ||
|
6652dc8aac | ||
|
7da1daf0a2 | ||
|
18b72d184c | ||
|
ef5b48dea1 | ||
|
2cd4056fae | ||
|
fb0175db93 | ||
|
aa70d92a13 | ||
|
aba4967150 | ||
|
174ce730c6 | ||
|
48547ee129 | ||
|
823c581f7c | ||
|
8982697981 | ||
|
9542537cee | ||
|
c3f2c287ce | ||
|
9e81d6ae3a | ||
|
94d6bf883b | ||
|
84c5d0a789 | ||
|
dd7074736f | ||
|
ef8b89faee | ||
|
159ca321cb | ||
|
ec83f38e2e | ||
|
197d725601 | ||
|
693a66aea9 | ||
|
8ea3353ec3 | ||
|
87af12dbdc | ||
|
a8c9ecfab0 | ||
|
4ecb9f0532 | ||
|
8b186e3695 | ||
|
e43edd3c70 | ||
|
20e15f9381 | ||
|
75a8383e8d | ||
|
920023240c | ||
|
62c325af3f | ||
|
32244ac7e9 | ||
|
3a6d968f37 | ||
|
cec74532bf | ||
|
f331bb0312 | ||
|
c3051df8e1 | ||
|
db79d2abac | ||
|
c19de0b7f6 | ||
|
e5b6eee15d | ||
|
006e183b6e | ||
|
180b0dab8b | ||
|
a85fbb1d36 | ||
|
555478fed6 | ||
|
2742c4e4db | ||
|
2b430ef56a | ||
|
b7a5a9db88 | ||
|
888ab86f85 | ||
|
2526152a10 | ||
|
519a2e7cb7 | ||
|
b687531f69 | ||
|
54b65e080e | ||
|
3076557ca3 | ||
|
4f21180416 | ||
|
c61763b5d2 | ||
|
08e62a1476 | ||
|
0e26ca0834 | ||
|
e44499480f | ||
|
9f6ff49650 | ||
|
c7a5d528c7 | ||
|
b8915340ea | ||
|
1155f64cc0 | ||
|
255e8ebd58 | ||
|
95174c4eb2 | ||
|
f76ff7e4a7 | ||
|
96aa403cee | ||
|
004673d4d1 | ||
|
0ad1bda7a1 | ||
|
e72b745f32 | ||
|
ea4fe661d7 | ||
|
4cbd16ed3f | ||
|
06049e2416 | ||
|
753af3a206 | ||
|
70207b70c5 | ||
|
1bbc203c6e | ||
|
6494541eaa | ||
|
590cd26006 | ||
|
ed4ab13cef | ||
|
af8d39861d | ||
|
c4f2710f9d | ||
|
436d72e994 | ||
|
d76ef5867d | ||
|
0a6040dc2d | ||
|
eab896cc21 | ||
|
f756924fa5 | ||
|
4fafe6390b | ||
|
6fc864b9e6 | ||
|
daffbe99dc | ||
|
8995544bc9 | ||
|
071357096e | ||
|
519b23b21f | ||
|
4991888fa0 | ||
|
34bd1233a9 | ||
|
457fb0e128 | ||
|
7275d4d097 | ||
|
f1038f81e4 | ||
|
c27c382acc | ||
|
5319ed0e53 | ||
|
070f280895 | ||
|
096dd541bd | ||
|
77174f0072 | ||
|
21a4fb4137 | ||
|
19b05d5009 | ||
|
2d2af2dcf7 | ||
|
eec33cc310 | ||
|
0f1d98c422 | ||
|
724df02073 | ||
|
2b17741e1b | ||
|
c6c0f94714 | ||
|
ef8653a838 | ||
|
514a15cea1 | ||
|
ac8b07b3ae | ||
|
e660690985 | ||
|
30655c211c | ||
|
59e0faaa5c | ||
|
eccb6a0698 | ||
|
10f08cc202 | ||
|
b7e3e0d64e | ||
|
19b8322169 | ||
|
2a0d441ebb | ||
|
15e74a6441 | ||
|
0f618b7eb7 | ||
|
8af48fc4d6 | ||
|
e9484e4085 | ||
|
a0cf4ceb36 | ||
|
5042778449 | ||
|
9c32af5bb2 | ||
|
841a823d6d | ||
|
0d57301ba2 | ||
|
12d51beb7e | ||
|
e294d938f2 | ||
|
f1b431b265 | ||
|
9fc897af7a | ||
|
d97ab9a7bd | ||
|
d9894e0d72 | ||
|
dba9c0bafd | ||
|
ba7ea2e697 | ||
|
50f319242b | ||
|
ca007cb449 | ||
|
d75963d258 | ||
|
8ee311d36d | ||
|
2e01918b55 | ||
|
168a7516b1 | ||
|
c107058e7e | ||
|
3bca4f679a | ||
|
9d881ea718 | ||
|
448d23331d | ||
|
66df1731e6 | ||
|
5820f7998a | ||
|
780d270312 | ||
|
e1e03b32ab | ||
|
f8ba07a77d | ||
|
5e01f9a114 | ||
|
f4ab5654d0 | ||
|
da16813f43 | ||
|
9227bca103 | ||
|
81b8aa9ecd | ||
|
14d3ab9662 | ||
|
904ab0c22c | ||
|
afa1df5871 | ||
|
c241d3b06a | ||
|
93da673904 | ||
|
cf6be2d5bd | ||
|
dbfd246db8 | ||
|
190e5595bc | ||
|
68edf28df6 | ||
|
9b8059e536 | ||
|
6d4284e2bf | ||
|
9974540c73 | ||
|
2c61fdafd6 | ||
|
1eca891dbe | ||
|
a231097609 | ||
|
fbe48ef01f | ||
|
71932ef85c | ||
|
6754e17138 | ||
|
f71fd439f5 | ||
|
147f5091a1 | ||
|
176dac684a | ||
|
34b60b001d | ||
|
3073cf21d2 | ||
|
d1d4121682 | ||
|
9ac9605de1 | ||
|
c56f2c49a5 | ||
|
be42f53020 | ||
|
a764b7eae0 | ||
|
4e77669926 | ||
|
2aabdc743f | ||
|
ee2339f673 | ||
|
228d4a6de7 | ||
|
1aad408b5a | ||
|
44a2e96729 | ||
|
5b2ee9c1e9 | ||
|
956fff6345 | ||
|
7b6fd8a0c6 | ||
|
cebad151a1 | ||
|
4f8b59d59b | ||
|
49ad2d4ed1 | ||
|
cc1591667d | ||
|
8986e36f36 | ||
|
fcbbdf9991 | ||
|
97a3023c9f | ||
|
3654193a4d | ||
|
e94be8d5c0 | ||
|
8da9f448f4 | ||
|
555b5fac4f | ||
|
a176bc6c17 | ||
|
ee40c4fb34 | ||
|
a584e846d4 | ||
|
dd02edf381 | ||
|
88d994c3b2 | ||
|
50092f8f33 | ||
|
870ebefb3b | ||
|
a663931204 | ||
|
5bc35a823a | ||
|
dc3a922cf3 | ||
|
0c8e578a38 | ||
|
3699751b0b | ||
|
d5aca8bf0c | ||
|
0c1438d331 | ||
|
a5033a0421 | ||
|
2189d9c96e | ||
|
e7ffe4619f | ||
|
8a54fad6cd | ||
|
ebcbf2f853 | ||
|
41eeae5fb1 | ||
|
02eb9acc5e | ||
|
44e9ccc708 | ||
|
adef42c88d | ||
|
7d376c76c9 | ||
|
a2ea606377 | ||
|
2363fff347 | ||
|
c92e688e15 | ||
|
170f08d4b1 | ||
|
91c30771b6 | ||
|
f236300e3a | ||
|
a73094cc6a | ||
|
42447365b2 | ||
|
b77a225250 | ||
|
d93615fc1e | ||
|
42725d6f54 | ||
|
4cd0e24f86 | ||
|
640ef7f890 | ||
|
63b852f4f9 | ||
|
ea970da0b6 | ||
|
e7276b7fa5 | ||
|
16a14510c4 | ||
|
725740c7c8 | ||
|
5951aab823 | ||
|
865ad82bb8 | ||
|
3b6f62fc73 | ||
|
111281f1fc | ||
|
663138a951 | ||
|
a45f23bed1 | ||
|
4b4cc650e1 | ||
|
781c54a5b8 | ||
|
6a36407a00 | ||
|
7905b19ec9 | ||
|
bd8c742762 | ||
|
9dc8bce88e | ||
|
b2006a40eb | ||
|
daf3093f28 | ||
|
5e9d73153c | ||
|
0b3c2a9a24 | ||
|
5594ddbcfe | ||
|
58e4aa0ec9 | ||
|
0fcfa1c5b0 | ||
|
e797bc8bbe | ||
|
7d82d284e3 | ||
|
a7bd2563c3 | ||
|
875df252a7 | ||
|
e804370014 | ||
|
32551222bc | ||
|
77667266a7 | ||
|
32a6468014 | ||
|
e65ad47a8f | ||
|
edc98df891 | ||
|
fbcb37cac5 | ||
|
3a5bb1729d | ||
|
2219a15b06 | ||
|
74235b1cf1 | ||
|
f3cf636e57 | ||
|
166b0ff973 | ||
|
7f1274fa8b | ||
|
99da2d30eb | ||
|
8b1dc68662 | ||
|
4dd8a8907e | ||
|
65573edd1b | ||
|
f3134ca7ad | ||
|
f7360cd42d | ||
|
39c492bb14 | ||
|
acd1f16b35 | ||
|
c6f35dd8db | ||
|
f087d60f18 | ||
|
41a874f486 | ||
|
ef073b7a75 | ||
|
c90b569238 | ||
|
93a7605b1d | ||
|
b42d5bcaff | ||
|
37e86254c1 | ||
|
216f729a95 | ||
|
38da697546 | ||
|
f93a228c38 | ||
|
1096eae18d | ||
|
361bccb4ec |
3
Makefile
3
Makefile
@@ -89,6 +89,7 @@ linux-dri \
|
||||
linux-dri-x86 \
|
||||
linux-dri-x86-64 \
|
||||
linux-dri-ppc \
|
||||
linux-dri-xcb \
|
||||
linux-indirect \
|
||||
linux-fbdev \
|
||||
linux-glide \
|
||||
@@ -113,7 +114,6 @@ linux-x86-32 \
|
||||
linux-x86-64 \
|
||||
linux-x86-64-debug \
|
||||
linux-x86-64-static \
|
||||
linux-x86-xcb \
|
||||
linux-x86-glide \
|
||||
linux-x86-static \
|
||||
netbsd \
|
||||
@@ -166,6 +166,7 @@ MAIN_FILES = \
|
||||
$(DIRECTORY)/include/GL/glx.h \
|
||||
$(DIRECTORY)/include/GL/glxext.h \
|
||||
$(DIRECTORY)/include/GL/glx_mangle.h \
|
||||
$(DIRECTORY)/include/GL/glfbdev.h \
|
||||
$(DIRECTORY)/include/GL/mesa_wgl.h \
|
||||
$(DIRECTORY)/include/GL/mglmesa.h \
|
||||
$(DIRECTORY)/include/GL/osmesa.h \
|
||||
|
11
Makefile.DJ
11
Makefile.DJ
@@ -20,9 +20,9 @@
|
||||
# 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 makefile v1.6 for Mesa
|
||||
# DOS/DJGPP makefile for Mesa
|
||||
#
|
||||
# Copyright (C) 2002 - Daniel Borca
|
||||
# Author: Daniel Borca
|
||||
# Email : dborca@users.sourceforge.net
|
||||
# Web : http://www.geocities.com/dborca
|
||||
|
||||
@@ -31,9 +31,6 @@
|
||||
# Available options:
|
||||
#
|
||||
# Environment variables:
|
||||
# GLU=[mesa|sgi] specify GLU directory; can be `sgi' (requires GNU/C++)
|
||||
# or `mesa'.
|
||||
# default = mesa
|
||||
# GLIDE path to Glide3 SDK; used with FX.
|
||||
# default = $(TOP)/glide3
|
||||
# FX=1 build for 3dfx Glide3. Note that this disables
|
||||
@@ -57,8 +54,6 @@
|
||||
|
||||
.PHONY : all libgl libglu libglut clean realclean
|
||||
|
||||
GLU ?= mesa
|
||||
|
||||
CFLAGS = -Wall -W -pedantic
|
||||
CFLAGS += -O2 -ffast-math
|
||||
|
||||
@@ -75,7 +70,7 @@ all: libgl libglu libglut
|
||||
libgl: lib
|
||||
$(MAKE) -f Makefile.DJ -C src/mesa
|
||||
libglu: lib
|
||||
$(MAKE) -f Makefile.DJ -C src/glu/$(GLU)
|
||||
$(MAKE) -f Makefile.DJ -C src/glu/sgi
|
||||
libglut: lib
|
||||
$(MAKE) -f Makefile.DJ -C src/glut/dos
|
||||
|
||||
|
@@ -53,6 +53,8 @@ if [ `uname` = "FreeBSD" ] ; then
|
||||
CP_FLAGS="-f"
|
||||
elif [ `uname` = "Darwin" ] ; then
|
||||
CP_FLAGS="-f"
|
||||
elif [ `uname` = "AIX" ] ; then
|
||||
CP_FLAGS="-fh"
|
||||
else
|
||||
CP_FLAGS="-fd"
|
||||
fi
|
||||
|
@@ -502,6 +502,9 @@ case $ARCH in
|
||||
${LINK} ${OPTS} ${LIBNAME} ${OBJECTS}
|
||||
FINAL_LIBS=${LIBNAME}
|
||||
else
|
||||
# may need these:
|
||||
# CFLAGS += -fno-common
|
||||
# LDFLAGS += -bundle -flat_namespace -undefined suppress
|
||||
LIBNAME="lib${LIBNAME}.dylib"
|
||||
echo "mklib: Making Darwin shared library: " ${LIBNAME}
|
||||
FLAGS="-dynamiclib -multiply_defined suppress -current_version ${MAJOR}.${MINOR}.0 -compatibility_version ${MAJOR}.${MINOR}.0"
|
||||
|
@@ -14,6 +14,6 @@ CXXFLAGS = -O2 -DAIXV3
|
||||
MKLIB_OPTIONS = -arch aix-gcc
|
||||
GL_LIB_DEPS = -lX11 -lXext -lm
|
||||
GLU_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -lm
|
||||
GLUT_LIB_DEPS = -L$(LIB_DIR -l$(GLU_LIB) -l$(GL_LIB) -lXi -lXmu
|
||||
GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lXi -lXmu
|
||||
APP_LIB_DEPS = -L$(LIB_DIR) -Wl,-brtl -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lX11 -lXext -lXmu -lXi
|
||||
|
||||
|
@@ -10,6 +10,9 @@ MESA_MAJOR=6
|
||||
MESA_MINOR=5
|
||||
MESA_TINY=0
|
||||
|
||||
# external projects. This should be useless now that we use libdrm.
|
||||
DRM_SOURCE_PATH=$(TOP)/../drm
|
||||
|
||||
# Compiler and flags
|
||||
CC = cc
|
||||
CXX = CC
|
||||
|
@@ -5,13 +5,22 @@ include $(TOP)/configs/default
|
||||
CONFIG_NAME = FreeBSD
|
||||
|
||||
# Compiler and flags
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
CC = cc
|
||||
CXX = c++
|
||||
MAKE = gmake
|
||||
|
||||
CFLAGS = -O2 -fPIC -pedantic -I/usr/X11R6/include -DUSE_XSHM -DHZ=100 \
|
||||
$(ASM_FLAGS)
|
||||
CXXFLAGS = -O2 -fPIC -pedantic
|
||||
OPT_FLAGS = -O2
|
||||
PIC_FLAGS = -fPIC
|
||||
|
||||
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -DUSE_XSHM -DHZ=100
|
||||
|
||||
X11_INCLUDES = -I/usr/X11R6/include
|
||||
|
||||
CFLAGS += $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) $(X11_INCLUDES) -ffast-math -pedantic
|
||||
|
||||
CXXFLAGS += $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) $(X11_INCLUDES)
|
||||
|
||||
GLUT_CFLAGS = -fexceptions
|
||||
|
||||
APP_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lXext -lXmu -lXi -lX11 -lm
|
||||
EXTRA_LIB_PATH = -L/usr/X11R6/lib
|
||||
APP_LIB_DEPS = -L$(LIB_DIR) $(EXTRA_LIB_PATH) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lXext -lXmu -lXi -lX11 -lm
|
||||
|
@@ -22,7 +22,7 @@ CXXFLAGS = $(DEFINES) -Wall -g -ansi -pedantic -fPIC
|
||||
ASM_SOURCES =
|
||||
|
||||
# Library/program dependencies
|
||||
LIBDRM_LIB = `pkg-config --libs libdrm` -ldrm
|
||||
LIBDRM_LIB = `pkg-config --libs libdrm`
|
||||
DRI_LIB_DEPS = -L/usr/local/lib -lm -lpthread -lexpat $(LIBDRM_LIB)
|
||||
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lm -lpthread $(LIBDRM_LIB)
|
||||
|
||||
@@ -40,6 +40,6 @@ DRM_SOURCE_PATH=$(TOP)/../drm
|
||||
|
||||
# ffb and gamma are missing because they have not been converted to use the new
|
||||
# interface.
|
||||
DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 r300 radeon tdfx \
|
||||
DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon tdfx \
|
||||
unichrome savage sis
|
||||
|
||||
|
@@ -4,5 +4,5 @@ include $(TOP)/configs/linux
|
||||
|
||||
CONFIG_NAME = linux-debug
|
||||
|
||||
OPT_FLAGS = -g
|
||||
OPT_FLAGS = -g -ansi -pedantic
|
||||
DEFINES += -DDEBUG -DDEBUG_MATH
|
||||
|
@@ -13,8 +13,7 @@ CXX = g++
|
||||
#MKDEP = gcc -M
|
||||
#MKDEP_OPTIONS = -MF depend
|
||||
|
||||
#OPT_FLAGS = -g -march=pentium4 -fprefetch-loop-arrays
|
||||
OPT_FLAGS = -O2
|
||||
OPT_FLAGS = -g
|
||||
PIC_FLAGS = -fPIC
|
||||
|
||||
# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
|
||||
@@ -23,7 +22,6 @@ ARCH_FLAGS ?=
|
||||
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
|
||||
-D_BSD_SOURCE -D_GNU_SOURCE \
|
||||
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
|
||||
-DDEBUG \
|
||||
-DGLX_DIRECT_RENDERING -DHAVE_ALIAS
|
||||
|
||||
X11_INCLUDES = -I/usr/X11R6/include
|
||||
@@ -39,7 +37,7 @@ ASM_SOURCES =
|
||||
# Library/program dependencies
|
||||
EXTRA_LIB_PATH=-L/usr/X11R6/lib
|
||||
|
||||
LIBDRM_LIB = `pkg-config --libs libdrm` -ldrm
|
||||
LIBDRM_LIB = `pkg-config --libs libdrm`
|
||||
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
|
||||
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl \
|
||||
$(LIBDRM_LIB)
|
||||
@@ -65,7 +63,5 @@ WINDOW_SYSTEM=dri
|
||||
|
||||
# gamma are missing because they have not been converted to use the new
|
||||
# interface.
|
||||
DRI_DIRS = i915 mach64 mga r128 r200 r300 radeon s3v \
|
||||
DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon s3v \
|
||||
savage sis tdfx trident unichrome ffb
|
||||
|
||||
DRI_DIRS = i915
|
||||
|
@@ -17,7 +17,7 @@ LIB_DIR = $(TOP)/lib64
|
||||
EXTRA_LIB_PATH=-L/usr/X11R6/lib64
|
||||
|
||||
# ffb, gamma, and sis are missing because they have not be converted to use
|
||||
# the new interface. i810 and i830 are missing because there is no x86-64
|
||||
# the new interface. i810 are missing because there is no x86-64
|
||||
# system where they could *ever* be used.
|
||||
#
|
||||
DRI_DIRS = i915 mach64 mga r128 r200 radeon tdfx unichrome savage r300
|
||||
|
67
configs/linux-dri-xcb
Normal file
67
configs/linux-dri-xcb
Normal file
@@ -0,0 +1,67 @@
|
||||
# -*-makefile-*-
|
||||
# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others
|
||||
|
||||
include $(TOP)/configs/default
|
||||
|
||||
CONFIG_NAME = linux-dri-xcb
|
||||
|
||||
# Compiler and flags
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
|
||||
#MKDEP = /usr/X11R6/bin/makedepend
|
||||
#MKDEP = gcc -M
|
||||
#MKDEP_OPTIONS = -MF depend
|
||||
|
||||
OPT_FLAGS = -g
|
||||
PIC_FLAGS = -fPIC
|
||||
|
||||
# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
|
||||
ARCH_FLAGS ?=
|
||||
|
||||
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
|
||||
-D_BSD_SOURCE -D_GNU_SOURCE \
|
||||
-DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
|
||||
-DGLX_DIRECT_RENDERING -DHAVE_ALIAS -DUSE_XCB
|
||||
|
||||
X11_INCLUDES = `pkg-config --cflags-only-I x11` `pkg-config --cflags-only-I xcb`
|
||||
|
||||
CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
|
||||
$(DEFINES) $(ASM_FLAGS) -std=c99 -ffast-math
|
||||
|
||||
CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
|
||||
|
||||
|
||||
ASM_SOURCES =
|
||||
|
||||
# Library/program dependencies
|
||||
EXTRA_LIB_PATH=`pkg-config --libs-only-L x11`
|
||||
|
||||
LIBDRM_LIB = `pkg-config --libs libdrm`
|
||||
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
|
||||
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl \
|
||||
$(LIBDRM_LIB) `pkg-config --libs xcb`
|
||||
|
||||
|
||||
# This is now 0 by default since it seems to confuse the hell out of people
|
||||
# and generate a lot of extra noise on bugzilla. If you need to build with
|
||||
# EGL, do 'make linux-dri USING_EGL=1'
|
||||
|
||||
USING_EGL=0
|
||||
|
||||
# Directories
|
||||
ifeq ($(USING_EGL), 1)
|
||||
SRC_DIRS = egl glx/x11 mesa glu glut/glx glw
|
||||
PROGRAM_DIRS = egl
|
||||
else
|
||||
SRC_DIRS = glx/x11 mesa glu glut/glx glw
|
||||
PROGRAM_DIRS =
|
||||
endif
|
||||
|
||||
DRIVER_DIRS = dri
|
||||
WINDOW_SYSTEM=dri
|
||||
|
||||
# gamma are missing because they have not been converted to use the new
|
||||
# interface.
|
||||
DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon s3v \
|
||||
savage sis tdfx trident unichrome ffb
|
@@ -10,7 +10,7 @@ CONFIG_NAME = linux-dri
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
|
||||
MKDEP = /usr/X11R6/bin/makedepend
|
||||
#MKDEP = /usr/X11R6/bin/makedepend
|
||||
#MKDEP = gcc -M
|
||||
#MKDEP_OPTIONS = -MF depend
|
||||
|
||||
|
@@ -40,4 +40,4 @@ DRIVER_DIRS = dri
|
||||
PROGRAM_DIRS = miniglx
|
||||
|
||||
#DRI_DIRS = ffb gamma sis savage
|
||||
DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 radeon tdfx unichrome fb
|
||||
DRI_DIRS = i810 i915 mach64 mga r128 r200 radeon tdfx unichrome fb
|
||||
|
@@ -1,25 +0,0 @@
|
||||
# Configuration for Linux with x86 optimizations
|
||||
|
||||
include $(TOP)/configs/default
|
||||
|
||||
CONFIG_NAME = linux-x86-xcb
|
||||
|
||||
# Compiler and flags
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
|
||||
CFLAGS = -Wall -O3 -ansi -pedantic -fPIC -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 -DUSE_XCB -I/usr/X11R6/include
|
||||
|
||||
CXXFLAGS = -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XCB
|
||||
|
||||
GLUT_CFLAGS = -fexceptions
|
||||
|
||||
|
||||
ASM_SOURCES = $(X86_SOURCES)
|
||||
ASM_API = $(X86_API)
|
||||
|
||||
# Library/program dependencies
|
||||
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread -lXCB
|
||||
GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm
|
||||
GLW_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -L/usr/X11R6/lib -lXt -lX11
|
||||
APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
|
@@ -1,4 +1,4 @@
|
||||
Mesa 6.3 DOS/DJGPP Port v1.7
|
||||
Mesa 6.5 DOS/DJGPP Port v1.8
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
@@ -7,8 +7,7 @@ Description:
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Well, guess what... this is the DOS port of Mesa 6.3, 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.
|
||||
The driver uses OSMesa to draw off screen, and then blits the buffer.
|
||||
|
||||
|
||||
|
||||
@@ -32,9 +31,6 @@ Available options:
|
||||
Environment variables:
|
||||
CPU optimize for the given processor.
|
||||
default = pentium
|
||||
GLU=[mesa|sgi] specify GLU directory; can be `sgi' (requires GNU/C++)
|
||||
or `mesa'.
|
||||
default = mesa
|
||||
GLIDE path to Glide3 SDK; used with FX.
|
||||
default = $(TOP)/glide3
|
||||
FX=1 build for 3dfx Glide3. Note that this disables
|
||||
@@ -56,11 +52,9 @@ Available options:
|
||||
|
||||
|
||||
Tested on:
|
||||
CPU: AMD Athlon XP 1800+
|
||||
Mainboard: GA-7VTXE w/ 512 MB DDRAM
|
||||
Video card: Voodoo5 6000 AGP w/ 128 MB SDRAM
|
||||
DJGPP: djdev 2.04 + gcc v3.4.3 + make v3.80
|
||||
OS: DOS and Win98SE
|
||||
Video card: Radeon 9500
|
||||
DJGPP: djdev 2.04 + gcc v4.1.0 + make v3.80
|
||||
OS: DOS, Win98SE, WinXP (using Videoport driver)
|
||||
|
||||
|
||||
|
||||
@@ -98,7 +92,7 @@ FAQ:
|
||||
Q) DMesa is so SLOOOW! The Win32 OpenGL performs so much better...
|
||||
A) Is that a question? If you have a 3dfx Voodoo (any model), you're
|
||||
lucky (check http://sourceforge.net/projects/glide for the DJGPP port).
|
||||
If you haven't, sorry; everything is done in software. Suggestions?
|
||||
If you haven't, sorry; everything is done in software.
|
||||
|
||||
Q) I tried to set refresh rate w/ DMesa, but without success.
|
||||
A) Refresh rate control works only for VESA 3.0 and the 3dfx driver (in
|
||||
@@ -107,7 +101,8 @@ FAQ:
|
||||
|
||||
Q) I made a simple application and it does nothing. It exits right away. Not
|
||||
even a blank screen.
|
||||
A) Pure software drivers (VESA/VGA/NUL) support only double-buffered modes.
|
||||
A) Software drivers (VESA/VGA/NUL) must to be constructed as single-buffered
|
||||
visuals. However, DMesaSwapBuffers must be called to get any output.
|
||||
A) Another weird "feature" is that buffer width must be multiple of 8 (I'm a
|
||||
lazy programmer and I found that the easiest way to keep buffer handling
|
||||
at peak performance ;-).
|
||||
@@ -265,6 +260,11 @@ v1.7 (???-2005)
|
||||
* no more GLX sources in DOS GLUT
|
||||
* made GLUT timer callbacks less accurate but safer
|
||||
|
||||
v1.8 (apr-2006)
|
||||
* killed lots of code, the driver is now a front-end to OSMesa
|
||||
* fixed problem with WinNT (http://www.volny.cz/martin.sulak/)
|
||||
- removed 3dfx Glide3 support (temporarily?)
|
||||
|
||||
|
||||
|
||||
Contact:
|
||||
|
@@ -1,15 +1,15 @@
|
||||
File: docs/README.WIN32
|
||||
|
||||
Last updated: Jul 01, 2005 - Karl Schultz - kschultz@users.sourceforge.net
|
||||
Last updated: Mar 31, 2006 - Karl Schultz - kschultz@users.sourceforge.net
|
||||
|
||||
Quick Start
|
||||
----- -----
|
||||
|
||||
Unzip both ZIP files (MesaLib and MesaDemos) into the same directory.
|
||||
The libs and demos build separately, so if you do not care about the
|
||||
demos, you do not have to unzip that zip file. But if you do, it does
|
||||
need to be unzipped into the same directory as the lib zip file
|
||||
because the demos depend on the libs.
|
||||
Unzip the MesaLib, MesaGLUT, and MesaDemos ZIP files into the same
|
||||
directory. The libs and demos build separately, so if you do not care
|
||||
about the demos or GLUT, you only need to unzip MesaLib. If you unzip
|
||||
more than one ZIP file, they all need to be unzipped into the same
|
||||
directory. Don't worry, you will not overwrite anything.
|
||||
|
||||
The Windows build system uses Microsoft Visual Studio. Project files
|
||||
for a specific version of Visual Studio are in their own directory in
|
||||
@@ -22,6 +22,10 @@ of Version 8 and it runs on 64-bit Windows. If you want to try this,
|
||||
start by importing the VC7 files and create the 64-bit targets in the
|
||||
configuration manager.
|
||||
|
||||
It is likely that the new and free Visual Studio Express can be used
|
||||
to build Mesa, but it hasn't been tried yet. Start with the VC7
|
||||
project files.
|
||||
|
||||
The project files to build the core Mesa library, Windows Mesa
|
||||
drivers, OSMesa, and GLU are in the mesa directory. The project files
|
||||
to build GLUT and some demo programs are in the progs directory.
|
||||
@@ -33,10 +37,11 @@ from the projects using Visual Studio.
|
||||
Windows Drivers
|
||||
------- -------
|
||||
|
||||
At this time, only the GDI driver is known to work, as it has been
|
||||
ported and rewritten to the latest Mesa DD interfaces. Source code
|
||||
also exists in the tree for other drivers in src/mesa/drivers/windows,
|
||||
but the status of this code is unknown.
|
||||
At this time, only the GDI driver is known to work. Most of the demos
|
||||
in progs/demos should work with this driver.
|
||||
|
||||
Source code also exists in the tree for other drivers in
|
||||
src/mesa/drivers/windows, but the status of this code is unknown.
|
||||
|
||||
The GDI driver operates basically by writing pixel spans into a DIB
|
||||
section and then blitting the DIB to the window. The driver was
|
||||
@@ -86,6 +91,14 @@ simply run the demo executables from the demo directory.
|
||||
If you want to run the demos from the Visual Studio, you may have to
|
||||
change the startup directory and explicitly state where the executables are.
|
||||
|
||||
You may also build all the demo programs by using a makefile. Go to
|
||||
the progs/demos directory and make sure you have executed VCVARS32.BAT
|
||||
or whatever setup script is appropriate for your compiler. Then,
|
||||
|
||||
nmake -f Makefile.win
|
||||
|
||||
should build all the demos.
|
||||
|
||||
|
||||
Build System Notes
|
||||
----- ------ -----
|
||||
@@ -98,6 +111,9 @@ language files, without a lot of unnatural tweaking. So, the VC6
|
||||
build process uses custom build steps to compile these files in the
|
||||
GLU library.
|
||||
|
||||
Two additional configurations are provided, Debug x86 and Release x86
|
||||
that activate the shader code compilation by defining SLANG_86. It is
|
||||
unknown if and how this works.
|
||||
|
||||
VC7
|
||||
---
|
||||
|
47
docs/RELNOTES-6.4.1
Normal file
47
docs/RELNOTES-6.4.1
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
Mesa 6.4.1 Release Notes
|
||||
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Mesa uses an even/odd version number scheme like the Linux kernel.
|
||||
Odd numbered versions (such as 6.3) designate new developmental releases.
|
||||
Even numbered versions (such as 6.4) designate stable releases.
|
||||
|
||||
|
||||
6.4.1 is a bug-fix release. See the VERSIONS file for details.
|
||||
|
||||
|
||||
|
||||
GLUT tarball
|
||||
------------
|
||||
|
||||
Starting with 6.4, the GLUT library sources are distributed in a separate
|
||||
tarball. This was done at the request of Linux distro vendors who prefer
|
||||
to use freeglut.
|
||||
|
||||
|
||||
|
||||
|
||||
Driver Status
|
||||
---------------------- ----------------------
|
||||
DRI drivers varies with the driver
|
||||
XMesa (Xlib) implements OpenGL 1.5
|
||||
OSMesa (off-screen) implements OpenGL 1.5
|
||||
Windows/Win32 implements OpenGL 1.5
|
||||
Glide (3dfx Voodoo1/2) requires updates
|
||||
SVGA requires updates
|
||||
DJGPP requires updates
|
||||
GGI requires updates
|
||||
BeOS requires updates
|
||||
Allegro requires updates
|
||||
D3D requires updates
|
||||
|
||||
The drivers which require updates mostly need to be updated to work
|
||||
with the new gl_renderbuffer / gl_framebuffer infrastructure introduced
|
||||
in Mesa 6.3.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
$Id: RELNOTES-6.4.1,v 3.1 2006/02/03 17:21:54 brianp Exp $
|
47
docs/RELNOTES-6.4.2
Normal file
47
docs/RELNOTES-6.4.2
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
Mesa 6.4.2 Release Notes
|
||||
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Mesa uses an even/odd version number scheme like the Linux kernel.
|
||||
Odd numbered versions (such as 6.3) designate new developmental releases.
|
||||
Even numbered versions (such as 6.4) designate stable releases.
|
||||
|
||||
|
||||
6.4.2 is a minor bug-fix release. See the VERSIONS file for details.
|
||||
|
||||
|
||||
|
||||
GLUT tarball
|
||||
------------
|
||||
|
||||
Starting with 6.4, the GLUT library sources are distributed in a separate
|
||||
tarball. This was done at the request of Linux distro vendors who prefer
|
||||
to use freeglut.
|
||||
|
||||
|
||||
|
||||
|
||||
Driver Status
|
||||
---------------------- ----------------------
|
||||
DRI drivers varies with the driver
|
||||
XMesa (Xlib) implements OpenGL 1.5
|
||||
OSMesa (off-screen) implements OpenGL 1.5
|
||||
Windows/Win32 implements OpenGL 1.5
|
||||
Glide (3dfx Voodoo1/2) requires updates
|
||||
SVGA requires updates
|
||||
DJGPP requires updates
|
||||
GGI requires updates
|
||||
BeOS requires updates
|
||||
Allegro requires updates
|
||||
D3D requires updates
|
||||
|
||||
The drivers which require updates mostly need to be updated to work
|
||||
with the new gl_renderbuffer / gl_framebuffer infrastructure introduced
|
||||
in Mesa 6.3.
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
$Id: RELNOTES-6.4.2,v 3.1 2006/02/03 17:21:54 brianp Exp $
|
@@ -1,7 +1,5 @@
|
||||
|
||||
Mesa 6.5 Release Notes
|
||||
|
||||
month, day, 2005
|
||||
Mesa 6.5 Release Notes
|
||||
|
||||
|
||||
|
||||
@@ -17,23 +15,29 @@ Even numbered versions (such as 6.4) designate stable releases.
|
||||
New Features
|
||||
------------
|
||||
|
||||
GL_EXT_timer_query - used to get elapsed time information from the renderer.
|
||||
OpenGL Shading language support
|
||||
This includes the GL_ARB_shader_objects, GL_ARB_shading_language_100,
|
||||
GL_ARB_vertex_shader and GL_ARB_fragment_shader extensions. Most of
|
||||
the work was done by Michal Krol.
|
||||
There's probably a fair number of bugs since this is a pretty large,
|
||||
complicated body of code.
|
||||
|
||||
The OpenGL 2.0 interface to these features will be implemented in a
|
||||
future version of Mesa,
|
||||
|
||||
GL_EXT_timer_query
|
||||
Used to measure the time of OpenGL operations at high precision.
|
||||
Only supported in the software/Xlib driver at this time.
|
||||
|
||||
Driver Interface Changes
|
||||
------------------------
|
||||
GL_EXT_packed_depth_stencil
|
||||
Defines a new GL_DEPTH_STENCIL_EXT pixel format.
|
||||
|
||||
Stencil: The Driver.StencilOp/Func/Mask() functions have been replaced by
|
||||
the two-sided versions: Driver.Stencil*Separate().
|
||||
|
||||
|
||||
|
||||
To Do
|
||||
-----
|
||||
Fix linux-glide target/driver.
|
||||
Fix lambda calculation for frag progs.
|
||||
GL_EXT_framebuffer_blit
|
||||
A simplified glCopyPixels-like feature for copying pixel rectangles.
|
||||
|
||||
GL_ARB_half_float_pixel
|
||||
Adds a new half-precision floating point format for image transfers,
|
||||
such as for glDrawPixels, glReadPixels, glTexImage, etc.
|
||||
|
||||
|
||||
|
||||
@@ -46,18 +50,37 @@ The following extensions have been removed:
|
||||
|
||||
|
||||
|
||||
Known Issues
|
||||
------------
|
||||
|
||||
Rendering to depth textures will not work. Rendering to GL_DEPTH_STENCIL
|
||||
textures should work.
|
||||
|
||||
|
||||
|
||||
Driver Interface Changes
|
||||
------------------------
|
||||
|
||||
Stencil: The Driver.StencilOp/Func/Mask() functions have been replaced by
|
||||
the two-sided versions: Driver.Stencil*Separate().
|
||||
|
||||
Render-to-texture: The functions for rendering to textures have changed.
|
||||
|
||||
|
||||
|
||||
To Do (someday) items
|
||||
---------------------
|
||||
Switch to freeglut
|
||||
Increase MAX_DRAWBUFFERS
|
||||
|
||||
Fix linux-glide target/driver.
|
||||
Fix lambda calculation for frag progs.
|
||||
|
||||
|
||||
|
||||
Driver Status
|
||||
---------------------- ----------------------
|
||||
DRI drivers varies with the driver
|
||||
XMesa (Xlib) implements OpenGL 1.5
|
||||
XMesa/GLX (on Xlib) implements OpenGL 1.5
|
||||
OSMesa (off-screen) implements OpenGL 1.5
|
||||
Glide (3dfx Voodoo1/2) implements OpenGL 1.3
|
||||
SVGA implements OpenGL 1.3
|
||||
@@ -71,4 +94,4 @@ D3D needs updating
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
$Id: RELNOTES-6.5,v 3.1 2005/09/14 14:34:54 brianp Exp $
|
||||
$Id: RELNOTES-6.5,v 3.4 2006/03/29 04:53:02 brianp Exp $
|
||||
|
@@ -1407,10 +1407,42 @@ Mesa Version History
|
||||
- fragment programs that wrote result.depth.z didn't work
|
||||
|
||||
|
||||
6.5 month, day, 2005
|
||||
6.4.1 November 30, 2005
|
||||
Bug fixes:
|
||||
- redefining a vertex program string didn't take effect in TNL module
|
||||
- fixed occasional segfault upon vertex/fragment parsing error
|
||||
- vertex program LIT instruction didn't handle 0^0=1 correctly
|
||||
- fragment program fog option didn't work with glDrawPixels, glBitmap
|
||||
- USE_MGL_NAMESPACE didn't work for x86-64
|
||||
- OSMesa demos were missing from previous release tarballs
|
||||
- fixed problem with float->ushort conversion in glClear (bug 4992)
|
||||
- popping of GL_EYE_PLANE texgen state was broken (bug 4996)
|
||||
- popping of GL_SPOT_DIRECTION light state was broken (bug 5005)
|
||||
- fixed occasional triangle color interpolation problem on VMS
|
||||
- work around invalid free() call (bug 5131)
|
||||
- fixed BSD X server compilation problem by including stdint.h
|
||||
|
||||
|
||||
6.4.2 February 2, 2006
|
||||
New:
|
||||
- added OSMesaColorClamp() function/feature
|
||||
- added wglGetExtensionStringARB() function
|
||||
Bug fixes:
|
||||
- fixed some problems when building on Windows
|
||||
- GLw header files weren't installed by installmesa script (bug 5396)
|
||||
- GL/glfbdev.h file was missing from tarballs
|
||||
- fixed TNL initialization bug which could lead to crash (bug 5791)
|
||||
|
||||
|
||||
6.5 March 31, 2006
|
||||
New:
|
||||
- OpenGL Shading Language support through GL_ARB_shader_objects,
|
||||
GL_ARB_shading_language_100, GL_ARB_vertex_shader and
|
||||
GL_ARB_fragment_shader (done by Michal Krol)
|
||||
- GL_EXT_packed_depth_stencil extension
|
||||
- GL_EXT_timer_query extension
|
||||
- GL_EXT_framebuffer_blit extension
|
||||
- GL_ARB_half_float_pixel
|
||||
- reflect demo improved to support multiple windows
|
||||
- singlebuffer demo (shows no/little-flicker single-buffered rendering)
|
||||
- r200: enable GL_ARB_texture_env_crossbar, separate the texture
|
||||
@@ -1420,8 +1452,21 @@ Mesa Version History
|
||||
- radeon: add support for all 3 tmus, GL_ARB_texture_cube_map
|
||||
and GL_EXT_fog_coord
|
||||
- MESA_GLX_ALPHA_BITS env var for xlib driver
|
||||
- many DRI driver updates (including screen rotation support
|
||||
for the Intel DRI driver)
|
||||
Changes:
|
||||
- removed GL_HP_occlusion_test (use GL_ARB_occlusion_query instead)
|
||||
- removed GL_SGIX/SGIS_pixel_texture extensions
|
||||
Bug fixes:
|
||||
|
||||
- fixed glxcontextmodes.c datatype problem (bug 5835)
|
||||
- fixed aix-gcc build/install bugs (bug 5874)
|
||||
- fixed some bugs in texture env program generation
|
||||
- glXCopyContext() didn't handle texture object bindings properly
|
||||
- glXCopyContext() didn't copy all lighting state
|
||||
- fixed FreeBSD config (Pedro Giffuni)
|
||||
- fixed some minor framebuffer object bugs
|
||||
- replaced dprintf() with _glu_printf() in GLU (bug 6244)
|
||||
- fixed a number of thread safety bugs/regressions
|
||||
- fixed a number of GLU tesselator bugs (John Shell, bug 6339)
|
||||
- paletted texturing was broken w/ floating point palettes (K. Schultz)
|
||||
- lots of assorted framebuffer object bug fixes
|
||||
|
@@ -40,14 +40,14 @@ Here are the basic instructions for Unix systems:
|
||||
Version 1.9.28 is known to work.
|
||||
<li>Login as an anonymous user:
|
||||
<pre>
|
||||
cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/mesa login
|
||||
cvs -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/mesa login
|
||||
</pre>
|
||||
Just press Enter/Return when prompted for a password.
|
||||
<br>
|
||||
<br>
|
||||
<li>Check out the code:
|
||||
<pre>
|
||||
cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/mesa co Mesa
|
||||
cvs -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/mesa co Mesa
|
||||
</pre>
|
||||
</ol>
|
||||
|
||||
@@ -56,7 +56,7 @@ Here are the basic instructions for Unix systems:
|
||||
|
||||
<ol>
|
||||
<li><code>cd Mesa</code>
|
||||
<li><code>cvs -z3 -d:pserver:anonymous@pdx.freedesktop.org:/cvs/mesa update</code>
|
||||
<li><code>cvs -z3 -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/mesa update</code>
|
||||
</ol>
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ with:
|
||||
</pre>
|
||||
followed by:
|
||||
<pre>
|
||||
cvs -d:ext:yourusername@pdx.freedesktop.org:/cvs/mesa co Mesa
|
||||
cvs -d:ext:yourusername@cvs.freedesktop.org:/cvs/mesa co Mesa
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
|
@@ -83,7 +83,7 @@ Brace example:
|
||||
Here's the GNU indent command which will best approximate my preferred style:
|
||||
</p>
|
||||
<pre>
|
||||
indent -br -i3 -npcs infile.c -o outfile.c
|
||||
indent -br -i3 -npcs --no-tabs infile.c -o outfile.c
|
||||
</pre>
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ DEMO_NAME are correct.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Update the docs/news.html file and docs/contents.html files.
|
||||
Update the docs/news.html file and docs/download.html files.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@@ -9,11 +9,11 @@
|
||||
<H1>Downloading</H1>
|
||||
|
||||
<p>
|
||||
Last development release: <b>6.3.2</b>
|
||||
Last development release: <b>6.5</b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Last stable release: <b>6.2.1</b>
|
||||
Last stable release: <b>6.4.2</b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@@ -23,16 +23,17 @@ generate exceptions.
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
The following environment variables are only applicable to the Xlib/X11
|
||||
software driver:
|
||||
The following are only applicable to the Xlib software driver.
|
||||
See <A HREF="README.X11">README.X11</A> for details.
|
||||
</p>
|
||||
<ul>
|
||||
<li>MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode (X only)
|
||||
<li>MESA_CI_VISUAL - specifies the X visual and depth for CI mode (X only)
|
||||
<li>MESA_BACK_BUFFER - specifies how to implement the back color buffer (X only)
|
||||
<li>MESA_GAMMA - gamma correction coefficients (X only)
|
||||
<li>MESA_XSYNC - enable synchronous X behavior (for X debugging only)
|
||||
<li>MESA_GLX_FORCE_CI - if set, force GLX to treak 8bpp visuals as CI visuals
|
||||
<li>MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode
|
||||
<li>MESA_CI_VISUAL - specifies the X visual and depth for CI mode
|
||||
<li>MESA_BACK_BUFFER - specifies how to implement the back color buffer,
|
||||
either "pixmap" or "ximage"
|
||||
<li>MESA_GAMMA - gamma correction coefficients for red, green, blue channels
|
||||
<li>MESA_XSYNC - enable synchronous X behavior (for debugging only)
|
||||
<li>MESA_GLX_FORCE_CI - if set, force GLX to treat 8bpp visuals as CI visuals
|
||||
<li>MESA_GLX_FX - set to either "fullscreen" for full-screen rendering,
|
||||
"window" to render into a window, or "disable" to disable the Glide driver.
|
||||
<li>MESA_GLX_FORCE_ALPHA - if set, forces RGB windows to have an alpha channel.
|
||||
|
@@ -70,13 +70,13 @@ They're found in a module of the DRI CVS tree.
|
||||
To obtain the code do the following:
|
||||
</p>
|
||||
<pre>
|
||||
cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/dri login
|
||||
cvs -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/dri login
|
||||
</pre>
|
||||
<p>
|
||||
Press Enter/Return when prompted for a password. Then,
|
||||
</p>
|
||||
<pre>
|
||||
cvs -d:pserver:anonymous@pdx.freedesktop.org:/cvs/dri co drm
|
||||
cvs -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/dri co drm
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
|
@@ -50,26 +50,18 @@ Rendering Manager) kernel drivers and header files.
|
||||
They're available from the <a href="http://dri.sf.net/" target="_parent">DRI</a> project.
|
||||
</p>
|
||||
<p>
|
||||
You can get them from CVS by doing:
|
||||
Your distribution should already have both the kernel modules and support
|
||||
library already installed. If not, you can get them from CVS by doing:
|
||||
<pre>
|
||||
cvs -d:pserver:anonymous@pds.freedesktop.org:/cvs/dri login
|
||||
(hit enter when prompted for a password)
|
||||
cvs -z3 -d:pserver:anonymous@pdx.freedesktop.org:/cvs/dri co drm
|
||||
cvs -z3 -d:pserver:anonymous@anoncvs.freedesktop.org:/cvs/dri co drm
|
||||
</pre>
|
||||
<p>
|
||||
Make note of the directory in which the drm files are placed.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="http://dri.freedesktop.org/wiki/Building" target="_parent">
|
||||
DRI Building Instructions</a> for the steps to build the DRM modules.
|
||||
DRI Building Instructions</a> for the steps to build the DRM modules. Mesa
|
||||
6.5 requires at least libdrm 2.0.1 or greater.
|
||||
</p>
|
||||
<p>
|
||||
Next, in the <code>Mesa-x.y.z/configs/default</code> file, set the
|
||||
<code>DRM_SOURCE_PATH</code> variable to indicate where the DRM files
|
||||
are located.
|
||||
</p>
|
||||
<p>
|
||||
Now build Mesa and the DRI drivers by running
|
||||
Build Mesa and the DRI drivers by running
|
||||
</p>
|
||||
<pre>
|
||||
make linux-dri
|
||||
|
@@ -21,7 +21,7 @@
|
||||
<li><a href="http://math.nist.gov/f90gl" target="_parent">Fortran77/90 bindings for OpenGL and Mesa</a> - by William Mitchell
|
||||
<li><a href="http://glow.sourceforge.net/" target="_parent">GLOW</a> - a GUI toolkit for GLUT and OpenGL
|
||||
<li><a href="http://www.nigels.com/glt/">Glt</a> - an OpenGL C++ toolkit
|
||||
<li><a href="http://www.opengl.org/developers/documentation/glut/" target="_parent">GLUT (GL Utility Toolkit)</a> - by Mark Kilgard
|
||||
<li><a href="http://www.opengl.org/resources/libraries/glut.html" target="_parent">GLUT (GL Utility Toolkit)</a> - by Mark Kilgard
|
||||
<li><a href="http://atrey.karlin.mff.cuni.cz/%7E0rfelyus/guileGL/" target="_parent">GuileGL</a> - OpenGL and GtkGLArea language bindings for Guile
|
||||
<li><a href="http://www.rsinc.com/" target="_parent">IDL</a> - Interactive Data Language
|
||||
<li><a href="http://www.newplanetsoftware.com/jx/" target="_parent">JX</a> - C++ application framework and GUI library
|
||||
|
@@ -14,7 +14,7 @@
|
||||
</li><li><a href="http://mesa3d.sourceforge.net/notfound.html">ARCAD</a> - CAD program
|
||||
</li><li><a href="http://www.mediascape.com/" target="_parent">Artstream</a> - provides
|
||||
functionality like Corel Draw and Illustrator
|
||||
</li><li><a href="http://www.blender.nl/" target="_parent">Blender</a> - 3-D animation
|
||||
</li><li><a href="http://www.blender.org/" target="_parent">Blender</a> - 3-D animation
|
||||
software
|
||||
</li><li><a href="http://www.arq.net/%7Ekasten/demtools/" target="_parent">Demtools</a>
|
||||
- Map viewer
|
||||
|
118
docs/news.html
118
docs/news.html
@@ -11,6 +11,122 @@
|
||||
<H1>News</H1>
|
||||
|
||||
|
||||
<h2>March 31, 2006</h2>
|
||||
<p>
|
||||
Mesa 6.5 has been released. This is a new development release.
|
||||
</p>
|
||||
<pre>
|
||||
New:
|
||||
- OpenGL Shading Language support through GL_ARB_shader_objects,
|
||||
GL_ARB_shading_language_100, GL_ARB_vertex_shader and
|
||||
GL_ARB_fragment_shader (done by Michal Krol)
|
||||
- GL_EXT_packed_depth_stencil extension
|
||||
- GL_EXT_timer_query extension
|
||||
- GL_EXT_framebuffer_blit extension
|
||||
- GL_ARB_half_float_pixel
|
||||
- GLX_MESA_copy_sub_buffer for DRI drivers (Dave Reveman)
|
||||
- reflect demo improved to support multiple windows
|
||||
- singlebuffer demo (shows no/little-flicker single-buffered rendering)
|
||||
- r200: enable GL_ARB_texture_env_crossbar, separate the texture
|
||||
sampling unit bits from the texture env combine enable bits
|
||||
- r200: add support for GL_ATI_fragment_shader
|
||||
- added fast XOR-mode line drawing optimization
|
||||
- radeon: add support for all 3 tmus, GL_ARB_texture_cube_map
|
||||
and GL_EXT_fog_coord
|
||||
- MESA_GLX_ALPHA_BITS env var for xlib driver
|
||||
- many DRI driver updates (including screen rotation support
|
||||
for the Intel DRI driver)
|
||||
Changes:
|
||||
- removed GL_HP_occlusion_test (use GL_ARB_occlusion_query instead)
|
||||
- removed GL_SGIX/SGIS_pixel_texture extensions
|
||||
Bug fixes:
|
||||
- fixed glxcontextmodes.c datatype problem (bug 5835)
|
||||
- fixed aix-gcc build/install bugs (bug 5874)
|
||||
- fixed some bugs in texture env program generation
|
||||
- glXCopyContext() didn't handle texture object bindings properly
|
||||
- glXCopyContext() didn't copy all lighting state
|
||||
- fixed FreeBSD config (Pedro Giffuni)
|
||||
- fixed some minor framebuffer object bugs
|
||||
- replaced dprintf() with _glu_printf() in GLU (bug 6244)
|
||||
- fixed a number of thread safety bugs/regressions
|
||||
- fixed a number of GLU tesselator bugs (John Shell, bug 6339)
|
||||
- paletted texturing was broken w/ floating point palettes (K. Schultz)
|
||||
- lots of assorted framebuffer object bug fixes
|
||||
</pre>
|
||||
<p>
|
||||
The MD5 checksums are:
|
||||
</p>
|
||||
<pre>
|
||||
TBD
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>February 2, 2006</h2>
|
||||
<p>
|
||||
Mesa 6.4.2 has been released. This is primarily a bug-fix release.
|
||||
</p>
|
||||
<pre>
|
||||
New items:
|
||||
- added OSMesaColorClamp() function/feature
|
||||
- added wglGetExtensionStringARB() function
|
||||
Bug fixes:
|
||||
- fixed some problems when building on Windows
|
||||
- GLw header files weren't installed by installmesa script (bug 5396)
|
||||
- GL/glfbdev.h file was missing from tarballs
|
||||
</pre>
|
||||
<p>
|
||||
The MD5 checksums are:
|
||||
</p>
|
||||
<pre>
|
||||
cb0d745d520fa7c2bb9178058b763544 MesaLib-6.4.2.tar.gz
|
||||
7674d2c603b5834259e4e5a820cefd5b MesaLib-6.4.2.tar.bz2
|
||||
d224e1325b33ff71a0f3893fc6b4d594 MesaLib-6.4.2.zip
|
||||
d4b345d4588fc750cd3d34f3ac26673e MesaDemos-6.4.2.tar.gz
|
||||
9cae1ab874af533ce356bd7dfe2e0bb0 MesaDemos-6.4.2.tar.bz2
|
||||
2da6e1d1245e441d27813595c6ba50de MesaDemos-6.4.2.zip
|
||||
84427d18c3453f0ea52388eeba7169b5 MesaGLUT-6.4.2.tar.gz
|
||||
b157ba8ad1ea63260cf5339132e7aac6 MesaGLUT-6.4.2.tar.bz2
|
||||
fe1523744fc05edc3811dfc6a1bf4181 MesaGLUT-6.4.2.zip
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>November 29, 2005</h2>
|
||||
<p>
|
||||
Mesa 6.4.1 has been released. This is a stable, bug-fix release.
|
||||
</p>
|
||||
<pre>
|
||||
Bug fixes:
|
||||
- redefining a vertex program string didn't take effect in TNL module
|
||||
- fixed occasional segfault upon vertex/fragment parsing error
|
||||
- vertex program LIT instruction didn't handle 0^0=1 correctly
|
||||
- fragment program fog option didn't work with glDrawPixels, glBitmap
|
||||
- USE_MGL_NAMESPACE didn't work for x86-64
|
||||
- OSMesa demos were missing from previous release tarballs
|
||||
- fixed problem with float->ushort conversion in glClear (bug 4992)
|
||||
- popping of GL_EYE_PLANE texgen state was broken (bug 4996)
|
||||
- popping of GL_SPOT_DIRECTION light state was broken (bug 5005)
|
||||
- fixed occasional triangle color interpolation problem on VMS
|
||||
- work around invalid free() call (bug 5131)
|
||||
- fixed BSD X server compilation problem by including stdint.h
|
||||
</pre>
|
||||
<p>
|
||||
The MD5 checksums are:
|
||||
</p>
|
||||
<pre>
|
||||
698ceb574cf882b0226761f5913c0da9 MesaLib-6.4.1.tar.gz
|
||||
ea148c828ec6f645526451db1b8556f1 MesaLib-6.4.1.tar.bz2
|
||||
42e93279468975ed2bf3111b8721e5d9 MesaLib-6.4.1.zip
|
||||
e3b0d50807fd2bdcd1a95aaddd786f13 MesaDemos-6.4.1.tar.gz
|
||||
99df1fdcb98d391666b476ca6f1dda8a MesaDemos-6.4.1.tar.bz2
|
||||
b999d2c6d92fb4b7740a3dbd889348e3 MesaDemos-6.4.1.zip
|
||||
eadfe01fe5ddfb1eb8227dd567b31635 MesaGLUT-6.4.1.tar.gz
|
||||
bd003bb4f981a4f91dee4c38644d4f3f MesaGLUT-6.4.1.tar.bz2
|
||||
71c401c037088bf688a88afdaeb3420f MesaGLUT-6.4.1.zip
|
||||
</pre>
|
||||
|
||||
|
||||
|
||||
|
||||
<h2>October 24, 2005</h2>
|
||||
<p>
|
||||
Mesa 6.4 has been released. This is a stable, bug-fix release.
|
||||
@@ -1102,6 +1218,6 @@ source code</a>.</p>
|
||||
|
||||
|
||||
<hr>
|
||||
$Id: news.html,v 3.25 2005/10/24 23:33:27 brianp Exp $
|
||||
$Id: news.html,v 3.27 2006/03/31 23:10:21 brianp Exp $
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -13,6 +13,8 @@ The release notes summarize what's new or changed in each Mesa release.
|
||||
</p>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="RELNOTES-6.4.2">RELNOTES-6.4.2</A>
|
||||
<LI><A HREF="RELNOTES-6.4.1">RELNOTES-6.4.1</A>
|
||||
<LI><A HREF="RELNOTES-6.4">RELNOTES-6.4</A>
|
||||
<LI><A HREF="RELNOTES-6.3.2">RELNOTES-6.3.2</A>
|
||||
<LI><A HREF="RELNOTES-6.3">RELNOTES-6.3</A>
|
||||
|
@@ -23,9 +23,9 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP device driver v1.7 for Mesa
|
||||
* DOS/DJGPP device driver for Mesa
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Author: Daniel Borca
|
||||
* Email : dborca@users.sourceforge.net
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
@@ -35,7 +35,7 @@
|
||||
#define DMESA_H_included
|
||||
|
||||
#define DMESA_MAJOR_VERSION 6
|
||||
#define DMESA_MINOR_VERSION 3
|
||||
#define DMESA_MINOR_VERSION 5
|
||||
|
||||
/* Sample Usage:
|
||||
*
|
||||
@@ -138,7 +138,7 @@ void DMesaSetCI (int ndx, GLfloat red, GLfloat green, GLfloat blue);
|
||||
/*
|
||||
* DMesa functions
|
||||
*/
|
||||
typedef void (*DMesaProc) (void);
|
||||
typedef void (*DMesaProc) ();
|
||||
DMesaProc DMesaGetProcAddress (const char *name);
|
||||
|
||||
/*
|
||||
@@ -149,8 +149,8 @@ DMesaProc DMesaGetProcAddress (const char *name);
|
||||
#define DMESA_GET_VIDEO_MODES 0x0300
|
||||
#define DMESA_GET_BUFFER_ADDR 0x0400
|
||||
|
||||
#define DMESA_DRIVER_SWDB_BIT 0x1 /* software double-buffered */
|
||||
#define DMESA_DRIVER_LLWO_BIT 0x2 /* lower-left window origin */
|
||||
#define DMESA_DRIVER_DBL_BIT 0x1 /* double-buffered */
|
||||
#define DMESA_DRIVER_YUP_BIT 0x2 /* lower-left window origin */
|
||||
int DMesaGetIntegerv (GLenum pname, GLint *params);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.3
|
||||
* Version: 6.5
|
||||
*
|
||||
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2006 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"),
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.5
|
||||
*
|
||||
* Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2006 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"),
|
||||
@@ -379,6 +379,60 @@ extern Bool glXDrawableAttribARB(Display *dpy, GLXDrawable draw, const int *attr
|
||||
#endif /* GLX_NV_float_buffer */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* #?. GLX_MESA_swap_frame_usage
|
||||
*/
|
||||
#ifndef GLX_MESA_swap_frame_usage
|
||||
#define GLX_MESA_swap_frame_usage 1
|
||||
|
||||
extern int glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable, float *usage);
|
||||
extern int glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable);
|
||||
extern int glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable);
|
||||
extern int glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage);
|
||||
|
||||
typedef int (*PFNGLXGETFRAMEUSAGEMESAPROC) (Display *dpy, GLXDrawable drawable, float *usage);
|
||||
typedef int (*PFNGLXBEGINFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable);
|
||||
typedef int (*PFNGLXENDFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable);
|
||||
typedef int (*PFNGLXQUERYFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage);
|
||||
|
||||
#endif /* GLX_MESA_swap_frame_usage */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* #?. GLX_MESA_swap_control
|
||||
*/
|
||||
#ifndef GLX_MESA_swap_control
|
||||
#define GLX_MESA_swap_control 1
|
||||
|
||||
extern int glXSwapIntervalMESA(unsigned int interval);
|
||||
extern int glXGetSwapIntervalMESA(void);
|
||||
|
||||
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(unsigned int interval);
|
||||
typedef int (*PFNGLXGETSWAPINTERVALMESAPROC)(void);
|
||||
|
||||
#endif /* GLX_MESA_swap_control */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* #?. GLX_EXT_texture_from_pixmap
|
||||
* XXX not finished?
|
||||
*/
|
||||
#ifndef GLX_EXT_texture_from_pixmap
|
||||
#define GLX_EXT_texture_from_pixmap 1
|
||||
|
||||
/* XXX need enums/tokens! */
|
||||
|
||||
extern Bool glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer);
|
||||
extern Bool glXReleaseTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer);
|
||||
|
||||
#endif /* GLX_EXT_texture_from_pixmap */
|
||||
|
||||
|
||||
|
||||
|
||||
/*** Should these go here, or in another header? */
|
||||
/*
|
||||
** GLX Events
|
||||
|
@@ -331,7 +331,7 @@ typedef struct {
|
||||
} GLXBufferClobberEventSGIX;
|
||||
#endif
|
||||
|
||||
#if defined(__sun__)
|
||||
#if defined(__sun__) || defined(__osf__)
|
||||
#include <inttypes.h>
|
||||
#if defined(__STDC__)
|
||||
#if defined(__arch64__)
|
||||
|
@@ -472,6 +472,14 @@ struct __DRIdrawableRec {
|
||||
* \since Internal API version 20030317.
|
||||
*/
|
||||
unsigned swap_interval;
|
||||
|
||||
/**
|
||||
* Used by drivers that implement the GLX_MESA_copy_sub_buffer extension.
|
||||
*
|
||||
* \since Internal API version 20060314.
|
||||
*/
|
||||
void (*copySubBuffer)(__DRInativeDisplay *dpy, void *drawablePrivate,
|
||||
int x, int y, int w, int h);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -111,6 +111,15 @@ WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDE
|
||||
WGLAPI int GLAPIENTRY GetPixelFormat(HDC);
|
||||
WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
|
||||
|
||||
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#define WGL_ARB_extensions_string 1
|
||||
|
||||
WGLAPI const char * GLAPIENTRY wglGetExtensionsStringARB(HDC hdc);
|
||||
|
||||
#endif /* WGL_ARB_extensions_string */
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning( pop )
|
||||
#endif
|
||||
|
@@ -100,15 +100,14 @@ extern WMesaContext WMesaCreateContext(HDC hDC,HPALETTE* pPal,
|
||||
/*
|
||||
* Destroy a rendering context as returned by WMesaCreateContext()
|
||||
*/
|
||||
/*extern void WMesaDestroyContext( WMesaContext ctx );*/
|
||||
extern void WMesaDestroyContext( void );
|
||||
extern void WMesaDestroyContext( WMesaContext ctx );
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Make the specified context the current one.
|
||||
*/
|
||||
extern void WMesaMakeCurrent( WMesaContext ctx );
|
||||
extern void WMesaMakeCurrent( WMesaContext ctx, HDC hdc );
|
||||
|
||||
|
||||
/*
|
||||
@@ -121,7 +120,7 @@ extern WMesaContext WMesaGetCurrentContext( void );
|
||||
* Swap the front and back buffers for the current context. No action
|
||||
* taken if the context is not double buffered.
|
||||
*/
|
||||
extern void WMesaSwapBuffers(void);
|
||||
extern void WMesaSwapBuffers(HDC hdc);
|
||||
|
||||
|
||||
/*
|
||||
|
@@ -64,6 +64,7 @@ typedef XColor XMesaColor;
|
||||
|
||||
#define XMesaDrawPoint XDrawPoint
|
||||
#define XMesaDrawPoints XDrawPoints
|
||||
#define XMesaDrawLine XDrawLine
|
||||
#define XMesaFillRectangle XFillRectangle
|
||||
#define XMesaPutImage XPutImage
|
||||
#define XMesaCopyArea XCopyArea
|
||||
|
@@ -95,6 +95,18 @@ do { \
|
||||
(*gc->ops->PolyPoint)(__b, __gc, __m, __n, __p); \
|
||||
} while (0)
|
||||
|
||||
#define XMesaDrawLine(__d, __b, __gc, __x0, __y0, __x1, __y1) \
|
||||
do { \
|
||||
XMesaPoint __p[2]; \
|
||||
(void) __d; \
|
||||
__p[0].x = __x0; \
|
||||
__p[0].y = __y0; \
|
||||
__p[1].x = __x1; \
|
||||
__p[1].y = __y1; \
|
||||
ValidateGC(__b, __gc); \
|
||||
(*gc->ops->PolyLines)(__b, __gc, CoordModeOrigin, 2, __p); \
|
||||
} while (0)
|
||||
|
||||
#define XMesaFillRectangle(__d,__b,__gc,__x,__y,__w,__h) \
|
||||
do { \
|
||||
xRectangle __r[1]; \
|
||||
|
@@ -64,9 +64,7 @@
|
||||
** Versioning and extensions
|
||||
*/
|
||||
#define EGL_VERSION_1_0 1
|
||||
#if 0
|
||||
#define EGL_VERSION_1_1 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Boolean
|
||||
@@ -269,6 +267,56 @@ GLAPI EGLBoolean APIENTRY eglCopyContextMESA(EGLDisplay dpy, EGLContext source,
|
||||
#endif /* EGL_MESA_copy_context */
|
||||
|
||||
|
||||
/* XXX this is preliminary! */
|
||||
#ifndef EGL_VERSION_1_2
|
||||
#define EGL_VERSION_1_2 1
|
||||
|
||||
typedef int EGLenum;
|
||||
typedef int EGLClientBuffer;
|
||||
|
||||
#define EGL_DISPLAY_SCALING 10000
|
||||
#define EGL_UNKNOWN ((EGLint)-1)
|
||||
|
||||
#define EGL_OPENGL_ES_BIT 0x1
|
||||
#define EGL_OPENVG_BIT 0x2
|
||||
|
||||
#define EGL_OPENGL_ES_API 0x30A0
|
||||
#define EGL_OPENVG_API 0x30A1
|
||||
|
||||
#define EGL_LUMINANCE_SIZE 0x303D
|
||||
#define EGL_ALPHA_MASK_SIZE 0x303E
|
||||
#define EGL_COLOR_BUFFER_TYPE 0x303F
|
||||
#define EGL_RENDERABLE_TYPE 0x3040
|
||||
|
||||
#define EGL_SINGLE_BUFFER 0x3085
|
||||
#define EGL_RENDER_BUFFER 0x3086
|
||||
#define EGL_COLORSPACE 0x3087
|
||||
#define EGL_ALPHA_FORMAT 0x3088
|
||||
#define EGL_COLORSPACE_sRGB 0x3089
|
||||
#define EGL_COLORSPACE_LINEAR 0x308A
|
||||
#define EGL_ALPHA_FORMAT_NONPRE 0x308B
|
||||
#define EGL_ALPHA_FORMAT_PRE 0x308C
|
||||
#define EGL_CLIENT_APIS 0x308D
|
||||
#define EGL_RGB_BUFFER 0x308E
|
||||
#define EGL_LUMINANCE_BUFFER 0x308F
|
||||
#define EGL_HORIZONTAL_RESOLUTION 0x3090
|
||||
#define EGL_VERTICAL_RESOLUTION 0x3091
|
||||
#define EGL_PIXEL_ASPECT_RATIO 0x3092
|
||||
#define EGL_SWAP_BEHAVIOR 0x3093
|
||||
#define EGL_BUFFER_PRESERVED 0x3094
|
||||
#define EGL_BUFFER_DESTROYED 0x3095
|
||||
#define EGL_OPENVG_IMAGE 0x3096
|
||||
#define EGL_CONTEXT_CLIENT_TYPE 0x3097
|
||||
|
||||
GLAPI EGLBoolean APIENTRY eglBindAPI(EGLenum api);
|
||||
GLAPI EGLenum APIENTRY eglQueryAPI(void);
|
||||
GLAPI EGLBoolean APIENTRY eglWaitClient(void);
|
||||
GLAPI EGLBoolean APIENTRY eglReleaseThread(void);
|
||||
GLAPI EGLSurface APIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
|
||||
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -31,6 +31,8 @@ readtex.h
|
||||
reflect
|
||||
renormal
|
||||
shadowtex
|
||||
showbuffer.c
|
||||
showbuffer.h
|
||||
spectex
|
||||
stex3d
|
||||
teapot
|
||||
|
@@ -15,22 +15,22 @@ LIB_DEP = $(LIB_DIR)/$(GL_LIB_NAME) $(LIB_DIR)/$(GLU_LIB_NAME) $(LIB_DIR)/$(GLUT
|
||||
|
||||
PROGS = \
|
||||
arbfplight \
|
||||
arbfslight \
|
||||
arbocclude \
|
||||
bounce \
|
||||
clearspd \
|
||||
cubemap \
|
||||
drawpix \
|
||||
copypix \
|
||||
drawpix_pbo \
|
||||
fire \
|
||||
fogcoord \
|
||||
fplight \
|
||||
gamma \
|
||||
gears \
|
||||
gearbox \
|
||||
gears \
|
||||
geartrain \
|
||||
glinfo \
|
||||
gloss \
|
||||
glslnoise \
|
||||
gltestperf \
|
||||
glutfx \
|
||||
isosurf \
|
||||
@@ -54,7 +54,7 @@ PROGS = \
|
||||
terrain \
|
||||
tessdemo \
|
||||
texcyl \
|
||||
texdown-pool \
|
||||
texdown \
|
||||
texenv \
|
||||
texobj \
|
||||
trispd \
|
||||
@@ -76,8 +76,9 @@ PROGS = \
|
||||
|
||||
##### TARGETS #####
|
||||
|
||||
default: readtex.o $(PROGS)
|
||||
default: $(PROGS)
|
||||
|
||||
$(PROGS): readtex.o
|
||||
|
||||
readtex.c: $(TOP)/progs/util/readtex.c
|
||||
cp $< .
|
||||
|
118
progs/demos/Makefile.win
Normal file
118
progs/demos/Makefile.win
Normal file
@@ -0,0 +1,118 @@
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 6.5
|
||||
# Copyright (C) 1995-2006 Brian Paul
|
||||
|
||||
# Makefile for GLUT-based demo programs for Windows
|
||||
|
||||
# Build the Mesa and GLUT libraries by using the Visual Studio
|
||||
# Workspaces in this distribution before running this Makefile.
|
||||
|
||||
# Invocation: nmake -f Makefile.win
|
||||
|
||||
NODEBUG=1
|
||||
!include <win32.mak>
|
||||
|
||||
##### MACROS #####
|
||||
|
||||
TOP = ..\..
|
||||
INCDIR = ..\..\include
|
||||
LIBDIR = ..\..\lib
|
||||
LIBS = GLUT32.LIB OPENGL32.LIB
|
||||
|
||||
all: OPENGL32.DLL GLU32.DLL GLUT32.DLL \
|
||||
readtex.h readtex.c showbuffer.h showbuffer.c \
|
||||
arbfplight.exe arbfslight.exe arbocclude.exe bounce.exe \
|
||||
clearspd.exe cubemap.exe drawpix.exe fire.exe fogcoord.exe \
|
||||
fplight.exe gamma.exe gearbox.exe \
|
||||
gears.exe geartrain.exe gloss.exe \
|
||||
glinfo.exe glslnoise.exe \
|
||||
gltestperf.exe glutfx.exe ipers.exe isosurf.exe lodbias.exe \
|
||||
morph3d.exe multiarb.exe occlude.exe paltex.exe pointblast.exe \
|
||||
ray.exe readpix.exe reflect.exe renormal.exe \
|
||||
shadowtex.exe singlebuffer.exe spectex.exe spriteblast.exe \
|
||||
stex3d.exe teapot.exe terrain.exe tessdemo.exe texcyl.exe \
|
||||
texdown.exe texenv.exe texobj.exe trispd.exe tunnel.exe tunnel2.exe \
|
||||
winpos.exe
|
||||
|
||||
arbfplight.exe: arbfplight.obj
|
||||
arbfslight.exe: arbfslight.obj
|
||||
arbocclude.exe: arbocclude.obj
|
||||
bounce.exe: bounce.obj
|
||||
clearspd.exe: clearspd.obj
|
||||
cubemap.exe: cubemap.obj readtex.obj
|
||||
drawpix.exe: drawpix.obj readtex.obj
|
||||
fire.exe: fire.obj readtex.obj
|
||||
fogcoord.exe: fogcoord.obj readtex.obj
|
||||
fplight.exe: fplight.obj
|
||||
gamma.exe: gamma.obj
|
||||
gearbox.exe: gearbox.obj
|
||||
gears.exe: gears.obj
|
||||
geartrain.exe: geartrain.obj
|
||||
gloss.exe: gloss.obj readtex.obj
|
||||
glinfo.exe: glinfo.obj
|
||||
glslnoise.exe: glslnoise.obj
|
||||
gltestperf.exe: gltestperf.obj
|
||||
glutfx.exe: glutfx.obj
|
||||
ipers.exe: ipers.obj readtex.obj
|
||||
isosurf.exe: isosurf.obj readtex.obj
|
||||
lodbias.exe: lodbias.obj readtex.obj
|
||||
morph3d.exe: morph3d.obj
|
||||
multiarb.exe: multiarb.obj readtex.obj
|
||||
occlude.exe: occlude.obj
|
||||
paltex.exe: paltex.obj
|
||||
pointblast.exe: pointblast.obj
|
||||
ray.exe: ray.obj
|
||||
readpix.exe: readpix.obj readtex.obj
|
||||
reflect.exe: reflect.obj readtex.obj showbuffer.obj
|
||||
renormal.exe: renormal.obj
|
||||
shadowtex.exe: shadowtex.obj showbuffer.obj
|
||||
singlebuffer.exe: singlebuffer.obj
|
||||
spectex.exe: spectex.obj
|
||||
spriteblast.exe: spriteblast.obj
|
||||
stex3d.exe: stex3d.obj
|
||||
teapot.exe: teapot.obj readtex.obj
|
||||
terrain.exe: terrain.obj
|
||||
tessdemo.exe: tessdemo.obj
|
||||
texcyl.exe: texcyl.obj readtex.obj
|
||||
texdown.exe: texdown.obj
|
||||
texenv.exe: texenv.obj
|
||||
texobj.exe: texobj.obj
|
||||
trispd.exe: trispd.obj
|
||||
tunnel.exe: tunnel.obj readtex.obj
|
||||
tunnel2.exe: tunnel2.obj readtex.obj
|
||||
winpos.exe: winpos.obj readtex.obj
|
||||
|
||||
|
||||
OPENGL32.DLL: $(LIBDIR)\OPENGL32.DLL
|
||||
copy $? .
|
||||
|
||||
GLU32.DLL: $(LIBDIR)\GLU32.DLL
|
||||
copy $? .
|
||||
|
||||
GLUT32.DLL: $(LIBDIR)\GLUT32.DLL
|
||||
copy $? .
|
||||
|
||||
readtex.c: $(TOP)\progs\util\readtex.c
|
||||
copy $** .
|
||||
|
||||
readtex.h: $(TOP)\progs\util\readtex.h
|
||||
copy $** .
|
||||
|
||||
showbuffer.c: $(TOP)\progs\util\showbuffer.c
|
||||
copy $** .
|
||||
|
||||
showbuffer.h: $(TOP)\progs\util\showbuffer.h
|
||||
copy $** .
|
||||
|
||||
.obj.exe:
|
||||
$(link) $(ldebug) -out:$@ $** /LIBPATH:$(LIBDIR) $(LIBS)
|
||||
|
||||
.c.obj:
|
||||
$(cc) $(cdebug) $(cflags) $(cvars) /I$(INCDIR) $*.c
|
||||
|
||||
clean::
|
||||
del *.obj *.exe readtex.* showbuffer.*
|
||||
|
||||
clobber::
|
||||
|
@@ -343,7 +343,7 @@ static void Init( void )
|
||||
(const GLubyte *) vertProgramText);
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
|
||||
if (glGetError() != GL_NO_ERROR || errorPos != -1) {
|
||||
int l = FindLine(fragProgramText, errorPos);
|
||||
int l = FindLine(vertProgramText, errorPos);
|
||||
printf("Vertex Program Error (pos=%d line=%d): %s\n", errorPos, l,
|
||||
(char *) glGetString(GL_PROGRAM_ERROR_STRING_ARB));
|
||||
exit(0);
|
||||
|
289
progs/demos/arbfslight.c
Normal file
289
progs/demos/arbfslight.c
Normal file
@@ -0,0 +1,289 @@
|
||||
/*
|
||||
* Use GL_ARB_fragment_shader and GL_ARB_vertex_shader to implement
|
||||
* simple per-pixel lighting.
|
||||
*
|
||||
* Michal Krol
|
||||
* 20 February 2006
|
||||
*
|
||||
* Based on the original demo by:
|
||||
* Brian Paul
|
||||
* 17 April 2003
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define GETPROCADDRESS wglGetProcAddress
|
||||
#else
|
||||
#define GETPROCADDRESS glutGetProcAddress
|
||||
#endif
|
||||
|
||||
static GLfloat diffuse[4] = { 0.5f, 0.5f, 1.0f, 1.0f };
|
||||
static GLfloat specular[4] = { 0.8f, 0.8f, 0.8f, 1.0f };
|
||||
static GLfloat lightPos[4] = { 0.0f, 10.0f, 20.0f, 1.0f };
|
||||
static GLfloat delta = 1.0f;
|
||||
|
||||
static GLhandleARB fragShader;
|
||||
static GLhandleARB vertShader;
|
||||
static GLhandleARB program;
|
||||
|
||||
static GLint uLightPos;
|
||||
static GLint uDiffuse;
|
||||
static GLint uSpecular;
|
||||
|
||||
static GLboolean anim = GL_TRUE;
|
||||
static GLboolean wire = GL_FALSE;
|
||||
static GLboolean pixelLight = GL_TRUE;
|
||||
|
||||
static GLint t0 = 0;
|
||||
static GLint frames = 0;
|
||||
|
||||
static GLfloat xRot = 0.0f, yRot = 0.0f;
|
||||
|
||||
static PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL;
|
||||
static PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL;
|
||||
static PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL;
|
||||
static PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL;
|
||||
static PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL;
|
||||
static PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL;
|
||||
static PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL;
|
||||
static PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL;
|
||||
static PFNGLUNIFORM4FVARBPROC glUniform4fvARB = NULL;
|
||||
|
||||
static void Redisplay (void)
|
||||
{
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
if (pixelLight)
|
||||
{
|
||||
glUseProgramObjectARB (program);
|
||||
glUniform4fvARB (uLightPos, 1, lightPos);
|
||||
glDisable(GL_LIGHTING);
|
||||
}
|
||||
else
|
||||
{
|
||||
glUseProgramObjectARB (0);
|
||||
glLightfv (GL_LIGHT0, GL_POSITION, lightPos);
|
||||
glEnable(GL_LIGHTING);
|
||||
}
|
||||
|
||||
glPushMatrix ();
|
||||
glRotatef (xRot, 1.0f, 0.0f, 0.0f);
|
||||
glRotatef (yRot, 0.0f, 1.0f, 0.0f);
|
||||
glutSolidSphere (2.0, 10, 5);
|
||||
glPopMatrix ();
|
||||
|
||||
glutSwapBuffers();
|
||||
frames++;
|
||||
|
||||
if (anim)
|
||||
{
|
||||
GLint t = glutGet (GLUT_ELAPSED_TIME);
|
||||
if (t - t0 >= 5000)
|
||||
{
|
||||
GLfloat seconds = (GLfloat) (t - t0) / 1000.0f;
|
||||
GLfloat fps = frames / seconds;
|
||||
printf ("%d frames in %6.3f seconds = %6.3f FPS\n", frames, seconds, fps);
|
||||
t0 = t;
|
||||
frames = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Idle (void)
|
||||
{
|
||||
lightPos[0] += delta;
|
||||
if (lightPos[0] > 25.0f || lightPos[0] < -25.0f)
|
||||
delta = -delta;
|
||||
glutPostRedisplay ();
|
||||
}
|
||||
|
||||
static void Reshape (int width, int height)
|
||||
{
|
||||
glViewport (0, 0, width, height);
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glLoadIdentity ();
|
||||
glFrustum (-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glLoadIdentity ();
|
||||
glTranslatef (0.0f, 0.0f, -15.0f);
|
||||
}
|
||||
|
||||
static void Key (unsigned char key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case ' ':
|
||||
case 'a':
|
||||
anim = !anim;
|
||||
if (anim)
|
||||
glutIdleFunc (Idle);
|
||||
else
|
||||
glutIdleFunc (NULL);
|
||||
break;
|
||||
case 'x':
|
||||
lightPos[0] -= 1.0f;
|
||||
break;
|
||||
case 'X':
|
||||
lightPos[0] += 1.0f;
|
||||
break;
|
||||
case 'w':
|
||||
wire = !wire;
|
||||
if (wire)
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
|
||||
else
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
|
||||
break;
|
||||
case 'p':
|
||||
pixelLight = !pixelLight;
|
||||
if (pixelLight)
|
||||
printf ("Per-pixel lighting\n");
|
||||
else
|
||||
printf ("Conventional lighting\n");
|
||||
break;
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay ();
|
||||
}
|
||||
|
||||
static void SpecialKey (int key, int x, int y)
|
||||
{
|
||||
const GLfloat step = 3.0f;
|
||||
|
||||
(void) x;
|
||||
(void) y;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case GLUT_KEY_UP:
|
||||
xRot -= step;
|
||||
break;
|
||||
case GLUT_KEY_DOWN:
|
||||
xRot += step;
|
||||
break;
|
||||
case GLUT_KEY_LEFT:
|
||||
yRot -= step;
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
yRot += step;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay ();
|
||||
}
|
||||
|
||||
static void Init (void)
|
||||
{
|
||||
static const char *fragShaderText =
|
||||
"uniform vec4 lightPos;\n"
|
||||
"uniform vec4 diffuse;\n"
|
||||
"uniform vec4 specular;\n"
|
||||
"void main () {\n"
|
||||
" // Compute dot product of light direction and normal vector\n"
|
||||
" float dotProd;\n"
|
||||
" dotProd = clamp (dot (normalize (lightPos).xyz, normalize (gl_TexCoord[0]).xyz), 0.0, 1.0);\n"
|
||||
" // Compute diffuse and specular contributions\n"
|
||||
" gl_FragColor = diffuse * dotProd + specular * pow (dotProd, 20.0);\n"
|
||||
"}\n"
|
||||
;
|
||||
static const char *vertShaderText =
|
||||
"void main () {\n"
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||
" gl_TexCoord[0] = vec4 (gl_NormalMatrix * gl_Normal, 1.0);\n"
|
||||
"}\n"
|
||||
;
|
||||
|
||||
if (!glutExtensionSupported ("GL_ARB_fragment_shader"))
|
||||
{
|
||||
printf ("Sorry, this demo requires GL_ARB_fragment_shader\n");
|
||||
exit(1);
|
||||
}
|
||||
if (!glutExtensionSupported ("GL_ARB_shader_objects"))
|
||||
{
|
||||
printf ("Sorry, this demo requires GL_ARB_shader_objects\n");
|
||||
exit(1);
|
||||
}
|
||||
if (!glutExtensionSupported ("GL_ARB_shading_language_100"))
|
||||
{
|
||||
printf ("Sorry, this demo requires GL_ARB_shading_language_100\n");
|
||||
exit(1);
|
||||
}
|
||||
if (!glutExtensionSupported ("GL_ARB_vertex_shader"))
|
||||
{
|
||||
printf ("Sorry, this demo requires GL_ARB_vertex_shader\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC) GETPROCADDRESS ("glCreateShaderObjectARB");
|
||||
glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC) GETPROCADDRESS ("glShaderSourceARB");
|
||||
glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC) GETPROCADDRESS ("glCompileShaderARB");
|
||||
glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC) GETPROCADDRESS ("glCreateProgramObjectARB");
|
||||
glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC) GETPROCADDRESS ("glAttachObjectARB");
|
||||
glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC) GETPROCADDRESS ("glLinkProgramARB");
|
||||
glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC) GETPROCADDRESS ("glUseProgramObjectARB");
|
||||
glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC) GETPROCADDRESS ("glGetUniformLocationARB");
|
||||
glUniform4fvARB = (PFNGLUNIFORM4FVARBPROC) GETPROCADDRESS ("glUniform4fvARB");
|
||||
|
||||
fragShader = glCreateShaderObjectARB (GL_FRAGMENT_SHADER_ARB);
|
||||
glShaderSourceARB (fragShader, 1, &fragShaderText, NULL);
|
||||
glCompileShaderARB (fragShader);
|
||||
|
||||
vertShader = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB);
|
||||
glShaderSourceARB (vertShader, 1, &vertShaderText, NULL);
|
||||
glCompileShaderARB (vertShader);
|
||||
|
||||
program = glCreateProgramObjectARB ();
|
||||
glAttachObjectARB (program, fragShader);
|
||||
glAttachObjectARB (program, vertShader);
|
||||
glLinkProgramARB (program);
|
||||
glUseProgramObjectARB (program);
|
||||
|
||||
uLightPos = glGetUniformLocationARB (program, "lightPos");
|
||||
uDiffuse = glGetUniformLocationARB (program, "diffuse");
|
||||
uSpecular = glGetUniformLocationARB (program, "specular");
|
||||
|
||||
glUniform4fvARB (uDiffuse, 1, diffuse);
|
||||
glUniform4fvARB (uSpecular, 1, specular);
|
||||
|
||||
glClearColor (0.3f, 0.3f, 0.3f, 0.0f);
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
glEnable (GL_LIGHT0);
|
||||
glEnable (GL_LIGHTING);
|
||||
glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse);
|
||||
glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, specular);
|
||||
glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 20.0f);
|
||||
|
||||
printf ("GL_RENDERER = %s\n", (const char *) glGetString (GL_RENDERER));
|
||||
printf ("Press p to toggle between per-pixel and per-vertex lighting\n");
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
glutInit (&argc, argv);
|
||||
glutInitWindowPosition ( 0, 0);
|
||||
glutInitWindowSize (200, 200);
|
||||
glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
glutCreateWindow (argv[0]);
|
||||
glutReshapeFunc (Reshape);
|
||||
glutKeyboardFunc (Key);
|
||||
glutSpecialFunc (SpecialKey);
|
||||
glutDisplayFunc (Redisplay);
|
||||
if (anim)
|
||||
glutIdleFunc (Idle);
|
||||
Init ();
|
||||
glutMainLoop ();
|
||||
return 0;
|
||||
}
|
||||
|
@@ -14,8 +14,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <GL/glut.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
#define COS(X) cos( (X) * 3.14159/180.0 )
|
||||
#define SIN(X) sin( (X) * 3.14159/180.0 )
|
||||
|
@@ -1,364 +0,0 @@
|
||||
|
||||
/*
|
||||
* glDrawPixels demo/test/benchmark
|
||||
*
|
||||
* Brian Paul September 25, 1997 This file is in the public domain.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "readtex.h"
|
||||
|
||||
#define IMAGE_FILE "../images/girl.rgb"
|
||||
|
||||
static int ImgWidth, ImgHeight;
|
||||
static GLenum ImgFormat;
|
||||
static GLubyte *Image = NULL;
|
||||
|
||||
static int Xpos, Ypos;
|
||||
static int SkipPixels, SkipRows;
|
||||
static int DrawWidth, DrawHeight;
|
||||
static int Scissor = 0;
|
||||
static int Fog = 0;
|
||||
static GLfloat Zpos = -1.0;
|
||||
static float Xzoom, Yzoom;
|
||||
static GLboolean DrawFront = GL_FALSE;
|
||||
static GLboolean Dither = GL_TRUE;
|
||||
|
||||
|
||||
static void Reset( void )
|
||||
{
|
||||
Xpos = Ypos = 20;
|
||||
DrawWidth = ImgWidth;
|
||||
DrawHeight = ImgHeight;
|
||||
SkipPixels = SkipRows = 0;
|
||||
Scissor = 0;
|
||||
Fog = 0;
|
||||
Zpos = -1.0;
|
||||
Xzoom = Yzoom = 1.0;
|
||||
}
|
||||
|
||||
|
||||
static void Display( void )
|
||||
{
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
glRasterPos2i(10, 10);
|
||||
glPixelZoom( 1, 1 );
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_FOG);
|
||||
glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
|
||||
|
||||
#if 0
|
||||
glRasterPos2i(Xpos, Ypos);
|
||||
#else
|
||||
/* This allows negative raster positions: */
|
||||
glRasterPos3f(0, 0, Zpos);
|
||||
glBitmap(0, 0, 0, 0, Xpos, Ypos, NULL);
|
||||
#endif
|
||||
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, SkipPixels);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, SkipRows);
|
||||
|
||||
glPixelZoom( Xzoom, Yzoom );
|
||||
|
||||
if (Scissor)
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
if (Fog)
|
||||
glEnable(GL_FOG);
|
||||
|
||||
glCopyPixels(10, 10, ImgWidth, ImgHeight, GL_COLOR);
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_FOG);
|
||||
|
||||
if (DrawFront)
|
||||
glFinish();
|
||||
else
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void Benchmark( void )
|
||||
{
|
||||
int startTime, endTime;
|
||||
int draws = 500;
|
||||
double seconds, pixelsPerSecond;
|
||||
|
||||
printf("Benchmarking...\n");
|
||||
/* GL set-up */
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, SkipPixels);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, SkipRows);
|
||||
glPixelZoom( Xzoom, Yzoom );
|
||||
if (Scissor)
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
if (Fog)
|
||||
glEnable(GL_FOG);
|
||||
|
||||
if (DrawFront)
|
||||
glDrawBuffer(GL_FRONT);
|
||||
else
|
||||
glDrawBuffer(GL_BACK);
|
||||
|
||||
/* Run timing test */
|
||||
draws = 0;
|
||||
startTime = glutGet(GLUT_ELAPSED_TIME);
|
||||
do {
|
||||
glCopyPixels(10, 10, ImgWidth, ImgHeight, GL_COLOR);
|
||||
draws++;
|
||||
endTime = glutGet(GLUT_ELAPSED_TIME);
|
||||
} while (endTime - startTime < 4000); /* 4 seconds */
|
||||
|
||||
/* GL clean-up */
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_FOG);
|
||||
|
||||
/* Results */
|
||||
seconds = (double) (endTime - startTime) / 1000.0;
|
||||
pixelsPerSecond = draws * DrawWidth * DrawHeight / seconds;
|
||||
printf("Result: %d draws in %f seconds = %f pixels/sec\n",
|
||||
draws, seconds, pixelsPerSecond);
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glOrtho( 0.0, width, 0.0, height, 0.0, 2.0 );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
glScissor(width/4, height/4, width/2, height/2);
|
||||
}
|
||||
|
||||
|
||||
static void Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case ' ':
|
||||
Reset();
|
||||
break;
|
||||
case 'd':
|
||||
Dither = !Dither;
|
||||
if (Dither)
|
||||
glEnable(GL_DITHER);
|
||||
else
|
||||
glDisable(GL_DITHER);
|
||||
break;
|
||||
case 'w':
|
||||
if (DrawWidth > 0)
|
||||
DrawWidth--;
|
||||
break;
|
||||
case 'W':
|
||||
DrawWidth++;
|
||||
break;
|
||||
case 'h':
|
||||
if (DrawHeight > 0)
|
||||
DrawHeight--;
|
||||
break;
|
||||
case 'H':
|
||||
DrawHeight++;
|
||||
break;
|
||||
case 'p':
|
||||
if (SkipPixels > 0)
|
||||
SkipPixels--;
|
||||
break;
|
||||
case 'P':
|
||||
SkipPixels++;
|
||||
break;
|
||||
case 'r':
|
||||
if (SkipRows > 0)
|
||||
SkipRows--;
|
||||
break;
|
||||
case 'R':
|
||||
SkipRows++;
|
||||
break;
|
||||
case 's':
|
||||
Scissor = !Scissor;
|
||||
break;
|
||||
case 'x':
|
||||
Xzoom -= 0.1;
|
||||
break;
|
||||
case 'X':
|
||||
Xzoom += 0.1;
|
||||
break;
|
||||
case 'y':
|
||||
Yzoom -= 0.1;
|
||||
break;
|
||||
case 'Y':
|
||||
Yzoom += 0.1;
|
||||
break;
|
||||
case 'z':
|
||||
Zpos -= 0.1;
|
||||
printf("RasterPos Z = %g\n", Zpos);
|
||||
break;
|
||||
case 'Z':
|
||||
Zpos += 0.1;
|
||||
printf("RasterPos Z = %g\n", Zpos);
|
||||
break;
|
||||
case 'b':
|
||||
Benchmark();
|
||||
break;
|
||||
case 'F':
|
||||
Fog = !Fog;
|
||||
printf("Fog %d\n", Fog);
|
||||
break;
|
||||
case 'f':
|
||||
DrawFront = !DrawFront;
|
||||
if (DrawFront)
|
||||
glDrawBuffer(GL_FRONT);
|
||||
else
|
||||
glDrawBuffer(GL_BACK);
|
||||
printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK");
|
||||
break;
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void SpecialKey( int key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case GLUT_KEY_UP:
|
||||
Ypos += 1;
|
||||
break;
|
||||
case GLUT_KEY_DOWN:
|
||||
Ypos -= 1;
|
||||
break;
|
||||
case GLUT_KEY_LEFT:
|
||||
Xpos -= 1;
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
Xpos += 1;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void Init( GLboolean ciMode, const char *filename )
|
||||
{
|
||||
static const GLfloat fogColor[4] = {0, 1, 0, 0};
|
||||
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
||||
Image = LoadRGBImage( filename, &ImgWidth, &ImgHeight, &ImgFormat );
|
||||
if (!Image) {
|
||||
printf("Couldn't read %s\n", filename);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (ciMode) {
|
||||
/* Convert RGB image to grayscale */
|
||||
GLubyte *indexImage = (GLubyte *) malloc( ImgWidth * ImgHeight );
|
||||
GLint i;
|
||||
for (i=0; i<ImgWidth*ImgHeight; i++) {
|
||||
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];
|
||||
indexImage[i] = gray / 3;
|
||||
}
|
||||
free(Image);
|
||||
Image = indexImage;
|
||||
ImgFormat = GL_COLOR_INDEX;
|
||||
|
||||
for (i=0;i<255;i++) {
|
||||
float g = i / 255.0;
|
||||
glutSetColor(i, g, g, g);
|
||||
}
|
||||
}
|
||||
|
||||
printf("Loaded %d by %d image\n", ImgWidth, ImgHeight );
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth);
|
||||
|
||||
glFogi(GL_FOG_MODE, GL_LINEAR);
|
||||
glFogf(GL_FOG_START, 0);
|
||||
glFogf(GL_FOG_END, 2);
|
||||
glFogfv(GL_FOG_COLOR, fogColor);
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
|
||||
static void Usage(void)
|
||||
{
|
||||
printf("Keys:\n");
|
||||
printf(" SPACE Reset Parameters\n");
|
||||
printf(" Up/Down Move image up/down\n");
|
||||
printf(" Left/Right Move image left/right\n");
|
||||
printf(" x Decrease X-axis PixelZoom\n");
|
||||
printf(" X Increase X-axis PixelZoom\n");
|
||||
printf(" y Decrease Y-axis PixelZoom\n");
|
||||
printf(" Y Increase Y-axis PixelZoom\n");
|
||||
printf(" w Decrease glDrawPixels width*\n");
|
||||
printf(" W Increase glDrawPixels width*\n");
|
||||
printf(" h Decrease glDrawPixels height*\n");
|
||||
printf(" H Increase glDrawPixels height*\n");
|
||||
printf(" p Decrease GL_UNPACK_SKIP_PIXELS*\n");
|
||||
printf(" P Increase GL_UNPACK_SKIP_PIXELS*\n");
|
||||
printf(" r Decrease GL_UNPACK_SKIP_ROWS*\n");
|
||||
printf(" R Increase GL_UNPACK_SKIP_ROWS*\n");
|
||||
printf(" s Toggle GL_SCISSOR_TEST\n");
|
||||
printf(" F Toggle GL_FOG\n");
|
||||
printf(" z Decrease RasterPos Z\n");
|
||||
printf(" Z Increase RasterPos Z\n");
|
||||
|
||||
printf(" f Toggle front/back buffer drawing\n");
|
||||
printf(" b Benchmark test\n");
|
||||
printf(" ESC Exit\n");
|
||||
printf("* Warning: no limits are imposed on these parameters so it's\n");
|
||||
printf(" possible to cause a segfault if you go too far.\n");
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
GLboolean ciMode = GL_FALSE;
|
||||
const char *filename = IMAGE_FILE;
|
||||
int i = 1;
|
||||
|
||||
if (argc > i && strcmp(argv[i], "-ci")==0) {
|
||||
ciMode = GL_TRUE;
|
||||
i++;
|
||||
}
|
||||
if (argc > i) {
|
||||
filename = argv[i];
|
||||
}
|
||||
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( 500, 400 );
|
||||
|
||||
if (ciMode)
|
||||
glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE );
|
||||
else
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
|
||||
|
||||
glutCreateWindow(argv[0]);
|
||||
|
||||
Init(ciMode, filename);
|
||||
Usage();
|
||||
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutSpecialFunc( SpecialKey );
|
||||
glutDisplayFunc( Display );
|
||||
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
@@ -1,376 +0,0 @@
|
||||
|
||||
/*
|
||||
* glDrawPixels demo/test/benchmark
|
||||
*
|
||||
* Brian Paul September 25, 1997 This file is in the public domain.
|
||||
*/
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "readtex.h"
|
||||
|
||||
#define IMAGE_FILE "../images/tree2.rgba"
|
||||
|
||||
static int ImgWidth, ImgHeight;
|
||||
static GLenum ImgFormat;
|
||||
static GLenum ImgType = GL_UNSIGNED_BYTE;
|
||||
static GLubyte *Image = NULL;
|
||||
|
||||
static int Xpos, Ypos;
|
||||
static int SkipPixels, SkipRows;
|
||||
static int DrawWidth, DrawHeight;
|
||||
static int Scissor = 0;
|
||||
static int Fog = 0;
|
||||
static GLfloat Zpos = -1.0;
|
||||
static float Xzoom, Yzoom;
|
||||
static GLboolean DrawFront = GL_FALSE;
|
||||
static GLboolean Dither = GL_TRUE;
|
||||
|
||||
|
||||
static GLuint DrawPBO;
|
||||
|
||||
|
||||
static void Reset( void )
|
||||
{
|
||||
Xpos = Ypos = 20;
|
||||
DrawWidth = ImgWidth;
|
||||
DrawHeight = ImgHeight;
|
||||
SkipPixels = SkipRows = 0;
|
||||
Scissor = 0;
|
||||
Fog = 0;
|
||||
Zpos = -1.0;
|
||||
Xzoom = Yzoom = 1.0;
|
||||
}
|
||||
|
||||
|
||||
static void Display( void )
|
||||
{
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
#if 0
|
||||
glRasterPos2i(Xpos, Ypos);
|
||||
#else
|
||||
/* This allows negative raster positions: */
|
||||
glRasterPos3f(0, 0, Zpos);
|
||||
glBitmap(0, 0, 0, 0, Xpos, Ypos, NULL);
|
||||
#endif
|
||||
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, SkipPixels);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, SkipRows);
|
||||
|
||||
glPixelZoom( Xzoom, Yzoom );
|
||||
|
||||
if (Scissor)
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
if (Fog)
|
||||
glEnable(GL_FOG);
|
||||
|
||||
/*** Draw from the DrawPBO */
|
||||
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO);
|
||||
glDrawPixels(DrawWidth, DrawHeight, ImgFormat, ImgType, NULL);
|
||||
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0);
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_FOG);
|
||||
|
||||
if (DrawFront)
|
||||
glFinish();
|
||||
else
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void Benchmark( void )
|
||||
{
|
||||
int startTime, endTime;
|
||||
int draws = 500;
|
||||
double seconds, pixelsPerSecond;
|
||||
|
||||
printf("Benchmarking...\n");
|
||||
/* GL set-up */
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, SkipPixels);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, SkipRows);
|
||||
glPixelZoom( Xzoom, Yzoom );
|
||||
if (Scissor)
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
if (Fog)
|
||||
glEnable(GL_FOG);
|
||||
|
||||
if (DrawFront)
|
||||
glDrawBuffer(GL_FRONT);
|
||||
else
|
||||
glDrawBuffer(GL_BACK);
|
||||
|
||||
/* Run timing test */
|
||||
draws = 0;
|
||||
startTime = glutGet(GLUT_ELAPSED_TIME);
|
||||
do {
|
||||
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO);
|
||||
glDrawPixels(DrawWidth, DrawHeight, ImgFormat, ImgType, NULL);
|
||||
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0);
|
||||
draws++;
|
||||
endTime = glutGet(GLUT_ELAPSED_TIME);
|
||||
} while (endTime - startTime < 4000); /* 4 seconds */
|
||||
|
||||
/* GL clean-up */
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_FOG);
|
||||
|
||||
/* Results */
|
||||
seconds = (double) (endTime - startTime) / 1000.0;
|
||||
pixelsPerSecond = draws * DrawWidth * DrawHeight / seconds;
|
||||
printf("Result: %d draws in %f seconds = %f pixels/sec\n",
|
||||
draws, seconds, pixelsPerSecond);
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glOrtho( 0.0, width, 0.0, height, 0.0, 2.0 );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
glScissor(width/4, height/4, width/2, height/2);
|
||||
}
|
||||
|
||||
|
||||
static void Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case ' ':
|
||||
Reset();
|
||||
break;
|
||||
case 'd':
|
||||
Dither = !Dither;
|
||||
if (Dither)
|
||||
glEnable(GL_DITHER);
|
||||
else
|
||||
glDisable(GL_DITHER);
|
||||
break;
|
||||
case 'w':
|
||||
if (DrawWidth > 0)
|
||||
DrawWidth--;
|
||||
break;
|
||||
case 'W':
|
||||
DrawWidth++;
|
||||
break;
|
||||
case 'h':
|
||||
if (DrawHeight > 0)
|
||||
DrawHeight--;
|
||||
break;
|
||||
case 'H':
|
||||
DrawHeight++;
|
||||
break;
|
||||
case 'p':
|
||||
if (SkipPixels > 0)
|
||||
SkipPixels--;
|
||||
break;
|
||||
case 'P':
|
||||
SkipPixels++;
|
||||
break;
|
||||
case 'r':
|
||||
if (SkipRows > 0)
|
||||
SkipRows--;
|
||||
break;
|
||||
case 'R':
|
||||
SkipRows++;
|
||||
break;
|
||||
case 's':
|
||||
Scissor = !Scissor;
|
||||
break;
|
||||
case 'x':
|
||||
Xzoom -= 0.1;
|
||||
break;
|
||||
case 'X':
|
||||
Xzoom += 0.1;
|
||||
break;
|
||||
case 'y':
|
||||
Yzoom -= 0.1;
|
||||
break;
|
||||
case 'Y':
|
||||
Yzoom += 0.1;
|
||||
break;
|
||||
case 'z':
|
||||
Zpos -= 0.1;
|
||||
printf("RasterPos Z = %g\n", Zpos);
|
||||
break;
|
||||
case 'Z':
|
||||
Zpos += 0.1;
|
||||
printf("RasterPos Z = %g\n", Zpos);
|
||||
break;
|
||||
case 'b':
|
||||
Benchmark();
|
||||
break;
|
||||
case 'F':
|
||||
Fog = !Fog;
|
||||
printf("Fog %d\n", Fog);
|
||||
break;
|
||||
case 'f':
|
||||
DrawFront = !DrawFront;
|
||||
if (DrawFront)
|
||||
glDrawBuffer(GL_FRONT);
|
||||
else
|
||||
glDrawBuffer(GL_BACK);
|
||||
printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK");
|
||||
break;
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void SpecialKey( int key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case GLUT_KEY_UP:
|
||||
Ypos += 1;
|
||||
break;
|
||||
case GLUT_KEY_DOWN:
|
||||
Ypos -= 1;
|
||||
break;
|
||||
case GLUT_KEY_LEFT:
|
||||
Xpos -= 1;
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
Xpos += 1;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void Init( GLboolean ciMode, const char *filename )
|
||||
{
|
||||
static const GLfloat fogColor[4] = {0, 1, 0, 0};
|
||||
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
||||
Image = LoadRGBImage( filename, &ImgWidth, &ImgHeight, &ImgFormat );
|
||||
if (!Image) {
|
||||
printf("Couldn't read %s\n", filename);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (ciMode) {
|
||||
/* Convert RGB image to grayscale */
|
||||
GLubyte *indexImage = (GLubyte *) malloc( ImgWidth * ImgHeight );
|
||||
GLint i;
|
||||
for (i=0; i<ImgWidth*ImgHeight; i++) {
|
||||
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];
|
||||
indexImage[i] = gray / 3;
|
||||
}
|
||||
free(Image);
|
||||
Image = indexImage;
|
||||
ImgFormat = GL_COLOR_INDEX;
|
||||
|
||||
for (i=0;i<255;i++) {
|
||||
float g = i / 255.0;
|
||||
glutSetColor(i, g, g, g);
|
||||
}
|
||||
}
|
||||
|
||||
printf("Loaded %d by %d image\n", ImgWidth, ImgHeight );
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth);
|
||||
|
||||
|
||||
/* put image into DrawPBO */
|
||||
glGenBuffersARB(1, &DrawPBO);
|
||||
glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, DrawPBO);
|
||||
glBufferDataARB(GL_PIXEL_PACK_BUFFER_EXT,
|
||||
ImgWidth * ImgHeight * 4, Image, GL_STATIC_DRAW);
|
||||
|
||||
|
||||
glFogi(GL_FOG_MODE, GL_LINEAR);
|
||||
glFogf(GL_FOG_START, 0);
|
||||
glFogf(GL_FOG_END, 2);
|
||||
glFogfv(GL_FOG_COLOR, fogColor);
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
|
||||
static void Usage(void)
|
||||
{
|
||||
printf("Keys:\n");
|
||||
printf(" SPACE Reset Parameters\n");
|
||||
printf(" Up/Down Move image up/down\n");
|
||||
printf(" Left/Right Move image left/right\n");
|
||||
printf(" x Decrease X-axis PixelZoom\n");
|
||||
printf(" X Increase X-axis PixelZoom\n");
|
||||
printf(" y Decrease Y-axis PixelZoom\n");
|
||||
printf(" Y Increase Y-axis PixelZoom\n");
|
||||
printf(" w Decrease glDrawPixels width*\n");
|
||||
printf(" W Increase glDrawPixels width*\n");
|
||||
printf(" h Decrease glDrawPixels height*\n");
|
||||
printf(" H Increase glDrawPixels height*\n");
|
||||
printf(" p Decrease GL_UNPACK_SKIP_PIXELS*\n");
|
||||
printf(" P Increase GL_UNPACK_SKIP_PIXELS*\n");
|
||||
printf(" r Decrease GL_UNPACK_SKIP_ROWS*\n");
|
||||
printf(" R Increase GL_UNPACK_SKIP_ROWS*\n");
|
||||
printf(" s Toggle GL_SCISSOR_TEST\n");
|
||||
printf(" F Toggle GL_FOG\n");
|
||||
printf(" z Decrease RasterPos Z\n");
|
||||
printf(" Z Increase RasterPos Z\n");
|
||||
|
||||
printf(" f Toggle front/back buffer drawing\n");
|
||||
printf(" b Benchmark test\n");
|
||||
printf(" ESC Exit\n");
|
||||
printf("* Warning: no limits are imposed on these parameters so it's\n");
|
||||
printf(" possible to cause a segfault if you go too far.\n");
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
GLboolean ciMode = GL_FALSE;
|
||||
const char *filename = IMAGE_FILE;
|
||||
int i = 1;
|
||||
|
||||
if (argc > i && strcmp(argv[i], "-ci")==0) {
|
||||
ciMode = GL_TRUE;
|
||||
i++;
|
||||
}
|
||||
if (argc > i) {
|
||||
filename = argv[i];
|
||||
}
|
||||
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( 500, 400 );
|
||||
|
||||
if (ciMode)
|
||||
glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE );
|
||||
else
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
|
||||
|
||||
glutCreateWindow(argv[0]);
|
||||
|
||||
Init(ciMode, filename);
|
||||
Usage();
|
||||
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutSpecialFunc( SpecialKey );
|
||||
glutDisplayFunc( Display );
|
||||
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
@@ -18,7 +18,7 @@
|
||||
static GLint WinWidth = 800, WinHeight = 500;
|
||||
static GLint TexWidth, TexHeight;
|
||||
static GLuint TexObj = 1;
|
||||
static GLenum IntFormat = GL_RGBA;
|
||||
static GLenum IntFormat = GL_RGB;
|
||||
|
||||
static GLboolean WireFrame = GL_FALSE;
|
||||
|
||||
@@ -325,10 +325,9 @@ idle(void)
|
||||
dt = t - t0;
|
||||
t0 = t;
|
||||
|
||||
GearRot += 70.0 * dt; /* 70 degrees per second */
|
||||
GearRot = fmod(GearRot, 360.0); /* prevents eventual overflow */
|
||||
|
||||
CubeRot += 15.0 * dt;
|
||||
/* fmod to prevent overflow */
|
||||
GearRot = fmod(GearRot + 70.0 * dt, 360.0); /* 70 deg/sec */
|
||||
CubeRot = fmod(CubeRot + 15.0 * dt, 360.0); /* 15 deg/sec */
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
@@ -236,6 +236,7 @@ static void SpecialKey( int key, int x, int y )
|
||||
static void Init( int argc, char *argv[] )
|
||||
{
|
||||
GLboolean convolve = GL_FALSE;
|
||||
GLboolean fullscreen = GL_FALSE;
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
@@ -248,8 +249,13 @@ static void Init( int argc, char *argv[] )
|
||||
else if (strcmp(argv[i], "-c")==0) {
|
||||
convolve = GL_TRUE;
|
||||
}
|
||||
else if (strcmp(argv[i], "-f")==0) {
|
||||
fullscreen = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (fullscreen)
|
||||
glutFullScreen();
|
||||
|
||||
/* Cylinder object */
|
||||
{
|
||||
@@ -421,7 +427,8 @@ int main( int argc, char *argv[] )
|
||||
glutKeyboardFunc( Key );
|
||||
glutSpecialFunc( SpecialKey );
|
||||
glutDisplayFunc( Display );
|
||||
glutIdleFunc( Idle );
|
||||
if (Animate)
|
||||
glutIdleFunc( Idle );
|
||||
|
||||
glutCreateMenu(ModeMenu);
|
||||
glutAddMenuEntry("Toggle Highlight", DO_SPEC_TEXTURE);
|
||||
|
185
progs/demos/glslnoise.c
Executable file
185
progs/demos/glslnoise.c
Executable file
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* GLSL noise demo.
|
||||
*
|
||||
* Michal Krol
|
||||
* 20 February 2006
|
||||
*
|
||||
* Based on the original demo by:
|
||||
* Stefan Gustavson (stegu@itn.liu.se) 2004, 2005
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define GETPROCADDRESS(F) wglGetProcAddress(F)
|
||||
#else
|
||||
#define GETPROCADDRESS(F) glutGetProcAddress(F)
|
||||
#endif
|
||||
|
||||
static GLhandleARB fragShader;
|
||||
static GLhandleARB vertShader;
|
||||
static GLhandleARB program;
|
||||
|
||||
static GLint uTime;
|
||||
|
||||
static GLfloat u_time = 0.0f;
|
||||
|
||||
static PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB = NULL;
|
||||
static PFNGLSHADERSOURCEARBPROC glShaderSourceARB = NULL;
|
||||
static PFNGLCOMPILESHADERARBPROC glCompileShaderARB = NULL;
|
||||
static PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB = NULL;
|
||||
static PFNGLATTACHOBJECTARBPROC glAttachObjectARB = NULL;
|
||||
static PFNGLLINKPROGRAMARBPROC glLinkProgramARB = NULL;
|
||||
static PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB = NULL;
|
||||
static PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB = NULL;
|
||||
static PFNGLUNIFORM1FARBPROC glUniform1fARB = NULL;
|
||||
|
||||
static void Redisplay (void)
|
||||
{
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glUniform1fARB (uTime, u_time);
|
||||
|
||||
glPushMatrix ();
|
||||
glutSolidSphere (2.0, 20, 10);
|
||||
glPopMatrix ();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
static void Idle (void)
|
||||
{
|
||||
u_time += 0.1f;
|
||||
glutPostRedisplay ();
|
||||
}
|
||||
|
||||
static void Reshape (int width, int height)
|
||||
{
|
||||
glViewport (0, 0, width, height);
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glLoadIdentity ();
|
||||
glFrustum (-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glLoadIdentity ();
|
||||
glTranslatef (0.0f, 0.0f, -15.0f);
|
||||
}
|
||||
|
||||
static void Key (unsigned char key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay ();
|
||||
}
|
||||
|
||||
static void Init (void)
|
||||
{
|
||||
static const char *fragShaderText =
|
||||
"uniform float time;\n"
|
||||
"void main () {\n"
|
||||
" gl_FragColor = gl_Color * vec4 ((0.5 + 0.5 * vec3 (noise1 (\n"
|
||||
" vec4 (4.0 * gl_TexCoord[0].xyz, 0.5 * time)))), 1.0);\n"
|
||||
"}\n"
|
||||
;
|
||||
static const char *vertShaderText =
|
||||
"void main () {\n"
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||
" gl_TexCoord[0] = gl_Vertex;\n"
|
||||
" gl_FrontColor = gl_Color;\n"
|
||||
"}\n"
|
||||
;
|
||||
|
||||
if (!glutExtensionSupported ("GL_ARB_fragment_shader"))
|
||||
{
|
||||
printf ("Sorry, this demo requires GL_ARB_fragment_shader\n");
|
||||
exit(1);
|
||||
}
|
||||
if (!glutExtensionSupported ("GL_ARB_shader_objects"))
|
||||
{
|
||||
printf ("Sorry, this demo requires GL_ARB_shader_objects\n");
|
||||
exit(1);
|
||||
}
|
||||
if (!glutExtensionSupported ("GL_ARB_shading_language_100"))
|
||||
{
|
||||
printf ("Sorry, this demo requires GL_ARB_shading_language_100\n");
|
||||
exit(1);
|
||||
}
|
||||
if (!glutExtensionSupported ("GL_ARB_vertex_shader"))
|
||||
{
|
||||
printf ("Sorry, this demo requires GL_ARB_vertex_shader\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)
|
||||
GETPROCADDRESS("glCreateShaderObjectARB");
|
||||
glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)
|
||||
GETPROCADDRESS("glShaderSourceARB");
|
||||
glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)
|
||||
GETPROCADDRESS("glCompileShaderARB");
|
||||
glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)
|
||||
GETPROCADDRESS("glCreateProgramObjectARB");
|
||||
glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)
|
||||
GETPROCADDRESS("glAttachObjectARB");
|
||||
glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)
|
||||
GETPROCADDRESS ("glLinkProgramARB");
|
||||
glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)
|
||||
GETPROCADDRESS("glUseProgramObjectARB");
|
||||
|
||||
glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)
|
||||
GETPROCADDRESS("glGetUniformLocationARB");
|
||||
glUniform1fARB = (PFNGLUNIFORM1FARBPROC)
|
||||
GETPROCADDRESS("glUniform1fARB");
|
||||
|
||||
fragShader = glCreateShaderObjectARB (GL_FRAGMENT_SHADER_ARB);
|
||||
glShaderSourceARB (fragShader, 1, &fragShaderText, NULL);
|
||||
glCompileShaderARB (fragShader);
|
||||
|
||||
vertShader = glCreateShaderObjectARB (GL_VERTEX_SHADER_ARB);
|
||||
glShaderSourceARB (vertShader, 1, &vertShaderText, NULL);
|
||||
glCompileShaderARB (vertShader);
|
||||
|
||||
program = glCreateProgramObjectARB ();
|
||||
glAttachObjectARB (program, fragShader);
|
||||
glAttachObjectARB (program, vertShader);
|
||||
glLinkProgramARB (program);
|
||||
glUseProgramObjectARB (program);
|
||||
|
||||
uTime = glGetUniformLocationARB (program, "time");
|
||||
|
||||
glClearColor (0.0f, 0.1f, 0.3f, 1.0f);
|
||||
glEnable (GL_CULL_FACE);
|
||||
glEnable (GL_DEPTH_TEST);
|
||||
|
||||
printf ("GL_RENDERER = %s\n", (const char *) glGetString (GL_RENDERER));
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
glutInit (&argc, argv);
|
||||
glutInitWindowPosition ( 0, 0);
|
||||
glutInitWindowSize (200, 200);
|
||||
glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
glutCreateWindow (argv[0]);
|
||||
glutReshapeFunc (Reshape);
|
||||
glutKeyboardFunc (Key);
|
||||
glutDisplayFunc (Redisplay);
|
||||
glutIdleFunc (Idle);
|
||||
Init ();
|
||||
glutMainLoop ();
|
||||
return 0;
|
||||
}
|
||||
|
@@ -42,6 +42,9 @@
|
||||
#define INIT_WIDTH 400
|
||||
#define INIT_HEIGHT 300
|
||||
|
||||
#ifdef _WIN32
|
||||
#undef CreateWindowA
|
||||
#endif
|
||||
|
||||
struct window {
|
||||
int id; /* returned by glutCreateWindow() */
|
||||
@@ -299,11 +302,21 @@ DrawWindow(void)
|
||||
GLfloat dist = 20.0;
|
||||
GLfloat eyex, eyey, eyez;
|
||||
|
||||
glDrawBuffer(w->drawBuffer);
|
||||
glReadBuffer(w->drawBuffer);
|
||||
if (w->drawBuffer == GL_NONE) {
|
||||
glDrawBuffer(GL_BACK);
|
||||
glReadBuffer(GL_BACK);
|
||||
}
|
||||
else {
|
||||
glDrawBuffer(w->drawBuffer);
|
||||
glReadBuffer(w->drawBuffer);
|
||||
}
|
||||
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
if (w->drawBuffer == GL_NONE) {
|
||||
glDrawBuffer(GL_NONE);
|
||||
}
|
||||
|
||||
eyex = dist * cos(w->yrot * DEG2RAD) * cos(w->xrot * DEG2RAD);
|
||||
eyez = dist * sin(w->yrot * DEG2RAD) * cos(w->xrot * DEG2RAD);
|
||||
eyey = dist * sin(w->xrot * DEG2RAD);
|
||||
@@ -373,10 +386,10 @@ DrawWindow(void)
|
||||
ShowAlphaBuffer(w->width, w->height);
|
||||
}
|
||||
|
||||
if (w->drawBuffer == GL_BACK)
|
||||
glutSwapBuffers();
|
||||
else
|
||||
if (w->drawBuffer == GL_FRONT)
|
||||
glFinish();
|
||||
else
|
||||
glutSwapBuffers();
|
||||
|
||||
/* calc/show frame rate */
|
||||
{
|
||||
@@ -457,6 +470,10 @@ Key(unsigned char key, int x, int y)
|
||||
w->drawBuffer = GL_FRONT;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case '0':
|
||||
w->drawBuffer = GL_NONE;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case ' ':
|
||||
w->anim = !w->anim;
|
||||
w->t0 = -1;
|
||||
|
@@ -41,7 +41,6 @@
|
||||
#undef GL_ARB_shadow_ambient
|
||||
#endif
|
||||
|
||||
|
||||
#define DEG_TO_RAD (3.14159 / 180.0)
|
||||
|
||||
static GLint WindowWidth = 450, WindowHeight = 300;
|
||||
@@ -67,6 +66,7 @@ static GLfloat Bias = -0.06;
|
||||
|
||||
static GLboolean Anim = GL_TRUE;
|
||||
|
||||
static GLboolean UsePackedDepthStencil = GL_FALSE;
|
||||
static GLboolean HaveEXTshadowFuncs = GL_FALSE;
|
||||
static GLint Operator = 0;
|
||||
static const GLenum OperatorFunc[8] = {
|
||||
@@ -266,7 +266,7 @@ Display(void)
|
||||
0, 1, 0); /* up */
|
||||
|
||||
glViewport(0, 0, ShadowTexWidth, ShadowTexHeight);
|
||||
glClear(GL_DEPTH_BUFFER_BIT);
|
||||
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
DrawScene();
|
||||
|
||||
/*
|
||||
@@ -274,9 +274,21 @@ Display(void)
|
||||
*/
|
||||
if (DisplayMode == SHOW_DEPTH_MAPPING) {
|
||||
/* load depth image as gray-scale luminance texture */
|
||||
GLfloat *depth = (GLfloat *) malloc(ShadowTexWidth * ShadowTexHeight
|
||||
* sizeof(GLfloat));
|
||||
if (depth) {
|
||||
if (UsePackedDepthStencil) {
|
||||
GLuint *depth = (GLuint *) malloc(ShadowTexWidth * ShadowTexHeight
|
||||
* sizeof(GLuint));
|
||||
assert(depth);
|
||||
glReadPixels(0, 0, ShadowTexWidth, ShadowTexHeight,
|
||||
GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, depth);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE,
|
||||
ShadowTexWidth, ShadowTexHeight, 0,
|
||||
GL_LUMINANCE, GL_UNSIGNED_INT, depth);
|
||||
free(depth);
|
||||
}
|
||||
else {
|
||||
GLfloat *depth = (GLfloat *) malloc(ShadowTexWidth * ShadowTexHeight
|
||||
* sizeof(GLfloat));
|
||||
assert(depth);
|
||||
glReadPixels(0, 0, ShadowTexWidth, ShadowTexHeight,
|
||||
GL_DEPTH_COMPONENT, GL_FLOAT, depth);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE,
|
||||
@@ -287,8 +299,18 @@ Display(void)
|
||||
}
|
||||
else {
|
||||
/* The normal shadow case */
|
||||
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
|
||||
0, 0, ShadowTexWidth, ShadowTexHeight, 0);
|
||||
if (UsePackedDepthStencil) {
|
||||
GLint intFormat;
|
||||
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL_EXT,
|
||||
0, 0, ShadowTexWidth, ShadowTexHeight, 0);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
|
||||
GL_TEXTURE_INTERNAL_FORMAT, &intFormat);
|
||||
assert(intFormat == GL_DEPTH_STENCIL_EXT);
|
||||
}
|
||||
else {
|
||||
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
|
||||
0, 0, ShadowTexWidth, ShadowTexHeight, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -447,6 +469,17 @@ Key(unsigned char key, int x, int y)
|
||||
OperatorFunc[Operator]);
|
||||
}
|
||||
break;
|
||||
case 'p':
|
||||
UsePackedDepthStencil = !UsePackedDepthStencil;
|
||||
if (UsePackedDepthStencil
|
||||
&& !glutExtensionSupported("GL_EXT_packed_depth_stencil")) {
|
||||
printf("Sorry, GL_EXT_packed_depth_stencil not supported\n");
|
||||
UsePackedDepthStencil = GL_FALSE;
|
||||
}
|
||||
else {
|
||||
printf("Use GL_DEPTH_STENCIL_EXT: %d\n", UsePackedDepthStencil);
|
||||
}
|
||||
break;
|
||||
case 'z':
|
||||
Zrot -= step;
|
||||
break;
|
||||
@@ -572,6 +605,7 @@ PrintHelp(void)
|
||||
printf(" n = show normal, shadowed image\n");
|
||||
printf(" f = toggle nearest/bilinear texture filtering\n");
|
||||
printf(" b/B = decrease/increase shadow map Z bias\n");
|
||||
printf(" p = toggle use of packed depth/stencil\n");
|
||||
printf(" cursor keys = rotate scene\n");
|
||||
printf(" <shift> + cursor keys = rotate light source\n");
|
||||
if (HaveEXTshadowFuncs)
|
||||
@@ -585,7 +619,7 @@ main(int argc, char *argv[])
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowPosition(0, 0);
|
||||
glutInitWindowSize(WindowWidth, WindowHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL);
|
||||
glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
|
@@ -38,8 +38,8 @@
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
static GLsizei MaxSize = 2048;
|
||||
static GLsizei TexWidth = 1024, TexHeight = 1024, TexBorder = 0;
|
||||
static GLsizei MaxSize = 1024;
|
||||
static GLsizei TexWidth = 256, TexHeight = 256, TexBorder = 0;
|
||||
static GLboolean ScaleAndBias = GL_FALSE;
|
||||
static GLboolean SubImage = GL_FALSE;
|
||||
static GLdouble DownloadRate = 0.0; /* texels/sec */
|
||||
@@ -47,32 +47,6 @@ static GLdouble DownloadRate = 0.0; /* texels/sec */
|
||||
static GLuint Mode = 0;
|
||||
|
||||
|
||||
/* Try and avoid L2 cache effects by cycling through a small number of
|
||||
* textures.
|
||||
*
|
||||
* At the initial size of 1024x1024x4 == 4mbyte, say 8 textures will
|
||||
* keep us out of most caches at 32mb total.
|
||||
*
|
||||
* This turns into a fairly interesting question of what exactly you
|
||||
* expect to be in cache in normal usage, and what you think should be
|
||||
* outside. There's no rules for this, no reason to favour one usage
|
||||
* over another except what the application you care about happens to
|
||||
* resemble most closely.
|
||||
*
|
||||
* - Should the client texture image be in L2 cache? Has it just been
|
||||
* generated or read from disk?
|
||||
* - Does the application really use >1 texture, or is it constantly
|
||||
* updating one image in-place?
|
||||
*
|
||||
* Different answers will favour different texture upload mechanisms.
|
||||
* To upload an image that is purely outside of cache, a DMA-based
|
||||
* upload will probably win, whereas for small, in-cache textures,
|
||||
* copying looks good.
|
||||
*/
|
||||
#define NR_TEXOBJ 4
|
||||
static GLuint TexObj[NR_TEXOBJ];
|
||||
|
||||
|
||||
struct FormatRec {
|
||||
GLenum Format;
|
||||
GLenum Type;
|
||||
@@ -142,57 +116,25 @@ TypeStr(GLenum type)
|
||||
}
|
||||
}
|
||||
|
||||
/* On x86, there is a performance cliff for memcpy to texture memory
|
||||
* for sources below 64 byte alignment. We do our best with this in
|
||||
* the driver, but it is better if the images are correctly aligned to
|
||||
* start with:
|
||||
*/
|
||||
#define ALIGN (1<<12)
|
||||
|
||||
static unsigned align(unsigned value, unsigned a)
|
||||
{
|
||||
return (value + a - 1) & ~(a-1);
|
||||
}
|
||||
|
||||
static int MIN2(int a, int b)
|
||||
{
|
||||
return a < b ? a : b;
|
||||
}
|
||||
|
||||
static void
|
||||
MeasureDownloadRate(void)
|
||||
{
|
||||
const int w = TexWidth + 2 * TexBorder;
|
||||
const int h = TexHeight + 2 * TexBorder;
|
||||
const int image_bytes = align(w * h * BytesPerTexel(Format), ALIGN);
|
||||
const int bytes = image_bytes * NR_TEXOBJ;
|
||||
GLubyte *orig_texImage, *orig_getImage;
|
||||
const int bytes = w * h * BytesPerTexel(Format);
|
||||
GLubyte *texImage, *getImage;
|
||||
GLdouble t0, t1, time;
|
||||
int count;
|
||||
int i;
|
||||
int offset = 0;
|
||||
GLdouble total = 0; /* ints will tend to overflow */
|
||||
|
||||
printf("allocating %d bytes for %d %dx%d images\n",
|
||||
bytes, NR_TEXOBJ, w, h);
|
||||
|
||||
orig_texImage = (GLubyte *) malloc(bytes + ALIGN);
|
||||
orig_getImage = (GLubyte *) malloc(image_bytes + ALIGN);
|
||||
if (!orig_texImage || !orig_getImage) {
|
||||
texImage = (GLubyte *) malloc(bytes);
|
||||
getImage = (GLubyte *) malloc(bytes);
|
||||
if (!texImage || !getImage) {
|
||||
DownloadRate = 0.0;
|
||||
return;
|
||||
}
|
||||
|
||||
printf("alloc %p %p\n", orig_texImage, orig_getImage);
|
||||
|
||||
texImage = (GLubyte *)align((unsigned)orig_texImage, ALIGN);
|
||||
getImage = (GLubyte *)align((unsigned)orig_getImage, ALIGN);
|
||||
|
||||
for (i = 1; !(((unsigned)texImage) & i); i<<=1)
|
||||
;
|
||||
printf("texture image alignment: %d bytes (%p)\n", i, texImage);
|
||||
|
||||
for (i = 0; i < bytes; i++) {
|
||||
texImage[i] = i & 0xff;
|
||||
}
|
||||
@@ -224,80 +166,51 @@ MeasureDownloadRate(void)
|
||||
count = 0;
|
||||
t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
|
||||
do {
|
||||
int img = count%NR_TEXOBJ;
|
||||
GLubyte *img_ptr = texImage + img * image_bytes;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, TexObj[img]);
|
||||
|
||||
if (SubImage && count > 0) {
|
||||
/* Only update a portion of the image each iteration. This
|
||||
* is presumably why you'd want to use texsubimage, otherwise
|
||||
* you may as well just call teximage again.
|
||||
*
|
||||
* A bigger question is whether to use a pointer that moves
|
||||
* with each call, ie does the incoming data come from L2
|
||||
* cache under normal circumstances, or is it pulled from
|
||||
* uncached memory?
|
||||
*
|
||||
* There's a good argument to say L2 cache, ie you'd expect
|
||||
* the data to have been recently generated. It's possible
|
||||
* that it could have come from a file read, which may or may
|
||||
* not have gone through the cpu.
|
||||
*/
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0,
|
||||
-TexBorder,
|
||||
-TexBorder + offset * h/8,
|
||||
w,
|
||||
h/8,
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, -TexBorder, -TexBorder, w, h,
|
||||
FormatTable[Format].Format,
|
||||
FormatTable[Format].Type,
|
||||
#if 1
|
||||
texImage /* likely in L2$ */
|
||||
#else
|
||||
img_ptr + offset * bytes/8 /* unlikely in L2$ */
|
||||
#endif
|
||||
);
|
||||
offset += 1;
|
||||
offset %= 8;
|
||||
total += w * h / 8;
|
||||
FormatTable[Format].Type, texImage);
|
||||
}
|
||||
else {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0,
|
||||
FormatTable[Format].IntFormat, w, h, TexBorder,
|
||||
FormatTable[Format].Format,
|
||||
FormatTable[Format].Type,
|
||||
img_ptr);
|
||||
total += w*h;
|
||||
FormatTable[Format].Type, texImage);
|
||||
}
|
||||
|
||||
#if 1
|
||||
/* Render a texture, but not necessarily the one just uploaded.
|
||||
*/
|
||||
/* glBindTexture(GL_TEXTURE_2D, TexObj[(img + NR_TEXOBJ/2)%NR_TEXOBJ]); */
|
||||
|
||||
/* draw a tiny polygon to force texture into texram */
|
||||
glBegin(GL_TRIANGLES);
|
||||
glTexCoord2f(0, 0); glVertex2f(1, 1);
|
||||
glTexCoord2f(1, 0); glVertex2f(3, 1);
|
||||
glTexCoord2f(0.5, 1); glVertex2f(2, 3);
|
||||
glEnd();
|
||||
/* glFinish(); */
|
||||
#endif
|
||||
|
||||
t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001;
|
||||
time = t1 - t0;
|
||||
count++;
|
||||
/* printf("total %f count %d\n", total, count); */
|
||||
} while (time < 3.0);
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
printf("total texels=%f time=%f\n", total, time);
|
||||
DownloadRate = total / time;
|
||||
printf("w*h=%d count=%d time=%f\n", w*h, count, time);
|
||||
DownloadRate = w * h * count / time;
|
||||
|
||||
#if 0
|
||||
if (!ScaleAndBias) {
|
||||
/* verify texture readback */
|
||||
glGetTexImage(GL_TEXTURE_2D, 0,
|
||||
FormatTable[Format].Format,
|
||||
FormatTable[Format].Type, getImage);
|
||||
for (i = 0; i < w * h; i++) {
|
||||
if (texImage[i] != getImage[i]) {
|
||||
printf("[%d] %d != %d\n", i, texImage[i], getImage[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
free(orig_texImage);
|
||||
free(orig_getImage);
|
||||
free(texImage);
|
||||
free(getImage);
|
||||
|
||||
{
|
||||
GLint err = glGetError();
|
@@ -82,60 +82,12 @@ static void render_image( void )
|
||||
glutSolidCone(1.0, 2.0, 16, 1);
|
||||
glPopMatrix();
|
||||
|
||||
#ifdef GL_HP_occlusion_test
|
||||
if (perf == 0) {
|
||||
GLboolean bRet;
|
||||
glDepthMask(GL_FALSE);
|
||||
glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
|
||||
glEnable(GL_OCCLUSION_TEST_HP);
|
||||
glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(0.75, 0.0, -1.0);
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat );
|
||||
glutSolidSphere(1.0, 20, 20);
|
||||
glPopMatrix();
|
||||
|
||||
glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet);
|
||||
printf("Occlusion test 1 (result should be 1): %d\n",bRet);
|
||||
|
||||
glDepthMask(GL_TRUE);
|
||||
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
|
||||
glDisable(GL_OCCLUSION_TEST_HP);
|
||||
}
|
||||
#endif
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(0.75, 0.0, -1.0);
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat );
|
||||
glutSolidSphere(1.0, 20, 20);
|
||||
glPopMatrix();
|
||||
|
||||
#ifdef GL_HP_occlusion_test
|
||||
if (perf == 0){
|
||||
GLboolean bRet;
|
||||
|
||||
glDepthMask(GL_FALSE);
|
||||
glColorMask(GL_FALSE,GL_FALSE,GL_FALSE,GL_FALSE);
|
||||
glEnable(GL_OCCLUSION_TEST_HP);
|
||||
glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet);
|
||||
|
||||
/* draw a sphere inside the previous sphere */
|
||||
glPushMatrix();
|
||||
glTranslatef(0.75, 0.0, -1.0);
|
||||
glMaterialfv( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, blue_mat );
|
||||
glutSolidSphere(0.5, 20, 20);
|
||||
glPopMatrix();
|
||||
|
||||
glGetBooleanv(GL_OCCLUSION_TEST_RESULT_HP,&bRet);
|
||||
printf("Occlusion test 2 (result should be 0): %d\n",bRet);
|
||||
|
||||
glDepthMask(GL_TRUE);
|
||||
glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE);
|
||||
glDisable(GL_OCCLUSION_TEST_HP);
|
||||
}
|
||||
#endif
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
/* This is very important!!!
|
||||
|
@@ -10,11 +10,14 @@ include $(TOP)/configs/current
|
||||
|
||||
LIBS = $(APP_LIB_DEPS)
|
||||
|
||||
SOURCES = antialias.c \
|
||||
SOURCES = \
|
||||
afsmultiarb.c \
|
||||
antialias.c \
|
||||
arbfpspec.c \
|
||||
arbfptest1.c \
|
||||
arbfptexture.c \
|
||||
arbfptrig.c \
|
||||
arbnpot.c \
|
||||
arbvptest1.c \
|
||||
arbvptest3.c \
|
||||
arbvptorus.c \
|
||||
@@ -22,14 +25,15 @@ SOURCES = antialias.c \
|
||||
blendminmax.c \
|
||||
blendsquare.c \
|
||||
bufferobj.c \
|
||||
bug_3050.c \
|
||||
bug_3101.c \
|
||||
bug_3195.c \
|
||||
copypixrate.c \
|
||||
crossbar.c \
|
||||
cva.c \
|
||||
dinoshade.c \
|
||||
floattex.c \
|
||||
fbotest1.c \
|
||||
fbotest2.c \
|
||||
fbotexture.c \
|
||||
fog.c \
|
||||
fogcoord.c \
|
||||
@@ -38,6 +42,7 @@ SOURCES = antialias.c \
|
||||
getprocaddress.c \
|
||||
interleave.c \
|
||||
invert.c \
|
||||
jkrahntest.c \
|
||||
manytex.c \
|
||||
multipal.c \
|
||||
no_s3tc.c \
|
||||
|
@@ -1,13 +1,9 @@
|
||||
|
||||
/*
|
||||
* GL_ARB_multitexture demo
|
||||
* GL_ATI_fragment_shader test
|
||||
* Roland Scheidegger
|
||||
*
|
||||
* Command line options:
|
||||
* -info print GL implementation information
|
||||
*
|
||||
*
|
||||
* Brian Paul November 1998 This program is in the public domain.
|
||||
* Modified on 12 Feb 2002 for > 2 texture units.
|
||||
*/
|
||||
|
||||
|
||||
|
162
progs/tests/bug_3050.c
Normal file
162
progs/tests/bug_3050.c
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* (C) Copyright IBM Corporation 2006
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||
* license, and/or sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file bug_3050.c
|
||||
*
|
||||
* Simple regression test for bug #3050. Create a texture and make a few
|
||||
* calls to \c glGetTexLevelParameteriv. If the bug still exists, trying
|
||||
* to get \c GL_TEXTURE_WITDH will cause a protocol error.
|
||||
*
|
||||
* This test \b only applies to indirect-rendering. This may mean that the
|
||||
* test needs to be run with the environment variable \c LIBGL_ALWAYS_INDIRECT
|
||||
* set to a non-zero value.
|
||||
*
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
static int Width = 400;
|
||||
static int Height = 200;
|
||||
static const GLfloat Near = 5.0, Far = 25.0;
|
||||
|
||||
|
||||
static void Display( void )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void Init( void )
|
||||
{
|
||||
unsigned i;
|
||||
static const GLenum pnames[] = {
|
||||
GL_TEXTURE_RED_SIZE,
|
||||
GL_TEXTURE_GREEN_SIZE,
|
||||
GL_TEXTURE_BLUE_SIZE,
|
||||
GL_TEXTURE_ALPHA_SIZE,
|
||||
GL_TEXTURE_LUMINANCE_SIZE,
|
||||
GL_TEXTURE_INTENSITY_SIZE,
|
||||
GL_TEXTURE_BORDER,
|
||||
GL_TEXTURE_INTERNAL_FORMAT,
|
||||
GL_TEXTURE_WIDTH,
|
||||
GL_TEXTURE_HEIGHT,
|
||||
GL_TEXTURE_DEPTH,
|
||||
~0
|
||||
};
|
||||
|
||||
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
|
||||
printf("\nThis program should log some data about a texture and exit.\n");
|
||||
printf("This is a regression test for bug #3050. If the bug still\n");
|
||||
printf("exists, a GLX protocol error will be generated.\n");
|
||||
printf("https://bugs.freedesktop.org/show_bug.cgi?id=3050\n\n");
|
||||
|
||||
|
||||
if ( ! glutExtensionSupported( "GL_NV_texture_rectangle" )
|
||||
&& ! glutExtensionSupported( "GL_EXT_texture_rectangle" )
|
||||
&& ! glutExtensionSupported( "GL_ARB_texture_rectangle" ) ) {
|
||||
printf( "This test requires one of GL_ARB_texture_rectangle, GL_EXT_texture_rectangle,\n"
|
||||
"or GL_NV_texture_rectangle be supported\n." );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
|
||||
glBindTexture( GL_TEXTURE_RECTANGLE_NV, 1 );
|
||||
glTexImage2D( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, GL_RGBA, 8, 8, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, NULL );
|
||||
|
||||
for ( i = 0 ; pnames[i] != ~0 ; i++ ) {
|
||||
GLint param_i;
|
||||
GLfloat param_f;
|
||||
GLenum err;
|
||||
|
||||
glGetTexLevelParameteriv( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, pnames[i], & param_i );
|
||||
err = glGetError();
|
||||
|
||||
if ( err ) {
|
||||
printf("glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) generated a GL\n"
|
||||
"error of 0x%04x!",
|
||||
pnames[i], err );
|
||||
exit( 1 );
|
||||
}
|
||||
else {
|
||||
printf("glGetTexLevelParameteriv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) = 0x%04x\n",
|
||||
pnames[i], param_i );
|
||||
}
|
||||
|
||||
|
||||
glGetTexLevelParameterfv( GL_PROXY_TEXTURE_RECTANGLE_NV, 0, pnames[i], & param_f );
|
||||
err = glGetError();
|
||||
|
||||
if ( err ) {
|
||||
printf("glGetTexLevelParameterfv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) generated a GL\n"
|
||||
"error of 0x%04x!\n",
|
||||
pnames[i], err );
|
||||
exit( 1 );
|
||||
}
|
||||
else {
|
||||
printf("glGetTexLevelParameterfv(GL_PROXY_TEXTURE_RECTANGLE_NV, 0, 0x%04x, & param) = %.1f (0x%04x)\n",
|
||||
pnames[i], param_f, (GLint) param_f );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( Width, Height );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
|
||||
glutCreateWindow( "Bug #3050 Test" );
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutDisplayFunc( Display );
|
||||
Init();
|
||||
return 0;
|
||||
}
|
@@ -185,8 +185,8 @@ static void Init( void )
|
||||
printf("\nThis program should function nearly identically to Mesa's lodbias demo.\n"
|
||||
"It should cycle through the complet LOD bias range once and exit. If bug\n"
|
||||
"#3195 still exists, the demo should crash almost immediatly.\n");
|
||||
printf("This is a regression test for bug #3101.\n");
|
||||
printf("https://bugs.freedesktop.org/show_bug.cgi?id=3101\n");
|
||||
printf("This is a regression test for bug #3195.\n");
|
||||
printf("https://bugs.freedesktop.org/show_bug.cgi?id=3195\n");
|
||||
|
||||
if (!glutExtensionSupported("GL_EXT_texture_lod_bias")) {
|
||||
printf("Sorry, GL_EXT_texture_lod_bias not supported by this renderer.\n");
|
||||
|
259
progs/tests/copypixrate.c
Normal file
259
progs/tests/copypixrate.c
Normal file
@@ -0,0 +1,259 @@
|
||||
/*
|
||||
* Measure glCopyPixels speed
|
||||
*
|
||||
* Brian Paul
|
||||
* 26 Jan 2006
|
||||
*/
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
static GLint WinWidth = 1000, WinHeight = 800;
|
||||
static GLint ImgWidth, ImgHeight;
|
||||
|
||||
static GLenum Buffer = GL_FRONT;
|
||||
static GLenum AlphaTest = GL_FALSE;
|
||||
static GLboolean UseBlit = GL_FALSE;
|
||||
|
||||
static PFNGLBLITFRAMEBUFFEREXTPROC glBlitFramebufferEXT_func = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* draw teapot in lower-left corner of window
|
||||
*/
|
||||
static void
|
||||
DrawTestImage(void)
|
||||
{
|
||||
GLfloat ar;
|
||||
|
||||
ImgWidth = WinWidth / 3;
|
||||
ImgHeight = WinHeight / 3;
|
||||
|
||||
glViewport(0, 0, ImgWidth, ImgHeight);
|
||||
glScissor(0, 0, ImgWidth, ImgHeight);
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
glClearColor(0.5, 0.5, 0.5, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
ar = (float) WinWidth / WinHeight;
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glFrontFace(GL_CW);
|
||||
glPushMatrix();
|
||||
glRotatef(45, 1, 0, 0);
|
||||
glutSolidTeapot(2.0);
|
||||
glPopMatrix();
|
||||
glFrontFace(GL_CCW);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
glViewport(0, 0, WinWidth, WinHeight);
|
||||
glFinish();
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
Rand(int max)
|
||||
{
|
||||
return ((int) random()) % max;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Measure glCopyPixels rate
|
||||
*/
|
||||
static void
|
||||
RunTest(void)
|
||||
{
|
||||
double t1, t0 = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
|
||||
int iters = 0;
|
||||
float copyRate, mbRate;
|
||||
int r, g, b, a, bpp;
|
||||
|
||||
if (AlphaTest) {
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glAlphaFunc(GL_GREATER, 0.0);
|
||||
}
|
||||
|
||||
glGetIntegerv(GL_RED_BITS, &r);
|
||||
glGetIntegerv(GL_GREEN_BITS, &g);
|
||||
glGetIntegerv(GL_BLUE_BITS, &b);
|
||||
glGetIntegerv(GL_ALPHA_BITS, &a);
|
||||
bpp = (r + g + b + a) / 8;
|
||||
|
||||
do {
|
||||
int x, y;
|
||||
x = Rand(WinWidth);
|
||||
y = Rand(WinHeight);
|
||||
|
||||
if (x > ImgWidth || y > ImgHeight) {
|
||||
#ifdef GL_EXT_framebuffer_blit
|
||||
if (UseBlit)
|
||||
{
|
||||
glBlitFramebufferEXT_func(0, 0, ImgWidth, ImgHeight,
|
||||
x, y, x + ImgWidth, y + ImgHeight,
|
||||
GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
glWindowPos2iARB(x, y);
|
||||
glCopyPixels(0, 0, ImgWidth, ImgHeight, GL_COLOR);
|
||||
}
|
||||
glFinish(); /* XXX OK? */
|
||||
|
||||
iters++;
|
||||
|
||||
t1 = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
|
||||
}
|
||||
} while (t1 - t0 < 5.0);
|
||||
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
|
||||
copyRate = iters / (t1 - t0);
|
||||
mbRate = ImgWidth * ImgHeight * bpp * copyRate / (1024 * 1024);
|
||||
|
||||
printf("Image size: %d x %d, %d Bpp\n", ImgWidth, ImgHeight, bpp);
|
||||
printf("%d copies in %.2f = %.2f copies/sec, %.2f MB/s\n",
|
||||
iters, t1-t0, copyRate, mbRate);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Draw(void)
|
||||
{
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClearColor(0.2, 0.2, 0.8, 0);
|
||||
glReadBuffer(Buffer);
|
||||
glDrawBuffer(Buffer);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
DrawTestImage();
|
||||
|
||||
RunTest();
|
||||
|
||||
if (Buffer == GL_FRONT)
|
||||
glFinish();
|
||||
else
|
||||
glutSwapBuffers();
|
||||
|
||||
printf("exiting\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -15.0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Key(unsigned char key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
SpecialKey(int key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case GLUT_KEY_UP:
|
||||
break;
|
||||
case GLUT_KEY_DOWN:
|
||||
break;
|
||||
case GLUT_KEY_LEFT:
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ParseArgs(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-back") == 0)
|
||||
Buffer = GL_BACK;
|
||||
else if (strcmp(argv[i], "-alpha") == 0)
|
||||
AlphaTest = GL_TRUE;
|
||||
else if (strcmp(argv[i], "-blit") == 0)
|
||||
UseBlit = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
if (glutExtensionSupported("GL_EXT_framebuffer_blit")) {
|
||||
glBlitFramebufferEXT_func = (PFNGLBLITFRAMEBUFFEREXTPROC)
|
||||
glutGetProcAddress("glBlitFramebufferEXT");
|
||||
}
|
||||
else if (UseBlit) {
|
||||
printf("Warning: GL_EXT_framebuffer_blit not supported.\n");
|
||||
UseBlit = GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
GLint mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE | GLUT_DEPTH;
|
||||
glutInit(&argc, argv);
|
||||
|
||||
ParseArgs(argc, argv);
|
||||
if (AlphaTest)
|
||||
mode |= GLUT_ALPHA;
|
||||
|
||||
glutInitWindowPosition(0, 0);
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(mode);
|
||||
glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
glutDisplayFunc(Draw);
|
||||
|
||||
printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("Draw Buffer: %s\n", (Buffer == GL_BACK) ? "Back" : "Front");
|
||||
Init();
|
||||
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
@@ -1,204 +0,0 @@
|
||||
/*
|
||||
* Test GL_EXT_framebuffer_object
|
||||
*
|
||||
* Brian Paul
|
||||
* 19 Mar 2006
|
||||
*/
|
||||
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
static int Width = 400, Height = 400;
|
||||
static GLuint MyFB, ColorRb, DepthRb;
|
||||
static GLboolean Animate = GL_FALSE;
|
||||
static GLfloat Rotation = 0.0;
|
||||
|
||||
|
||||
static void
|
||||
CheckError(int line)
|
||||
{
|
||||
GLenum err = glGetError();
|
||||
if (err) {
|
||||
printf("fbotest1: GL Error 0x%x at line %d\n", (int) err, line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Display( void )
|
||||
{
|
||||
GLubyte *buffer = malloc(Width * Height * 4);
|
||||
GLenum status;
|
||||
|
||||
printf("Drawing\n");
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
/* draw to user framebuffer */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
printf("fbotest1: Error: Framebuffer is incomplete!!!\n");
|
||||
}
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
glClearColor(0.5, 0.5, 1.0, 0.0);
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(30.0, 1, 0, 0);
|
||||
glRotatef(Rotation, 0, 1, 0);
|
||||
glutSolidTeapot(2.0);
|
||||
glPopMatrix();
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_LIGHTING);
|
||||
|
||||
/* read from user framebuffer */
|
||||
glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
|
||||
/* draw to window */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glWindowPos2iARB(0, 0);
|
||||
glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
|
||||
free(buffer);
|
||||
glutSwapBuffers();
|
||||
CheckError(__LINE__);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape( int width, int height )
|
||||
{
|
||||
float ar = (float) width / (float) height;
|
||||
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glFrustum( -ar, ar, -1.0, 1.0, 5.0, 25.0 );
|
||||
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
glTranslatef( 0.0, 0.0, -15.0 );
|
||||
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorRb);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, width, height);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRb);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT,
|
||||
width, height);
|
||||
|
||||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteFramebuffersEXT(1, &MyFB);
|
||||
glDeleteRenderbuffersEXT(1, &ColorRb);
|
||||
glDeleteRenderbuffersEXT(1, &DepthRb);
|
||||
assert(!glIsFramebufferEXT(MyFB));
|
||||
assert(!glIsRenderbufferEXT(ColorRb));
|
||||
assert(!glIsRenderbufferEXT(DepthRb));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Idle(void)
|
||||
{
|
||||
Rotation = glutGet(GLUT_ELAPSED_TIME) * 0.1;
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 'a':
|
||||
Animate = !Animate;
|
||||
if (Animate)
|
||||
glutIdleFunc(Idle);
|
||||
else
|
||||
glutIdleFunc(NULL);
|
||||
break;
|
||||
case 27:
|
||||
CleanUp();
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init( void )
|
||||
{
|
||||
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
|
||||
printf("fbotest1: GL_EXT_framebuffer_object not found!\n");
|
||||
exit(0);
|
||||
}
|
||||
printf("fbotest1: GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
||||
glGenFramebuffersEXT(1, &MyFB);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
|
||||
assert(glIsFramebufferEXT(MyFB));
|
||||
|
||||
/* set color buffer */
|
||||
glGenRenderbuffersEXT(1, &ColorRb);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, ColorRb);
|
||||
assert(glIsRenderbufferEXT(ColorRb));
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT,
|
||||
GL_RENDERBUFFER_EXT, ColorRb);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
|
||||
|
||||
/* setup depth buffer */
|
||||
glGenRenderbuffersEXT(1, &DepthRb);
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRb);
|
||||
assert(glIsRenderbufferEXT(DepthRb));
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, DepthRb);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, Width, Height);
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
/* restore to default */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
CheckError(__LINE__);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize(Width, Height);
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
|
||||
glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutDisplayFunc( Display );
|
||||
if (Animate)
|
||||
glutIdleFunc(Idle);
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
@@ -20,16 +20,23 @@
|
||||
/* For debug */
|
||||
#define DEPTH 1
|
||||
#define STENCIL 1
|
||||
#define DRAW 1
|
||||
|
||||
|
||||
static int Width = 400, Height = 400;
|
||||
|
||||
static GLenum TexTarget = GL_TEXTURE_2D; /*GL_TEXTURE_RECTANGLE_ARB;*/
|
||||
static int TexWidth = 512, TexHeight = 512;
|
||||
/*static int TexWidth = 600, TexHeight = 600;*/
|
||||
|
||||
static GLuint MyFB;
|
||||
static GLuint TexObj;
|
||||
static GLuint DepthRB, StencilRB;
|
||||
static GLboolean Anim = GL_FALSE;
|
||||
static GLfloat Rot = 0.0;
|
||||
static GLboolean UsePackedDepthStencil = GL_FALSE;
|
||||
static GLuint TextureLevel = 1; /* which texture level to render to */
|
||||
static GLenum TexIntFormat = GL_RGB; /* either GL_RGB or GL_RGBA */
|
||||
|
||||
|
||||
static void
|
||||
@@ -45,7 +52,7 @@ CheckError(int line)
|
||||
static void
|
||||
Idle(void)
|
||||
{
|
||||
Rot = glutGet(GLUT_ELAPSED_TIME) * 0.05;
|
||||
Rot = glutGet(GLUT_ELAPSED_TIME) * 0.1;
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
@@ -53,7 +60,6 @@ Idle(void)
|
||||
static void
|
||||
RenderTexture(void)
|
||||
{
|
||||
GLint level = 0;
|
||||
GLenum status;
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
@@ -64,10 +70,7 @@ RenderTexture(void)
|
||||
glTranslatef(0.0, 0.0, -15.0);
|
||||
|
||||
/* draw to texture image */
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_TEXTURE_2D, TexObj, level);
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
@@ -82,6 +85,7 @@ RenderTexture(void)
|
||||
|
||||
#if DEPTH
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
#endif
|
||||
|
||||
#if STENCIL
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
@@ -91,6 +95,7 @@ RenderTexture(void)
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
#if DEPTH || STENCIL
|
||||
/* draw diamond-shaped stencil pattern */
|
||||
glColor3f(0, 1, 0);
|
||||
glBegin(GL_POLYGON);
|
||||
@@ -99,6 +104,7 @@ RenderTexture(void)
|
||||
glVertex2f( 0.2, 0.0);
|
||||
glVertex2f( 0.0, 0.2);
|
||||
glEnd();
|
||||
#endif
|
||||
|
||||
/* draw teapot where stencil != 1 */
|
||||
#if STENCIL
|
||||
@@ -107,7 +113,6 @@ RenderTexture(void)
|
||||
#endif
|
||||
|
||||
CheckError(__LINE__);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
glBegin(GL_POLYGON);
|
||||
@@ -126,12 +131,18 @@ RenderTexture(void)
|
||||
glutSolidTeapot(0.5);
|
||||
glPopMatrix();
|
||||
glDisable(GL_LIGHTING);
|
||||
/*
|
||||
PrintStencilHistogram(TexWidth, TexHeight);
|
||||
*/
|
||||
#endif
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
|
||||
#if DRAW
|
||||
/* Bind normal framebuffer */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
#endif
|
||||
|
||||
CheckError(__LINE__);
|
||||
}
|
||||
@@ -146,7 +157,7 @@ Display(void)
|
||||
RenderTexture();
|
||||
|
||||
/* draw textured quad in the window */
|
||||
|
||||
#if DRAW
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0);
|
||||
@@ -161,23 +172,38 @@ Display(void)
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(Rot, 0, 1, 0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, TexObj);
|
||||
glEnable(TexTarget);
|
||||
glBindTexture(TexTarget, TexObj);
|
||||
glBegin(GL_POLYGON);
|
||||
glColor3f(0.25, 0.25, 0.25);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(-1, -1);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2f(1, -1);
|
||||
glColor3f(1.0, 1.0, 1.0);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2f(1, 1);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2f(-1, 1);
|
||||
if (TexTarget == GL_TEXTURE_2D) {
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(-1, -1);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2f(1, -1);
|
||||
glColor3f(1.0, 1.0, 1.0);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2f(1, 1);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2f(-1, 1);
|
||||
}
|
||||
else {
|
||||
assert(TexTarget == GL_TEXTURE_RECTANGLE_ARB);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(-1, -1);
|
||||
glTexCoord2f(TexWidth, 0);
|
||||
glVertex2f(1, -1);
|
||||
glColor3f(1.0, 1.0, 1.0);
|
||||
glTexCoord2f(TexWidth, TexHeight);
|
||||
glVertex2f(1, 1);
|
||||
glTexCoord2f(0, TexHeight);
|
||||
glVertex2f(-1, 1);
|
||||
}
|
||||
glEnd();
|
||||
glPopMatrix();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glDisable(TexTarget);
|
||||
#endif
|
||||
|
||||
glutSwapBuffers();
|
||||
CheckError(__LINE__);
|
||||
}
|
||||
@@ -237,6 +263,7 @@ Key(unsigned char key, int x, int y)
|
||||
static void
|
||||
Init(int argc, char *argv[])
|
||||
{
|
||||
static const GLfloat mat[4] = { 1.0, 0.5, 0.5, 1.0 };
|
||||
GLint i;
|
||||
|
||||
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
|
||||
@@ -268,6 +295,30 @@ Init(int argc, char *argv[])
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &i);
|
||||
assert(i == MyFB);
|
||||
|
||||
/* Make texture object/image */
|
||||
glGenTextures(1, &TexObj);
|
||||
glBindTexture(TexTarget, TexObj);
|
||||
/* make two image levels */
|
||||
glTexImage2D(TexTarget, 0, TexIntFormat, TexWidth, TexHeight, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexImage2D(TexTarget, 1, TexIntFormat, TexWidth/2, TexHeight/2, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
TexWidth = TexWidth >> TextureLevel;
|
||||
TexHeight = TexHeight >> TextureLevel;
|
||||
|
||||
glTexParameteri(TexTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(TexTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glTexParameteri(TexTarget, GL_TEXTURE_BASE_LEVEL, TextureLevel);
|
||||
glTexParameteri(TexTarget, GL_TEXTURE_MAX_LEVEL, TextureLevel);
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
/* Render color to texture */
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
TexTarget, TexObj, TextureLevel);
|
||||
|
||||
|
||||
#if DEPTH
|
||||
/* make depth renderbuffer */
|
||||
glGenRenderbuffersEXT(1, &DepthRB);
|
||||
@@ -323,21 +374,14 @@ Init(int argc, char *argv[])
|
||||
assert(i > 0);
|
||||
#endif
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
/* bind regular framebuffer */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
/* Make texture object/image */
|
||||
glGenTextures(1, &TexObj);
|
||||
glBindTexture(GL_TEXTURE_2D, TexObj);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TexWidth, TexHeight, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
CheckError(__LINE__);
|
||||
/* lighting */
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, mat);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: jkrahntest.c,v 1.1 2002/06/16 03:57:48 brianp Exp $ */
|
||||
/* $Id: jkrahntest.c,v 1.2 2006/01/30 17:12:10 brianp Exp $ */
|
||||
|
||||
/* This is a good test for glXSwapBuffers on non-current windows,
|
||||
* and the glXCopyContext function. Fixed several Mesa/DRI bugs with
|
||||
@@ -25,7 +25,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159
|
||||
#endif
|
||||
|
||||
#define DEGTOR (M_PI/180.0)
|
||||
|
||||
static int AttributeList[] = { GLX_RGBA, GLX_DOUBLEBUFFER, None };
|
||||
|
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "../util/readtex.c" /* a hack, I know */
|
||||
|
||||
#define IMAGE_FILE "../images/tree2.rgba"
|
||||
#define IMAGE_FILE "../images/girl.rgb"
|
||||
|
||||
static int ImgWidth, ImgHeight;
|
||||
static GLenum ImgFormat;
|
||||
@@ -32,8 +32,8 @@ static GLboolean Benchmark = GL_FALSE;
|
||||
static GLuint DrawPBO, TempPBO;
|
||||
|
||||
|
||||
static GLenum ReadFormat = GL_BGRA;
|
||||
static GLenum ReadType = GL_UNSIGNED_INT_8_8_8_8_REV;
|
||||
static GLenum ReadFormat = GL_RGBA;
|
||||
static GLenum ReadType = GL_UNSIGNED_BYTE;
|
||||
|
||||
|
||||
|
||||
|
@@ -17,8 +17,8 @@ static GLint TexWidth = 512, TexHeight = 512;
|
||||
|
||||
static GLuint TexObj = 1;
|
||||
|
||||
static GLenum IntFormat = GL_RGBA;
|
||||
static GLenum ReadFormat = GL_BGRA; /* for glReadPixels */
|
||||
static GLenum IntFormat = GL_RGBA8;
|
||||
static GLenum ReadFormat = GL_RGBA; /* for glReadPixels */
|
||||
|
||||
static GLboolean DrawQuad = GL_TRUE;
|
||||
|
||||
@@ -77,15 +77,15 @@ DoCopyTex(GLboolean doSubRect)
|
||||
int w = TexWidth / 2, h = TexHeight / 2;
|
||||
int x0 = 0, y0 = 0;
|
||||
int x1 = w, y1 = h;
|
||||
#if 0
|
||||
#if 1
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, x0, y0, w, h);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y0, x1, y0, w, h);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y1, x0, y1, w, h);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y1, x1, y1, w, h);
|
||||
#else
|
||||
/* scramble */
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, x1, y1, w, h);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y0, x0, y1, w, h);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, x1, y1, w, h);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y0, x0, y1, w, h);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x0, y1, x1, y0, w, h);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, x1, y1, x0, y0, w, h);
|
||||
#endif
|
||||
@@ -110,31 +110,26 @@ SubTex(GLboolean doSubRect, const GLubyte *image)
|
||||
int x1 = w, y1 = h;
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, TexWidth);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glPixelStorei( GL_PACK_INVERT_MESA, GL_TRUE );
|
||||
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
|
||||
/* glPixelStorei(GL_UNPACK_SKIP_ROWS, y0); */
|
||||
/* glPixelStorei(GL_UNPACK_SKIP_PIXELS, x0); */
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, y0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, x0);
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y0, w, h,
|
||||
ReadFormat, GL_UNSIGNED_BYTE, image);
|
||||
|
||||
/* glPixelStorei(GL_UNPACK_SKIP_ROWS, y0); */
|
||||
/* glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1); */
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, y0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1);
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, x1, y0, w, h,
|
||||
ReadFormat, GL_UNSIGNED_BYTE, image);
|
||||
|
||||
/* glPixelStorei(GL_UNPACK_SKIP_ROWS, y1); */
|
||||
/* glPixelStorei(GL_UNPACK_SKIP_PIXELS, x0); */
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, y1);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, x0);
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, x0, y1, w, h,
|
||||
ReadFormat, GL_UNSIGNED_BYTE, image);
|
||||
|
||||
/* glPixelStorei(GL_UNPACK_SKIP_ROWS, y1); */
|
||||
/* glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1); */
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, y1);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1);
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, x1, y1, w, h,
|
||||
ReadFormat, GL_UNSIGNED_BYTE, image);
|
||||
glPixelStorei( GL_PACK_INVERT_MESA, GL_FALSE );
|
||||
|
||||
}
|
||||
else {
|
||||
/* all at once */
|
||||
@@ -178,9 +173,6 @@ RunTest(GLboolean copyTex, GLboolean doSubRect)
|
||||
|
||||
t0 = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
|
||||
|
||||
if (!DrawQuad)
|
||||
glDrawBuffer(GL_FRONT);
|
||||
|
||||
do {
|
||||
if (copyTex)
|
||||
/* Framebuffer -> Texture */
|
||||
@@ -202,36 +194,16 @@ RunTest(GLboolean copyTex, GLboolean doSubRect)
|
||||
glTexCoord2f(0, 1); glVertex2f(-1, 1);
|
||||
glEnd();
|
||||
glPopMatrix();
|
||||
glutSwapBuffers();
|
||||
}
|
||||
else {
|
||||
/* Draw something tiny to ensure that the texture is really
|
||||
* uploaded:
|
||||
*/
|
||||
glPushMatrix();
|
||||
glRotatef(rot, 0, 0, 1);
|
||||
glTranslatef(1, 0, 0);
|
||||
glBegin(GL_POLYGON);
|
||||
glTexCoord2f(0, 0); glVertex2f(-.01, -.01);
|
||||
glTexCoord2f(.01, 0); glVertex2f( .01, -.01);
|
||||
glTexCoord2f(.01, .01); glVertex2f( .01, .01);
|
||||
glTexCoord2f(0, .01); glVertex2f(-.01, .01);
|
||||
glEnd();
|
||||
glPopMatrix();
|
||||
glFlush();
|
||||
}
|
||||
|
||||
iters++;
|
||||
rot += 2.0;
|
||||
|
||||
t1 = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
|
||||
} while (t1 - t0 < 2.0);
|
||||
|
||||
/* Make sure everything is done before taking the final timing:
|
||||
*/
|
||||
glFinish();
|
||||
t1 = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
|
||||
|
||||
if (DrawQuad) {
|
||||
glutSwapBuffers();
|
||||
}
|
||||
} while (t1 - t0 < 5.0);
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
if (image)
|
||||
@@ -270,15 +242,15 @@ Draw(void)
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
RunTest(GL_FALSE, GL_FALSE);
|
||||
RunTest(GL_FALSE, GL_TRUE);
|
||||
RunTest(GL_TRUE, GL_FALSE);
|
||||
RunTest(GL_FALSE, GL_FALSE);
|
||||
RunTest(GL_FALSE, GL_TRUE);
|
||||
RunTest(GL_TRUE, GL_FALSE);
|
||||
RunTest(GL_TRUE, GL_TRUE);
|
||||
|
||||
glutSwapBuffers();
|
||||
glutSwapBuffers();
|
||||
|
||||
/* printf("exiting\n"); */
|
||||
/* exit(0); */
|
||||
printf("exiting\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -97,7 +97,7 @@ static rawImageRec *RawImageOpen(const char *fileName)
|
||||
swapFlag = GL_FALSE;
|
||||
}
|
||||
|
||||
raw = (rawImageRec *)malloc(sizeof(rawImageRec));
|
||||
raw = (rawImageRec *)calloc(1, sizeof(rawImageRec));
|
||||
if (raw == NULL) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
return NULL;
|
||||
@@ -148,12 +148,15 @@ static rawImageRec *RawImageOpen(const char *fileName)
|
||||
|
||||
static void RawImageClose(rawImageRec *raw)
|
||||
{
|
||||
|
||||
fclose(raw->file);
|
||||
free(raw->tmp);
|
||||
free(raw->tmpR);
|
||||
free(raw->tmpG);
|
||||
free(raw->tmpB);
|
||||
if (raw->rowStart)
|
||||
free(raw->rowStart);
|
||||
if (raw->rowSize)
|
||||
free(raw->rowSize);
|
||||
if (raw->sizeZ>3) {
|
||||
free(raw->tmpA);
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@ LIB_DEP = $(LIB_DIR)/$(GL_LIB_NAME) $(LIB_DIR)/$(GLU_LIB_NAME)
|
||||
PROGS = glthreads \
|
||||
glxdemo \
|
||||
glxgears \
|
||||
fgl_glxgears \
|
||||
glxgears_fbconfig \
|
||||
glxcontexts \
|
||||
glxheads \
|
||||
|
@@ -23,6 +23,7 @@
|
||||
/*
|
||||
* This program tests GLX thread safety.
|
||||
* Command line options:
|
||||
* -p Open a display connection for each thread
|
||||
* -n <num threads> Number of threads to create (default is 2)
|
||||
* -display <display name> Specify X display (default is :0.0)
|
||||
*
|
||||
@@ -32,6 +33,7 @@
|
||||
|
||||
#if defined(PTHREADS) /* defined by Mesa on Linux and other platforms */
|
||||
|
||||
#include <assert.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
#include <stdio.h>
|
||||
@@ -61,6 +63,10 @@ static struct winthread WinThreads[MAX_WINTHREADS];
|
||||
static int NumWinThreads = 0;
|
||||
static volatile GLboolean ExitFlag = GL_FALSE;
|
||||
|
||||
static GLboolean MultiDisplays = 0;
|
||||
static GLboolean Locking = 0;
|
||||
|
||||
static pthread_mutex_t Mutex;
|
||||
|
||||
|
||||
static void
|
||||
@@ -145,9 +151,22 @@ resize(struct winthread *wt, int w, int h)
|
||||
static void
|
||||
draw_loop(struct winthread *wt)
|
||||
{
|
||||
GLboolean firstIter = GL_TRUE;
|
||||
|
||||
while (!ExitFlag) {
|
||||
|
||||
if (Locking)
|
||||
pthread_mutex_lock(&Mutex);
|
||||
|
||||
glXMakeCurrent(wt->Dpy, wt->Win, wt->Context);
|
||||
if (firstIter) {
|
||||
printf("glthreads: %d: GL_RENDERER = %s\n", wt->Index,
|
||||
(char *) glGetString(GL_RENDERER));
|
||||
firstIter = GL_FALSE;
|
||||
}
|
||||
|
||||
if (Locking)
|
||||
pthread_mutex_unlock(&Mutex);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
@@ -172,8 +191,15 @@ draw_loop(struct winthread *wt)
|
||||
draw_object();
|
||||
glPopMatrix();
|
||||
|
||||
if (Locking)
|
||||
pthread_mutex_lock(&Mutex);
|
||||
|
||||
glXSwapBuffers(wt->Dpy, wt->Win);
|
||||
|
||||
if (Locking)
|
||||
pthread_mutex_unlock(&Mutex);
|
||||
|
||||
usleep(5000);
|
||||
wt->Angle += 1.0;
|
||||
}
|
||||
}
|
||||
@@ -181,6 +207,7 @@ draw_loop(struct winthread *wt)
|
||||
|
||||
/*
|
||||
* The main process thread runs this loop.
|
||||
* Single display connection for all threads.
|
||||
*/
|
||||
static void
|
||||
event_loop(Display *dpy)
|
||||
@@ -188,8 +215,28 @@ event_loop(Display *dpy)
|
||||
XEvent event;
|
||||
int i;
|
||||
|
||||
assert(!MultiDisplays);
|
||||
|
||||
while (!ExitFlag) {
|
||||
XNextEvent(dpy, &event);
|
||||
|
||||
if (Locking) {
|
||||
while (1) {
|
||||
int k;
|
||||
pthread_mutex_lock(&Mutex);
|
||||
k = XPending(dpy);
|
||||
if (k) {
|
||||
XNextEvent(dpy, &event);
|
||||
pthread_mutex_unlock(&Mutex);
|
||||
break;
|
||||
}
|
||||
pthread_mutex_unlock(&Mutex);
|
||||
usleep(5000);
|
||||
}
|
||||
}
|
||||
else {
|
||||
XNextEvent(dpy, &event);
|
||||
}
|
||||
|
||||
switch (event.type) {
|
||||
case ConfigureNotify:
|
||||
/* Find winthread for this event's window */
|
||||
@@ -214,6 +261,41 @@ event_loop(Display *dpy)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Separate display connection for each thread.
|
||||
*/
|
||||
static void
|
||||
event_loop_multi(void)
|
||||
{
|
||||
XEvent event;
|
||||
int w = 0;
|
||||
|
||||
assert(MultiDisplays);
|
||||
|
||||
while (!ExitFlag) {
|
||||
struct winthread *wt = &WinThreads[w];
|
||||
if (XPending(wt->Dpy)) {
|
||||
XNextEvent(wt->Dpy, &event);
|
||||
switch (event.type) {
|
||||
case ConfigureNotify:
|
||||
resize(wt, event.xconfigure.width, event.xconfigure.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
/* tell all threads to exit */
|
||||
ExitFlag = GL_TRUE;
|
||||
/*printf("exit draw_loop %d\n", wt->Index);*/
|
||||
return;
|
||||
default:
|
||||
/*no-op*/ ;
|
||||
}
|
||||
}
|
||||
w = (w + 1) % NumWinThreads;
|
||||
usleep(5000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* we'll call this once for each thread, before the threads are created.
|
||||
*/
|
||||
@@ -329,14 +411,14 @@ main(int argc, char *argv[])
|
||||
{
|
||||
char *displayName = ":0.0";
|
||||
int numThreads = 2;
|
||||
Display *dpy;
|
||||
Display *dpy = NULL;
|
||||
int i;
|
||||
Status threadStat;
|
||||
|
||||
if (argc == 1) {
|
||||
printf("threadgl: test of GL thread safety (any key = exit)\n");
|
||||
printf("glthreads: test of GL thread safety (any key = exit)\n");
|
||||
printf("Usage:\n");
|
||||
printf(" threadgl [-display dpyName] [-n numthreads]\n");
|
||||
printf(" glthreads [-display dpyName] [-n numthreads]\n");
|
||||
}
|
||||
else {
|
||||
int i;
|
||||
@@ -345,6 +427,12 @@ main(int argc, char *argv[])
|
||||
displayName = argv[i + 1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-p") == 0) {
|
||||
MultiDisplays = 1;
|
||||
}
|
||||
else if (strcmp(argv[i], "-l") == 0) {
|
||||
Locking = 1;
|
||||
}
|
||||
else if (strcmp(argv[i], "-n") == 0 && i + 1 < argc) {
|
||||
numThreads = atoi(argv[i + 1]);
|
||||
if (numThreads < 1)
|
||||
@@ -353,48 +441,88 @@ main(int argc, char *argv[])
|
||||
numThreads = MAX_WINTHREADS;
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "glthreads: unexpected flag: %s\n", argv[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Locking)
|
||||
printf("glthreads: Using explict locks around Xlib calls.\n");
|
||||
else
|
||||
printf("glthreads: No explict locking.\n");
|
||||
|
||||
if (MultiDisplays)
|
||||
printf("glthreads: Per-thread display connections.\n");
|
||||
else
|
||||
printf("glthreads: Single display connection.\n");
|
||||
|
||||
/*
|
||||
* VERY IMPORTANT: call XInitThreads() before any other Xlib functions.
|
||||
*/
|
||||
threadStat = XInitThreads();
|
||||
if (threadStat) {
|
||||
printf("XInitThreads() returned %d (success)\n", (int) threadStat);
|
||||
}
|
||||
else {
|
||||
printf("XInitThreads() returned 0 (failure- this program may fail)\n");
|
||||
if (!MultiDisplays) {
|
||||
if (!Locking) {
|
||||
threadStat = XInitThreads();
|
||||
if (threadStat) {
|
||||
printf("XInitThreads() returned %d (success)\n", (int) threadStat);
|
||||
}
|
||||
else {
|
||||
printf("XInitThreads() returned 0 (failure- this program may fail)\n");
|
||||
}
|
||||
}
|
||||
|
||||
dpy = XOpenDisplay(displayName);
|
||||
if (!dpy) {
|
||||
fprintf(stderr, "Unable to open display %s\n", displayName);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dpy = XOpenDisplay(displayName);
|
||||
if (!dpy) {
|
||||
fprintf(stderr, "Unable to open display %s\n", displayName);
|
||||
return -1;
|
||||
if (Locking) {
|
||||
pthread_mutex_init(&Mutex, NULL);
|
||||
}
|
||||
|
||||
printf("glthreads: creating windows\n");
|
||||
|
||||
NumWinThreads = numThreads;
|
||||
|
||||
/* Create the GLX windows and contexts */
|
||||
for (i = 0; i < numThreads; i++) {
|
||||
WinThreads[i].Dpy = dpy;
|
||||
if (MultiDisplays) {
|
||||
WinThreads[i].Dpy = XOpenDisplay(displayName);
|
||||
assert(WinThreads[i].Dpy);
|
||||
}
|
||||
else {
|
||||
WinThreads[i].Dpy = dpy;
|
||||
}
|
||||
WinThreads[i].Index = i;
|
||||
create_window(&WinThreads[i]);
|
||||
}
|
||||
|
||||
printf("glthreads: creating threads\n");
|
||||
|
||||
/* Create the threads */
|
||||
for (i = 0; i < numThreads; i++) {
|
||||
pthread_create(&WinThreads[i].Thread, NULL, thread_function,
|
||||
(void*) &WinThreads[i]);
|
||||
printf("Created Thread %d\n", (int) WinThreads[i].Thread);
|
||||
printf("glthreads: Created thread %u\n", (unsigned int) WinThreads[i].Thread);
|
||||
}
|
||||
|
||||
event_loop(dpy);
|
||||
if (MultiDisplays)
|
||||
event_loop_multi();
|
||||
else
|
||||
event_loop(dpy);
|
||||
|
||||
clean_up();
|
||||
|
||||
XCloseDisplay(dpy);
|
||||
if (MultiDisplays) {
|
||||
for (i = 0; i < numThreads; i++) {
|
||||
XCloseDisplay(WinThreads[i].Dpy);
|
||||
}
|
||||
}
|
||||
else {
|
||||
XCloseDisplay(dpy);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -262,6 +262,7 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits)
|
||||
ctx = glXCreateContext( dpy, visinfo, NULL, allowDirect );
|
||||
if (!ctx) {
|
||||
fprintf(stderr, "Error: glXCreateContext failed\n");
|
||||
XFree(visinfo);
|
||||
XDestroyWindow(dpy, win);
|
||||
return;
|
||||
}
|
||||
@@ -336,6 +337,7 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect, GLboolean limits)
|
||||
}
|
||||
|
||||
glXDestroyContext(dpy, ctx);
|
||||
XFree(visinfo);
|
||||
XDestroyWindow(dpy, win);
|
||||
}
|
||||
|
||||
|
@@ -31,6 +31,7 @@
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "eglcontext.h"
|
||||
#include "egldisplay.h"
|
||||
@@ -346,6 +347,7 @@ void (* APIENTRY eglGetProcAddress(const char *procname))()
|
||||
{ "eglWaitGL", (_EGLProc) eglWaitGL },
|
||||
{ "eglWaitNative", (_EGLProc) eglWaitNative },
|
||||
/* Extensions */
|
||||
#ifdef EGL_MESA_screen_surface
|
||||
{ "eglChooseModeMESA", (_EGLProc) eglChooseModeMESA },
|
||||
{ "eglGetModesMESA", (_EGLProc) eglGetModesMESA },
|
||||
{ "eglGetModeAttribMESA", (_EGLProc) eglGetModeAttribMESA },
|
||||
@@ -358,6 +360,14 @@ void (* APIENTRY eglGetProcAddress(const char *procname))()
|
||||
{ "eglQueryScreenSurfaceMESA", (_EGLProc) eglQueryScreenSurfaceMESA },
|
||||
{ "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA },
|
||||
{ "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA },
|
||||
#endif /* EGL_MESA_screen_surface */
|
||||
#ifdef EGL_VERSION_1_2
|
||||
{ "eglBindAPI", (_EGLProc) eglBindAPI },
|
||||
{ "eglCreatePbufferFromClientBuffer", (_EGLProc) eglCreatePbufferFromClientBuffer },
|
||||
{ "eglQueryAPI", (_EGLProc) eglQueryAPI },
|
||||
{ "eglReleaseThread", (_EGLProc) eglReleaseThread },
|
||||
{ "eglWaitClient", (_EGLProc) eglWaitClient },
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
{ NULL, NULL }
|
||||
};
|
||||
EGLint i;
|
||||
@@ -492,6 +502,85 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
** EGL 1.2
|
||||
**/
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
|
||||
EGLBoolean
|
||||
eglBindAPI(EGLenum api)
|
||||
{
|
||||
_EGLThreadInfo *t = _eglGetCurrentThread();
|
||||
|
||||
switch (api) {
|
||||
case EGL_OPENGL_ES_API:
|
||||
if (_eglGlobal.OpenGLESAPISupported) {
|
||||
t->CurrentAPI = api;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
_eglError(EGL_BAD_PARAMETER, "eglBindAPI");
|
||||
return EGL_FALSE;
|
||||
case EGL_OPENVG_API:
|
||||
if (_eglGlobal.OpenVGAPISupported) {
|
||||
t->CurrentAPI = api;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
_eglError(EGL_BAD_PARAMETER, "eglBindAPI");
|
||||
return EGL_FALSE;
|
||||
default:
|
||||
return EGL_FALSE;
|
||||
}
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
EGLSurface
|
||||
eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype,
|
||||
EGLClientBuffer buffer, EGLConfig config,
|
||||
const EGLint *attrib_list)
|
||||
{
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
return drv->API.CreatePbufferFromClientBuffer(drv, dpy, buftype, buffer,
|
||||
config, attrib_list);
|
||||
}
|
||||
|
||||
|
||||
EGLenum
|
||||
eglQueryAPI(void)
|
||||
{
|
||||
/* returns one of EGL_OPENGL_ES_API or EGL_OPENVG_API */
|
||||
_EGLThreadInfo *t = _eglGetCurrentThread();
|
||||
return t->CurrentAPI;
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean
|
||||
eglReleaseThread(void)
|
||||
{
|
||||
_EGLThreadInfo *t = _eglGetCurrentThread();
|
||||
EGLDisplay dpy = eglGetCurrentDisplay();
|
||||
if (dpy) {
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
/* unbind context */
|
||||
(void) drv->API.MakeCurrent(drv, dpy, EGL_NO_SURFACE,
|
||||
EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
}
|
||||
_eglDeleteThreadData(t);
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
EGLBoolean
|
||||
eglWaitClient(void)
|
||||
{
|
||||
EGLDisplay dpy = eglGetCurrentDisplay();
|
||||
if (dpy != EGL_NO_DISPLAY) {
|
||||
_EGLDriver *drv = _eglLookupDriver(dpy);
|
||||
return drv->API.WaitClient(drv, dpy);
|
||||
}
|
||||
else
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
|
@@ -40,7 +40,7 @@ typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, EGLDisplay dpy);
|
||||
typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, EGLDisplay dpy, EGLint engine);
|
||||
|
||||
|
||||
/* EGL_MESA_screen extension */
|
||||
#ifdef EGL_MESA_screen_surface
|
||||
typedef EGLBoolean (*ChooseModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
|
||||
typedef EGLBoolean (*GetModesMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint mode_size, EGLint *num_mode);
|
||||
typedef EGLBoolean (*GetModeAttribMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
|
||||
@@ -53,6 +53,14 @@ typedef EGLBoolean (*QueryScreenMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScre
|
||||
typedef EGLBoolean (*QueryScreenSurfaceMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
|
||||
typedef EGLBoolean (*QueryScreenModeMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
|
||||
typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, EGLDisplay dpy, EGLModeMESA mode);
|
||||
#endif /* EGL_MESA_screen_surface */
|
||||
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, EGLDisplay dpy);
|
||||
typedef EGLSurface (*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -101,6 +109,11 @@ struct _egl_api
|
||||
QueryScreenSurfaceMESA_t QueryScreenSurfaceMESA;
|
||||
QueryScreenModeMESA_t QueryScreenModeMESA;
|
||||
QueryModeStringMESA_t QueryModeStringMESA;
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
WaitClient_t WaitClient;
|
||||
CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* EGLAPI_INCLUDED */
|
||||
|
@@ -92,6 +92,10 @@ _eglInitConfig(_EGLConfig *config, EGLint id)
|
||||
_eglSetConfigAttrib(config, EGL_TRANSPARENT_RED_VALUE, EGL_DONT_CARE);
|
||||
_eglSetConfigAttrib(config, EGL_TRANSPARENT_GREEN_VALUE, EGL_DONT_CARE);
|
||||
_eglSetConfigAttrib(config, EGL_TRANSPARENT_BLUE_VALUE, EGL_DONT_CARE);
|
||||
#ifdef EGL_VERSION_1_2
|
||||
_eglSetConfigAttrib(config, EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
|
||||
_eglSetConfigAttrib(config, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT);
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
}
|
||||
|
||||
|
||||
@@ -153,13 +157,37 @@ _eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list)
|
||||
}
|
||||
|
||||
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
|
||||
if (attrib_list[i] >= EGL_BUFFER_SIZE &&
|
||||
attrib_list[i] <= EGL_MAX_SWAP_INTERVAL) {
|
||||
EGLint k = attrib_list[i] - FIRST_ATTRIB;
|
||||
const EGLint attr = attrib_list[i];
|
||||
if (attr >= EGL_BUFFER_SIZE &&
|
||||
attr <= EGL_MAX_SWAP_INTERVAL) {
|
||||
EGLint k = attr - FIRST_ATTRIB;
|
||||
assert(k >= 0);
|
||||
assert(k < MAX_ATTRIBS);
|
||||
config->Attrib[k] = attrib_list[++i];
|
||||
}
|
||||
#ifdef EGL_VERSION_1_2
|
||||
else if (attr == EGL_COLOR_BUFFER_TYPE) {
|
||||
EGLint bufType = attrib_list[++i];
|
||||
if (bufType != EGL_RGB_BUFFER && bufType != EGL_LUMINANCE_BUFFER) {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
_eglSetConfigAttrib(config, EGL_COLOR_BUFFER_TYPE, bufType);
|
||||
}
|
||||
else if (attr == EGL_RENDERABLE_TYPE) {
|
||||
EGLint renType = attrib_list[++i];
|
||||
if (renType & ~(EGL_OPENGL_ES_BIT | EGL_OPENVG_BIT)) {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
_eglSetConfigAttrib(config, EGL_RENDERABLE_TYPE, renType);
|
||||
}
|
||||
else if (attr == EGL_ALPHA_MASK_SIZE ||
|
||||
attr == EGL_LUMINANCE_SIZE) {
|
||||
EGLint value = attrib_list[++i];
|
||||
_eglSetConfigAttrib(config, attr, value);
|
||||
}
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
else {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig");
|
||||
return EGL_FALSE;
|
||||
@@ -184,6 +212,8 @@ struct sort_info {
|
||||
|
||||
/* This encodes the info from Table 3.5 of the EGL spec, ordered by
|
||||
* Sort Priority.
|
||||
*
|
||||
* XXX To do: EGL 1.2 attribs
|
||||
*/
|
||||
static struct sort_info SortInfo[] = {
|
||||
{ EGL_CONFIG_CAVEAT, EXACT, SPECIAL },
|
||||
|
@@ -160,6 +160,11 @@ _eglQueryContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx,
|
||||
case EGL_CONFIG_ID:
|
||||
*value = GET_CONFIG_ATTRIB(c->Config, EGL_CONFIG_ID);
|
||||
return EGL_TRUE;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
case EGL_CONTEXT_CLIENT_TYPE:
|
||||
*value = c->ClientAPI;
|
||||
return EGL_FALSE;
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
default:
|
||||
_eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
|
||||
return EGL_FALSE;
|
||||
|
@@ -22,6 +22,9 @@ struct _egl_context
|
||||
|
||||
EGLBoolean IsBound;
|
||||
EGLBoolean DeletePending;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
EGLint ClientAPI; /* Either EGL_OPENGL_ES_API or EGL_OPENVG_API */
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
};
|
||||
|
||||
|
||||
|
@@ -181,7 +181,7 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
|
||||
drv->API.WaitGL = _eglWaitGL;
|
||||
drv->API.WaitNative = _eglWaitNative;
|
||||
|
||||
/* EGL_MESA_screen */
|
||||
#ifdef EGL_MESA_screen_surface
|
||||
drv->API.ChooseModeMESA = _eglChooseModeMESA;
|
||||
drv->API.GetModesMESA = _eglGetModesMESA;
|
||||
drv->API.GetModeAttribMESA = _eglGetModeAttribMESA;
|
||||
@@ -193,6 +193,11 @@ _eglInitDriverFallbacks(_EGLDriver *drv)
|
||||
drv->API.QueryScreenSurfaceMESA = _eglQueryScreenSurfaceMESA;
|
||||
drv->API.QueryScreenModeMESA = _eglQueryScreenModeMESA;
|
||||
drv->API.QueryModeStringMESA = _eglQueryModeStringMESA;
|
||||
#endif /* EGL_MESA_screen_surface */
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
drv->API.CreatePbufferFromClientBuffer = _eglCreatePbufferFromClientBuffer;
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
}
|
||||
|
||||
|
||||
@@ -227,6 +232,11 @@ _eglQueryString(_EGLDriver *drv, EGLDisplay dpy, EGLint name)
|
||||
case EGL_EXTENSIONS:
|
||||
_eglUpdateExtensionsString(drv);
|
||||
return drv->Extensions.String;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
case EGL_CLIENT_APIS:
|
||||
/* XXX need to initialize somewhere */
|
||||
return drv->ClientAPIs;
|
||||
#endif
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "eglQueryString");
|
||||
return NULL;
|
||||
@@ -250,6 +260,13 @@ _eglWaitNative(_EGLDriver *drv, EGLDisplay dpy, EGLint engine)
|
||||
/* just a placeholder */
|
||||
(void) drv;
|
||||
(void) dpy;
|
||||
(void) engine;
|
||||
switch (engine) {
|
||||
case EGL_CORE_NATIVE_ENGINE:
|
||||
break;
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "eglWaitNative(engine)");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
@@ -34,6 +34,7 @@ struct _egl_driver
|
||||
|
||||
int ABIversion;
|
||||
int APImajor, APIminor; /* returned through eglInitialize */
|
||||
const char *ClientAPIs;
|
||||
|
||||
_EGLAPI API;
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "eglglobals.h"
|
||||
|
||||
|
||||
@@ -18,9 +19,12 @@ _eglInitGlobals(void)
|
||||
_eglGlobal.Surfaces = _eglNewHashTable();
|
||||
_eglGlobal.FreeScreenHandle = 1;
|
||||
_eglGlobal.Initialized = EGL_TRUE;
|
||||
|
||||
_eglGlobal.OpenGLESAPISupported = EGL_TRUE;
|
||||
_eglGlobal.OpenVGAPISupported = EGL_FALSE;
|
||||
|
||||
/* XXX temporary */
|
||||
_eglGlobal.ThreadInfo.CurrentContext = EGL_NO_CONTEXT;
|
||||
_eglGlobal.ThreadInfo.LastError = EGL_SUCCESS;
|
||||
_eglGlobal.ThreadInfo = _eglNewThreadInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +42,33 @@ _eglDestroyGlobals(void)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allocate and init a new _EGLThreadInfo object.
|
||||
*/
|
||||
_EGLThreadInfo *
|
||||
_eglNewThreadInfo(void)
|
||||
{
|
||||
_EGLThreadInfo *t = (_EGLThreadInfo *) calloc(1, sizeof(_EGLThreadInfo));
|
||||
if (t) {
|
||||
t->CurrentContext = EGL_NO_CONTEXT;
|
||||
t->LastError = EGL_SUCCESS;
|
||||
t->CurrentAPI = EGL_NONE;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete/free a _EGLThreadInfo object.
|
||||
*/
|
||||
void
|
||||
_eglDeleteThreadData(_EGLThreadInfo *t)
|
||||
{
|
||||
free(t);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return pointer to calling thread's _EGLThreadInfo object.
|
||||
* Create a new one if needed.
|
||||
@@ -46,8 +77,10 @@ _eglDestroyGlobals(void)
|
||||
_EGLThreadInfo *
|
||||
_eglGetCurrentThread(void)
|
||||
{
|
||||
_eglInitGlobals();
|
||||
|
||||
/* XXX temporary */
|
||||
return &_eglGlobal.ThreadInfo;
|
||||
return _eglGlobal.ThreadInfo;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -12,6 +12,7 @@ struct _egl_thread_info
|
||||
{
|
||||
EGLint LastError;
|
||||
_EGLContext *CurrentContext;
|
||||
EGLenum CurrentAPI;
|
||||
};
|
||||
|
||||
|
||||
@@ -28,8 +29,12 @@ struct _egl_global
|
||||
|
||||
EGLScreenMESA FreeScreenHandle;
|
||||
|
||||
/* XXX temporary */
|
||||
_EGLThreadInfo ThreadInfo;
|
||||
/* XXX these may be temporary */
|
||||
EGLBoolean OpenGLESAPISupported;
|
||||
EGLBoolean OpenVGAPISupported;
|
||||
|
||||
/* XXX temporary - should be thread-specific data (TSD) */
|
||||
_EGLThreadInfo *ThreadInfo;
|
||||
};
|
||||
|
||||
|
||||
@@ -44,6 +49,14 @@ extern void
|
||||
_eglDestroyGlobals(void);
|
||||
|
||||
|
||||
extern _EGLThreadInfo *
|
||||
_eglNewThreadInfo(void);
|
||||
|
||||
|
||||
extern void
|
||||
_eglDeleteThreadData(_EGLThreadInfo *t);
|
||||
|
||||
|
||||
extern _EGLThreadInfo *
|
||||
_eglGetCurrentThread(void);
|
||||
|
||||
|
@@ -27,6 +27,11 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
|
||||
_EGLConfig *conf;
|
||||
EGLint width = 0, height = 0, largest = 0;
|
||||
EGLint texFormat = 0, texTarget = 0, mipmapTex = 0;
|
||||
EGLint renderBuffer = EGL_BACK_BUFFER;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
EGLint colorspace = EGL_COLORSPACE_sRGB;
|
||||
EGLint alphaFormat = EGL_ALPHA_FORMAT_NONPRE;
|
||||
#endif
|
||||
EGLint i;
|
||||
|
||||
switch (type) {
|
||||
@@ -35,12 +40,14 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
|
||||
break;
|
||||
case EGL_PIXMAP_BIT:
|
||||
func = "eglCreatePixmapSurface";
|
||||
renderBuffer = EGL_SINGLE_BUFFER;
|
||||
break;
|
||||
case EGL_PBUFFER_BIT:
|
||||
func = "eglCreatePBufferSurface";
|
||||
break;
|
||||
case EGL_SCREEN_BIT_MESA:
|
||||
func = "eglCreateScreenSurface";
|
||||
renderBuffer = EGL_SINGLE_BUFFER; /* XXX correct? */
|
||||
break;
|
||||
default:
|
||||
_eglLog(_EGL_WARNING, "Bad type in _eglInitSurface");
|
||||
@@ -113,6 +120,55 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
|
||||
return EGL_FALSE;
|
||||
}
|
||||
break;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
case EGL_RENDER_BUFFER:
|
||||
if (type == EGL_WINDOW_BIT) {
|
||||
renderBuffer = attrib_list[++i];
|
||||
if (renderBuffer != EGL_BACK_BUFFER &&
|
||||
renderBuffer != EGL_SINGLE_BUFFER) {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
break;
|
||||
case EGL_COLORSPACE:
|
||||
if (type == EGL_WINDOW_BIT ||
|
||||
type == EGL_PBUFFER_BIT ||
|
||||
type == EGL_PIXMAP_BIT) {
|
||||
colorspace = attrib_list[++i];
|
||||
if (colorspace != EGL_COLORSPACE_sRGB &&
|
||||
colorspace != EGL_COLORSPACE_LINEAR) {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
break;
|
||||
case EGL_ALPHA_FORMAT:
|
||||
if (type == EGL_WINDOW_BIT ||
|
||||
type == EGL_PBUFFER_BIT ||
|
||||
type == EGL_PIXMAP_BIT) {
|
||||
alphaFormat = attrib_list[++i];
|
||||
if (alphaFormat != EGL_ALPHA_FORMAT_NONPRE &&
|
||||
alphaFormat != EGL_ALPHA_FORMAT_PRE) {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
default:
|
||||
_eglError(EGL_BAD_ATTRIBUTE, func);
|
||||
return EGL_FALSE;
|
||||
@@ -134,6 +190,15 @@ _eglInitSurface(_EGLDriver *drv, EGLDisplay dpy,
|
||||
surf->MipmapTexture = mipmapTex;
|
||||
surf->MipmapLevel = 0;
|
||||
surf->SwapInterval = 0;
|
||||
#ifdef EGL_VERSION_1_2
|
||||
surf->SwapBehavior = EGL_BUFFER_DESTROYED; /* XXX ok? */
|
||||
surf->HorizontalResolution = EGL_UNKNOWN; /* set by caller */
|
||||
surf->VerticalResolution = EGL_UNKNOWN; /* set by caller */
|
||||
surf->AspectRatio = EGL_UNKNOWN; /* set by caller */
|
||||
surf->RenderBuffer = renderBuffer;
|
||||
surf->AlphaFormat = alphaFormat;
|
||||
surf->Colorspace = colorspace;
|
||||
#endif
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
@@ -232,6 +297,11 @@ _eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf,
|
||||
case EGL_CONFIG_ID:
|
||||
*value = GET_CONFIG_ATTRIB(surface->Config, EGL_CONFIG_ID);
|
||||
return EGL_TRUE;
|
||||
/*XXX case EGL_LARGEST_PBUFFER:*/
|
||||
case EGL_SURFACE_TYPE:
|
||||
*value = surface->Type;
|
||||
return EGL_TRUE;
|
||||
#ifdef EGL_VERSION_1_1
|
||||
case EGL_TEXTURE_FORMAT:
|
||||
/* texture attributes: only for pbuffers, no error otherwise */
|
||||
if (surface->Type == EGL_PBUFFER_BIT)
|
||||
@@ -249,9 +319,30 @@ _eglQuerySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surf,
|
||||
if (surface->Type == EGL_PBUFFER_BIT)
|
||||
*value = surface->MipmapLevel;
|
||||
return EGL_TRUE;
|
||||
case EGL_SURFACE_TYPE:
|
||||
*value = surface->Type;
|
||||
#endif /* EGL_VERSION_1_1 */
|
||||
#ifdef EGL_VERSION_1_2
|
||||
case EGL_SWAP_BEHAVIOR:
|
||||
*value = surface->SwapBehavior;
|
||||
return EGL_TRUE;
|
||||
case EGL_RENDER_BUFFER:
|
||||
*value = surface->RenderBuffer;
|
||||
return EGL_TRUE;
|
||||
case EGL_PIXEL_ASPECT_RATIO:
|
||||
*value = surface->AspectRatio;
|
||||
return EGL_TRUE;
|
||||
case EGL_HORIZONTAL_RESOLUTION:
|
||||
*value = surface->HorizontalResolution;
|
||||
return EGL_TRUE;
|
||||
case EGL_VERTICAL_RESOLUTION:
|
||||
*value = surface->VerticalResolution;
|
||||
return EGL_TRUE;
|
||||
case EGL_ALPHA_FORMAT:
|
||||
*value = surface->AlphaFormat;
|
||||
return EGL_TRUE;
|
||||
case EGL_COLORSPACE:
|
||||
*value = surface->Colorspace;
|
||||
return EGL_TRUE;
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
default:
|
||||
_eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface");
|
||||
return EGL_FALSE;
|
||||
@@ -416,3 +507,24 @@ _eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval)
|
||||
surf->SwapInterval = interval;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
|
||||
/**
|
||||
* Example function - drivers should do a proper implementation.
|
||||
*/
|
||||
EGLSurface
|
||||
_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, EGLDisplay dpy,
|
||||
EGLenum buftype, EGLClientBuffer buffer,
|
||||
EGLConfig config, const EGLint *attrib_list)
|
||||
{
|
||||
if (buftype != EGL_OPENVG_IMAGE) {
|
||||
_eglError(EGL_BAD_PARAMETER, "eglCreatePbufferFromClientBuffer");
|
||||
return EGL_NO_SURFACE;
|
||||
}
|
||||
|
||||
return EGL_NO_SURFACE;
|
||||
}
|
||||
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
|
@@ -25,6 +25,15 @@ struct _egl_surface
|
||||
|
||||
/* If type == EGL_SCREEN_BIT: */
|
||||
EGLint VisibleRefCount; /* number of screens I'm displayed on */
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
EGLint SwapBehavior; /* one of EGL_BUFFER_PRESERVED/DESTROYED */
|
||||
EGLint HorizontalResolution, VerticalResolution;
|
||||
EGLint AspectRatio;
|
||||
EGLint RenderBuffer; /* EGL_BACK_BUFFER or EGL_SINGLE_BUFFER */
|
||||
EGLint AlphaFormat; /* EGL_ALPHA_FORMAT_NONPRE or EGL_ALPHA_FORMAT_PRE */
|
||||
EGLint Colorspace; /* EGL_COLORSPACE_sRGB or EGL_COLORSPACE_LINEAR */
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
};
|
||||
|
||||
|
||||
@@ -94,4 +103,15 @@ extern EGLBoolean
|
||||
_eglSwapInterval(_EGLDriver *drv, EGLDisplay dpy, EGLint interval);
|
||||
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
|
||||
extern EGLSurface
|
||||
_eglCreatePbufferFromClientBuffer(_EGLDriver *drv, EGLDisplay dpy,
|
||||
EGLenum buftype, EGLClientBuffer buffer,
|
||||
EGLConfig config, const EGLint *attrib_list);
|
||||
|
||||
#endif /* EGL_VERSION_1_2 */
|
||||
|
||||
|
||||
|
||||
#endif /* EGLSURFACE_INCLUDED */
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* glcurveval.c++
|
||||
*
|
||||
* $Date: 2004/05/12 15:29:36 $ $Revision: 1.6 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glcurveval.cc,v 1.6 2004/05/12 15:29:36 brianp Exp $
|
||||
* $Date: 2006/03/29 18:46:46 $ $Revision: 1.7 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/glcurveval.cc,v 1.7 2006/03/29 18:46:46 brianp Exp $
|
||||
*/
|
||||
|
||||
/* Polynomial Evaluator Interface */
|
||||
@@ -74,6 +74,7 @@ OpenGLCurveEvaluator::OpenGLCurveEvaluator(void)
|
||||
em_normal.uprime = -1.0;
|
||||
em_color.uprime = -1.0;
|
||||
em_texcoord.uprime = -1.0;
|
||||
output_triangles = 0; // don't output triangles by default
|
||||
}
|
||||
|
||||
OpenGLCurveEvaluator::~OpenGLCurveEvaluator(void)
|
||||
|
@@ -35,28 +35,28 @@
|
||||
/*
|
||||
* mystdio.h
|
||||
*
|
||||
* $Date: 2001/03/19 17:52:02 $ $Revision: 1.3 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/mystdio.h,v 1.3 2001/03/19 17:52:02 pesco Exp $
|
||||
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.4 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/interface/mystdio.h,v 1.4 2006/03/14 15:08:52 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __glumystdio_h_
|
||||
#define __glumystdio_h_
|
||||
|
||||
#ifdef STANDALONE
|
||||
inline void dprintf( char *, ... ) { }
|
||||
inline void _glu_dprintf( char *, ... ) { }
|
||||
#endif
|
||||
|
||||
#ifdef LIBRARYBUILD
|
||||
#ifndef NDEBUG
|
||||
#include <stdio.h>
|
||||
#define dprintf printf
|
||||
#define _glu_dprintf printf
|
||||
#else
|
||||
inline void dprintf( char *, ... ) { }
|
||||
inline void _glu_dprintf( char *, ... ) { }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef GLBUILD
|
||||
inline void dprintf( char *, ... ) { }
|
||||
inline void _glu_dprintf( char *, ... ) { }
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
|
@@ -156,9 +156,9 @@ void
|
||||
Arc::show()
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "\tPWLARC NP: %d FL: 1\n", pwlArc->npts );
|
||||
_glu_dprintf( "\tPWLARC NP: %d FL: 1\n", pwlArc->npts );
|
||||
for( int i = 0; i < pwlArc->npts; i++ ) {
|
||||
dprintf( "\t\tVERTEX %f %f\n", pwlArc->pts[i].param[0],
|
||||
_glu_dprintf( "\t\tVERTEX %f %f\n", pwlArc->pts[i].param[0],
|
||||
pwlArc->pts[i].param[1] );
|
||||
}
|
||||
#endif
|
||||
@@ -175,14 +175,14 @@ Arc::print( void )
|
||||
Arc_ptr jarc = this;
|
||||
|
||||
#ifndef NDEBUG
|
||||
dprintf( "BGNTRIM\n" );
|
||||
_glu_dprintf( "BGNTRIM\n" );
|
||||
#endif
|
||||
do {
|
||||
jarc->show( );
|
||||
jarc = jarc->next;
|
||||
} while (jarc != this);
|
||||
#ifndef NDEBUG
|
||||
dprintf("ENDTRIM\n" );
|
||||
_glu_dprintf("ENDTRIM\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -203,8 +203,8 @@ Arc::isDisconnected( void )
|
||||
if( ((p0[0] - p1[0]) > ZERO) || ((p1[0] - p0[0]) > ZERO) ||
|
||||
((p0[1] - p1[1]) > ZERO) || ((p1[1] - p0[1]) > ZERO) ) {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "x coord = %f %f %f\n", p0[0], p1[0], p0[0] - p1[0] );
|
||||
dprintf( "y coord = %f %f %f\n", p0[1], p1[1], p0[1] - p1[1] );
|
||||
_glu_dprintf( "x coord = %f %f %f\n", p0[0], p1[0], p0[0] - p1[0] );
|
||||
_glu_dprintf( "y coord = %f %f %f\n", p0[1], p1[1], p0[1] - p1[1] );
|
||||
#endif
|
||||
return 1;
|
||||
} else {
|
||||
@@ -244,7 +244,7 @@ Arc::check( void )
|
||||
|
||||
if (jarc->prev == 0 || jarc->next == 0) {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "checkjarc:null next/prev pointer\n");
|
||||
_glu_dprintf( "checkjarc:null next/prev pointer\n");
|
||||
jarc->print( );
|
||||
#endif
|
||||
return 0;
|
||||
@@ -252,7 +252,7 @@ Arc::check( void )
|
||||
|
||||
if (jarc->next->prev != jarc) {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "checkjarc: pointer linkage screwed up\n");
|
||||
_glu_dprintf( "checkjarc: pointer linkage screwed up\n");
|
||||
jarc->print( );
|
||||
#endif
|
||||
return 0;
|
||||
@@ -271,7 +271,7 @@ Arc::check( void )
|
||||
if( jarc->prev->pwlArc ) {
|
||||
if( jarc->tail()[1] != jarc->prev->rhead()[1] ) {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "checkjarc: geometric linkage screwed up 1\n");
|
||||
_glu_dprintf( "checkjarc: geometric linkage screwed up 1\n");
|
||||
jarc->prev->show();
|
||||
jarc->show();
|
||||
#endif
|
||||
@@ -280,7 +280,7 @@ Arc::check( void )
|
||||
if( jarc->tail()[0] != jarc->prev->rhead()[0] ) {
|
||||
|
||||
#ifndef NDEBUG
|
||||
dprintf( "checkjarc: geometric linkage screwed up 2\n");
|
||||
_glu_dprintf( "checkjarc: geometric linkage screwed up 2\n");
|
||||
jarc->prev->show();
|
||||
jarc->show();
|
||||
#endif
|
||||
@@ -290,7 +290,7 @@ Arc::check( void )
|
||||
if( jarc->next->pwlArc ) {
|
||||
if( jarc->next->tail()[0] != jarc->rhead()[0] ) {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "checkjarc: geometric linkage screwed up 3\n");
|
||||
_glu_dprintf( "checkjarc: geometric linkage screwed up 3\n");
|
||||
jarc->show();
|
||||
jarc->next->show();
|
||||
#endif
|
||||
@@ -298,7 +298,7 @@ Arc::check( void )
|
||||
}
|
||||
if( jarc->next->tail()[1] != jarc->rhead()[1] ) {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "checkjarc: geometric linkage screwed up 4\n");
|
||||
_glu_dprintf( "checkjarc: geometric linkage screwed up 4\n");
|
||||
jarc->show();
|
||||
jarc->next->show();
|
||||
#endif
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* arcsorter.c++
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arcsorter.cc,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/arcsorter.cc,v 1.2 2006/03/14 15:08:52 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __gluarcsorter_c_
|
||||
@@ -54,7 +54,7 @@ ArcSorter::ArcSorter(Subdivider &s) : Sorter( sizeof( Arc ** ) ), subdivider(s)
|
||||
int
|
||||
ArcSorter::qscmp( char *, char * )
|
||||
{
|
||||
dprintf( "ArcSorter::qscmp: pure virtual called\n" );
|
||||
_glu_dprintf( "ArcSorter::qscmp: pure virtual called\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -335,7 +335,7 @@ ArcTessellator::tessellateNonlinear( Arc *arc, REAL geo_stepsize, REAL arc_steps
|
||||
REAL min_u, min_v, max_u,max_v;
|
||||
min_u = max_u = bezierArc->cpts[0];
|
||||
min_v = max_v = bezierArc->cpts[1];
|
||||
for(i=1, j=2; i<bezierArc->order; i++, j+= bezierArc->stride)
|
||||
for(i=1, j=bezierArc->stride; i<bezierArc->order; i++, j+= bezierArc->stride)
|
||||
{
|
||||
if(bezierArc->cpts[j] < min_u)
|
||||
min_u = bezierArc->cpts[j];
|
||||
|
@@ -45,7 +45,7 @@ void
|
||||
BasicCurveEvaluator::domain1f( REAL, REAL )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "domain1f\n" );
|
||||
_glu_dprintf( "domain1f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ void
|
||||
BasicCurveEvaluator::range1f( long , REAL *, REAL * )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "range1f\n" );
|
||||
_glu_dprintf( "range1f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ void
|
||||
BasicCurveEvaluator::enable( long )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "enable\n" );
|
||||
_glu_dprintf( "enable\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ void
|
||||
BasicCurveEvaluator::disable( long )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "disable\n" );
|
||||
_glu_dprintf( "disable\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void
|
||||
BasicCurveEvaluator::bgnmap1f( long )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "bgnmap1f\n" );
|
||||
_glu_dprintf( "bgnmap1f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ void
|
||||
BasicCurveEvaluator::map1f( long, REAL, REAL, long, long, REAL * )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "map1f\n" );
|
||||
_glu_dprintf( "map1f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ void
|
||||
BasicCurveEvaluator::mapgrid1f( long, REAL, REAL )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "mapgrid1f\n" );
|
||||
_glu_dprintf( "mapgrid1f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ void
|
||||
BasicCurveEvaluator::mapmesh1f( long, long, long )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "mapmesh1f\n" );
|
||||
_glu_dprintf( "mapmesh1f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ void
|
||||
BasicCurveEvaluator::evalcoord1f( long, REAL )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "evalcoord1f\n" );
|
||||
_glu_dprintf( "evalcoord1f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ void
|
||||
BasicCurveEvaluator::endmap1f( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "endmap1f\n" );
|
||||
_glu_dprintf( "endmap1f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ void
|
||||
BasicCurveEvaluator::bgnline( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "bgnline\n" );
|
||||
_glu_dprintf( "bgnline\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -133,6 +133,6 @@ void
|
||||
BasicCurveEvaluator::endline( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "endline\n" );
|
||||
_glu_dprintf( "endline\n" );
|
||||
#endif
|
||||
}
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* basiccurveeval.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basiccrveval.h,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
* $Date: 2006/03/29 18:54:00 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basiccrveval.h,v 1.2 2006/03/29 18:54:00 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __glubasiccrveval_h_
|
||||
@@ -48,6 +48,7 @@
|
||||
|
||||
class BasicCurveEvaluator : public CachingEvaluator {
|
||||
public:
|
||||
virtual ~BasicCurveEvaluator() { /* silence warning*/ }
|
||||
virtual void domain1f( REAL, REAL );
|
||||
virtual void range1f( long, REAL *, REAL * );
|
||||
|
||||
|
@@ -49,7 +49,7 @@ void
|
||||
BasicSurfaceEvaluator::domain2f( REAL, REAL, REAL, REAL )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "domain2f\n" );
|
||||
_glu_dprintf( "domain2f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ void
|
||||
BasicSurfaceEvaluator::polymode( long )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "polymode\n" );
|
||||
_glu_dprintf( "polymode\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ void
|
||||
BasicSurfaceEvaluator::range2f( long type, REAL *from, REAL *to )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "range2f type %ld, from (%g,%g), to (%g,%g)\n",
|
||||
_glu_dprintf( "range2f type %ld, from (%g,%g), to (%g,%g)\n",
|
||||
type, from[0], from[1], to[0], to[1] );
|
||||
#endif
|
||||
}
|
||||
@@ -74,7 +74,7 @@ void
|
||||
BasicSurfaceEvaluator::enable( long )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "enable\n" );
|
||||
_glu_dprintf( "enable\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ void
|
||||
BasicSurfaceEvaluator::disable( long )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "disable\n" );
|
||||
_glu_dprintf( "disable\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ void
|
||||
BasicSurfaceEvaluator::bgnmap2f( long )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "bgnmap2f\n" );
|
||||
_glu_dprintf( "bgnmap2f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ void
|
||||
BasicSurfaceEvaluator::endmap2f( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "endmap2f\n" );
|
||||
_glu_dprintf( "endmap2f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ BasicSurfaceEvaluator::map2f( long, REAL, REAL, long, long,
|
||||
REAL * )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "map2f\n" );
|
||||
_glu_dprintf( "map2f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ void
|
||||
BasicSurfaceEvaluator::mapgrid2f( long, REAL, REAL, long, REAL, REAL )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "mapgrid2f\n" );
|
||||
_glu_dprintf( "mapgrid2f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ void
|
||||
BasicSurfaceEvaluator::mapmesh2f( long, long, long, long, long )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "mapmesh2f\n" );
|
||||
_glu_dprintf( "mapmesh2f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ void
|
||||
BasicSurfaceEvaluator::evalcoord2f( long, REAL, REAL )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "evalcoord2f\n" );
|
||||
_glu_dprintf( "evalcoord2f\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ void
|
||||
BasicSurfaceEvaluator::evalpoint2i( long, long )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "evalpoint2i\n" );
|
||||
_glu_dprintf( "evalpoint2i\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ void
|
||||
BasicSurfaceEvaluator::bgnline( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "bgnline\n" );
|
||||
_glu_dprintf( "bgnline\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ void
|
||||
BasicSurfaceEvaluator::endline( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "endline\n" );
|
||||
_glu_dprintf( "endline\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ void
|
||||
BasicSurfaceEvaluator::bgnclosedline( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "bgnclosedline\n" );
|
||||
_glu_dprintf( "bgnclosedline\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ void
|
||||
BasicSurfaceEvaluator::endclosedline( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "endclosedline\n" );
|
||||
_glu_dprintf( "endclosedline\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ void
|
||||
BasicSurfaceEvaluator::bgntfan( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "bgntfan\n" );
|
||||
_glu_dprintf( "bgntfan\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ void
|
||||
BasicSurfaceEvaluator::bgntmesh( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "bgntmesh\n" );
|
||||
_glu_dprintf( "bgntmesh\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ void
|
||||
BasicSurfaceEvaluator::swaptmesh( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "swaptmesh\n" );
|
||||
_glu_dprintf( "swaptmesh\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ void
|
||||
BasicSurfaceEvaluator::endtmesh( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "endtmesh\n" );
|
||||
_glu_dprintf( "endtmesh\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ void
|
||||
BasicSurfaceEvaluator::bgnqstrip( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "bgnqstrip\n" );
|
||||
_glu_dprintf( "bgnqstrip\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ void
|
||||
BasicSurfaceEvaluator::endqstrip( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "endqstrip\n" );
|
||||
_glu_dprintf( "endqstrip\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* basicsurfeval.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basicsurfeval.h,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
* $Date: 2006/03/29 18:54:00 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/basicsurfeval.h,v 1.2 2006/03/29 18:54:00 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __glubasicsurfeval_h_
|
||||
@@ -48,6 +48,7 @@
|
||||
|
||||
class BasicSurfaceEvaluator : public CachingEvaluator {
|
||||
public:
|
||||
virtual ~BasicSurfaceEvaluator() { /* silence warning*/ }
|
||||
virtual void range2f( long, REAL *, REAL * );
|
||||
virtual void domain2f( REAL, REAL, REAL, REAL );
|
||||
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* bin.c++
|
||||
*
|
||||
* $Date: 2004/05/12 15:29:36 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/bin.cc,v 1.2 2004/05/12 15:29:36 brianp Exp $
|
||||
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.3 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/bin.cc,v 1.3 2006/03/14 15:08:52 brianp Exp $
|
||||
*/
|
||||
|
||||
#include "glimports.h"
|
||||
@@ -123,7 +123,7 @@ void
|
||||
Bin::show( char *name )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "%s\n", name );
|
||||
_glu_dprintf( "%s\n", name );
|
||||
for( Arc_ptr jarc = firstarc(); jarc; jarc = nextarc() )
|
||||
jarc->show( );
|
||||
#endif
|
||||
@@ -160,7 +160,7 @@ Bin::listBezier( void )
|
||||
REAL t1 = pts[0].param[1];
|
||||
REAL s2 = pts[1].param[0];
|
||||
REAL t2 = pts[1].param[1];
|
||||
dprintf( "arc (%g,%g) (%g,%g)\n", s1, t1, s2, t2 );
|
||||
_glu_dprintf( "arc (%g,%g) (%g,%g)\n", s1, t1, s2, t2 );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* bufpool.h
|
||||
*
|
||||
* $Date: 2001/03/22 11:38:36 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/bufpool.h,v 1.2 2001/03/22 11:38:36 joukj Exp $
|
||||
* $Date: 2006/03/29 18:46:46 $ $Revision: 1.3 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/bufpool.h,v 1.3 2006/03/29 18:46:46 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __glubufpool_h_
|
||||
@@ -128,6 +128,7 @@ public:
|
||||
inline void * operator new( size_t s)
|
||||
{ return ::new char[s]; }
|
||||
inline void operator delete( void * ) { assert( 0 ); }
|
||||
inline void operator delete( void *, Pool & ) { assert( 0 ); }
|
||||
inline void deleteMe( Pool & );
|
||||
};
|
||||
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* cachingeval.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:40 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/cachingeval.h,v 1.1 2001/03/17 00:25:40 brianp Exp $
|
||||
* $Date: 2006/03/29 18:54:00 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/cachingeval.h,v 1.2 2006/03/29 18:54:00 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __glucachingval_h_
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
class CachingEvaluator {
|
||||
public:
|
||||
virtual ~CachingEvaluator() { /* silence warning*/ }
|
||||
enum ServiceMode { play, record, playAndRecord };
|
||||
virtual int canRecord( void );
|
||||
virtual int canPlayAndRecord( void );
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* ccw.c++
|
||||
*
|
||||
* $Date: 2002/11/01 23:35:07 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/ccw.cc,v 1.2 2002/11/01 23:35:07 brianp Exp $
|
||||
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.3 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/ccw.cc,v 1.3 2006/03/14 15:08:52 brianp Exp $
|
||||
*/
|
||||
|
||||
#include "glimports.h"
|
||||
@@ -70,7 +70,7 @@ Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
|
||||
assert( v2 != v2last );
|
||||
|
||||
#ifndef NDEBUG
|
||||
dprintf( "arc_ccw_turn, p = %d\n", 0 );
|
||||
_glu_dprintf( "arc_ccw_turn, p = %d\n", 0 );
|
||||
#endif
|
||||
|
||||
// the arcs lie on the line (0 == v1->param[0])
|
||||
@@ -88,7 +88,7 @@ Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
|
||||
while( 1 ) {
|
||||
if( v1next->param[0] < v2next->param[0] ) {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "case a\n" );
|
||||
_glu_dprintf( "case a\n" );
|
||||
#endif
|
||||
assert( v1->param[0] <= v1next->param[0] );
|
||||
assert( v2->param[0] <= v1next->param[0] );
|
||||
@@ -101,12 +101,12 @@ Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
|
||||
return sgn;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
dprintf( "decr\n" );
|
||||
_glu_dprintf( "decr\n" );
|
||||
#endif
|
||||
v1 = v1next--;
|
||||
if( v1 == v1last ) {
|
||||
#ifdef DEBUG
|
||||
dprintf( "no good results\n" );
|
||||
_glu_dprintf( "no good results\n" );
|
||||
#endif
|
||||
return 0; // ill-conditioned, guess answer
|
||||
}
|
||||
@@ -117,7 +117,7 @@ Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
|
||||
}
|
||||
} else if( v1next->param[0] > v2next->param[0] ) {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "case b\n" );
|
||||
_glu_dprintf( "case b\n" );
|
||||
#endif
|
||||
assert( v1->param[0] <= v2next->param[0] );
|
||||
assert( v2->param[0] <= v2next->param[0] );
|
||||
@@ -130,12 +130,12 @@ Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
|
||||
return sgn;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
dprintf( "incr\n" );
|
||||
_glu_dprintf( "incr\n" );
|
||||
#endif
|
||||
v2 = v2next++;
|
||||
if( v2 == v2last ) {
|
||||
#ifdef DEBUG
|
||||
dprintf( "no good results\n" );
|
||||
_glu_dprintf( "no good results\n" );
|
||||
#endif
|
||||
return 0; // ill-conditioned, guess answer
|
||||
}
|
||||
@@ -146,7 +146,7 @@ Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
|
||||
}
|
||||
} else {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "case ab\n" );
|
||||
_glu_dprintf( "case ab\n" );
|
||||
#endif
|
||||
if( v1next->param[1] < v2next->param[1] )
|
||||
return 0;
|
||||
@@ -154,12 +154,12 @@ Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
|
||||
return 1;
|
||||
else {
|
||||
#ifdef DEBUG
|
||||
dprintf( "incr\n" );
|
||||
_glu_dprintf( "incr\n" );
|
||||
#endif
|
||||
v2 = v2next++;
|
||||
if( v2 == v2last ) {
|
||||
#ifdef DEBUG
|
||||
dprintf( "no good results\n" );
|
||||
_glu_dprintf( "no good results\n" );
|
||||
#endif
|
||||
return 0; // ill-conditioned, guess answer
|
||||
}
|
||||
@@ -183,7 +183,7 @@ Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0
|
||||
assert( v2 != v2last );
|
||||
|
||||
#ifndef NDEBUG
|
||||
dprintf( "arc_ccw_turn, p = %d\n", 0 );
|
||||
_glu_dprintf( "arc_ccw_turn, p = %d\n", 0 );
|
||||
#endif
|
||||
|
||||
// the arcs lie on the line (0 == v1->param[0])
|
||||
@@ -201,7 +201,7 @@ Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0
|
||||
while( 1 ) {
|
||||
if( v1next->param[0] > v2next->param[0] ) {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "case c\n" );
|
||||
_glu_dprintf( "case c\n" );
|
||||
#endif
|
||||
assert( v1->param[0] >= v1next->param[0] );
|
||||
assert( v2->param[0] >= v1next->param[0] );
|
||||
@@ -215,11 +215,11 @@ Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0
|
||||
else {
|
||||
v1 = v1next--;
|
||||
#ifdef DEBUG
|
||||
dprintf( "decr\n" );
|
||||
_glu_dprintf( "decr\n" );
|
||||
#endif
|
||||
if( v1 == v1last ) {
|
||||
#ifdef DEBUG
|
||||
dprintf( "no good results\n" );
|
||||
_glu_dprintf( "no good results\n" );
|
||||
#endif
|
||||
return 0; // ill-conditioned, guess answer
|
||||
}
|
||||
@@ -230,7 +230,7 @@ Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0
|
||||
}
|
||||
} else if( v1next->param[0] < v2next->param[0] ) {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "case d\n" );
|
||||
_glu_dprintf( "case d\n" );
|
||||
#endif
|
||||
assert( v1->param[0] >= v2next->param[0] );
|
||||
assert( v2->param[0] >= v2next->param[0] );
|
||||
@@ -244,11 +244,11 @@ Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0
|
||||
else {
|
||||
v2 = v2next++;
|
||||
#ifdef DEBUG
|
||||
dprintf( "incr\n" );
|
||||
_glu_dprintf( "incr\n" );
|
||||
#endif
|
||||
if( v2 == v2last ) {
|
||||
#ifdef DEBUG
|
||||
dprintf( "no good results\n" );
|
||||
_glu_dprintf( "no good results\n" );
|
||||
#endif
|
||||
return 0; // ill-conditioned, guess answer
|
||||
}
|
||||
@@ -259,7 +259,7 @@ Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0
|
||||
}
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
dprintf( "case cd\n" );
|
||||
_glu_dprintf( "case cd\n" );
|
||||
#endif
|
||||
if( v1next->param[1] < v2next->param[1] )
|
||||
return 1;
|
||||
@@ -268,11 +268,11 @@ Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0
|
||||
else {
|
||||
v2 = v2next++;
|
||||
#ifdef DEBUG
|
||||
dprintf( "incr\n" );
|
||||
_glu_dprintf( "incr\n" );
|
||||
#endif
|
||||
if( v2 == v2last ) {
|
||||
#ifdef DEBUG
|
||||
dprintf( "no good results\n" );
|
||||
_glu_dprintf( "no good results\n" );
|
||||
#endif
|
||||
return 0; // ill-conditioned, guess answer
|
||||
}
|
||||
@@ -296,7 +296,7 @@ Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
|
||||
assert( v2 != v2last );
|
||||
|
||||
#ifndef NDEBUG
|
||||
dprintf( "arc_ccw_turn, p = %d\n", 1 );
|
||||
_glu_dprintf( "arc_ccw_turn, p = %d\n", 1 );
|
||||
#endif
|
||||
|
||||
// the arcs lie on the line (1 == v1->param[1])
|
||||
@@ -314,7 +314,7 @@ Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
|
||||
while( 1 ) {
|
||||
if( v1next->param[1] < v2next->param[1] ) {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "case a\n" );
|
||||
_glu_dprintf( "case a\n" );
|
||||
#endif
|
||||
assert( v1->param[1] <= v1next->param[1] );
|
||||
assert( v2->param[1] <= v1next->param[1] );
|
||||
@@ -327,12 +327,12 @@ Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
|
||||
return sgn;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
dprintf( "decr\n" );
|
||||
_glu_dprintf( "decr\n" );
|
||||
#endif
|
||||
v1 = v1next--;
|
||||
if( v1 == v1last ) {
|
||||
#ifdef DEBUG
|
||||
dprintf( "no good results\n" );
|
||||
_glu_dprintf( "no good results\n" );
|
||||
#endif
|
||||
return 0; // ill-conditioned, guess answer
|
||||
}
|
||||
@@ -343,7 +343,7 @@ Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
|
||||
}
|
||||
} else if( v1next->param[1] > v2next->param[1] ) {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "case b\n" );
|
||||
_glu_dprintf( "case b\n" );
|
||||
#endif
|
||||
assert( v1->param[1] <= v2next->param[1] );
|
||||
assert( v2->param[1] <= v2next->param[1] );
|
||||
@@ -356,12 +356,12 @@ Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
|
||||
return sgn;
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
dprintf( "incr\n" );
|
||||
_glu_dprintf( "incr\n" );
|
||||
#endif
|
||||
v2 = v2next++;
|
||||
if( v2 == v2last ) {
|
||||
#ifdef DEBUG
|
||||
dprintf( "no good results\n" );
|
||||
_glu_dprintf( "no good results\n" );
|
||||
#endif
|
||||
return 0; // ill-conditioned, guess answer
|
||||
}
|
||||
@@ -372,7 +372,7 @@ Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
|
||||
}
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
dprintf( "case ab\n" );
|
||||
_glu_dprintf( "case ab\n" );
|
||||
#endif
|
||||
if( v1next->param[0] < v2next->param[0] )
|
||||
return 1;
|
||||
@@ -380,12 +380,12 @@ Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1
|
||||
return 0;
|
||||
else {
|
||||
#ifdef DEBUG
|
||||
dprintf( "incr\n" );
|
||||
_glu_dprintf( "incr\n" );
|
||||
#endif
|
||||
v2 = v2next++;
|
||||
if( v2 == v2last ) {
|
||||
#ifdef DEBUG
|
||||
dprintf( "no good results\n" );
|
||||
_glu_dprintf( "no good results\n" );
|
||||
#endif
|
||||
return 0; // ill-conditioned, guess answer
|
||||
}
|
||||
@@ -409,7 +409,7 @@ Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 )
|
||||
assert( v2 != v2last );
|
||||
|
||||
#ifndef NDEBUG
|
||||
dprintf( "arc_ccw_turn, p = %d\n", 1 );
|
||||
_glu_dprintf( "arc_ccw_turn, p = %d\n", 1 );
|
||||
#endif
|
||||
|
||||
// the arcs lie on the line (1 == v1->param[1])
|
||||
@@ -427,7 +427,7 @@ Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 )
|
||||
while( 1 ) {
|
||||
if( v1next->param[1] > v2next->param[1] ) {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "case c\n" );
|
||||
_glu_dprintf( "case c\n" );
|
||||
#endif
|
||||
assert( v1->param[1] >= v1next->param[1] );
|
||||
assert( v2->param[1] >= v1next->param[1] );
|
||||
@@ -441,11 +441,11 @@ Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 )
|
||||
else {
|
||||
v1 = v1next--;
|
||||
#ifdef DEBUG
|
||||
dprintf( "decr\n" );
|
||||
_glu_dprintf( "decr\n" );
|
||||
#endif
|
||||
if( v1 == v1last ) {
|
||||
#ifdef DEBUG
|
||||
dprintf( "no good results\n" );
|
||||
_glu_dprintf( "no good results\n" );
|
||||
#endif
|
||||
return 0; // ill-conditioned, guess answer
|
||||
}
|
||||
@@ -456,7 +456,7 @@ Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 )
|
||||
}
|
||||
} else if( v1next->param[1] < v2next->param[1] ) {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "case d\n" );
|
||||
_glu_dprintf( "case d\n" );
|
||||
assert( v1->param[1] >= v2next->param[1] );
|
||||
assert( v2->param[1] >= v2next->param[1] );
|
||||
#endif
|
||||
@@ -470,11 +470,11 @@ Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 )
|
||||
else {
|
||||
v2 = v2next++;
|
||||
#ifdef DEBUG
|
||||
dprintf( "incr\n" );
|
||||
_glu_dprintf( "incr\n" );
|
||||
#endif
|
||||
if( v2 == v2last ) {
|
||||
#ifdef DEBUG
|
||||
dprintf( "no good results\n" );
|
||||
_glu_dprintf( "no good results\n" );
|
||||
#endif
|
||||
return 0; // ill-conditioned, guess answer
|
||||
}
|
||||
@@ -485,7 +485,7 @@ Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 )
|
||||
}
|
||||
} else {
|
||||
#ifdef DEBUG
|
||||
dprintf( "case cd\n" );
|
||||
_glu_dprintf( "case cd\n" );
|
||||
#endif
|
||||
if( v1next->param[0] < v2next->param[0] )
|
||||
return 0;
|
||||
@@ -494,11 +494,11 @@ Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 )
|
||||
else {
|
||||
v2 = v2next++;
|
||||
#ifdef DEBUG
|
||||
dprintf( "incr\n" );
|
||||
_glu_dprintf( "incr\n" );
|
||||
#endif
|
||||
if( v2 == v2last ) {
|
||||
#ifdef DEBUG
|
||||
dprintf( "no good results\n" );
|
||||
_glu_dprintf( "no good results\n" );
|
||||
#endif
|
||||
return 0; // ill-conditioned, guess answer
|
||||
}
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* flistsorter.h
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/flistsorter.h,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
* $Date: 2006/03/29 18:54:00 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/flistsorter.h,v 1.2 2006/03/29 18:54:00 brianp Exp $
|
||||
*/
|
||||
|
||||
#ifndef __gluflistsorter_h_
|
||||
@@ -48,6 +48,7 @@
|
||||
class FlistSorter : public Sorter {
|
||||
public:
|
||||
FlistSorter(void);
|
||||
virtual ~FlistSorter() { /* silence warning*/ }
|
||||
void qsort( REAL *a, int n );
|
||||
|
||||
protected:
|
||||
|
@@ -129,11 +129,11 @@ int Knotvector::validate( void )
|
||||
void Knotvector::show( char *msg )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "%s\n", msg );
|
||||
dprintf( "order = %ld, count = %ld\n", order, knotcount );
|
||||
_glu_dprintf( "%s\n", msg );
|
||||
_glu_dprintf( "order = %ld, count = %ld\n", order, knotcount );
|
||||
|
||||
for( int i=0; i<knotcount; i++ )
|
||||
dprintf( "knot[%d] = %g\n", i, knotlist[i] );
|
||||
_glu_dprintf( "knot[%d] = %g\n", i, knotlist[i] );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -232,7 +232,7 @@ NurbsTessellator::pwlcurve( long count, INREAL array[], long byte_stride, long t
|
||||
}
|
||||
if( i != count ) {
|
||||
do_nurbserror( 37 );
|
||||
dprintf( "point %d (%f,%f)\n", i, x, y );
|
||||
_glu_dprintf( "point %d (%f,%f)\n", i, x, y );
|
||||
isDataValid = 0;
|
||||
return;
|
||||
}
|
||||
@@ -247,7 +247,7 @@ NurbsTessellator::pwlcurve( long count, INREAL array[], long byte_stride, long t
|
||||
}
|
||||
if( i != count ) {
|
||||
do_nurbserror( 37 );
|
||||
dprintf( "point %d (%f,%f)\n", i, x, y );
|
||||
_glu_dprintf( "point %d (%f,%f)\n", i, x, y );
|
||||
isDataValid = 0;
|
||||
return;
|
||||
}
|
||||
@@ -460,7 +460,7 @@ NurbsTessellator::setnurbsproperty( long type, long purpose, INREAL *mat )
|
||||
mapdesc->setBboxsize( mat );
|
||||
} else {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "ERRORRORRORR!!!\n");
|
||||
_glu_dprintf( "ERRORRORRORR!!!\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -488,7 +488,7 @@ NurbsTessellator::setnurbsproperty( long type, long purpose, INREAL *mat,
|
||||
mapdesc->setBmat( mat, rstride, cstride );
|
||||
} else {
|
||||
#ifndef NDEBUG
|
||||
dprintf( "ERRORRORRORR!!!\n");
|
||||
_glu_dprintf( "ERRORRORRORR!!!\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* nurbstess.c++
|
||||
*
|
||||
* $Date: 2001/03/17 00:25:41 $ $Revision: 1.1 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/nurbstess.cc,v 1.1 2001/03/17 00:25:41 brianp Exp $
|
||||
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/nurbstess.cc,v 1.2 2006/03/14 15:08:52 brianp Exp $
|
||||
*/
|
||||
|
||||
#include "glimports.h"
|
||||
@@ -79,7 +79,7 @@ void
|
||||
NurbsTessellator::makeobj( int )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "makeobj\n" );
|
||||
_glu_dprintf( "makeobj\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ void
|
||||
NurbsTessellator::closeobj( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "closeobj\n" );
|
||||
_glu_dprintf( "closeobj\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ void
|
||||
NurbsTessellator::bgnrender( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "bgnrender\n" );
|
||||
_glu_dprintf( "bgnrender\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ void
|
||||
NurbsTessellator::endrender( void )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
dprintf( "endrender\n" );
|
||||
_glu_dprintf( "endrender\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* patch.c++
|
||||
*
|
||||
* $Date: 2002/11/01 23:35:07 $ $Revision: 1.3 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/patch.cc,v 1.3 2002/11/01 23:35:07 brianp Exp $
|
||||
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.4 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/patch.cc,v 1.4 2006/03/14 15:08:52 brianp Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -439,7 +439,7 @@ Patch::getstepsize( void )
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
dprintf( "sidesteps %g %g %g %g, stepsize %g %g\n",
|
||||
_glu_dprintf( "sidesteps %g %g %g %g, stepsize %g %g\n",
|
||||
pspec[0].sidestep[0], pspec[0].sidestep[1],
|
||||
pspec[1].sidestep[0], pspec[1].sidestep[1],
|
||||
pspec[0].stepsize, pspec[1].stepsize );
|
||||
|
@@ -35,8 +35,8 @@
|
||||
/*
|
||||
* quilt.c++
|
||||
*
|
||||
* $Date: 2002/11/01 23:35:07 $ $Revision: 1.2 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/quilt.cc,v 1.2 2002/11/01 23:35:07 brianp Exp $
|
||||
* $Date: 2006/03/14 15:08:52 $ $Revision: 1.3 $
|
||||
* $Header: /home/krh/git/sync/mesa-cvs-repo/Mesa/src/glu/sgi/libnurbs/internals/quilt.cc,v 1.3 2006/03/14 15:08:52 brianp Exp $
|
||||
*/
|
||||
|
||||
#include "glimports.h"
|
||||
@@ -91,12 +91,12 @@ Quilt::show( void )
|
||||
for( int i=0; i!= qspec[0].order * qspec[0].width; i++ ) {
|
||||
for( int j = 0; j!= qspec[1].order * qspec[1].width; j++ ) {
|
||||
for( int k=0; k < nc; k++ )
|
||||
dprintf( "%g ", ps[i*qspec[0].stride + j*qspec[1].stride + k] );
|
||||
dprintf( "\n" );
|
||||
_glu_dprintf( "%g ", ps[i*qspec[0].stride + j*qspec[1].stride + k] );
|
||||
_glu_dprintf( "\n" );
|
||||
}
|
||||
dprintf( "\n" );
|
||||
_glu_dprintf( "\n" );
|
||||
}
|
||||
dprintf( "\n" );
|
||||
_glu_dprintf( "\n" );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user