Compare commits
220 Commits
mesa_7_6_1
...
android-x8
Author | SHA1 | Date | |
---|---|---|---|
|
74237c1a10 | ||
|
ce5af556aa | ||
|
f457f7a31c | ||
|
11ff6a0e6f | ||
|
b4bf8be547 | ||
|
6ec4bba0ea | ||
|
893bc24da3 | ||
|
c83d23d30d | ||
|
e786472b8d | ||
|
27c1ec2334 | ||
|
607a4393e7 | ||
|
74174dd5d6 | ||
|
35f9a9c5c9 | ||
|
d5e732764b | ||
|
ef1a6243ef | ||
|
8911b7d7a1 | ||
|
1ba61c244f | ||
|
dce62509e5 | ||
|
25e6736400 | ||
|
6059e6a8f2 | ||
|
3c718c0e95 | ||
|
3806be3ddb | ||
|
94f9330609 | ||
|
08b9155eee | ||
|
87b5e03290 | ||
|
94fe206c56 | ||
|
62e7cd2aca | ||
|
16678f5dbf | ||
|
705fed33ea | ||
|
4e547d5155 | ||
|
d535d82b32 | ||
|
dea3bc04c1 | ||
|
a49adc545b | ||
|
b4d0fdf8d2 | ||
|
a5a8bdfd9b | ||
|
e2ba90a9cc | ||
|
b4b8800315 | ||
|
4e5934fed1 | ||
|
c4a8ce7ffd | ||
|
9199889374 | ||
|
80c0f18f2d | ||
|
4db23069f9 | ||
|
77e2b23ea6 | ||
|
5f32756254 | ||
|
9e9a4cf471 | ||
|
985cefb769 | ||
|
554361e2b2 | ||
|
a1842a4f11 | ||
|
73f3765270 | ||
|
33640499b9 | ||
|
0878cce17d | ||
|
cbd17236c8 | ||
|
8077986205 | ||
|
542c26fa4f | ||
|
a98c282c7d | ||
|
dc2ddb27d3 | ||
|
0fc1cd5e91 | ||
|
5f471a37aa | ||
|
9562ca3628 | ||
|
e6f4bc9d82 | ||
|
2ae5bf72c2 | ||
|
cc0d078977 | ||
|
4938cb77f8 | ||
|
a00d4ab589 | ||
|
b5abf7b08b | ||
|
70b6b622bf | ||
|
440882f547 | ||
|
e5501bd823 | ||
|
919fbc5524 | ||
|
55c73512c9 | ||
|
4cf0415cc0 | ||
|
3de1a6584f | ||
|
3c417b27a2 | ||
|
9ac1d3e36f | ||
|
610e200429 | ||
|
de8b4f3bbd | ||
|
4132e67e31 | ||
|
5c8873a311 | ||
|
b7c133b5c2 | ||
|
1c497bd4c6 | ||
|
17f2649e26 | ||
|
57ce3ab323 | ||
|
7f8045ab4e | ||
|
6fcf6a5a7f | ||
|
b04d58c0b1 | ||
|
8df670164f | ||
|
940b525a5a | ||
|
93c3911ca8 | ||
|
c9ae896376 | ||
|
bae850f9af | ||
|
ec86469c55 | ||
|
5bcfe4b5c8 | ||
|
57377d5d69 | ||
|
b565e7b88c | ||
|
c7ebd40185 | ||
|
57d16c4cc3 | ||
|
a79eecb913 | ||
|
08b7d32140 | ||
|
622b31925b | ||
|
4099bb7614 | ||
|
4108ed7e80 | ||
|
672c5f52d1 | ||
|
1fc4100225 | ||
|
7c0152fbae | ||
|
0ef5b62787 | ||
|
4781c1f459 | ||
|
6bc36f29c7 | ||
|
209031701a | ||
|
de059d35c3 | ||
|
afcaa45a94 | ||
|
759696defb | ||
|
71b3ccc4b0 | ||
|
d9dc4cb0e4 | ||
|
8c37a4c8fd | ||
|
85a716bf62 | ||
|
feb74e7753 | ||
|
57d0934bc5 | ||
|
974dec2e7b | ||
|
16886c8be3 | ||
|
6be1a98ab9 | ||
|
3167c2e8a0 | ||
|
18882f4d30 | ||
|
36dd53a3cd | ||
|
e669dc2b0d | ||
|
7dfe54a60e | ||
|
f89751e719 | ||
|
c7291f69a0 | ||
|
6a405b4a21 | ||
|
4c3a48ad0c | ||
|
48f19c0bcd | ||
|
c3c80c5c22 | ||
|
8e6b925d2a | ||
|
bd3b59da63 | ||
|
4139bc8f43 | ||
|
b0b131b023 | ||
|
abc160b664 | ||
|
cdbbcdf3bd | ||
|
da912a7a16 | ||
|
01c831576e | ||
|
5604b27b93 | ||
|
4d85a6b393 | ||
|
49c230709c | ||
|
7bf6347362 | ||
|
94a8157ef6 | ||
|
3fed69eb16 | ||
|
da9ed257a3 | ||
|
ca246dd186 | ||
|
5aaa45de4c | ||
|
8947cf6728 | ||
|
f78eafcacb | ||
|
97cbaab541 | ||
|
079ae4c38c | ||
|
126696caf7 | ||
|
e589a37f7b | ||
|
d112132840 | ||
|
547b726484 | ||
|
d585616f5b | ||
|
6e61d06209 | ||
|
3833587818 | ||
|
530fbd314e | ||
|
9fff4b46d3 | ||
|
f959ccdfa6 | ||
|
92d7ed8a20 | ||
|
ec9e729580 | ||
|
b11a8ea863 | ||
|
0310aafd9e | ||
|
0e5c2598ec | ||
|
b4922b5331 | ||
|
3e4539a471 | ||
|
15c0cc5cf4 | ||
|
ea6dab2537 | ||
|
58a57e3fc4 | ||
|
b2de028523 | ||
|
e61215242b | ||
|
8e8d3470be | ||
|
ced699b37a | ||
|
abdf2e14bc | ||
|
00aac1d29a | ||
|
e6ad286a80 | ||
|
e34ea368d9 | ||
|
2c307c7750 | ||
|
fcb94f6e3e | ||
|
79f48c9f9e | ||
|
b481fb2c6d | ||
|
1127201088 | ||
|
e4c76c02f7 | ||
|
de8376e2f2 | ||
|
0c2ea24338 | ||
|
fa0f4b35be | ||
|
4da20234f3 | ||
|
b1eff018c7 | ||
|
866fbacf2b | ||
|
6b129a8222 | ||
|
8be72bb764 | ||
|
970823978c | ||
|
826d441cdf | ||
|
617202b578 | ||
|
7b8ec0d8e7 | ||
|
23663ae914 | ||
|
4d63c626d0 | ||
|
886e7b318d | ||
|
b2951ffe96 | ||
|
f477fa7a85 | ||
|
0e5293a240 | ||
|
bcb62ae78a | ||
|
4fdc96db1d | ||
|
1ddb22675c | ||
|
4b01e6f614 | ||
|
9778731732 | ||
|
80ea03bd17 | ||
|
8f990f928b | ||
|
9ab19a3900 | ||
|
60ca65c016 | ||
|
8fd7586bcc | ||
|
0612ad4f19 | ||
|
a47858e45e | ||
|
8f7f22ca1d | ||
|
11a4292d4e | ||
|
07cc2311a8 | ||
|
8567d003d5 |
1
Android.mk
Normal file
1
Android.mk
Normal file
@@ -0,0 +1 @@
|
||||
include $(call all-subdir-makefiles)
|
31
Makefile
31
Makefile
@@ -105,6 +105,8 @@ irix6-n32-static \
|
||||
irix6-o32 \
|
||||
irix6-o32-static \
|
||||
linux \
|
||||
mine \
|
||||
mine-dri \
|
||||
linux-alpha \
|
||||
linux-alpha-static \
|
||||
linux-cell \
|
||||
@@ -182,7 +184,7 @@ ultrix-gcc:
|
||||
|
||||
# Rules for making release tarballs
|
||||
|
||||
VERSION=7.6.1
|
||||
VERSION=7.7-devel
|
||||
DIRECTORY = Mesa-$(VERSION)
|
||||
LIB_NAME = MesaLib-$(VERSION)
|
||||
DEMO_NAME = MesaDemos-$(VERSION)
|
||||
@@ -303,10 +305,25 @@ MAIN_FILES = \
|
||||
$(DIRECTORY)/progs/util/sampleMakefile \
|
||||
$(DIRECTORY)/windows/VC8/
|
||||
|
||||
EGL_FILES = \
|
||||
$(DIRECTORY)/include/EGL/*.h \
|
||||
ES_FILES = \
|
||||
$(DIRECTORY)/include/GLES/*.h \
|
||||
$(DIRECTORY)/include/GLES2/*.h \
|
||||
$(DIRECTORY)/src/mesa/glapi/*.xml \
|
||||
$(DIRECTORY)/src/mesa/glapi/*.py \
|
||||
$(DIRECTORY)/src/mesa/glapi/*.dtd \
|
||||
$(DIRECTORY)/src/mesa/es/glapi/Makefile \
|
||||
$(DIRECTORY)/src/mesa/es/glapi/*.xml \
|
||||
$(DIRECTORY)/src/mesa/es/glapi/*.py \
|
||||
$(DIRECTORY)/src/mesa/es/state_tracker/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/es/main/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/es/main/*.py \
|
||||
$(DIRECTORY)/src/mesa/es/main/*.txt \
|
||||
$(DIRECTORY)/src/mesa/es/main/es*_special \
|
||||
$(DIRECTORY)/src/mesa/es/Makefile \
|
||||
$(DIRECTORY)/src/mesa/es/sources.mak \
|
||||
|
||||
EGL_FILES = \
|
||||
$(DIRECTORY)/include/EGL/*.h \
|
||||
$(DIRECTORY)/src/egl/Makefile \
|
||||
$(DIRECTORY)/src/egl/*/Makefile \
|
||||
$(DIRECTORY)/src/egl/*/*.[ch] \
|
||||
@@ -433,7 +450,8 @@ DEMO_FILES = \
|
||||
$(DIRECTORY)/progs/windml/Makefile.ugl \
|
||||
$(DIRECTORY)/progs/windml/*.c \
|
||||
$(DIRECTORY)/progs/windml/*.bmp \
|
||||
$(DIRECTORY)/progs/ggi/*.c
|
||||
$(DIRECTORY)/progs/ggi/*.c \
|
||||
$(DIRECTORY)/windows/VC7/progs/progs.sln
|
||||
|
||||
GLUT_FILES = \
|
||||
$(DIRECTORY)/include/GL/glut.h \
|
||||
@@ -456,7 +474,9 @@ GLUT_FILES = \
|
||||
$(DIRECTORY)/src/glut/mini/glut.pc.in \
|
||||
$(DIRECTORY)/src/glut/directfb/Makefile \
|
||||
$(DIRECTORY)/src/glut/directfb/NOTES \
|
||||
$(DIRECTORY)/src/glut/directfb/*[ch]
|
||||
$(DIRECTORY)/src/glut/directfb/*[ch] \
|
||||
$(DIRECTORY)/windows/VC6/progs/glut/glut.dsp \
|
||||
$(DIRECTORY)/windows/VC7/progs/glut/glut.vcproj
|
||||
|
||||
DEPEND_FILES = \
|
||||
$(TOP)/src/mesa/depend \
|
||||
@@ -468,6 +488,7 @@ DEPEND_FILES = \
|
||||
|
||||
LIB_FILES = \
|
||||
$(MAIN_FILES) \
|
||||
$(ES_FILES) \
|
||||
$(EGL_FILES) \
|
||||
$(GALLIUM_FILES) \
|
||||
$(DRI_FILES) \
|
||||
|
@@ -124,7 +124,7 @@ INSTALL_INC_DIR = $(includedir)
|
||||
DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@
|
||||
|
||||
# Where libGL will look for DRI hardware drivers
|
||||
DRI_DRIVER_SEARCH_DIR = @DRI_DRIVER_SEARCH_DIR@
|
||||
DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR)
|
||||
|
||||
# Xorg driver install directory (for xorg state-tracker)
|
||||
XORG_DRIVER_INSTALL_DIR = @XORG_DRIVER_INSTALL_DIR@
|
||||
|
@@ -9,8 +9,8 @@ CONFIG_NAME = default
|
||||
|
||||
# Version info
|
||||
MESA_MAJOR=7
|
||||
MESA_MINOR=6
|
||||
MESA_TINY=1
|
||||
MESA_MINOR=7
|
||||
MESA_TINY=0
|
||||
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
|
||||
|
||||
# external projects. This should be useless now that we use libdrm.
|
||||
@@ -23,7 +23,6 @@ HOST_CC = $(CC)
|
||||
CFLAGS = -O
|
||||
CXXFLAGS = -O
|
||||
LDFLAGS =
|
||||
HOST_CFLAGS = $(CFLAGS)
|
||||
GLU_CFLAGS =
|
||||
|
||||
# Compiler for building demos/tests/etc
|
||||
|
82
configs/mine
Normal file
82
configs/mine
Normal file
@@ -0,0 +1,82 @@
|
||||
# -*-makefile-*-
|
||||
# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others
|
||||
|
||||
include $(TOP)/configs/default
|
||||
|
||||
CONFIG_NAME = mine
|
||||
|
||||
# Compiler and flags
|
||||
CC = ccache gcc
|
||||
CXX = ccache g++
|
||||
|
||||
#MKDEP = /usr/X11R6/bin/makedepend
|
||||
#MKDEP = gcc -M
|
||||
#MKDEP_OPTIONS = -MF depend
|
||||
|
||||
OPT_FLAGS = -O0 -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 \
|
||||
-DGLX_DIRECT_RENDERING \
|
||||
-DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN
|
||||
|
||||
X11_INCLUDES = -I/usr/X11R6/include
|
||||
|
||||
CFLAGS = -Wall -Wmissing-prototypes -std=c99 -ffast-math \
|
||||
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS)
|
||||
|
||||
CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
|
||||
|
||||
GLUT_CFLAGS = -fexceptions
|
||||
|
||||
# Work around aliasing bugs - developers should comment this out
|
||||
CFLAGS += -fno-strict-aliasing
|
||||
CXXFLAGS += -fno-strict-aliasing
|
||||
|
||||
MESA_ASM_SOURCES =
|
||||
|
||||
# Library/program dependencies
|
||||
EXTRA_LIB_PATH=-L/usr/X11R6/lib
|
||||
|
||||
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
|
||||
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
|
||||
-lm -lpthread -ldl $(LIBDRM_LIB)
|
||||
|
||||
|
||||
# Directories
|
||||
SRC_DIRS = egl mesa gallium gallium/winsys
|
||||
PROGRAM_DIRS := egl openvg/demos demos xdemos
|
||||
|
||||
# EGL directories
|
||||
EGL_DRIVERS_DIRS = glx xdri
|
||||
|
||||
ifeq ($(USE_DRI),yes)
|
||||
DEFINES += -DIN_DRI_DRIVER -DGLX_INDIRECT_RENDERING
|
||||
|
||||
LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm)
|
||||
LIBDRM_LIB = $(shell pkg-config --libs libdrm)
|
||||
|
||||
SRC_DIRS := glx/x11 $(SRC_DIRS)
|
||||
DRIVER_DIRS = dri
|
||||
WINDOW_SYSTEM = dri
|
||||
DRI_DIRS = i915
|
||||
|
||||
GALLIUM_WINSYS_DIRS = drm egl_xlib
|
||||
GALLIUM_WINSYS_DRM_DIRS = intel
|
||||
GALLIUM_STATE_TRACKERS_DIRS = egl glx vega
|
||||
|
||||
else
|
||||
|
||||
DRIVER_DIRS =
|
||||
WINDOW_SYSTEM =
|
||||
DRI_DIRS =
|
||||
|
||||
GALLIUM_WINSYS_DIRS = egl_xlib xlib
|
||||
GALLIUM_STATE_TRACKERS_DIRS = glx vega
|
||||
|
||||
endif
|
5
configs/mine-dri
Normal file
5
configs/mine-dri
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*-makefile-*-
|
||||
# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others
|
||||
|
||||
USE_DRI = yes
|
||||
include $(TOP)/configs/mine
|
16
configure.ac
16
configure.ac
@@ -230,8 +230,6 @@ else
|
||||
LIB_EXTENSION='dylib' ;;
|
||||
cygwin* )
|
||||
LIB_EXTENSION='dll' ;;
|
||||
aix* )
|
||||
LIB_EXTENSION='a' ;;
|
||||
* )
|
||||
LIB_EXTENSION='so' ;;
|
||||
esac
|
||||
@@ -649,13 +647,6 @@ AC_ARG_WITH([dri-driverdir],
|
||||
[DRI_DRIVER_INSTALL_DIR="$withval"],
|
||||
[DRI_DRIVER_INSTALL_DIR='${libdir}/dri'])
|
||||
AC_SUBST([DRI_DRIVER_INSTALL_DIR])
|
||||
dnl Extra search path for DRI drivers
|
||||
AC_ARG_WITH([dri-searchpath],
|
||||
[AS_HELP_STRING([--with-dri-searchpath=DIRS...],
|
||||
[semicolon delimited DRI driver search directories @<:@${libdir}/dri@:>@])],
|
||||
[DRI_DRIVER_SEARCH_DIR="$withval"],
|
||||
[DRI_DRIVER_SEARCH_DIR='${DRI_DRIVER_INSTALL_DIR}'])
|
||||
AC_SUBST([DRI_DRIVER_SEARCH_DIR])
|
||||
dnl Direct rendering or just indirect rendering
|
||||
AC_ARG_ENABLE([driglx-direct],
|
||||
[AS_HELP_STRING([--disable-driglx-direct],
|
||||
@@ -1157,11 +1148,6 @@ yes)
|
||||
if test "$tracker" = egl && test "x$enable_egl" != xyes; then
|
||||
AC_MSG_ERROR([cannot build egl state tracker without EGL library])
|
||||
fi
|
||||
if test "$tracker" = xorg; then
|
||||
PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
|
||||
HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
|
||||
HAVE_XEXTPROTO_71="no")
|
||||
fi
|
||||
done
|
||||
GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
|
||||
;;
|
||||
@@ -1216,7 +1202,7 @@ if test "x$enable_gallium_radeon" = xyes; then
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Gallium Nouveau configuration
|
||||
dnl Gallium Radeon configuration
|
||||
dnl
|
||||
AC_ARG_ENABLE([gallium-nouveau],
|
||||
[AS_HELP_STRING([--enable-gallium-nouveau],
|
||||
|
@@ -27,6 +27,12 @@ using the SDK with Visual Studio Express can be found at
|
||||
|
||||
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
|
||||
|
||||
If you are stuck using VC6 or VC7, you may start with these project
|
||||
files, but you may need to modify them to reflect changes in the
|
||||
Mesa source code tree. If you sucessfully update the project files,
|
||||
please submit them to the author of this document so that they may
|
||||
be included in the next distribution.
|
||||
|
||||
The project files to build the core Mesa library, Windows Mesa
|
||||
drivers, OSMesa, and GLU are in the mesa directory. The project files
|
||||
to build GLUT and some demo programs are in the progs directory.
|
||||
@@ -100,6 +106,23 @@ should build all the demos.
|
||||
Build System Notes
|
||||
----- ------ -----
|
||||
|
||||
VC6 (not actively supported)
|
||||
---
|
||||
|
||||
Visual Studio 6 does not recognize files with the .cc extension as C++
|
||||
language files, without a lot of unnatural tweaking. So, the VC6
|
||||
build process uses custom build steps to compile these files in the
|
||||
GLU library.
|
||||
|
||||
Two additional configurations are provided, Debug x86 and Release x86
|
||||
that activate the shader code compilation by defining SLANG_86. It is
|
||||
unknown if and how this works.
|
||||
|
||||
VC7 (not actively supported)
|
||||
---
|
||||
|
||||
The above-mentioned .cc problem does not exist in this version.
|
||||
|
||||
VC8
|
||||
---
|
||||
|
||||
|
@@ -10,24 +10,6 @@
|
||||
|
||||
<H1>News</H1>
|
||||
|
||||
<h2>November XX, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.6.1.html">Mesa 7.6.1</a> is released. This is a bug-fix
|
||||
release fixing issues found in the 7.6 release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>September 28, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.6.html">Mesa 7.6</a> is released. This is a new feature
|
||||
release. Those especially concerned about stability may want to wait for the
|
||||
follow-on 7.6.1 bug-fix release.
|
||||
</p>
|
||||
<p>
|
||||
<a href="relnotes-7.5.2.html">Mesa 7.5.2</a> is also released.
|
||||
This is a stable release fixing bugs since the 7.5.1 release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>September 3, 2009</h2>
|
||||
<p>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.5.2 Release Notes, 28 September 2009</H1>
|
||||
<H1>Mesa 7.5.2 Release Notes, (date tbd)</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.5.2 is a bug-fix release fixing issues found since the 7.5.1 release.
|
||||
@@ -31,15 +31,7 @@ for DRI hardware acceleration.
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
43a90191dd9f76cd65dcc1ac91f3be70 MesaLib-7.5.2.tar.gz
|
||||
94e47a499f1226803869c2e37a6a8e3a MesaLib-7.5.2.tar.bz2
|
||||
1ecb822b567ad67a0617361d45206b67 MesaLib-7.5.2.zip
|
||||
2718fdce7e075911d6147beb8f27104b MesaDemos-7.5.2.tar.gz
|
||||
4e0f5ccd58afe21eddcd94327d926e86 MesaDemos-7.5.2.tar.bz2
|
||||
f621f8c223b278d7c8e49a012d56ca25 MesaDemos-7.5.2.zip
|
||||
83c16c1d6bcfcc3f97aab5d2fe430b4c MesaGLUT-7.5.2.tar.gz
|
||||
e5d03bedae369ea3705783573bb33813 MesaGLUT-7.5.2.tar.bz2
|
||||
e82ba28e00d653e6f437d32be8ca8481 MesaGLUT-7.5.2.zip
|
||||
tbd
|
||||
</pre>
|
||||
|
||||
|
||||
@@ -53,15 +45,8 @@ e82ba28e00d653e6f437d32be8ca8481 MesaGLUT-7.5.2.zip
|
||||
<ul>
|
||||
<li>Assorted bug fixes for i965/i945 drivers
|
||||
<li>Fixed Gallium glDrawPixels(GL_STENCIL_INDEX) failure.
|
||||
<li>Fixed GLSL linker/preprocessor version directive issue seen in Wine
|
||||
(such as bug 23946)
|
||||
<li>glUseProgram() is now compiled into display lists (bug 23746).
|
||||
<li>glUniform functions are now compiled into display lists
|
||||
<li>Auto mipmap generation didn't work reliably with Gallium.
|
||||
<li>Fixed random number usage in GLX code.
|
||||
<li>Fixed invalid GL_OUT_OF_MEMORY error sometimes raised by glTexSubImage2D
|
||||
when using Gallium.
|
||||
</ul>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -1,72 +0,0 @@
|
||||
<HTML>
|
||||
|
||||
<TITLE>Mesa Release Notes</TITLE>
|
||||
|
||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.6.1 Release Notes, (date tbd)</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.6.1 is a bug-fix release fixing issues since version 7.6.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.6.1 implements the OpenGL 2.1 API, but the version reported by
|
||||
glGetString(GL_VERSION) depends on the particular driver being used.
|
||||
Some drivers don't support all the features required in OpenGL 2.1.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
tbd
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>New features</h2>
|
||||
<ul>
|
||||
<li>Upgraded GL/glext.h to version 56, GL/glxext.h to version 25,
|
||||
GL/wglext.h to version 17
|
||||
<li>New 3D driver, r600, for Radeon R6xx, R7xx hardware
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Fixed crash caused by glXCopyContext() and glXDestroyContext(), bug 24217
|
||||
<li>glXQueryContext(GLX_RENDER_TYPE) returned wrong values (bug 24211)
|
||||
<li>GLSL sqrt(0) returned unpredictable results
|
||||
<li>Fixed default texture binding bug when a bound texture was deleted.
|
||||
<li>r300: Work around an issue with very large fragment programs on R500.
|
||||
<li>Fake glXQueryDrawable() didn't return good values (bug 24320)
|
||||
<li>Fixed AUX buffer breakage (bug 24426).
|
||||
<li>Fixed locale-dependent float parsing bug in GLSL compiler (bug 24531)
|
||||
<li>Fixed Gallium Cell driver compilation failure.
|
||||
<li>Fixed glGetTexLevelParameter(GL_TEXTURE_INTERNAL_FORMAT) query so that
|
||||
it returns the actual compressed format chosen.
|
||||
<li>Fixed glBitmap bugs in Intel drivers.
|
||||
<li>Fixed a number of Microsoft Visual Studio compilation problems.
|
||||
<li>Fixed clipping / provoking vertex bugs in i965 driver.
|
||||
<li>Assorted build fixes for AIX.
|
||||
<li>Endianness fixes for the DRI swrast driver (bug 22767).</li>
|
||||
<li>Point sprite fixes for i915/945 driver.
|
||||
<li>Fixed assorted memory leaks (usually on error paths)
|
||||
<li>Fixed some GLSL compiler bugs (ex: 25579)
|
||||
<li>Assorted build fixes for BlueGene
|
||||
</ul>
|
||||
|
||||
<h2>Changes</h2>
|
||||
<ul>
|
||||
<li>Removed old VC6, VC7 project files for Windows
|
||||
</ul>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -8,7 +8,7 @@
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.6 Release Notes, 28 September 2009</H1>
|
||||
<H1>Mesa 7.6 Release Notes / date TBD</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.6 is a new development release.
|
||||
@@ -28,15 +28,7 @@ for DRI hardware acceleration.
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
5ffa7d7abf8973f57a1bc4f813e6dade MesaLib-7.6.tar.gz
|
||||
8c75f90cd0303cfac9e4b6d54f6759ca MesaLib-7.6.tar.bz2
|
||||
27fcfd69708599c978cb34ba5cd363e1 MesaLib-7.6.zip
|
||||
e7befb3ae604f591806194a4da445628 MesaDemos-7.6.tar.gz
|
||||
0ede7adf217951acd90dbe4551210c07 MesaDemos-7.6.tar.bz2
|
||||
ed9298409cf6613bc0964525ca4afc8a MesaDemos-7.6.zip
|
||||
666955668e44ff14acf7d15dc78407d3 MesaGLUT-7.6.tar.gz
|
||||
b8b59706f827d18d1b784a0ff98b4dc2 MesaGLUT-7.6.tar.bz2
|
||||
c49c19c2bbef4f3b7f1389974dff25f4 MesaGLUT-7.6.zip
|
||||
tbd
|
||||
</pre>
|
||||
|
||||
|
||||
@@ -58,8 +50,6 @@ This was written by Zack Rusin at Tungsten Graphics.
|
||||
<li>Rewritten radeon/r200/r300 driver using a buffer manager
|
||||
<li>radeon/r200/r300 GL_EXT_framebuffer_object support when used with
|
||||
kernel memory manager
|
||||
<li>radeon/r200/r300 support for GL_ARB_occlusion_query</li>
|
||||
<li>r300 driver supports OpenGL 1.5</li>
|
||||
<li>r300 driver support for GL_EXT_vertex_array_bgra, GL_EXT_texture_sRGB
|
||||
<li>i915/945 driver support for GL_ARB_point_sprite, GL_EXT_stencil_two_side
|
||||
and GL_ATI_separate_stencil extensions
|
||||
@@ -67,10 +57,6 @@ This was written by Zack Rusin at Tungsten Graphics.
|
||||
GL_ARB_fragment_program.</li>
|
||||
<li>Added configure --with-max-width=W, --with-max-height=H options to specify
|
||||
max framebuffer, viewport size.
|
||||
<li>Initial version of Gallium llvmpipe driver. This is a new driver based
|
||||
on LLVM which makes exensive use of run-time code generation. This is
|
||||
an "alpha" stage driver. See the src/gallium/drivers/llvmpipe/README
|
||||
file for more information.
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -80,5 +66,10 @@ This was written by Zack Rusin at Tungsten Graphics.
|
||||
buffers (GLSL uniforms)
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Changes</h2>
|
||||
<ul>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
53
docs/relnotes-7.7.html
Normal file
53
docs/relnotes-7.7.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<HTML>
|
||||
|
||||
<TITLE>Mesa Release Notes</TITLE>
|
||||
|
||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.7 Release Notes / date TBD</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.7 is a new development release.
|
||||
People who are concerned with stability and reliability should stick
|
||||
with a previous release or wait for Mesa 7.7.1.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.7 implements the OpenGL 2.1 API, but the version reported by
|
||||
glGetString(GL_VERSION) depends on the particular driver being used.
|
||||
Some drivers don't support all the features required in OpenGL 2.1.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
tbd
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>New features</h2>
|
||||
<ul>
|
||||
<li>GL_ARB_draw_elements_base_vertex (supported in Intel i965 and software drivers)</li>
|
||||
<li>GL_ARB_depth_clamp (supported in Intel i965 DRI and software drivers)</li>
|
||||
<li>GL_NV_depth_clamp (supported in Intel i965 DRI and software drivers)</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Changes</h2>
|
||||
<ul>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -13,7 +13,7 @@ The release notes summarize what's new or changed in each Mesa release.
|
||||
</p>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="relnotes-7.6.1.html">7.6.1 release notes</A>
|
||||
<LI><A HREF="relnotes-7.7.html">7.7 release notes</A>
|
||||
<LI><A HREF="relnotes-7.6.html">7.6 release notes</A>
|
||||
<LI><A HREF="relnotes-7.5.2.html">7.5.2 release notes</A>
|
||||
<LI><A HREF="relnotes-7.5.1.html">7.5.1 release notes</A>
|
||||
|
@@ -6,7 +6,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007 The Khronos Group Inc.
|
||||
** Copyright (c) 2007-2009 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
@@ -33,9 +33,9 @@ extern "C" {
|
||||
/*************************************************************/
|
||||
|
||||
/* Header file version number */
|
||||
/* eglext.h last updated 2007/11/20 */
|
||||
/* Current version at http://www.khronos.org/registry/egl/ */
|
||||
#define EGL_EGLEXT_VERSION 1
|
||||
/* $Revision: 7244 $ on $Date: 2009-01-20 17:06:59 -0800 (Tue, 20 Jan 2009) $ */
|
||||
#define EGL_EGLEXT_VERSION 3
|
||||
|
||||
#ifndef EGL_KHR_config_attribs
|
||||
#define EGL_KHR_config_attribs 1
|
||||
@@ -79,12 +79,12 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display
|
||||
#define EGL_KHR_image 1
|
||||
#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
|
||||
typedef void *EGLImageKHR;
|
||||
extern const EGLImageKHR EGL_NO_IMAGE_KHR;
|
||||
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, EGLint *attr_list);
|
||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, EGLint *attr_list);
|
||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
|
||||
#endif
|
||||
|
||||
@@ -179,6 +179,17 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYCONTEXTMESA) (EGLDisplay dpy, EGLCont
|
||||
|
||||
#endif /* EGL_MESA_copy_context */
|
||||
|
||||
#ifndef EGL_KHR_image_base
|
||||
#define EGL_KHR_image_base 1
|
||||
/* Most interfaces defined by EGL_KHR_image_pixmap above */
|
||||
#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_image_pixmap
|
||||
#define EGL_KHR_image_pixmap 1
|
||||
/* Interfaces defined by EGL_KHR_image above */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
27
include/EGL/internal/eglimage_dri.h
Normal file
27
include/EGL/internal/eglimage_dri.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef EGLIMAGE_DRI_INCLUDED
|
||||
#define EGLIMAGE_DRI_INCLUDED
|
||||
|
||||
#include "GL/internal/dri_interface.h"
|
||||
|
||||
#define __DRI_EGL_IMAGE_MAGIC \
|
||||
(('D' << 24) | \
|
||||
('R' << 16) | \
|
||||
('I' << 8) | \
|
||||
('0'))
|
||||
|
||||
typedef void *__DRIEGLImageHandle;
|
||||
typedef struct __DRIEGLImageRec __DRIEGLImage;
|
||||
|
||||
struct __DRIEGLImageRec {
|
||||
GLint magic;
|
||||
|
||||
__DRIdrawable *drawable;
|
||||
|
||||
GLboolean texture_format_rgba;
|
||||
GLint level;
|
||||
GLint __pad[4];
|
||||
};
|
||||
|
||||
extern __DRIEGLImage *_eglClientGetImageData(__DRIEGLImageHandle handle);
|
||||
|
||||
#endif /* EGLIMAGE_DRI_INCLUDED */
|
@@ -1740,9 +1740,6 @@ GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target,
|
||||
GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format,
|
||||
GLenum type, GLvoid *row, GLvoid *column, GLvoid *span );
|
||||
|
||||
typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@@ -1948,18 +1945,6 @@ GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] );
|
||||
GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert );
|
||||
|
||||
|
||||
typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
|
||||
typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1)
|
||||
*/
|
||||
|
@@ -108,20 +108,12 @@
|
||||
#define glBlendColorEXT MANGLE(BlendColorEXT)
|
||||
#define glBlendColor MANGLE(BlendColor)
|
||||
#define glBlendEquationEXT MANGLE(BlendEquationEXT)
|
||||
#define glBlendEquationi MANGLE(BlendEquationi)
|
||||
#define glBlendEquationIndexedAMD MANGLE(BlendEquationIndexedAMD)
|
||||
#define glBlendEquation MANGLE(BlendEquation)
|
||||
#define glBlendEquationSeparateATI MANGLE(BlendEquationSeparateATI)
|
||||
#define glBlendEquationSeparateEXT MANGLE(BlendEquationSeparateEXT)
|
||||
#define glBlendEquationSeparatei MANGLE(BlendEquationSeparatei)
|
||||
#define glBlendEquationSeparateIndexedAMD MANGLE(BlendEquationSeparateIndexedAMD)
|
||||
#define glBlendEquationSeparate MANGLE(BlendEquationSeparate)
|
||||
#define glBlendFunci MANGLE(BlendFunci)
|
||||
#define glBlendFuncIndexedAMD MANGLE(BlendFuncIndexedAMD)
|
||||
#define glBlendFunc MANGLE(BlendFunc)
|
||||
#define glBlendFuncSeparateEXT MANGLE(BlendFuncSeparateEXT)
|
||||
#define glBlendFuncSeparatei MANGLE(BlendFuncSeparatei)
|
||||
#define glBlendFuncSeparateIndexedAMD MANGLE(BlendFuncSeparateIndexedAMD)
|
||||
#define glBlendFuncSeparateINGR MANGLE(BlendFuncSeparateINGR)
|
||||
#define glBlendFuncSeparate MANGLE(BlendFuncSeparate)
|
||||
#define glBlitFramebufferEXT MANGLE(BlitFramebufferEXT)
|
||||
@@ -156,7 +148,6 @@
|
||||
#define glClientActiveTexture MANGLE(ClientActiveTexture)
|
||||
#define glClientActiveVertexStreamATI MANGLE(ClientActiveVertexStreamATI)
|
||||
#define glClientAttribDefaultEXT MANGLE(ClientAttribDefaultEXT)
|
||||
#define glClientWaitSync MANGLE(ClientWaitSync)
|
||||
#define glClipPlane MANGLE(ClipPlane)
|
||||
#define glColor3b MANGLE(Color3b)
|
||||
#define glColor3bv MANGLE(Color3bv)
|
||||
@@ -329,7 +320,6 @@
|
||||
#define glDeleteRenderbuffersEXT MANGLE(DeleteRenderbuffersEXT)
|
||||
#define glDeleteRenderbuffers MANGLE(DeleteRenderbuffers)
|
||||
#define glDeleteShader MANGLE(DeleteShader)
|
||||
#define glDeleteSync MANGLE(DeleteSync)
|
||||
#define glDeleteTexturesEXT MANGLE(DeleteTexturesEXT)
|
||||
#define glDeleteTextures MANGLE(DeleteTextures)
|
||||
#define glDeleteTransformFeedbacksNV MANGLE(DeleteTransformFeedbacksNV)
|
||||
@@ -351,7 +341,6 @@
|
||||
#define glDisableIndexedEXT MANGLE(DisableIndexedEXT)
|
||||
#define glDisable MANGLE(Disable)
|
||||
#define glDisableVariantClientStateEXT MANGLE(DisableVariantClientStateEXT)
|
||||
#define glDisableVertexAttribAPPLE MANGLE(DisableVertexAttribAPPLE)
|
||||
#define glDisableVertexAttribArrayARB MANGLE(DisableVertexAttribArrayARB)
|
||||
#define glDisableVertexAttribArray MANGLE(DisableVertexAttribArray)
|
||||
#define glDrawArraysEXT MANGLE(DrawArraysEXT)
|
||||
@@ -365,9 +354,7 @@
|
||||
#define glDrawBuffers MANGLE(DrawBuffers)
|
||||
#define glDrawElementArrayAPPLE MANGLE(DrawElementArrayAPPLE)
|
||||
#define glDrawElementArrayATI MANGLE(DrawElementArrayATI)
|
||||
#define glDrawElementsBaseVertex MANGLE(DrawElementsBaseVertex)
|
||||
#define glDrawElementsInstancedARB MANGLE(DrawElementsInstancedARB)
|
||||
#define glDrawElementsInstancedBaseVertex MANGLE(DrawElementsInstancedBaseVertex)
|
||||
#define glDrawElementsInstancedEXT MANGLE(DrawElementsInstancedEXT)
|
||||
#define glDrawElementsInstanced MANGLE(DrawElementsInstanced)
|
||||
#define glDrawElements MANGLE(DrawElements)
|
||||
@@ -375,7 +362,6 @@
|
||||
#define glDrawPixels MANGLE(DrawPixels)
|
||||
#define glDrawRangeElementArrayAPPLE MANGLE(DrawRangeElementArrayAPPLE)
|
||||
#define glDrawRangeElementArrayATI MANGLE(DrawRangeElementArrayATI)
|
||||
#define glDrawRangeElementsBaseVertex MANGLE(DrawRangeElementsBaseVertex)
|
||||
#define glDrawRangeElementsEXT MANGLE(DrawRangeElementsEXT)
|
||||
#define glDrawRangeElements MANGLE(DrawRangeElements)
|
||||
#define glDrawTransformFeedbackNV MANGLE(DrawTransformFeedbackNV)
|
||||
@@ -392,7 +378,6 @@
|
||||
#define glEnableIndexedEXT MANGLE(EnableIndexedEXT)
|
||||
#define glEnable MANGLE(Enable)
|
||||
#define glEnableVariantClientStateEXT MANGLE(EnableVariantClientStateEXT)
|
||||
#define glEnableVertexAttribAPPLE MANGLE(EnableVertexAttribAPPLE)
|
||||
#define glEnableVertexAttribArrayARB MANGLE(EnableVertexAttribArrayARB)
|
||||
#define glEnableVertexAttribArray MANGLE(EnableVertexAttribArray)
|
||||
#define glEndConditionalRender MANGLE(EndConditionalRender)
|
||||
@@ -424,7 +409,6 @@
|
||||
#define glExecuteProgramNV MANGLE(ExecuteProgramNV)
|
||||
#define glExtractComponentEXT MANGLE(ExtractComponentEXT)
|
||||
#define glFeedbackBuffer MANGLE(FeedbackBuffer)
|
||||
#define glFenceSync MANGLE(FenceSync)
|
||||
#define glFinalCombinerInputNV MANGLE(FinalCombinerInputNV)
|
||||
#define glFinishAsyncSGIX MANGLE(FinishAsyncSGIX)
|
||||
#define glFinishFenceAPPLE MANGLE(FinishFenceAPPLE)
|
||||
@@ -485,11 +469,9 @@
|
||||
#define glFramebufferTextureEXT MANGLE(FramebufferTextureEXT)
|
||||
#define glFramebufferTextureFaceARB MANGLE(FramebufferTextureFaceARB)
|
||||
#define glFramebufferTextureFaceEXT MANGLE(FramebufferTextureFaceEXT)
|
||||
#define glFramebufferTextureFace MANGLE(FramebufferTextureFace)
|
||||
#define glFramebufferTextureLayerARB MANGLE(FramebufferTextureLayerARB)
|
||||
#define glFramebufferTextureLayerEXT MANGLE(FramebufferTextureLayerEXT)
|
||||
#define glFramebufferTextureLayer MANGLE(FramebufferTextureLayer)
|
||||
#define glFramebufferTexture MANGLE(FramebufferTexture)
|
||||
#define glFrameTerminatorGREMEDY MANGLE(FrameTerminatorGREMEDY)
|
||||
#define glFrameZoomSGIX MANGLE(FrameZoomSGIX)
|
||||
#define glFreeObjectBufferATI MANGLE(FreeObjectBufferATI)
|
||||
@@ -541,7 +523,6 @@
|
||||
#define glGetBooleanIndexedvEXT MANGLE(GetBooleanIndexedvEXT)
|
||||
#define glGetBooleani_v MANGLE(GetBooleani_v)
|
||||
#define glGetBooleanv MANGLE(GetBooleanv)
|
||||
#define glGetBufferParameteri64v MANGLE(GetBufferParameteri64v)
|
||||
#define glGetBufferParameterivARB MANGLE(GetBufferParameterivARB)
|
||||
#define glGetBufferParameteriv MANGLE(GetBufferParameteriv)
|
||||
#define glGetBufferPointervARB MANGLE(GetBufferPointervARB)
|
||||
@@ -605,8 +586,6 @@
|
||||
#define glGetImageTransformParameterivHP MANGLE(GetImageTransformParameterivHP)
|
||||
#define glGetInfoLogARB MANGLE(GetInfoLogARB)
|
||||
#define glGetInstrumentsSGIX MANGLE(GetInstrumentsSGIX)
|
||||
#define glGetInteger64i_v MANGLE(GetInteger64i_v)
|
||||
#define glGetInteger64v MANGLE(GetInteger64v)
|
||||
#define glGetIntegerIndexedvEXT MANGLE(GetIntegerIndexedvEXT)
|
||||
#define glGetIntegeri_v MANGLE(GetIntegeri_v)
|
||||
#define glGetIntegerv MANGLE(GetIntegerv)
|
||||
@@ -636,7 +615,6 @@
|
||||
#define glGetMinmaxParameterfv MANGLE(GetMinmaxParameterfv)
|
||||
#define glGetMinmaxParameterivEXT MANGLE(GetMinmaxParameterivEXT)
|
||||
#define glGetMinmaxParameteriv MANGLE(GetMinmaxParameteriv)
|
||||
#define glGetMultisamplefv MANGLE(GetMultisamplefv)
|
||||
#define glGetMultisamplefvNV MANGLE(GetMultisamplefvNV)
|
||||
#define glGetMultiTexEnvfvEXT MANGLE(GetMultiTexEnvfvEXT)
|
||||
#define glGetMultiTexEnvivEXT MANGLE(GetMultiTexEnvivEXT)
|
||||
@@ -664,7 +642,6 @@
|
||||
#define glGetObjectBufferfvATI MANGLE(GetObjectBufferfvATI)
|
||||
#define glGetObjectBufferivATI MANGLE(GetObjectBufferivATI)
|
||||
#define glGetObjectParameterfvARB MANGLE(GetObjectParameterfvARB)
|
||||
#define glGetObjectParameterivAPPLE MANGLE(GetObjectParameterivAPPLE)
|
||||
#define glGetObjectParameterivARB MANGLE(GetObjectParameterivARB)
|
||||
#define glGetOcclusionQueryivNV MANGLE(GetOcclusionQueryivNV)
|
||||
#define glGetOcclusionQueryuivNV MANGLE(GetOcclusionQueryuivNV)
|
||||
@@ -721,7 +698,6 @@
|
||||
#define glGetSharpenTexFuncSGIS MANGLE(GetSharpenTexFuncSGIS)
|
||||
#define glGetStringi MANGLE(GetStringi)
|
||||
#define glGetString MANGLE(GetString)
|
||||
#define glGetSynciv MANGLE(GetSynciv)
|
||||
#define glGetTexBumpParameterfvATI MANGLE(GetTexBumpParameterfvATI)
|
||||
#define glGetTexBumpParameterivATI MANGLE(GetTexBumpParameterivATI)
|
||||
#define glGetTexEnvfv MANGLE(GetTexEnvfv)
|
||||
@@ -739,7 +715,6 @@
|
||||
#define glGetTexParameterIuivEXT MANGLE(GetTexParameterIuivEXT)
|
||||
#define glGetTexParameterIuiv MANGLE(GetTexParameterIuiv)
|
||||
#define glGetTexParameteriv MANGLE(GetTexParameteriv)
|
||||
#define glGetTexParameterPointervAPPLE MANGLE(GetTexParameterPointervAPPLE)
|
||||
#define glGetTextureImageEXT MANGLE(GetTextureImageEXT)
|
||||
#define glGetTextureLevelParameterfvEXT MANGLE(GetTextureLevelParameterfvEXT)
|
||||
#define glGetTextureLevelParameterivEXT MANGLE(GetTextureLevelParameterivEXT)
|
||||
@@ -850,14 +825,12 @@
|
||||
#define glIsRenderbufferEXT MANGLE(IsRenderbufferEXT)
|
||||
#define glIsRenderbuffer MANGLE(IsRenderbuffer)
|
||||
#define glIsShader MANGLE(IsShader)
|
||||
#define glIsSync MANGLE(IsSync)
|
||||
#define glIsTextureEXT MANGLE(IsTextureEXT)
|
||||
#define glIsTexture MANGLE(IsTexture)
|
||||
#define glIsTransformFeedbackNV MANGLE(IsTransformFeedbackNV)
|
||||
#define glIsVariantEnabledEXT MANGLE(IsVariantEnabledEXT)
|
||||
#define glIsVertexArrayAPPLE MANGLE(IsVertexArrayAPPLE)
|
||||
#define glIsVertexArray MANGLE(IsVertexArray)
|
||||
#define glIsVertexAttribEnabledAPPLE MANGLE(IsVertexAttribEnabledAPPLE)
|
||||
#define glLightEnviSGIX MANGLE(LightEnviSGIX)
|
||||
#define glLightf MANGLE(Lightf)
|
||||
#define glLightfv MANGLE(Lightfv)
|
||||
@@ -904,10 +877,6 @@
|
||||
#define glMapObjectBufferATI MANGLE(MapObjectBufferATI)
|
||||
#define glMapParameterfvNV MANGLE(MapParameterfvNV)
|
||||
#define glMapParameterivNV MANGLE(MapParameterivNV)
|
||||
#define glMapVertexAttrib1dAPPLE MANGLE(MapVertexAttrib1dAPPLE)
|
||||
#define glMapVertexAttrib1fAPPLE MANGLE(MapVertexAttrib1fAPPLE)
|
||||
#define glMapVertexAttrib2dAPPLE MANGLE(MapVertexAttrib2dAPPLE)
|
||||
#define glMapVertexAttrib2fAPPLE MANGLE(MapVertexAttrib2fAPPLE)
|
||||
#define glMaterialf MANGLE(Materialf)
|
||||
#define glMaterialfv MANGLE(Materialfv)
|
||||
#define glMateriali MANGLE(Materiali)
|
||||
@@ -938,11 +907,9 @@
|
||||
#define glMatrixTranslatefEXT MANGLE(MatrixTranslatefEXT)
|
||||
#define glMinmaxEXT MANGLE(MinmaxEXT)
|
||||
#define glMinmax MANGLE(Minmax)
|
||||
#define glMinSampleShading MANGLE(MinSampleShading)
|
||||
#define glMultiDrawArraysEXT MANGLE(MultiDrawArraysEXT)
|
||||
#define glMultiDrawArrays MANGLE(MultiDrawArrays)
|
||||
#define glMultiDrawElementArrayAPPLE MANGLE(MultiDrawElementArrayAPPLE)
|
||||
#define glMultiDrawElementsBaseVertex MANGLE(MultiDrawElementsBaseVertex)
|
||||
#define glMultiDrawElementsEXT MANGLE(MultiDrawElementsEXT)
|
||||
#define glMultiDrawElements MANGLE(MultiDrawElements)
|
||||
#define glMultiDrawRangeElementArrayAPPLE MANGLE(MultiDrawRangeElementArrayAPPLE)
|
||||
@@ -1105,8 +1072,6 @@
|
||||
#define glNormalStream3ivATI MANGLE(NormalStream3ivATI)
|
||||
#define glNormalStream3sATI MANGLE(NormalStream3sATI)
|
||||
#define glNormalStream3svATI MANGLE(NormalStream3svATI)
|
||||
#define glObjectPurgeableAPPLE MANGLE(ObjectPurgeableAPPLE)
|
||||
#define glObjectUnpurgeableAPPLE MANGLE(ObjectUnpurgeableAPPLE)
|
||||
#define glOrtho MANGLE(Ortho)
|
||||
#define glPassTexCoordATI MANGLE(PassTexCoordATI)
|
||||
#define glPassThrough MANGLE(PassThrough)
|
||||
@@ -1197,7 +1162,6 @@
|
||||
#define glProgramParameter4fvNV MANGLE(ProgramParameter4fvNV)
|
||||
#define glProgramParameteriARB MANGLE(ProgramParameteriARB)
|
||||
#define glProgramParameteriEXT MANGLE(ProgramParameteriEXT)
|
||||
#define glProgramParameteri MANGLE(ProgramParameteri)
|
||||
#define glProgramParameters4dvNV MANGLE(ProgramParameters4dvNV)
|
||||
#define glProgramParameters4fvNV MANGLE(ProgramParameters4fvNV)
|
||||
#define glProgramStringARB MANGLE(ProgramStringARB)
|
||||
@@ -1236,7 +1200,6 @@
|
||||
#define glProgramUniformMatrix4x3fvEXT MANGLE(ProgramUniformMatrix4x3fvEXT)
|
||||
#define glProgramVertexLimitNV MANGLE(ProgramVertexLimitNV)
|
||||
#define glProvokingVertexEXT MANGLE(ProvokingVertexEXT)
|
||||
#define glProvokingVertex MANGLE(ProvokingVertex)
|
||||
#define glPushAttrib MANGLE(PushAttrib)
|
||||
#define glPushClientAttribDefaultEXT MANGLE(PushClientAttribDefaultEXT)
|
||||
#define glPushClientAttrib MANGLE(PushClientAttrib)
|
||||
@@ -1320,7 +1283,6 @@
|
||||
#define glSampleCoverage MANGLE(SampleCoverage)
|
||||
#define glSampleMapATI MANGLE(SampleMapATI)
|
||||
#define glSampleMaskEXT MANGLE(SampleMaskEXT)
|
||||
#define glSampleMaski MANGLE(SampleMaski)
|
||||
#define glSampleMaskIndexedNV MANGLE(SampleMaskIndexedNV)
|
||||
#define glSampleMaskSGIS MANGLE(SampleMaskSGIS)
|
||||
#define glSamplePatternEXT MANGLE(SamplePatternEXT)
|
||||
@@ -1492,10 +1454,8 @@
|
||||
#define glTexGeniv MANGLE(TexGeniv)
|
||||
#define glTexImage1D MANGLE(TexImage1D)
|
||||
#define glTexImage2D MANGLE(TexImage2D)
|
||||
#define glTexImage2DMultisample MANGLE(TexImage2DMultisample)
|
||||
#define glTexImage3DEXT MANGLE(TexImage3DEXT)
|
||||
#define glTexImage3D MANGLE(TexImage3D)
|
||||
#define glTexImage3DMultisample MANGLE(TexImage3DMultisample)
|
||||
#define glTexImage4DSGIS MANGLE(TexImage4DSGIS)
|
||||
#define glTexParameterf MANGLE(TexParameterf)
|
||||
#define glTexParameterfv MANGLE(TexParameterfv)
|
||||
@@ -1527,7 +1487,6 @@
|
||||
#define glTextureParameterIivEXT MANGLE(TextureParameterIivEXT)
|
||||
#define glTextureParameterIuivEXT MANGLE(TextureParameterIuivEXT)
|
||||
#define glTextureParameterivEXT MANGLE(TextureParameterivEXT)
|
||||
#define glTextureRangeAPPLE MANGLE(TextureRangeAPPLE)
|
||||
#define glTextureRenderbufferEXT MANGLE(TextureRenderbufferEXT)
|
||||
#define glTextureSubImage1DEXT MANGLE(TextureSubImage1DEXT)
|
||||
#define glTextureSubImage2DEXT MANGLE(TextureSubImage2DEXT)
|
||||
@@ -1869,7 +1828,6 @@
|
||||
#define glVertexWeighthvNV MANGLE(VertexWeighthvNV)
|
||||
#define glVertexWeightPointerEXT MANGLE(VertexWeightPointerEXT)
|
||||
#define glViewport MANGLE(Viewport)
|
||||
#define glWaitSync MANGLE(WaitSync)
|
||||
#define glWeightbvARB MANGLE(WeightbvARB)
|
||||
#define glWeightdvARB MANGLE(WeightdvARB)
|
||||
#define glWeightfvARB MANGLE(WeightfvARB)
|
||||
|
@@ -29,9 +29,9 @@ extern "C" {
|
||||
*/
|
||||
|
||||
/* Header file version number, required by OpenGL ABI for Linux */
|
||||
/* glext.h last updated $Date: 2009-09-24 13:55:03 -0700 (Thu, 24 Sep 2009) $ */
|
||||
/* glext.h last updated $Date: 2009-08-03 02:13:51 -0700 (Mon, 03 Aug 2009) $ */
|
||||
/* Current version at http://www.opengl.org/registry/ */
|
||||
#define GL_GLEXT_VERSION 56
|
||||
#define GL_GLEXT_VERSION 54
|
||||
|
||||
/* Function declaration macros - to move into glplatform.h */
|
||||
|
||||
@@ -4236,7 +4236,7 @@ extern "C" {
|
||||
#define GL_LUMINANCE16_SNORM 0x9019
|
||||
#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A
|
||||
#define GL_INTENSITY16_SNORM 0x901B
|
||||
/* reuse GL_RED_SNORM */
|
||||
/* reuse GL_R_SNORM */
|
||||
/* reuse GL_RG_SNORM */
|
||||
/* reuse GL_RGB_SNORM */
|
||||
/* reuse GL_RGBA_SNORM */
|
||||
@@ -4311,88 +4311,6 @@ extern "C" {
|
||||
#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16
|
||||
#endif
|
||||
|
||||
#ifndef GL_APPLE_rgb_422
|
||||
#define GL_RGB_422_APPLE 0x8A1F
|
||||
/* reuse GL_UNSIGNED_SHORT_8_8_APPLE */
|
||||
/* reuse GL_UNSIGNED_SHORT_8_8_REV_APPLE */
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_video_capture
|
||||
#define GL_VIDEO_BUFFER_NV 0x9020
|
||||
#define GL_VIDEO_BUFFER_BINDING_NV 0x9021
|
||||
#define GL_FIELD_UPPER_NV 0x9022
|
||||
#define GL_FIELD_LOWER_NV 0x9023
|
||||
#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024
|
||||
#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025
|
||||
#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026
|
||||
#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027
|
||||
#define GL_VIDEO_BUFFER_PITCH_NV 0x9028
|
||||
#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029
|
||||
#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A
|
||||
#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B
|
||||
#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C
|
||||
#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D
|
||||
#define GL_PARTIAL_SUCCESS_NV 0x902E
|
||||
#define GL_SUCCESS_NV 0x902F
|
||||
#define GL_FAILURE_NV 0x9030
|
||||
#define GL_YCBYCR8_422_NV 0x9031
|
||||
#define GL_YCBAYCR8A_4224_NV 0x9032
|
||||
#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033
|
||||
#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034
|
||||
#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035
|
||||
#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036
|
||||
#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037
|
||||
#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038
|
||||
#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039
|
||||
#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A
|
||||
#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B
|
||||
#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_copy_image
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_separate_shader_objects
|
||||
#define GL_ACTIVE_PROGRAM_EXT 0x8B8D
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_parameter_buffer_object2
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_shader_buffer_load
|
||||
#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D
|
||||
#define GL_GPU_ADDRESS_NV 0x8F34
|
||||
#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_vertex_buffer_unified_memory
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E
|
||||
#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20
|
||||
#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21
|
||||
#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22
|
||||
#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23
|
||||
#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24
|
||||
#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25
|
||||
#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26
|
||||
#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27
|
||||
#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28
|
||||
#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A
|
||||
#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B
|
||||
#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C
|
||||
#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D
|
||||
#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E
|
||||
#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F
|
||||
#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30
|
||||
#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31
|
||||
#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32
|
||||
#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_texture_barrier
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
@@ -9327,136 +9245,6 @@ typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType,
|
||||
#define GL_APPLE_row_bytes 1
|
||||
#endif
|
||||
|
||||
#ifndef GL_APPLE_rgb_422
|
||||
#define GL_APPLE_rgb_422 1
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_video_capture
|
||||
#define GL_NV_video_capture 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glBeginVideoCaptureNV (GLuint);
|
||||
GLAPI void APIENTRY glBindVideoCaptureStreamBufferNV (GLuint, GLuint, GLenum, GLintptrARB);
|
||||
GLAPI void APIENTRY glBindVideoCaptureStreamTextureNV (GLuint, GLuint, GLenum, GLenum, GLuint);
|
||||
GLAPI void APIENTRY glEndVideoCaptureNV (GLuint);
|
||||
GLAPI void APIENTRY glGetVideoCaptureivNV (GLuint, GLenum, GLint *);
|
||||
GLAPI void APIENTRY glGetVideoCaptureStreamivNV (GLuint, GLuint, GLenum, GLint *);
|
||||
GLAPI void APIENTRY glGetVideoCaptureStreamfvNV (GLuint, GLuint, GLenum, GLfloat *);
|
||||
GLAPI void APIENTRY glGetVideoCaptureStreamdvNV (GLuint, GLuint, GLenum, GLdouble *);
|
||||
GLAPI GLenum APIENTRY glVideoCaptureNV (GLuint, GLuint *, GLuint64EXT *);
|
||||
GLAPI void APIENTRY glVideoCaptureStreamParameterivNV (GLuint, GLuint, GLenum, const GLint *);
|
||||
GLAPI void APIENTRY glVideoCaptureStreamParameterfvNV (GLuint, GLuint, GLenum, const GLfloat *);
|
||||
GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint, GLuint, GLenum, const GLdouble *);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot);
|
||||
typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);
|
||||
typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture);
|
||||
typedef void (APIENTRYP PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot);
|
||||
typedef void (APIENTRYP PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params);
|
||||
typedef GLenum (APIENTRYP PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time);
|
||||
typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params);
|
||||
typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params);
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_copy_image
|
||||
#define GL_NV_copy_image 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glCopyImageSubDataNV (GLuint, GLenum, GLint, GLint, GLint, GLint, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_separate_shader_objects
|
||||
#define GL_EXT_separate_shader_objects 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glUseShaderProgramEXT (GLenum, GLuint);
|
||||
GLAPI void APIENTRY glActiveProgramEXT (GLuint);
|
||||
GLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum, const GLchar *);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program);
|
||||
typedef void (APIENTRYP PFNGLACTIVEPROGRAMEXTPROC) (GLuint program);
|
||||
typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar *string);
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_parameter_buffer_object2
|
||||
#define GL_NV_parameter_buffer_object2 1
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_shader_buffer_load
|
||||
#define GL_NV_shader_buffer_load 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glMakeBufferResidentNV (GLenum, GLenum);
|
||||
GLAPI void APIENTRY glMakeBufferNonResidentNV (GLenum);
|
||||
GLAPI GLboolean APIENTRY glIsBufferResidentNV (GLenum);
|
||||
GLAPI void APIENTRY glNamedMakeBufferResidentNV (GLuint, GLenum);
|
||||
GLAPI void APIENTRY glNamedMakeBufferNonResidentNV (GLuint);
|
||||
GLAPI GLboolean APIENTRY glIsNamedBufferResidentNV (GLuint);
|
||||
GLAPI void APIENTRY glGetBufferParameterui64vNV (GLenum, GLenum, GLuint64EXT *);
|
||||
GLAPI void APIENTRY glGetNamedBufferParameterui64vNV (GLuint, GLenum, GLuint64EXT *);
|
||||
GLAPI void APIENTRY glGetIntegerui64vNV (GLenum, GLuint64EXT *);
|
||||
GLAPI void APIENTRY glUniformui64NV (GLint, GLuint64EXT);
|
||||
GLAPI void APIENTRY glUniformui64vNV (GLint, GLsizei, const GLuint64EXT *);
|
||||
GLAPI void APIENTRY glGetUniformui64vNV (GLuint, GLint, GLuint64EXT *);
|
||||
GLAPI void APIENTRY glProgramUniformui64NV (GLuint, GLint, GLuint64EXT);
|
||||
GLAPI void APIENTRY glProgramUniformui64vNV (GLuint, GLint, GLsizei, const GLuint64EXT *);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access);
|
||||
typedef void (APIENTRYP PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target);
|
||||
typedef GLboolean (APIENTRYP PFNGLISBUFFERRESIDENTNVPROC) (GLenum target);
|
||||
typedef void (APIENTRYP PFNGLNAMEDMAKEBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access);
|
||||
typedef void (APIENTRYP PFNGLNAMEDMAKEBUFFERNONRESIDENTNVPROC) (GLuint buffer);
|
||||
typedef GLboolean (APIENTRYP PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer);
|
||||
typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT *params);
|
||||
typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT *params);
|
||||
typedef void (APIENTRYP PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT *result);
|
||||
typedef void (APIENTRYP PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
typedef void (APIENTRYP PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT *params);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_vertex_buffer_unified_memory
|
||||
#define GL_NV_vertex_buffer_unified_memory 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glBufferAddressRangeNV (GLenum, GLuint, GLuint64EXT, GLsizeiptr);
|
||||
GLAPI void APIENTRY glVertexFormatNV (GLint, GLenum, GLsizei);
|
||||
GLAPI void APIENTRY glNormalFormatNV (GLenum, GLsizei);
|
||||
GLAPI void APIENTRY glColorFormatNV (GLint, GLenum, GLsizei);
|
||||
GLAPI void APIENTRY glIndexFormatNV (GLenum, GLsizei);
|
||||
GLAPI void APIENTRY glTexCoordFormatNV (GLint, GLenum, GLsizei);
|
||||
GLAPI void APIENTRY glEdgeFlagFormatNV (GLsizei);
|
||||
GLAPI void APIENTRY glSecondaryColorFormatNV (GLint, GLenum, GLsizei);
|
||||
GLAPI void APIENTRY glFogCoordFormatNV (GLenum, GLsizei);
|
||||
GLAPI void APIENTRY glVertexAttribFormatNV (GLuint, GLint, GLenum, GLboolean, GLsizei);
|
||||
GLAPI void APIENTRY glVertexAttribIFormatNV (GLuint, GLint, GLenum, GLsizei);
|
||||
GLAPI void APIENTRY glGetIntegerui64i_vNV (GLenum, GLuint, GLuint64EXT *);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);
|
||||
typedef void (APIENTRYP PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
|
||||
typedef void (APIENTRYP PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride);
|
||||
typedef void (APIENTRYP PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
|
||||
typedef void (APIENTRYP PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride);
|
||||
typedef void (APIENTRYP PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
|
||||
typedef void (APIENTRYP PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride);
|
||||
typedef void (APIENTRYP PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
|
||||
typedef void (APIENTRYP PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);
|
||||
typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result);
|
||||
#endif
|
||||
|
||||
#ifndef GL_NV_texture_barrier
|
||||
#define GL_NV_texture_barrier 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glTextureBarrierNV (void);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -76,7 +76,6 @@
|
||||
|
||||
/* GLX 1.4 */
|
||||
#define glXGetProcAddress mglXGetProcAddress
|
||||
#define glXGetProcAddressARB mglXGetProcAddressARB
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -48,9 +48,9 @@ extern "C" {
|
||||
/*************************************************************/
|
||||
|
||||
/* Header file version number, required by OpenGL ABI for Linux */
|
||||
/* glxext.h last updated 2009/10/08 */
|
||||
/* glxext.h last updated 2009/08/03 */
|
||||
/* Current version at http://www.opengl.org/registry/ */
|
||||
#define GLX_GLXEXT_VERSION 25
|
||||
#define GLX_GLXEXT_VERSION 23
|
||||
|
||||
#ifndef GLX_VERSION_1_3
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
@@ -382,20 +382,6 @@ extern "C" {
|
||||
#ifndef GLX_NV_swap_group
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_video_capture
|
||||
#define GLX_DEVICE_ID_NV 0x20CD
|
||||
#define GLX_UNIQUE_ID_NV 0x20CE
|
||||
#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_swap_control
|
||||
#define GLX_SWAP_INTERVAL_EXT 0x20F1
|
||||
#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_copy_image
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
@@ -429,14 +415,6 @@ typedef struct {
|
||||
} GLXBufferClobberEventSGIX;
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_video_output
|
||||
typedef unsigned int GLXVideoDeviceNV;
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_video_capture
|
||||
typedef XID GLXVideoCaptureDeviceNV;
|
||||
#endif
|
||||
|
||||
#ifndef GLEXT_64_TYPES_DEFINED
|
||||
/* This code block is duplicated in glext.h, so must be protected */
|
||||
#define GLEXT_64_TYPES_DEFINED
|
||||
@@ -849,80 +827,14 @@ typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawab
|
||||
|
||||
#ifndef GLX_NV_present_video
|
||||
#define GLX_NV_present_video 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern unsigned int * glXEnumerateVideoDevicesNV (Display *, int, int *);
|
||||
extern int glXBindVideoDeviceNV (Display *, unsigned int, unsigned int, const int *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef unsigned int * ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements);
|
||||
typedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_video_output
|
||||
#define GLX_NV_video_output 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXGetVideoDeviceNV (Display *, int, int, GLXVideoDeviceNV *);
|
||||
extern int glXReleaseVideoDeviceNV (Display *, int, GLXVideoDeviceNV);
|
||||
extern int glXBindVideoImageNV (Display *, GLXVideoDeviceNV, GLXPbuffer, int);
|
||||
extern int glXReleaseVideoImageNV (Display *, GLXPbuffer);
|
||||
extern int glXSendPbufferToVideoNV (Display *, GLXPbuffer, int, unsigned long *, GLboolean);
|
||||
extern int glXGetVideoInfoNV (Display *, int, GLXVideoDeviceNV, unsigned long *, unsigned long *);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
|
||||
typedef int ( * PFNGLXRELEASEVIDEODEVICENVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
|
||||
typedef int ( * PFNGLXBINDVIDEOIMAGENVPROC) (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
|
||||
typedef int ( * PFNGLXRELEASEVIDEOIMAGENVPROC) (Display *dpy, GLXPbuffer pbuf);
|
||||
typedef int ( * PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
|
||||
typedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#ifndef GLX_NV_video_out
|
||||
#define GLX_NV_video_out 1
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_swap_group
|
||||
#define GLX_NV_swap_group 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXJoinSwapGroupNV (Display *, GLXDrawable, GLuint);
|
||||
extern Bool glXBindSwapBarrierNV (Display *, GLuint, GLuint);
|
||||
extern Bool glXQuerySwapGroupNV (Display *, GLXDrawable, GLuint *, GLuint *);
|
||||
extern Bool glXQueryMaxSwapGroupsNV (Display *, int, GLuint *, GLuint *);
|
||||
extern Bool glXQueryFrameCountNV (Display *, int, GLuint *);
|
||||
extern Bool glXResetFrameCountNV (Display *, int);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group);
|
||||
typedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display *dpy, GLuint group, GLuint barrier);
|
||||
typedef Bool ( * PFNGLXQUERYSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
|
||||
typedef Bool ( * PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
typedef Bool ( * PFNGLXQUERYFRAMECOUNTNVPROC) (Display *dpy, int screen, GLuint *count);
|
||||
typedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display *dpy, int screen);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_video_capture
|
||||
#define GLX_NV_video_capture 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXBindVideoCaptureDeviceNV (Display *, unsigned int, GLXVideoCaptureDeviceNV);
|
||||
extern GLXVideoCaptureDeviceNV * glXEnumerateVideoCaptureDevicesNV (Display *, int, int *);
|
||||
extern void glXLockVideoCaptureDeviceNV (Display *, GLXVideoCaptureDeviceNV);
|
||||
extern int glXQueryVideoCaptureDeviceNV (Display *, GLXVideoCaptureDeviceNV, int, int *);
|
||||
extern void glXReleaseVideoCaptureDeviceNV (Display *, GLXVideoCaptureDeviceNV);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
|
||||
typedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display *dpy, int screen, int *nelements);
|
||||
typedef void ( * PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
|
||||
typedef int ( * PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
|
||||
typedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_EXT_swap_control
|
||||
#define GLX_EXT_swap_control 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXSwapIntervalEXT (Display *, GLXDrawable, int);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, int interval);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_NV_copy_image
|
||||
#define GLX_NV_copy_image 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXCopyImageSubDataNV (Display *, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -708,6 +708,19 @@ struct __DRIdri2LoaderExtensionRec {
|
||||
int *out_count, void *loaderPrivate);
|
||||
};
|
||||
|
||||
#define __DRI_COPY_BUFFER "DRI_CopyBuffer"
|
||||
#define __DRI_COPY_BUFFER_VERSION 1
|
||||
typedef struct __DRIcopyBufferExtensionRec __DRIcopyBufferExtension;
|
||||
struct __DRIcopyBufferExtensionRec {
|
||||
__DRIextension base;
|
||||
|
||||
int (*copyBuffer)(__DRIcontext *context,
|
||||
__DRIbuffer *dst, int dst_x, int dst_y,
|
||||
__DRIdrawable *src, unsigned int src_attachment,
|
||||
int x, int y, int width, int height);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This extension provides alternative screen, drawable and context
|
||||
* constructors for DRI2.
|
||||
|
@@ -48,9 +48,9 @@ extern "C" {
|
||||
/*************************************************************/
|
||||
|
||||
/* Header file version number */
|
||||
/* wglext.h last updated 2009/09/16 */
|
||||
/* wglext.h last updated 2009/08/03 */
|
||||
/* Current version at http://www.opengl.org/registry/ */
|
||||
#define WGL_WGLEXT_VERSION 17
|
||||
#define WGL_WGLEXT_VERSION 15
|
||||
|
||||
#ifndef WGL_ARB_buffer_region
|
||||
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
|
||||
@@ -388,14 +388,6 @@ extern "C" {
|
||||
#define WGL_GPU_NUM_SPI_AMD 0x21A8
|
||||
#endif
|
||||
|
||||
#ifndef NV_video_capture
|
||||
#define WGL_UNIQUE_ID_NV 0x20CE
|
||||
#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
|
||||
#endif
|
||||
|
||||
#ifndef NV_copy_image
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
@@ -408,7 +400,7 @@ DECLARE_HANDLE(HPBUFFEREXT);
|
||||
#ifndef WGL_NV_present_video
|
||||
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
|
||||
#endif
|
||||
#ifndef WGL_NV_video_output
|
||||
#ifndef WGL_NV_video_out
|
||||
DECLARE_HANDLE(HPVIDEODEV);
|
||||
#endif
|
||||
#ifndef WGL_NV_gpu_affinity
|
||||
@@ -423,9 +415,6 @@ typedef struct _GPU_DEVICE {
|
||||
RECT rcVirtualScreen;
|
||||
} GPU_DEVICE, *PGPU_DEVICE;
|
||||
#endif
|
||||
#ifndef WGL_NV_video_capture
|
||||
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_buffer_region
|
||||
#define WGL_ARB_buffer_region 1
|
||||
@@ -761,8 +750,8 @@ typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVide
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_video_output
|
||||
#define WGL_NV_video_output 1
|
||||
#ifndef WGL_NV_video_out
|
||||
#define WGL_NV_video_out 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglGetVideoDeviceNV (HDC, int, HPVIDEODEV *);
|
||||
extern BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV);
|
||||
@@ -837,30 +826,6 @@ typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
|
||||
typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_video_capture
|
||||
#define WGL_NV_video_capture 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT, HVIDEOINPUTDEVICENV);
|
||||
extern UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC, HVIDEOINPUTDEVICENV *);
|
||||
extern BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC, HVIDEOINPUTDEVICENV);
|
||||
extern BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC, HVIDEOINPUTDEVICENV, int, int *);
|
||||
extern BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC, HVIDEOINPUTDEVICENV);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
|
||||
typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
|
||||
typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
|
||||
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_NV_copy_image
|
||||
#define WGL_NV_copy_image 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglCopyImageSubDataNV (HGLRC, GLuint, GLenum, GLint, GLint, GLint, GLint, HGLRC, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
1
progs/.gitignore
vendored
1
progs/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
*.dSYM
|
@@ -15,7 +15,7 @@ message:
|
||||
|
||||
|
||||
subdirs:
|
||||
@list='$(SUBDIRS)'; for dir in $$list ; do \
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
if [ -d $$dir ] ; then \
|
||||
(cd $$dir && $(MAKE)) || exit 1 ; \
|
||||
fi \
|
||||
@@ -25,7 +25,7 @@ subdirs:
|
||||
install:
|
||||
|
||||
clean:
|
||||
@list='$(SUBDIRS)'; for dir in $$list tests ; do \
|
||||
-@for dir in $(SUBDIRS) tests ; do \
|
||||
if [ -d $$dir ] ; then \
|
||||
(cd $$dir && $(MAKE) clean) ; \
|
||||
fi \
|
||||
|
@@ -26,6 +26,7 @@ static int Scissor = 0;
|
||||
static float Xzoom, Yzoom;
|
||||
static GLboolean DrawFront = GL_FALSE;
|
||||
static GLboolean Dither = GL_TRUE;
|
||||
static GLboolean Invert = GL_FALSE;
|
||||
|
||||
|
||||
static void Reset( void )
|
||||
@@ -59,6 +60,15 @@ static void Display( void )
|
||||
if (Scissor)
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
if (Invert) {
|
||||
glPixelTransferf(GL_RED_SCALE, -1.0);
|
||||
glPixelTransferf(GL_GREEN_SCALE, -1.0);
|
||||
glPixelTransferf(GL_BLUE_SCALE, -1.0);
|
||||
glPixelTransferf(GL_RED_BIAS, 1.0);
|
||||
glPixelTransferf(GL_GREEN_BIAS, 1.0);
|
||||
glPixelTransferf(GL_BLUE_BIAS, 1.0);
|
||||
}
|
||||
|
||||
/* draw copy */
|
||||
glPixelZoom(Xzoom, Yzoom);
|
||||
glWindowPos2iARB(Xpos, Ypos);
|
||||
@@ -67,6 +77,15 @@ static void Display( void )
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
if (Invert) {
|
||||
glPixelTransferf(GL_RED_SCALE, 1.0);
|
||||
glPixelTransferf(GL_GREEN_SCALE, 1.0);
|
||||
glPixelTransferf(GL_BLUE_SCALE, 1.0);
|
||||
glPixelTransferf(GL_RED_BIAS, 0.0);
|
||||
glPixelTransferf(GL_GREEN_BIAS, 0.0);
|
||||
glPixelTransferf(GL_BLUE_BIAS, 0.0);
|
||||
}
|
||||
|
||||
if (DrawFront)
|
||||
glFinish();
|
||||
else
|
||||
@@ -105,6 +124,9 @@ static void Key( unsigned char key, int x, int y )
|
||||
else
|
||||
glDisable(GL_DITHER);
|
||||
break;
|
||||
case 'i':
|
||||
Invert = !Invert;
|
||||
break;
|
||||
case 's':
|
||||
Scissor = !Scissor;
|
||||
break;
|
||||
|
@@ -15,6 +15,8 @@
|
||||
|
||||
#define DEPTH 5.0f
|
||||
|
||||
static PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointer_ext;
|
||||
|
||||
static GLfloat camz;
|
||||
|
||||
static GLint fogMode;
|
||||
|
@@ -353,7 +353,6 @@ MakeSphere(void)
|
||||
glNewList(SphereList, GL_COMPILE);
|
||||
gluSphere(obj, 2.0f, 10, 5);
|
||||
glEndList();
|
||||
gluDeleteQuadric(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -133,8 +133,6 @@ initdlists(void)
|
||||
|
||||
glEndList();
|
||||
}
|
||||
|
||||
gluDeleteQuadric(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -245,10 +245,6 @@ loadImageTextures(void)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);
|
||||
|
||||
free(texData3);
|
||||
free(texData4);
|
||||
free(image);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -834,8 +834,6 @@ initdlists(void)
|
||||
gluQuadricTexture(obj, GL_TRUE);
|
||||
gluSphere(obj, SPHERE_RADIUS, 16, 16);
|
||||
glEndList();
|
||||
|
||||
gluDeleteQuadric(obj);
|
||||
}
|
||||
|
||||
int
|
||||
|
77
progs/es1/xegl/Makefile
Normal file
77
progs/es1/xegl/Makefile
Normal file
@@ -0,0 +1,77 @@
|
||||
# progs/es1/xegl/Makefile
|
||||
|
||||
TOP = ../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
|
||||
INCLUDE_DIRS = \
|
||||
-I$(TOP)/include \
|
||||
|
||||
HEADERS = $(TOP)/include/GLES/egl.h
|
||||
|
||||
|
||||
ES1_LIB_DEPS = \
|
||||
$(TOP)/$(LIB_DIR)/libEGL.so \
|
||||
$(TOP)/$(LIB_DIR)/libGLESv1_CM.so
|
||||
|
||||
|
||||
ES1_LIBS = \
|
||||
-L$(TOP)/$(LIB_DIR) -lEGL \
|
||||
-L$(TOP)/$(LIB_DIR) -lGLESv1_CM $(LIBDRM_LIB) -lX11
|
||||
|
||||
PROGRAMS = \
|
||||
drawtex \
|
||||
es1_info \
|
||||
msaa \
|
||||
pbuffer \
|
||||
render_tex \
|
||||
torus \
|
||||
tri \
|
||||
two_win
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
|
||||
|
||||
|
||||
|
||||
default: $(PROGRAMS)
|
||||
|
||||
|
||||
|
||||
drawtex: drawtex.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) drawtex.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
es1_info: es1_info.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) es1_info.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
msaa: msaa.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) msaa.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
pbuffer: pbuffer.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) pbuffer.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
render_tex: render_tex.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) render_tex.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
torus: torus.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) torus.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
two_win: two_win.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) two_win.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
tri: tri.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) tri.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o *~
|
||||
rm -f $(PROGRAMS)
|
||||
|
427
progs/es1/xegl/drawtex.c
Normal file
427
progs/es1/xegl/drawtex.c
Normal file
@@ -0,0 +1,427 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test GL_OES_draw_texture
|
||||
* Brian Paul
|
||||
* August 2008
|
||||
*/
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
|
||||
|
||||
static GLfloat view_posx = 10.0, view_posy = 20.0;
|
||||
static GLfloat width = 200, height = 200;
|
||||
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glDrawTexfOES(view_posx, view_posy, 0.0, width, height);
|
||||
}
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
GLfloat ar = (GLfloat) width / (GLfloat) height;
|
||||
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
#ifdef GL_VERSION_ES_CM_1_0
|
||||
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
#else
|
||||
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
#endif
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -15.0);
|
||||
}
|
||||
|
||||
|
||||
static float
|
||||
dist(GLuint i, GLuint j, float x, float y)
|
||||
{
|
||||
return sqrt((i-x) * (i-x) + (j-y) * (j-y));
|
||||
}
|
||||
|
||||
static void
|
||||
make_smile_texture(void)
|
||||
{
|
||||
#define SZ 128
|
||||
GLenum Filter = GL_LINEAR;
|
||||
GLubyte image[SZ][SZ][4];
|
||||
GLuint i, j;
|
||||
GLint cropRect[4];
|
||||
|
||||
for (i = 0; i < SZ; i++) {
|
||||
for (j = 0; j < SZ; j++) {
|
||||
GLfloat d_mouth = dist(i, j, SZ/2, SZ/2);
|
||||
GLfloat d_rt_eye = dist(i, j, SZ*3/4, SZ*3/4);
|
||||
GLfloat d_lt_eye = dist(i, j, SZ*3/4, SZ*1/4);
|
||||
if (d_rt_eye < SZ / 8 || d_lt_eye < SZ / 8) {
|
||||
image[i][j][0] = 20;
|
||||
image[i][j][1] = 50;
|
||||
image[i][j][2] = 255;
|
||||
image[i][j][3] = 255;
|
||||
}
|
||||
else if (i < SZ/2 && d_mouth < SZ/3) {
|
||||
image[i][j][0] = 255;
|
||||
image[i][j][1] = 20;
|
||||
image[i][j][2] = 20;
|
||||
image[i][j][3] = 255;
|
||||
}
|
||||
else {
|
||||
image[i][j][0] = 200;
|
||||
image[i][j][1] = 200;
|
||||
image[i][j][2] = 200;
|
||||
image[i][j][3] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE0); /* unit 0 */
|
||||
glBindTexture(GL_TEXTURE_2D, 42);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ, SZ, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, image);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
|
||||
cropRect[0] = 0;
|
||||
cropRect[1] = 0;
|
||||
cropRect[2] = SZ;
|
||||
cropRect[3] = SZ;
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect);
|
||||
#undef SZ
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
const char *ext = (char *) glGetString(GL_EXTENSIONS);
|
||||
|
||||
if (!strstr(ext, "GL_OES_draw_texture")) {
|
||||
fprintf(stderr, "Sorry, this program requires GL_OES_draw_texture");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glClearColor(0.4, 0.4, 0.4, 0.0);
|
||||
|
||||
make_smile_texture();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create an RGB, double-buffered X window.
|
||||
* Return the window and context handles.
|
||||
*/
|
||||
static void
|
||||
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
|
||||
const char *name,
|
||||
int x, int y, int width, int height,
|
||||
Window *winRet,
|
||||
EGLContext *ctxRet,
|
||||
EGLSurface *surfRet)
|
||||
{
|
||||
static const EGLint attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
Window win;
|
||||
XVisualInfo *visInfo, visTemplate;
|
||||
int num_visuals;
|
||||
EGLContext ctx;
|
||||
EGLConfig config;
|
||||
EGLint num_configs;
|
||||
EGLint vid;
|
||||
|
||||
scrnum = DefaultScreen( x_dpy );
|
||||
root = RootWindow( x_dpy, scrnum );
|
||||
|
||||
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL visual config\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
assert(config);
|
||||
assert(num_configs > 0);
|
||||
|
||||
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
||||
printf("Error: eglGetConfigAttrib() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!visInfo) {
|
||||
printf("Error: couldn't get X visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
|
||||
0, visInfo->depth, InputOutput,
|
||||
visInfo->visual, mask, &attr );
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(x_dpy, win, &sizehints);
|
||||
XSetStandardProperties(x_dpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
|
||||
if (!ctx) {
|
||||
printf("Error: eglCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
|
||||
|
||||
if (!*surfRet) {
|
||||
printf("Error: eglCreateWindowSurface failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
XFree(visInfo);
|
||||
|
||||
*winRet = win;
|
||||
*ctxRet = ctx;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
event_loop(Display *dpy, Window win,
|
||||
EGLDisplay egl_dpy, EGLSurface egl_surf)
|
||||
{
|
||||
int anim = 0;
|
||||
|
||||
while (1) {
|
||||
int redraw = 0;
|
||||
|
||||
if (!anim || XPending(dpy)) {
|
||||
XEvent event;
|
||||
XNextEvent(dpy, &event);
|
||||
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
redraw = 1;
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
reshape(event.xconfigure.width, event.xconfigure.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_posx -= 1.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_posx += 1.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_posy += 1.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_posy -= 1.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == ' ') {
|
||||
anim = !anim;
|
||||
}
|
||||
else if (buffer[0] == 'w') {
|
||||
width -= 1.0f;
|
||||
}
|
||||
else if (buffer[0] == 'W') {
|
||||
width += 1.0f;
|
||||
}
|
||||
else if (buffer[0] == 'h') {
|
||||
height -= 1.0f;
|
||||
}
|
||||
else if (buffer[0] == 'H') {
|
||||
height += 1.0f;
|
||||
}
|
||||
else if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
redraw = 1;
|
||||
break;
|
||||
default:
|
||||
; /*no-op*/
|
||||
}
|
||||
}
|
||||
|
||||
if (anim) {
|
||||
view_posx += 1.0;
|
||||
view_posy += 2.0;
|
||||
redraw = 1;
|
||||
}
|
||||
|
||||
if (redraw) {
|
||||
draw();
|
||||
eglSwapBuffers(egl_dpy, egl_surf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" -display <displayname> set the display to run on\n");
|
||||
printf(" -info display OpenGL renderer info\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const int winWidth = 400, winHeight = 300;
|
||||
Display *x_dpy;
|
||||
Window win;
|
||||
EGLSurface egl_surf;
|
||||
EGLContext egl_ctx;
|
||||
EGLDisplay egl_dpy;
|
||||
char *dpyName = NULL;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
EGLint egl_major, egl_minor;
|
||||
int i;
|
||||
const char *s;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-display") == 0) {
|
||||
dpyName = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-info") == 0) {
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
x_dpy = XOpenDisplay(dpyName);
|
||||
if (!x_dpy) {
|
||||
printf("Error: couldn't open display %s\n",
|
||||
dpyName ? dpyName : getenv("DISPLAY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
egl_dpy = eglGetDisplay(x_dpy);
|
||||
if (!egl_dpy) {
|
||||
printf("Error: eglGetDisplay() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
|
||||
printf("Error: eglInitialize() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VERSION);
|
||||
printf("EGL_VERSION = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VENDOR);
|
||||
printf("EGL_VENDOR = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
|
||||
printf("EGL_EXTENSIONS = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
|
||||
printf("EGL_CLIENT_APIS = %s\n", s);
|
||||
|
||||
make_x_window(x_dpy, egl_dpy,
|
||||
"drawtex", 0, 0, winWidth, winHeight,
|
||||
&win, &egl_ctx, &egl_surf);
|
||||
|
||||
XMapWindow(x_dpy, win);
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (printInfo) {
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
/* Set initial projection/viewing transformation.
|
||||
* We can't be sure we'll get a ConfigureNotify event when the window
|
||||
* first appears.
|
||||
*/
|
||||
reshape(winWidth, winHeight);
|
||||
|
||||
event_loop(x_dpy, win, egl_dpy, egl_surf);
|
||||
|
||||
eglDestroyContext(egl_dpy, egl_ctx);
|
||||
eglDestroySurface(egl_dpy, egl_surf);
|
||||
eglTerminate(egl_dpy);
|
||||
|
||||
|
||||
XDestroyWindow(x_dpy, win);
|
||||
XCloseDisplay(x_dpy);
|
||||
|
||||
return 0;
|
||||
}
|
274
progs/es1/xegl/es1_info.c
Normal file
274
progs/es1/xegl/es1_info.c
Normal file
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* List OpenGL ES extensions.
|
||||
* Print ES 1 or ES 2 extensions depending on which library we're
|
||||
* linked with: libGLESv1_CM.so vs libGLESv2.so
|
||||
*/
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
|
||||
/*
|
||||
* Print a list of extensions, with word-wrapping.
|
||||
*/
|
||||
static void
|
||||
print_extension_list(const char *ext)
|
||||
{
|
||||
const char *indentString = " ";
|
||||
const int indent = 4;
|
||||
const int max = 79;
|
||||
int width, i, j;
|
||||
|
||||
if (!ext || !ext[0])
|
||||
return;
|
||||
|
||||
width = indent;
|
||||
printf(indentString);
|
||||
i = j = 0;
|
||||
while (1) {
|
||||
if (ext[j] == ' ' || ext[j] == 0) {
|
||||
/* found end of an extension name */
|
||||
const int len = j - i;
|
||||
if (width + len > max) {
|
||||
/* start a new line */
|
||||
printf("\n");
|
||||
width = indent;
|
||||
printf(indentString);
|
||||
}
|
||||
/* print the extension name between ext[i] and ext[j] */
|
||||
while (i < j) {
|
||||
printf("%c", ext[i]);
|
||||
i++;
|
||||
}
|
||||
/* either we're all done, or we'll continue with next extension */
|
||||
width += len + 1;
|
||||
if (ext[j] == 0) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
j++;
|
||||
if (ext[j] == 0)
|
||||
break;
|
||||
printf(", ");
|
||||
width += 2;
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
info(EGLDisplay egl_dpy)
|
||||
{
|
||||
const char *s;
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VERSION);
|
||||
printf("EGL_VERSION = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VENDOR);
|
||||
printf("EGL_VENDOR = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
|
||||
printf("EGL_EXTENSIONS = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
|
||||
printf("EGL_CLIENT_APIS = %s\n", s);
|
||||
|
||||
printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_EXTENSIONS:\n");
|
||||
print_extension_list((char *) glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create an RGB, double-buffered X window.
|
||||
* Return the window and context handles.
|
||||
*/
|
||||
static void
|
||||
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
|
||||
const char *name,
|
||||
int x, int y, int width, int height,
|
||||
Window *winRet,
|
||||
EGLContext *ctxRet,
|
||||
EGLSurface *surfRet)
|
||||
{
|
||||
static const EGLint attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
Window win;
|
||||
XVisualInfo *visInfo, visTemplate;
|
||||
int num_visuals;
|
||||
EGLContext ctx;
|
||||
EGLConfig config;
|
||||
EGLint num_configs;
|
||||
EGLint vid;
|
||||
|
||||
scrnum = DefaultScreen( x_dpy );
|
||||
root = RootWindow( x_dpy, scrnum );
|
||||
|
||||
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL visual config\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
assert(config);
|
||||
assert(num_configs > 0);
|
||||
|
||||
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
||||
printf("Error: eglGetConfigAttrib() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!visInfo) {
|
||||
printf("Error: couldn't get X visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
|
||||
0, visInfo->depth, InputOutput,
|
||||
visInfo->visual, mask, &attr );
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(x_dpy, win, &sizehints);
|
||||
XSetStandardProperties(x_dpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
|
||||
if (!ctx) {
|
||||
printf("Error: eglCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
|
||||
|
||||
if (!*surfRet) {
|
||||
printf("Error: eglCreateWindowSurface failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
XFree(visInfo);
|
||||
|
||||
*winRet = win;
|
||||
*ctxRet = ctx;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" -display <displayname> set the display to run on\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const int winWidth = 400, winHeight = 300;
|
||||
Display *x_dpy;
|
||||
Window win;
|
||||
EGLSurface egl_surf;
|
||||
EGLContext egl_ctx;
|
||||
EGLDisplay egl_dpy;
|
||||
char *dpyName = NULL;
|
||||
EGLint egl_major, egl_minor;
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-display") == 0) {
|
||||
dpyName = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
x_dpy = XOpenDisplay(dpyName);
|
||||
if (!x_dpy) {
|
||||
printf("Error: couldn't open display %s\n",
|
||||
dpyName ? dpyName : getenv("DISPLAY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
egl_dpy = eglGetDisplay(x_dpy);
|
||||
if (!egl_dpy) {
|
||||
printf("Error: eglGetDisplay() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
|
||||
printf("Error: eglInitialize() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
make_x_window(x_dpy, egl_dpy,
|
||||
"ES info", 0, 0, winWidth, winHeight,
|
||||
&win, &egl_ctx, &egl_surf);
|
||||
|
||||
/*XMapWindow(x_dpy, win);*/
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
info(egl_dpy);
|
||||
|
||||
eglDestroyContext(egl_dpy, egl_ctx);
|
||||
eglDestroySurface(egl_dpy, egl_surf);
|
||||
eglTerminate(egl_dpy);
|
||||
|
||||
|
||||
XDestroyWindow(x_dpy, win);
|
||||
XCloseDisplay(x_dpy);
|
||||
|
||||
return 0;
|
||||
}
|
442
progs/es1/xegl/msaa.c
Normal file
442
progs/es1/xegl/msaa.c
Normal file
@@ -0,0 +1,442 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test MSAA with X/EGL and OpenGL ES 1.x
|
||||
* Brian Paul
|
||||
* 15 September 2008
|
||||
*/
|
||||
|
||||
#define USE_FULL_GL 0
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#if USE_FULL_GL
|
||||
#include <GL/gl.h> /* use full OpenGL */
|
||||
#else
|
||||
#include <GLES/gl.h> /* use OpenGL ES 1.x */
|
||||
#include <GLES/glext.h>
|
||||
#endif
|
||||
#include <EGL/egl.h>
|
||||
|
||||
|
||||
|
||||
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
|
||||
static GLboolean AA = 0*GL_TRUE;
|
||||
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
float a;
|
||||
|
||||
static const GLfloat verts[4][2] = {
|
||||
{ -1, -.1 },
|
||||
{ 1, -.1 },
|
||||
{ -1, .1 },
|
||||
{ 1, .1 }
|
||||
};
|
||||
static const GLfloat colors[4][4] = {
|
||||
{ 1, 0, 0, 1 },
|
||||
{ 0, 1, 0, 1 },
|
||||
{ 0, 0, 1, 1 },
|
||||
{ 1, 0, 1, 1 }
|
||||
};
|
||||
|
||||
if (AA) {
|
||||
printf("MSAA enabled\n");
|
||||
glEnable(GL_MULTISAMPLE);
|
||||
}
|
||||
else {
|
||||
printf("MSAA disabled\n");
|
||||
glDisable(GL_MULTISAMPLE);
|
||||
}
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(view_rotx, 1, 0, 0);
|
||||
glRotatef(view_roty, 0, 1, 0);
|
||||
glRotatef(view_rotz, 0, 0, 1);
|
||||
|
||||
{
|
||||
glVertexPointer(2, GL_FLOAT, 0, verts);
|
||||
glColorPointer(4, GL_FLOAT, 0, colors);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
for (a = 0; a < 360; a += 20.0) {
|
||||
glPushMatrix();
|
||||
|
||||
glRotatef(a, 0, 0, 1);
|
||||
glTranslatef(1.5, 0, 0);
|
||||
|
||||
/* draw triangle */
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
GLfloat ary = 3.0;
|
||||
GLfloat arx = ary * (GLfloat) width / (GLfloat) height;
|
||||
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
#ifdef GL_VERSION_ES_CM_1_0
|
||||
glOrthof(-arx, arx, -ary, ary, -1.0, 1.0);
|
||||
#else
|
||||
glOrtho(-arx, arx, -ary, ary, -1.0, 1.0);
|
||||
#endif
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
printf("Press 'a' to toggle multisample antialiasing\n");
|
||||
printf("Press 'Esc' to exit\n");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create an RGB, double-buffered X window.
|
||||
* Return the window and context handles.
|
||||
*/
|
||||
static void
|
||||
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
|
||||
const char *name,
|
||||
int x, int y, int width, int height,
|
||||
Window *winRet,
|
||||
EGLContext *ctxRet,
|
||||
EGLSurface *surfRet)
|
||||
{
|
||||
static const EGLint attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_DEPTH_SIZE, 1,
|
||||
EGL_SAMPLES, 1,
|
||||
EGL_SAMPLE_BUFFERS, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
Window win;
|
||||
XVisualInfo *visInfo, visTemplate;
|
||||
int num_visuals;
|
||||
EGLContext ctx;
|
||||
EGLConfig config;
|
||||
EGLint num_configs;
|
||||
EGLint vid;
|
||||
|
||||
scrnum = DefaultScreen( x_dpy );
|
||||
root = RootWindow( x_dpy, scrnum );
|
||||
|
||||
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL visual config\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (num_configs < 1) {
|
||||
printf("Error: Unable to find multisample pixel format.\n");
|
||||
printf("Try running glxinfo to see if your server supports MSAA.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
||||
printf("Error: eglGetConfigAttrib() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!visInfo) {
|
||||
printf("Error: couldn't get X visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
|
||||
0, visInfo->depth, InputOutput,
|
||||
visInfo->visual, mask, &attr );
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(x_dpy, win, &sizehints);
|
||||
XSetStandardProperties(x_dpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
#if USE_FULL_GL
|
||||
eglBindAPI(EGL_OPENGL_API);
|
||||
#else
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
#endif
|
||||
|
||||
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
|
||||
if (!ctx) {
|
||||
printf("Error: eglCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
|
||||
|
||||
if (!*surfRet) {
|
||||
printf("Error: eglCreateWindowSurface failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
XFree(visInfo);
|
||||
|
||||
*winRet = win;
|
||||
*ctxRet = ctx;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
event_loop(Display *dpy, Window win,
|
||||
EGLDisplay egl_dpy, EGLSurface egl_surf)
|
||||
{
|
||||
while (1) {
|
||||
int redraw = 0;
|
||||
XEvent event;
|
||||
|
||||
XNextEvent(dpy, &event);
|
||||
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
redraw = 1;
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
reshape(event.xconfigure.width, event.xconfigure.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == 'a') {
|
||||
AA = !AA;
|
||||
redraw = 1;
|
||||
}
|
||||
else if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
redraw = 1;
|
||||
break;
|
||||
default:
|
||||
; /*no-op*/
|
||||
}
|
||||
|
||||
if (redraw) {
|
||||
draw();
|
||||
eglSwapBuffers(egl_dpy, egl_surf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" -display <displayname> set the display to run on\n");
|
||||
printf(" -info display OpenGL renderer info\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const int winWidth = 600, winHeight = 600;
|
||||
Display *x_dpy;
|
||||
Window win;
|
||||
EGLSurface egl_surf;
|
||||
EGLContext egl_ctx;
|
||||
EGLDisplay egl_dpy;
|
||||
char *dpyName = NULL;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
EGLint egl_major, egl_minor;
|
||||
int i;
|
||||
const char *s;
|
||||
|
||||
static struct {
|
||||
char *name;
|
||||
GLenum value;
|
||||
enum {GetString, GetInteger} type;
|
||||
} info_items[] = {
|
||||
{"GL_RENDERER", GL_RENDERER, GetString},
|
||||
{"GL_VERSION", GL_VERSION, GetString},
|
||||
{"GL_VENDOR", GL_VENDOR, GetString},
|
||||
{"GL_EXTENSIONS", GL_EXTENSIONS, GetString},
|
||||
{"GL_MAX_PALETTE_MATRICES_OES", GL_MAX_PALETTE_MATRICES_OES, GetInteger},
|
||||
{"GL_MAX_VERTEX_UNITS_OES", GL_MAX_VERTEX_UNITS_OES, GetInteger},
|
||||
};
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-display") == 0) {
|
||||
dpyName = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-info") == 0) {
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
x_dpy = XOpenDisplay(dpyName);
|
||||
if (!x_dpy) {
|
||||
printf("Error: couldn't open display %s\n",
|
||||
dpyName ? dpyName : getenv("DISPLAY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
egl_dpy = eglGetDisplay(x_dpy);
|
||||
if (!egl_dpy) {
|
||||
printf("Error: eglGetDisplay() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
|
||||
printf("Error: eglInitialize() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VERSION);
|
||||
printf("EGL_VERSION = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VENDOR);
|
||||
printf("EGL_VENDOR = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
|
||||
printf("EGL_EXTENSIONS = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
|
||||
printf("EGL_CLIENT_APIS = %s\n", s);
|
||||
|
||||
make_x_window(x_dpy, egl_dpy,
|
||||
"msaa", 0, 0, winWidth, winHeight,
|
||||
&win, &egl_ctx, &egl_surf);
|
||||
|
||||
XMapWindow(x_dpy, win);
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (printInfo) {
|
||||
for (i = 0; i < sizeof(info_items)/sizeof(info_items[0]); i++) {
|
||||
switch (info_items[i].type) {
|
||||
case GetString:
|
||||
printf("%s = %s\n", info_items[i].name, (char *)glGetString(info_items[i].value));
|
||||
break;
|
||||
case GetInteger: {
|
||||
GLint rv = -1;
|
||||
glGetIntegerv(info_items[i].value, &rv);
|
||||
printf("%s = %d\n", info_items[i].name, rv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
init();
|
||||
|
||||
/* Set initial projection/viewing transformation.
|
||||
* We can't be sure we'll get a ConfigureNotify event when the window
|
||||
* first appears.
|
||||
*/
|
||||
reshape(winWidth, winHeight);
|
||||
|
||||
event_loop(x_dpy, win, egl_dpy, egl_surf);
|
||||
|
||||
eglDestroyContext(egl_dpy, egl_ctx);
|
||||
eglDestroySurface(egl_dpy, egl_surf);
|
||||
eglTerminate(egl_dpy);
|
||||
|
||||
|
||||
XDestroyWindow(x_dpy, win);
|
||||
XCloseDisplay(x_dpy);
|
||||
|
||||
return 0;
|
||||
}
|
607
progs/es1/xegl/pbuffer.c
Normal file
607
progs/es1/xegl/pbuffer.c
Normal file
@@ -0,0 +1,607 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test EGL Pbuffers
|
||||
* Brian Paul
|
||||
* August 2008
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
|
||||
|
||||
static int WinWidth = 300, WinHeight = 300;
|
||||
|
||||
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
|
||||
|
||||
|
||||
static void
|
||||
Normal(GLfloat *n, GLfloat nx, GLfloat ny, GLfloat nz)
|
||||
{
|
||||
n[0] = nx;
|
||||
n[1] = ny;
|
||||
n[2] = nz;
|
||||
}
|
||||
|
||||
static void
|
||||
Vertex(GLfloat *v, GLfloat vx, GLfloat vy, GLfloat vz)
|
||||
{
|
||||
v[0] = vx;
|
||||
v[1] = vy;
|
||||
v[2] = vz;
|
||||
}
|
||||
|
||||
static void
|
||||
Texcoord(GLfloat *v, GLfloat s, GLfloat t)
|
||||
{
|
||||
v[0] = s;
|
||||
v[1] = t;
|
||||
}
|
||||
|
||||
|
||||
/* Borrowed from glut, adapted */
|
||||
static void
|
||||
draw_torus(GLfloat r, GLfloat R, GLint nsides, GLint rings)
|
||||
{
|
||||
int i, j;
|
||||
GLfloat theta, phi, theta1;
|
||||
GLfloat cosTheta, sinTheta;
|
||||
GLfloat cosTheta1, sinTheta1;
|
||||
GLfloat ringDelta, sideDelta;
|
||||
GLfloat varray[100][3], narray[100][3], tarray[100][2];
|
||||
int vcount;
|
||||
|
||||
glVertexPointer(3, GL_FLOAT, 0, varray);
|
||||
glNormalPointer(GL_FLOAT, 0, narray);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, tarray);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
ringDelta = 2.0 * M_PI / rings;
|
||||
sideDelta = 2.0 * M_PI / nsides;
|
||||
|
||||
theta = 0.0;
|
||||
cosTheta = 1.0;
|
||||
sinTheta = 0.0;
|
||||
for (i = rings - 1; i >= 0; i--) {
|
||||
theta1 = theta + ringDelta;
|
||||
cosTheta1 = cos(theta1);
|
||||
sinTheta1 = sin(theta1);
|
||||
|
||||
vcount = 0; /* glBegin(GL_QUAD_STRIP); */
|
||||
|
||||
phi = 0.0;
|
||||
for (j = nsides; j >= 0; j--) {
|
||||
GLfloat s0, s1, t;
|
||||
GLfloat cosPhi, sinPhi, dist;
|
||||
|
||||
phi += sideDelta;
|
||||
cosPhi = cos(phi);
|
||||
sinPhi = sin(phi);
|
||||
dist = R + r * cosPhi;
|
||||
|
||||
s0 = 20.0 * theta / (2.0 * M_PI);
|
||||
s1 = 20.0 * theta1 / (2.0 * M_PI);
|
||||
t = 8.0 * phi / (2.0 * M_PI);
|
||||
|
||||
Normal(narray[vcount], cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
|
||||
Texcoord(tarray[vcount], s1, t);
|
||||
Vertex(varray[vcount], cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
|
||||
vcount++;
|
||||
|
||||
Normal(narray[vcount], cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
|
||||
Texcoord(tarray[vcount], s0, t);
|
||||
Vertex(varray[vcount], cosTheta * dist, -sinTheta * dist, r * sinPhi);
|
||||
vcount++;
|
||||
}
|
||||
|
||||
/*glEnd();*/
|
||||
assert(vcount <= 100);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, vcount);
|
||||
|
||||
theta = theta1;
|
||||
cosTheta = cosTheta1;
|
||||
sinTheta = sinTheta1;
|
||||
}
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(view_rotx, 1, 0, 0);
|
||||
glRotatef(view_roty, 0, 1, 0);
|
||||
glRotatef(view_rotz, 0, 0, 1);
|
||||
glScalef(0.5, 0.5, 0.5);
|
||||
|
||||
draw_torus(1.0, 3.0, 30, 60);
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glFinish();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draw to both the window and pbuffer and compare results.
|
||||
*/
|
||||
static void
|
||||
draw_both(EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
|
||||
EGLContext egl_ctx)
|
||||
{
|
||||
unsigned *wbuf, *pbuf;
|
||||
int x = 100, y = 110;
|
||||
int i, dif;
|
||||
|
||||
wbuf = (unsigned *) malloc(WinWidth * WinHeight * 4);
|
||||
pbuf = (unsigned *) malloc(WinWidth * WinHeight * 4);
|
||||
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
|
||||
/* first draw to window */
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent(window) failed\n");
|
||||
return;
|
||||
}
|
||||
draw();
|
||||
glReadPixels(0, 0, WinWidth, WinHeight, GL_RGBA, GL_UNSIGNED_BYTE, wbuf);
|
||||
printf("Window[%d,%d] = 0x%08x\n", x, y, wbuf[y*WinWidth+x]);
|
||||
|
||||
/* then draw to pbuffer */
|
||||
if (!eglMakeCurrent(egl_dpy, egl_pbuf, egl_pbuf, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent(pbuffer) failed\n");
|
||||
return;
|
||||
}
|
||||
draw();
|
||||
glReadPixels(0, 0, WinWidth, WinHeight, GL_RGBA, GL_UNSIGNED_BYTE, pbuf);
|
||||
printf("Pbuffer[%d,%d] = 0x%08x\n", x, y, pbuf[y*WinWidth+x]);
|
||||
|
||||
eglSwapBuffers(egl_dpy, egl_surf);
|
||||
|
||||
/* compare renderings */
|
||||
for (dif = i = 0; i < WinWidth * WinHeight; i++) {
|
||||
if (wbuf[i] != pbuf[i]) {
|
||||
dif = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dif)
|
||||
printf("Difference at %d: 0x%08x vs. 0x%08x\n", i, wbuf[i], pbuf[i]);
|
||||
else
|
||||
printf("Window rendering matches Pbuffer rendering!\n");
|
||||
|
||||
free(wbuf);
|
||||
free(pbuf);
|
||||
}
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
GLfloat ar = (GLfloat) width / (GLfloat) height;
|
||||
|
||||
WinWidth = width;
|
||||
WinHeight = height;
|
||||
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
#ifdef GL_VERSION_ES_CM_1_0
|
||||
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
#else
|
||||
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
#endif
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -15.0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
make_texture(void)
|
||||
{
|
||||
#define SZ 64
|
||||
GLenum Filter = GL_LINEAR;
|
||||
GLubyte image[SZ][SZ][4];
|
||||
GLuint i, j;
|
||||
|
||||
for (i = 0; i < SZ; i++) {
|
||||
for (j = 0; j < SZ; j++) {
|
||||
GLfloat d = (i - SZ/2) * (i - SZ/2) + (j - SZ/2) * (j - SZ/2);
|
||||
d = sqrt(d);
|
||||
if (d < SZ/3) {
|
||||
image[i][j][0] = 255;
|
||||
image[i][j][1] = 255;
|
||||
image[i][j][2] = 255;
|
||||
image[i][j][3] = 255;
|
||||
}
|
||||
else {
|
||||
image[i][j][0] = 127;
|
||||
image[i][j][1] = 127;
|
||||
image[i][j][2] = 127;
|
||||
image[i][j][3] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE0); /* unit 0 */
|
||||
glBindTexture(GL_TEXTURE_2D, 42);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ, SZ, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, image);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
#undef SZ
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
static const GLfloat red[4] = {1, 0, 0, 0};
|
||||
static const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
|
||||
static const GLfloat diffuse[4] = {0.7, 0.7, 0.7, 1.0};
|
||||
static const GLfloat specular[4] = {0.001, 0.001, 0.001, 1.0};
|
||||
static const GLfloat pos[4] = {20, 20, 50, 1};
|
||||
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red);
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white);
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 9.0);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
glLightfv(GL_LIGHT0, GL_POSITION, pos);
|
||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
|
||||
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
|
||||
|
||||
glClearColor(0.4, 0.4, 0.4, 0.0);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
make_texture();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create an RGB, double-buffered X window.
|
||||
* Return the window and context handles.
|
||||
*/
|
||||
static void
|
||||
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
|
||||
const char *name,
|
||||
int x, int y, int width, int height,
|
||||
Window *winRet,
|
||||
EGLContext *ctxRet,
|
||||
EGLSurface *surfRet)
|
||||
{
|
||||
static const EGLint attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_DEPTH_SIZE, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
Window win;
|
||||
XVisualInfo *visInfo, visTemplate;
|
||||
int num_visuals;
|
||||
EGLContext ctx;
|
||||
EGLConfig config;
|
||||
EGLint num_configs;
|
||||
EGLint vid;
|
||||
|
||||
scrnum = DefaultScreen( x_dpy );
|
||||
root = RootWindow( x_dpy, scrnum );
|
||||
|
||||
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL visual config\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
assert(config);
|
||||
assert(num_configs > 0);
|
||||
|
||||
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
||||
printf("Error: eglGetConfigAttrib() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!visInfo) {
|
||||
printf("Error: couldn't get X visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
|
||||
0, visInfo->depth, InputOutput,
|
||||
visInfo->visual, mask, &attr );
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(x_dpy, win, &sizehints);
|
||||
XSetStandardProperties(x_dpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
|
||||
if (!ctx) {
|
||||
printf("Error: eglCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
|
||||
|
||||
if (!*surfRet) {
|
||||
printf("Error: eglCreateWindowSurface failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
XFree(visInfo);
|
||||
|
||||
*winRet = win;
|
||||
*ctxRet = ctx;
|
||||
}
|
||||
|
||||
|
||||
static EGLSurface
|
||||
make_pbuffer(Display *x_dpy, EGLDisplay egl_dpy, int width, int height)
|
||||
{
|
||||
static const EGLint config_attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_DEPTH_SIZE, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
EGLConfig config;
|
||||
EGLSurface pbuf;
|
||||
EGLint num_configs;
|
||||
EGLint pbuf_attribs[5];
|
||||
|
||||
pbuf_attribs[0] = EGL_WIDTH;
|
||||
pbuf_attribs[1] = width;
|
||||
pbuf_attribs[2] = EGL_HEIGHT;
|
||||
pbuf_attribs[3] = height;
|
||||
pbuf_attribs[4] = EGL_NONE;
|
||||
|
||||
if (!eglChooseConfig( egl_dpy, config_attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL config for pbuffer\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pbuf = eglCreatePbufferSurface(egl_dpy, config, pbuf_attribs);
|
||||
|
||||
return pbuf;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
event_loop(Display *dpy, Window win,
|
||||
EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
|
||||
EGLContext egl_ctx)
|
||||
{
|
||||
int anim = 0;
|
||||
|
||||
while (1) {
|
||||
int redraw = 0;
|
||||
|
||||
if (!anim || XPending(dpy)) {
|
||||
XEvent event;
|
||||
XNextEvent(dpy, &event);
|
||||
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
redraw = 1;
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
if (event.xconfigure.window == win)
|
||||
reshape(event.xconfigure.width, event.xconfigure.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == ' ') {
|
||||
anim = !anim;
|
||||
}
|
||||
else if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
redraw = 1;
|
||||
break;
|
||||
default:
|
||||
; /*no-op*/
|
||||
}
|
||||
}
|
||||
|
||||
if (anim) {
|
||||
view_rotx += 1.0;
|
||||
view_roty += 2.0;
|
||||
redraw = 1;
|
||||
}
|
||||
|
||||
if (redraw) {
|
||||
draw_both(egl_dpy, egl_surf, egl_pbuf, egl_ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" -display <displayname> set the display to run on\n");
|
||||
printf(" -info display OpenGL renderer info\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
Display *x_dpy;
|
||||
Window win;
|
||||
EGLSurface egl_surf, egl_pbuf;
|
||||
EGLContext egl_ctx;
|
||||
EGLDisplay egl_dpy;
|
||||
char *dpyName = NULL;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
EGLint egl_major, egl_minor;
|
||||
int i;
|
||||
const char *s;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-display") == 0) {
|
||||
dpyName = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-info") == 0) {
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
x_dpy = XOpenDisplay(dpyName);
|
||||
if (!x_dpy) {
|
||||
printf("Error: couldn't open display %s\n",
|
||||
dpyName ? dpyName : getenv("DISPLAY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
egl_dpy = eglGetDisplay(x_dpy);
|
||||
if (!egl_dpy) {
|
||||
printf("Error: eglGetDisplay() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
|
||||
printf("Error: eglInitialize() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VERSION);
|
||||
printf("EGL_VERSION = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VENDOR);
|
||||
printf("EGL_VENDOR = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
|
||||
printf("EGL_EXTENSIONS = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
|
||||
printf("EGL_CLIENT_APIS = %s\n", s);
|
||||
|
||||
make_x_window(x_dpy, egl_dpy,
|
||||
"pbuffer", 0, 0, WinWidth, WinHeight,
|
||||
&win, &egl_ctx, &egl_surf);
|
||||
|
||||
egl_pbuf = make_pbuffer(x_dpy, egl_dpy, WinWidth, WinHeight);
|
||||
if (!egl_pbuf) {
|
||||
printf("Error: eglCreatePBufferSurface() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
XMapWindow(x_dpy, win);
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (printInfo) {
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
/* Set initial projection/viewing transformation.
|
||||
* We can't be sure we'll get a ConfigureNotify event when the window
|
||||
* first appears.
|
||||
*/
|
||||
reshape(WinWidth, WinHeight);
|
||||
|
||||
event_loop(x_dpy, win, egl_dpy, egl_surf, egl_pbuf, egl_ctx);
|
||||
|
||||
eglDestroyContext(egl_dpy, egl_ctx);
|
||||
eglDestroySurface(egl_dpy, egl_surf);
|
||||
eglTerminate(egl_dpy);
|
||||
|
||||
|
||||
XDestroyWindow(x_dpy, win);
|
||||
XCloseDisplay(x_dpy);
|
||||
|
||||
return 0;
|
||||
}
|
657
progs/es1/xegl/render_tex.c
Normal file
657
progs/es1/xegl/render_tex.c
Normal file
@@ -0,0 +1,657 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test EGL render to texture.
|
||||
* Brian Paul
|
||||
* August 2008
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
|
||||
static int TexWidth = 256, TexHeight = 256;
|
||||
|
||||
static int WinWidth = 300, WinHeight = 300;
|
||||
|
||||
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
|
||||
|
||||
static GLuint DotTexture, RenderTexture;
|
||||
|
||||
|
||||
static void
|
||||
Normal(GLfloat *n, GLfloat nx, GLfloat ny, GLfloat nz)
|
||||
{
|
||||
n[0] = nx;
|
||||
n[1] = ny;
|
||||
n[2] = nz;
|
||||
}
|
||||
|
||||
static void
|
||||
Vertex(GLfloat *v, GLfloat vx, GLfloat vy, GLfloat vz)
|
||||
{
|
||||
v[0] = vx;
|
||||
v[1] = vy;
|
||||
v[2] = vz;
|
||||
}
|
||||
|
||||
static void
|
||||
Texcoord(GLfloat *v, GLfloat s, GLfloat t)
|
||||
{
|
||||
v[0] = s;
|
||||
v[1] = t;
|
||||
}
|
||||
|
||||
|
||||
/* Borrowed from glut, adapted */
|
||||
static void
|
||||
draw_torus(GLfloat r, GLfloat R, GLint nsides, GLint rings)
|
||||
{
|
||||
int i, j;
|
||||
GLfloat theta, phi, theta1;
|
||||
GLfloat cosTheta, sinTheta;
|
||||
GLfloat cosTheta1, sinTheta1;
|
||||
GLfloat ringDelta, sideDelta;
|
||||
GLfloat varray[100][3], narray[100][3], tarray[100][2];
|
||||
int vcount;
|
||||
|
||||
glVertexPointer(3, GL_FLOAT, 0, varray);
|
||||
glNormalPointer(GL_FLOAT, 0, narray);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, tarray);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
ringDelta = 2.0 * M_PI / rings;
|
||||
sideDelta = 2.0 * M_PI / nsides;
|
||||
|
||||
theta = 0.0;
|
||||
cosTheta = 1.0;
|
||||
sinTheta = 0.0;
|
||||
for (i = rings - 1; i >= 0; i--) {
|
||||
theta1 = theta + ringDelta;
|
||||
cosTheta1 = cos(theta1);
|
||||
sinTheta1 = sin(theta1);
|
||||
|
||||
vcount = 0; /* glBegin(GL_QUAD_STRIP); */
|
||||
|
||||
phi = 0.0;
|
||||
for (j = nsides; j >= 0; j--) {
|
||||
GLfloat s0, s1, t;
|
||||
GLfloat cosPhi, sinPhi, dist;
|
||||
|
||||
phi += sideDelta;
|
||||
cosPhi = cos(phi);
|
||||
sinPhi = sin(phi);
|
||||
dist = R + r * cosPhi;
|
||||
|
||||
s0 = 20.0 * theta / (2.0 * M_PI);
|
||||
s1 = 20.0 * theta1 / (2.0 * M_PI);
|
||||
t = 8.0 * phi / (2.0 * M_PI);
|
||||
|
||||
Normal(narray[vcount], cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
|
||||
Texcoord(tarray[vcount], s1, t);
|
||||
Vertex(varray[vcount], cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
|
||||
vcount++;
|
||||
|
||||
Normal(narray[vcount], cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
|
||||
Texcoord(tarray[vcount], s0, t);
|
||||
Vertex(varray[vcount], cosTheta * dist, -sinTheta * dist, r * sinPhi);
|
||||
vcount++;
|
||||
}
|
||||
|
||||
/*glEnd();*/
|
||||
assert(vcount <= 100);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, vcount);
|
||||
|
||||
theta = theta1;
|
||||
cosTheta = cosTheta1;
|
||||
sinTheta = sinTheta1;
|
||||
}
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw_torus_to_texture(void)
|
||||
{
|
||||
glViewport(0, 0, TexWidth, TexHeight);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustumf(-1, 1, -1, 1, 5.0, 60.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -15.0);
|
||||
|
||||
glClearColor(0.4, 0.4, 0.4, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, DotTexture);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(view_roty, 0, 1, 0);
|
||||
glScalef(0.5, 0.5, 0.5);
|
||||
|
||||
draw_torus(1.0, 3.0, 30, 60);
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
|
||||
#if 0
|
||||
glBindTexture(GL_TEXTURE_2D, RenderTexture);
|
||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, TexWidth, TexHeight);
|
||||
#endif
|
||||
|
||||
glFinish();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw_textured_quad(void)
|
||||
{
|
||||
GLfloat ar = (GLfloat) WinWidth / (GLfloat) WinHeight;
|
||||
|
||||
glViewport(0, 0, WinWidth, WinHeight);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -8.0);
|
||||
|
||||
glClearColor(0.4, 0.4, 1.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, RenderTexture);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(view_rotx, 1, 0, 0);
|
||||
glRotatef(view_rotz, 0, 0, 1);
|
||||
|
||||
{
|
||||
static const GLfloat texcoord[4][2] = {
|
||||
{ 0, 0 }, { 1, 0 }, { 0, 1 }, { 1, 1 }
|
||||
};
|
||||
static const GLfloat vertex[4][2] = {
|
||||
{ -1, -1 }, { 1, -1 }, { -1, 1 }, { 1, 1 }
|
||||
};
|
||||
|
||||
glVertexPointer(2, GL_FLOAT, 0, vertex);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, texcoord);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
draw(EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
|
||||
EGLContext egl_ctx)
|
||||
{
|
||||
/*printf("Begin draw\n");*/
|
||||
|
||||
/* first draw torus to pbuffer /texture */
|
||||
#if 01
|
||||
if (!eglMakeCurrent(egl_dpy, egl_pbuf, egl_pbuf, egl_ctx)) {
|
||||
#else
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
|
||||
#endif
|
||||
printf("Error: eglMakeCurrent(pbuf) failed\n");
|
||||
return;
|
||||
}
|
||||
glBindTexture(GL_TEXTURE_2D, RenderTexture);
|
||||
eglBindTexImage(egl_dpy, egl_pbuf, EGL_BACK_BUFFER);
|
||||
draw_torus_to_texture();
|
||||
eglReleaseTexImage(egl_dpy, egl_pbuf, EGL_BACK_BUFFER);
|
||||
|
||||
/* draw textured quad to window */
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent(pbuffer) failed\n");
|
||||
return;
|
||||
}
|
||||
draw_textured_quad();
|
||||
eglSwapBuffers(egl_dpy, egl_surf);
|
||||
|
||||
/*printf("End draw\n");*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
make_dot_texture(void)
|
||||
{
|
||||
#define SZ 64
|
||||
GLenum Filter = GL_LINEAR;
|
||||
GLubyte image[SZ][SZ][4];
|
||||
GLuint i, j;
|
||||
|
||||
for (i = 0; i < SZ; i++) {
|
||||
for (j = 0; j < SZ; j++) {
|
||||
GLfloat d = (i - SZ/2) * (i - SZ/2) + (j - SZ/2) * (j - SZ/2);
|
||||
d = sqrt(d);
|
||||
if (d < SZ/3) {
|
||||
image[i][j][0] = 255;
|
||||
image[i][j][1] = 255;
|
||||
image[i][j][2] = 255;
|
||||
image[i][j][3] = 255;
|
||||
}
|
||||
else {
|
||||
image[i][j][0] = 127;
|
||||
image[i][j][1] = 127;
|
||||
image[i][j][2] = 127;
|
||||
image[i][j][3] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glGenTextures(1, &DotTexture);
|
||||
glBindTexture(GL_TEXTURE_2D, DotTexture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ, SZ, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, image);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
#undef SZ
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
make_render_texture(void)
|
||||
{
|
||||
GLenum Filter = GL_LINEAR;
|
||||
glGenTextures(1, &RenderTexture);
|
||||
glBindTexture(GL_TEXTURE_2D, RenderTexture);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TexWidth, TexHeight, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
static const GLfloat red[4] = {1, 0, 0, 0};
|
||||
static const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
|
||||
static const GLfloat diffuse[4] = {0.7, 0.7, 0.7, 1.0};
|
||||
static const GLfloat specular[4] = {0.001, 0.001, 0.001, 1.0};
|
||||
static const GLfloat pos[4] = {20, 20, 50, 1};
|
||||
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red);
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white);
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 9.0);
|
||||
|
||||
glEnable(GL_LIGHT0);
|
||||
glLightfv(GL_LIGHT0, GL_POSITION, pos);
|
||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
|
||||
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
make_dot_texture();
|
||||
make_render_texture();
|
||||
|
||||
printf("DotTexture=%u RenderTexture=%u\n", DotTexture, RenderTexture);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create an RGB, double-buffered X window.
|
||||
* Return the window and context handles.
|
||||
*/
|
||||
static void
|
||||
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
|
||||
const char *name,
|
||||
int x, int y, int width, int height,
|
||||
Window *winRet,
|
||||
EGLContext *ctxRet,
|
||||
EGLSurface *surfRet)
|
||||
{
|
||||
static const EGLint attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_DEPTH_SIZE, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
Window win;
|
||||
XVisualInfo *visInfo, visTemplate;
|
||||
int num_visuals;
|
||||
EGLContext ctx;
|
||||
EGLConfig config;
|
||||
EGLint num_configs;
|
||||
EGLint vid;
|
||||
|
||||
scrnum = DefaultScreen( x_dpy );
|
||||
root = RootWindow( x_dpy, scrnum );
|
||||
|
||||
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL visual config\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
assert(config);
|
||||
assert(num_configs > 0);
|
||||
|
||||
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
||||
printf("Error: eglGetConfigAttrib() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!visInfo) {
|
||||
printf("Error: couldn't get X visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
|
||||
0, visInfo->depth, InputOutput,
|
||||
visInfo->visual, mask, &attr );
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(x_dpy, win, &sizehints);
|
||||
XSetStandardProperties(x_dpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
|
||||
if (!ctx) {
|
||||
printf("Error: eglCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
|
||||
|
||||
if (!*surfRet) {
|
||||
printf("Error: eglCreateWindowSurface failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
XFree(visInfo);
|
||||
|
||||
*winRet = win;
|
||||
*ctxRet = ctx;
|
||||
}
|
||||
|
||||
|
||||
static EGLSurface
|
||||
make_pbuffer(Display *x_dpy, EGLDisplay egl_dpy, int width, int height)
|
||||
{
|
||||
static const EGLint config_attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_DEPTH_SIZE, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
EGLConfig config;
|
||||
EGLSurface pbuf;
|
||||
EGLint num_configs;
|
||||
EGLint pbuf_attribs[15];
|
||||
int i = 0;
|
||||
|
||||
pbuf_attribs[i++] = EGL_WIDTH;
|
||||
pbuf_attribs[i++] = width;
|
||||
pbuf_attribs[i++] = EGL_HEIGHT;
|
||||
pbuf_attribs[i++] = height;
|
||||
pbuf_attribs[i++] = EGL_TEXTURE_FORMAT;
|
||||
pbuf_attribs[i++] = EGL_TEXTURE_RGBA;
|
||||
pbuf_attribs[i++] = EGL_TEXTURE_TARGET;
|
||||
pbuf_attribs[i++] = EGL_TEXTURE_2D;
|
||||
pbuf_attribs[i++] = EGL_MIPMAP_TEXTURE;
|
||||
pbuf_attribs[i++] = EGL_FALSE;
|
||||
pbuf_attribs[i++] = EGL_NONE;
|
||||
assert(i <= 15);
|
||||
|
||||
if (!eglChooseConfig( egl_dpy, config_attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL config for pbuffer\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pbuf = eglCreatePbufferSurface(egl_dpy, config, pbuf_attribs);
|
||||
|
||||
return pbuf;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
event_loop(Display *dpy, Window win,
|
||||
EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
|
||||
EGLContext egl_ctx)
|
||||
{
|
||||
int anim = 0;
|
||||
|
||||
while (1) {
|
||||
int redraw = 0;
|
||||
|
||||
if (!anim || XPending(dpy)) {
|
||||
XEvent event;
|
||||
XNextEvent(dpy, &event);
|
||||
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
redraw = 1;
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
if (event.xconfigure.window == win) {
|
||||
WinWidth = event.xconfigure.width;
|
||||
WinHeight = event.xconfigure.height;
|
||||
}
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == ' ') {
|
||||
anim = !anim;
|
||||
}
|
||||
else if (buffer[0] == 'z') {
|
||||
view_rotz += 5.0;
|
||||
}
|
||||
else if (buffer[0] == 'Z') {
|
||||
view_rotz -= 5.0;
|
||||
}
|
||||
else if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
redraw = 1;
|
||||
break;
|
||||
default:
|
||||
; /*no-op*/
|
||||
}
|
||||
}
|
||||
|
||||
if (anim) {
|
||||
view_rotx += 1.0;
|
||||
view_roty += 2.0;
|
||||
redraw = 1;
|
||||
}
|
||||
|
||||
if (redraw) {
|
||||
draw(egl_dpy, egl_surf, egl_pbuf, egl_ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" -display <displayname> set the display to run on\n");
|
||||
printf(" -info display OpenGL renderer info\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
Display *x_dpy;
|
||||
Window win;
|
||||
EGLSurface egl_surf, egl_pbuf;
|
||||
EGLContext egl_ctx;
|
||||
EGLDisplay egl_dpy;
|
||||
char *dpyName = NULL;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
EGLint egl_major, egl_minor;
|
||||
int i;
|
||||
const char *s;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-display") == 0) {
|
||||
dpyName = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-info") == 0) {
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
x_dpy = XOpenDisplay(dpyName);
|
||||
if (!x_dpy) {
|
||||
printf("Error: couldn't open display %s\n",
|
||||
dpyName ? dpyName : getenv("DISPLAY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
egl_dpy = eglGetDisplay(x_dpy);
|
||||
if (!egl_dpy) {
|
||||
printf("Error: eglGetDisplay() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
|
||||
printf("Error: eglInitialize() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VERSION);
|
||||
printf("EGL_VERSION = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VENDOR);
|
||||
printf("EGL_VENDOR = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
|
||||
printf("EGL_EXTENSIONS = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
|
||||
printf("EGL_CLIENT_APIS = %s\n", s);
|
||||
|
||||
make_x_window(x_dpy, egl_dpy,
|
||||
"render_tex", 0, 0, WinWidth, WinHeight,
|
||||
&win, &egl_ctx, &egl_surf);
|
||||
|
||||
egl_pbuf = make_pbuffer(x_dpy, egl_dpy, TexWidth, TexHeight);
|
||||
if (!egl_pbuf) {
|
||||
printf("Error: eglCreatePBufferSurface() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
XMapWindow(x_dpy, win);
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (printInfo) {
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
event_loop(x_dpy, win, egl_dpy, egl_surf, egl_pbuf, egl_ctx);
|
||||
|
||||
eglDestroyContext(egl_dpy, egl_ctx);
|
||||
eglDestroySurface(egl_dpy, egl_surf);
|
||||
eglTerminate(egl_dpy);
|
||||
|
||||
|
||||
XDestroyWindow(x_dpy, win);
|
||||
XCloseDisplay(x_dpy);
|
||||
|
||||
return 0;
|
||||
}
|
509
progs/es1/xegl/torus.c
Normal file
509
progs/es1/xegl/torus.c
Normal file
@@ -0,0 +1,509 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Draw a lit, textured torus with X/EGL and OpenGL ES 1.x
|
||||
* Brian Paul
|
||||
* July 2008
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
|
||||
|
||||
|
||||
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
|
||||
|
||||
|
||||
static void
|
||||
Normal(GLfloat *n, GLfloat nx, GLfloat ny, GLfloat nz)
|
||||
{
|
||||
n[0] = nx;
|
||||
n[1] = ny;
|
||||
n[2] = nz;
|
||||
}
|
||||
|
||||
static void
|
||||
Vertex(GLfloat *v, GLfloat vx, GLfloat vy, GLfloat vz)
|
||||
{
|
||||
v[0] = vx;
|
||||
v[1] = vy;
|
||||
v[2] = vz;
|
||||
}
|
||||
|
||||
static void
|
||||
Texcoord(GLfloat *v, GLfloat s, GLfloat t)
|
||||
{
|
||||
v[0] = s;
|
||||
v[1] = t;
|
||||
}
|
||||
|
||||
|
||||
/* Borrowed from glut, adapted */
|
||||
static void
|
||||
draw_torus(GLfloat r, GLfloat R, GLint nsides, GLint rings)
|
||||
{
|
||||
int i, j;
|
||||
GLfloat theta, phi, theta1;
|
||||
GLfloat cosTheta, sinTheta;
|
||||
GLfloat cosTheta1, sinTheta1;
|
||||
GLfloat ringDelta, sideDelta;
|
||||
GLfloat varray[100][3], narray[100][3], tarray[100][2];
|
||||
int vcount;
|
||||
|
||||
glVertexPointer(3, GL_FLOAT, 0, varray);
|
||||
glNormalPointer(GL_FLOAT, 0, narray);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, tarray);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_NORMAL_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
ringDelta = 2.0 * M_PI / rings;
|
||||
sideDelta = 2.0 * M_PI / nsides;
|
||||
|
||||
theta = 0.0;
|
||||
cosTheta = 1.0;
|
||||
sinTheta = 0.0;
|
||||
for (i = rings - 1; i >= 0; i--) {
|
||||
theta1 = theta + ringDelta;
|
||||
cosTheta1 = cos(theta1);
|
||||
sinTheta1 = sin(theta1);
|
||||
|
||||
vcount = 0; /* glBegin(GL_QUAD_STRIP); */
|
||||
|
||||
phi = 0.0;
|
||||
for (j = nsides; j >= 0; j--) {
|
||||
GLfloat s0, s1, t;
|
||||
GLfloat cosPhi, sinPhi, dist;
|
||||
|
||||
phi += sideDelta;
|
||||
cosPhi = cos(phi);
|
||||
sinPhi = sin(phi);
|
||||
dist = R + r * cosPhi;
|
||||
|
||||
s0 = 20.0 * theta / (2.0 * M_PI);
|
||||
s1 = 20.0 * theta1 / (2.0 * M_PI);
|
||||
t = 8.0 * phi / (2.0 * M_PI);
|
||||
|
||||
Normal(narray[vcount], cosTheta1 * cosPhi, -sinTheta1 * cosPhi, sinPhi);
|
||||
Texcoord(tarray[vcount], s1, t);
|
||||
Vertex(varray[vcount], cosTheta1 * dist, -sinTheta1 * dist, r * sinPhi);
|
||||
vcount++;
|
||||
|
||||
Normal(narray[vcount], cosTheta * cosPhi, -sinTheta * cosPhi, sinPhi);
|
||||
Texcoord(tarray[vcount], s0, t);
|
||||
Vertex(varray[vcount], cosTheta * dist, -sinTheta * dist, r * sinPhi);
|
||||
vcount++;
|
||||
}
|
||||
|
||||
/*glEnd();*/
|
||||
assert(vcount <= 100);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, vcount);
|
||||
|
||||
theta = theta1;
|
||||
cosTheta = cosTheta1;
|
||||
sinTheta = sinTheta1;
|
||||
}
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_NORMAL_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(view_rotx, 1, 0, 0);
|
||||
glRotatef(view_roty, 0, 1, 0);
|
||||
glRotatef(view_rotz, 0, 0, 1);
|
||||
glScalef(0.5, 0.5, 0.5);
|
||||
|
||||
draw_torus(1.0, 3.0, 30, 60);
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
GLfloat ar = (GLfloat) width / (GLfloat) height;
|
||||
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
#ifdef GL_VERSION_ES_CM_1_0
|
||||
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
#else
|
||||
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
#endif
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -15.0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
make_texture(void)
|
||||
{
|
||||
#define SZ 64
|
||||
GLenum Filter = GL_LINEAR;
|
||||
GLubyte image[SZ][SZ][4];
|
||||
GLuint i, j;
|
||||
|
||||
for (i = 0; i < SZ; i++) {
|
||||
for (j = 0; j < SZ; j++) {
|
||||
GLfloat d = (i - SZ/2) * (i - SZ/2) + (j - SZ/2) * (j - SZ/2);
|
||||
d = sqrt(d);
|
||||
if (d < SZ/3) {
|
||||
image[i][j][0] = 255;
|
||||
image[i][j][1] = 255;
|
||||
image[i][j][2] = 255;
|
||||
image[i][j][3] = 255;
|
||||
}
|
||||
else {
|
||||
image[i][j][0] = 127;
|
||||
image[i][j][1] = 127;
|
||||
image[i][j][2] = 127;
|
||||
image[i][j][3] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE0); /* unit 0 */
|
||||
glBindTexture(GL_TEXTURE_2D, 42);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ, SZ, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, image);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
#undef SZ
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
static const GLfloat red[4] = {1, 0, 0, 0};
|
||||
static const GLfloat white[4] = {1.0, 1.0, 1.0, 1.0};
|
||||
static const GLfloat diffuse[4] = {0.7, 0.7, 0.7, 1.0};
|
||||
static const GLfloat specular[4] = {0.001, 0.001, 0.001, 1.0};
|
||||
static const GLfloat pos[4] = {20, 20, 50, 1};
|
||||
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, red);
|
||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, white);
|
||||
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 9.0);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
glLightfv(GL_LIGHT0, GL_POSITION, pos);
|
||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
|
||||
glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
|
||||
|
||||
glClearColor(0.4, 0.4, 0.4, 0.0);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
make_texture();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create an RGB, double-buffered X window.
|
||||
* Return the window and context handles.
|
||||
*/
|
||||
static void
|
||||
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
|
||||
const char *name,
|
||||
int x, int y, int width, int height,
|
||||
Window *winRet,
|
||||
EGLContext *ctxRet,
|
||||
EGLSurface *surfRet)
|
||||
{
|
||||
static const EGLint attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_DEPTH_SIZE, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
Window win;
|
||||
XVisualInfo *visInfo, visTemplate;
|
||||
int num_visuals;
|
||||
EGLContext ctx;
|
||||
EGLConfig config;
|
||||
EGLint num_configs;
|
||||
EGLint vid;
|
||||
|
||||
scrnum = DefaultScreen( x_dpy );
|
||||
root = RootWindow( x_dpy, scrnum );
|
||||
|
||||
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL visual config\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
assert(config);
|
||||
assert(num_configs > 0);
|
||||
|
||||
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
||||
printf("Error: eglGetConfigAttrib() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!visInfo) {
|
||||
printf("Error: couldn't get X visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
|
||||
0, visInfo->depth, InputOutput,
|
||||
visInfo->visual, mask, &attr );
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(x_dpy, win, &sizehints);
|
||||
XSetStandardProperties(x_dpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
|
||||
if (!ctx) {
|
||||
printf("Error: eglCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
|
||||
|
||||
if (!*surfRet) {
|
||||
printf("Error: eglCreateWindowSurface failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
XFree(visInfo);
|
||||
|
||||
*winRet = win;
|
||||
*ctxRet = ctx;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
event_loop(Display *dpy, Window win,
|
||||
EGLDisplay egl_dpy, EGLSurface egl_surf)
|
||||
{
|
||||
int anim = 1;
|
||||
|
||||
while (1) {
|
||||
int redraw = 0;
|
||||
|
||||
if (!anim || XPending(dpy)) {
|
||||
XEvent event;
|
||||
XNextEvent(dpy, &event);
|
||||
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
redraw = 1;
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
reshape(event.xconfigure.width, event.xconfigure.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == ' ') {
|
||||
anim = !anim;
|
||||
}
|
||||
else if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
redraw = 1;
|
||||
break;
|
||||
default:
|
||||
; /*no-op*/
|
||||
}
|
||||
}
|
||||
|
||||
if (anim) {
|
||||
view_rotx += 1.0;
|
||||
view_roty += 2.0;
|
||||
redraw = 1;
|
||||
}
|
||||
|
||||
if (redraw) {
|
||||
draw();
|
||||
eglSwapBuffers(egl_dpy, egl_surf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" -display <displayname> set the display to run on\n");
|
||||
printf(" -info display OpenGL renderer info\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const int winWidth = 300, winHeight = 300;
|
||||
Display *x_dpy;
|
||||
Window win;
|
||||
EGLSurface egl_surf;
|
||||
EGLContext egl_ctx;
|
||||
EGLDisplay egl_dpy;
|
||||
char *dpyName = NULL;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
EGLint egl_major, egl_minor;
|
||||
int i;
|
||||
const char *s;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-display") == 0) {
|
||||
dpyName = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-info") == 0) {
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
x_dpy = XOpenDisplay(dpyName);
|
||||
if (!x_dpy) {
|
||||
printf("Error: couldn't open display %s\n",
|
||||
dpyName ? dpyName : getenv("DISPLAY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
egl_dpy = eglGetDisplay(x_dpy);
|
||||
if (!egl_dpy) {
|
||||
printf("Error: eglGetDisplay() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
|
||||
printf("Error: eglInitialize() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VERSION);
|
||||
printf("EGL_VERSION = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VENDOR);
|
||||
printf("EGL_VENDOR = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
|
||||
printf("EGL_EXTENSIONS = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
|
||||
printf("EGL_CLIENT_APIS = %s\n", s);
|
||||
|
||||
make_x_window(x_dpy, egl_dpy,
|
||||
"torus", 0, 0, winWidth, winHeight,
|
||||
&win, &egl_ctx, &egl_surf);
|
||||
|
||||
XMapWindow(x_dpy, win);
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (printInfo) {
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
/* Set initial projection/viewing transformation.
|
||||
* We can't be sure we'll get a ConfigureNotify event when the window
|
||||
* first appears.
|
||||
*/
|
||||
reshape(winWidth, winHeight);
|
||||
|
||||
event_loop(x_dpy, win, egl_dpy, egl_surf);
|
||||
|
||||
eglDestroyContext(egl_dpy, egl_ctx);
|
||||
eglDestroySurface(egl_dpy, egl_surf);
|
||||
eglTerminate(egl_dpy);
|
||||
|
||||
|
||||
XDestroyWindow(x_dpy, win);
|
||||
XCloseDisplay(x_dpy);
|
||||
|
||||
return 0;
|
||||
}
|
473
progs/es1/xegl/tri.c
Normal file
473
progs/es1/xegl/tri.c
Normal file
@@ -0,0 +1,473 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Draw a triangle with X/EGL and OpenGL ES 1.x
|
||||
* Brian Paul
|
||||
* 5 June 2008
|
||||
*/
|
||||
|
||||
#define USE_FULL_GL 0
|
||||
|
||||
#define USE_FIXED_POINT 0
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#if USE_FULL_GL
|
||||
#include <GL/gl.h> /* use full OpenGL */
|
||||
#else
|
||||
#include <GLES/gl.h> /* use OpenGL ES 1.x */
|
||||
#include <GLES/glext.h>
|
||||
#endif
|
||||
#include <EGL/egl.h>
|
||||
|
||||
|
||||
#define FLOAT_TO_FIXED(X) ((X) * 65535.0)
|
||||
|
||||
|
||||
|
||||
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
|
||||
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
#if USE_FIXED_POINT
|
||||
static const GLfixed verts[3][2] = {
|
||||
{ -65536, -65536 },
|
||||
{ 65536, -65536 },
|
||||
{ 0, 65536 }
|
||||
};
|
||||
static const GLfixed colors[3][4] = {
|
||||
{ 65536, 0, 0, 65536 },
|
||||
{ 0, 65536, 0 , 65536},
|
||||
{ 0, 0, 65536 , 65536}
|
||||
};
|
||||
#else
|
||||
static const GLfloat verts[3][2] = {
|
||||
{ -1, -1 },
|
||||
{ 1, -1 },
|
||||
{ 0, 1 }
|
||||
};
|
||||
static const GLfloat colors[3][4] = {
|
||||
{ 1, 0, 0, 1 },
|
||||
{ 0, 1, 0, 1 },
|
||||
{ 0, 0, 1, 1 }
|
||||
};
|
||||
#endif
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(view_rotx, 1, 0, 0);
|
||||
glRotatef(view_roty, 0, 1, 0);
|
||||
glRotatef(view_rotz, 0, 0, 1);
|
||||
|
||||
{
|
||||
#if USE_FIXED_POINT
|
||||
glVertexPointer(2, GL_FIXED, 0, verts);
|
||||
glColorPointer(4, GL_FIXED, 0, colors);
|
||||
#else
|
||||
glVertexPointer(2, GL_FLOAT, 0, verts);
|
||||
glColorPointer(4, GL_FLOAT, 0, colors);
|
||||
#endif
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
/* draw triangle */
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
|
||||
/* draw some points */
|
||||
glPointSizex(FLOAT_TO_FIXED(15.5));
|
||||
glDrawArrays(GL_POINTS, 0, 3);
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
if (0) {
|
||||
/* test code */
|
||||
GLfixed size;
|
||||
glGetFixedv(GL_POINT_SIZE, &size);
|
||||
printf("GL_POINT_SIZE = 0x%x %f\n", size, size / 65536.0);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
GLfloat ar = (GLfloat) width / (GLfloat) height;
|
||||
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
#ifdef GL_VERSION_ES_CM_1_0
|
||||
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
#else
|
||||
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
#endif
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -10.0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test_query_matrix(void)
|
||||
{
|
||||
PFNGLQUERYMATRIXXOESPROC procQueryMatrixx;
|
||||
typedef void (*voidproc)();
|
||||
GLfixed mantissa[16];
|
||||
GLint exponent[16];
|
||||
GLbitfield rv;
|
||||
int i;
|
||||
voidproc p = eglGetProcAddress("eglCreateContext");
|
||||
|
||||
assert(p);
|
||||
procQueryMatrixx = (PFNGLQUERYMATRIXXOESPROC) eglGetProcAddress("glQueryMatrixxOES");
|
||||
assert(procQueryMatrixx);
|
||||
/* Actually try out this one */
|
||||
rv = (*procQueryMatrixx)(mantissa, exponent);
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (rv & (1<<i)) {
|
||||
printf("matrix[%d] invalid\n", i);
|
||||
}
|
||||
else {
|
||||
printf("matrix[%d] = %f * 2^(%d)\n", i, mantissa[i]/65536.0, exponent[i]);
|
||||
}
|
||||
}
|
||||
p = eglGetProcAddress("glFoo");
|
||||
assert(!p);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
glClearColor(0.4, 0.4, 0.4, 0.0);
|
||||
|
||||
if (0)
|
||||
test_query_matrix();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create an RGB, double-buffered X window.
|
||||
* Return the window and context handles.
|
||||
*/
|
||||
static void
|
||||
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
|
||||
const char *name,
|
||||
int x, int y, int width, int height,
|
||||
Window *winRet,
|
||||
EGLContext *ctxRet,
|
||||
EGLSurface *surfRet)
|
||||
{
|
||||
static const EGLint attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_DEPTH_SIZE, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
Window win;
|
||||
XVisualInfo *visInfo, visTemplate;
|
||||
int num_visuals;
|
||||
EGLContext ctx;
|
||||
EGLConfig config;
|
||||
EGLint num_configs;
|
||||
EGLint vid;
|
||||
|
||||
scrnum = DefaultScreen( x_dpy );
|
||||
root = RootWindow( x_dpy, scrnum );
|
||||
|
||||
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL visual config\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
assert(config);
|
||||
assert(num_configs > 0);
|
||||
|
||||
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
||||
printf("Error: eglGetConfigAttrib() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!visInfo) {
|
||||
printf("Error: couldn't get X visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
|
||||
0, visInfo->depth, InputOutput,
|
||||
visInfo->visual, mask, &attr );
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(x_dpy, win, &sizehints);
|
||||
XSetStandardProperties(x_dpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
#if USE_FULL_GL
|
||||
eglBindAPI(EGL_OPENGL_API);
|
||||
#else
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
#endif
|
||||
|
||||
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
|
||||
if (!ctx) {
|
||||
printf("Error: eglCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
|
||||
|
||||
if (!*surfRet) {
|
||||
printf("Error: eglCreateWindowSurface failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
XFree(visInfo);
|
||||
|
||||
*winRet = win;
|
||||
*ctxRet = ctx;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
event_loop(Display *dpy, Window win,
|
||||
EGLDisplay egl_dpy, EGLSurface egl_surf)
|
||||
{
|
||||
while (1) {
|
||||
int redraw = 0;
|
||||
XEvent event;
|
||||
|
||||
XNextEvent(dpy, &event);
|
||||
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
redraw = 1;
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
reshape(event.xconfigure.width, event.xconfigure.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
redraw = 1;
|
||||
break;
|
||||
default:
|
||||
; /*no-op*/
|
||||
}
|
||||
|
||||
if (redraw) {
|
||||
draw();
|
||||
eglSwapBuffers(egl_dpy, egl_surf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" -display <displayname> set the display to run on\n");
|
||||
printf(" -info display OpenGL renderer info\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const int winWidth = 300, winHeight = 300;
|
||||
Display *x_dpy;
|
||||
Window win;
|
||||
EGLSurface egl_surf;
|
||||
EGLContext egl_ctx;
|
||||
EGLDisplay egl_dpy;
|
||||
char *dpyName = NULL;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
EGLint egl_major, egl_minor;
|
||||
int i;
|
||||
const char *s;
|
||||
|
||||
static struct {
|
||||
char *name;
|
||||
GLenum value;
|
||||
enum {GetString, GetInteger} type;
|
||||
} info_items[] = {
|
||||
{"GL_RENDERER", GL_RENDERER, GetString},
|
||||
{"GL_VERSION", GL_VERSION, GetString},
|
||||
{"GL_VENDOR", GL_VENDOR, GetString},
|
||||
{"GL_EXTENSIONS", GL_EXTENSIONS, GetString},
|
||||
{"GL_MAX_PALETTE_MATRICES_OES", GL_MAX_PALETTE_MATRICES_OES, GetInteger},
|
||||
{"GL_MAX_VERTEX_UNITS_OES", GL_MAX_VERTEX_UNITS_OES, GetInteger},
|
||||
};
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-display") == 0) {
|
||||
dpyName = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-info") == 0) {
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
x_dpy = XOpenDisplay(dpyName);
|
||||
if (!x_dpy) {
|
||||
printf("Error: couldn't open display %s\n",
|
||||
dpyName ? dpyName : getenv("DISPLAY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
egl_dpy = eglGetDisplay(x_dpy);
|
||||
if (!egl_dpy) {
|
||||
printf("Error: eglGetDisplay() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
|
||||
printf("Error: eglInitialize() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VERSION);
|
||||
printf("EGL_VERSION = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VENDOR);
|
||||
printf("EGL_VENDOR = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
|
||||
printf("EGL_EXTENSIONS = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
|
||||
printf("EGL_CLIENT_APIS = %s\n", s);
|
||||
|
||||
make_x_window(x_dpy, egl_dpy,
|
||||
"OpenGL ES 1.x tri", 0, 0, winWidth, winHeight,
|
||||
&win, &egl_ctx, &egl_surf);
|
||||
|
||||
XMapWindow(x_dpy, win);
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (printInfo) {
|
||||
for (i = 0; i < sizeof(info_items)/sizeof(info_items[0]); i++) {
|
||||
switch (info_items[i].type) {
|
||||
case GetString:
|
||||
printf("%s = %s\n", info_items[i].name, (char *)glGetString(info_items[i].value));
|
||||
break;
|
||||
case GetInteger: {
|
||||
GLint rv = -1;
|
||||
glGetIntegerv(info_items[i].value, &rv);
|
||||
printf("%s = %d\n", info_items[i].name, rv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
init();
|
||||
|
||||
/* Set initial projection/viewing transformation.
|
||||
* We can't be sure we'll get a ConfigureNotify event when the window
|
||||
* first appears.
|
||||
*/
|
||||
reshape(winWidth, winHeight);
|
||||
|
||||
event_loop(x_dpy, win, egl_dpy, egl_surf);
|
||||
|
||||
eglDestroyContext(egl_dpy, egl_ctx);
|
||||
eglDestroySurface(egl_dpy, egl_surf);
|
||||
eglTerminate(egl_dpy);
|
||||
|
||||
|
||||
XDestroyWindow(x_dpy, win);
|
||||
XCloseDisplay(x_dpy);
|
||||
|
||||
return 0;
|
||||
}
|
433
progs/es1/xegl/two_win.c
Normal file
433
progs/es1/xegl/two_win.c
Normal file
@@ -0,0 +1,433 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test drawing to two windows.
|
||||
* Brian Paul
|
||||
* August 2008
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
|
||||
static int WinWidth[2] = {150, 300}, WinHeight[2] = {150, 300};
|
||||
|
||||
|
||||
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
GLfloat ar = (GLfloat) width / (GLfloat) height;
|
||||
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
#ifdef GL_VERSION_ES_CM_1_0
|
||||
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
#else
|
||||
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
#endif
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -10.0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw(int win)
|
||||
{
|
||||
static const GLfloat verts[3][2] = {
|
||||
{ -1, -1 },
|
||||
{ 1, -1 },
|
||||
{ 0, 1 }
|
||||
};
|
||||
static const GLfloat colors[3][4] = {
|
||||
{ 1, 0, 0, 1 },
|
||||
{ 0, 1, 0, 1 },
|
||||
{ 0, 0, 1, 1 }
|
||||
};
|
||||
|
||||
assert(win == 0 || win == 1);
|
||||
|
||||
reshape(WinWidth[win], WinHeight[win]);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(view_rotx, 1, 0, 0);
|
||||
glRotatef(view_roty, 0, 1, 0);
|
||||
glRotatef(view_rotz, 0, 0, 1);
|
||||
|
||||
/* draw triangle */
|
||||
{
|
||||
glVertexPointer(2, GL_FLOAT, 0, verts);
|
||||
glColorPointer(4, GL_FLOAT, 0, colors);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
glClearColor(0.4, 0.4, 0.4, 0.0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create an RGB, double-buffered X window.
|
||||
* Return the window and context handles.
|
||||
*/
|
||||
static void
|
||||
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
|
||||
const char *name,
|
||||
int x, int y, int width, int height,
|
||||
Window *winRet,
|
||||
EGLContext *ctxRet,
|
||||
EGLSurface *surfRet)
|
||||
{
|
||||
static const EGLint attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_DEPTH_SIZE, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
Window win;
|
||||
XVisualInfo *visInfo, visTemplate;
|
||||
int num_visuals;
|
||||
EGLContext ctx;
|
||||
EGLConfig config;
|
||||
EGLint num_configs;
|
||||
EGLint vid;
|
||||
|
||||
scrnum = DefaultScreen( x_dpy );
|
||||
root = RootWindow( x_dpy, scrnum );
|
||||
|
||||
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL visual config\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
assert(config);
|
||||
assert(num_configs > 0);
|
||||
|
||||
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
||||
printf("Error: eglGetConfigAttrib() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!visInfo) {
|
||||
printf("Error: couldn't get X visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow( x_dpy, root, x, y, width, height,
|
||||
0, visInfo->depth, InputOutput,
|
||||
visInfo->visual, mask, &attr );
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(x_dpy, win, &sizehints);
|
||||
XSetStandardProperties(x_dpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
#if USE_FULL_GL
|
||||
eglBindAPI(EGL_OPENGL_API);
|
||||
#else
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
#endif
|
||||
|
||||
if (ctxRet) {
|
||||
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
|
||||
if (!ctx) {
|
||||
printf("Error: eglCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
*ctxRet = ctx;
|
||||
}
|
||||
|
||||
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
|
||||
|
||||
if (!*surfRet) {
|
||||
printf("Error: eglCreateWindowSurface failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
XFree(visInfo);
|
||||
|
||||
*winRet = win;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
event_loop(Display *dpy, Window win1, Window win2,
|
||||
EGLDisplay egl_dpy, EGLSurface egl_surf1, EGLSurface egl_surf2,
|
||||
EGLContext egl_ctx)
|
||||
{
|
||||
while (1) {
|
||||
int redraw = 0;
|
||||
int win;
|
||||
XEvent event;
|
||||
|
||||
XNextEvent(dpy, &event);
|
||||
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
redraw = 1;
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
if (event.xconfigure.window == win1)
|
||||
win = 0;
|
||||
else
|
||||
win = 1;
|
||||
WinWidth[win] = event.xconfigure.width;
|
||||
WinHeight[win] = event.xconfigure.height;
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
redraw = 1;
|
||||
break;
|
||||
default:
|
||||
; /*no-op*/
|
||||
}
|
||||
|
||||
if (redraw) {
|
||||
/* win 1 */
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf1, egl_surf1, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent(1) failed\n");
|
||||
return;
|
||||
}
|
||||
draw(0);
|
||||
eglSwapBuffers(egl_dpy, egl_surf1);
|
||||
|
||||
/* win 2 */
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf2, egl_surf2, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent(2) failed\n");
|
||||
return;
|
||||
}
|
||||
draw(1);
|
||||
eglSwapBuffers(egl_dpy, egl_surf2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" -display <displayname> set the display to run on\n");
|
||||
printf(" -info display OpenGL renderer info\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
Display *x_dpy;
|
||||
Window win1, win2;
|
||||
EGLSurface egl_surf1, egl_surf2;
|
||||
EGLContext egl_ctx;
|
||||
EGLDisplay egl_dpy;
|
||||
char *dpyName = NULL;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
EGLint egl_major, egl_minor;
|
||||
int i;
|
||||
const char *s;
|
||||
|
||||
static struct {
|
||||
char *name;
|
||||
GLenum value;
|
||||
enum {GetString, GetInteger} type;
|
||||
} info_items[] = {
|
||||
{"GL_RENDERER", GL_RENDERER, GetString},
|
||||
{"GL_VERSION", GL_VERSION, GetString},
|
||||
{"GL_VENDOR", GL_VENDOR, GetString},
|
||||
{"GL_EXTENSIONS", GL_EXTENSIONS, GetString},
|
||||
{"GL_MAX_PALETTE_MATRICES_OES", GL_MAX_PALETTE_MATRICES_OES, GetInteger},
|
||||
{"GL_MAX_VERTEX_UNITS_OES", GL_MAX_VERTEX_UNITS_OES, GetInteger},
|
||||
};
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-display") == 0) {
|
||||
dpyName = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-info") == 0) {
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
x_dpy = XOpenDisplay(dpyName);
|
||||
if (!x_dpy) {
|
||||
printf("Error: couldn't open display %s\n",
|
||||
dpyName ? dpyName : getenv("DISPLAY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
egl_dpy = eglGetDisplay(x_dpy);
|
||||
if (!egl_dpy) {
|
||||
printf("Error: eglGetDisplay() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
|
||||
printf("Error: eglInitialize() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VERSION);
|
||||
printf("EGL_VERSION = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VENDOR);
|
||||
printf("EGL_VENDOR = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
|
||||
printf("EGL_EXTENSIONS = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
|
||||
printf("EGL_CLIENT_APIS = %s\n", s);
|
||||
|
||||
make_x_window(x_dpy, egl_dpy,
|
||||
"xegl_two_win #1", 0, 0, WinWidth[0], WinHeight[0],
|
||||
&win1, &egl_ctx, &egl_surf1);
|
||||
|
||||
make_x_window(x_dpy, egl_dpy,
|
||||
"xegl_two_win #2", WinWidth[0] + 50, 0,
|
||||
WinWidth[1], WinHeight[1],
|
||||
&win2, NULL, &egl_surf2);
|
||||
|
||||
XMapWindow(x_dpy, win1);
|
||||
|
||||
XMapWindow(x_dpy, win2);
|
||||
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf1, egl_surf1, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (printInfo) {
|
||||
for (i = 0; i < sizeof(info_items)/sizeof(info_items[0]); i++) {
|
||||
switch (info_items[i].type) {
|
||||
case GetString:
|
||||
printf("%s = %s\n", info_items[i].name, (char *)glGetString(info_items[i].value));
|
||||
break;
|
||||
case GetInteger: {
|
||||
GLint rv = -1;
|
||||
glGetIntegerv(info_items[i].value, &rv);
|
||||
printf("%s = %d\n", info_items[i].name, rv);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
init();
|
||||
|
||||
event_loop(x_dpy, win1, win2, egl_dpy, egl_surf1, egl_surf2, egl_ctx);
|
||||
|
||||
eglDestroyContext(egl_dpy, egl_ctx);
|
||||
eglDestroySurface(egl_dpy, egl_surf1);
|
||||
eglDestroySurface(egl_dpy, egl_surf2);
|
||||
eglTerminate(egl_dpy);
|
||||
|
||||
XDestroyWindow(x_dpy, win1);
|
||||
XDestroyWindow(x_dpy, win2);
|
||||
XCloseDisplay(x_dpy);
|
||||
|
||||
return 0;
|
||||
}
|
51
progs/es2/xegl/Makefile
Normal file
51
progs/es2/xegl/Makefile
Normal file
@@ -0,0 +1,51 @@
|
||||
# progs/es2/xegl/Makefile
|
||||
|
||||
TOP = ../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
|
||||
INCLUDE_DIRS = \
|
||||
-I$(TOP)/include \
|
||||
|
||||
HEADERS = $(TOP)/include/GLES/egl.h
|
||||
|
||||
|
||||
ES2_LIB_DEPS = \
|
||||
$(TOP)/$(LIB_DIR)/libEGL.so \
|
||||
$(TOP)/$(LIB_DIR)/libGLESv2.so
|
||||
|
||||
|
||||
ES2_LIBS = \
|
||||
-L$(TOP)/$(LIB_DIR) -lEGL \
|
||||
-L$(TOP)/$(LIB_DIR) -lGLESv2 $(LIBDRM_LIB) -lX11
|
||||
|
||||
PROGRAMS = \
|
||||
es2_info \
|
||||
tri
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
|
||||
|
||||
|
||||
|
||||
default: $(PROGRAMS)
|
||||
|
||||
|
||||
|
||||
es2_info.c:
|
||||
cp ../../es1/xegl/es1_info.c es2_info.c
|
||||
|
||||
es2_info: es2_info.o $(ES2_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) es2_info.o $(ES2_LIBS) -o $@
|
||||
|
||||
tri: tri.o $(ES2_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) tri.o $(ES2_LIBS) -o $@
|
||||
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o *~
|
||||
rm -f $(PROGRAMS)
|
||||
rm -f es2_info.c
|
||||
|
516
progs/es2/xegl/tri.c
Normal file
516
progs/es2/xegl/tri.c
Normal file
@@ -0,0 +1,516 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Draw a triangle with X/EGL and OpenGL ES 2.x
|
||||
*/
|
||||
|
||||
#define USE_FULL_GL 0
|
||||
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#if USE_FULL_GL
|
||||
#include <GL/gl.h> /* use full OpenGL */
|
||||
#else
|
||||
#include <GLES2/gl2.h> /* use OpenGL ES 2.x */
|
||||
#endif
|
||||
#include <EGL/egl.h>
|
||||
|
||||
|
||||
#define FLOAT_TO_FIXED(X) ((X) * 65535.0)
|
||||
|
||||
|
||||
|
||||
static GLfloat view_rotx = 0.0, view_roty = 0.0;
|
||||
|
||||
static GLint u_matrix = -1;
|
||||
static GLint attr_pos = 0, attr_color = 1;
|
||||
|
||||
|
||||
static void
|
||||
make_z_rot_matrix(GLfloat angle, GLfloat *m)
|
||||
{
|
||||
float c = cos(angle * M_PI / 180.0);
|
||||
float s = sin(angle * M_PI / 180.0);
|
||||
int i;
|
||||
for (i = 0; i < 16; i++)
|
||||
m[i] = 0.0;
|
||||
m[0] = m[5] = m[10] = m[15] = 1.0;
|
||||
|
||||
m[0] = c;
|
||||
m[1] = s;
|
||||
m[4] = -s;
|
||||
m[5] = c;
|
||||
}
|
||||
|
||||
static void
|
||||
make_scale_matrix(GLfloat xs, GLfloat ys, GLfloat zs, GLfloat *m)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 16; i++)
|
||||
m[i] = 0.0;
|
||||
m[0] = xs;
|
||||
m[5] = ys;
|
||||
m[10] = zs;
|
||||
m[15] = 1.0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mul_matrix(GLfloat *prod, const GLfloat *a, const GLfloat *b)
|
||||
{
|
||||
#define A(row,col) a[(col<<2)+row]
|
||||
#define B(row,col) b[(col<<2)+row]
|
||||
#define P(row,col) p[(col<<2)+row]
|
||||
GLfloat p[16];
|
||||
GLint i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
const GLfloat ai0=A(i,0), ai1=A(i,1), ai2=A(i,2), ai3=A(i,3);
|
||||
P(i,0) = ai0 * B(0,0) + ai1 * B(1,0) + ai2 * B(2,0) + ai3 * B(3,0);
|
||||
P(i,1) = ai0 * B(0,1) + ai1 * B(1,1) + ai2 * B(2,1) + ai3 * B(3,1);
|
||||
P(i,2) = ai0 * B(0,2) + ai1 * B(1,2) + ai2 * B(2,2) + ai3 * B(3,2);
|
||||
P(i,3) = ai0 * B(0,3) + ai1 * B(1,3) + ai2 * B(2,3) + ai3 * B(3,3);
|
||||
}
|
||||
memcpy(prod, p, sizeof(p));
|
||||
#undef A
|
||||
#undef B
|
||||
#undef PROD
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
static const GLfloat verts[3][2] = {
|
||||
{ -1, -1 },
|
||||
{ 1, -1 },
|
||||
{ 0, 1 }
|
||||
};
|
||||
static const GLfloat colors[3][3] = {
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 1, 0 },
|
||||
{ 0, 0, 1 }
|
||||
};
|
||||
GLfloat mat[16], rot[16], scale[16];
|
||||
|
||||
/* Set modelview/projection matrix */
|
||||
make_z_rot_matrix(view_rotx, rot);
|
||||
make_scale_matrix(0.5, 0.5, 0.5, scale);
|
||||
mul_matrix(mat, rot, scale);
|
||||
glUniformMatrix4fv(u_matrix, 1, GL_FALSE, mat);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
{
|
||||
glVertexAttribPointer(attr_pos, 2, GL_FLOAT, GL_FALSE, 0, verts);
|
||||
glVertexAttribPointer(attr_color, 3, GL_FLOAT, GL_FALSE, 0, colors);
|
||||
glEnableVertexAttribArray(attr_pos);
|
||||
glEnableVertexAttribArray(attr_color);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
|
||||
glDisableVertexAttribArray(attr_pos);
|
||||
glDisableVertexAttribArray(attr_color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
create_shaders(void)
|
||||
{
|
||||
static const char *fragShaderText =
|
||||
"varying vec4 v_color;\n"
|
||||
"void main() {\n"
|
||||
" gl_FragColor = v_color;\n"
|
||||
"}\n";
|
||||
static const char *vertShaderText =
|
||||
"uniform mat4 modelviewProjection;\n"
|
||||
"attribute vec4 pos;\n"
|
||||
"attribute vec4 color;\n"
|
||||
"varying vec4 v_color;\n"
|
||||
"void main() {\n"
|
||||
" gl_Position = modelviewProjection * pos;\n"
|
||||
" v_color = color;\n"
|
||||
"}\n";
|
||||
|
||||
GLuint fragShader, vertShader, program;
|
||||
GLint stat;
|
||||
|
||||
fragShader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
glShaderSource(fragShader, 1, (const char **) &fragShaderText, NULL);
|
||||
glCompileShader(fragShader);
|
||||
glGetShaderiv(fragShader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
printf("Error: fragment shader did not compile!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
vertShader = glCreateShader(GL_VERTEX_SHADER);
|
||||
glShaderSource(vertShader, 1, (const char **) &vertShaderText, NULL);
|
||||
glCompileShader(vertShader);
|
||||
glGetShaderiv(vertShader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
printf("Error: vertex shader did not compile!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
program = glCreateProgram();
|
||||
glAttachShader(program, fragShader);
|
||||
glAttachShader(program, vertShader);
|
||||
glLinkProgram(program);
|
||||
|
||||
glGetProgramiv(program, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
char log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog(program, 1000, &len, log);
|
||||
printf("Error: linking:\n%s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glUseProgram(program);
|
||||
|
||||
if (1) {
|
||||
/* test setting attrib locations */
|
||||
glBindAttribLocation(program, attr_pos, "pos");
|
||||
glBindAttribLocation(program, attr_color, "color");
|
||||
glLinkProgram(program); /* needed to put attribs into effect */
|
||||
}
|
||||
else {
|
||||
/* test automatic attrib locations */
|
||||
attr_pos = glGetAttribLocation(program, "pos");
|
||||
attr_color = glGetAttribLocation(program, "color");
|
||||
}
|
||||
|
||||
u_matrix = glGetUniformLocation(program, "modelviewProjection");
|
||||
printf("Uniform modelviewProjection at %d\n", u_matrix);
|
||||
printf("Attrib pos at %d\n", attr_pos);
|
||||
printf("Attrib color at %d\n", attr_color);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
typedef void (*proc)();
|
||||
|
||||
#if 1 /* test code */
|
||||
proc p = eglGetProcAddress("eglCreateContext");
|
||||
assert(p);
|
||||
p = eglGetProcAddress("glMapBufferOES");
|
||||
assert(p);
|
||||
#endif
|
||||
|
||||
glClearColor(0.4, 0.4, 0.4, 0.0);
|
||||
|
||||
create_shaders();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create an RGB, double-buffered X window.
|
||||
* Return the window and context handles.
|
||||
*/
|
||||
static void
|
||||
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
|
||||
const char *name,
|
||||
int x, int y, int width, int height,
|
||||
Window *winRet,
|
||||
EGLContext *ctxRet,
|
||||
EGLSurface *surfRet)
|
||||
{
|
||||
static const EGLint attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_DEPTH_SIZE, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
static const EGLint ctx_attribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 2,
|
||||
EGL_NONE
|
||||
};
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
Window win;
|
||||
XVisualInfo *visInfo, visTemplate;
|
||||
int num_visuals;
|
||||
EGLContext ctx;
|
||||
EGLConfig config;
|
||||
EGLint num_configs;
|
||||
EGLint vid;
|
||||
|
||||
scrnum = DefaultScreen( x_dpy );
|
||||
root = RootWindow( x_dpy, scrnum );
|
||||
|
||||
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL visual config\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
assert(config);
|
||||
assert(num_configs > 0);
|
||||
|
||||
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
||||
printf("Error: eglGetConfigAttrib() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!visInfo) {
|
||||
printf("Error: couldn't get X visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
|
||||
0, visInfo->depth, InputOutput,
|
||||
visInfo->visual, mask, &attr );
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(x_dpy, win, &sizehints);
|
||||
XSetStandardProperties(x_dpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
#if USE_FULL_GL /* XXX fix this when eglBindAPI() works */
|
||||
eglBindAPI(EGL_OPENGL_API);
|
||||
#else
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
#endif
|
||||
|
||||
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs );
|
||||
if (!ctx) {
|
||||
printf("Error: eglCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* test eglQueryContext() */
|
||||
{
|
||||
EGLint val;
|
||||
eglQueryContext(egl_dpy, ctx, EGL_CONTEXT_CLIENT_VERSION, &val);
|
||||
assert(val == 2);
|
||||
}
|
||||
|
||||
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
|
||||
if (!*surfRet) {
|
||||
printf("Error: eglCreateWindowSurface failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
{
|
||||
EGLint val;
|
||||
eglQuerySurface(egl_dpy, *surfRet, EGL_WIDTH, &val);
|
||||
assert(val == width);
|
||||
eglQuerySurface(egl_dpy, *surfRet, EGL_HEIGHT, &val);
|
||||
assert(val == height);
|
||||
eglQuerySurface(egl_dpy, *surfRet, EGL_SURFACE_TYPE, &val);
|
||||
assert(val == EGL_WINDOW_BIT);
|
||||
}
|
||||
|
||||
XFree(visInfo);
|
||||
|
||||
*winRet = win;
|
||||
*ctxRet = ctx;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
event_loop(Display *dpy, Window win,
|
||||
EGLDisplay egl_dpy, EGLSurface egl_surf)
|
||||
{
|
||||
while (1) {
|
||||
int redraw = 0;
|
||||
XEvent event;
|
||||
|
||||
XNextEvent(dpy, &event);
|
||||
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
redraw = 1;
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
reshape(event.xconfigure.width, event.xconfigure.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
redraw = 1;
|
||||
break;
|
||||
default:
|
||||
; /*no-op*/
|
||||
}
|
||||
|
||||
if (redraw) {
|
||||
draw();
|
||||
eglSwapBuffers(egl_dpy, egl_surf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" -display <displayname> set the display to run on\n");
|
||||
printf(" -info display OpenGL renderer info\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const int winWidth = 300, winHeight = 300;
|
||||
Display *x_dpy;
|
||||
Window win;
|
||||
EGLSurface egl_surf;
|
||||
EGLContext egl_ctx;
|
||||
EGLDisplay egl_dpy;
|
||||
char *dpyName = NULL;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
EGLint egl_major, egl_minor;
|
||||
int i;
|
||||
const char *s;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-display") == 0) {
|
||||
dpyName = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-info") == 0) {
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
x_dpy = XOpenDisplay(dpyName);
|
||||
if (!x_dpy) {
|
||||
printf("Error: couldn't open display %s\n",
|
||||
dpyName ? dpyName : getenv("DISPLAY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
egl_dpy = eglGetDisplay(x_dpy);
|
||||
if (!egl_dpy) {
|
||||
printf("Error: eglGetDisplay() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
|
||||
printf("Error: eglInitialize() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VERSION);
|
||||
printf("EGL_VERSION = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VENDOR);
|
||||
printf("EGL_VENDOR = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
|
||||
printf("EGL_EXTENSIONS = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
|
||||
printf("EGL_CLIENT_APIS = %s\n", s);
|
||||
|
||||
make_x_window(x_dpy, egl_dpy,
|
||||
"OpenGL ES 2.x tri", 0, 0, winWidth, winHeight,
|
||||
&win, &egl_ctx, &egl_surf);
|
||||
|
||||
XMapWindow(x_dpy, win);
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (printInfo) {
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
/* Set initial projection/viewing transformation.
|
||||
* We can't be sure we'll get a ConfigureNotify event when the window
|
||||
* first appears.
|
||||
*/
|
||||
reshape(winWidth, winHeight);
|
||||
|
||||
event_loop(x_dpy, win, egl_dpy, egl_surf);
|
||||
|
||||
eglDestroyContext(egl_dpy, egl_ctx);
|
||||
eglDestroySurface(egl_dpy, egl_surf);
|
||||
eglTerminate(egl_dpy);
|
||||
|
||||
|
||||
XDestroyWindow(x_dpy, win);
|
||||
XCloseDisplay(x_dpy);
|
||||
|
||||
return 0;
|
||||
}
|
@@ -17,7 +17,6 @@ SOURCES = \
|
||||
tri-depth2.c \
|
||||
tri-depthwrite.c \
|
||||
tri-depthwrite2.c \
|
||||
tri-inv.c \
|
||||
tri-param.c \
|
||||
fp-tri.c
|
||||
|
||||
|
@@ -197,7 +197,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -57,7 +57,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -59,7 +59,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -55,7 +55,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -56,7 +56,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -54,7 +54,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -76,7 +76,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -31,7 +31,7 @@ void main()
|
||||
float iter;
|
||||
|
||||
// for (iter = 0.0; iter < MaxIterations && r2 < 4.0; ++iter)
|
||||
for (iter = 0.0; iter < 12.0 && r2 < 4.0; ++iter)
|
||||
for (iter = 0.0; iter < 12 && r2 < 4.0; ++iter)
|
||||
{
|
||||
float tempreal = real;
|
||||
|
||||
|
@@ -10,15 +10,16 @@ LIB_DEP = \
|
||||
$(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \
|
||||
$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
|
||||
|
||||
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) \
|
||||
-l$(GL_LIB) $(APP_LIB_DEPS)
|
||||
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
|
||||
|
||||
INCLUDE_DIRS = -I$(TOP)/progs/util
|
||||
|
||||
# using : to avoid APP_CC pointing to CC loop
|
||||
CC := $(APP_CC)
|
||||
CFLAGS := -I$(INCDIR) $(CFLAGS)
|
||||
LDLIBS = $(LIBS)
|
||||
CC:=$(APP_CC)
|
||||
CFLAGS += -I$(INCDIR)
|
||||
LDLIBS=$(LIBS)
|
||||
|
||||
PROG_SOURCES = \
|
||||
DEMO_SOURCES = \
|
||||
array.c \
|
||||
bitmap.c \
|
||||
brick.c \
|
||||
@@ -58,8 +59,8 @@ UTIL_SOURCES = \
|
||||
readtex.c
|
||||
|
||||
UTIL_OBJS = $(UTIL_SOURCES:.c=.o)
|
||||
PROG_OBJS = $(PROG_SOURCES:.c=.o)
|
||||
PROGS = $(PROG_SOURCES:%.c=%)
|
||||
PROG_OBJS = $(DEMO_SOURCES:.c=.o)
|
||||
PROGS = $(DEMO_SOURCES:%.c=%)
|
||||
|
||||
##### TARGETS #####
|
||||
|
||||
|
@@ -36,7 +36,7 @@ static GLint win = 0;
|
||||
|
||||
static GLfloat xRot = 20.0f, yRot = 0.0f, zRot = 0.0f;
|
||||
|
||||
static GLint tangentAttrib;
|
||||
static GLuint tangentAttrib;
|
||||
|
||||
static GLboolean Anim = GL_FALSE;
|
||||
|
||||
|
@@ -369,7 +369,7 @@ static void keyPress(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(0);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
@@ -140,7 +140,6 @@ MakeSphere(void)
|
||||
glNewList(SphereList, GL_COMPILE);
|
||||
gluSphere(obj, 2.0f, 30, 15);
|
||||
glEndList();
|
||||
gluDeleteQuadric(obj);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -22,22 +22,22 @@ static const char *FragShaderText[ 4 ] = {
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].w ) * 0.5 + 0.5;\n"
|
||||
" gl_FragColor.a = 1.0;\n"
|
||||
" gl_FragColor.a = 1;\n"
|
||||
"}\n",
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xw ) * 0.5 + 0.5;\n"
|
||||
" gl_FragColor.a = 1.0;\n"
|
||||
" gl_FragColor.a = 1;\n"
|
||||
"}\n",
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xyw ) * 0.5 + 0.5;\n"
|
||||
" gl_FragColor.a = 1.0;\n"
|
||||
" gl_FragColor.a = 1;\n"
|
||||
"}\n",
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_FragColor.rgb = noise3( gl_TexCoord[ 0 ].xyzw ) * 0.5 + 0.5;\n"
|
||||
" gl_FragColor.a = 1.0;\n"
|
||||
" gl_FragColor.a = 1;\n"
|
||||
"}\n"
|
||||
};
|
||||
|
||||
@@ -125,7 +125,6 @@ Key(unsigned char key, int x, int y)
|
||||
case 'a':
|
||||
Anim = !Anim;
|
||||
glutIdleFunc(Anim ? Idle : NULL);
|
||||
break;
|
||||
case 's':
|
||||
Slice -= step;
|
||||
break;
|
||||
@@ -194,7 +193,7 @@ LoadAndCompileShader(GLuint shader, const char *text)
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog(shader, 1000, &len, log);
|
||||
fprintf(stderr, "multinoise: problem compiling shader: %s\n", log);
|
||||
fprintf(stderr, "noise: problem compiling shader: %s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
|
@@ -28,7 +28,7 @@ static const char *FragShaderText =
|
||||
" vec4 p;\n"
|
||||
" p.xy = gl_TexCoord[0].xy;\n"
|
||||
" p.z = Slice;\n"
|
||||
" p.w = 0.0;\n"
|
||||
" p.w = 0;\n"
|
||||
" vec4 n = noise4(p * scale);\n"
|
||||
" gl_FragColor = n * Scale + Bias;\n"
|
||||
"}\n";
|
||||
@@ -119,7 +119,6 @@ Key(unsigned char key, int x, int y)
|
||||
case 'a':
|
||||
Anim = !Anim;
|
||||
glutIdleFunc(Anim ? Idle : NULL);
|
||||
break;
|
||||
case 's':
|
||||
Slice -= step;
|
||||
break;
|
||||
|
@@ -16,9 +16,6 @@
|
||||
#include <GL/glut.h>
|
||||
#include "shaderutil.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.1415926535
|
||||
#endif
|
||||
|
||||
static char *FragProgFile = "skinning.frag";
|
||||
static char *VertProgFile = "skinning.vert";
|
||||
|
@@ -14,9 +14,6 @@
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.1415926535
|
||||
#endif
|
||||
|
||||
static GLint WinWidth = 300, WinHeight = 300;
|
||||
static GLint win = 0;
|
||||
|
@@ -179,9 +179,9 @@ Init(void)
|
||||
"\n"
|
||||
"void main() {\n"
|
||||
" vec2 p = gl_FragCoord.xy; \n"
|
||||
" if (crs(v1 - v0, p - v0) >= 0.0 && \n"
|
||||
" crs(v2 - v1, p - v1) >= 0.0 && \n"
|
||||
" crs(v0 - v2, p - v2) >= 0.0) \n"
|
||||
" if (crs(v1 - v0, p - v0) >= 0 && \n"
|
||||
" crs(v2 - v1, p - v1) >= 0 && \n"
|
||||
" crs(v0 - v2, p - v2) >= 0) \n"
|
||||
" gl_FragColor = vec4(1.0); \n"
|
||||
" else \n"
|
||||
" gl_FragColor = vec4(0.5); \n"
|
||||
|
@@ -16,9 +16,6 @@
|
||||
#include <GL/glut.h>
|
||||
#include "shaderutil.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.1415926535
|
||||
#endif
|
||||
|
||||
static GLint WinWidth = 300, WinHeight = 300;
|
||||
static char *FragProgFile = NULL;
|
||||
|
@@ -56,7 +56,7 @@ static float rotAngle = 0.;
|
||||
* at RAMP1START, and a blue color ramp starting
|
||||
* at RAMP2START. The ramps must be a multiple of 16.
|
||||
*/
|
||||
static void init(void)
|
||||
void init(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -76,7 +76,7 @@ static void init(void)
|
||||
|
||||
/* Draw 2 diagonal lines to form an X
|
||||
*/
|
||||
static void display(void)
|
||||
void display(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
@@ -101,7 +101,7 @@ static void display(void)
|
||||
glFlush();
|
||||
}
|
||||
|
||||
static void reshape(int w, int h)
|
||||
void reshape(int w, int h)
|
||||
{
|
||||
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
@@ -117,7 +117,7 @@ static void reshape(int w, int h)
|
||||
}
|
||||
|
||||
/* ARGSUSED1 */
|
||||
static void keyboard(unsigned char key, int x, int y)
|
||||
void keyboard(unsigned char key, int x, int y)
|
||||
{
|
||||
switch (key) {
|
||||
case 'r':
|
||||
|
@@ -116,8 +116,6 @@ void init(void)
|
||||
glNewList(startList+3, GL_COMPILE);
|
||||
gluPartialDisk(qobj, 0.0, 1.0, 20, 4, 0.0, 225.0);
|
||||
glEndList();
|
||||
|
||||
gluDeleteQuadric(qobj);
|
||||
}
|
||||
|
||||
void display(void)
|
||||
|
@@ -10,7 +10,7 @@ LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(T
|
||||
LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
|
||||
|
||||
PROGS = accum bitmap1 bitmap2 blendeq blendxor copy cursor depth eval fog \
|
||||
font line logo nurb olympic overlay point prim rgbtoppm quad select \
|
||||
font line logo nurb olympic overlay point prim quad select \
|
||||
shape sphere star stencil stretch texture tri wave
|
||||
|
||||
|
||||
|
@@ -86,19 +86,13 @@ static ImageRec *ImageOpen(char *fileName)
|
||||
exit(1);
|
||||
}
|
||||
if ((image->file = fopen(fileName, "rb")) == NULL) {
|
||||
free(image);
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fread(image, 1, 12, image->file);
|
||||
|
||||
if (swapFlag) {
|
||||
ConvertShort(&image->imagic, 1);
|
||||
ConvertShort(&image->type, 1);
|
||||
ConvertShort(&image->dim, 1);
|
||||
ConvertShort(&image->xsize, 1);
|
||||
ConvertShort(&image->ysize, 1);
|
||||
ConvertShort(&image->zsize, 1);
|
||||
ConvertShort(&image->imagic, 6);
|
||||
}
|
||||
|
||||
image->tmp = (unsigned char *)malloc(image->xsize*256);
|
||||
@@ -230,7 +224,6 @@ read_rgb_texture(char *name, int *width, int *height)
|
||||
if (gbuf) free(gbuf);
|
||||
if (bbuf) free(bbuf);
|
||||
if (abuf) free(abuf);
|
||||
ImageClose(image);
|
||||
return NULL;
|
||||
}
|
||||
ptr = base;
|
||||
|
@@ -25,11 +25,9 @@ SOURCES = \
|
||||
arbvptorus.c \
|
||||
arbvpwarpmesh.c \
|
||||
arraytexture.c \
|
||||
auxbuffer.c \
|
||||
blendminmax.c \
|
||||
blendsquare.c \
|
||||
blendxor.c \
|
||||
blitfb.c \
|
||||
bufferobj.c \
|
||||
bumpmap.c \
|
||||
bug_3050.c \
|
||||
@@ -42,7 +40,6 @@ SOURCES = \
|
||||
cva.c \
|
||||
drawbuffers.c \
|
||||
exactrast.c \
|
||||
ext422square.c \
|
||||
floattex.c \
|
||||
fbotest1.c \
|
||||
fbotest2.c \
|
||||
@@ -68,8 +65,6 @@ SOURCES = \
|
||||
mipmap_limits.c \
|
||||
mipmap_view.c \
|
||||
multipal.c \
|
||||
multitexarray.c \
|
||||
multiwindow.c \
|
||||
no_s3tc.c \
|
||||
packedpixels.c \
|
||||
pbo.c \
|
||||
@@ -92,12 +87,10 @@ SOURCES = \
|
||||
subtex \
|
||||
subtexrate.c \
|
||||
tex1d.c \
|
||||
texcmp.c \
|
||||
texcompress2.c \
|
||||
texcompsub.c \
|
||||
texdown \
|
||||
texfilt.c \
|
||||
texgenmix.c \
|
||||
texline.c \
|
||||
texobj.c \
|
||||
texobjshare.c \
|
||||
@@ -107,7 +100,6 @@ SOURCES = \
|
||||
vao-01.c \
|
||||
vao-02.c \
|
||||
vparray.c \
|
||||
vpeval.c \
|
||||
vptest1.c \
|
||||
vptest2.c \
|
||||
vptest3.c \
|
||||
|
@@ -52,7 +52,6 @@ progs = [
|
||||
'blendminmax',
|
||||
'blendsquare',
|
||||
'blendxor',
|
||||
'blitfb',
|
||||
'bufferobj',
|
||||
'bug_3050',
|
||||
'bug_3101',
|
||||
|
@@ -77,6 +77,10 @@ static GLfloat texZ = 0.0;
|
||||
static GLfloat texZ_dir = 0.01;
|
||||
static GLint num_layers;
|
||||
|
||||
static PFNGLBINDPROGRAMARBPROC bind_program;
|
||||
static PFNGLPROGRAMSTRINGARBPROC program_string;
|
||||
static PFNGLGENPROGRAMSARBPROC gen_programs;
|
||||
|
||||
|
||||
static void
|
||||
PrintString(const char *s)
|
||||
@@ -121,13 +125,13 @@ static void Display(void)
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0);
|
||||
(*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0);
|
||||
glColor3f(1,1,1);
|
||||
glRasterPos3f(-0.9, -0.9, 0.0);
|
||||
sprintf(str, "Texture Z coordinate = %4.1f", texZ);
|
||||
PrintString(str);
|
||||
|
||||
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 1);
|
||||
(*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 1);
|
||||
GL_CHECK_ERROR();
|
||||
glEnable(GL_TEXTURE_2D_ARRAY_EXT);
|
||||
GL_CHECK_ERROR();
|
||||
@@ -155,7 +159,7 @@ static void Display(void)
|
||||
|
||||
glDisable(GL_TEXTURE_2D_ARRAY_EXT);
|
||||
GL_CHECK_ERROR();
|
||||
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0);
|
||||
(*bind_program)(GL_FRAGMENT_PROGRAM_ARB, 0);
|
||||
GL_CHECK_ERROR();
|
||||
|
||||
glutSwapBuffers();
|
||||
@@ -222,8 +226,8 @@ compile_fragment_program(GLuint id, const char *prog)
|
||||
int err;
|
||||
|
||||
err = glGetError();
|
||||
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, id);
|
||||
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
|
||||
(*bind_program)(GL_FRAGMENT_PROGRAM_ARB, id);
|
||||
(*program_string)(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
|
||||
strlen(prog), (const GLubyte *) prog);
|
||||
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errorPos);
|
||||
@@ -260,6 +264,11 @@ static void Init(void)
|
||||
require_extension("GL_MESA_texture_array");
|
||||
require_extension("GL_SGIS_generate_mipmap");
|
||||
|
||||
bind_program = glutGetProcAddress("glBindProgramARB");
|
||||
program_string = glutGetProcAddress("glProgramStringARB");
|
||||
gen_programs = glutGetProcAddress("glGenProgramsARB");
|
||||
|
||||
|
||||
for (num_layers = 0; textures[num_layers] != NULL; num_layers++)
|
||||
/* empty */ ;
|
||||
|
||||
|
@@ -1,259 +0,0 @@
|
||||
/**
|
||||
* Test glFramebufferBlit()
|
||||
* Brian Paul
|
||||
* 27 Oct 2009
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
static int Win;
|
||||
static int WinWidth = 1100, WinHeight = 600;
|
||||
|
||||
static int SrcWidth = 512, SrcHeight = 512;
|
||||
static int DstWidth = 512, DstHeight = 512;
|
||||
|
||||
static GLuint SrcFB, DstFB;
|
||||
static GLuint SrcTex, DstTex;
|
||||
|
||||
#if 0
|
||||
static GLenum SrcTexTarget = GL_TEXTURE_2D, SrcTexFace = GL_TEXTURE_2D;
|
||||
#else
|
||||
static GLenum SrcTexTarget = GL_TEXTURE_CUBE_MAP, SrcTexFace = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
|
||||
#endif
|
||||
|
||||
static GLenum DstTexTarget = GL_TEXTURE_2D, DstTexFace = GL_TEXTURE_2D;
|
||||
|
||||
static GLuint SrcTexLevel = 01, DstTexLevel = 0;
|
||||
|
||||
|
||||
static void
|
||||
Draw(void)
|
||||
{
|
||||
GLboolean rp = GL_FALSE;
|
||||
GLubyte *buf;
|
||||
GLint srcWidth = SrcWidth >> SrcTexLevel;
|
||||
GLint srcHeight = SrcHeight >> SrcTexLevel;
|
||||
GLint dstWidth = DstWidth >> DstTexLevel;
|
||||
GLint dstHeight = DstHeight >> DstTexLevel;
|
||||
GLenum status;
|
||||
|
||||
/* clear window */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
|
||||
glClearColor(0.5, 0.5, 0.5, 1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
|
||||
/* clear src buf */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER, SrcFB);
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
assert(status == GL_FRAMEBUFFER_COMPLETE_EXT);
|
||||
glClearColor(0, 1, 0, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
/* clear dst buf */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER, DstFB);
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
assert(status == GL_FRAMEBUFFER_COMPLETE_EXT);
|
||||
glClearColor(1, 0, 0, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
/* blit src -> dst */
|
||||
glBindFramebufferEXT(GL_READ_FRAMEBUFFER, SrcFB);
|
||||
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, DstFB);
|
||||
glBlitFramebufferEXT(0, 0, srcWidth, srcHeight,
|
||||
0, 0, dstWidth, dstHeight,
|
||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
|
||||
#if 01
|
||||
/* read src results */
|
||||
buf = malloc(4 * srcWidth * srcHeight);
|
||||
memset(buf, 0x88, 4 * srcWidth * srcHeight);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER, SrcFB);
|
||||
if (rp)
|
||||
glReadPixels(0, 0, srcWidth, srcHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf);
|
||||
else {
|
||||
glBindTexture(SrcTexTarget, SrcTex);
|
||||
glGetTexImage(SrcTexFace, SrcTexLevel, GL_RGBA, GL_UNSIGNED_BYTE, buf);
|
||||
}
|
||||
|
||||
/* draw dst in window */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
|
||||
glWindowPos2i(0, 0);
|
||||
glDrawPixels(srcWidth, srcHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf);
|
||||
|
||||
printf("Src Pix[0] = %d %d %d %d\n", buf[0], buf[1], buf[2], buf[3]);
|
||||
free(buf);
|
||||
#endif
|
||||
|
||||
glFinish();
|
||||
|
||||
/* read dst results */
|
||||
buf = malloc(4 * dstWidth * dstHeight);
|
||||
memset(buf, 0x88, 4 * dstWidth * dstHeight);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER, DstFB);
|
||||
if (rp)
|
||||
glReadPixels(0, 0, dstWidth, dstHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf);
|
||||
else {
|
||||
glBindTexture(DstTexTarget, DstTex);
|
||||
glGetTexImage(DstTexFace, DstTexLevel, GL_RGBA, GL_UNSIGNED_BYTE, buf);
|
||||
}
|
||||
|
||||
/* draw dst in window */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER, 0);
|
||||
glWindowPos2i(srcWidth + 2, 0);
|
||||
glDrawPixels(dstWidth, dstHeight, GL_RGBA, GL_UNSIGNED_BYTE, buf);
|
||||
|
||||
printf("Dst Pix[0] = %d %d %d %d\n", buf[0], buf[1], buf[2], buf[3]);
|
||||
free(buf);
|
||||
|
||||
glFinish();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape(int width, int height)
|
||||
{
|
||||
WinWidth = width;
|
||||
WinHeight = height;
|
||||
glViewport(0, 0, width, height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-1.0, 1.0, -1.0, 1.0, 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:
|
||||
glutDestroyWindow(Win);
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
SpecialKey(int key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
InitFBOs(void)
|
||||
{
|
||||
GLuint w, h, lvl;
|
||||
|
||||
/* Src */
|
||||
glGenTextures(1, &SrcTex);
|
||||
glBindTexture(SrcTexTarget, SrcTex);
|
||||
w = SrcWidth;
|
||||
h = SrcHeight;
|
||||
lvl = 0;
|
||||
for (lvl = 0; ; lvl++) {
|
||||
if (SrcTexTarget == GL_TEXTURE_CUBE_MAP) {
|
||||
GLuint f;
|
||||
for (f = 0; f < 6; f++) {
|
||||
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, lvl, GL_RGBA8,
|
||||
w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* single face */
|
||||
glTexImage2D(SrcTexFace, lvl, GL_RGBA8, w, h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
}
|
||||
if (w == 1 && h == 1)
|
||||
break;
|
||||
if (w > 1)
|
||||
w /= 2;
|
||||
if (h > 1)
|
||||
h /= 2;
|
||||
}
|
||||
|
||||
glGenFramebuffersEXT(1, &SrcFB);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER, SrcFB);
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
SrcTexFace, SrcTex, SrcTexLevel);
|
||||
|
||||
/* Dst */
|
||||
glGenTextures(1, &DstTex);
|
||||
glBindTexture(DstTexTarget, DstTex);
|
||||
w = DstWidth;
|
||||
h = DstHeight;
|
||||
lvl = 0;
|
||||
for (lvl = 0; ; lvl++) {
|
||||
glTexImage2D(DstTexFace, lvl, GL_RGBA8, w, h, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
if (w == 1 && h == 1)
|
||||
break;
|
||||
if (w > 1)
|
||||
w /= 2;
|
||||
if (h > 1)
|
||||
h /= 2;
|
||||
}
|
||||
|
||||
glGenFramebuffersEXT(1, &DstFB);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER, DstFB);
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
DstTexFace, DstTex, DstTexLevel);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
|
||||
fprintf(stderr, "This test requires GL_EXT_framebuffer_object\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!glutExtensionSupported("GL_EXT_framebuffer_blit")) {
|
||||
fprintf(stderr, "This test requires GL_EXT_framebuffer_blit,\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
InitFBOs();
|
||||
|
||||
printf("Left rect = src FBO, Right rect = dst FBO.\n");
|
||||
printf("Both should be green.\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
glutDisplayFunc(Draw);
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
@@ -69,7 +69,7 @@ DrawTestImage(void)
|
||||
static int
|
||||
Rand(int max)
|
||||
{
|
||||
return ((int) rand()) % max;
|
||||
return ((int) random()) % max;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -145,7 +145,7 @@ static void Init( void )
|
||||
{
|
||||
const char * const ver_string = (const char * const)
|
||||
glGetString( GL_VERSION );
|
||||
float ver = strtod( ver_string, NULL );
|
||||
float ver = strtof( ver_string, NULL );
|
||||
GLint tex_units;
|
||||
GLint temp[ 256 ];
|
||||
|
||||
|
@@ -39,7 +39,7 @@ GLboolean compiled = GL_TRUE;
|
||||
GLboolean doubleBuffer = GL_TRUE;
|
||||
|
||||
|
||||
static void init( void )
|
||||
void init( void )
|
||||
{
|
||||
glClearColor( 0.0, 0.0, 0.0, 0.0 );
|
||||
glShadeModel( GL_SMOOTH );
|
||||
@@ -69,7 +69,7 @@ static void init( void )
|
||||
#endif
|
||||
}
|
||||
|
||||
static void display( void )
|
||||
void display( void )
|
||||
{
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
|
||||
@@ -81,7 +81,7 @@ static void display( void )
|
||||
}
|
||||
}
|
||||
|
||||
static void keyboard( unsigned char key, int x, int y )
|
||||
void keyboard( unsigned char key, int x, int y )
|
||||
{
|
||||
switch ( key ) {
|
||||
case 27:
|
||||
@@ -92,7 +92,7 @@ static void keyboard( unsigned char key, int x, int y )
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
static GLboolean args( int argc, char **argv )
|
||||
GLboolean args( int argc, char **argv )
|
||||
{
|
||||
GLint i;
|
||||
|
||||
|
@@ -43,8 +43,6 @@ Display(void)
|
||||
|
||||
glUseProgram_func(Program);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
/* draw to user framebuffer */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, FBobject);
|
||||
|
||||
@@ -70,23 +68,18 @@ Display(void)
|
||||
glPopMatrix();
|
||||
|
||||
/* read from user framebuffer */
|
||||
/* left half = colorbuffer 0 */
|
||||
/* bottom half = colorbuffer 0 */
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
|
||||
glPixelStorei(GL_PACK_ROW_LENGTH, Width);
|
||||
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
|
||||
glReadPixels(0, 0, Width / 2, Height, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
glReadPixels(0, 0, Width, Height / 2, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
buffer);
|
||||
|
||||
/* right half = colorbuffer 1 */
|
||||
/* top half = colorbuffer 1 */
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
|
||||
glPixelStorei(GL_PACK_SKIP_PIXELS, Width / 2);
|
||||
glReadPixels(Width / 2, 0, Width - Width / 2, Height,
|
||||
glReadPixels(0, Height/2, Width, Height - Height / 2,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
buffer);
|
||||
buffer + Width * (Height / 2) * 4);
|
||||
|
||||
/* draw to window */
|
||||
glUseProgram_func(0);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glWindowPos2iARB(0, 0);
|
||||
glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
|
@@ -128,7 +128,7 @@ static void Init( void )
|
||||
{
|
||||
const char * const ver_string = (const char * const)
|
||||
glGetString( GL_VERSION );
|
||||
const float ver = strtod( ver_string, NULL );
|
||||
const float ver = strtof( ver_string, NULL );
|
||||
|
||||
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
@@ -285,12 +285,6 @@ main(int argc, char** argv)
|
||||
glutInitWindowSize (600, 600);
|
||||
glutCreateWindow (argv[0]);
|
||||
glewInit();
|
||||
|
||||
if (!glutExtensionSupported("GL_EXT_texture_compression_s3tc")) {
|
||||
fprintf(stderr, "This test requires GL_EXT_texture_compression_s3tc.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
myInit();
|
||||
glutReshapeFunc (myReshape);
|
||||
glutDisplayFunc(display);
|
||||
|
@@ -116,7 +116,7 @@ static int set_parameter_batch( GLsizei count, GLfloat * param,
|
||||
|
||||
|
||||
for ( i = 0 ; i < (4 * count) ; i++ ) {
|
||||
param[i] = (GLfloat) rand() / (GLfloat) rand();
|
||||
param[i] = (GLfloat) random() / (GLfloat) random();
|
||||
}
|
||||
|
||||
/* Try using the "classic" interface.
|
||||
@@ -153,7 +153,7 @@ static int set_parameter_batch( GLsizei count, GLfloat * param,
|
||||
|
||||
|
||||
for ( i = 0 ; i < (4 * count) ; i++ ) {
|
||||
param[i] = (GLfloat) rand() / (GLfloat) rand();
|
||||
param[i] = (GLfloat) random() / (GLfloat) random();
|
||||
}
|
||||
|
||||
printf("Testing glProgram%sParameters4fvEXT (count = %u)...\n", name, count);
|
||||
@@ -192,7 +192,6 @@ static void Init( void )
|
||||
GLfloat * params;
|
||||
GLint max_program_env_parameters;
|
||||
GLint max_program_local_parameters;
|
||||
int i;
|
||||
|
||||
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
@@ -204,20 +203,20 @@ static void Init( void )
|
||||
}
|
||||
|
||||
|
||||
program_local_parameter4fv = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) glutGetProcAddress( "glProgramLocalParameter4fvARB" );
|
||||
program_env_parameter4fv = (PFNGLPROGRAMENVPARAMETER4FVARBPROC) glutGetProcAddress( "glProgramEnvParameter4fvARB" );
|
||||
program_local_parameter4fv = glutGetProcAddress( "glProgramLocalParameter4fvARB" );
|
||||
program_env_parameter4fv = glutGetProcAddress( "glProgramEnvParameter4fvARB" );
|
||||
|
||||
get_program_local_parameterfv = (PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) glutGetProcAddress( "glGetProgramLocalParameterfvARB" );
|
||||
get_program_env_parameterfv = (PFNGLGETPROGRAMENVPARAMETERFVARBPROC) glutGetProcAddress( "glGetProgramEnvParameterfvARB" );
|
||||
get_program_local_parameterfv = glutGetProcAddress( "glGetProgramLocalParameterfvARB" );
|
||||
get_program_env_parameterfv = glutGetProcAddress( "glGetProgramEnvParameterfvARB" );
|
||||
|
||||
bind_program = (PFNGLBINDPROGRAMARBPROC) glutGetProcAddress( "glBindProgramARB" );
|
||||
get_program = (PFNGLGETPROGRAMIVARBPROC) glutGetProcAddress( "glGetProgramivARB" );
|
||||
bind_program = glutGetProcAddress( "glBindProgramARB" );
|
||||
get_program = glutGetProcAddress( "glGetProgramivARB" );
|
||||
|
||||
if ( glutExtensionSupported("GL_EXT_gpu_program_parameters") ) {
|
||||
printf("GL_EXT_gpu_program_parameters available, testing that path.\n");
|
||||
|
||||
program_local_parameters4fv = (PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) glutGetProcAddress( "glProgramLocalParameters4fvEXT" );
|
||||
program_env_parameters4fv = (PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) glutGetProcAddress( "glProgramEnvParameters4fvEXT" );
|
||||
program_local_parameters4fv = glutGetProcAddress( "glProgramLocalParameters4fvEXT" );
|
||||
program_env_parameters4fv = glutGetProcAddress( "glProgramEnvParameters4fvEXT" );
|
||||
}
|
||||
else {
|
||||
printf("GL_EXT_gpu_program_parameters not available.\n");
|
||||
@@ -239,10 +238,6 @@ static void Init( void )
|
||||
|
||||
params = malloc(max_program_env_parameters * 4 * sizeof(GLfloat));
|
||||
|
||||
for (i = 0; i < max_program_env_parameters * 4; i++) {
|
||||
params[i] = 0.0F;
|
||||
}
|
||||
|
||||
pass &= set_parameter_batch(max_program_env_parameters, params, "Env",
|
||||
program_env_parameter4fv,
|
||||
program_env_parameters4fv,
|
||||
|
@@ -257,11 +257,11 @@ RandomPrimitive(void)
|
||||
Vcount++;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
int k = RandomInt(9);
|
||||
Vbuffer[Vcount].v[0] = RandomFloat(-3, 3);
|
||||
Vbuffer[Vcount].v[1] = RandomFloat(-3, 3);
|
||||
Vbuffer[Vcount].v[2] = RandomFloat(-3, 3);
|
||||
Vbuffer[Vcount].v[3] = RandomFloat(-3, 3);
|
||||
int k = RandomInt(9);
|
||||
switch (k) {
|
||||
case 0:
|
||||
glVertex2fv(Vbuffer[Vcount].v);
|
||||
|
@@ -8,10 +8,6 @@
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
static void assert_test(const char *file, int line, int cond, const char *msg)
|
||||
{
|
||||
if (!cond)
|
||||
@@ -46,7 +42,7 @@ static void assert_error_test(const char *file, int line, GLenum expect)
|
||||
|
||||
#define assert_error(err) assert_error_test(__FILE__, __LINE__, (err))
|
||||
|
||||
static void check_status(GLuint id, GLenum pname, void (APIENTRY *query)(GLuint, GLenum, GLint *))
|
||||
static void check_status(GLuint id, GLenum pname, void (*query)(GLuint, GLenum, GLint *))
|
||||
{
|
||||
GLint status;
|
||||
|
||||
|
@@ -274,9 +274,9 @@ static void Init( void )
|
||||
if (atof( ver_string ) < 2.0) {
|
||||
use20syntax = 0;
|
||||
}
|
||||
stencil_func_separate = (PFNGLSTENCILFUNCSEPARATEPROC) glutGetProcAddress( "glStencilFuncSeparate" );
|
||||
stencil_func_separate_ati = (PFNGLSTENCILFUNCSEPARATEATIPROC) glutGetProcAddress( "glStencilFuncSeparateATI" );
|
||||
stencil_op_separate = (PFNGLSTENCILOPSEPARATEPROC) glutGetProcAddress( "glStencilOpSeparate" );
|
||||
stencil_func_separate = glutGetProcAddress( "glStencilFuncSeparate" );
|
||||
stencil_func_separate_ati = glutGetProcAddress( "glStencilFuncSeparateATI" );
|
||||
stencil_op_separate = glutGetProcAddress( "glStencilOpSeparate" );
|
||||
|
||||
printf("\nAll 5 squares should be the same color.\n");
|
||||
}
|
||||
|
@@ -149,7 +149,7 @@ static void Reshape( int width, int height )
|
||||
|
||||
static void ReInit( GLenum TC, TEXTURE *Tx )
|
||||
{
|
||||
GLint rv, v;
|
||||
GLint rv;
|
||||
|
||||
if ((Tx->TC == TC) && (Tx->cData != NULL)) {
|
||||
glCompressedTexImage2DARB(GL_TEXTURE_2D, /* target */
|
||||
@@ -170,12 +170,6 @@ static void ReInit( GLenum TC, TEXTURE *Tx )
|
||||
GL_UNSIGNED_BYTE, /* texture type */
|
||||
Tx->data); /* the texture */
|
||||
|
||||
|
||||
v = 0;
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
|
||||
GL_TEXTURE_INTERNAL_FORMAT, &v);
|
||||
printf("Requested internal format = 0x%x, actual = 0x%x\n", TC, v);
|
||||
|
||||
/* okay, now cache the compressed texture */
|
||||
Tx->TC = TC;
|
||||
if (Tx->cData != NULL) {
|
||||
|
@@ -162,7 +162,7 @@ MeasureDownloadRate(void)
|
||||
const int image_bytes = align(w * h * BytesPerTexel(Format), ALIGN);
|
||||
const int bytes = image_bytes * NR_TEXOBJ;
|
||||
GLubyte *orig_texImage, *orig_getImage;
|
||||
GLubyte *texImage;
|
||||
GLubyte *texImage, *getImage;
|
||||
GLdouble t0, t1, time;
|
||||
int count;
|
||||
int i;
|
||||
@@ -176,14 +176,13 @@ MeasureDownloadRate(void)
|
||||
orig_getImage = (GLubyte *) malloc(image_bytes + ALIGN);
|
||||
if (!orig_texImage || !orig_getImage) {
|
||||
DownloadRate = 0.0;
|
||||
free(orig_texImage);
|
||||
free(orig_getImage);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("alloc %p %p\n", orig_texImage, orig_getImage);
|
||||
|
||||
texImage = (GLubyte *)align((unsigned long)orig_texImage, ALIGN);
|
||||
getImage = (GLubyte *)align((unsigned long)orig_getImage, ALIGN);
|
||||
|
||||
for (i = 1; !(((unsigned long)texImage) & i); i<<=1)
|
||||
;
|
||||
|
@@ -124,10 +124,10 @@ static void Init( void )
|
||||
exit(2);
|
||||
}
|
||||
|
||||
bind_vertex_array = (PFNGLBINDVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glBindVertexArrayAPPLE" );
|
||||
gen_vertex_arrays = (PFNGLGENVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glGenVertexArraysAPPLE" );
|
||||
delete_vertex_arrays = (PFNGLDELETEVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glDeleteVertexArraysAPPLE" );
|
||||
is_vertex_array = (PFNGLISVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glIsVertexArrayAPPLE" );
|
||||
bind_vertex_array = glutGetProcAddress( "glBindVertexArrayAPPLE" );
|
||||
gen_vertex_arrays = glutGetProcAddress( "glGenVertexArraysAPPLE" );
|
||||
delete_vertex_arrays = glutGetProcAddress( "glDeleteVertexArraysAPPLE" );
|
||||
is_vertex_array = glutGetProcAddress( "glIsVertexArrayAPPLE" );
|
||||
|
||||
|
||||
(*gen_vertex_arrays)( 1, & obj );
|
||||
|
@@ -125,10 +125,10 @@ static void Init( void )
|
||||
exit(2);
|
||||
}
|
||||
|
||||
bind_vertex_array = (PFNGLBINDVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glBindVertexArrayAPPLE" );
|
||||
gen_vertex_arrays = (PFNGLGENVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glGenVertexArraysAPPLE" );
|
||||
delete_vertex_arrays = (PFNGLDELETEVERTEXARRAYSAPPLEPROC) glutGetProcAddress( "glDeleteVertexArraysAPPLE" );
|
||||
is_vertex_array = (PFNGLISVERTEXARRAYAPPLEPROC) glutGetProcAddress( "glIsVertexArrayAPPLE" );
|
||||
bind_vertex_array = glutGetProcAddress( "glBindVertexArrayAPPLE" );
|
||||
gen_vertex_arrays = glutGetProcAddress( "glGenVertexArraysAPPLE" );
|
||||
delete_vertex_arrays = glutGetProcAddress( "glDeleteVertexArraysAPPLE" );
|
||||
is_vertex_array = glutGetProcAddress( "glIsVertexArrayAPPLE" );
|
||||
|
||||
|
||||
(*gen_vertex_arrays)( 1, & obj );
|
||||
|
@@ -94,16 +94,16 @@ GLfloat colorPoints[4][4][4] =
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
void
|
||||
initlights(void)
|
||||
{
|
||||
#if 0 /* no lighting for now */
|
||||
GLfloat ambient[] = {0.2, 0.2, 0.2, 1.0};
|
||||
GLfloat position[] = {0.0, 0.0, 2.0, 1.0};
|
||||
GLfloat mat_diffuse[] = {0.6, 0.6, 0.6, 1.0};
|
||||
GLfloat mat_specular[] = {1.0, 1.0, 1.0, 1.0};
|
||||
GLfloat mat_shininess[] = {50.0};
|
||||
|
||||
#if 0 /* no lighting for now */
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
||||
@@ -116,7 +116,7 @@ initlights(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
display(void)
|
||||
{
|
||||
glClearColor(.3, .3, .3, 0);
|
||||
@@ -130,7 +130,7 @@ display(void)
|
||||
glFlush();
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
myinit(int argc, char *argv[])
|
||||
{
|
||||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||
@@ -186,7 +186,7 @@ myinit(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
myReshape(int w, int h)
|
||||
{
|
||||
glViewport(0, 0, w, h);
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include <GL/glut.h>
|
||||
|
||||
static GLint WinWidth = 500, WinHeight = 500;
|
||||
static GLboolean Invert = GL_FALSE;
|
||||
|
||||
|
||||
static void Display(void)
|
||||
@@ -50,7 +51,15 @@ static void Display(void)
|
||||
glPixelZoom(4.0, 4.0);
|
||||
glColor4f(1, 0, 0, 0);
|
||||
glWindowPos2i(100, 0);
|
||||
if (Invert) {
|
||||
glPixelTransferf(GL_DEPTH_SCALE, -1.0);
|
||||
glPixelTransferf(GL_DEPTH_BIAS, 1.0);
|
||||
}
|
||||
glDrawPixels(100, 100, GL_DEPTH_COMPONENT, GL_FLOAT, depth);
|
||||
if (Invert) {
|
||||
glPixelTransferf(GL_DEPTH_SCALE, 1.0);
|
||||
glPixelTransferf(GL_DEPTH_BIAS, 0.0);
|
||||
}
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
@@ -77,6 +86,9 @@ static void Key(unsigned char key, int x, int y)
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 'i':
|
||||
Invert = !Invert;
|
||||
break;
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
|
@@ -88,7 +88,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -73,7 +73,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -61,7 +61,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(0);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -38,7 +38,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(0);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -62,7 +62,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -87,7 +87,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -74,7 +74,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -76,7 +76,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -81,7 +81,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -93,7 +93,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
@@ -103,7 +103,7 @@ static void Key(unsigned char key, int x, int y)
|
||||
case 27:
|
||||
exit(1);
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
glutPostRedisplay();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user