Compare commits
209 Commits
jump_and_c
...
gliding_pe
Author | SHA1 | Date | |
---|---|---|---|
|
a30402b56a | ||
|
07561c6b32 | ||
|
a4296239d4 | ||
|
3f9467c946 | ||
|
1bb14ad90c | ||
|
87030f6618 | ||
|
8ff72e9723 | ||
|
b47731f24d | ||
|
bc6bf401f5 | ||
|
984d527626 | ||
|
fdb5a87f91 | ||
|
ce77d37264 | ||
|
6e776f25fd | ||
|
c1f2f9090b | ||
|
7644bfb536 | ||
|
3e1961839e | ||
|
fff3b2f318 | ||
|
b960c14cbb | ||
|
3db7ae3a38 | ||
|
7cd2ae9d97 | ||
|
03dc437363 | ||
|
80875253ce | ||
|
d1e40c9bdd | ||
|
6c0c91714c | ||
|
87a2f3df64 | ||
|
ab7312ef63 | ||
|
67742383e8 | ||
|
4932ba28ad | ||
|
8ca515097f | ||
|
c68233cb35 | ||
|
9bfd9582d4 | ||
|
24dcc6b6bf | ||
|
f3a6e4fa5b | ||
|
4e262cfb07 | ||
|
40af76bbaa | ||
|
1fd3bbc42e | ||
|
ac8020ea9c | ||
|
2c6f911e10 | ||
|
7b7d00ca62 | ||
|
365a0a7c15 | ||
|
2b1ec683d3 | ||
|
ba0fe1832e | ||
|
540b260cbd | ||
|
8f5f6b3d59 | ||
|
6614766f3e | ||
|
57b5e8538e | ||
|
fdb07636f2 | ||
|
cb83f62e30 | ||
|
78123bb38b | ||
|
3c69df8a70 | ||
|
e00b729716 | ||
|
a2990a9d73 | ||
|
dee1c795c2 | ||
|
eb6560bf2b | ||
|
35bc4ac680 | ||
|
ff3ce3dd96 | ||
|
42896b2a18 | ||
|
10b892af96 | ||
|
9605806d81 | ||
|
3f22c0966d | ||
|
8281cca82f | ||
|
4d73f1af35 | ||
|
26d812ae00 | ||
|
f448e632b6 | ||
|
49f7430b12 | ||
|
d73b929ef2 | ||
|
6f37e76272 | ||
|
74477b24a8 | ||
|
78152f85e7 | ||
|
002a64cc48 | ||
|
ca4116bfce | ||
|
0846e52d46 | ||
|
6e2fd96627 | ||
|
a9eb712fc9 | ||
|
934be3266f | ||
|
c8af2b5a52 | ||
|
f321f16e83 | ||
|
41d180c899 | ||
|
8eeef423e9 | ||
|
1ff8f50f2f | ||
|
2c28dd892c | ||
|
5c2f3d5d3a | ||
|
d588311dbb | ||
|
f446027656 | ||
|
233d93d47e | ||
|
70f2be9cc6 | ||
|
9e5a0b8895 | ||
|
09298228c6 | ||
|
e82cb7852b | ||
|
4ea4589302 | ||
|
a5f2dcb57b | ||
|
72b2af6035 | ||
|
84396a72df | ||
|
0340663eb7 | ||
|
8352666a9d | ||
|
8d12a6d537 | ||
|
fbdd7a5e74 | ||
|
aeee36a311 | ||
|
2f99f6558c | ||
|
b6082fd236 | ||
|
0a13cebaa1 | ||
|
baa832d311 | ||
|
1718e34352 | ||
|
d5e008b84b | ||
|
3271390362 | ||
|
37cbb521d3 | ||
|
2752177ade | ||
|
f640ee2f6e | ||
|
25817dc26b | ||
|
ed9119b72a | ||
|
0872b85b1e | ||
|
6125515cec | ||
|
cc70176446 | ||
|
a0c8524924 | ||
|
2d10924a14 | ||
|
4837ea3020 | ||
|
26d3159125 | ||
|
b66251f76d | ||
|
d9468c9405 | ||
|
f901072afb | ||
|
1982a66838 | ||
|
3f9bae90c3 | ||
|
b97e478fe9 | ||
|
a9a4c5489e | ||
|
a85eb9c0a7 | ||
|
dd951e6dde | ||
|
d190734875 | ||
|
4afa1d7abb | ||
|
58010eb35c | ||
|
816c0c932d | ||
|
4f1f5e336b | ||
|
a8d5b176b5 | ||
|
fe7aa08ad9 | ||
|
1f6735a6a5 | ||
|
f0bbbf66b8 | ||
|
d863424032 | ||
|
799bc13da2 | ||
|
4754fc653f | ||
|
85199453cc | ||
|
a91e0218a3 | ||
|
5e4a7581df | ||
|
6a04cff065 | ||
|
3dec3c7a74 | ||
|
8e5f0e62dd | ||
|
46cde1715f | ||
|
d084982240 | ||
|
4885a9eb20 | ||
|
1764b78ee9 | ||
|
315afce941 | ||
|
3f847b73f3 | ||
|
923b6fc4d9 | ||
|
1864c7d79a | ||
|
386e997f45 | ||
|
3d2e10564e | ||
|
cf69e051ce | ||
|
78e6e59477 | ||
|
87440f531c | ||
|
6cfd4f7e55 | ||
|
463642c0be | ||
|
d1b1b37270 | ||
|
0d22b90540 | ||
|
27f75a863e | ||
|
049290c584 | ||
|
71699df7de | ||
|
8d621b3bdd | ||
|
1f2b715988 | ||
|
3deaa01c2b | ||
|
1e42244e82 | ||
|
66b48d6df6 | ||
|
5bdf2bc6c7 | ||
|
d9d972a944 | ||
|
ddc82eefca | ||
|
2886579324 | ||
|
bb7d5f8837 | ||
|
8c3ddf4270 | ||
|
f955218bf1 | ||
|
7aafcc86c7 | ||
|
ce657cf752 | ||
|
cf899d400d | ||
|
557dce9bc2 | ||
|
b64d4a27cb | ||
|
a02b83115a | ||
|
0a755ade51 | ||
|
19064f818a | ||
|
cbff5db516 | ||
|
64b85b4563 | ||
|
9ea600ff3f | ||
|
fe58074dea | ||
|
c326f9ffae | ||
|
54b03eefda | ||
|
d26e464b6a | ||
|
4c56261075 | ||
|
19b260119a | ||
|
3f0926b612 | ||
|
cb085044c9 | ||
|
f350617c24 | ||
|
f46de6f23b | ||
|
94a20cbadf | ||
|
eba5b610b9 | ||
|
2eb9e67a5a | ||
|
8b21166c14 | ||
|
1a141b9161 | ||
|
6286dda286 | ||
|
1a1c49f8a6 | ||
|
3fec8c24ec | ||
|
6b158a7d23 | ||
|
b5c90ca7d9 | ||
|
b5128c6e82 | ||
|
7bccfa1026 |
3
Makefile
3
Makefile
@@ -33,7 +33,7 @@ realclean:
|
||||
|
||||
install:
|
||||
@echo "Installing"
|
||||
$(TOP)/bin/installmesa
|
||||
$(TOP)/bin/installmesa $(DESTDIR)
|
||||
|
||||
# DirectFBGL module installation
|
||||
linux-directfb-install:
|
||||
@@ -105,6 +105,7 @@ linux-ultrasparc \
|
||||
linux-tcc \
|
||||
linux-x86 \
|
||||
linux-x86-debug \
|
||||
linux-x86-32 \
|
||||
linux-x86-64 \
|
||||
linux-x86-64-static \
|
||||
linux-x86-glide \
|
||||
|
@@ -12,7 +12,7 @@ TOP=.
|
||||
INCLUDE_DIR="/usr/local/include"
|
||||
LIB_DIR="/usr/local/lib"
|
||||
|
||||
|
||||
if [ x$# == "x0" ] ; then
|
||||
echo
|
||||
echo "***** Mesa installation - You may need root privileges to do this *****"
|
||||
echo
|
||||
@@ -33,7 +33,6 @@ if [ x${INPUT} != "x" ] ; then
|
||||
LIB_DIR=${INPUT}
|
||||
fi
|
||||
|
||||
|
||||
echo
|
||||
echo "About to install Mesa header files (GL/*.h) in: " ${INCLUDE_DIR}/GL
|
||||
echo "and Mesa library files (libGL.*, etc) in: " ${LIB_DIR}
|
||||
@@ -41,6 +40,10 @@ echo "Press <Enter> to continue, or <ctrl>-C to abort."
|
||||
|
||||
read INPUT
|
||||
|
||||
else
|
||||
INCLUDE_DIR=$1/include
|
||||
LIB_DIR=$1/lib
|
||||
fi
|
||||
|
||||
# flags:
|
||||
# -f = force
|
||||
|
@@ -173,6 +173,15 @@ case $ARCH in
|
||||
OPTS="${OPTS} -Xlinker --version-script=exptmp"
|
||||
# exptmp is removed below
|
||||
fi
|
||||
|
||||
# Check if objects are 32-bit and we're running in 64-bit
|
||||
# environment. If so, pass -m32 flag to linker.
|
||||
set ${OBJECTS}
|
||||
ABI32=`file $1 | grep 32-bit`
|
||||
if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then
|
||||
OPTS="-m32 ${OPTS}"
|
||||
fi
|
||||
|
||||
if [ x${PATCH} = "x" ] ; then
|
||||
VERSION="${MAJOR}.${MINOR}"
|
||||
else
|
||||
|
@@ -19,7 +19,7 @@ CXXFLAGS = $(DEFINES) -Wall -g -ansi -pedantic -fPIC
|
||||
ASM_SOURCES =
|
||||
|
||||
# Library/program dependencies
|
||||
DRI_LIB_DEPS = -lm -lpthread -lexpat
|
||||
DRI_LIB_DEPS = -L/usr/local/lib -lm -lpthread -lexpat
|
||||
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -pthread
|
||||
|
||||
GLUT_LIB_DEPS = -L$(LIB_DIR) -L/usr/X11R6/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm
|
||||
|
@@ -9,7 +9,7 @@ CONFIG_NAME = linux-dri-x86-64
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
|
||||
DEFINES = -DDRI_NEW_INTERFACE_ONLY -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS -D_GNU_SOURCE -D__AMD64__
|
||||
DEFINES = -DDRI_NEW_INTERFACE_ONLY -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS -D_GNU_SOURCE
|
||||
|
||||
CFLAGS = -m64 -Wmissing-prototypes -g -std=c99 -Wundef -fPIC -ffast-math $(DEFINES)
|
||||
CXXFLAGS = -m64 -Wall -g -ansi -pedantic -fPIC $(DEFINES)
|
||||
|
13
configs/linux-x86-32
Normal file
13
configs/linux-x86-32
Normal file
@@ -0,0 +1,13 @@
|
||||
# To build Linux x86 32-bit in an x86-64 environment
|
||||
|
||||
include $(TOP)/configs/linux-x86
|
||||
|
||||
CONFIG_NAME = linux-x86-32
|
||||
|
||||
|
||||
# Other than -m32, these are the same as in linux-x86, which we included above.
|
||||
|
||||
CFLAGS = -m32 -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DPTHREADS -I/usr/X11R6/include
|
||||
|
||||
CXXFLAGS = -m32 -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
|
||||
|
@@ -8,9 +8,9 @@ CONFIG_NAME = linux-x86-64
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
|
||||
CFLAGS = -m64 -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -D__AMD64__ -I/usr/X11R6/include
|
||||
CFLAGS = -m64 -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include
|
||||
|
||||
CXXFLAGS = -m64 -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D__AMD64__
|
||||
CXXFLAGS = -m64 -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
|
||||
|
||||
GLUT_CFLAGS = -fexceptions
|
||||
|
||||
|
@@ -8,9 +8,9 @@ CONFIG_NAME = linux-x86-64-static
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
|
||||
CFLAGS = -m64 -Wall -O3 -ansi -pedantic -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -D__AMD64__ -I/usr/X11R6/include
|
||||
CFLAGS = -m64 -Wall -O3 -ansi -pedantic -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include
|
||||
|
||||
CXXFLAGS = -m64 -Wall -O3 -ansi -pedantic -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D__AMD64__
|
||||
CXXFLAGS = -m64 -Wall -O3 -ansi -pedantic -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
|
||||
|
||||
GLUT_CFLAGS = -fexceptions
|
||||
|
||||
|
@@ -113,14 +113,10 @@ FAQ:
|
||||
at peak performance ;-).
|
||||
|
||||
Q) I'm getting a "bad font!" fatal error.
|
||||
A) By default, DOS GLUT compiles with GLUT_IMPORT_LIB, to cope with variable
|
||||
access inside dynamic modules (same mechanism used for Win32 _DLL). Since
|
||||
-DGLUT_IMPORT_LIB affects Mesa's `glut.h', your apps must be compiled the
|
||||
same way GLUT was compiled (either with or without defining it). If you
|
||||
want to use another `glut.h' when building your own demos, or just don't
|
||||
feel happy about this, make sure you remove the line with GLUT_IMPORT_LIB
|
||||
from `Mesa/src/glut/dos/Makefile.DJ' before (re)making GLUT. Beware, this
|
||||
means you will never EVER be able to safely use `glut.dxe'!
|
||||
A) Always use GLUT_STROKE_* and GLUT_BITMAP_* constants when dealing with
|
||||
GLUT fonts. If you're using `glut.dxe', then make sure GLUT_STROKE_* and
|
||||
GLUT_BITMAP_* are mapped to integer constants, not to the actual font
|
||||
address (same mechanism used for Win32 _DLL).
|
||||
|
||||
Q) What is NUL driver good for, if I don't get any output at all?
|
||||
A) For debugging. The NUL driver is very much like OSMesa. Everything is
|
||||
@@ -265,8 +261,9 @@ v1.6 (aug-2004)
|
||||
v1.7 (???-2005)
|
||||
+ enabled OpenGL 2.0 support
|
||||
+ added support for sw texture compression
|
||||
* minor rework
|
||||
* `glutTimerFunc' now works with heavy callbacks
|
||||
+ added FreeGLUT specific functions
|
||||
* no more GLX sources in DOS GLUT
|
||||
* made GLUT timer callbacks less accurate but safer
|
||||
|
||||
|
||||
|
||||
|
@@ -9,54 +9,64 @@
|
||||
<H1>Help Wanted</H1>
|
||||
|
||||
<p>
|
||||
We can always use more help with the Mesa project. Here are some
|
||||
specific areas. If you think you can help out, post to the mesa3d-dev
|
||||
mailing list.
|
||||
We can always use more help with the Mesa project.
|
||||
Here are some specific ideas and areas where help would be appreciated:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Windows 98/NT build/driver maintenance and testing (Karl Schultz has been
|
||||
doing a great job of this lately)
|
||||
<li>DOS/DJGPP build/driver maintenance and testing
|
||||
<li>GGI driver/build maintenance and testing
|
||||
<li>GNU autoconfig/libtool maintenance (esp. on non-Linux systems)
|
||||
<li>x86, SSE, 3DNow! and SPARC assembly language programming
|
||||
<li>Implement WGL font functions in the WGL interface code
|
||||
<li>Implement off-screen bitmap rendering support in the WGL interface code
|
||||
<li>Help with writing/testing the new NV_fragment_program extension code
|
||||
<li>Implement the ARB_vertex/fragment extensions
|
||||
<li>Download/compile/test Mesa and report any bugs found
|
||||
</ul>
|
||||
<ol>
|
||||
<li><p>
|
||||
Generate the src/mesa/main/enums.c file with a Python script which
|
||||
uses the gl_API.xml file.
|
||||
</p>
|
||||
<li><p>
|
||||
Try to auto-generate the display list "save" functions seen in dlist.c
|
||||
using a Python script and the gl_API.xml file.
|
||||
The gl_API.xml file will probably need a new tag to indicate whether or
|
||||
not each function gets compiled into display lists.
|
||||
</p>
|
||||
<li><p>
|
||||
Maintenance of assembly language files on Linux, Windows and SPARC systems.
|
||||
</p>
|
||||
<li><p>
|
||||
Help to incorporate the 3Dlabs' shading language compiler for OpenGL 2.0.
|
||||
</p>
|
||||
<li><p>
|
||||
Implement assembly language (SSE/MMX) code generation for
|
||||
vertex/fragment programs.
|
||||
</p>
|
||||
<li><p>
|
||||
Windows 98/NT driver building, maintenance and testing
|
||||
(Karl Schultz has been doing a great job of this lately).
|
||||
</p>
|
||||
<li><p>
|
||||
Maintenance and testing of various drivers, such as DOS/DJGPP, GGI, etc.
|
||||
</p>
|
||||
<li><p>
|
||||
Write new tests for Glean.
|
||||
</p>
|
||||
</ol>
|
||||
|
||||
|
||||
<p>
|
||||
If you want to help with Mesa, first join the Mesa developer's
|
||||
mailing list. Then post a message explaining what you might like
|
||||
to help with. The Mesa web page has a list of a few work items
|
||||
which you may consider.
|
||||
mailing list.
|
||||
Then post a message to propose what you want to do, just to make sure
|
||||
there's no issues.
|
||||
</p>
|
||||
|
||||
</p>
|
||||
Anyone is welcome to contribute code to the Mesa project, provided you
|
||||
agree to the copyright terms of the relevant code. See the COPYRIGHT
|
||||
file.
|
||||
Anyone is welcome to contribute code to the Mesa project.
|
||||
By doing so, it's assumed that you agree to the code's licensing terms.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Unfortunately, all the easy work in Mesa was done years ago. Nowadays, the
|
||||
work is rather complicated and not suited to beginners.
|
||||
</p>
|
||||
Finally:
|
||||
<p>
|
||||
|
||||
<p>
|
||||
If you're contribution code to the Mesa library itself:
|
||||
<p>
|
||||
<ol>
|
||||
<li>Try to write clean code (uniform indentation, comments, meaningful
|
||||
identifiers, etc). It must be readable and maintainable!
|
||||
|
||||
<li>Test your code. On several occations I've incorporated code from
|
||||
users which later turned out to have bugs. Now, I'm pretty hesitant
|
||||
to use code which doesn't look good.
|
||||
<li>Try to write high-quality code that follows the existing style.
|
||||
<li>Use uniform indentation, write comments, use meaningful identifiers, etc.
|
||||
<li>Test your code thoroughly. Include test programs if appropriate.
|
||||
</ol>
|
||||
|
||||
|
||||
|
124
include/GL/gl.h
124
include/GL/gl.h
@@ -62,6 +62,9 @@
|
||||
#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
|
||||
# define GLAPI extern
|
||||
# define GLAPIENTRY __stdcall
|
||||
#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
|
||||
# define GLAPI __attribute__((visibility("default")))
|
||||
# define GLAPIENTRY
|
||||
#endif /* WIN32 && !CYGWIN */
|
||||
|
||||
#if (defined(__BEOS__) && defined(__POWERPC__)) || defined(__QUICKDRAW__)
|
||||
@@ -2210,11 +2213,11 @@ GLAPI void GLAPIENTRY glTracePointerRangeMESA( const GLvoid* first, const GLvoid
|
||||
|
||||
typedef void (*GLprogramcallbackMESA)(GLenum target, GLvoid *data);
|
||||
|
||||
extern void
|
||||
GLAPI void GLAPIENTRY
|
||||
glProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback,
|
||||
GLvoid *data);
|
||||
|
||||
extern void
|
||||
GLAPI void GLAPIENTRY
|
||||
glGetProgramRegisterfvMESA(GLenum target, GLsizei len, const GLubyte *name,
|
||||
GLfloat *v);
|
||||
|
||||
@@ -2232,6 +2235,123 @@ typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLen
|
||||
#endif /* GL_ATI_blend_equation_separate */
|
||||
|
||||
|
||||
/* XXX this is temporary here! */
|
||||
#ifndef GL_EXT_framebuffer_object
|
||||
#define GL_EXT_framebuffer_object
|
||||
|
||||
GLAPI GLboolean GLAPIENTRY
|
||||
glIsRenderbufferEXT(GLuint renderbuffer);
|
||||
|
||||
GLAPI void GLAPIENTRY
|
||||
glBindRenderbufferEXT(GLenum target, GLuint renderbuffer);
|
||||
|
||||
GLAPI void GLAPIENTRY
|
||||
glDeleteRenderbuffersEXT(GLsizei n, const GLuint *renderbuffers);
|
||||
|
||||
GLAPI void GLAPIENTRY
|
||||
glGenRenderbuffersEXT(GLsizei n, GLuint *renderbuffers);
|
||||
|
||||
GLAPI void GLAPIENTRY
|
||||
glRenderbufferStorageEXT(GLenum target, GLenum internalformat,
|
||||
GLsizei width, GLsizei height);
|
||||
|
||||
GLAPI void GLAPIENTRY
|
||||
glGetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params);
|
||||
|
||||
GLAPI GLboolean GLAPIENTRY
|
||||
glIsFramebufferEXT(GLuint framebuffer);
|
||||
|
||||
GLAPI void GLAPIENTRY
|
||||
glBindFramebufferEXT(GLenum target, GLuint framebuffer);
|
||||
|
||||
GLAPI void GLAPIENTRY
|
||||
glDeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers);
|
||||
|
||||
GLAPI void GLAPIENTRY
|
||||
glGenFramebuffersEXT(GLsizei n, GLuint *framebuffers);
|
||||
|
||||
GLAPI GLenum GLAPIENTRY
|
||||
glCheckFramebufferStatusEXT(GLenum target);
|
||||
|
||||
GLAPI void GLAPIENTRY
|
||||
glFramebufferTexture1DEXT(GLenum target, GLenum attachment,
|
||||
GLenum textarget, GLuint texture, GLint level);
|
||||
|
||||
GLAPI void GLAPIENTRY
|
||||
glFramebufferTexture2DEXT(GLenum target, GLenum attachment,
|
||||
GLenum textarget, GLuint texture, GLint level);
|
||||
|
||||
GLAPI void GLAPIENTRY
|
||||
glFramebufferTexture3DEXT(GLenum target, GLenum attachment,
|
||||
GLenum textarget, GLuint texture,
|
||||
GLint level, GLint zoffset);
|
||||
|
||||
GLAPI void GLAPIENTRY
|
||||
glFramebufferRenderbufferEXT(GLenum target, GLenum attachment,
|
||||
GLenum renderbuffertarget,
|
||||
GLuint renderbuffer);
|
||||
|
||||
GLAPI void GLAPIENTRY
|
||||
glGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment,
|
||||
GLenum pname, GLint *params);
|
||||
|
||||
GLAPI void GLAPIENTRY
|
||||
glGenerateMipmapEXT(GLenum target);
|
||||
|
||||
|
||||
#define GL_FRAMEBUFFER_EXT 0x8D40
|
||||
#define GL_RENDERBUFFER_EXT 0x8D41
|
||||
#define GL_STENCIL_INDEX_EXT 0x8D45
|
||||
#define GL_STENCIL_INDEX1_EXT 0x8D46
|
||||
#define GL_STENCIL_INDEX4_EXT 0x8D47
|
||||
#define GL_STENCIL_INDEX8_EXT 0x8D48
|
||||
#define GL_STENCIL_INDEX16_EXT 0x8D49
|
||||
#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
|
||||
#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
|
||||
#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
|
||||
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
|
||||
#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
|
||||
#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
|
||||
#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
|
||||
#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
|
||||
#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
|
||||
#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
|
||||
#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
|
||||
#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
|
||||
#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
|
||||
#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
|
||||
#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
|
||||
#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
|
||||
#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
|
||||
#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
|
||||
#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
|
||||
#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
|
||||
#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
|
||||
#define GL_STENCIL_ATTACHMENT_EXT 0x8D20
|
||||
#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
|
||||
#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
|
||||
#define GL_FRAMEBUFFER_STATUS_ERROR_EXT 0x8CDE
|
||||
#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
|
||||
#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
|
||||
#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
|
||||
#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
|
||||
#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
|
||||
|
||||
#endif /* GL_EXT_framebuffer_object */
|
||||
|
||||
|
||||
|
||||
/**
|
||||
** NOTE!!!!! If you add new functions to this file, or update
|
||||
** glext.h be sure to regenerate the gl_mangle.h file. See comments
|
||||
|
@@ -193,13 +193,11 @@ WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
|
||||
#else /* _WIN32 not defined */
|
||||
|
||||
/* Define GLUTAPIENTRY and GLUTCALLBACK to nothing if we aren't on Win32. */
|
||||
# define GLUTAPIENTRY
|
||||
# define GLUTAPIENTRY GLAPIENTRY
|
||||
# define GLUTAPIENTRYV
|
||||
# define GLUT_APIENTRY_DEFINED
|
||||
# define GLUTCALLBACK
|
||||
# define GLUTAPI extern
|
||||
/* Prototype exit for the non-Win32 case (see above). */
|
||||
/*extern void exit(int); this screws up gcc -ansi -pedantic! */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -747,26 +745,4 @@ GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#ifdef GLUT_APIENTRY_DEFINED
|
||||
# undef GLUT_APIENTRY_DEFINED
|
||||
# undef APIENTRY
|
||||
#endif
|
||||
|
||||
#ifdef GLUT_WINGDIAPI_DEFINED
|
||||
# undef GLUT_WINGDIAPI_DEFINED
|
||||
# undef WINGDIAPI
|
||||
#endif
|
||||
|
||||
#ifdef GLUT_DEFINED___CDECL
|
||||
# undef GLUT_DEFINED___CDECL
|
||||
# undef __cdecl
|
||||
#endif
|
||||
|
||||
#ifdef GLUT_DEFINED__CRTIMP
|
||||
# undef GLUT_DEFINED__CRTIMP
|
||||
# undef _CRTIMP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __glut_h__ */
|
||||
|
@@ -482,6 +482,21 @@ typedef GLuint (* PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *pointer);
|
||||
#endif /* GLX_MESA_agp_offset */
|
||||
|
||||
|
||||
/*
|
||||
* ???. GLX_MESA_allocate_memory
|
||||
*/
|
||||
#ifndef GLX_MESA_allocate_memory
|
||||
#define GLX_MESA_allocate_memory 1
|
||||
|
||||
extern void *glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority);
|
||||
extern void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer);
|
||||
extern GLuint glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer);
|
||||
typedef void * ( * PFNGLXALLOCATEMEMORYMESAPROC) (Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority);
|
||||
typedef void ( * PFNGLXFREEMEMORYMESAPROC) (Display *dpy, int scrn, void *pointer);
|
||||
typedef GLuint (* PFNGLXGETMEMORYOFFSETMESAPROC) (Display *dpy, int scrn, const void *pointer);
|
||||
|
||||
#endif /* GLX_MESA_allocate_memory */
|
||||
|
||||
/*
|
||||
* ARB ?. GLX_ARB_render_texture
|
||||
*/
|
||||
@@ -506,6 +521,28 @@ extern Bool glXDrawableAttribARB(Display *dpy, GLXDrawable draw, const int *attr
|
||||
#endif /* GLX_NV_float_buffer */
|
||||
|
||||
|
||||
/*** Should these go here, or in another header? */
|
||||
/*
|
||||
** GLX Events
|
||||
*/
|
||||
typedef struct {
|
||||
int event_type; /* GLX_DAMAGED or GLX_SAVED */
|
||||
int draw_type; /* GLX_WINDOW or GLX_PBUFFER */
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came for SendEvent request */
|
||||
Display *display; /* display the event was read from */
|
||||
GLXDrawable drawable; /* XID of Drawable */
|
||||
unsigned int buffer_mask; /* mask indicating which buffers are affected */
|
||||
unsigned int aux_buffer; /* which aux buffer was affected */
|
||||
int x, y;
|
||||
int width, height;
|
||||
int count; /* if nonzero, at least this many more */
|
||||
} GLXPbufferClobberEvent;
|
||||
|
||||
typedef union __GLXEvent {
|
||||
GLXPbufferClobberEvent glxpbufferclobber;
|
||||
long pad[24];
|
||||
} GLXEvent;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -52,14 +52,20 @@ extern "C" {
|
||||
*
|
||||
* It can have the values #True or #False.
|
||||
*/
|
||||
#ifndef MINIGLX_NO_XTYPES
|
||||
typedef int Bool;
|
||||
#endif
|
||||
typedef int MINI_Bool;
|
||||
|
||||
/**
|
||||
* \brief Color map.
|
||||
*
|
||||
* Alias for private ::MiniGLXColormapRec structure.
|
||||
*/
|
||||
typedef struct MiniGLXColormapRec *MINI_Colormap;
|
||||
#ifndef MINIGLX_NO_XTYPES
|
||||
typedef struct MiniGLXColormapRec *Colormap;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Window attributes.
|
||||
@@ -67,7 +73,7 @@ typedef struct MiniGLXColormapRec *Colormap;
|
||||
typedef struct MiniGLXSetWindowAttributesRec {
|
||||
int background_pixel; /**< \brief background pixel */
|
||||
int border_pixel; /**< \brief border pixel value */
|
||||
Colormap colormap; /**< \brief color map to be associated with window */
|
||||
MINI_Colormap colormap; /**< \brief color map to be associated with window */
|
||||
int event_mask; /**< \brief set of events that should be saved */
|
||||
} XSetWindowAttributes;
|
||||
|
||||
@@ -85,10 +91,13 @@ typedef struct MiniGLXVisualRec Visual;
|
||||
*
|
||||
* \sa \ref datatypes.
|
||||
*/
|
||||
typedef unsigned int VisualID;
|
||||
#ifndef MINIGLX_NO_XTYPES
|
||||
typedef unsigned long VisualID;
|
||||
#endif
|
||||
typedef unsigned long MINI_VisualID;
|
||||
typedef struct MiniGLXXVisualInfoRec {
|
||||
Visual *visual; /**< \brief pointer to the GLX Visual */
|
||||
VisualID visualid; /**< \brief visual ID */
|
||||
MINI_VisualID visualid; /**< \brief visual ID */
|
||||
int screen; /**< \brief screen number */
|
||||
int depth; /**< \brief bit depth */
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
@@ -115,7 +124,10 @@ typedef struct MiniGLXFBConfigRec {
|
||||
*
|
||||
* \sa \ref datatypes.
|
||||
*/
|
||||
#ifndef MINIGLX_NO_XTYPES
|
||||
typedef struct MiniGLXDisplayRec Display;
|
||||
#endif
|
||||
typedef struct MiniGLXDisplayRec MINI_Display;
|
||||
|
||||
/**
|
||||
* \brief Window handle.
|
||||
@@ -124,7 +136,10 @@ typedef struct MiniGLXDisplayRec Display;
|
||||
*
|
||||
* \sa \ref datatypes.
|
||||
*/
|
||||
#ifndef MINIGLX_NO_XTYPES
|
||||
typedef struct MiniGLXWindowRec *Window;
|
||||
#endif
|
||||
typedef struct MiniGLXWindowRec *MINI_Window;
|
||||
|
||||
/**
|
||||
* \brief Drawable.
|
||||
@@ -136,7 +151,10 @@ typedef struct MiniGLXWindowRec *Window;
|
||||
*
|
||||
* \sa \ref datatypes.
|
||||
*/
|
||||
#ifndef MINIGLX_NO_XTYPES
|
||||
typedef struct MiniGLXWindowRec *Drawable;
|
||||
#endif
|
||||
typedef struct MiniGLXWindowRec *MINI_Drawable;
|
||||
|
||||
/**
|
||||
* \brief GLX drawable.
|
||||
@@ -174,9 +192,9 @@ typedef struct MiniGLXContextRec *GLXContext;
|
||||
typedef struct {
|
||||
int type;
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came from a SendEvent request */
|
||||
Display *display; /* Display the event was read from */
|
||||
Window window;
|
||||
MINI_Bool send_event; /* true if this came from a SendEvent request */
|
||||
MINI_Display *display; /* Display the event was read from */
|
||||
MINI_Window window;
|
||||
int x, y;
|
||||
int width, height;
|
||||
int count; /* if non-zero, at least this many more */
|
||||
@@ -185,53 +203,53 @@ typedef struct {
|
||||
typedef struct {
|
||||
int type;
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came from a SendEvent request */
|
||||
Display *display; /* Display the event was read from */
|
||||
Window parent; /* parent of the window */
|
||||
Window window; /* window id of window created */
|
||||
MINI_Bool send_event; /* true if this came from a SendEvent request */
|
||||
MINI_Display *display; /* Display the event was read from */
|
||||
MINI_Window parent; /* parent of the window */
|
||||
MINI_Window window; /* window id of window created */
|
||||
int x, y; /* window location */
|
||||
int width, height; /* size of window */
|
||||
int border_width; /* border width */
|
||||
Bool override_redirect; /* creation should be overridden */
|
||||
MINI_Bool override_redirect; /* creation should be overridden */
|
||||
} XCreateWindowEvent;
|
||||
|
||||
typedef struct {
|
||||
int type;
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came from a SendEvent request */
|
||||
Display *display; /* Display the event was read from */
|
||||
Window event;
|
||||
Window window;
|
||||
MINI_Bool send_event; /* true if this came from a SendEvent request */
|
||||
MINI_Display *display; /* Display the event was read from */
|
||||
MINI_Window event;
|
||||
MINI_Window window;
|
||||
} XDestroyWindowEvent;
|
||||
|
||||
typedef struct {
|
||||
int type;
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came from a SendEvent request */
|
||||
Display *display; /* Display the event was read from */
|
||||
Window event;
|
||||
Window window;
|
||||
Bool from_configure;
|
||||
MINI_Bool send_event; /* true if this came from a SendEvent request */
|
||||
MINI_Display *display; /* Display the event was read from */
|
||||
MINI_Window event;
|
||||
MINI_Window window;
|
||||
MINI_Bool from_configure;
|
||||
} XUnmapEvent;
|
||||
|
||||
typedef struct {
|
||||
int type;
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came from a SendEvent request */
|
||||
Display *display; /* Display the event was read from */
|
||||
Window event;
|
||||
Window window;
|
||||
Bool override_redirect; /* boolean, is override set... */
|
||||
MINI_Bool send_event; /* true if this came from a SendEvent request */
|
||||
MINI_Display *display; /* Display the event was read from */
|
||||
MINI_Window event;
|
||||
MINI_Window window;
|
||||
MINI_Bool override_redirect; /* boolean, is override set... */
|
||||
} XMapEvent;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int type;
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came from a SendEvent request */
|
||||
Display *display; /* Display the event was read from */
|
||||
Window parent;
|
||||
Window window;
|
||||
MINI_Bool send_event; /* true if this came from a SendEvent request */
|
||||
MINI_Display *display; /* Display the event was read from */
|
||||
MINI_Window parent;
|
||||
MINI_Window window;
|
||||
} XMapRequestEvent;
|
||||
|
||||
typedef union _XEvent {
|
||||
@@ -263,6 +281,7 @@ typedef union _XEvent {
|
||||
#define CWColormap (1L<<13)
|
||||
#define PseudoColor 3
|
||||
#define TrueColor 4
|
||||
#define VisualIDMask 0x1
|
||||
#define VisualScreenMask 0x2
|
||||
#define Expose 12
|
||||
#define CreateNotify 16
|
||||
@@ -318,11 +337,11 @@ typedef union _XEvent {
|
||||
/**
|
||||
* \name Server-specific functions
|
||||
*/
|
||||
extern Display *
|
||||
extern MINI_Display *
|
||||
__miniglx_StartServer( const char *display_name );
|
||||
|
||||
extern int
|
||||
__miniglx_Select( Display *dpy, int maxfd,
|
||||
__miniglx_Select( MINI_Display *dpy, int maxfd,
|
||||
fd_set *rfds, fd_set *wfds, fd_set *xfds,
|
||||
struct timeval *tv );
|
||||
|
||||
@@ -331,25 +350,25 @@ __miniglx_Select( Display *dpy, int maxfd,
|
||||
* \name Simulated Xlib functions
|
||||
*/
|
||||
/*@{*/
|
||||
extern Display *
|
||||
extern MINI_Display *
|
||||
XOpenDisplay( const char *dpy_name );
|
||||
|
||||
|
||||
extern void
|
||||
XCloseDisplay( Display *display );
|
||||
XCloseDisplay( MINI_Display *display );
|
||||
|
||||
extern Window
|
||||
XCreateWindow( Display *display, Window parent, int x, int y,
|
||||
extern MINI_Window
|
||||
XCreateWindow( MINI_Display *display, MINI_Window parent, int x, int y,
|
||||
unsigned int width, unsigned int height,
|
||||
unsigned int border_width, int depth, unsigned int winclass,
|
||||
Visual *visual, unsigned long valuemask,
|
||||
XSetWindowAttributes *attributes );
|
||||
|
||||
extern int
|
||||
XNextEvent(Display *display, XEvent *event_return);
|
||||
XNextEvent(MINI_Display *display, XEvent *event_return);
|
||||
|
||||
extern Bool
|
||||
XCheckMaskEvent( Display *dpy, long event_mask, XEvent *event_return );
|
||||
extern MINI_Bool
|
||||
XCheckMaskEvent( MINI_Display *dpy, long event_mask, XEvent *event_return );
|
||||
|
||||
/**
|
||||
* \brief Return the root window.
|
||||
@@ -365,27 +384,27 @@ XCheckMaskEvent( Display *dpy, long event_mask, XEvent *event_return );
|
||||
#define DefaultScreen(dpy) 0
|
||||
|
||||
extern void
|
||||
XDestroyWindow( Display *display, Window w );
|
||||
XDestroyWindow( MINI_Display *display, MINI_Window w );
|
||||
|
||||
extern void
|
||||
XMapWindow( Display *display, Window w );
|
||||
XMapWindow( MINI_Display *display, MINI_Window w );
|
||||
|
||||
/* Should clients have access to this?
|
||||
*/
|
||||
extern void
|
||||
XUnmapWindow( Display *display, Window w );
|
||||
XUnmapWindow( MINI_Display *display, MINI_Window w );
|
||||
|
||||
extern Colormap
|
||||
XCreateColormap( Display *display, Window w, Visual *visual, int alloc );
|
||||
extern MINI_Colormap
|
||||
XCreateColormap( MINI_Display *display, MINI_Window w, Visual *visual, int alloc );
|
||||
|
||||
extern void
|
||||
XFreeColormap( Display *display, Colormap cmap );
|
||||
XFreeColormap( MINI_Display *display, MINI_Colormap cmap );
|
||||
|
||||
extern void
|
||||
XFree( void *data );
|
||||
|
||||
extern XVisualInfo *
|
||||
XGetVisualInfo( Display *display, long vinfo_mask,
|
||||
XGetVisualInfo( MINI_Display *display, long vinfo_mask,
|
||||
XVisualInfo *vinfo_template, int *nitems_return );
|
||||
/*@}*/
|
||||
|
||||
@@ -396,23 +415,23 @@ XGetVisualInfo( Display *display, long vinfo_mask,
|
||||
*/
|
||||
/*@{*/
|
||||
extern XVisualInfo*
|
||||
glXChooseVisual( Display *dpy, int screen, int *attribList );
|
||||
glXChooseVisual( MINI_Display *dpy, int screen, int *attribList );
|
||||
|
||||
extern int
|
||||
glXGetConfig( Display *dpy, XVisualInfo *vis, int attrib, int *value );
|
||||
glXGetConfig( MINI_Display *dpy, XVisualInfo *vis, int attrib, int *value );
|
||||
|
||||
extern GLXContext
|
||||
glXCreateContext( Display *dpy, XVisualInfo *vis,
|
||||
GLXContext shareList, Bool direct );
|
||||
glXCreateContext( MINI_Display *dpy, XVisualInfo *vis,
|
||||
GLXContext shareList, MINI_Bool direct );
|
||||
|
||||
extern void
|
||||
glXDestroyContext( Display *dpy, GLXContext ctx );
|
||||
glXDestroyContext( MINI_Display *dpy, GLXContext ctx );
|
||||
|
||||
extern Bool
|
||||
glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx);
|
||||
extern MINI_Bool
|
||||
glXMakeCurrent( MINI_Display *dpy, GLXDrawable drawable, GLXContext ctx);
|
||||
|
||||
extern void
|
||||
glXSwapBuffers( Display *dpy, GLXDrawable drawable );
|
||||
glXSwapBuffers( MINI_Display *dpy, GLXDrawable drawable );
|
||||
|
||||
extern GLXContext
|
||||
glXGetCurrentContext( void );
|
||||
@@ -423,22 +442,35 @@ glXGetCurrentDrawable( void );
|
||||
extern void
|
||||
(*glXGetProcAddress(const GLubyte *procname))( void );
|
||||
|
||||
extern Bool
|
||||
glXQueryVersion( Display *dpy, int *major, int *minor );
|
||||
extern MINI_Bool
|
||||
glXQueryVersion( MINI_Display *dpy, int *major, int *minor );
|
||||
|
||||
/* Added in MiniGLX 1.1 */
|
||||
extern GLXPbuffer
|
||||
glXCreatePbuffer( Display *dpy, GLXFBConfig config, const int *attribList );
|
||||
glXCreatePbuffer( MINI_Display *dpy, GLXFBConfig config, const int *attribList );
|
||||
|
||||
extern void
|
||||
glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf );
|
||||
glXDestroyPbuffer( MINI_Display *dpy, GLXPbuffer pbuf );
|
||||
|
||||
extern GLXFBConfig *
|
||||
glXChooseFBConfig( Display *dpy, int screen, const int *attribList,
|
||||
glXChooseFBConfig( MINI_Display *dpy, int screen, const int *attribList,
|
||||
int *nitems );
|
||||
|
||||
extern XVisualInfo *
|
||||
glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config );
|
||||
glXGetVisualFromFBConfig( MINI_Display *dpy, GLXFBConfig config );
|
||||
|
||||
extern void *glXAllocateMemoryMESA(Display *dpy, int scrn,
|
||||
size_t size, float readFreq,
|
||||
float writeFreq, float priority);
|
||||
|
||||
extern void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer);
|
||||
|
||||
extern GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn,
|
||||
const void *pointer );
|
||||
/*@}*/
|
||||
|
||||
extern void
|
||||
__glXScrEnableExtension( void *, const char * name );
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
232
include/GLES/egl.h
Normal file
232
include/GLES/egl.h
Normal file
@@ -0,0 +1,232 @@
|
||||
#ifndef _EGL_H
|
||||
#define _EGL_H
|
||||
|
||||
/*
|
||||
** License Applicability. Except to the extent portions of this file are
|
||||
** made subject to an alternative license as permitted in the SGI Free
|
||||
** Software License B, Version 1.0 (the "License"), the contents of this
|
||||
** file are subject only to the provisions of the License. You may not use
|
||||
** this file except in compliance with the License. You may obtain a copy
|
||||
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
|
||||
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
|
||||
**
|
||||
** http://oss.sgi.com/projects/FreeB
|
||||
**
|
||||
** Note that, as provided in the License, the Software is distributed on an
|
||||
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
|
||||
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
|
||||
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
|
||||
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
||||
**
|
||||
** Original Code. The Original Code is: OpenGL Sample Implementation,
|
||||
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
|
||||
** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc.
|
||||
** Copyright in any portions created by third parties is as indicated
|
||||
** elsewhere herein. All Rights Reserved.
|
||||
**
|
||||
** Additional Notice Provisions: The application programming interfaces
|
||||
** established by SGI in conjunction with the Original Code are The
|
||||
** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
|
||||
** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
|
||||
** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
|
||||
** Window System(R) (Version 1.3), released October 19, 1998. This software
|
||||
** was created using the OpenGL(R) version 1.2.1 Sample Implementation
|
||||
** published by SGI, but has not been independently verified as being
|
||||
** compliant with the OpenGL(R) version 1.2.1 Specification.
|
||||
*/
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GLES/egltypes.h>
|
||||
|
||||
/* XXX should go in eglext.h */
|
||||
#define GL_OES_VERSION_1_0 1
|
||||
#define GL_OES_read_format 1
|
||||
#define GL_OES_compressed_paletted_texture 1
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
|
||||
#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
|
||||
#define GL_PALETTE4_RGB8_OES 0x8B90
|
||||
#define GL_PALETTE4_RGBA8_OES 0x8B91
|
||||
#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
|
||||
#define GL_PALETTE4_RGBA4_OES 0x8B93
|
||||
#define GL_PALETTE4_RGB5_A1_OES 0x8B94
|
||||
#define GL_PALETTE8_RGB8_OES 0x8B95
|
||||
#define GL_PALETTE8_RGBA8_OES 0x8B96
|
||||
#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
|
||||
#define GL_PALETTE8_RGBA4_OES 0x8B98
|
||||
#define GL_PALETTE8_RGB5_A1_OES 0x8B99
|
||||
/* XXX */
|
||||
|
||||
/*
|
||||
** Versioning and extensions
|
||||
*/
|
||||
#define EGL_VERSION_1_0 1
|
||||
#if 0
|
||||
#define EGL_VERSION_1_1 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Boolean
|
||||
*/
|
||||
#define EGL_FALSE 0
|
||||
#define EGL_TRUE 1
|
||||
|
||||
/*
|
||||
** Errors
|
||||
*/
|
||||
#define EGL_SUCCESS 0x3000
|
||||
#define EGL_NOT_INITIALIZED 0x3001
|
||||
#define EGL_BAD_ACCESS 0x3002
|
||||
#define EGL_BAD_ALLOC 0x3003
|
||||
#define EGL_BAD_ATTRIBUTE 0x3004
|
||||
#define EGL_BAD_CONFIG 0x3005
|
||||
#define EGL_BAD_CONTEXT 0x3006
|
||||
#define EGL_BAD_CURRENT_SURFACE 0x3007
|
||||
#define EGL_BAD_DISPLAY 0x3008
|
||||
#define EGL_BAD_MATCH 0x3009
|
||||
#define EGL_BAD_NATIVE_PIXMAP 0x300A
|
||||
#define EGL_BAD_NATIVE_WINDOW 0x300B
|
||||
#define EGL_BAD_PARAMETER 0x300C
|
||||
#define EGL_BAD_SURFACE 0x300D
|
||||
#define EGL_CONTEXT_LOST 0x300E
|
||||
/* 0x300F - 0x301F reserved for additional errors. */
|
||||
|
||||
/*
|
||||
** Config attributes
|
||||
*/
|
||||
#define EGL_BUFFER_SIZE 0x3020
|
||||
#define EGL_ALPHA_SIZE 0x3021
|
||||
#define EGL_BLUE_SIZE 0x3022
|
||||
#define EGL_GREEN_SIZE 0x3023
|
||||
#define EGL_RED_SIZE 0x3024
|
||||
#define EGL_DEPTH_SIZE 0x3025
|
||||
#define EGL_STENCIL_SIZE 0x3026
|
||||
#define EGL_CONFIG_CAVEAT 0x3027
|
||||
#define EGL_CONFIG_ID 0x3028
|
||||
#define EGL_LEVEL 0x3029
|
||||
#define EGL_MAX_PBUFFER_HEIGHT 0x302A
|
||||
#define EGL_MAX_PBUFFER_PIXELS 0x302B
|
||||
#define EGL_MAX_PBUFFER_WIDTH 0x302C
|
||||
#define EGL_NATIVE_RENDERABLE 0x302D
|
||||
#define EGL_NATIVE_VISUAL_ID 0x302E
|
||||
#define EGL_NATIVE_VISUAL_TYPE 0x302F
|
||||
/*#define EGL_PRESERVED_RESOURCES 0x3030*/
|
||||
#define EGL_SAMPLES 0x3031
|
||||
#define EGL_SAMPLE_BUFFERS 0x3032
|
||||
#define EGL_SURFACE_TYPE 0x3033
|
||||
#define EGL_TRANSPARENT_TYPE 0x3034
|
||||
#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
|
||||
#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
|
||||
#define EGL_TRANSPARENT_RED_VALUE 0x3037
|
||||
#define EGL_NONE 0x3038 /* Also a config value */
|
||||
#define EGL_BIND_TO_TEXTURE_RGB 0x3039
|
||||
#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
|
||||
#define EGL_MIN_SWAP_INTERVAL 0x303B
|
||||
#define EGL_MAX_SWAP_INTERVAL 0x303C
|
||||
|
||||
/*
|
||||
** Config values
|
||||
*/
|
||||
#define EGL_DONT_CARE ((EGLint) -1)
|
||||
|
||||
#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
|
||||
#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* " */
|
||||
#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
|
||||
#define EGL_NO_TEXTURE 0x305C /* EGL_TEXTURE_FORMAT/TARGET value */
|
||||
#define EGL_TEXTURE_RGB 0x305D /* EGL_TEXTURE_FORMAT value */
|
||||
#define EGL_TEXTURE_RGBA 0x305E /* " */
|
||||
#define EGL_TEXTURE_2D 0x305F /* EGL_TEXTURE_TARGET value */
|
||||
|
||||
/*
|
||||
** Config attribute mask bits
|
||||
*/
|
||||
#define EGL_PBUFFER_BIT 0x01 /* EGL_SURFACE_TYPE mask bit */
|
||||
#define EGL_PIXMAP_BIT 0x02 /* " */
|
||||
#define EGL_WINDOW_BIT 0x04 /* " */
|
||||
|
||||
/*
|
||||
** String names
|
||||
*/
|
||||
#define EGL_VENDOR 0x3053 /* eglQueryString target */
|
||||
#define EGL_VERSION 0x3054 /* " */
|
||||
#define EGL_EXTENSIONS 0x3055 /* " */
|
||||
|
||||
/*
|
||||
** Surface attributes
|
||||
*/
|
||||
#define EGL_HEIGHT 0x3056
|
||||
#define EGL_WIDTH 0x3057
|
||||
#define EGL_LARGEST_PBUFFER 0x3058
|
||||
#define EGL_TEXTURE_FORMAT 0x3080 /* For pbuffers bound as textures */
|
||||
#define EGL_TEXTURE_TARGET 0x3081 /* " */
|
||||
#define EGL_MIPMAP_TEXTURE 0x3082 /* " */
|
||||
#define EGL_MIPMAP_LEVEL 0x3083 /* " */
|
||||
|
||||
/*
|
||||
** BindTexImage / ReleaseTexImage buffer target
|
||||
*/
|
||||
#define EGL_BACK_BUFFER 0x3084
|
||||
|
||||
/*
|
||||
** Current surfaces
|
||||
*/
|
||||
#define EGL_DRAW 0x3059
|
||||
#define EGL_READ 0x305A
|
||||
|
||||
/*
|
||||
** Engines
|
||||
*/
|
||||
#define EGL_CORE_NATIVE_ENGINE 0x305B
|
||||
|
||||
/* 0x305C-0x3FFFF reserved for future use */
|
||||
|
||||
/*
|
||||
** Functions
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GLAPI EGLint APIENTRY eglGetError (void);
|
||||
|
||||
GLAPI EGLDisplay APIENTRY eglGetDisplay (NativeDisplayType display);
|
||||
GLAPI EGLBoolean APIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
GLAPI EGLBoolean APIENTRY eglTerminate (EGLDisplay dpy);
|
||||
GLAPI const char * APIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
|
||||
GLAPI void (* APIENTRY eglGetProcAddress (const char *procname))();
|
||||
|
||||
GLAPI EGLBoolean APIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
||||
GLAPI EGLBoolean APIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
|
||||
GLAPI EGLBoolean APIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
|
||||
|
||||
GLAPI EGLSurface APIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
|
||||
GLAPI EGLSurface APIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
|
||||
GLAPI EGLSurface APIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
|
||||
GLAPI EGLBoolean APIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
|
||||
GLAPI EGLBoolean APIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
|
||||
|
||||
/* EGL 1.1 render-to-texture APIs */
|
||||
GLAPI EGLBoolean APIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
|
||||
GLAPI EGLBoolean APIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
GLAPI EGLBoolean APIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
|
||||
|
||||
/* EGL 1.1 swap control API */
|
||||
GLAPI EGLBoolean APIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
|
||||
|
||||
GLAPI EGLContext APIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list);
|
||||
GLAPI EGLBoolean APIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
|
||||
GLAPI EGLBoolean APIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
|
||||
GLAPI EGLContext APIENTRY eglGetCurrentContext (void);
|
||||
GLAPI EGLSurface APIENTRY eglGetCurrentSurface (EGLint readdraw);
|
||||
GLAPI EGLDisplay APIENTRY eglGetCurrentDisplay (void);
|
||||
GLAPI EGLBoolean APIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
|
||||
|
||||
GLAPI EGLBoolean APIENTRY eglWaitGL (void);
|
||||
GLAPI EGLBoolean APIENTRY eglWaitNative (EGLint engine);
|
||||
GLAPI EGLBoolean APIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface draw);
|
||||
GLAPI EGLBoolean APIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _EGL_H */
|
48
include/GLES/egltypes.h
Normal file
48
include/GLES/egltypes.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* egltypes.h - EGL API compatibility
|
||||
*
|
||||
* The intention here is to support multiple EGL implementations for the
|
||||
* various backends - GLX, AGL, WGL, Solo - so we define the EGL types as
|
||||
* opaque handles. We also define the Native types as opaque handles for
|
||||
* now, which should be fine for GLX and Solo but the others who knows.
|
||||
* They can extend this later.
|
||||
*
|
||||
* We require that 'int' be 32 bits. Other than that this should be pretty
|
||||
* portable.
|
||||
*
|
||||
* Derived from the OpenGL|ES 1.1 egl.h on the Khronos website:
|
||||
* http://www.khronos.org/opengles/spec_headers/opengles1_1/egl.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _EGLTYPES_H
|
||||
#define _EGLTYPES_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/*
|
||||
* Native types
|
||||
*/
|
||||
typedef void *NativeDisplayType;
|
||||
typedef void *NativePixmapType;
|
||||
typedef void *NativeWindowType;
|
||||
|
||||
/*
|
||||
* Types and resources
|
||||
*/
|
||||
typedef GLboolean EGLBoolean;
|
||||
typedef GLint EGLint;
|
||||
typedef void *EGLDisplay;
|
||||
typedef void *EGLConfig;
|
||||
typedef void *EGLSurface;
|
||||
typedef void *EGLContext;
|
||||
|
||||
/*
|
||||
* EGL and native handle values
|
||||
*/
|
||||
#define EGL_DEFAULT_DISPLAY ((NativeDisplayType)0)
|
||||
#define EGL_NO_CONTEXT ((EGLContext)0)
|
||||
#define EGL_NO_DISPLAY ((EGLDisplay)0)
|
||||
#define EGL_NO_SURFACE ((EGLSurface)0)
|
||||
|
||||
#endif /* _EGLTYPES_H */
|
BIN
progs/images/girl2.rgb
Normal file
BIN
progs/images/girl2.rgb
Normal file
Binary file not shown.
@@ -22,6 +22,7 @@ SOURCES = antialias.c \
|
||||
blendminmax.c \
|
||||
blendsquare.c \
|
||||
bufferobj.c \
|
||||
crossbar.c \
|
||||
cva.c \
|
||||
dinoshade.c \
|
||||
floattex.c \
|
||||
@@ -29,6 +30,7 @@ SOURCES = antialias.c \
|
||||
fptest1.c \
|
||||
fptexture.c \
|
||||
getprocaddress.c \
|
||||
invert.c \
|
||||
manytex.c \
|
||||
multipal.c \
|
||||
no_s3tc.c \
|
||||
@@ -99,6 +101,12 @@ texrect: texrect.o readtex.o
|
||||
texrect.o: texrect.c readtex.h
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
|
||||
|
||||
invert: invert.o readtex.o
|
||||
$(CC) invert.o readtex.o $(LIBS) -o $@
|
||||
|
||||
invert.o: invert.c readtex.h
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
|
||||
|
||||
readtex.o: readtex.c
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
|
||||
|
||||
|
235
progs/tests/crossbar.c
Normal file
235
progs/tests/crossbar.c
Normal file
@@ -0,0 +1,235 @@
|
||||
/*
|
||||
* (C) Copyright IBM Corporation 2005
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||
* license, and/or sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file crossbar.c
|
||||
*
|
||||
* Simple test of GL_ARB_texture_env_crossbar functionality. Several squares
|
||||
* are drawn with different texture combine modes, but all should be rendered
|
||||
* with the same final color.
|
||||
*
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
static const GLint tests[][8] = {
|
||||
{ 1, GL_REPLACE, GL_PRIMARY_COLOR, GL_PRIMARY_COLOR,
|
||||
2, GL_REPLACE, GL_TEXTURE, GL_PRIMARY_COLOR },
|
||||
{ 3, GL_REPLACE, GL_PRIMARY_COLOR, GL_PRIMARY_COLOR,
|
||||
2, GL_SUBTRACT, GL_TEXTURE0, GL_TEXTURE1 },
|
||||
{ 2, GL_REPLACE, GL_PRIMARY_COLOR, GL_PRIMARY_COLOR,
|
||||
2, GL_REPLACE, GL_TEXTURE0, GL_TEXTURE0 },
|
||||
{ 2, GL_REPLACE, GL_PRIMARY_COLOR, GL_PRIMARY_COLOR,
|
||||
1, GL_SUBTRACT, GL_TEXTURE0, GL_TEXTURE1 },
|
||||
{ 3, GL_ADD, GL_TEXTURE1, GL_TEXTURE1,
|
||||
2, GL_MODULATE, GL_TEXTURE1, GL_PREVIOUS },
|
||||
{ 3, GL_ADD, GL_TEXTURE1, GL_TEXTURE1,
|
||||
4, GL_MODULATE, GL_TEXTURE0, GL_PREVIOUS },
|
||||
};
|
||||
|
||||
#define NUM_TESTS (sizeof(tests) / sizeof(tests[0]))
|
||||
|
||||
static int Width = 100 * (NUM_TESTS + 1);
|
||||
static int Height = 200;
|
||||
static const GLfloat Near = 5.0, Far = 25.0;
|
||||
|
||||
|
||||
static void Display( void )
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
|
||||
glClearColor(0.2, 0.2, 0.8, 0);
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
/* This is the "reference" square.
|
||||
*/
|
||||
|
||||
glActiveTexture( GL_TEXTURE0 );
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
glActiveTexture( GL_TEXTURE1 );
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
|
||||
glTranslatef(-(NUM_TESTS * 1.5), 0, 0);
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f( 0.5, 0.5, 0.5 );
|
||||
glVertex2f(-1, -1);
|
||||
glVertex2f( 1, -1);
|
||||
glVertex2f( 1, 1);
|
||||
glVertex2f(-1, 1);
|
||||
glEnd();
|
||||
|
||||
for ( i = 0 ; i < NUM_TESTS ; i++ ) {
|
||||
glActiveTexture( GL_TEXTURE0 );
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
glBindTexture( GL_TEXTURE_2D, tests[i][0] );
|
||||
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
|
||||
glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, tests[i][1] );
|
||||
glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, tests[i][2] );
|
||||
glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB, tests[i][3] );
|
||||
|
||||
glActiveTexture( GL_TEXTURE1 );
|
||||
glEnable( GL_TEXTURE_2D );
|
||||
glBindTexture( GL_TEXTURE_2D, tests[i][4] );
|
||||
glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
|
||||
glTexEnvi( GL_TEXTURE_ENV, GL_COMBINE_RGB, tests[i][5] );
|
||||
glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE0_RGB, tests[i][6] );
|
||||
glTexEnvi( GL_TEXTURE_ENV, GL_SOURCE1_RGB, tests[i][7] );
|
||||
|
||||
glCallList(1);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
GLfloat ar = (float) width / (float) height;
|
||||
Width = width;
|
||||
Height = height;
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glFrustum( -ar, ar, -1.0, 1.0, Near, Far );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
glTranslatef( 0.0, 0.0, -15.0 );
|
||||
}
|
||||
|
||||
|
||||
static void Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void Init( void )
|
||||
{
|
||||
const char * const ver_string = (const char * const)
|
||||
glGetString( GL_VERSION );
|
||||
float ver = strtof( ver_string, NULL );
|
||||
GLint tex_units;
|
||||
GLint temp[ 256 ];
|
||||
|
||||
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", ver_string);
|
||||
|
||||
if ( (!glutExtensionSupported("GL_ARB_multitexture")
|
||||
&& (ver < 1.3))
|
||||
|| (!glutExtensionSupported("GL_ARB_texture_env_combine")
|
||||
&& !glutExtensionSupported("GL_EXT_texture_env_combine")
|
||||
&& (ver < 1.3))
|
||||
|| (!glutExtensionSupported("GL_ARB_texture_env_crossbar")
|
||||
&& !glutExtensionSupported("GL_NV_texture_env_combine4")
|
||||
&& (ver < 1.4)) ) {
|
||||
printf("\nSorry, this program requires GL_ARB_multitexture and either\n"
|
||||
"GL_ARB_texture_env_combine or GL_EXT_texture_env_combine (or OpenGL 1.3).\n"
|
||||
"Either GL_ARB_texture_env_crossbar or GL_NV_texture_env_combine4 (or\n"
|
||||
"OpenGL 1.4) are also required.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glGetIntegerv( GL_MAX_TEXTURE_UNITS, & tex_units );
|
||||
if ( tex_units < 2 ) {
|
||||
printf("\nSorry, this program requires at least 2 texture units.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("\nAll %u squares should be the same color.\n", NUM_TESTS + 1);
|
||||
|
||||
(void) memset( temp, 0x00, sizeof( temp ) );
|
||||
glBindTexture( GL_TEXTURE_2D, 1 );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, temp );
|
||||
|
||||
(void) memset( temp, 0x7f, sizeof( temp ) );
|
||||
glBindTexture( GL_TEXTURE_2D, 2 );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, temp );
|
||||
|
||||
(void) memset( temp, 0xff, sizeof( temp ) );
|
||||
glBindTexture( GL_TEXTURE_2D, 3 );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, temp );
|
||||
|
||||
(void) memset( temp, 0x3f, sizeof( temp ) );
|
||||
glBindTexture( GL_TEXTURE_2D, 4 );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, temp );
|
||||
|
||||
|
||||
glNewList( 1, GL_COMPILE );
|
||||
glTranslatef(3.0, 0, 0);
|
||||
glBegin(GL_QUADS);
|
||||
glColor3f( 0.9, 0.0, 0.0 );
|
||||
glMultiTexCoord2f( GL_TEXTURE0, 0.5, 0.5 );
|
||||
glMultiTexCoord2f( GL_TEXTURE1, 0.5, 0.5 );
|
||||
glVertex2f(-1, -1);
|
||||
glVertex2f( 1, -1);
|
||||
glVertex2f( 1, 1);
|
||||
glVertex2f(-1, 1);
|
||||
glEnd();
|
||||
glEndList();
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( Width, Height );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
|
||||
glutCreateWindow( "GL_ARB_texture_env_crossbar test" );
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutDisplayFunc( Display );
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
180
progs/tests/invert.c
Normal file
180
progs/tests/invert.c
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* (C) Copyright IBM Corporation 2005
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||
* license, and/or sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file invert.c
|
||||
*
|
||||
* Simple test of GL_MESA_pack_invert functionality. Three squares are
|
||||
* drawn. The first two should look the same, and the third one should
|
||||
* look inverted.
|
||||
*
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "readtex.h"
|
||||
|
||||
#define IMAGE_FILE "../images/tree3.rgb"
|
||||
|
||||
static int Width = 420;
|
||||
static int Height = 150;
|
||||
static const GLfloat Near = 5.0, Far = 25.0;
|
||||
|
||||
static GLubyte * image = NULL;
|
||||
static GLubyte * temp_image = NULL;
|
||||
static GLuint img_width = 0;
|
||||
static GLuint img_height = 0;
|
||||
static GLuint img_format = 0;
|
||||
|
||||
PFNGLWINDOWPOS2IPROC win_pos_2i = NULL;
|
||||
|
||||
|
||||
static void Display( void )
|
||||
{
|
||||
glClearColor(0.2, 0.2, 0.8, 0);
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
|
||||
/* This is the "reference" square.
|
||||
*/
|
||||
|
||||
(*win_pos_2i)( 5, 5 );
|
||||
glDrawPixels( img_width, img_height, img_format, GL_UNSIGNED_BYTE, image );
|
||||
|
||||
glPixelStorei( GL_PACK_INVERT_MESA, GL_FALSE );
|
||||
glReadPixels( 5, 5, img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image );
|
||||
(*win_pos_2i)( 5 + 1 * (10 + img_width), 5 );
|
||||
glDrawPixels( img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image );
|
||||
|
||||
glPixelStorei( GL_PACK_INVERT_MESA, GL_TRUE );
|
||||
glReadPixels( 5, 5, img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image );
|
||||
(*win_pos_2i)( 5 + 2 * (10 + img_width), 5 );
|
||||
glDrawPixels( img_width, img_height, img_format, GL_UNSIGNED_BYTE, temp_image );
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
GLfloat ar = (float) width / (float) height;
|
||||
Width = width;
|
||||
Height = height;
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glFrustum( -ar, ar, -1.0, 1.0, Near, Far );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
glTranslatef( 0.0, 0.0, -15.0 );
|
||||
}
|
||||
|
||||
|
||||
static void Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void Init( void )
|
||||
{
|
||||
const char * const ver_string = (const char * const)
|
||||
glGetString( GL_VERSION );
|
||||
const float ver = strtof( ver_string, NULL );
|
||||
|
||||
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", ver_string);
|
||||
|
||||
if ( !glutExtensionSupported("GL_MESA_pack_invert") ) {
|
||||
printf("\nSorry, this program requires GL_MESA_pack_invert.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ( ver >= 1.4 ) {
|
||||
win_pos_2i = (PFNGLWINDOWPOS2IPROC) glutGetProcAddress( "glWindowPos2i" );
|
||||
}
|
||||
else if ( glutExtensionSupported("GL_ARB_window_pos") ) {
|
||||
win_pos_2i = (PFNGLWINDOWPOS2IPROC) glutGetProcAddress( "glWindowPos2iARB" );
|
||||
}
|
||||
else if ( glutExtensionSupported("GL_MESA_window_pos") ) {
|
||||
win_pos_2i = (PFNGLWINDOWPOS2IPROC) glutGetProcAddress( "glWindowPos2iMESA" );
|
||||
}
|
||||
|
||||
|
||||
/* Do this check as a separate if-statement instead of as an else in case
|
||||
* one of the required extensions is supported but glutGetProcAddress
|
||||
* returns NULL.
|
||||
*/
|
||||
|
||||
if ( win_pos_2i == NULL ) {
|
||||
printf("\nSorry, this program requires either GL 1.4 (or higher),\n"
|
||||
"GL_ARB_window_pos, or GL_MESA_window_pos.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("\nThe left 2 squares should be the same color, and the right\n"
|
||||
"square should look upside-down.\n");
|
||||
|
||||
|
||||
image = LoadRGBImage( IMAGE_FILE, & img_width, & img_height,
|
||||
& img_format );
|
||||
if ( image == NULL ) {
|
||||
printf( "Could not open image file \"%s\".\n", IMAGE_FILE );
|
||||
exit(1);
|
||||
}
|
||||
|
||||
temp_image = malloc( 3 * img_height * img_width );
|
||||
if ( temp_image == NULL ) {
|
||||
printf( "Could not allocate memory for temporary image.\n" );
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( Width, Height );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
|
||||
glutCreateWindow( "GL_MESA_pack_invert test" );
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutDisplayFunc( Display );
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
@@ -24,7 +24,8 @@ PROGS = glthreads \
|
||||
wincopy \
|
||||
xdemo \
|
||||
xfont \
|
||||
xrotfontdemo
|
||||
xrotfontdemo \
|
||||
yuvrect_client
|
||||
|
||||
|
||||
|
||||
|
326
progs/xdemos/yuvrect_client.c
Normal file
326
progs/xdemos/yuvrect_client.c
Normal file
@@ -0,0 +1,326 @@
|
||||
/*
|
||||
* Test the GL_NV_texture_rectangle and GL_MESA_ycrcb_texture extensions and GLX_MESA_allocate-memory
|
||||
*
|
||||
* Dave Airlie - Feb 2005
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GL/glx.h>
|
||||
|
||||
#include "../util/readtex.c" /* I know, this is a hack. */
|
||||
|
||||
#define TEXTURE_FILE "../images/girl2.rgb"
|
||||
|
||||
static GLfloat Xrot = 0, Yrot = 0, Zrot = 0;
|
||||
static GLint ImgWidth, ImgHeight;
|
||||
static GLushort *ImageYUV = NULL;
|
||||
static void *glx_memory;
|
||||
|
||||
static void DrawObject(void)
|
||||
{
|
||||
glBegin(GL_QUADS);
|
||||
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(-1.0, -1.0);
|
||||
|
||||
glTexCoord2f(ImgWidth, 0);
|
||||
glVertex2f(1.0, -1.0);
|
||||
|
||||
glTexCoord2f(ImgWidth, ImgHeight);
|
||||
glVertex2f(1.0, 1.0);
|
||||
|
||||
glTexCoord2f(0, ImgHeight);
|
||||
glVertex2f(-1.0, 1.0);
|
||||
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
static void scr_Display( void )
|
||||
{
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(Xrot, 1.0, 0.0, 0.0);
|
||||
glRotatef(Yrot, 0.0, 1.0, 0.0);
|
||||
glRotatef(Zrot, 0.0, 0.0, 1.0);
|
||||
DrawObject();
|
||||
glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glFrustum( -1.0, 1.0, -1.0, 1.0, 10.0, 100.0 );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
glTranslatef( 0.0, 0.0, -15.0 );
|
||||
}
|
||||
|
||||
static int queryClient(Display *dpy, int screen)
|
||||
{
|
||||
#ifdef GLX_MESA_allocate_memory
|
||||
char *extensions;
|
||||
|
||||
extensions = (char *)glXQueryExtensionsString(dpy, screen);
|
||||
if (!extensions || !strstr(extensions,"GLX_MESA_allocate_memory")) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
query_extension(char* extName) {
|
||||
char *p = (char *) glGetString(GL_EXTENSIONS);
|
||||
char *end = p + strlen(p);
|
||||
while (p < end) {
|
||||
int n = strcspn(p, " ");
|
||||
if ((strlen(extName) == n) && (strncmp(extName, p, n) == 0))
|
||||
return GL_TRUE;
|
||||
p += (n + 1);
|
||||
}
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
static void Init( int argc, char *argv[] , Display *dpy, int screen, Window win)
|
||||
{
|
||||
GLuint texObj = 100;
|
||||
const char *file;
|
||||
void *glx_memory;
|
||||
|
||||
if (!query_extension("GL_NV_texture_rectangle")) {
|
||||
printf("Sorry, GL_NV_texture_rectangle is required\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (!query_extension("GL_MESA_ycbcr_texture")) {
|
||||
printf("Sorry, GL_MESA_ycbcr_texture is required\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (!queryClient(dpy, screen)) {
|
||||
printf("Sorry, GLX_MESA_allocate_memory is required\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, 1);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE_NV, texObj);
|
||||
#ifdef LINEAR_FILTER
|
||||
/* linear filtering looks much nicer but is much slower for Mesa */
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
#else
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
#endif
|
||||
|
||||
if (argc > 1)
|
||||
file = argv[1];
|
||||
else
|
||||
file = TEXTURE_FILE;
|
||||
|
||||
ImageYUV = LoadYUVImage(file, &ImgWidth, &ImgHeight);
|
||||
if (!ImageYUV) {
|
||||
printf("Couldn't read %s\n", TEXTURE_FILE);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
glx_memory = glXAllocateMemoryMESA(dpy, screen, ImgWidth * ImgHeight * 2, 0, 0 ,0);
|
||||
if (!glx_memory)
|
||||
{
|
||||
fprintf(stderr,"Failed to allocate MESA memory\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
memcpy(glx_memory, ImageYUV, ImgWidth * ImgHeight * 2);
|
||||
|
||||
printf("Image: %dx%d\n", ImgWidth, ImgHeight);
|
||||
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0,
|
||||
GL_YCBCR_MESA, ImgWidth, ImgHeight, 0,
|
||||
GL_YCBCR_MESA, GL_UNSIGNED_SHORT_8_8_APPLE, glx_memory);
|
||||
|
||||
assert(glGetError() == GL_NO_ERROR);
|
||||
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
glEnable(GL_TEXTURE_RECTANGLE_NV);
|
||||
|
||||
glShadeModel(GL_FLAT);
|
||||
glClearColor(0.3, 0.3, 0.4, 1.0);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Create an RGB, double-buffered window.
|
||||
* Return the window and context handles.
|
||||
*/
|
||||
static void
|
||||
make_window( Display *dpy, const char *name,
|
||||
int x, int y, int width, int height,
|
||||
Window *winRet, GLXContext *ctxRet)
|
||||
{
|
||||
int attribs[] = { GLX_RGBA,
|
||||
GLX_RED_SIZE, 1,
|
||||
GLX_GREEN_SIZE, 1,
|
||||
GLX_BLUE_SIZE, 1,
|
||||
GLX_DOUBLEBUFFER,
|
||||
GLX_DEPTH_SIZE, 1,
|
||||
None };
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
Window win;
|
||||
GLXContext ctx;
|
||||
XVisualInfo *visinfo;
|
||||
|
||||
scrnum = DefaultScreen( dpy );
|
||||
root = RootWindow( dpy, scrnum );
|
||||
|
||||
visinfo = glXChooseVisual( dpy, scrnum, attribs );
|
||||
if (!visinfo) {
|
||||
printf("Error: couldn't get an RGB, Double-buffered visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
attr.override_redirect = 0;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
|
||||
|
||||
win = XCreateWindow( 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(dpy, win, &sizehints);
|
||||
XSetStandardProperties(dpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
ctx = glXCreateContext( dpy, visinfo, NULL, True );
|
||||
if (!ctx) {
|
||||
printf("Error: glXCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
XFree(visinfo);
|
||||
|
||||
*winRet = win;
|
||||
*ctxRet = ctx;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
event_loop(Display *dpy, Window win)
|
||||
{
|
||||
while (1) {
|
||||
while (XPending(dpy) > 0) {
|
||||
XEvent event;
|
||||
XNextEvent(dpy, &event);
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
/* we'll redraw below */
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
Reshape(event.xconfigure.width, event.xconfigure.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
Display *dpy;
|
||||
Window win;
|
||||
GLXContext ctx;
|
||||
char *dpyName = NULL;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
int i;
|
||||
|
||||
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
|
||||
printf("Warrning: unknown parameter: %s\n", argv[i]);
|
||||
}
|
||||
|
||||
dpy = XOpenDisplay(dpyName);
|
||||
if (!dpy) {
|
||||
printf("Error: couldn't open display %s\n",
|
||||
dpyName ? dpyName : getenv("DISPLAY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
make_window(dpy, "yuvrect_client", 0, 0, 300, 300, &win, &ctx);
|
||||
XMapWindow(dpy, win);
|
||||
glXMakeCurrent(dpy, win, ctx);
|
||||
|
||||
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(argc, argv, dpy, DefaultScreen(dpy), win);
|
||||
|
||||
scr_Display();
|
||||
glXSwapBuffers(dpy, win);
|
||||
event_loop(dpy, win);
|
||||
|
||||
glXFreeMemoryMESA(dpy, DefaultScreen(dpy), glx_memory);
|
||||
glXDestroyContext(dpy, ctx);
|
||||
XDestroyWindow(dpy, win);
|
||||
XCloseDisplay(dpy);
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1409,6 +1409,9 @@ static void scale_internal_ubyte(GLint components, GLint widthin,
|
||||
highy_float = convy_float;
|
||||
|
||||
for (i = 0; i < heightout; i++) {
|
||||
/* Clamp here to be sure we don't read beyond input buffer. */
|
||||
if (highy_int >= heightin)
|
||||
highy_int = heightin - 1;
|
||||
lowx_int = 0;
|
||||
lowx_float = 0;
|
||||
highx_int = convx_int;
|
||||
@@ -1450,7 +1453,7 @@ static void scale_internal_ubyte(GLint components, GLint widthin,
|
||||
totals[k] += (GLubyte)(*(temp_index)) * percent;
|
||||
}
|
||||
|
||||
/* calculate the value for pixels in the last row */
|
||||
/* calculate the value for pixels in the last row */
|
||||
y_percent = highy_float;
|
||||
percent = y_percent * (1-lowx_float);
|
||||
temp = (const char *)datain + xindex + highy_int * ysize;
|
||||
@@ -1623,6 +1626,9 @@ static void scale_internal_byte(GLint components, GLint widthin,
|
||||
highy_float = convy_float;
|
||||
|
||||
for (i = 0; i < heightout; i++) {
|
||||
/* Clamp here to be sure we don't read beyond input buffer. */
|
||||
if (highy_int >= heightin)
|
||||
highy_int = heightin - 1;
|
||||
lowx_int = 0;
|
||||
lowx_float = 0;
|
||||
highx_int = convx_int;
|
||||
@@ -1838,6 +1844,9 @@ static void scale_internal_ushort(GLint components, GLint widthin,
|
||||
highy_float = convy_float;
|
||||
|
||||
for (i = 0; i < heightout; i++) {
|
||||
/* Clamp here to be sure we don't read beyond input buffer. */
|
||||
if (highy_int >= heightin)
|
||||
highy_int = heightin - 1;
|
||||
lowx_int = 0;
|
||||
lowx_float = 0;
|
||||
highx_int = convx_int;
|
||||
@@ -2117,6 +2126,9 @@ static void scale_internal_short(GLint components, GLint widthin,
|
||||
highy_float = convy_float;
|
||||
|
||||
for (i = 0; i < heightout; i++) {
|
||||
/* Clamp here to be sure we don't read beyond input buffer. */
|
||||
if (highy_int >= heightin)
|
||||
highy_int = heightin - 1;
|
||||
lowx_int = 0;
|
||||
lowx_float = 0;
|
||||
highx_int = convx_int;
|
||||
@@ -2406,6 +2418,9 @@ static void scale_internal_uint(GLint components, GLint widthin,
|
||||
highy_float = convy_float;
|
||||
|
||||
for (i = 0; i < heightout; i++) {
|
||||
/* Clamp here to be sure we don't read beyond input buffer. */
|
||||
if (highy_int >= heightin)
|
||||
highy_int = heightin - 1;
|
||||
lowx_int = 0;
|
||||
lowx_float = 0;
|
||||
highx_int = convx_int;
|
||||
@@ -2692,6 +2707,9 @@ static void scale_internal_int(GLint components, GLint widthin,
|
||||
highy_float = convy_float;
|
||||
|
||||
for (i = 0; i < heightout; i++) {
|
||||
/* Clamp here to be sure we don't read beyond input buffer. */
|
||||
if (highy_int >= heightin)
|
||||
highy_int = heightin - 1;
|
||||
lowx_int = 0;
|
||||
lowx_float = 0;
|
||||
highx_int = convx_int;
|
||||
@@ -2985,6 +3003,9 @@ static void scale_internal_float(GLint components, GLint widthin,
|
||||
highy_float = convy_float;
|
||||
|
||||
for (i = 0; i < heightout; i++) {
|
||||
/* Clamp here to be sure we don't read beyond input buffer. */
|
||||
if (highy_int >= heightin)
|
||||
highy_int = heightin - 1;
|
||||
lowx_int = 0;
|
||||
lowx_float = 0;
|
||||
highx_int = convx_int;
|
||||
|
@@ -1,31 +1,25 @@
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 4.0
|
||||
#
|
||||
# Copyright (C) 1999 Brian Paul All Rights Reserved.
|
||||
#
|
||||
# DOS/DJGPP Mesa Utility Toolkit
|
||||
# Version: 1.0
|
||||
#
|
||||
# Copyright (C) 2005 Daniel Borca 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
|
||||
# DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# DOS/DJGPP glut makefile v1.6 for Mesa
|
||||
#
|
||||
# Copyright (C) 2002 - Daniel Borca
|
||||
# Email : dborca@users.sourceforge.net
|
||||
# Web : http://www.geocities.com/dborca
|
||||
|
||||
|
||||
#
|
||||
# Available options:
|
||||
@@ -33,8 +27,6 @@
|
||||
# Environment variables:
|
||||
# CFLAGS
|
||||
#
|
||||
# MKGLUT absolute path to original GLUT.
|
||||
# default = $(TOP)/src/glut/glx
|
||||
# GLIDE path to Glide3 SDK; used to resolve DXEs.
|
||||
# default = $(TOP)/glide3
|
||||
#
|
||||
@@ -49,7 +41,6 @@
|
||||
|
||||
TOP = ../../..
|
||||
GLIDE ?= $(TOP)/glide3
|
||||
MKGLUT ?= $(TOP)/src/glut/glx
|
||||
LIBDIR = $(TOP)/lib
|
||||
GLUT_LIB = libglut.a
|
||||
GLUT_DXE = glut.dxe
|
||||
@@ -58,7 +49,7 @@ GLUT_IMP = libiglut.a
|
||||
export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH);$(LIBDIR);$(GLIDE)/lib
|
||||
|
||||
CC = gcc
|
||||
CFLAGS += -I- -I$(TOP)/include -I. -I$(MKGLUT) -IPC_HW
|
||||
CFLAGS += -I$(TOP)/include -I. -IPC_HW
|
||||
CFLAGS += -DGLUT_IMPORT_LIB
|
||||
|
||||
AR = ar
|
||||
@@ -73,6 +64,7 @@ UNLINK = $(RM) $(1)
|
||||
endif
|
||||
|
||||
CORE_SOURCES = \
|
||||
loop.c \
|
||||
callback.c \
|
||||
color.c \
|
||||
extens.c \
|
||||
@@ -82,7 +74,20 @@ CORE_SOURCES = \
|
||||
overlay.c \
|
||||
state.c \
|
||||
util.c \
|
||||
window.c
|
||||
window.c \
|
||||
f8x13.c \
|
||||
f9x15.c \
|
||||
hel10.c \
|
||||
hel12.c \
|
||||
hel18.c \
|
||||
tr10.c \
|
||||
tr24.c \
|
||||
mroman.c \
|
||||
roman.c \
|
||||
bitmap.c \
|
||||
stroke.c \
|
||||
teapot.c \
|
||||
shapes.c
|
||||
|
||||
PC_HW_SOURCES = \
|
||||
PC_HW/pc_hw.c \
|
||||
@@ -91,25 +96,7 @@ PC_HW_SOURCES = \
|
||||
PC_HW/pc_timer.c \
|
||||
PC_HW/pc_irq.S
|
||||
|
||||
MKGLUT_SOURCES = \
|
||||
$(MKGLUT)/glut_bitmap.c \
|
||||
$(MKGLUT)/glut_bwidth.c \
|
||||
$(MKGLUT)/glut_stroke.c \
|
||||
$(MKGLUT)/glut_swidth.c \
|
||||
$(MKGLUT)/glut_shapes.c \
|
||||
$(MKGLUT)/glut_teapot.c \
|
||||
$(MKGLUT)/glut_8x13.c \
|
||||
$(MKGLUT)/glut_9x15.c \
|
||||
$(MKGLUT)/glut_hel10.c \
|
||||
$(MKGLUT)/glut_hel12.c \
|
||||
$(MKGLUT)/glut_hel18.c \
|
||||
$(MKGLUT)/glut_tr10.c \
|
||||
$(MKGLUT)/glut_tr24.c \
|
||||
$(MKGLUT)/glut_roman.c \
|
||||
$(MKGLUT)/glut_mroman.c \
|
||||
$(MKGLUT)/glut_util.c
|
||||
|
||||
SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES) $(MKGLUT_SOURCES)
|
||||
SOURCES = $(CORE_SOURCES) $(PC_HW_SOURCES)
|
||||
|
||||
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
|
||||
|
||||
@@ -129,12 +116,11 @@ $(LIBDIR)/$(GLUT_DXE) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)
|
||||
ifeq ($(HAVEDXE3),)
|
||||
$(warning Missing DXE3 package... Skipping $(GLUT_DXE))
|
||||
else
|
||||
-dxe3gen -o $(LIBDIR)/$(GLUT_DXE) -Y $(LIBDIR)/$(GLUT_IMP) -D "MesaGLUT DJGPP" -E _glut -P gl.dxe -P glu.dxe -U $^
|
||||
-dxe3gen -o $(LIBDIR)/$(GLUT_DXE) -Y $(LIBDIR)/$(GLUT_IMP) -D "MesaGLUT DJGPP" -E _glut -P gl.dxe -U $^
|
||||
endif
|
||||
|
||||
clean:
|
||||
-$(call UNLINK,*.o)
|
||||
-$(call UNLINK,PC_HW/*.o)
|
||||
-$(call UNLINK,$(MKGLUT)/*.o)
|
||||
|
||||
-include depend
|
||||
|
115
src/glut/dos/bitmap.c
Normal file
115
src/glut/dos/bitmap.c
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2005 Daniel Borca 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
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutBitmapCharacter (void *font, int c)
|
||||
{
|
||||
const GLUTBitmapFont *bfp = _glut_font(font);
|
||||
const GLUTBitmapChar *bcp;
|
||||
|
||||
if (c >= bfp->num || !(bcp = bfp->table[c]))
|
||||
return;
|
||||
|
||||
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
|
||||
|
||||
glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
|
||||
glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glBitmap(bcp->width, bcp->height, bcp->xorig, bcp->yorig,
|
||||
bcp->xmove, 0, bcp->bitmap);
|
||||
|
||||
glPopClientAttrib();
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutBitmapString (void *font, const unsigned char *string)
|
||||
{
|
||||
const GLUTBitmapFont *bfp = _glut_font(font);
|
||||
const GLUTBitmapChar *bcp;
|
||||
unsigned char c;
|
||||
|
||||
glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
|
||||
|
||||
glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
|
||||
glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
while ((c = *(string++))) {
|
||||
if (c < bfp->num && (bcp = bfp->table[c]))
|
||||
glBitmap(bcp->width, bcp->height, bcp->xorig,
|
||||
bcp->yorig, bcp->xmove, 0, bcp->bitmap);
|
||||
}
|
||||
|
||||
glPopClientAttrib();
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY
|
||||
glutBitmapWidth (void *font, int c)
|
||||
{
|
||||
const GLUTBitmapFont *bfp = _glut_font(font);
|
||||
const GLUTBitmapChar *bcp;
|
||||
|
||||
if (c >= bfp->num || !(bcp = bfp->table[c]))
|
||||
return 0;
|
||||
|
||||
return bcp->xmove;
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY
|
||||
glutBitmapLength (void *font, const unsigned char *string)
|
||||
{
|
||||
const GLUTBitmapFont *bfp = _glut_font(font);
|
||||
const GLUTBitmapChar *bcp;
|
||||
unsigned char c;
|
||||
int length = 0;
|
||||
|
||||
while ((c = *(string++))) {
|
||||
if (c < bfp->num && (bcp = bfp->table[c]))
|
||||
length += bcp->xmove;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY
|
||||
glutBitmapHeight (void *font)
|
||||
{
|
||||
const GLUTBitmapFont *bfp = _glut_font(font);
|
||||
|
||||
return bfp->height;
|
||||
}
|
@@ -1,106 +1,103 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* 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:
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* 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
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.6 for Mesa
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
#include "glutint.h"
|
||||
GLUTSShotCB _glut_timer_cb[MAX_TIMER_CB];
|
||||
|
||||
|
||||
GLUTSShotCB g_sscb[MAX_SSHOT_CB];
|
||||
|
||||
GLUTidleCB g_idle_func = NULL;
|
||||
GLUTidleCB _glut_idle_func = NULL;
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutDisplayFunc (GLUTdisplayCB func)
|
||||
{
|
||||
g_curwin->display = func;
|
||||
_glut_current->display = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutReshapeFunc (GLUTreshapeCB func)
|
||||
{
|
||||
g_curwin->reshape = func;
|
||||
_glut_current->reshape = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutKeyboardFunc (GLUTkeyboardCB func)
|
||||
{
|
||||
g_curwin->keyboard = func;
|
||||
_glut_current->keyboard = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMouseFunc (GLUTmouseCB func)
|
||||
{
|
||||
g_curwin->mouse = func;
|
||||
_glut_current->mouse = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMotionFunc (GLUTmotionCB func)
|
||||
{
|
||||
g_curwin->motion = func;
|
||||
_glut_current->motion = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutPassiveMotionFunc (GLUTpassiveCB func)
|
||||
{
|
||||
g_curwin->passive = func;
|
||||
_glut_current->passive = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutEntryFunc (GLUTentryCB func)
|
||||
{
|
||||
g_curwin->entry = func;
|
||||
_glut_current->entry = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutVisibilityFunc (GLUTvisibilityCB func)
|
||||
{
|
||||
g_curwin->visibility = func;
|
||||
_glut_current->visibility = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutWindowStatusFunc (GLUTwindowStatusCB func)
|
||||
{
|
||||
_glut_current->windowStatus = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutIdleFunc (GLUTidleCB func)
|
||||
{
|
||||
g_idle_func = func;
|
||||
_glut_idle_func = func;
|
||||
}
|
||||
|
||||
|
||||
@@ -110,8 +107,8 @@ glutTimerFunc (unsigned int millis, GLUTtimerCB func, int value)
|
||||
int i;
|
||||
|
||||
if (millis > 0) {
|
||||
for (i = 0; i < MAX_SSHOT_CB; i++) {
|
||||
GLUTSShotCB *cb = &g_sscb[i];
|
||||
for (i = 0; i < MAX_TIMER_CB; i++) {
|
||||
GLUTSShotCB *cb = &_glut_timer_cb[i];
|
||||
if (cb->func == NULL) {
|
||||
cb->value = value;
|
||||
cb->func = func;
|
||||
@@ -126,53 +123,82 @@ glutTimerFunc (unsigned int millis, GLUTtimerCB func, int value)
|
||||
void APIENTRY
|
||||
glutSpecialFunc (GLUTspecialCB func)
|
||||
{
|
||||
g_curwin->special = func;
|
||||
_glut_current->special = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSpaceballMotionFunc (GLUTspaceMotionCB func)
|
||||
{
|
||||
_glut_current->spaceMotion = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSpaceballRotateFunc (GLUTspaceRotateCB func)
|
||||
{
|
||||
_glut_current->spaceRotate = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSpaceballButtonFunc (GLUTspaceButtonCB func)
|
||||
{
|
||||
_glut_current->spaceButton = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutDialsFunc (GLUTdialsCB func)
|
||||
{
|
||||
_glut_current->dials = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutButtonBoxFunc (GLUTbuttonBoxCB func)
|
||||
{
|
||||
_glut_current->buttonBox = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutTabletMotionFunc (GLUTtabletMotionCB func)
|
||||
{
|
||||
_glut_current->tabletMotion = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutTabletButtonFunc (GLUTtabletButtonCB func)
|
||||
{
|
||||
_glut_current->tabletButton = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutJoystickFunc (GLUTjoystickCB func, int interval)
|
||||
{
|
||||
_glut_current->joystick = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutKeyboardUpFunc (GLUTkeyboardCB func)
|
||||
{
|
||||
_glut_current->keyboardUp = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSpecialUpFunc (GLUTspecialCB func)
|
||||
{
|
||||
_glut_current->specialUp = func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMouseWheelFunc (GLUTmouseWheelCB func)
|
||||
{
|
||||
_glut_current->mouseWheel = func;
|
||||
}
|
||||
|
@@ -1,34 +1,29 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* 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:
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* 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
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.3 for Mesa
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#include "glutint.h"
|
||||
#include "GL/dmesa.h"
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
#define CLAMP(i) ((i) > 1.0F ? 1.0F : ((i) < 0.0F ? 0.0F : (i)))
|
||||
@@ -37,7 +32,7 @@
|
||||
void APIENTRY
|
||||
glutSetColor (int ndx, GLfloat red, GLfloat green, GLfloat blue)
|
||||
{
|
||||
if (g_display_mode & GLUT_INDEX) {
|
||||
if (_glut_default.mode & GLUT_INDEX) {
|
||||
if ((ndx >= 0) && (ndx < (256 - RESERVED_COLORS))) {
|
||||
DMesaSetCI(ndx, CLAMP(red), CLAMP(green), CLAMP(blue));
|
||||
}
|
||||
|
@@ -1,37 +1,31 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* 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:
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.5 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* 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
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "GL/dmesa.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
int APIENTRY
|
||||
|
1183
src/glut/dos/f8x13.c
Normal file
1183
src/glut/dos/f8x13.c
Normal file
File diff suppressed because it is too large
Load Diff
1407
src/glut/dos/f9x15.c
Normal file
1407
src/glut/dos/f9x15.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,155 +0,0 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.0
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.6 for Mesa
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@users.sourceforge.net
|
||||
* Web : http://www.geocities.com/dborca
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __glutint_h__
|
||||
#define __glutint_h__
|
||||
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "GL/dmesa.h"
|
||||
|
||||
|
||||
/* GLUT function types */
|
||||
typedef void (GLUTCALLBACK *GLUTdisplayCB) (void);
|
||||
typedef void (GLUTCALLBACK *GLUTreshapeCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTkeyboardCB) (unsigned char, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTmouseCB) (int, int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTmotionCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTpassiveCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTentryCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTvisibilityCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTwindowStatusCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTidleCB) (void);
|
||||
typedef void (GLUTCALLBACK *GLUTtimerCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTmenuStateCB) (int); /* DEPRECATED. */
|
||||
typedef void (GLUTCALLBACK *GLUTmenuStatusCB) (int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTselectCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTspecialCB) (int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTspaceMotionCB) (int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTspaceRotateCB) (int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTspaceButtonCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTdialsCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTbuttonBoxCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTtabletMotionCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTtabletButtonCB) (int, int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTjoystickCB) (unsigned int, int, int, int);
|
||||
|
||||
typedef struct GLUTwindow {
|
||||
int num; /* window id */
|
||||
|
||||
DMesaContext context;
|
||||
DMesaBuffer buffer;
|
||||
|
||||
int show_mouse;
|
||||
GLboolean redisplay;
|
||||
|
||||
/* GLUT settable or visible window state. */
|
||||
int xpos;
|
||||
int ypos;
|
||||
int width; /* window width in pixels */
|
||||
int height; /* window height in pixels */
|
||||
|
||||
/* Per-window callbacks. */
|
||||
GLUTdisplayCB display; /* redraw */
|
||||
GLUTreshapeCB reshape; /* resize (width,height) */
|
||||
GLUTmouseCB mouse; /* mouse (button,state,x,y) */
|
||||
GLUTmotionCB motion; /* motion (x,y) */
|
||||
GLUTpassiveCB passive; /* passive motion (x,y) */
|
||||
GLUTentryCB entry; /* window entry/exit (state) */
|
||||
GLUTkeyboardCB keyboard; /* keyboard (ASCII,x,y) */
|
||||
GLUTkeyboardCB keyboardUp; /* keyboard up (ASCII,x,y) */
|
||||
GLUTwindowStatusCB windowStatus; /* window status */
|
||||
GLUTvisibilityCB visibility; /* visibility */
|
||||
GLUTspecialCB special; /* special key */
|
||||
GLUTspecialCB specialUp; /* special up key */
|
||||
GLUTbuttonBoxCB buttonBox; /* button box */
|
||||
GLUTdialsCB dials; /* dials */
|
||||
GLUTspaceMotionCB spaceMotion; /* Spaceball motion */
|
||||
GLUTspaceRotateCB spaceRotate; /* Spaceball rotate */
|
||||
GLUTspaceButtonCB spaceButton; /* Spaceball button */
|
||||
GLUTtabletMotionCB tabletMotion; /* tablet motion */
|
||||
GLUTtabletButtonCB tabletButton; /* tablet button */
|
||||
GLUTjoystickCB joystick; /* joystick */
|
||||
} GLUTwindow;
|
||||
|
||||
extern GLUTidleCB g_idle_func;
|
||||
extern GLUTmenuStatusCB g_menu_status_func;
|
||||
|
||||
extern GLuint g_bpp; /* HW: bits per pixel */
|
||||
extern GLuint g_alpha; /* HW: alpha bits */
|
||||
extern GLuint g_depth; /* HW: depth bits */
|
||||
extern GLuint g_stencil; /* HW: stencil bits */
|
||||
extern GLuint g_accum; /* HW: accum bits */
|
||||
extern GLuint g_refresh; /* HW: vertical refresh rate */
|
||||
extern GLuint g_screen_w, g_screen_h; /* HW: physical screen size */
|
||||
extern GLint g_driver_caps;
|
||||
|
||||
extern GLuint g_fps;
|
||||
|
||||
extern GLuint g_display_mode; /* display bits */
|
||||
extern int g_init_x, g_init_y; /* initial window position */
|
||||
extern GLuint g_init_w, g_init_h; /* initial window size */
|
||||
|
||||
extern int g_mouse; /* non-zero if mouse installed */
|
||||
extern int g_mouse_x, g_mouse_y; /* mouse coords, relative to current win */
|
||||
|
||||
extern GLUTwindow *g_curwin; /* current window */
|
||||
extern GLUTwindow *g_windows[];
|
||||
|
||||
extern char *__glutProgramName; /* program name */
|
||||
|
||||
extern void __glutInitMouse (void);
|
||||
|
||||
/* private routines from glut_util.c */
|
||||
extern char * __glutStrdup(const char *string);
|
||||
extern void __glutWarning(char *format,...);
|
||||
extern void __glutFatalError(char *format,...);
|
||||
extern void __glutFatalUsage(char *format,...);
|
||||
/* Private routines from util.c */
|
||||
#ifdef GLUT_IMPORT_LIB
|
||||
extern void *__glutFont(void *font);
|
||||
#endif
|
||||
|
||||
|
||||
/* hmmm... */
|
||||
#include "pc_hw/pc_hw.h"
|
||||
|
||||
typedef struct {
|
||||
void (*func) (int); /* function to call */
|
||||
int value; /* value to pass to callback */
|
||||
int time; /* end time */
|
||||
} GLUTSShotCB;
|
||||
|
||||
extern GLUTSShotCB g_sscb[];
|
||||
|
||||
#define MAX_WINDOWS 2
|
||||
#define MAX_SSHOT_CB 8
|
||||
#define RESERVED_COLORS 0
|
||||
|
||||
#endif /* __glutint_h__ */
|
1019
src/glut/dos/hel10.c
Normal file
1019
src/glut/dos/hel10.c
Normal file
File diff suppressed because it is too large
Load Diff
1029
src/glut/dos/hel12.c
Normal file
1029
src/glut/dos/hel12.c
Normal file
File diff suppressed because it is too large
Load Diff
1138
src/glut/dos/hel18.c
Normal file
1138
src/glut/dos/hel18.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,63 +1,88 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.0
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* 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:
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.5 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@users.sourceforge.net
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* 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
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "glutint.h"
|
||||
#include "internal.h"
|
||||
|
||||
#define DEFAULT_WIDTH 300
|
||||
#define DEFAULT_HEIGHT 300
|
||||
#define DEFAULT_BPP 16
|
||||
|
||||
#define ALPHA_SIZE 8
|
||||
#define DEPTH_SIZE 16
|
||||
#define STENCIL_SIZE 8
|
||||
#define ACCUM_SIZE 16
|
||||
|
||||
|
||||
GLuint g_bpp = DEFAULT_BPP;
|
||||
GLuint g_alpha = ALPHA_SIZE;
|
||||
GLuint g_depth = DEPTH_SIZE;
|
||||
GLuint g_stencil = STENCIL_SIZE;
|
||||
GLuint g_accum = ACCUM_SIZE;
|
||||
GLuint g_refresh = 0;
|
||||
GLuint g_screen_w, g_screen_h;
|
||||
GLint g_driver_caps;
|
||||
|
||||
GLuint g_fps = 0;
|
||||
|
||||
GLuint g_display_mode = 0;
|
||||
int g_init_x = 0, g_init_y = 0;
|
||||
GLuint g_init_w = DEFAULT_WIDTH, g_init_h = DEFAULT_HEIGHT;
|
||||
|
||||
char *__glutProgramName = NULL;
|
||||
|
||||
GLUTvisual _glut_visual = {
|
||||
16, 8, 16, 8, 16, /* bpp, alpha, depth, stencil, accum */
|
||||
|
||||
{ 0, 0 }, 0, /* geometry */
|
||||
|
||||
0 /* flags */
|
||||
};
|
||||
|
||||
GLUTdefault _glut_default = {
|
||||
0, 0, /* glutInitWindowPosition */
|
||||
300, 300, /* glutInitWindowSize */
|
||||
0 /* glutInitDisplayMode */
|
||||
};
|
||||
|
||||
GLuint _glut_fps = 0;
|
||||
|
||||
static char *init_string;
|
||||
|
||||
|
||||
void
|
||||
_glut_fatal (char *format,...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
fprintf(stderr, "GLUT: Fatal Error in %s: ",
|
||||
__glutProgramName ? __glutProgramName : "(unamed)");
|
||||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
putc('\n', stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
/* strdup is actually not a standard ANSI C or POSIX routine
|
||||
* so implement a private one for GLUT.
|
||||
*/
|
||||
static char *
|
||||
_glut_strdup (const char *string)
|
||||
{
|
||||
if (string != NULL) {
|
||||
int len = strlen(string) + 1;
|
||||
char *p = malloc(len);
|
||||
if (p != NULL) {
|
||||
return strcpy(p, string);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutInit (int *argc, char **argv)
|
||||
@@ -66,22 +91,22 @@ glutInit (int *argc, char **argv)
|
||||
const char *env;
|
||||
|
||||
if ((env = getenv("DMESA_GLUT_BPP")) != NULL) {
|
||||
g_bpp = atoi(env);
|
||||
_glut_visual.bpp = atoi(env);
|
||||
}
|
||||
if ((env = getenv("DMESA_GLUT_ALPHA")) != NULL) {
|
||||
g_alpha = atoi(env);
|
||||
_glut_visual.alpha = atoi(env);
|
||||
}
|
||||
if ((env = getenv("DMESA_GLUT_DEPTH")) != NULL) {
|
||||
g_depth = atoi(env);
|
||||
_glut_visual.depth = atoi(env);
|
||||
}
|
||||
if ((env = getenv("DMESA_GLUT_STENCIL")) != NULL) {
|
||||
g_stencil = atoi(env);
|
||||
_glut_visual.stencil = atoi(env);
|
||||
}
|
||||
if ((env = getenv("DMESA_GLUT_ACCUM")) != NULL) {
|
||||
g_accum = atoi(env);
|
||||
_glut_visual.accum = atoi(env);
|
||||
}
|
||||
if ((env = getenv("DMESA_GLUT_REFRESH")) != NULL) {
|
||||
g_refresh = atoi(env);
|
||||
_glut_visual.refresh = atoi(env);
|
||||
}
|
||||
|
||||
/* Determine program name. */
|
||||
@@ -91,12 +116,12 @@ glutInit (int *argc, char **argv)
|
||||
} else {
|
||||
str++;
|
||||
}
|
||||
__glutProgramName = __glutStrdup(str);
|
||||
__glutProgramName = _glut_strdup(str);
|
||||
|
||||
/* check if GLUT_FPS env var is set */
|
||||
if ((env = getenv("GLUT_FPS")) != NULL) {
|
||||
if ((g_fps = atoi(env)) <= 0) {
|
||||
g_fps = 5000; /* 5000 milliseconds */
|
||||
if ((_glut_fps = atoi(env)) <= 0) {
|
||||
_glut_fps = 5000; /* 5000 milliseconds */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,220 +133,91 @@ glutInit (int *argc, char **argv)
|
||||
void APIENTRY
|
||||
glutInitDisplayMode (unsigned int mode)
|
||||
{
|
||||
g_display_mode = mode;
|
||||
_glut_default.mode = mode;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutInitWindowPosition (int x, int y)
|
||||
{
|
||||
g_init_x = x;
|
||||
g_init_y = y;
|
||||
_glut_default.x = x;
|
||||
_glut_default.y = y;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutInitWindowSize (int width, int height)
|
||||
{
|
||||
g_init_w = width;
|
||||
g_init_h = height;
|
||||
_glut_default.width = width;
|
||||
_glut_default.height = height;
|
||||
}
|
||||
|
||||
|
||||
#define DO_REDISPLAY(w, ccin, ccout) \
|
||||
do { \
|
||||
if (w->redisplay && w->display) { \
|
||||
int rv = GL_TRUE; \
|
||||
\
|
||||
idle = GL_FALSE; \
|
||||
w->redisplay = GL_FALSE; \
|
||||
\
|
||||
/* test IN condition (whether we need to `MakeCurrent') */\
|
||||
if (ccin) { \
|
||||
rv = DMesaMakeCurrent(w->context, w->buffer); \
|
||||
} \
|
||||
\
|
||||
/* do the display only if `MakeCurrent' didn't failed */ \
|
||||
if (rv) { \
|
||||
if (w->show_mouse && !(g_display_mode & GLUT_DOUBLE)) {\
|
||||
/* XXX scare mouse */ \
|
||||
w->display(); \
|
||||
/* XXX unscare mouse */ \
|
||||
} else { \
|
||||
w->display(); \
|
||||
} \
|
||||
\
|
||||
/* update OUT condition */ \
|
||||
ccout; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMainLoop (void)
|
||||
glutInitDisplayString (const char *string)
|
||||
{
|
||||
int i, n;
|
||||
GLUTwindow *w;
|
||||
GLboolean idle;
|
||||
static int old_mouse_x = 0;
|
||||
static int old_mouse_y = 0;
|
||||
static int old_mouse_b = 0;
|
||||
init_string = _glut_strdup(string);
|
||||
}
|
||||
|
||||
{
|
||||
GLint screen_size[2];
|
||||
DMesaGetIntegerv(DMESA_GET_SCREEN_SIZE, screen_size);
|
||||
g_screen_w = screen_size[0];
|
||||
g_screen_h = screen_size[1];
|
||||
DMesaGetIntegerv(DMESA_GET_DRIVER_CAPS, &g_driver_caps);
|
||||
}
|
||||
|
||||
pc_install_keyb();
|
||||
__glutInitMouse();
|
||||
|
||||
for (i = 0; i < MAX_WINDOWS; i++) {
|
||||
w = g_windows[i];
|
||||
if (w != NULL) {
|
||||
glutSetWindow(w->num);
|
||||
glutPostRedisplay();
|
||||
if (w->reshape) {
|
||||
w->reshape(w->width, w->height);
|
||||
}
|
||||
if (w->visibility) {
|
||||
w->visibility(GLUT_VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (GL_TRUE) {
|
||||
idle = GL_TRUE;
|
||||
|
||||
n = 0;
|
||||
for (i = 0; i < MAX_WINDOWS; i++) {
|
||||
w = g_windows[i];
|
||||
if ((w != NULL) && (w != g_curwin)) {
|
||||
/* 1) redisplay `w'
|
||||
* 2) `MakeCurrent' always
|
||||
* 3) update number of non-default windows
|
||||
*/
|
||||
DO_REDISPLAY(w, GL_TRUE, n++);
|
||||
}
|
||||
}
|
||||
/* 1) redisplay `g_curwin'
|
||||
* 2) `MakeCurrent' only if we previously did non-default windows
|
||||
* 3) don't update anything
|
||||
*/
|
||||
DO_REDISPLAY(g_curwin, n, n);
|
||||
|
||||
if (g_mouse) {
|
||||
int mouse_x;
|
||||
int mouse_y;
|
||||
int mouse_z;
|
||||
int mouse_b;
|
||||
|
||||
/* query mouse */
|
||||
mouse_b = pc_query_mouse(&mouse_x, &mouse_y, &mouse_z);
|
||||
|
||||
/* relative to window coordinates */
|
||||
g_mouse_x = mouse_x - g_curwin->xpos;
|
||||
g_mouse_y = mouse_y - g_curwin->ypos;
|
||||
|
||||
/* mouse was moved? */
|
||||
if ((mouse_x != old_mouse_x) || (mouse_y != old_mouse_y)) {
|
||||
idle = GL_FALSE;
|
||||
old_mouse_x = mouse_x;
|
||||
old_mouse_y = mouse_y;
|
||||
|
||||
if (mouse_b) {
|
||||
/* any button pressed */
|
||||
if (g_curwin->motion) {
|
||||
g_curwin->motion(g_mouse_x, g_mouse_y);
|
||||
}
|
||||
} else {
|
||||
/* no button pressed */
|
||||
if (g_curwin->passive) {
|
||||
g_curwin->passive(g_mouse_x, g_mouse_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* button state changed? */
|
||||
if (mouse_b != old_mouse_b) {
|
||||
GLUTmouseCB mouse_func;
|
||||
|
||||
if ((mouse_func = g_curwin->mouse)) {
|
||||
if ((old_mouse_b & 1) && !(mouse_b & 1))
|
||||
mouse_func(GLUT_LEFT_BUTTON, GLUT_UP, g_mouse_x, g_mouse_y);
|
||||
else if (!(old_mouse_b & 1) && (mouse_b & 1))
|
||||
mouse_func(GLUT_LEFT_BUTTON, GLUT_DOWN, g_mouse_x, g_mouse_y);
|
||||
|
||||
if ((old_mouse_b & 2) && !(mouse_b & 2))
|
||||
mouse_func(GLUT_RIGHT_BUTTON, GLUT_UP, g_mouse_x, g_mouse_y);
|
||||
else if (!(old_mouse_b & 2) && (mouse_b & 2))
|
||||
mouse_func(GLUT_RIGHT_BUTTON, GLUT_DOWN, g_mouse_x, g_mouse_y);
|
||||
|
||||
if ((old_mouse_b & 4) && !(mouse_b & 4))
|
||||
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_UP, g_mouse_x, g_mouse_y);
|
||||
else if (!(old_mouse_b & 3) && (mouse_b & 4))
|
||||
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_DOWN, g_mouse_x, g_mouse_y);
|
||||
}
|
||||
|
||||
idle = GL_FALSE;
|
||||
old_mouse_b = mouse_b;
|
||||
}
|
||||
}
|
||||
|
||||
if (pc_keypressed()) {
|
||||
int key;
|
||||
int glut_key;
|
||||
|
||||
idle = GL_FALSE;
|
||||
key = pc_readkey();
|
||||
|
||||
switch (key>>16) {
|
||||
case KEY_F1: glut_key = GLUT_KEY_F1; goto special;
|
||||
case KEY_F2: glut_key = GLUT_KEY_F2; goto special;
|
||||
case KEY_F3: glut_key = GLUT_KEY_F3; goto special;
|
||||
case KEY_F4: glut_key = GLUT_KEY_F4; goto special;
|
||||
case KEY_F5: glut_key = GLUT_KEY_F5; goto special;
|
||||
case KEY_F6: glut_key = GLUT_KEY_F6; goto special;
|
||||
case KEY_F7: glut_key = GLUT_KEY_F7; goto special;
|
||||
case KEY_F8: glut_key = GLUT_KEY_F8; goto special;
|
||||
case KEY_F9: glut_key = GLUT_KEY_F9; goto special;
|
||||
case KEY_F10: glut_key = GLUT_KEY_F10; goto special;
|
||||
case KEY_F11: glut_key = GLUT_KEY_F11; goto special;
|
||||
case KEY_F12: glut_key = GLUT_KEY_F12; goto special;
|
||||
case KEY_LEFT: glut_key = GLUT_KEY_LEFT; goto special;
|
||||
case KEY_UP: glut_key = GLUT_KEY_UP; goto special;
|
||||
case KEY_RIGHT: glut_key = GLUT_KEY_RIGHT; goto special;
|
||||
case KEY_DOWN: glut_key = GLUT_KEY_DOWN; goto special;
|
||||
case KEY_PGUP: glut_key = GLUT_KEY_PAGE_UP; goto special;
|
||||
case KEY_PGDN: glut_key = GLUT_KEY_PAGE_DOWN; goto special;
|
||||
case KEY_HOME: glut_key = GLUT_KEY_HOME; goto special;
|
||||
case KEY_END: glut_key = GLUT_KEY_END; goto special;
|
||||
case KEY_INSERT: glut_key = GLUT_KEY_INSERT; goto special;
|
||||
special:
|
||||
if (g_curwin->special) {
|
||||
g_curwin->special(glut_key, g_mouse_x, g_mouse_y);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (g_curwin->keyboard) {
|
||||
g_curwin->keyboard(key & 0xFF, g_mouse_x, g_mouse_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (idle && g_idle_func)
|
||||
g_idle_func();
|
||||
|
||||
for (i = 0; i < MAX_SSHOT_CB; i++) {
|
||||
int time = glutGet(GLUT_ELAPSED_TIME);
|
||||
GLUTSShotCB *cb = &g_sscb[i];
|
||||
if (cb->func && (time >= cb->time)) {
|
||||
cb->func(cb->value);
|
||||
cb->func = NULL;
|
||||
}
|
||||
}
|
||||
void APIENTRY
|
||||
glutSetOption (GLenum pname, int value)
|
||||
{
|
||||
switch (pname) {
|
||||
case GLUT_INIT_WINDOW_X:
|
||||
_glut_default.x = value;
|
||||
break;
|
||||
case GLUT_INIT_WINDOW_Y:
|
||||
_glut_default.y = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutForceJoystickFunc (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutIgnoreKeyRepeat (int ignore)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSetKeyRepeat (int repeatMode)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutVideoPan (int x, int y, int w, int h)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY
|
||||
glutVideoResizeGet( GLenum eWhat )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSetupVideoResizing (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutStopVideoResizing (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutVideoResize (int x, int y, int w, int h)
|
||||
{
|
||||
}
|
||||
|
197
src/glut/dos/internal.h
Normal file
197
src/glut/dos/internal.h
Normal file
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2005 Daniel Borca 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
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef INTERNAL_H_included
|
||||
#define INTERNAL_H_included
|
||||
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "GL/dmesa.h"
|
||||
|
||||
|
||||
#define MAX_WINDOWS 2
|
||||
#define MAX_TIMER_CB 8
|
||||
#define RESERVED_COLORS 0
|
||||
|
||||
|
||||
/* GLUT function types */
|
||||
typedef void (GLUTCALLBACK *GLUTdisplayCB) (void);
|
||||
typedef void (GLUTCALLBACK *GLUTreshapeCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTkeyboardCB) (unsigned char, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTmouseCB) (int, int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTmotionCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTpassiveCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTentryCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTvisibilityCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTwindowStatusCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTidleCB) (void);
|
||||
typedef void (GLUTCALLBACK *GLUTtimerCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTmenuStateCB) (int); /* DEPRECATED. */
|
||||
typedef void (GLUTCALLBACK *GLUTmenuStatusCB) (int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTselectCB) (int);
|
||||
typedef void (GLUTCALLBACK *GLUTspecialCB) (int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTspaceMotionCB) (int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTspaceRotateCB) (int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTspaceButtonCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTdialsCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTbuttonBoxCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTtabletMotionCB) (int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTtabletButtonCB) (int, int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTjoystickCB) (unsigned int, int, int, int);
|
||||
|
||||
typedef void (GLUTCALLBACK *GLUTdestroyCB) (void);
|
||||
typedef void (GLUTCALLBACK *GLUTmouseWheelCB) (int, int, int, int);
|
||||
typedef void (GLUTCALLBACK *GLUTmenuDestroyCB) (void);
|
||||
|
||||
|
||||
typedef struct {
|
||||
GLuint bpp, alpha;
|
||||
GLuint depth, stencil;
|
||||
GLuint accum;
|
||||
|
||||
GLint geometry[2];
|
||||
GLuint refresh;
|
||||
|
||||
GLint flags;
|
||||
} GLUTvisual;
|
||||
|
||||
typedef struct {
|
||||
GLint x, y;
|
||||
GLint width, height;
|
||||
GLuint mode;
|
||||
} GLUTdefault;
|
||||
|
||||
typedef struct {
|
||||
void (*func) (int);
|
||||
int value;
|
||||
int time;
|
||||
} GLUTSShotCB;
|
||||
|
||||
typedef struct GLUTwindow {
|
||||
int num; /* window id */
|
||||
|
||||
DMesaContext context;
|
||||
DMesaBuffer buffer;
|
||||
|
||||
int show_mouse;
|
||||
GLboolean redisplay;
|
||||
|
||||
/* GLUT settable or visible window state. */
|
||||
int xpos;
|
||||
int ypos;
|
||||
int width; /* window width in pixels */
|
||||
int height; /* window height in pixels */
|
||||
|
||||
/* Per-window callbacks. */
|
||||
GLUTdisplayCB display; /* redraw */
|
||||
GLUTreshapeCB reshape; /* resize (width,height) */
|
||||
GLUTmouseCB mouse; /* mouse (button,state,x,y) */
|
||||
GLUTmotionCB motion; /* motion (x,y) */
|
||||
GLUTpassiveCB passive; /* passive motion (x,y) */
|
||||
GLUTentryCB entry; /* window entry/exit (state) */
|
||||
GLUTkeyboardCB keyboard; /* keyboard (ASCII,x,y) */
|
||||
GLUTkeyboardCB keyboardUp; /* keyboard up (ASCII,x,y) */
|
||||
GLUTwindowStatusCB windowStatus; /* window status */
|
||||
GLUTvisibilityCB visibility; /* visibility */
|
||||
GLUTspecialCB special; /* special key */
|
||||
GLUTspecialCB specialUp; /* special up key */
|
||||
GLUTbuttonBoxCB buttonBox; /* button box */
|
||||
GLUTdialsCB dials; /* dials */
|
||||
GLUTspaceMotionCB spaceMotion; /* Spaceball motion */
|
||||
GLUTspaceRotateCB spaceRotate; /* Spaceball rotate */
|
||||
GLUTspaceButtonCB spaceButton; /* Spaceball button */
|
||||
GLUTtabletMotionCB tabletMotion; /* tablet motion */
|
||||
GLUTtabletButtonCB tabletButton; /* tablet button */
|
||||
GLUTjoystickCB joystick; /* joystick */
|
||||
|
||||
GLUTdestroyCB destroy; /* destroy */
|
||||
GLUTmouseWheelCB mouseWheel; /* mouse wheel */
|
||||
|
||||
/* specific data */
|
||||
void *data;
|
||||
} GLUTwindow;
|
||||
|
||||
typedef struct {
|
||||
int width, height;
|
||||
int xorig, yorig;
|
||||
int xmove;
|
||||
const unsigned char *bitmap;
|
||||
} GLUTBitmapChar;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int height;
|
||||
int num;
|
||||
const GLUTBitmapChar *const *table;
|
||||
} GLUTBitmapFont;
|
||||
|
||||
typedef struct {
|
||||
const GLfloat x, y;
|
||||
} GLUTStrokeVertex;
|
||||
|
||||
typedef struct {
|
||||
const unsigned num;
|
||||
const GLUTStrokeVertex *vertex;
|
||||
} GLUTStrokeStrip;
|
||||
|
||||
typedef struct {
|
||||
const GLfloat right;
|
||||
const unsigned num;
|
||||
const GLUTStrokeStrip *strip;
|
||||
} GLUTStrokeChar;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const unsigned num;
|
||||
const GLUTStrokeChar *const *table;
|
||||
const GLfloat height;
|
||||
const GLfloat descent;
|
||||
} GLUTStrokeFont;
|
||||
|
||||
|
||||
extern char *__glutProgramName;
|
||||
|
||||
extern GLUTvisual _glut_visual;
|
||||
extern GLUTdefault _glut_default;
|
||||
|
||||
extern GLuint _glut_fps;
|
||||
extern GLUTidleCB _glut_idle_func;
|
||||
extern GLUTmenuStatusCB _glut_menu_status_func;
|
||||
extern GLUTSShotCB _glut_timer_cb[];
|
||||
|
||||
extern GLUTwindow *_glut_current, *_glut_windows[];
|
||||
|
||||
extern int _glut_mouse; /* number of buttons, if mouse installed */
|
||||
extern int _glut_mouse_x, _glut_mouse_y; /* mouse coords, relative to current win */
|
||||
|
||||
|
||||
extern void _glut_mouse_init (void);
|
||||
extern void _glut_fatal(char *format,...);
|
||||
extern void *_glut_font (void *font);
|
||||
|
||||
|
||||
#include "pc_hw/pc_hw.h"
|
||||
|
||||
#endif
|
245
src/glut/dos/loop.c
Normal file
245
src/glut/dos/loop.c
Normal file
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* Copyright (C) 2005 Daniel Borca 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
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <GL/glut.h>
|
||||
#include "GL/dmesa.h"
|
||||
|
||||
#include "PC_HW/pc_hw.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
static int looping = 0;
|
||||
|
||||
|
||||
#define DO_REDISPLAY(w, ccin, ccout) \
|
||||
do { \
|
||||
if (w->redisplay && w->display) { \
|
||||
int rv = GL_TRUE; \
|
||||
\
|
||||
idle = GL_FALSE; \
|
||||
w->redisplay = GL_FALSE; \
|
||||
\
|
||||
/* test IN condition (whether we need to `MakeCurrent') */\
|
||||
if (ccin) { \
|
||||
rv = DMesaMakeCurrent(w->context, w->buffer); \
|
||||
} \
|
||||
\
|
||||
/* do the display only if `MakeCurrent' didn't failed */ \
|
||||
if (rv) { \
|
||||
if (w->show_mouse && !(_glut_default.mode & GLUT_DOUBLE)) {\
|
||||
/* XXX scare mouse */ \
|
||||
w->display(); \
|
||||
/* XXX unscare mouse */ \
|
||||
} else { \
|
||||
w->display(); \
|
||||
} \
|
||||
\
|
||||
/* update OUT condition */ \
|
||||
ccout; \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMainLoopEvent (void)
|
||||
{
|
||||
int i, n;
|
||||
GLUTwindow *w;
|
||||
GLboolean idle;
|
||||
static int old_mouse_x = 0;
|
||||
static int old_mouse_y = 0;
|
||||
static int old_mouse_b = 0;
|
||||
|
||||
static GLboolean virgin = GL_TRUE;
|
||||
if (virgin) {
|
||||
pc_install_keyb();
|
||||
_glut_mouse_init();
|
||||
|
||||
for (i = 0; i < MAX_WINDOWS; i++) {
|
||||
w = _glut_windows[i];
|
||||
if (w != NULL) {
|
||||
glutSetWindow(w->num);
|
||||
glutPostRedisplay();
|
||||
if (w->reshape) {
|
||||
w->reshape(w->width, w->height);
|
||||
}
|
||||
if (w->visibility) {
|
||||
w->visibility(GLUT_VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
virgin = GL_FALSE;
|
||||
}
|
||||
|
||||
idle = GL_TRUE;
|
||||
|
||||
n = 0;
|
||||
for (i = 0; i < MAX_WINDOWS; i++) {
|
||||
w = _glut_windows[i];
|
||||
if ((w != NULL) && (w != _glut_current)) {
|
||||
/* 1) redisplay `w'
|
||||
* 2) `MakeCurrent' always
|
||||
* 3) update number of non-default windows
|
||||
*/
|
||||
DO_REDISPLAY(w, GL_TRUE, n++);
|
||||
}
|
||||
}
|
||||
/* 1) redisplay `_glut_current'
|
||||
* 2) `MakeCurrent' only if we previously did non-default windows
|
||||
* 3) don't update anything
|
||||
*/
|
||||
DO_REDISPLAY(_glut_current, n, n);
|
||||
|
||||
if (_glut_mouse) {
|
||||
int mouse_x;
|
||||
int mouse_y;
|
||||
int mouse_z;
|
||||
int mouse_b;
|
||||
|
||||
/* query mouse */
|
||||
mouse_b = pc_query_mouse(&mouse_x, &mouse_y, &mouse_z);
|
||||
|
||||
/* relative to window coordinates */
|
||||
_glut_mouse_x = mouse_x - _glut_current->xpos;
|
||||
_glut_mouse_y = mouse_y - _glut_current->ypos;
|
||||
|
||||
/* mouse was moved? */
|
||||
if ((mouse_x != old_mouse_x) || (mouse_y != old_mouse_y)) {
|
||||
idle = GL_FALSE;
|
||||
old_mouse_x = mouse_x;
|
||||
old_mouse_y = mouse_y;
|
||||
|
||||
if (mouse_b) {
|
||||
/* any button pressed */
|
||||
if (_glut_current->motion) {
|
||||
_glut_current->motion(_glut_mouse_x, _glut_mouse_y);
|
||||
}
|
||||
} else {
|
||||
/* no button pressed */
|
||||
if (_glut_current->passive) {
|
||||
_glut_current->passive(_glut_mouse_x, _glut_mouse_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* button state changed? */
|
||||
if (mouse_b != old_mouse_b) {
|
||||
GLUTmouseCB mouse_func;
|
||||
|
||||
if ((mouse_func = _glut_current->mouse)) {
|
||||
if ((old_mouse_b & 1) && !(mouse_b & 1))
|
||||
mouse_func(GLUT_LEFT_BUTTON, GLUT_UP, _glut_mouse_x, _glut_mouse_y);
|
||||
else if (!(old_mouse_b & 1) && (mouse_b & 1))
|
||||
mouse_func(GLUT_LEFT_BUTTON, GLUT_DOWN, _glut_mouse_x, _glut_mouse_y);
|
||||
|
||||
if ((old_mouse_b & 2) && !(mouse_b & 2))
|
||||
mouse_func(GLUT_RIGHT_BUTTON, GLUT_UP, _glut_mouse_x, _glut_mouse_y);
|
||||
else if (!(old_mouse_b & 2) && (mouse_b & 2))
|
||||
mouse_func(GLUT_RIGHT_BUTTON, GLUT_DOWN, _glut_mouse_x, _glut_mouse_y);
|
||||
|
||||
if ((old_mouse_b & 4) && !(mouse_b & 4))
|
||||
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_UP, _glut_mouse_x, _glut_mouse_y);
|
||||
else if (!(old_mouse_b & 3) && (mouse_b & 4))
|
||||
mouse_func(GLUT_MIDDLE_BUTTON, GLUT_DOWN, _glut_mouse_x, _glut_mouse_y);
|
||||
}
|
||||
|
||||
idle = GL_FALSE;
|
||||
old_mouse_b = mouse_b;
|
||||
}
|
||||
}
|
||||
|
||||
if (pc_keypressed()) {
|
||||
int key;
|
||||
int glut_key;
|
||||
|
||||
idle = GL_FALSE;
|
||||
key = pc_readkey();
|
||||
|
||||
switch (key>>16) {
|
||||
case KEY_F1: glut_key = GLUT_KEY_F1; goto special;
|
||||
case KEY_F2: glut_key = GLUT_KEY_F2; goto special;
|
||||
case KEY_F3: glut_key = GLUT_KEY_F3; goto special;
|
||||
case KEY_F4: glut_key = GLUT_KEY_F4; goto special;
|
||||
case KEY_F5: glut_key = GLUT_KEY_F5; goto special;
|
||||
case KEY_F6: glut_key = GLUT_KEY_F6; goto special;
|
||||
case KEY_F7: glut_key = GLUT_KEY_F7; goto special;
|
||||
case KEY_F8: glut_key = GLUT_KEY_F8; goto special;
|
||||
case KEY_F9: glut_key = GLUT_KEY_F9; goto special;
|
||||
case KEY_F10: glut_key = GLUT_KEY_F10; goto special;
|
||||
case KEY_F11: glut_key = GLUT_KEY_F11; goto special;
|
||||
case KEY_F12: glut_key = GLUT_KEY_F12; goto special;
|
||||
case KEY_LEFT: glut_key = GLUT_KEY_LEFT; goto special;
|
||||
case KEY_UP: glut_key = GLUT_KEY_UP; goto special;
|
||||
case KEY_RIGHT: glut_key = GLUT_KEY_RIGHT; goto special;
|
||||
case KEY_DOWN: glut_key = GLUT_KEY_DOWN; goto special;
|
||||
case KEY_PGUP: glut_key = GLUT_KEY_PAGE_UP; goto special;
|
||||
case KEY_PGDN: glut_key = GLUT_KEY_PAGE_DOWN; goto special;
|
||||
case KEY_HOME: glut_key = GLUT_KEY_HOME; goto special;
|
||||
case KEY_END: glut_key = GLUT_KEY_END; goto special;
|
||||
case KEY_INSERT: glut_key = GLUT_KEY_INSERT; goto special;
|
||||
special:
|
||||
if (_glut_current->special) {
|
||||
_glut_current->special(glut_key, _glut_mouse_x, _glut_mouse_y);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (_glut_current->keyboard) {
|
||||
_glut_current->keyboard(key & 0xFF, _glut_mouse_x, _glut_mouse_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (idle && _glut_idle_func)
|
||||
_glut_idle_func();
|
||||
|
||||
for (i = 0; i < MAX_TIMER_CB; i++) {
|
||||
int time = glutGet(GLUT_ELAPSED_TIME);
|
||||
GLUTSShotCB *cb = &_glut_timer_cb[i];
|
||||
if (cb->func && (time >= cb->time)) {
|
||||
cb->func(cb->value);
|
||||
cb->func = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMainLoop (void)
|
||||
{
|
||||
looping++;
|
||||
while (looping) {
|
||||
glutMainLoopEvent();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutLeaveMainLoop (void)
|
||||
{
|
||||
looping--;
|
||||
}
|
@@ -1,49 +1,45 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* 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:
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.3 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* 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
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "glutint.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
GLUTmenuStatusCB g_menu_status_func = NULL;
|
||||
GLUTmenuStatusCB _glut_menu_status_func = NULL;
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMenuStateFunc (GLUTmenuStateCB func)
|
||||
{
|
||||
g_menu_status_func = (GLUTmenuStatusCB)func;
|
||||
_glut_menu_status_func = (GLUTmenuStatusCB)func;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMenuStatusFunc (GLUTmenuStatusCB func)
|
||||
{
|
||||
g_menu_status_func = func;
|
||||
_glut_menu_status_func = func;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,3 +109,22 @@ void APIENTRY
|
||||
glutDetachMenu (int button)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutMenuDestroyFunc ( void (* callback)( void ) )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void * APIENTRY
|
||||
glutGetMenuData (void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSetMenuData (void *data)
|
||||
{
|
||||
}
|
||||
|
@@ -1,46 +1,42 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* 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:
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.3 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* 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
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "glutint.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
int g_mouse;
|
||||
int g_mouse_x = 0, g_mouse_y = 0;
|
||||
int _glut_mouse;
|
||||
int _glut_mouse_x = 0, _glut_mouse_y = 0;
|
||||
|
||||
|
||||
void
|
||||
__glutInitMouse (void)
|
||||
_glut_mouse_init (void)
|
||||
{
|
||||
if ((g_mouse = pc_install_mouse())) {
|
||||
pc_mouse_area(g_curwin->xpos, g_curwin->ypos, g_curwin->xpos + g_curwin->width - 1, g_curwin->ypos + g_curwin->height - 1);
|
||||
if ((_glut_mouse = pc_install_mouse())) {
|
||||
pc_mouse_area(_glut_current->xpos, _glut_current->ypos, _glut_current->xpos + _glut_current->width - 1, _glut_current->ypos + _glut_current->height - 1);
|
||||
|
||||
g_curwin->show_mouse = (g_curwin->mouse || g_curwin->motion || g_curwin->passive);
|
||||
_glut_current->show_mouse = (_glut_current->mouse || _glut_current->motion || _glut_current->passive);
|
||||
}
|
||||
}
|
||||
|
||||
|
2783
src/glut/dos/mroman.c
Normal file
2783
src/glut/dos/mroman.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,33 +1,29 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* 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:
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.3 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* 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
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "glutint.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
int APIENTRY
|
||||
@@ -89,3 +85,9 @@ void APIENTRY
|
||||
glutHideOverlay (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutPostWindowOverlayRedisplay (int win)
|
||||
{
|
||||
}
|
||||
|
2783
src/glut/dos/roman.c
Normal file
2783
src/glut/dos/roman.c
Normal file
File diff suppressed because it is too large
Load Diff
1143
src/glut/dos/shapes.c
Normal file
1143
src/glut/dos/shapes.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,35 +1,31 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* 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:
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.5 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* 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
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "glutint.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
#define FREQUENCY 100 /* set this to zero to use the default timer */
|
||||
@@ -58,35 +54,35 @@ glutGet (GLenum type)
|
||||
{
|
||||
switch (type) {
|
||||
case GLUT_WINDOW_X:
|
||||
return g_curwin->xpos;
|
||||
return _glut_current->xpos;
|
||||
case GLUT_WINDOW_Y:
|
||||
return g_curwin->ypos;
|
||||
return _glut_current->ypos;
|
||||
case GLUT_WINDOW_WIDTH:
|
||||
return g_curwin->width;
|
||||
return _glut_current->width;
|
||||
case GLUT_WINDOW_HEIGHT:
|
||||
return g_curwin->height;
|
||||
return _glut_current->height;
|
||||
case GLUT_WINDOW_STENCIL_SIZE:
|
||||
return g_stencil;
|
||||
return _glut_visual.stencil;
|
||||
case GLUT_WINDOW_DEPTH_SIZE:
|
||||
return g_depth;
|
||||
return _glut_visual.depth;
|
||||
case GLUT_WINDOW_RGBA:
|
||||
return !(g_display_mode & GLUT_INDEX);
|
||||
return !(_glut_default.mode & GLUT_INDEX);
|
||||
case GLUT_WINDOW_COLORMAP_SIZE:
|
||||
return (g_display_mode & GLUT_INDEX) ? (256 - RESERVED_COLORS) : 0;
|
||||
return (_glut_default.mode & GLUT_INDEX) ? (256 - RESERVED_COLORS) : 0;
|
||||
case GLUT_SCREEN_WIDTH:
|
||||
return g_screen_w;
|
||||
return _glut_visual.geometry[0];
|
||||
case GLUT_SCREEN_HEIGHT:
|
||||
return g_screen_h;
|
||||
return _glut_visual.geometry[1];
|
||||
case GLUT_INIT_WINDOW_X:
|
||||
return g_init_x;
|
||||
return _glut_default.x;
|
||||
case GLUT_INIT_WINDOW_Y:
|
||||
return g_init_y;
|
||||
return _glut_default.y;
|
||||
case GLUT_INIT_WINDOW_WIDTH:
|
||||
return g_init_w;
|
||||
return _glut_default.width;
|
||||
case GLUT_INIT_WINDOW_HEIGHT:
|
||||
return g_init_h;
|
||||
return _glut_default.height;
|
||||
case GLUT_INIT_DISPLAY_MODE:
|
||||
return g_display_mode;
|
||||
return _glut_default.mode;
|
||||
case GLUT_ELAPSED_TIME:
|
||||
#if FREQUENCY
|
||||
if (!timer_installed) {
|
||||
@@ -121,9 +117,9 @@ glutDeviceGet (GLenum type)
|
||||
case GLUT_HAS_KEYBOARD:
|
||||
return GL_TRUE;
|
||||
case GLUT_HAS_MOUSE:
|
||||
return (g_mouse != 0);
|
||||
return (_glut_mouse != 0);
|
||||
case GLUT_NUM_MOUSE_BUTTONS:
|
||||
return g_mouse;
|
||||
return _glut_mouse;
|
||||
case GLUT_HAS_SPACEBALL:
|
||||
case GLUT_HAS_DIAL_AND_BUTTON_BOX:
|
||||
case GLUT_HAS_TABLET:
|
||||
@@ -161,10 +157,17 @@ glutGetModifiers (void)
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutReportErrors (void)
|
||||
{
|
||||
/* reports all the OpenGL errors that happened till now */
|
||||
}
|
||||
|
||||
|
||||
/* GAME MODE
|
||||
* Hack alert: incomplete... what is GameMode, anyway?
|
||||
*/
|
||||
GLint g_game;
|
||||
static GLint game;
|
||||
static GLboolean game_possible;
|
||||
static GLboolean game_active;
|
||||
static GLuint game_width;
|
||||
@@ -189,7 +192,7 @@ glutGameModeGet (GLenum mode)
|
||||
case GLUT_GAME_MODE_ACTIVE:
|
||||
return game_active;
|
||||
case GLUT_GAME_MODE_POSSIBLE:
|
||||
return game_possible && !g_curwin;
|
||||
return game_possible && !_glut_current;
|
||||
case GLUT_GAME_MODE_WIDTH:
|
||||
return game_active ? (int)game_width : -1;
|
||||
case GLUT_GAME_MODE_HEIGHT:
|
||||
@@ -208,16 +211,16 @@ int APIENTRY
|
||||
glutEnterGameMode (void)
|
||||
{
|
||||
if (glutGameModeGet(GLUT_GAME_MODE_POSSIBLE)) {
|
||||
g_bpp = game_bpp;
|
||||
g_refresh = game_refresh;
|
||||
_glut_visual.bpp = game_bpp;
|
||||
_glut_visual.refresh = game_refresh;
|
||||
|
||||
glutInitWindowSize(game_width, game_height);
|
||||
|
||||
if ((g_game = glutCreateWindow("<game>")) > 0) {
|
||||
if ((game = glutCreateWindow("<game>")) > 0) {
|
||||
game_active = GL_TRUE;
|
||||
}
|
||||
|
||||
return g_game;
|
||||
return game;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@@ -230,6 +233,6 @@ glutLeaveGameMode (void)
|
||||
if (glutGameModeGet(GLUT_GAME_MODE_ACTIVE)) {
|
||||
game_active = GL_FALSE;
|
||||
|
||||
glutDestroyWindow(g_game);
|
||||
glutDestroyWindow(game);
|
||||
}
|
||||
}
|
||||
|
118
src/glut/dos/stroke.c
Normal file
118
src/glut/dos/stroke.c
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* FxGLUT version 0.12 - GLUT for Voodoo 1 and 2 under Linux
|
||||
* Copyright (C) 1999 Christopher John Purnell
|
||||
* cjp@lost.org.uk
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
void
|
||||
glutStrokeCharacter (void *font, int c)
|
||||
{
|
||||
const GLUTStrokeFont *sfp = _glut_font(font);
|
||||
const GLUTStrokeChar *scp;
|
||||
const GLUTStrokeStrip *ssp;
|
||||
const GLUTStrokeVertex *svp;
|
||||
unsigned i, j;
|
||||
|
||||
if (((unsigned)c) >= sfp->num || !(scp = sfp->table[c]))
|
||||
return;
|
||||
|
||||
ssp = scp->strip;
|
||||
|
||||
for (i = 0; i < scp->num; i++, ssp++) {
|
||||
svp = ssp->vertex;
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for (j = 0; j < ssp->num; j++, svp++) {
|
||||
glVertex2f(svp->x, svp->y);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
glTranslatef(scp->right, 0.0, 0.0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
glutStrokeString (void *font, const unsigned char *string)
|
||||
{
|
||||
const GLUTStrokeFont *sfp = _glut_font(font);
|
||||
const GLUTStrokeChar *scp;
|
||||
const GLUTStrokeStrip *ssp;
|
||||
const GLUTStrokeVertex *svp;
|
||||
unsigned char c;
|
||||
unsigned i, j;
|
||||
|
||||
while ((c = *(string++))) {
|
||||
if (c < sfp->num && (scp = sfp->table[c])) {
|
||||
ssp = scp->strip;
|
||||
|
||||
for (i = 0; i < scp->num; i++, ssp++) {
|
||||
svp = ssp->vertex;
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for (j = 0; j < ssp->num; j++, svp++) {
|
||||
glVertex2f(svp->x, svp->y);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
glTranslatef(scp->right, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
glutStrokeWidth (void *font, int c)
|
||||
{
|
||||
const GLUTStrokeFont *sfp = _glut_font(font);
|
||||
const GLUTStrokeChar *scp;
|
||||
|
||||
if (((unsigned)c) >= sfp->num || !(scp = sfp->table[c]))
|
||||
return 0;
|
||||
|
||||
return scp->right;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
glutStrokeLength (void *font, const unsigned char *string)
|
||||
{
|
||||
const GLUTStrokeFont *sfp = _glut_font(font);
|
||||
const GLUTStrokeChar *scp;
|
||||
unsigned char c;
|
||||
int length = 0;
|
||||
|
||||
while ((c = *(string++))) {
|
||||
if (c < sfp->num && (scp = sfp->table[c]))
|
||||
length += scp->right;
|
||||
}
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
|
||||
GLfloat
|
||||
glutStrokeHeight (void *font)
|
||||
{
|
||||
const GLUTStrokeFont *sfp = _glut_font(font);
|
||||
|
||||
return sfp->height;
|
||||
}
|
201
src/glut/dos/teapot.c
Normal file
201
src/glut/dos/teapot.c
Normal file
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
* (c) Copyright 1993, Silicon Graphics, Inc.
|
||||
*
|
||||
* ALL RIGHTS RESERVED
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* for any purpose and without fee is hereby granted, provided
|
||||
* that the above copyright notice appear in all copies and that
|
||||
* both the copyright notice and this permission notice appear in
|
||||
* supporting documentation, and that the name of Silicon
|
||||
* Graphics, Inc. not be used in advertising or publicity
|
||||
* pertaining to distribution of the software without specific,
|
||||
* written prior permission.
|
||||
*
|
||||
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU
|
||||
* "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR
|
||||
* OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO
|
||||
* EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE
|
||||
* ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER,
|
||||
* INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE,
|
||||
* SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR
|
||||
* NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* US Government Users Restricted Rights
|
||||
*
|
||||
* Use, duplication, or disclosure by the Government is subject to
|
||||
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
|
||||
* (c)(1)(ii) of the Rights in Technical Data and Computer
|
||||
* Software clause at DFARS 252.227-7013 and/or in similar or
|
||||
* successor clauses in the FAR or the DOD or NASA FAR
|
||||
* Supplement. Unpublished-- rights reserved under the copyright
|
||||
* laws of the United States. Contractor/manufacturer is Silicon
|
||||
* Graphics, Inc., 2011 N. Shoreline Blvd., Mountain View, CA
|
||||
* 94039-7311.
|
||||
*
|
||||
* OpenGL(TM) is a trademark of Silicon Graphics, Inc.
|
||||
*/
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
/*
|
||||
* Rim, body, lid, and bottom data must be reflected in x and y;
|
||||
* handle and spout data across the y axis only.
|
||||
*/
|
||||
static int patchdata[][16] =
|
||||
{
|
||||
{ 102, 103, 104, 105, 4, 5, 6, 7,
|
||||
8, 9, 10, 11, 12, 13, 14, 15 }, /* rim */
|
||||
{ 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 23, 24, 25, 26, 27 }, /* body */
|
||||
{ 24, 25, 26, 27, 29, 30, 31, 32,
|
||||
33, 34, 35, 36, 37, 38, 39, 40 },
|
||||
{ 96, 96, 96, 96, 97, 98, 99, 100,
|
||||
101, 101, 101, 101, 0, 1, 2, 3 }, /* lid */
|
||||
{ 0, 1, 2, 3, 106, 107, 108, 109,
|
||||
110, 111, 112, 113, 114, 115, 116, 117 },
|
||||
{ 118, 118, 118, 118, 124, 122, 119, 121,
|
||||
123, 126, 125, 120, 40, 39, 38, 37 }, /* bottom */
|
||||
{ 41, 42, 43, 44, 45, 46, 47, 48,
|
||||
49, 50, 51, 52, 53, 54, 55, 56 }, /* handle */
|
||||
{ 53, 54, 55, 56, 57, 58, 59, 60,
|
||||
61, 62, 63, 64, 28, 65, 66, 67 },
|
||||
{ 68, 69, 70, 71, 72, 73, 74, 75,
|
||||
76, 77, 78, 79, 80, 81, 82, 83 }, /* spout */
|
||||
{ 80, 81, 82, 83, 84, 85, 86, 87,
|
||||
88, 89, 90, 91, 92, 93, 94, 95 }
|
||||
};
|
||||
|
||||
static float cpdata[][3] =
|
||||
{
|
||||
{0.2, 0, 2.7}, {0.2, -0.112, 2.7}, {0.112, -0.2, 2.7},
|
||||
{0,-0.2, 2.7}, {1.3375, 0, 2.53125}, {1.3375, -0.749, 2.53125},
|
||||
{0.749, -1.3375, 2.53125}, {0, -1.3375, 2.53125},
|
||||
{1.4375, 0, 2.53125}, {1.4375, -0.805, 2.53125},
|
||||
{0.805, -1.4375, 2.53125}, {0, -1.4375, 2.53125},
|
||||
{1.5, 0, 2.4}, {1.5, -0.84, 2.4}, {0.84, -1.5, 2.4},
|
||||
{0, -1.5, 2.4}, {1.75, 0, 1.875}, {1.75, -0.98, 1.875},
|
||||
{0.98, -1.75, 1.875}, {0, -1.75, 1.875}, {2, 0, 1.35},
|
||||
{2, -1.12, 1.35}, {1.12, -2, 1.35}, {0, -2, 1.35}, {2, 0, 0.9},
|
||||
{2, -1.12, 0.9}, {1.12, -2, 0.9}, {0, -2, 0.9}, {-2, 0, 0.9},
|
||||
{2, 0, 0.45}, {2, -1.12, 0.45}, {1.12, -2, 0.45}, {0, -2, 0.45},
|
||||
{1.5, 0, 0.225}, {1.5, -0.84, 0.225}, {0.84, -1.5, 0.225},
|
||||
{0, -1.5, 0.225}, {1.5, 0, 0.15}, {1.5, -0.84, 0.15},
|
||||
{0.84, -1.5, 0.15}, {0, -1.5, 0.15}, {-1.6, 0, 2.025},
|
||||
{-1.6, -0.3, 2.025}, {-1.5, -0.3, 2.25}, {-1.5, 0, 2.25},
|
||||
{-2.3, 0, 2.025}, {-2.3, -0.3, 2.025}, {-2.5, -0.3, 2.25},
|
||||
{-2.5, 0, 2.25}, {-2.7, 0, 2.025}, {-2.7, -0.3, 2.025},
|
||||
{-3, -0.3, 2.25}, {-3, 0, 2.25}, {-2.7, 0, 1.8},
|
||||
{-2.7, -0.3, 1.8}, {-3, -0.3, 1.8}, {-3, 0, 1.8},
|
||||
{-2.7, 0, 1.575}, {-2.7, -0.3, 1.575}, {-3, -0.3, 1.35},
|
||||
{-3, 0, 1.35}, {-2.5, 0, 1.125}, {-2.5, -0.3, 1.125},
|
||||
{-2.65, -0.3, 0.9375}, {-2.65, 0, 0.9375}, {-2, -0.3, 0.9},
|
||||
{-1.9, -0.3, 0.6}, {-1.9, 0, 0.6}, {1.7, 0, 1.425},
|
||||
{1.7, -0.66, 1.425}, {1.7, -0.66, 0.6}, {1.7, 0, 0.6},
|
||||
{2.6, 0, 1.425}, {2.6, -0.66, 1.425}, {3.1, -0.66, 0.825},
|
||||
{3.1, 0, 0.825}, {2.3, 0, 2.1}, {2.3, -0.25, 2.1},
|
||||
{2.4, -0.25, 2.025}, {2.4, 0, 2.025}, {2.7, 0, 2.4},
|
||||
{2.7, -0.25, 2.4}, {3.3, -0.25, 2.4}, {3.3, 0, 2.4},
|
||||
{2.8, 0, 2.475}, {2.8, -0.25, 2.475}, {3.525, -0.25, 2.49375},
|
||||
{3.525, 0, 2.49375}, {2.9, 0, 2.475}, {2.9, -0.15, 2.475},
|
||||
{3.45, -0.15, 2.5125}, {3.45, 0, 2.5125}, {2.8, 0, 2.4},
|
||||
{2.8, -0.15, 2.4}, {3.2, -0.15, 2.4}, {3.2, 0, 2.4},
|
||||
{0, 0, 3.15}, {0.8, 0, 3.15}, {0.8, -0.45, 3.15},
|
||||
{0.45, -0.8, 3.15}, {0, -0.8, 3.15}, {0, 0, 2.85}, {1.4, 0, 2.4},
|
||||
{1.4, -0.784, 2.4}, {0.784, -1.4, 2.4}, {0, -1.4, 2.4},
|
||||
{0.4, 0, 2.55}, {0.4, -0.224, 2.55}, {0.224, -0.4, 2.55},
|
||||
{0, -0.4, 2.55}, {1.3, 0, 2.55}, {1.3, -0.728, 2.55},
|
||||
{0.728, -1.3, 2.55}, {0, -1.3, 2.55}, {1.3, 0, 2.4},
|
||||
{1.3, -0.728, 2.4}, {0.728, -1.3, 2.4}, {0, -1.3, 2.4},
|
||||
{0, 0, 0}, {1.425, -0.798, 0}, {1.5, 0, 0.075}, {1.425, 0, 0},
|
||||
{0.798, -1.425, 0}, {0, -1.5, 0.075}, {0, -1.425, 0},
|
||||
{1.5, -0.84, 0.075}, {0.84, -1.5, 0.075}
|
||||
};
|
||||
|
||||
static float tex[2][2][2] =
|
||||
{
|
||||
{ {0, 0}, {1, 0} },
|
||||
{ {0, 1}, {1, 1} }
|
||||
};
|
||||
|
||||
static void teapot( GLint grid, GLdouble scale, GLenum type )
|
||||
{
|
||||
float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3];
|
||||
long i, j, k, l;
|
||||
|
||||
glPushAttrib( GL_ENABLE_BIT | GL_EVAL_BIT );
|
||||
glEnable( GL_AUTO_NORMAL );
|
||||
glEnable( GL_NORMALIZE );
|
||||
glEnable( GL_MAP2_VERTEX_3 );
|
||||
glEnable( GL_MAP2_TEXTURE_COORD_2 );
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(270.0, 1.0, 0.0, 0.0);
|
||||
glScalef(0.5 * scale, 0.5 * scale, 0.5 * scale);
|
||||
glTranslatef(0.0, 0.0, -1.5);
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
for (k = 0; k < 4; k++)
|
||||
{
|
||||
for (l = 0; l < 3; l++)
|
||||
{
|
||||
p[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
|
||||
q[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l];
|
||||
if (l == 1)
|
||||
q[j][k][l] *= -1.0;
|
||||
if (i < 6)
|
||||
{
|
||||
r[j][k][l] = cpdata[patchdata[i][j * 4 + (3 - k)]][l];
|
||||
if (l == 0)
|
||||
r[j][k][l] *= -1.0;
|
||||
s[j][k][l] = cpdata[patchdata[i][j * 4 + k]][l];
|
||||
if (l == 0)
|
||||
s[j][k][l] *= -1.0;
|
||||
if (l == 1)
|
||||
s[j][k][l] *= -1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glMap2f(GL_MAP2_TEXTURE_COORD_2, 0, 1, 2, 2, 0, 1, 4, 2,
|
||||
&tex[0][0][0]);
|
||||
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
|
||||
&p[0][0][0]);
|
||||
glMapGrid2f(grid, 0.0, 1.0, grid, 0.0, 1.0);
|
||||
glEvalMesh2(type, 0, grid, 0, grid);
|
||||
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
|
||||
&q[0][0][0]);
|
||||
glEvalMesh2(type, 0, grid, 0, grid);
|
||||
if (i < 6)
|
||||
{
|
||||
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
|
||||
&r[0][0][0]);
|
||||
glEvalMesh2(type, 0, grid, 0, grid);
|
||||
glMap2f(GL_MAP2_VERTEX_3, 0, 1, 3, 4, 0, 1, 12, 4,
|
||||
&s[0][0][0]);
|
||||
glEvalMesh2(type, 0, grid, 0, grid);
|
||||
}
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
glPopAttrib();
|
||||
}
|
||||
|
||||
void glutWireTeapot(GLdouble size)
|
||||
{
|
||||
teapot(10, size, GL_LINE);
|
||||
}
|
||||
|
||||
void glutSolidTeapot(GLdouble size)
|
||||
{
|
||||
teapot(7, size, GL_FILL);
|
||||
}
|
1018
src/glut/dos/tr10.c
Normal file
1018
src/glut/dos/tr10.c
Normal file
File diff suppressed because it is too large
Load Diff
1301
src/glut/dos/tr24.c
Normal file
1301
src/glut/dos/tr24.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,40 +1,33 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.4
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* 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:
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.4 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@yahoo.com
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* 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
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include "glutint.h"
|
||||
#include "glutbitmap.h"
|
||||
#include "glutstroke.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
#ifdef GLUT_IMPORT_LIB
|
||||
extern StrokeFontRec glutStrokeRoman, glutStrokeMonoRoman;
|
||||
extern BitmapFontRec glutBitmap8By13, glutBitmap9By15, glutBitmapTimesRoman10, glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12, glutBitmapHelvetica18;
|
||||
extern GLUTStrokeFont glutStrokeRoman, glutStrokeMonoRoman;
|
||||
extern GLUTBitmapFont glutBitmap8By13, glutBitmap9By15, glutBitmapTimesRoman10, glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12, glutBitmapHelvetica18;
|
||||
|
||||
/* To get around the fact that DJGPP DXEs only allow functions
|
||||
to be exported and no data addresses (as Unix DSOs support), the
|
||||
@@ -42,7 +35,7 @@ extern BitmapFontRec glutBitmap8By13, glutBitmap9By15, glutBitmapTimesRoman10, g
|
||||
through a case statement to get mapped to the actual data structure
|
||||
address. */
|
||||
void *
|
||||
__glutFont (void *font)
|
||||
_glut_font (void *font)
|
||||
{
|
||||
switch ((int)font) {
|
||||
case (int)GLUT_STROKE_ROMAN:
|
||||
@@ -63,9 +56,19 @@ __glutFont (void *font)
|
||||
return &glutBitmapHelvetica12;
|
||||
case (int)GLUT_BITMAP_HELVETICA_18:
|
||||
return &glutBitmapHelvetica18;
|
||||
default: /* NOTREACHED */
|
||||
__glutFatalError("bad font!");
|
||||
default:
|
||||
if ((font == &glutStrokeRoman) ||
|
||||
(font == &glutStrokeMonoRoman) ||
|
||||
(font == &glutBitmap9By15) ||
|
||||
(font == &glutBitmap8By13) ||
|
||||
(font == &glutBitmapTimesRoman10) ||
|
||||
(font == &glutBitmapTimesRoman24) ||
|
||||
(font == &glutBitmapHelvetica10) ||
|
||||
(font == &glutBitmapHelvetica12) ||
|
||||
(font == &glutBitmapHelvetica18)) {
|
||||
return font;
|
||||
}
|
||||
_glut_fatal("bad font!");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,43 +1,38 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 4.1
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
* DOS/DJGPP Mesa Utility Toolkit
|
||||
* Version: 1.0
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
* Copyright (C) 2005 Daniel Borca All Rights Reserved.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
* 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:
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DOS/DJGPP glut driver v1.4 for Mesa
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* Copyright (C) 2002 - Daniel Borca
|
||||
* Email : dborca@users.sourceforge.net
|
||||
* Web : http://www.geocities.com/dborca
|
||||
* 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
|
||||
* DANIEL BORCA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "glutint.h"
|
||||
#include "GL/dmesa.h"
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
GLUTwindow *g_curwin;
|
||||
static GLuint swaptime, swapcount;
|
||||
|
||||
static DMesaVisual visual = NULL;
|
||||
GLUTwindow *g_windows[MAX_WINDOWS];
|
||||
|
||||
GLUTwindow *_glut_current, *_glut_windows[MAX_WINDOWS];
|
||||
|
||||
|
||||
static void
|
||||
@@ -55,11 +50,21 @@ clean (void)
|
||||
}
|
||||
|
||||
|
||||
static GLUTwindow *
|
||||
_glut_window (int win)
|
||||
{
|
||||
if (win > 0 && --win < MAX_WINDOWS) {
|
||||
return _glut_windows[win];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int APIENTRY
|
||||
glutCreateWindow (const char *title)
|
||||
{
|
||||
int i;
|
||||
int m8width = (g_init_w + 7) & ~7;
|
||||
int m8width = (_glut_default.width + 7) & ~7;
|
||||
|
||||
/* We set the Visual once. This will be our desktop (graphic mode).
|
||||
* We should do this in the `glutInit' code, but we don't have any idea
|
||||
@@ -67,16 +72,19 @@ glutCreateWindow (const char *title)
|
||||
* window, we have a slight idea about resolution.
|
||||
*/
|
||||
if (!visual) {
|
||||
if ((visual=DMesaCreateVisual(g_init_x + m8width, g_init_y + g_init_h, g_bpp, g_refresh,
|
||||
g_display_mode & GLUT_DOUBLE,
|
||||
!(g_display_mode & GLUT_INDEX),
|
||||
(g_display_mode & GLUT_ALPHA ) ? g_alpha : 0,
|
||||
(g_display_mode & GLUT_DEPTH ) ? g_depth : 0,
|
||||
(g_display_mode & GLUT_STENCIL) ? g_stencil : 0,
|
||||
(g_display_mode & GLUT_ACCUM ) ? g_accum : 0))==NULL) {
|
||||
if ((visual=DMesaCreateVisual(_glut_default.x + m8width, _glut_default.y + _glut_default.height, _glut_visual.bpp, _glut_visual.refresh,
|
||||
_glut_default.mode & GLUT_DOUBLE,
|
||||
!(_glut_default.mode & GLUT_INDEX),
|
||||
(_glut_default.mode & GLUT_ALPHA ) ? _glut_visual.alpha : 0,
|
||||
(_glut_default.mode & GLUT_DEPTH ) ? _glut_visual.depth : 0,
|
||||
(_glut_default.mode & GLUT_STENCIL) ? _glut_visual.stencil : 0,
|
||||
(_glut_default.mode & GLUT_ACCUM ) ? _glut_visual.accum : 0))==NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
DMesaGetIntegerv(DMESA_GET_SCREEN_SIZE, _glut_visual.geometry);
|
||||
DMesaGetIntegerv(DMESA_GET_DRIVER_CAPS, &_glut_visual.flags);
|
||||
|
||||
/* Also hook stdio/stderr once */
|
||||
pc_open_stdout();
|
||||
pc_open_stderr();
|
||||
@@ -87,7 +95,7 @@ glutCreateWindow (const char *title)
|
||||
* Each window has its own rendering Context and its own Buffer.
|
||||
*/
|
||||
for (i=0; i<MAX_WINDOWS; i++) {
|
||||
if (g_windows[i] == NULL) {
|
||||
if (_glut_windows[i] == NULL) {
|
||||
DMesaContext c;
|
||||
DMesaBuffer b;
|
||||
GLUTwindow *w;
|
||||
@@ -105,7 +113,7 @@ glutCreateWindow (const char *title)
|
||||
/* Allocate the Buffer (displayable area).
|
||||
* We have to specify buffer size and position (inside the desktop).
|
||||
*/
|
||||
if ((b = DMesaCreateBuffer(visual, g_init_x, g_init_y, m8width, g_init_h)) == NULL) {
|
||||
if ((b = DMesaCreateBuffer(visual, _glut_default.x, _glut_default.y, m8width, _glut_default.height)) == NULL) {
|
||||
DMesaDestroyContext(c);
|
||||
free(w);
|
||||
return 0;
|
||||
@@ -119,13 +127,13 @@ glutCreateWindow (const char *title)
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_curwin = g_windows[i] = w;
|
||||
_glut_current = _glut_windows[i] = w;
|
||||
|
||||
w->num = ++i;
|
||||
w->xpos = g_init_x;
|
||||
w->ypos = g_init_y;
|
||||
w->xpos = _glut_default.x;
|
||||
w->ypos = _glut_default.y;
|
||||
w->width = m8width;
|
||||
w->height = g_init_h;
|
||||
w->height = _glut_default.height;
|
||||
w->context = c;
|
||||
w->buffer = b;
|
||||
|
||||
@@ -147,13 +155,16 @@ glutCreateSubWindow (int win, int x, int y, int width, int height)
|
||||
void APIENTRY
|
||||
glutDestroyWindow (int win)
|
||||
{
|
||||
if (g_windows[--win]) {
|
||||
GLUTwindow *w = g_windows[win];
|
||||
GLUTwindow *w = _glut_window(win);
|
||||
if (w != NULL) {
|
||||
if (w->destroy) {
|
||||
w->destroy();
|
||||
}
|
||||
DMesaMakeCurrent(NULL, NULL);
|
||||
DMesaDestroyBuffer(w->buffer);
|
||||
DMesaDestroyContext(w->context);
|
||||
free(w);
|
||||
g_windows[win] = NULL;
|
||||
_glut_windows[win - 1] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,27 +172,27 @@ glutDestroyWindow (int win)
|
||||
void APIENTRY
|
||||
glutPostRedisplay (void)
|
||||
{
|
||||
g_curwin->redisplay = GL_TRUE;
|
||||
_glut_current->redisplay = GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSwapBuffers (void)
|
||||
{
|
||||
if (g_curwin->show_mouse) {
|
||||
if (_glut_current->show_mouse) {
|
||||
/* XXX scare mouse */
|
||||
DMesaSwapBuffers(g_curwin->buffer);
|
||||
DMesaSwapBuffers(_glut_current->buffer);
|
||||
/* XXX unscare mouse */
|
||||
} else {
|
||||
DMesaSwapBuffers(g_curwin->buffer);
|
||||
DMesaSwapBuffers(_glut_current->buffer);
|
||||
}
|
||||
|
||||
if (g_fps) {
|
||||
if (_glut_fps) {
|
||||
GLint t = glutGet(GLUT_ELAPSED_TIME);
|
||||
swapcount++;
|
||||
if (swaptime == 0)
|
||||
swaptime = t;
|
||||
else if (t - swaptime > g_fps) {
|
||||
else if (t - swaptime > _glut_fps) {
|
||||
double time = 0.001 * (t - swaptime);
|
||||
double fps = (double)swapcount / time;
|
||||
fprintf(stderr, "GLUT: %d frames in %.2f seconds = %.2f FPS\n", swapcount, time, fps);
|
||||
@@ -195,15 +206,18 @@ glutSwapBuffers (void)
|
||||
int APIENTRY
|
||||
glutGetWindow (void)
|
||||
{
|
||||
return g_curwin->num;
|
||||
return _glut_current->num;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSetWindow (int win)
|
||||
{
|
||||
g_curwin = g_windows[win - 1];
|
||||
DMesaMakeCurrent(g_curwin->context, g_curwin->buffer);
|
||||
GLUTwindow *w = _glut_window(win);
|
||||
if (w != NULL) {
|
||||
_glut_current = w;
|
||||
DMesaMakeCurrent(_glut_current->context, _glut_current->buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -223,8 +237,8 @@ void APIENTRY
|
||||
glutPositionWindow (int x, int y)
|
||||
{
|
||||
if (DMesaMoveBuffer(x, y)) {
|
||||
g_curwin->xpos = x;
|
||||
g_curwin->ypos = y;
|
||||
_glut_current->xpos = x;
|
||||
_glut_current->ypos = y;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,10 +247,10 @@ void APIENTRY
|
||||
glutReshapeWindow (int width, int height)
|
||||
{
|
||||
if (DMesaResizeBuffer(width, height)) {
|
||||
g_curwin->width = width;
|
||||
g_curwin->height = height;
|
||||
if (g_curwin->reshape) {
|
||||
g_curwin->reshape(width, height);
|
||||
_glut_current->width = width;
|
||||
_glut_current->height = height;
|
||||
if (_glut_current->reshape) {
|
||||
_glut_current->reshape(width, height);
|
||||
} else {
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
@@ -278,3 +292,34 @@ void APIENTRY
|
||||
glutHideWindow (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutCloseFunc (GLUTdestroyCB destroy)
|
||||
{
|
||||
_glut_current->destroy = destroy;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutPostWindowRedisplay (int win)
|
||||
{
|
||||
GLUTwindow *w = _glut_window(win);
|
||||
if (w != NULL) {
|
||||
w->redisplay = GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void * APIENTRY
|
||||
glutGetWindowData (void)
|
||||
{
|
||||
return _glut_current->data;
|
||||
}
|
||||
|
||||
|
||||
void APIENTRY
|
||||
glutSetWindowData (void *data)
|
||||
{
|
||||
_glut_current->data = data;
|
||||
}
|
||||
|
@@ -182,9 +182,9 @@ extern void GLwDrawingAreaSwapBuffers(Widget w);
|
||||
|
||||
#ifdef __GLX_MOTIF
|
||||
#ifdef _NO_PROTO
|
||||
extern Widget GLwCreateMDrawingArea();
|
||||
GLAPI extern Widget GLwCreateMDrawingArea();
|
||||
#else
|
||||
extern Widget GLwCreateMDrawingArea(Widget parent,char *name,ArgList arglist,Cardinal argcount);
|
||||
GLAPI extern Widget GLwCreateMDrawingArea(Widget parent,char *name,ArgList arglist,Cardinal argcount);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@@ -59,7 +59,7 @@ typedef struct _GLwMDrawingAreaClassRec {
|
||||
} GLwMDrawingAreaClassRec;
|
||||
|
||||
|
||||
extern GLwMDrawingAreaClassRec glwMDrawingAreaClassRec;
|
||||
GLAPI extern GLwMDrawingAreaClassRec glwMDrawingAreaClassRec;
|
||||
|
||||
|
||||
/* XT */
|
||||
|
@@ -1103,6 +1103,7 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
|
||||
drmVersionPtr version;
|
||||
drm_handle_t hFB;
|
||||
int junk;
|
||||
drm_magic_t magic;
|
||||
|
||||
err_msg = "XF86DRIOpenConnection";
|
||||
err_extra = NULL;
|
||||
@@ -1117,8 +1118,6 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
|
||||
|
||||
if (fd < 0) goto done;
|
||||
|
||||
drm_magic_t magic;
|
||||
|
||||
err_msg = "drmGetMagic";
|
||||
err_extra = NULL;
|
||||
|
||||
@@ -1215,8 +1214,20 @@ CallCreateNewScreen(Display *dpy, int scrn, __DRIscreen *psc)
|
||||
fd,
|
||||
(get_ver != NULL) ? (*get_ver)() : 20040602,
|
||||
(__GLcontextModes **) &dpy->driver_modes);
|
||||
}
|
||||
|
||||
/* fill in dummy visual ids */
|
||||
{
|
||||
__GLcontextModes *temp;
|
||||
temp = (__GLcontextModes *)dpy->driver_modes;
|
||||
i = 1;
|
||||
while (temp)
|
||||
{
|
||||
temp->visualID = i++;
|
||||
temp=temp->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
if ( psp == NULL ) {
|
||||
if ( pSAREA != MAP_FAILED ) {
|
||||
@@ -1631,50 +1642,102 @@ XGetVisualInfo( Display *dpy, long vinfo_mask, XVisualInfo *vinfo_template, int
|
||||
const __GLcontextModes *mode;
|
||||
XVisualInfo *results;
|
||||
Visual *visResults;
|
||||
int i, n;
|
||||
int i, n=0;
|
||||
|
||||
ASSERT(vinfo_mask == VisualScreenMask);
|
||||
// ASSERT(vinfo_mask == VisualScreenMask);
|
||||
ASSERT(vinfo_template.screen == 0);
|
||||
|
||||
n = 0;
|
||||
for ( mode = dpy->driver_modes ; mode != NULL ; mode = mode->next )
|
||||
n++;
|
||||
if (vinfo_mask == VisualIDMask)
|
||||
{
|
||||
for ( mode = dpy->driver_modes ; mode != NULL ; mode= mode->next )
|
||||
if (mode->visualID == vinfo_template->visualid)
|
||||
n=1;
|
||||
|
||||
results = (XVisualInfo *)calloc(1, n * sizeof(XVisualInfo));
|
||||
if (!results) {
|
||||
*nitens_return = 0;
|
||||
return NULL;
|
||||
}
|
||||
if (n==0)
|
||||
return NULL;
|
||||
|
||||
results = (XVisualInfo *)calloc(1, n * sizeof(XVisualInfo));
|
||||
if (!results) {
|
||||
*nitens_return = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
visResults = (Visual *)calloc(1, n * sizeof(Visual));
|
||||
if (!results) {
|
||||
free(results);
|
||||
*nitens_return = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
visResults = (Visual *)calloc(1, n * sizeof(Visual));
|
||||
if (!results) {
|
||||
free(results);
|
||||
*nitens_return = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for ( mode = dpy->driver_modes, i = 0 ; mode != NULL ; mode = mode->next, i++ ) {
|
||||
visResults[i].mode = mode;
|
||||
visResults[i].visInfo = results + i;
|
||||
visResults[i].dpy = dpy;
|
||||
|
||||
if (dpy->driverContext.bpp == 32)
|
||||
visResults[i].pixelFormat = PF_B8G8R8A8; /* XXX: FIX ME */
|
||||
else
|
||||
visResults[i].pixelFormat = PF_B5G6R5; /* XXX: FIX ME */
|
||||
|
||||
results[i].visual = visResults + i;
|
||||
results[i].visualid = i;
|
||||
for ( mode = dpy->driver_modes ; mode != NULL ; mode= mode->next )
|
||||
if (mode->visualID == vinfo_template->visualid)
|
||||
{
|
||||
visResults[0].mode=mode;
|
||||
visResults[0].visInfo = results;
|
||||
visResults[0].dpy = dpy;
|
||||
if (dpy->driverContext.bpp == 32)
|
||||
visResults[0].pixelFormat = PF_B8G8R8A8; /* XXX: FIX ME */
|
||||
else
|
||||
visResults[0].pixelFormat = PF_B5G6R5; /* XXX: FIX ME */
|
||||
|
||||
results[0].visual = visResults;
|
||||
results[0].visualid = mode->visualID;
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
results[i].c_class = TrueColor;
|
||||
results[0].c_class = TrueColor;
|
||||
#else
|
||||
results[i].class = TrueColor;
|
||||
results[0].class = TrueColor;
|
||||
#endif
|
||||
results[i].depth = mode->redBits +
|
||||
mode->redBits +
|
||||
mode->redBits +
|
||||
mode->redBits;
|
||||
results[i].bits_per_rgb = dpy->driverContext.bpp;
|
||||
results[0].depth = mode->redBits +
|
||||
mode->redBits +
|
||||
mode->redBits +
|
||||
mode->redBits;
|
||||
results[0].bits_per_rgb = dpy->driverContext.bpp;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else // if (vinfo_mask == VisualScreenMask)
|
||||
{
|
||||
n = 0;
|
||||
for ( mode = dpy->driver_modes ; mode != NULL ; mode = mode->next )
|
||||
n++;
|
||||
|
||||
results = (XVisualInfo *)calloc(1, n * sizeof(XVisualInfo));
|
||||
if (!results) {
|
||||
*nitens_return = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
visResults = (Visual *)calloc(1, n * sizeof(Visual));
|
||||
if (!results) {
|
||||
free(results);
|
||||
*nitens_return = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for ( mode = dpy->driver_modes, i = 0 ; mode != NULL ; mode = mode->next, i++ ) {
|
||||
visResults[i].mode = mode;
|
||||
visResults[i].visInfo = results + i;
|
||||
visResults[i].dpy = dpy;
|
||||
|
||||
if (dpy->driverContext.bpp == 32)
|
||||
visResults[i].pixelFormat = PF_B8G8R8A8; /* XXX: FIX ME */
|
||||
else
|
||||
visResults[i].pixelFormat = PF_B5G6R5; /* XXX: FIX ME */
|
||||
|
||||
results[i].visual = visResults + i;
|
||||
results[i].visualid = mode->visualID;
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
results[i].c_class = TrueColor;
|
||||
#else
|
||||
results[i].class = TrueColor;
|
||||
#endif
|
||||
results[i].depth = mode->redBits +
|
||||
mode->redBits +
|
||||
mode->redBits +
|
||||
mode->redBits;
|
||||
results[i].bits_per_rgb = dpy->driverContext.bpp;
|
||||
}
|
||||
}
|
||||
*nitens_return = n;
|
||||
return results;
|
||||
@@ -1989,6 +2052,7 @@ glXCreateContext( Display *dpy, XVisualInfo *vis,
|
||||
else
|
||||
sharePriv = NULL;
|
||||
|
||||
ctx->driContext.mode = vis->visual->mode;
|
||||
ctx->driContext.private = dpy->driScreen.createNewContext(dpy, vis->visual->mode,
|
||||
GLX_WINDOW_BIT, sharePriv, &ctx->driContext);
|
||||
|
||||
@@ -2289,6 +2353,7 @@ void (*glXGetProcAddress(const GLubyte *procname))( void )
|
||||
{ "__glXWindowExists", (void *) __glXWindowExists },
|
||||
{ "__glXCreateContextModes", (void *) _gl_context_modes_create },
|
||||
{ "__glXFindDRIScreen", (void *)__glXFindDRIScreen },
|
||||
{ "__glXScrEnableExtension", (void *)__glXScrEnableExtension },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
const struct name_address *entry;
|
||||
@@ -2369,5 +2434,36 @@ glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config )
|
||||
return config.visInfo;
|
||||
}
|
||||
|
||||
void *glXAllocateMemoryMESA(Display *dpy, int scrn,
|
||||
size_t size, float readFreq,
|
||||
float writeFreq, float priority)
|
||||
{
|
||||
if (dpy->driScreen.private && dpy->driScreen.allocateMemory) {
|
||||
return (*dpy->driScreen.allocateMemory)( dpy, scrn, size,
|
||||
readFreq, writeFreq,
|
||||
priority );
|
||||
}
|
||||
}
|
||||
|
||||
void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer){
|
||||
if (dpy->driScreen.private && dpy->driScreen.freeMemory) {
|
||||
(*dpy->driScreen.freeMemory)( dpy, scrn, pointer );
|
||||
}
|
||||
}
|
||||
|
||||
GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn,
|
||||
const void *pointer )
|
||||
{
|
||||
if (dpy->driScreen.private && dpy->driScreen.memoryOffset) {
|
||||
return (*dpy->driScreen.memoryOffset)( dpy, scrn, pointer );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
__glXScrEnableExtension( void *psc, const char * name )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*@}*/
|
||||
|
@@ -32,6 +32,8 @@ C_SOURCES = \
|
||||
indirect_size.c \
|
||||
indirect_window_pos.c \
|
||||
indirect_transpose_matrix.c \
|
||||
indirect_vertex_array.c \
|
||||
indirect_vertex_program.c \
|
||||
pixel.c \
|
||||
pixelstore.c \
|
||||
render2.c \
|
||||
|
@@ -36,77 +36,34 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include "glxclient.h"
|
||||
#include "indirect_vertex_array.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void __indirect_glEnableClientState(GLenum array)
|
||||
static void
|
||||
do_enable_disable(GLenum array, GLboolean val )
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
unsigned index = 0;
|
||||
|
||||
switch (array) {
|
||||
case GL_COLOR_ARRAY:
|
||||
ENABLE_ARRAY(state, color);
|
||||
break;
|
||||
case GL_EDGE_FLAG_ARRAY:
|
||||
ENABLE_ARRAY(state, edgeFlag);
|
||||
break;
|
||||
case GL_INDEX_ARRAY:
|
||||
ENABLE_ARRAY(state, index);
|
||||
break;
|
||||
case GL_NORMAL_ARRAY:
|
||||
ENABLE_ARRAY(state, normal);
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
ENABLE_TEXARRAY(state, state->vertArray.activeTexture);
|
||||
break;
|
||||
case GL_VERTEX_ARRAY:
|
||||
ENABLE_ARRAY(state, vertex);
|
||||
break;
|
||||
case GL_SECONDARY_COLOR_ARRAY:
|
||||
ENABLE_ARRAY(state, secondaryColor);
|
||||
break;
|
||||
case GL_FOG_COORD_ARRAY:
|
||||
ENABLE_ARRAY(state, fogCoord);
|
||||
break;
|
||||
default:
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
if ( array == GL_TEXTURE_COORD_ARRAY ) {
|
||||
index = __glXGetActiveTextureUnit( state );
|
||||
}
|
||||
|
||||
if ( ! __glXSetArrayEnable( state, array, index, val ) ) {
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glEnableClientState(GLenum array)
|
||||
{
|
||||
do_enable_disable( array, GL_TRUE );
|
||||
}
|
||||
|
||||
void __indirect_glDisableClientState(GLenum array)
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
|
||||
switch (array) {
|
||||
case GL_COLOR_ARRAY:
|
||||
DISABLE_ARRAY(state, color);
|
||||
break;
|
||||
case GL_EDGE_FLAG_ARRAY:
|
||||
DISABLE_ARRAY(state, edgeFlag);
|
||||
break;
|
||||
case GL_INDEX_ARRAY:
|
||||
DISABLE_ARRAY(state, index);
|
||||
break;
|
||||
case GL_NORMAL_ARRAY:
|
||||
DISABLE_ARRAY(state, normal);
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
DISABLE_TEXARRAY(state, state->vertArray.activeTexture);
|
||||
break;
|
||||
case GL_VERTEX_ARRAY:
|
||||
DISABLE_ARRAY(state, vertex);
|
||||
break;
|
||||
case GL_SECONDARY_COLOR_ARRAY:
|
||||
DISABLE_ARRAY(state, secondaryColor);
|
||||
break;
|
||||
case GL_FOG_COORD_ARRAY:
|
||||
DISABLE_ARRAY(state, fogCoord);
|
||||
break;
|
||||
default:
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
}
|
||||
do_enable_disable( array, GL_FALSE );
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
@@ -129,7 +86,7 @@ void __indirect_glPushClientAttrib(GLuint mask)
|
||||
sp->storeUnpack = state->storeUnpack;
|
||||
}
|
||||
if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) {
|
||||
sp->vertArray = state->vertArray;
|
||||
__glXPushArrayState( state );
|
||||
}
|
||||
} else {
|
||||
__glXSetError(gc, GL_STACK_OVERFLOW);
|
||||
@@ -156,7 +113,7 @@ void __indirect_glPopClientAttrib(void)
|
||||
state->storeUnpack = sp->storeUnpack;
|
||||
}
|
||||
if (mask & GL_CLIENT_VERTEX_ARRAY_BIT) {
|
||||
state->vertArray = sp->vertArray;
|
||||
__glXPopArrayState( state );
|
||||
}
|
||||
|
||||
sp->mask = 0;
|
||||
@@ -181,5 +138,3 @@ void __glFreeAttributeState(__GLXcontext *gc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -278,14 +278,16 @@ CreateDrawable( Display *dpy, const __GLcontextModes * fbconfig,
|
||||
{
|
||||
xGLXCreateWindowReq * req;
|
||||
CARD32 * data;
|
||||
unsigned int i;
|
||||
unsigned int i;
|
||||
|
||||
|
||||
for ( i = 0 ; attrib_list[i * 2] != None ; i++ )
|
||||
/* empty */ ;
|
||||
i = 0;
|
||||
if (attrib_list) {
|
||||
while (attrib_list[i * 2] != None)
|
||||
i++;
|
||||
}
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReqExtra( GLXCreateWindow, 20 + (8 * i), req );
|
||||
GetReqExtra( GLXCreateWindow, 8 * i, req );
|
||||
data = (CARD32 *) (req + 1);
|
||||
|
||||
req->reqType = __glXSetupForCommand(dpy);
|
||||
@@ -293,12 +295,15 @@ CreateDrawable( Display *dpy, const __GLcontextModes * fbconfig,
|
||||
req->screen = (CARD32) fbconfig->screen;
|
||||
req->fbconfig = fbconfig->fbconfigID;
|
||||
req->window = (GLXPbuffer) drawable;
|
||||
req->glxwindow = (GLXWindow) XAllocID(dpy);
|
||||
req->numAttribs = (CARD32) i;
|
||||
|
||||
memcpy( data, attrib_list, 8 * i );
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
|
||||
return drawable;
|
||||
return (GLXDrawable)req->glxwindow;
|
||||
}
|
||||
|
||||
|
||||
@@ -355,10 +360,11 @@ CreatePbuffer( Display *dpy, const __GLcontextModes * fbconfig,
|
||||
CARD32 * data;
|
||||
unsigned int i;
|
||||
|
||||
|
||||
for ( i = 0 ; attrib_list[i * 2] != None ; i++ )
|
||||
/* empty */ ;
|
||||
|
||||
i = 0;
|
||||
if (attrib_list) {
|
||||
while (attrib_list[i * 2])
|
||||
i++;
|
||||
}
|
||||
|
||||
LockDisplay(dpy);
|
||||
id = XAllocID(dpy);
|
||||
|
@@ -59,6 +59,7 @@
|
||||
#include "GL/glxproto.h"
|
||||
#include "GL/internal/glcore.h"
|
||||
#include "glapitable.h"
|
||||
#include "glxextensions.h"
|
||||
#ifdef XTHREADS
|
||||
#include "Xthreads.h"
|
||||
#endif
|
||||
@@ -220,110 +221,29 @@ typedef struct __GLXattributeRecDEPRECATED {
|
||||
__GLXvertArrayStateDEPRECATED vertArray;
|
||||
} __GLXattributeDEPRECATED;
|
||||
|
||||
typedef struct __GLXvertexArrayPointerStateRec {
|
||||
void (*proc)(const void *);
|
||||
void (*mtex_proc)(GLenum, const void *);
|
||||
const GLubyte *ptr;
|
||||
GLsizei skip;
|
||||
GLint size;
|
||||
GLenum type;
|
||||
GLsizei stride;
|
||||
} __GLXvertexArrayPointerState;
|
||||
|
||||
/**
|
||||
* Define which entries of \c __GLXvertArrayState::arrays match which
|
||||
* vertex arrays in the client-state vector. These are only the one-of
|
||||
* arrays. See the \c __GLXvertArrayState::arrays documentation for more
|
||||
* details.
|
||||
*
|
||||
* \sa __GLXvertArrayState
|
||||
*/
|
||||
enum {
|
||||
edgeFlag_ARRAY, /**< \c GL_EDGE_FLAG_ARRAY */
|
||||
index_ARRAY, /**< \c GL_INDEX_ARRAY */
|
||||
fogCoord_ARRAY, /**< \c GL_FOG_COORD_ARRAY */
|
||||
secondaryColor_ARRAY, /**< \c GL_SECONDARY_COLOR_ARRAY */
|
||||
color_ARRAY, /**< \c GL_COLOR_ARRAY */
|
||||
normal_ARRAY, /**< \c GL_NORMAL_ARRAY */
|
||||
|
||||
/**
|
||||
* \c GL_VERTEX_ARRAY \b must be last! All of the code for emitting arrays
|
||||
* and array elements is written based on the assumption that the vertex
|
||||
* array is last.
|
||||
*/
|
||||
vertex_ARRAY,
|
||||
|
||||
__GLX_MAX_ARRAYS /**< Place holder entry. */
|
||||
};
|
||||
|
||||
#define ENABLE_ARRAY(state,a) \
|
||||
do { (state)->vertArray.enables |= (1U << (a ## _ARRAY)); } while( 0 )
|
||||
#define DISABLE_ARRAY(state,a) \
|
||||
do { (state)->vertArray.enables &= ~(1U << (a ## _ARRAY)); } while( 0 )
|
||||
#define IS_ARRAY_ENABLED_BY_INDEX(state, i) \
|
||||
(((state)->vertArray.enables & (1U << (i))) != 0)
|
||||
#define IS_ARRAY_ENABLED(state, a) \
|
||||
IS_ARRAY_ENABLED_BY_INDEX(state, a ## _ARRAY)
|
||||
|
||||
#define ENABLE_TEXARRAY(state,a) \
|
||||
do { (state)->vertArray.texture_enables |= (1U << a); } while( 0 )
|
||||
#define DISABLE_TEXARRAY(state,a) \
|
||||
do { (state)->vertArray.texture_enables &= ~(1U << a); } while( 0 )
|
||||
#define IS_TEXARRAY_ENABLED(state, a) \
|
||||
(((state)->vertArray.texture_enables & (1U << a)) != 0)
|
||||
|
||||
/**
|
||||
* Client-side vertex array state.
|
||||
*/
|
||||
typedef struct __GLXvertArrayStateRec {
|
||||
/**
|
||||
* Which client-side arrays are enabled? These are the flag bits for
|
||||
* all of the non-texture coordinate arrays.
|
||||
*/
|
||||
GLuint enables;
|
||||
|
||||
/**
|
||||
* Which of the texture coordinate arrays are enabled?
|
||||
*/
|
||||
GLuint texture_enables;
|
||||
|
||||
/**
|
||||
* State for "one-of" arrays. These are the arrays, such as
|
||||
* GL_COLOR_ARRAY or GL_FOG_COORD_ARRAY for which there is only one
|
||||
* array. There are also "many-of" arrays, such as
|
||||
* GL_TEXTURE_COORD_ARRAY.
|
||||
*/
|
||||
__GLXvertexArrayPointerState arrays[__GLX_MAX_ARRAYS];
|
||||
|
||||
__GLXvertexArrayPointerState texCoord[__GLX_MAX_TEXTURE_UNITS];
|
||||
|
||||
GLint maxElementsVertices;
|
||||
GLint maxElementsIndices;
|
||||
GLint activeTexture;
|
||||
} __GLXvertArrayState;
|
||||
|
||||
typedef struct __GLXattributeRec {
|
||||
GLuint mask;
|
||||
GLuint mask;
|
||||
|
||||
/*
|
||||
** Pixel storage state. Most of the pixel store mode state is kept
|
||||
** here and used by the client code to manage the packing and
|
||||
** unpacking of data sent to/received from the server.
|
||||
*/
|
||||
__GLXpixelStoreMode storePack, storeUnpack;
|
||||
/**
|
||||
* Pixel storage state. Most of the pixel store mode state is kept
|
||||
* here and used by the client code to manage the packing and
|
||||
* unpacking of data sent to/received from the server.
|
||||
*/
|
||||
__GLXpixelStoreMode storePack, storeUnpack;
|
||||
|
||||
/*
|
||||
** Vertex Array storage state. The vertex array component
|
||||
** state is stored here and is used to manage the packing of
|
||||
** DrawArrays data sent to the server.
|
||||
*/
|
||||
__GLXvertArrayState vertArray;
|
||||
|
||||
/**
|
||||
* Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically
|
||||
* disabled?
|
||||
*/
|
||||
GLboolean NoDrawArraysProtocol;
|
||||
/**
|
||||
* Is EXT_vertex_array / GL 1.1 DrawArrays protocol specifically
|
||||
* disabled?
|
||||
*/
|
||||
GLboolean NoDrawArraysProtocol;
|
||||
|
||||
/**
|
||||
* Vertex Array storage state. The vertex array component
|
||||
* state is stored here and is used to manage the packing of
|
||||
* DrawArrays data sent to the server.
|
||||
*/
|
||||
struct array_state_vector * array_state;
|
||||
} __GLXattribute;
|
||||
|
||||
typedef struct __GLXattributeMachineRec {
|
||||
@@ -529,7 +449,7 @@ struct __GLXcontextRec {
|
||||
* drivers should NEVER use this data or even care that it exists.
|
||||
*/
|
||||
void * client_state_private;
|
||||
|
||||
|
||||
/**
|
||||
* Stored value for \c glXQueryContext attribute \c GLX_RENDER_TYPE.
|
||||
*/
|
||||
@@ -546,6 +466,8 @@ struct __GLXcontextRec {
|
||||
int server_major; /**< Major version number. */
|
||||
int server_minor; /**< Minor version number. */
|
||||
/*@}*/
|
||||
|
||||
char gl_extension_bits[ __GL_EXT_BYTES ];
|
||||
};
|
||||
|
||||
#define __glXSetError(gc,code) \
|
||||
|
@@ -375,8 +375,6 @@ GLXContext AllocateGLXContext( Display *dpy )
|
||||
state->storePack.alignment = 4;
|
||||
state->storeUnpack.alignment = 4;
|
||||
|
||||
__glXInitVertexArrayState(gc);
|
||||
|
||||
gc->attributes.stackPointer = &gc->attributes.stack[0];
|
||||
|
||||
/*
|
||||
|
@@ -1761,10 +1761,19 @@ USED static Bool MakeContextCurrent(Display *dpy, GLXDrawable draw,
|
||||
gc->currentDpy = dpy;
|
||||
gc->currentDrawable = draw;
|
||||
gc->currentReadable = read;
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
if (gc->isDirect) reply.contextTag = -1;
|
||||
#endif
|
||||
gc->currentContextTag = reply.contextTag;
|
||||
|
||||
if ( ! gc->isDirect ) {
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
|
||||
gc->currentContextTag = reply.contextTag;
|
||||
if ( state->array_state == NULL ) {
|
||||
(void) glGetString( GL_EXTENSIONS );
|
||||
__glXInitVertexArrayState(gc);
|
||||
}
|
||||
}
|
||||
else {
|
||||
gc->currentContextTag = -1;
|
||||
}
|
||||
} else {
|
||||
__glXSetCurrentContext(&dummyContext);
|
||||
#ifdef GLX_DIRECT_RENDERING
|
||||
|
@@ -27,7 +27,6 @@
|
||||
*
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
/* $XFree86: xc/lib/GL/glx/glxextensions.c,v 1.1 2003/09/28 20:15:03 alanh Exp $ */
|
||||
|
||||
#include "glxclient.h"
|
||||
#include <extutil.h>
|
||||
@@ -113,7 +112,8 @@ static const struct extension_info known_glx_extensions[] = {
|
||||
|
||||
static const struct extension_info known_gl_extensions[] = {
|
||||
{ GL(ARB_depth_texture), VER(1,4), Y, N, N, N },
|
||||
{ GL(ARB_fragment_program), VER(0,0), N, N, N, N },
|
||||
{ GL(ARB_fragment_program), VER(0,0), Y, N, N, N },
|
||||
{ GL(ARB_fragment_program_shadow), VER(0,0), Y, N, N, N },
|
||||
{ GL(ARB_imaging), VER(0,0), Y, N, N, N },
|
||||
{ GL(ARB_multisample), VER(1,3), Y, N, N, N },
|
||||
{ GL(ARB_multitexture), VER(1,3), Y, N, N, N },
|
||||
@@ -123,7 +123,7 @@ static const struct extension_info known_gl_extensions[] = {
|
||||
{ GL(ARB_shadow), VER(1,4), Y, N, N, N },
|
||||
{ GL(ARB_shadow_ambient), VER(0,0), Y, N, N, N },
|
||||
{ GL(ARB_texture_border_clamp), VER(1,3), Y, N, N, N },
|
||||
{ GL(ARB_texture_compression), VER(1,3), N, N, N, N },
|
||||
{ GL(ARB_texture_compression), VER(1,3), Y, N, N, N },
|
||||
{ GL(ARB_texture_cube_map), VER(1,3), Y, N, N, N },
|
||||
{ GL(ARB_texture_env_add), VER(1,3), Y, N, N, N },
|
||||
{ GL(ARB_texture_env_combine), VER(1,3), Y, N, N, N },
|
||||
@@ -134,6 +134,7 @@ static const struct extension_info known_gl_extensions[] = {
|
||||
{ GL(ARB_texture_rectangle), VER(0,0), Y, N, N, N },
|
||||
{ GL(ARB_transpose_matrix), VER(1,3), Y, N, Y, N },
|
||||
{ GL(ARB_vertex_buffer_object), VER(1,5), N, N, N, N },
|
||||
{ GL(ARB_vertex_program), VER(0,0), Y, N, N, N },
|
||||
{ GL(ARB_window_pos), VER(1,4), Y, N, N, N },
|
||||
{ GL(EXT_abgr), VER(0,0), Y, N, N, N },
|
||||
{ GL(EXT_bgra), VER(1,2), Y, N, N, N },
|
||||
@@ -167,7 +168,8 @@ static const struct extension_info known_gl_extensions[] = {
|
||||
{ GL(EXT_subtexture), VER(1,1), Y, N, N, N },
|
||||
{ GL(EXT_texture), VER(1,1), Y, N, N, N },
|
||||
{ GL(EXT_texture3D), VER(1,2), Y, N, N, N },
|
||||
{ GL(EXT_texture_compression_s3tc), VER(0,0), N, N, N, N },
|
||||
{ GL(EXT_texture_compression_dxt1), VER(0,0), Y, N, N, N },
|
||||
{ GL(EXT_texture_compression_s3tc), VER(0,0), Y, N, N, N },
|
||||
{ GL(EXT_texture_edge_clamp), VER(1,2), Y, N, N, N },
|
||||
{ GL(EXT_texture_env_add), VER(1,3), Y, N, N, N },
|
||||
{ GL(EXT_texture_env_combine), VER(1,3), Y, N, N, N },
|
||||
@@ -179,9 +181,10 @@ static const struct extension_info known_gl_extensions[] = {
|
||||
{ GL(EXT_texture_object), VER(1,1), Y, N, N, N },
|
||||
{ GL(EXT_texture_rectangle), VER(0,0), Y, N, N, N },
|
||||
{ GL(EXT_vertex_array), VER(0,0), Y, N, N, N },
|
||||
{ GL(3DFX_texture_compression_FXT1), VER(0,0), N, N, N, N },
|
||||
{ GL(3DFX_texture_compression_FXT1), VER(0,0), Y, N, N, N },
|
||||
{ GL(APPLE_packed_pixels), VER(1,2), Y, N, N, N },
|
||||
{ GL(APPLE_ycbcr_422), VER(0,0), Y, N, N, N },
|
||||
{ GL(ATI_text_fragment_shader), VER(0,0), Y, N, N, N },
|
||||
{ GL(ATI_texture_env_combine3), VER(0,0), Y, N, N, N },
|
||||
{ GL(ATI_texture_float), VER(0,0), Y, N, N, N },
|
||||
{ GL(ATI_texture_mirror_once), VER(0,0), Y, N, N, N },
|
||||
@@ -201,14 +204,25 @@ static const struct extension_info known_gl_extensions[] = {
|
||||
{ GL(NV_copy_depth_to_color), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_depth_clamp), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_fog_distance), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_fragment_program), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_fragment_program_option), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_fragment_program2), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_light_max_exponent), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_multisample_filter_hint), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_point_sprite), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_texgen_reflection), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_texture_compression_vtc), VER(0,0), N, N, N, N },
|
||||
{ GL(NV_texture_compression_vtc), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_texture_env_combine4), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_texture_rectangle), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_vertex_program), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_vertex_program1_1), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_vertex_program2), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_vertex_program2_option), VER(0,0), Y, N, N, N },
|
||||
{ GL(NV_vertex_program3), VER(0,0), Y, N, N, N },
|
||||
{ GL(OES_read_format), VER(0,0), Y, N, N, N },
|
||||
{ GL(OES_compressed_paletted_texture),VER(0,0), Y, N, N, N },
|
||||
{ GL(SGI_color_matrix), VER(0,0), Y, N, N, N },
|
||||
{ GL(SGI_texture_color_table), VER(0,0), Y, N, N, N },
|
||||
{ GL(SGIS_generate_mipmap), VER(1,4), Y, N, N, N },
|
||||
{ GL(SGIS_multisample), VER(0,0), Y, N, N, N },
|
||||
{ GL(SGIS_texture_border_clamp), VER(1,3), Y, N, N, N },
|
||||
@@ -234,8 +248,6 @@ static const struct extension_info known_gl_extensions[] = {
|
||||
};
|
||||
|
||||
|
||||
#define __GL_EXT_BYTES ((__NUM_GL_EXTS + 7) / 8)
|
||||
|
||||
/* global bit-fields of available extensions and their characteristics */
|
||||
static unsigned char client_glx_support[8];
|
||||
static unsigned char client_glx_only[8];
|
||||
@@ -490,6 +502,24 @@ __glXExtensionBitIsEnabled( __GLXscreenConfigs *psc, unsigned bit )
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if a certain extension is enabled in a given context.
|
||||
*
|
||||
*/
|
||||
GLboolean
|
||||
__glExtensionBitIsEnabled( const __GLXcontext * gc, unsigned bit )
|
||||
{
|
||||
GLboolean enabled = GL_FALSE;
|
||||
|
||||
if ( gc != NULL ) {
|
||||
enabled = EXT_ENABLED( bit, gc->gl_extension_bits );
|
||||
}
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Convert a bit-field to a string of supported extensions.
|
||||
*/
|
||||
@@ -677,6 +707,7 @@ __glXCalculateUsableGLExtensions( __GLXcontext * gc,
|
||||
|
||||
gc->extensions = (unsigned char *)
|
||||
__glXGetStringFromTable( known_gl_extensions, usable );
|
||||
(void) memcpy( gc->gl_extension_bits, usable, sizeof( usable ) );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -27,7 +27,6 @@
|
||||
*
|
||||
* \author Ian Romanick <idr@us.ibm.com>
|
||||
*/
|
||||
/* $XFree86: xc/lib/GL/glx/glxextensions.h,v 1.2tsi Exp $ */
|
||||
|
||||
#ifndef GLX_GLXEXTENSIONS_H
|
||||
#define GLX_GLXEXTENSIONS_H
|
||||
@@ -76,6 +75,7 @@ enum {
|
||||
enum {
|
||||
GL_ARB_depth_texture_bit = 0,
|
||||
GL_ARB_fragment_program_bit,
|
||||
GL_ARB_fragment_program_shadow_bit,
|
||||
GL_ARB_imaging_bit,
|
||||
GL_ARB_multisample_bit,
|
||||
GL_ARB_multitexture_bit,
|
||||
@@ -129,6 +129,7 @@ enum {
|
||||
GL_EXT_subtexture_bit,
|
||||
GL_EXT_texture_bit,
|
||||
GL_EXT_texture3D_bit,
|
||||
GL_EXT_texture_compression_dxt1_bit,
|
||||
GL_EXT_texture_compression_s3tc_bit,
|
||||
GL_EXT_texture_edge_clamp_bit,
|
||||
GL_EXT_texture_env_combine_bit,
|
||||
@@ -142,6 +143,7 @@ enum {
|
||||
GL_3DFX_texture_compression_FXT1_bit,
|
||||
GL_APPLE_packed_pixels_bit,
|
||||
GL_APPLE_ycbcr_422_bit,
|
||||
GL_ATI_text_fragment_shader_bit,
|
||||
GL_ATI_texture_env_combine3_bit,
|
||||
GL_ATI_texture_float_bit,
|
||||
GL_ATI_texture_mirror_once_bit,
|
||||
@@ -158,13 +160,24 @@ enum {
|
||||
GL_NV_copy_depth_to_color_bit,
|
||||
GL_NV_depth_clamp_bit,
|
||||
GL_NV_fog_distance_bit,
|
||||
GL_NV_fragment_program_bit,
|
||||
GL_NV_fragment_program_option_bit,
|
||||
GL_NV_fragment_program2_bit,
|
||||
GL_NV_light_max_exponent_bit,
|
||||
GL_NV_multisample_filter_hint_bit,
|
||||
GL_NV_point_sprite_bit,
|
||||
GL_NV_texgen_reflection_bit,
|
||||
GL_NV_texture_compression_vtc_bit,
|
||||
GL_NV_texture_env_combine4_bit,
|
||||
GL_NV_vertex_program_bit,
|
||||
GL_NV_vertex_program1_1_bit,
|
||||
GL_NV_vertex_program2_bit,
|
||||
GL_NV_vertex_program2_option_bit,
|
||||
GL_NV_vertex_program3_bit,
|
||||
GL_OES_compressed_paletted_texture_bit,
|
||||
GL_OES_read_format_bit,
|
||||
GL_SGI_color_matrix_bit,
|
||||
GL_SGI_texture_color_table_bit,
|
||||
GL_SGIS_generate_mipmap_bit,
|
||||
GL_SGIS_multisample_bit,
|
||||
GL_SGIS_texture_lod_bit,
|
||||
@@ -213,16 +226,25 @@ enum {
|
||||
GL_SUN_multi_draw_arrays_bit = GL_EXT_multi_draw_arrays_bit
|
||||
};
|
||||
|
||||
extern GLboolean __glXExtensionBitIsEnabled( __GLXscreenConfigs *psc, unsigned bit );
|
||||
#define __GL_EXT_BYTES ((__NUM_GL_EXTS + 7) / 8)
|
||||
|
||||
struct __GLXscreenConfigsRec;
|
||||
struct __GLXcontextRec;
|
||||
|
||||
extern GLboolean __glXExtensionBitIsEnabled( struct __GLXscreenConfigsRec *psc, unsigned bit );
|
||||
extern const char * __glXGetClientExtensions( void );
|
||||
extern void __glXCalculateUsableExtensions( __GLXscreenConfigs *psc,
|
||||
extern void __glXCalculateUsableExtensions( struct __GLXscreenConfigsRec *psc,
|
||||
GLboolean display_is_direct_capable, int server_minor_version );
|
||||
extern void __glXScrEnableExtension( __GLXscreenConfigs *psc, const char * name );
|
||||
extern void __glXCalculateUsableGLExtensions( __GLXcontext * gc,
|
||||
extern void __glXScrEnableExtension( struct __GLXscreenConfigsRec *psc, const char * name );
|
||||
extern void __glXCalculateUsableGLExtensions( struct __GLXcontextRec * gc,
|
||||
const char * server_string, int major_version, int minor_version );
|
||||
extern void __glXGetGLVersion( int * major_version, int * minor_version );
|
||||
extern char * __glXGetClientGLExtensionString( void );
|
||||
|
||||
extern GLboolean __glExtensionBitIsEnabled( const struct __GLXcontextRec * gc,
|
||||
unsigned bit );
|
||||
|
||||
|
||||
/* Source-level backwards compatibility with old drivers. They won't
|
||||
* find the respective functions, though.
|
||||
*/
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -42,6 +42,33 @@
|
||||
# else
|
||||
# define HIDDEN
|
||||
# endif
|
||||
# if defined(__i386__) && defined(__GNUC__)
|
||||
# define FASTCALL __attribute__((fastcall))
|
||||
# else
|
||||
# define FASTCALL
|
||||
# endif
|
||||
# if defined(__GNUC__)
|
||||
# define NOINLINE __attribute__((noinline))
|
||||
# else
|
||||
# define NOINLINE
|
||||
# endif
|
||||
|
||||
#include "glxclient.h"
|
||||
|
||||
extern HIDDEN NOINLINE CARD32 __glXReadReply( Display *dpy, size_t size,
|
||||
void * dest, GLboolean reply_is_always_array );
|
||||
|
||||
extern HIDDEN NOINLINE void __glXReadPixelReply( Display *dpy,
|
||||
__GLXcontext * gc, unsigned max_dim, GLint width, GLint height,
|
||||
GLint depth, GLenum format, GLenum type, void * dest,
|
||||
GLboolean dimensions_in_reply );
|
||||
|
||||
extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupSingleRequest(
|
||||
__GLXcontext * gc, GLint sop, GLint cmdlen );
|
||||
|
||||
extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest(
|
||||
__GLXcontext * gc, GLint code, GLint vop, GLint cmdlen );
|
||||
|
||||
extern HIDDEN void __indirect_glNewList(GLuint list, GLenum mode);
|
||||
extern HIDDEN void __indirect_glEndList(void);
|
||||
extern HIDDEN void __indirect_glCallList(GLuint list);
|
||||
@@ -514,11 +541,140 @@ extern HIDDEN void __indirect_glSecondaryColor3uivEXT(const GLuint * v);
|
||||
extern HIDDEN void __indirect_glSecondaryColor3usEXT(GLushort red, GLushort green, GLushort blue);
|
||||
extern HIDDEN void __indirect_glSecondaryColor3usvEXT(const GLushort * v);
|
||||
extern HIDDEN void __indirect_glSecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
|
||||
extern HIDDEN GLboolean __indirect_glAreProgramsResidentNV(GLsizei n, const GLuint * ids, GLboolean * residences);
|
||||
extern HIDDEN void __indirect_glBindProgramNV(GLenum target, GLuint id);
|
||||
extern HIDDEN void __indirect_glDeleteProgramsNV(GLsizei n, const GLuint * ids);
|
||||
extern HIDDEN void __indirect_glExecuteProgramNV(GLenum target, GLuint id, const GLfloat * params);
|
||||
extern HIDDEN void __indirect_glGenProgramsNV(GLsizei n, GLuint * ids);
|
||||
extern HIDDEN void __indirect_glGetProgramParameterdvNV(GLenum target, GLuint index, GLenum pname, GLdouble * params);
|
||||
extern HIDDEN void __indirect_glGetProgramParameterfvNV(GLenum target, GLuint index, GLenum pname, GLfloat * params);
|
||||
extern HIDDEN void __indirect_glGetProgramivNV(GLuint id, GLenum pname, GLint * params);
|
||||
extern HIDDEN void __indirect_glGetProgramStringNV(GLuint id, GLenum pname, GLubyte * program);
|
||||
extern HIDDEN void __indirect_glGetTrackMatrixivNV(GLenum target, GLuint address, GLenum pname, GLint * params);
|
||||
extern HIDDEN void __indirect_glGetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble * params);
|
||||
extern HIDDEN void __indirect_glGetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat * params);
|
||||
extern HIDDEN void __indirect_glGetVertexAttribivARB(GLuint index, GLenum pname, GLint * params);
|
||||
extern HIDDEN void __indirect_glGetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid ** pointer);
|
||||
extern HIDDEN GLboolean __indirect_glIsProgramNV(GLuint id);
|
||||
extern HIDDEN void __indirect_glLoadProgramNV(GLenum target, GLuint id, GLsizei len, const GLubyte * program);
|
||||
extern HIDDEN void __indirect_glProgramParameter4dNV(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
extern HIDDEN void __indirect_glProgramParameter4dvNV(GLenum target, GLuint index, const GLdouble * params);
|
||||
extern HIDDEN void __indirect_glProgramParameter4fNV(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
extern HIDDEN void __indirect_glProgramParameter4fvNV(GLenum target, GLuint index, const GLfloat * params);
|
||||
extern HIDDEN void __indirect_glProgramParameters4dvNV(GLenum target, GLuint index, GLuint num, const GLdouble * params);
|
||||
extern HIDDEN void __indirect_glProgramParameters4fvNV(GLenum target, GLuint index, GLuint num, const GLfloat * params);
|
||||
extern HIDDEN void __indirect_glRequestResidentProgramsNV(GLsizei n, const GLuint * ids);
|
||||
extern HIDDEN void __indirect_glTrackMatrixNV(GLenum target, GLuint address, GLenum matrix, GLenum transform);
|
||||
extern HIDDEN void __indirect_glVertexAttribPointerNV(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
|
||||
extern HIDDEN void __indirect_glVertexAttrib1dARB(GLuint index, GLdouble x);
|
||||
extern HIDDEN void __indirect_glVertexAttrib1dvARB(GLuint index, const GLdouble * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib1fARB(GLuint index, GLfloat x);
|
||||
extern HIDDEN void __indirect_glVertexAttrib1fvARB(GLuint index, const GLfloat * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib1sARB(GLuint index, GLshort x);
|
||||
extern HIDDEN void __indirect_glVertexAttrib1svARB(GLuint index, const GLshort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib2dARB(GLuint index, GLdouble x, GLdouble y);
|
||||
extern HIDDEN void __indirect_glVertexAttrib2dvARB(GLuint index, const GLdouble * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib2fARB(GLuint index, GLfloat x, GLfloat y);
|
||||
extern HIDDEN void __indirect_glVertexAttrib2fvARB(GLuint index, const GLfloat * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib2sARB(GLuint index, GLshort x, GLshort y);
|
||||
extern HIDDEN void __indirect_glVertexAttrib2svARB(GLuint index, const GLshort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib3dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z);
|
||||
extern HIDDEN void __indirect_glVertexAttrib3dvARB(GLuint index, const GLdouble * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib3fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
extern HIDDEN void __indirect_glVertexAttrib3fvARB(GLuint index, const GLfloat * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib3sARB(GLuint index, GLshort x, GLshort y, GLshort z);
|
||||
extern HIDDEN void __indirect_glVertexAttrib3svARB(GLuint index, const GLshort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4dARB(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4dvARB(GLuint index, const GLdouble * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4fARB(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4fvARB(GLuint index, const GLfloat * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4sARB(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4svARB(GLuint index, const GLshort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4NubARB(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4NubvARB(GLuint index, const GLubyte * v);
|
||||
extern HIDDEN void __indirect_glVertexAttribs1dvNV(GLuint index, GLsizei n, const GLdouble * v);
|
||||
extern HIDDEN void __indirect_glVertexAttribs1fvNV(GLuint index, GLsizei n, const GLfloat * v);
|
||||
extern HIDDEN void __indirect_glVertexAttribs1svNV(GLuint index, GLsizei n, const GLshort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttribs2dvNV(GLuint index, GLsizei n, const GLdouble * v);
|
||||
extern HIDDEN void __indirect_glVertexAttribs2fvNV(GLuint index, GLsizei n, const GLfloat * v);
|
||||
extern HIDDEN void __indirect_glVertexAttribs2svNV(GLuint index, GLsizei n, const GLshort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttribs3dvNV(GLuint index, GLsizei n, const GLdouble * v);
|
||||
extern HIDDEN void __indirect_glVertexAttribs3fvNV(GLuint index, GLsizei n, const GLfloat * v);
|
||||
extern HIDDEN void __indirect_glVertexAttribs3svNV(GLuint index, GLsizei n, const GLshort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttribs4dvNV(GLuint index, GLsizei n, const GLdouble * v);
|
||||
extern HIDDEN void __indirect_glVertexAttribs4fvNV(GLuint index, GLsizei n, const GLfloat * v);
|
||||
extern HIDDEN void __indirect_glVertexAttribs4svNV(GLuint index, GLsizei n, const GLshort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttribs4ubvNV(GLuint index, GLsizei n, const GLubyte * v);
|
||||
extern HIDDEN void __indirect_glPointParameteriNV(GLenum pname, GLint params);
|
||||
extern HIDDEN void __indirect_glPointParameterivNV(GLenum pname, const GLint * params);
|
||||
extern HIDDEN void __indirect_glMultiDrawArraysEXT(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount);
|
||||
extern HIDDEN void __indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount);
|
||||
extern HIDDEN void __indirect_glActiveStencilFaceEXT(GLenum face);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4ivARB(GLuint index, const GLint * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4ubvARB(GLuint index, const GLubyte * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4usvARB(GLuint index, const GLushort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4uivARB(GLuint index, const GLuint * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4NbvARB(GLuint index, const GLbyte * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4NsvARB(GLuint index, const GLshort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4NivARB(GLuint index, const GLint * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4NusvARB(GLuint index, const GLushort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4NuivARB(GLuint index, const GLuint * v);
|
||||
extern HIDDEN void __indirect_glVertexAttribPointerARB(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid * pointer);
|
||||
extern HIDDEN void __indirect_glEnableVertexAttribArrayARB(GLuint index);
|
||||
extern HIDDEN void __indirect_glDisableVertexAttribArrayARB(GLuint index);
|
||||
extern HIDDEN void __indirect_glProgramStringARB(GLenum target, GLenum format, GLsizei len, const GLvoid * string);
|
||||
extern HIDDEN void __indirect_glProgramEnvParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
extern HIDDEN void __indirect_glProgramEnvParameter4dvARB(GLenum target, GLuint index, const GLdouble * params);
|
||||
extern HIDDEN void __indirect_glProgramEnvParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
extern HIDDEN void __indirect_glProgramEnvParameter4fvARB(GLenum target, GLuint index, const GLfloat * params);
|
||||
extern HIDDEN void __indirect_glProgramLocalParameter4dARB(GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
extern HIDDEN void __indirect_glProgramLocalParameter4dvARB(GLenum target, GLuint index, const GLdouble * params);
|
||||
extern HIDDEN void __indirect_glProgramLocalParameter4fARB(GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
extern HIDDEN void __indirect_glProgramLocalParameter4fvARB(GLenum target, GLuint index, const GLfloat * params);
|
||||
extern HIDDEN void __indirect_glGetProgramEnvParameterdvARB(GLenum target, GLuint index, GLdouble * params);
|
||||
extern HIDDEN void __indirect_glGetProgramEnvParameterfvARB(GLenum target, GLuint index, GLfloat * params);
|
||||
extern HIDDEN void __indirect_glGetProgramLocalParameterdvARB(GLenum target, GLuint index, GLdouble * params);
|
||||
extern HIDDEN void __indirect_glGetProgramLocalParameterfvARB(GLenum target, GLuint index, GLfloat * params);
|
||||
extern HIDDEN void __indirect_glGetProgramivARB(GLenum target, GLenum pname, GLint * params);
|
||||
extern HIDDEN void __indirect_glGetProgramStringARB(GLenum target, GLenum pname, GLvoid * string);
|
||||
extern HIDDEN void __indirect_glProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
extern HIDDEN void __indirect_glProgramNamedParameter4dNV(GLuint id, GLsizei len, const GLubyte * name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
extern HIDDEN void __indirect_glProgramNamedParameter4fvNV(GLuint id, GLsizei len, const GLubyte * name, const GLfloat * v);
|
||||
extern HIDDEN void __indirect_glProgramNamedParameter4dvNV(GLuint id, GLsizei len, const GLubyte * name, const GLdouble * v);
|
||||
extern HIDDEN void __indirect_glGetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte * name, GLfloat * params);
|
||||
extern HIDDEN void __indirect_glGetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte * name, GLdouble * params);
|
||||
extern HIDDEN void __indirect_glGetVertexAttribdvNV(GLuint index, GLenum pname, GLdouble * params);
|
||||
extern HIDDEN void __indirect_glGetVertexAttribfvNV(GLuint index, GLenum pname, GLfloat * params);
|
||||
extern HIDDEN void __indirect_glGetVertexAttribivNV(GLuint index, GLenum pname, GLint * params);
|
||||
extern HIDDEN void __indirect_glVertexAttrib1dNV(GLuint index, GLdouble x);
|
||||
extern HIDDEN void __indirect_glVertexAttrib1dvNV(GLuint index, const GLdouble * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib1fNV(GLuint index, GLfloat x);
|
||||
extern HIDDEN void __indirect_glVertexAttrib1fvNV(GLuint index, const GLfloat * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib1sNV(GLuint index, GLshort x);
|
||||
extern HIDDEN void __indirect_glVertexAttrib1svNV(GLuint index, const GLshort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib2dNV(GLuint index, GLdouble x, GLdouble y);
|
||||
extern HIDDEN void __indirect_glVertexAttrib2dvNV(GLuint index, const GLdouble * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib2fNV(GLuint index, GLfloat x, GLfloat y);
|
||||
extern HIDDEN void __indirect_glVertexAttrib2fvNV(GLuint index, const GLfloat * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib2sNV(GLuint index, GLshort x, GLshort y);
|
||||
extern HIDDEN void __indirect_glVertexAttrib2svNV(GLuint index, const GLshort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib3dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z);
|
||||
extern HIDDEN void __indirect_glVertexAttrib3dvNV(GLuint index, const GLdouble * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib3fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
extern HIDDEN void __indirect_glVertexAttrib3fvNV(GLuint index, const GLfloat * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib3sNV(GLuint index, GLshort x, GLshort y, GLshort z);
|
||||
extern HIDDEN void __indirect_glVertexAttrib3svNV(GLuint index, const GLshort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4dNV(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4dvNV(GLuint index, const GLdouble * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4fNV(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4fvNV(GLuint index, const GLfloat * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4sNV(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4svNV(GLuint index, const GLshort * v);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4ubNV(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
|
||||
extern HIDDEN void __indirect_glVertexAttrib4ubvNV(GLuint index, const GLubyte * v);
|
||||
|
||||
# undef HIDDEN
|
||||
# undef FASTCALL
|
||||
# undef NOINLINE
|
||||
|
||||
#endif /* !defined( _INDIRECT_H_ ) */
|
||||
|
@@ -589,6 +589,85 @@ __GLapi * __glXNewIndirectAPI( void )
|
||||
glAPI->SecondaryColor3usvEXT = __indirect_glSecondaryColor3usvEXT;
|
||||
glAPI->SecondaryColorPointerEXT = __indirect_glSecondaryColorPointerEXT;
|
||||
|
||||
/* GL_NV_vertex_program */
|
||||
|
||||
glAPI->AreProgramsResidentNV = __indirect_glAreProgramsResidentNV;
|
||||
glAPI->BindProgramNV = __indirect_glBindProgramNV;
|
||||
glAPI->DeleteProgramsNV = __indirect_glDeleteProgramsNV;
|
||||
glAPI->ExecuteProgramNV = __indirect_glExecuteProgramNV;
|
||||
glAPI->GenProgramsNV = __indirect_glGenProgramsNV;
|
||||
glAPI->GetProgramParameterdvNV = __indirect_glGetProgramParameterdvNV;
|
||||
glAPI->GetProgramParameterfvNV = __indirect_glGetProgramParameterfvNV;
|
||||
glAPI->GetProgramivNV = __indirect_glGetProgramivNV;
|
||||
glAPI->GetProgramStringNV = __indirect_glGetProgramStringNV;
|
||||
glAPI->GetTrackMatrixivNV = __indirect_glGetTrackMatrixivNV;
|
||||
|
||||
/* GL_ARB_vertex_program */
|
||||
|
||||
glAPI->GetVertexAttribdvARB = __indirect_glGetVertexAttribdvARB;
|
||||
glAPI->GetVertexAttribfvARB = __indirect_glGetVertexAttribfvARB;
|
||||
glAPI->GetVertexAttribivARB = __indirect_glGetVertexAttribivARB;
|
||||
|
||||
/* GL_NV_vertex_program */
|
||||
|
||||
glAPI->GetVertexAttribPointervNV = __indirect_glGetVertexAttribPointervNV;
|
||||
glAPI->IsProgramNV = __indirect_glIsProgramNV;
|
||||
glAPI->LoadProgramNV = __indirect_glLoadProgramNV;
|
||||
glAPI->ProgramParameter4dNV = __indirect_glProgramParameter4dNV;
|
||||
glAPI->ProgramParameter4dvNV = __indirect_glProgramParameter4dvNV;
|
||||
glAPI->ProgramParameter4fNV = __indirect_glProgramParameter4fNV;
|
||||
glAPI->ProgramParameter4fvNV = __indirect_glProgramParameter4fvNV;
|
||||
glAPI->ProgramParameters4dvNV = __indirect_glProgramParameters4dvNV;
|
||||
glAPI->ProgramParameters4fvNV = __indirect_glProgramParameters4fvNV;
|
||||
glAPI->RequestResidentProgramsNV = __indirect_glRequestResidentProgramsNV;
|
||||
glAPI->TrackMatrixNV = __indirect_glTrackMatrixNV;
|
||||
glAPI->VertexAttribPointerNV = __indirect_glVertexAttribPointerNV;
|
||||
|
||||
/* GL_ARB_vertex_program */
|
||||
|
||||
glAPI->VertexAttrib1dARB = __indirect_glVertexAttrib1dARB;
|
||||
glAPI->VertexAttrib1dvARB = __indirect_glVertexAttrib1dvARB;
|
||||
glAPI->VertexAttrib1fARB = __indirect_glVertexAttrib1fARB;
|
||||
glAPI->VertexAttrib1fvARB = __indirect_glVertexAttrib1fvARB;
|
||||
glAPI->VertexAttrib1sARB = __indirect_glVertexAttrib1sARB;
|
||||
glAPI->VertexAttrib1svARB = __indirect_glVertexAttrib1svARB;
|
||||
glAPI->VertexAttrib2dARB = __indirect_glVertexAttrib2dARB;
|
||||
glAPI->VertexAttrib2dvARB = __indirect_glVertexAttrib2dvARB;
|
||||
glAPI->VertexAttrib2fARB = __indirect_glVertexAttrib2fARB;
|
||||
glAPI->VertexAttrib2fvARB = __indirect_glVertexAttrib2fvARB;
|
||||
glAPI->VertexAttrib2sARB = __indirect_glVertexAttrib2sARB;
|
||||
glAPI->VertexAttrib2svARB = __indirect_glVertexAttrib2svARB;
|
||||
glAPI->VertexAttrib3dARB = __indirect_glVertexAttrib3dARB;
|
||||
glAPI->VertexAttrib3dvARB = __indirect_glVertexAttrib3dvARB;
|
||||
glAPI->VertexAttrib3fARB = __indirect_glVertexAttrib3fARB;
|
||||
glAPI->VertexAttrib3fvARB = __indirect_glVertexAttrib3fvARB;
|
||||
glAPI->VertexAttrib3sARB = __indirect_glVertexAttrib3sARB;
|
||||
glAPI->VertexAttrib3svARB = __indirect_glVertexAttrib3svARB;
|
||||
glAPI->VertexAttrib4dARB = __indirect_glVertexAttrib4dARB;
|
||||
glAPI->VertexAttrib4dvARB = __indirect_glVertexAttrib4dvARB;
|
||||
glAPI->VertexAttrib4fARB = __indirect_glVertexAttrib4fARB;
|
||||
glAPI->VertexAttrib4fvARB = __indirect_glVertexAttrib4fvARB;
|
||||
glAPI->VertexAttrib4sARB = __indirect_glVertexAttrib4sARB;
|
||||
glAPI->VertexAttrib4svARB = __indirect_glVertexAttrib4svARB;
|
||||
glAPI->VertexAttrib4NubARB = __indirect_glVertexAttrib4NubARB;
|
||||
glAPI->VertexAttrib4NubvARB = __indirect_glVertexAttrib4NubvARB;
|
||||
|
||||
/* GL_NV_vertex_program */
|
||||
|
||||
glAPI->VertexAttribs1dvNV = __indirect_glVertexAttribs1dvNV;
|
||||
glAPI->VertexAttribs1fvNV = __indirect_glVertexAttribs1fvNV;
|
||||
glAPI->VertexAttribs1svNV = __indirect_glVertexAttribs1svNV;
|
||||
glAPI->VertexAttribs2dvNV = __indirect_glVertexAttribs2dvNV;
|
||||
glAPI->VertexAttribs2fvNV = __indirect_glVertexAttribs2fvNV;
|
||||
glAPI->VertexAttribs2svNV = __indirect_glVertexAttribs2svNV;
|
||||
glAPI->VertexAttribs3dvNV = __indirect_glVertexAttribs3dvNV;
|
||||
glAPI->VertexAttribs3fvNV = __indirect_glVertexAttribs3fvNV;
|
||||
glAPI->VertexAttribs3svNV = __indirect_glVertexAttribs3svNV;
|
||||
glAPI->VertexAttribs4dvNV = __indirect_glVertexAttribs4dvNV;
|
||||
glAPI->VertexAttribs4fvNV = __indirect_glVertexAttribs4fvNV;
|
||||
glAPI->VertexAttribs4svNV = __indirect_glVertexAttribs4svNV;
|
||||
glAPI->VertexAttribs4ubvNV = __indirect_glVertexAttribs4ubvNV;
|
||||
|
||||
/* GL_NV_point_sprite */
|
||||
|
||||
glAPI->PointParameteriNV = __indirect_glPointParameteriNV;
|
||||
@@ -603,6 +682,77 @@ __GLapi * __glXNewIndirectAPI( void )
|
||||
|
||||
glAPI->ActiveStencilFaceEXT = __indirect_glActiveStencilFaceEXT;
|
||||
|
||||
/* GL_ARB_vertex_program */
|
||||
|
||||
glAPI->VertexAttrib4ivARB = __indirect_glVertexAttrib4ivARB;
|
||||
glAPI->VertexAttrib4ubvARB = __indirect_glVertexAttrib4ubvARB;
|
||||
glAPI->VertexAttrib4usvARB = __indirect_glVertexAttrib4usvARB;
|
||||
glAPI->VertexAttrib4uivARB = __indirect_glVertexAttrib4uivARB;
|
||||
glAPI->VertexAttrib4NbvARB = __indirect_glVertexAttrib4NbvARB;
|
||||
glAPI->VertexAttrib4NsvARB = __indirect_glVertexAttrib4NsvARB;
|
||||
glAPI->VertexAttrib4NivARB = __indirect_glVertexAttrib4NivARB;
|
||||
glAPI->VertexAttrib4NusvARB = __indirect_glVertexAttrib4NusvARB;
|
||||
glAPI->VertexAttrib4NuivARB = __indirect_glVertexAttrib4NuivARB;
|
||||
glAPI->VertexAttribPointerARB = __indirect_glVertexAttribPointerARB;
|
||||
glAPI->EnableVertexAttribArrayARB = __indirect_glEnableVertexAttribArrayARB;
|
||||
glAPI->DisableVertexAttribArrayARB = __indirect_glDisableVertexAttribArrayARB;
|
||||
glAPI->ProgramStringARB = __indirect_glProgramStringARB;
|
||||
glAPI->ProgramEnvParameter4dARB = __indirect_glProgramEnvParameter4dARB;
|
||||
glAPI->ProgramEnvParameter4dvARB = __indirect_glProgramEnvParameter4dvARB;
|
||||
glAPI->ProgramEnvParameter4fARB = __indirect_glProgramEnvParameter4fARB;
|
||||
glAPI->ProgramEnvParameter4fvARB = __indirect_glProgramEnvParameter4fvARB;
|
||||
glAPI->ProgramLocalParameter4dARB = __indirect_glProgramLocalParameter4dARB;
|
||||
glAPI->ProgramLocalParameter4dvARB = __indirect_glProgramLocalParameter4dvARB;
|
||||
glAPI->ProgramLocalParameter4fARB = __indirect_glProgramLocalParameter4fARB;
|
||||
glAPI->ProgramLocalParameter4fvARB = __indirect_glProgramLocalParameter4fvARB;
|
||||
glAPI->GetProgramEnvParameterdvARB = __indirect_glGetProgramEnvParameterdvARB;
|
||||
glAPI->GetProgramEnvParameterfvARB = __indirect_glGetProgramEnvParameterfvARB;
|
||||
glAPI->GetProgramLocalParameterdvARB = __indirect_glGetProgramLocalParameterdvARB;
|
||||
glAPI->GetProgramLocalParameterfvARB = __indirect_glGetProgramLocalParameterfvARB;
|
||||
glAPI->GetProgramivARB = __indirect_glGetProgramivARB;
|
||||
glAPI->GetProgramStringARB = __indirect_glGetProgramStringARB;
|
||||
|
||||
/* GL_NV_fragment_program */
|
||||
|
||||
glAPI->ProgramNamedParameter4fNV = __indirect_glProgramNamedParameter4fNV;
|
||||
glAPI->ProgramNamedParameter4dNV = __indirect_glProgramNamedParameter4dNV;
|
||||
glAPI->ProgramNamedParameter4fvNV = __indirect_glProgramNamedParameter4fvNV;
|
||||
glAPI->ProgramNamedParameter4dvNV = __indirect_glProgramNamedParameter4dvNV;
|
||||
glAPI->GetProgramNamedParameterfvNV = __indirect_glGetProgramNamedParameterfvNV;
|
||||
glAPI->GetProgramNamedParameterdvNV = __indirect_glGetProgramNamedParameterdvNV;
|
||||
|
||||
/* GL_NV_vertex_program */
|
||||
|
||||
glAPI->GetVertexAttribdvNV = __indirect_glGetVertexAttribdvNV;
|
||||
glAPI->GetVertexAttribfvNV = __indirect_glGetVertexAttribfvNV;
|
||||
glAPI->GetVertexAttribivNV = __indirect_glGetVertexAttribivNV;
|
||||
glAPI->VertexAttrib1dNV = __indirect_glVertexAttrib1dNV;
|
||||
glAPI->VertexAttrib1dvNV = __indirect_glVertexAttrib1dvNV;
|
||||
glAPI->VertexAttrib1fNV = __indirect_glVertexAttrib1fNV;
|
||||
glAPI->VertexAttrib1fvNV = __indirect_glVertexAttrib1fvNV;
|
||||
glAPI->VertexAttrib1sNV = __indirect_glVertexAttrib1sNV;
|
||||
glAPI->VertexAttrib1svNV = __indirect_glVertexAttrib1svNV;
|
||||
glAPI->VertexAttrib2dNV = __indirect_glVertexAttrib2dNV;
|
||||
glAPI->VertexAttrib2dvNV = __indirect_glVertexAttrib2dvNV;
|
||||
glAPI->VertexAttrib2fNV = __indirect_glVertexAttrib2fNV;
|
||||
glAPI->VertexAttrib2fvNV = __indirect_glVertexAttrib2fvNV;
|
||||
glAPI->VertexAttrib2sNV = __indirect_glVertexAttrib2sNV;
|
||||
glAPI->VertexAttrib2svNV = __indirect_glVertexAttrib2svNV;
|
||||
glAPI->VertexAttrib3dNV = __indirect_glVertexAttrib3dNV;
|
||||
glAPI->VertexAttrib3dvNV = __indirect_glVertexAttrib3dvNV;
|
||||
glAPI->VertexAttrib3fNV = __indirect_glVertexAttrib3fNV;
|
||||
glAPI->VertexAttrib3fvNV = __indirect_glVertexAttrib3fvNV;
|
||||
glAPI->VertexAttrib3sNV = __indirect_glVertexAttrib3sNV;
|
||||
glAPI->VertexAttrib3svNV = __indirect_glVertexAttrib3svNV;
|
||||
glAPI->VertexAttrib4dNV = __indirect_glVertexAttrib4dNV;
|
||||
glAPI->VertexAttrib4dvNV = __indirect_glVertexAttrib4dvNV;
|
||||
glAPI->VertexAttrib4fNV = __indirect_glVertexAttrib4fNV;
|
||||
glAPI->VertexAttrib4fvNV = __indirect_glVertexAttrib4fvNV;
|
||||
glAPI->VertexAttrib4sNV = __indirect_glVertexAttrib4sNV;
|
||||
glAPI->VertexAttrib4svNV = __indirect_glVertexAttrib4svNV;
|
||||
glAPI->VertexAttrib4ubNV = __indirect_glVertexAttrib4ubNV;
|
||||
glAPI->VertexAttrib4ubvNV = __indirect_glVertexAttrib4ubvNV;
|
||||
|
||||
return glAPI;
|
||||
}
|
||||
|
||||
|
@@ -132,6 +132,7 @@ __glLightModelfv_size( GLenum e )
|
||||
case GL_LIGHT_MODEL_LOCAL_VIEWER:
|
||||
case GL_LIGHT_MODEL_TWO_SIDE:
|
||||
case GL_LIGHT_MODEL_COLOR_CONTROL:
|
||||
/* case GL_LIGHT_MODEL_COLOR_CONTROL_EXT:*/
|
||||
return 1;
|
||||
case GL_LIGHT_MODEL_AMBIENT:
|
||||
return 4;
|
||||
|
@@ -81,8 +81,8 @@ extern INTERNAL PURE FASTCALL GLint __glConvolutionParameteriv_size(GLenum);
|
||||
extern INTERNAL PURE FASTCALL GLint __glPointParameterfvEXT_size(GLenum);
|
||||
extern INTERNAL PURE FASTCALL GLint __glPointParameterivNV_size(GLenum);
|
||||
|
||||
# undef INTERNAL
|
||||
# undef PURE
|
||||
# undef FASTCALL
|
||||
# undef INTERNAL
|
||||
|
||||
#endif /* !defined( _INDIRECT_SIZE_H_ ) */
|
||||
|
2106
src/glx/x11/indirect_vertex_array.c
Normal file
2106
src/glx/x11/indirect_vertex_array.c
Normal file
File diff suppressed because it is too large
Load Diff
57
src/glx/x11/indirect_vertex_array.h
Normal file
57
src/glx/x11/indirect_vertex_array.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* (C) Copyright IBM Corporation 2004, 2005
|
||||
* 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, sub license,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* IBM,
|
||||
* AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef INDIRECT_VERTEX_ARRAY_H
|
||||
#define INDIRECT_VERTEX_ARRAY_H
|
||||
|
||||
extern const GLuint __glXTypeSize_table[16];
|
||||
|
||||
#define __glXTypeSize(e) ((((e) & ~0x0f) != 0x1400) \
|
||||
? 0 : __glXTypeSize_table[ (e) & 0x0f ])
|
||||
|
||||
extern void __glXArrayDisableAll( __GLXattribute * state );
|
||||
|
||||
extern GLboolean __glXSetArrayEnable( __GLXattribute * state,
|
||||
GLenum key, unsigned index, GLboolean enable );
|
||||
|
||||
extern GLboolean __glXGetArrayEnable( const __GLXattribute * const state,
|
||||
GLenum key, unsigned index, GLintptr * dest );
|
||||
extern GLboolean __glXGetArraySize( const __GLXattribute * const state,
|
||||
GLenum key, unsigned index, GLintptr * dest );
|
||||
extern GLboolean __glXGetArrayType( const __GLXattribute * const state,
|
||||
GLenum key, unsigned index, GLintptr * dest );
|
||||
extern GLboolean __glXGetArrayStride( const __GLXattribute * const state,
|
||||
GLenum key, unsigned index, GLintptr * dest );
|
||||
extern GLboolean __glXGetArrayPointer( const __GLXattribute * const state,
|
||||
GLenum key, unsigned index, void ** dest );
|
||||
extern GLboolean __glXGetArrayNormalized( const __GLXattribute * const state,
|
||||
GLenum key, unsigned index, GLintptr * dest );
|
||||
|
||||
extern void __glXPushArrayState( __GLXattribute * state );
|
||||
extern void __glXPopArrayState( __GLXattribute * state );
|
||||
|
||||
extern GLuint __glXGetActiveTextureUnit( const __GLXattribute * const state );
|
||||
|
||||
#endif /* INDIRECT_VERTEX_ARRAY_H */
|
272
src/glx/x11/indirect_vertex_program.c
Normal file
272
src/glx/x11/indirect_vertex_program.c
Normal file
@@ -0,0 +1,272 @@
|
||||
/*
|
||||
* (C) Copyright IBM Corporation 2005
|
||||
* 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, sub license,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* IBM,
|
||||
* AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <GL/gl.h>
|
||||
#include "indirect.h"
|
||||
#include "glxclient.h"
|
||||
#include "indirect_vertex_array.h"
|
||||
#include <GL/glxproto.h>
|
||||
|
||||
void do_vertex_attrib_enable( GLuint index, GLboolean val )
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
|
||||
if ( ! __glXSetArrayEnable( state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
|
||||
index, val ) ) {
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void __indirect_glEnableVertexAttribArrayARB( GLuint index )
|
||||
{
|
||||
do_vertex_attrib_enable( index, GL_TRUE );
|
||||
}
|
||||
|
||||
|
||||
void __indirect_glDisableVertexAttribArrayARB( GLuint index )
|
||||
{
|
||||
do_vertex_attrib_enable( index, GL_FALSE );
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
get_parameter( unsigned opcode, unsigned size, GLenum target, GLuint index,
|
||||
void * params )
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
Display * const dpy = gc->currentDpy;
|
||||
const GLuint cmdlen = 12;
|
||||
|
||||
if (__builtin_expect(dpy != NULL, 1)) {
|
||||
GLubyte const * pc = __glXSetupVendorRequest(gc,
|
||||
X_GLXVendorPrivateWithReply,
|
||||
opcode, cmdlen);
|
||||
|
||||
*((GLenum *)(pc + 0)) = target;
|
||||
*((GLuint *)(pc + 4)) = index;
|
||||
*((GLuint *)(pc + 8)) = 0;
|
||||
|
||||
(void) __glXReadReply(dpy, size, params, GL_FALSE);
|
||||
UnlockDisplay(dpy); SyncHandle();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void __indirect_glGetProgramEnvParameterfvARB( GLenum target, GLuint index,
|
||||
GLfloat * params )
|
||||
{
|
||||
get_parameter( 1296, 4, target, index, params );
|
||||
}
|
||||
|
||||
|
||||
void __indirect_glGetProgramEnvParameterdvARB( GLenum target, GLuint index,
|
||||
GLdouble * params )
|
||||
{
|
||||
get_parameter( 1297, 8, target, index, params );
|
||||
}
|
||||
|
||||
|
||||
void __indirect_glGetProgramLocalParameterfvARB( GLenum target, GLuint index,
|
||||
GLfloat * params )
|
||||
{
|
||||
get_parameter( 1305, 4, target, index, params );
|
||||
}
|
||||
|
||||
|
||||
void __indirect_glGetProgramLocalParameterdvARB( GLenum target, GLuint index,
|
||||
GLdouble * params )
|
||||
{
|
||||
get_parameter( 1306, 8, target, index, params );
|
||||
}
|
||||
|
||||
|
||||
void __indirect_glGetVertexAttribPointervNV( GLuint index, GLenum pname,
|
||||
GLvoid ** pointer )
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
|
||||
if ( pname != GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB ) {
|
||||
__glXSetError( gc, GL_INVALID_ENUM );
|
||||
}
|
||||
|
||||
if ( ! __glXGetArrayPointer( state, GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB,
|
||||
index, pointer ) ) {
|
||||
__glXSetError( gc, GL_INVALID_VALUE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the selected attribute from the vertex array state vector.
|
||||
*
|
||||
* \returns
|
||||
* On success \c GL_TRUE is returned. Otherwise, \c GL_FALSE is returned.
|
||||
*/
|
||||
static GLboolean
|
||||
get_attrib_array_data( __GLXattribute * state, GLuint index, GLenum cap,
|
||||
GLintptr * data )
|
||||
{
|
||||
GLboolean retval = GL_FALSE;
|
||||
const GLenum attrib = GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB;
|
||||
|
||||
switch( cap ) {
|
||||
case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB:
|
||||
retval = __glXGetArrayEnable( state, attrib, index, data );
|
||||
break;
|
||||
|
||||
case GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB:
|
||||
retval = __glXGetArraySize( state, attrib, index, data );
|
||||
break;
|
||||
|
||||
case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
|
||||
retval = __glXGetArrayStride( state, attrib, index, data );
|
||||
break;
|
||||
|
||||
case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
|
||||
retval = __glXGetArrayType( state, attrib, index, data );
|
||||
break;
|
||||
|
||||
case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
|
||||
retval = __glXGetArrayNormalized( state, attrib, index, data );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
static void get_vertex_attrib( __GLXcontext * gc, unsigned vop,
|
||||
GLuint index, GLenum pname,
|
||||
xReply * reply )
|
||||
{
|
||||
Display * const dpy = gc->currentDpy;
|
||||
GLubyte * const pc = __glXSetupVendorRequest(gc,
|
||||
X_GLXVendorPrivateWithReply,
|
||||
vop, 8);
|
||||
|
||||
*((uint32_t *)(pc + 0)) = index;
|
||||
*((uint32_t *)(pc + 4)) = pname;
|
||||
|
||||
(void) _XReply( dpy, reply, 0, False );
|
||||
}
|
||||
|
||||
|
||||
void __indirect_glGetVertexAttribivARB( GLuint index, GLenum pname,
|
||||
GLint * params )
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
Display * const dpy = gc->currentDpy;
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
xGLXSingleReply reply;
|
||||
|
||||
|
||||
get_vertex_attrib( gc, 1303, index, pname, (xReply *) & reply );
|
||||
|
||||
if ( reply.size != 0 ) {
|
||||
if ( ! get_attrib_array_data( state, index, pname, params ) ) {
|
||||
if (reply.size == 1) {
|
||||
*params = (GLint) reply.pad3;
|
||||
}
|
||||
else {
|
||||
_XRead(dpy, (void *) params, 4 * reply.size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
||||
|
||||
void __indirect_glGetVertexAttribfvARB( GLuint index, GLenum pname,
|
||||
GLfloat * params )
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
Display * const dpy = gc->currentDpy;
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
xGLXSingleReply reply;
|
||||
|
||||
|
||||
get_vertex_attrib( gc, 1302, index, pname, (xReply *) & reply );
|
||||
|
||||
if ( reply.size != 0 ) {
|
||||
GLintptr data;
|
||||
|
||||
|
||||
if ( get_attrib_array_data( state, index, pname, & data ) ) {
|
||||
*params = (GLfloat) data;
|
||||
}
|
||||
else {
|
||||
if (reply.size == 1) {
|
||||
(void) memcpy( params, & reply.pad3, sizeof( GLfloat ) );
|
||||
}
|
||||
else {
|
||||
_XRead(dpy, (void *) params, 4 * reply.size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
||||
|
||||
|
||||
void __indirect_glGetVertexAttribdvARB( GLuint index, GLenum pname,
|
||||
GLdouble * params )
|
||||
{
|
||||
__GLXcontext * const gc = __glXGetCurrentContext();
|
||||
Display * const dpy = gc->currentDpy;
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
xGLXSingleReply reply;
|
||||
|
||||
|
||||
get_vertex_attrib( gc, 1301, index, pname, (xReply *) & reply );
|
||||
|
||||
if ( reply.size != 0 ) {
|
||||
GLintptr data;
|
||||
|
||||
|
||||
if ( get_attrib_array_data( state, index, pname, & data ) ) {
|
||||
*params = (GLdouble) data;
|
||||
}
|
||||
else {
|
||||
if (reply.size == 1) {
|
||||
(void) memcpy( params, & reply.pad3, sizeof( GLdouble ) );
|
||||
}
|
||||
else {
|
||||
_XRead(dpy, (void *) params, 8 * reply.size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
}
|
@@ -35,9 +35,11 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "glxclient.h"
|
||||
#include "packsingle.h"
|
||||
#include "glxextensions.h"
|
||||
#include "indirect_vertex_array.h"
|
||||
|
||||
/* Used for GL_ARB_transpose_matrix */
|
||||
static void TransposeMatrixf(GLfloat m[16])
|
||||
@@ -134,24 +136,166 @@ GLenum __indirect_glGetError(void)
|
||||
return retval;
|
||||
}
|
||||
|
||||
#define CASE_ARRAY_ENABLE(enum_name,array,dest,gl_type) \
|
||||
case GL_ ## enum_name ## _ARRAY: \
|
||||
*dest = (gl_type) (IS_ARRAY_ENABLED(state, array)); break
|
||||
#define CASE_ARRAY_SIZE(enum_name,array,dest,gl_type) \
|
||||
case GL_ ## enum_name ## _ARRAY_SIZE: \
|
||||
*dest = (gl_type) state->vertArray.arrays[array ## _ARRAY].size ; break
|
||||
#define CASE_ARRAY_TYPE(enum_name,array,dest,gl_type) \
|
||||
case GL_ ## enum_name ## _ARRAY_TYPE: \
|
||||
*dest = (gl_type) state->vertArray.arrays[array ## _ARRAY].type ; break
|
||||
#define CASE_ARRAY_STRIDE(enum_name,array,dest,gl_type) \
|
||||
case GL_ ## enum_name ## _ARRAY_STRIDE: \
|
||||
*dest = (gl_type) state->vertArray.arrays[array ## _ARRAY].stride ; break
|
||||
|
||||
#define CASE_ARRAY_ALL(enum_name,array,dest,gl_type) \
|
||||
CASE_ARRAY_ENABLE(enum_name,array,dest,gl_type); \
|
||||
CASE_ARRAY_STRIDE(enum_name,array,dest,gl_type); \
|
||||
CASE_ARRAY_TYPE(enum_name,array,dest,gl_type); \
|
||||
CASE_ARRAY_SIZE(enum_name,array,dest,gl_type)
|
||||
/**
|
||||
* Get the selected attribute from the client state.
|
||||
*
|
||||
* \returns
|
||||
* On success \c GL_TRUE is returned. Otherwise, \c GL_FALSE is returned.
|
||||
*/
|
||||
static GLboolean
|
||||
get_client_data( __GLXattribute * state, GLenum cap, GLintptr * data )
|
||||
{
|
||||
GLboolean retval = GL_TRUE;
|
||||
const GLint tex_unit = __glXGetActiveTextureUnit( state );
|
||||
|
||||
|
||||
switch( cap ) {
|
||||
case GL_VERTEX_ARRAY:
|
||||
case GL_NORMAL_ARRAY:
|
||||
case GL_COLOR_ARRAY:
|
||||
case GL_INDEX_ARRAY:
|
||||
case GL_EDGE_FLAG_ARRAY:
|
||||
case GL_SECONDARY_COLOR_ARRAY:
|
||||
case GL_FOG_COORD_ARRAY:
|
||||
retval = __glXGetArrayEnable( state, cap, 0, data );
|
||||
break;
|
||||
|
||||
case GL_VERTEX_ARRAY_SIZE:
|
||||
retval = __glXGetArraySize( state, GL_VERTEX_ARRAY, 0, data );
|
||||
break;
|
||||
case GL_COLOR_ARRAY_SIZE:
|
||||
retval = __glXGetArraySize( state, GL_COLOR_ARRAY, 0, data );
|
||||
break;
|
||||
case GL_SECONDARY_COLOR_ARRAY_SIZE:
|
||||
retval = __glXGetArraySize( state, GL_SECONDARY_COLOR_ARRAY, 0, data );
|
||||
break;
|
||||
|
||||
case GL_VERTEX_ARRAY_TYPE:
|
||||
retval = __glXGetArrayType( state, GL_VERTEX_ARRAY, 0, data );
|
||||
break;
|
||||
case GL_NORMAL_ARRAY_TYPE:
|
||||
retval = __glXGetArrayType( state, GL_NORMAL_ARRAY, 0, data );
|
||||
break;
|
||||
case GL_INDEX_ARRAY_TYPE:
|
||||
retval = __glXGetArrayType( state, GL_INDEX_ARRAY, 0, data );
|
||||
break;
|
||||
case GL_COLOR_ARRAY_TYPE:
|
||||
retval = __glXGetArrayType( state, GL_COLOR_ARRAY, 0, data );
|
||||
break;
|
||||
case GL_SECONDARY_COLOR_ARRAY_TYPE:
|
||||
retval = __glXGetArrayType( state, GL_SECONDARY_COLOR_ARRAY, 0, data );
|
||||
break;
|
||||
case GL_FOG_COORD_ARRAY_TYPE:
|
||||
retval = __glXGetArrayType( state, GL_FOG_COORD_ARRAY, 0, data );
|
||||
break;
|
||||
|
||||
case GL_VERTEX_ARRAY_STRIDE:
|
||||
retval = __glXGetArrayStride( state, GL_VERTEX_ARRAY, 0, data );
|
||||
break;
|
||||
case GL_NORMAL_ARRAY_STRIDE:
|
||||
retval = __glXGetArrayStride( state, GL_NORMAL_ARRAY, 0, data );
|
||||
break;
|
||||
case GL_INDEX_ARRAY_STRIDE:
|
||||
retval = __glXGetArrayStride( state, GL_INDEX_ARRAY, 0, data );
|
||||
break;
|
||||
case GL_EDGE_FLAG_ARRAY_STRIDE:
|
||||
retval = __glXGetArrayStride( state, GL_EDGE_FLAG_ARRAY, 0, data );
|
||||
break;
|
||||
case GL_COLOR_ARRAY_STRIDE:
|
||||
retval = __glXGetArrayStride( state, GL_COLOR_ARRAY, 0, data );
|
||||
break;
|
||||
case GL_SECONDARY_COLOR_ARRAY_STRIDE:
|
||||
retval = __glXGetArrayStride( state, GL_SECONDARY_COLOR_ARRAY, 0, data );
|
||||
break;
|
||||
case GL_FOG_COORD_ARRAY_STRIDE:
|
||||
retval = __glXGetArrayStride( state, GL_FOG_COORD_ARRAY, 0, data );
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
retval = __glXGetArrayEnable( state, GL_TEXTURE_COORD_ARRAY, tex_unit, data );
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_SIZE:
|
||||
retval = __glXGetArraySize( state, GL_TEXTURE_COORD_ARRAY, tex_unit, data );
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_TYPE:
|
||||
retval = __glXGetArrayType( state, GL_TEXTURE_COORD_ARRAY, tex_unit, data );
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_STRIDE:
|
||||
retval = __glXGetArrayStride( state, GL_TEXTURE_COORD_ARRAY, tex_unit, data );
|
||||
break;
|
||||
|
||||
case GL_MAX_ELEMENTS_VERTICES:
|
||||
case GL_MAX_ELEMENTS_INDICES:
|
||||
retval = GL_TRUE;
|
||||
*data = ~0UL;
|
||||
break;
|
||||
|
||||
|
||||
case GL_PACK_ROW_LENGTH:
|
||||
*data = (GLintptr)state->storePack.rowLength;
|
||||
break;
|
||||
case GL_PACK_IMAGE_HEIGHT:
|
||||
*data = (GLintptr)state->storePack.imageHeight;
|
||||
break;
|
||||
case GL_PACK_SKIP_ROWS:
|
||||
*data = (GLintptr)state->storePack.skipRows;
|
||||
break;
|
||||
case GL_PACK_SKIP_PIXELS:
|
||||
*data = (GLintptr)state->storePack.skipPixels;
|
||||
break;
|
||||
case GL_PACK_SKIP_IMAGES:
|
||||
*data = (GLintptr)state->storePack.skipImages;
|
||||
break;
|
||||
case GL_PACK_ALIGNMENT:
|
||||
*data = (GLintptr)state->storePack.alignment;
|
||||
break;
|
||||
case GL_PACK_SWAP_BYTES:
|
||||
*data = (GLintptr)state->storePack.swapEndian;
|
||||
break;
|
||||
case GL_PACK_LSB_FIRST:
|
||||
*data = (GLintptr)state->storePack.lsbFirst;
|
||||
break;
|
||||
case GL_UNPACK_ROW_LENGTH:
|
||||
*data = (GLintptr)state->storeUnpack.rowLength;
|
||||
break;
|
||||
case GL_UNPACK_IMAGE_HEIGHT:
|
||||
*data = (GLintptr)state->storeUnpack.imageHeight;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_ROWS:
|
||||
*data = (GLintptr)state->storeUnpack.skipRows;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_PIXELS:
|
||||
*data = (GLintptr)state->storeUnpack.skipPixels;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_IMAGES:
|
||||
*data = (GLintptr)state->storeUnpack.skipImages;
|
||||
break;
|
||||
case GL_UNPACK_ALIGNMENT:
|
||||
*data = (GLintptr)state->storeUnpack.alignment;
|
||||
break;
|
||||
case GL_UNPACK_SWAP_BYTES:
|
||||
*data = (GLintptr)state->storeUnpack.swapEndian;
|
||||
break;
|
||||
case GL_UNPACK_LSB_FIRST:
|
||||
*data = (GLintptr)state->storeUnpack.lsbFirst;
|
||||
break;
|
||||
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
|
||||
*data = (GLintptr)__GL_CLIENT_ATTRIB_STACK_DEPTH;
|
||||
break;
|
||||
case GL_CLIENT_ACTIVE_TEXTURE:
|
||||
*data = (GLintptr)(tex_unit + GL_TEXTURE0);
|
||||
break;
|
||||
|
||||
default:
|
||||
retval = GL_FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
void __indirect_glGetBooleanv(GLenum val, GLboolean *b)
|
||||
{
|
||||
@@ -173,120 +317,28 @@ void __indirect_glGetBooleanv(GLenum val, GLboolean *b)
|
||||
** Error occured; don't modify user's buffer.
|
||||
*/
|
||||
} else {
|
||||
GLintptr data;
|
||||
|
||||
/*
|
||||
** For all the queries listed here, we use the locally stored
|
||||
** values rather than the one returned by the server. Note that
|
||||
** we still needed to send the request to the server in order to
|
||||
** We still needed to send the request to the server in order to
|
||||
** find out whether it was legal to make a query (it's illegal,
|
||||
** for example, to call a query between glBegin() and glEnd()).
|
||||
*/
|
||||
switch (val) {
|
||||
case GL_PACK_ROW_LENGTH:
|
||||
*b = (GLboolean)state->storePack.rowLength;
|
||||
break;
|
||||
case GL_PACK_IMAGE_HEIGHT:
|
||||
*b = (GLboolean)state->storePack.imageHeight;
|
||||
break;
|
||||
case GL_PACK_SKIP_ROWS:
|
||||
*b = (GLboolean)state->storePack.skipRows;
|
||||
break;
|
||||
case GL_PACK_SKIP_PIXELS:
|
||||
*b = (GLboolean)state->storePack.skipPixels;
|
||||
break;
|
||||
case GL_PACK_SKIP_IMAGES:
|
||||
*b = (GLboolean)state->storePack.skipImages;
|
||||
break;
|
||||
case GL_PACK_ALIGNMENT:
|
||||
*b = (GLboolean)state->storePack.alignment;
|
||||
break;
|
||||
case GL_PACK_SWAP_BYTES:
|
||||
*b = (GLboolean)state->storePack.swapEndian;
|
||||
break;
|
||||
case GL_PACK_LSB_FIRST:
|
||||
*b = (GLboolean)state->storePack.lsbFirst;
|
||||
break;
|
||||
case GL_UNPACK_ROW_LENGTH:
|
||||
*b = (GLboolean)state->storeUnpack.rowLength;
|
||||
break;
|
||||
case GL_UNPACK_IMAGE_HEIGHT:
|
||||
*b = (GLboolean)state->storeUnpack.imageHeight;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_ROWS:
|
||||
*b = (GLboolean)state->storeUnpack.skipRows;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_PIXELS:
|
||||
*b = (GLboolean)state->storeUnpack.skipPixels;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_IMAGES:
|
||||
*b = (GLboolean)state->storeUnpack.skipImages;
|
||||
break;
|
||||
case GL_UNPACK_ALIGNMENT:
|
||||
*b = (GLboolean)state->storeUnpack.alignment;
|
||||
break;
|
||||
case GL_UNPACK_SWAP_BYTES:
|
||||
*b = (GLboolean)state->storeUnpack.swapEndian;
|
||||
break;
|
||||
case GL_UNPACK_LSB_FIRST:
|
||||
*b = (GLboolean)state->storeUnpack.lsbFirst;
|
||||
break;
|
||||
|
||||
CASE_ARRAY_ALL(VERTEX, vertex, b, GLboolean);
|
||||
|
||||
CASE_ARRAY_ENABLE(NORMAL, normal, b, GLboolean);
|
||||
CASE_ARRAY_TYPE(NORMAL, normal, b, GLboolean);
|
||||
CASE_ARRAY_STRIDE(NORMAL, normal, b, GLboolean);
|
||||
|
||||
CASE_ARRAY_ALL(COLOR, color, b, GLboolean);
|
||||
|
||||
CASE_ARRAY_ENABLE(INDEX, index, b, GLboolean);
|
||||
CASE_ARRAY_TYPE(INDEX, index, b, GLboolean);
|
||||
CASE_ARRAY_STRIDE(INDEX, index, b, GLboolean);
|
||||
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
*b = (GLboolean)IS_TEXARRAY_ENABLED(state, state->vertArray.activeTexture);
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_SIZE:
|
||||
*b = (GLboolean)state->vertArray.texCoord[state->vertArray.activeTexture].size;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_TYPE:
|
||||
*b = (GLboolean)state->vertArray.texCoord[state->vertArray.activeTexture].type;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_STRIDE:
|
||||
*b = (GLboolean)state->vertArray.texCoord[state->vertArray.activeTexture].stride;
|
||||
break;
|
||||
|
||||
CASE_ARRAY_ENABLE(EDGE_FLAG, edgeFlag, b, GLboolean);
|
||||
CASE_ARRAY_STRIDE(EDGE_FLAG, edgeFlag, b, GLboolean);
|
||||
|
||||
CASE_ARRAY_ALL(SECONDARY_COLOR, secondaryColor, b, GLboolean);
|
||||
|
||||
CASE_ARRAY_ENABLE(FOG_COORD, fogCoord, b, GLboolean);
|
||||
CASE_ARRAY_TYPE(FOG_COORD, fogCoord, b, GLboolean);
|
||||
CASE_ARRAY_STRIDE(FOG_COORD, fogCoord, b, GLboolean);
|
||||
|
||||
case GL_MAX_ELEMENTS_VERTICES:
|
||||
*b = (GLboolean)state->vertArray.maxElementsVertices;
|
||||
break;
|
||||
case GL_MAX_ELEMENTS_INDICES:
|
||||
*b = (GLboolean)state->vertArray.maxElementsIndices;
|
||||
break;
|
||||
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
|
||||
*b = (GLboolean)__GL_CLIENT_ATTRIB_STACK_DEPTH;
|
||||
break;
|
||||
case GL_CLIENT_ACTIVE_TEXTURE_ARB:
|
||||
*b = (GLboolean)(state->vertArray.activeTexture + GL_TEXTURE0_ARB);
|
||||
break;
|
||||
default:
|
||||
if ( get_client_data( state, val, & data ) ) {
|
||||
*b = (GLboolean) data;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
** Not a local value, so use what we got from the server.
|
||||
*/
|
||||
** Not a local value, so use what we got from the server.
|
||||
*/
|
||||
if (compsize == 1) {
|
||||
__GLX_SINGLE_GET_CHAR(b);
|
||||
} else {
|
||||
__GLX_SINGLE_GET_CHAR_ARRAY(b,compsize);
|
||||
if (val != origVal) {
|
||||
/* matrix transpose */
|
||||
TransposeMatrixb(b);
|
||||
if (val != origVal) {
|
||||
/* matrix transpose */
|
||||
TransposeMatrixb(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -314,110 +366,18 @@ void __indirect_glGetDoublev(GLenum val, GLdouble *d)
|
||||
** Error occured; don't modify user's buffer.
|
||||
*/
|
||||
} else {
|
||||
GLintptr data;
|
||||
|
||||
/*
|
||||
** For all the queries listed here, we use the locally stored
|
||||
** values rather than the one returned by the server. Note that
|
||||
** we still needed to send the request to the server in order to
|
||||
** We still needed to send the request to the server in order to
|
||||
** find out whether it was legal to make a query (it's illegal,
|
||||
** for example, to call a query between glBegin() and glEnd()).
|
||||
*/
|
||||
switch (val) {
|
||||
case GL_PACK_ROW_LENGTH:
|
||||
*d = (GLdouble)state->storePack.rowLength;
|
||||
break;
|
||||
case GL_PACK_IMAGE_HEIGHT:
|
||||
*d = (GLdouble)state->storePack.imageHeight;
|
||||
break;
|
||||
case GL_PACK_SKIP_ROWS:
|
||||
*d = (GLdouble)state->storePack.skipRows;
|
||||
break;
|
||||
case GL_PACK_SKIP_PIXELS:
|
||||
*d = (GLdouble)state->storePack.skipPixels;
|
||||
break;
|
||||
case GL_PACK_SKIP_IMAGES:
|
||||
*d = (GLdouble)state->storePack.skipImages;
|
||||
break;
|
||||
case GL_PACK_ALIGNMENT:
|
||||
*d = (GLdouble)state->storePack.alignment;
|
||||
break;
|
||||
case GL_PACK_SWAP_BYTES:
|
||||
*d = (GLdouble)state->storePack.swapEndian;
|
||||
break;
|
||||
case GL_PACK_LSB_FIRST:
|
||||
*d = (GLdouble)state->storePack.lsbFirst;
|
||||
break;
|
||||
case GL_UNPACK_ROW_LENGTH:
|
||||
*d = (GLdouble)state->storeUnpack.rowLength;
|
||||
break;
|
||||
case GL_UNPACK_IMAGE_HEIGHT:
|
||||
*d = (GLdouble)state->storeUnpack.imageHeight;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_ROWS:
|
||||
*d = (GLdouble)state->storeUnpack.skipRows;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_PIXELS:
|
||||
*d = (GLdouble)state->storeUnpack.skipPixels;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_IMAGES:
|
||||
*d = (GLdouble)state->storeUnpack.skipImages;
|
||||
break;
|
||||
case GL_UNPACK_ALIGNMENT:
|
||||
*d = (GLdouble)state->storeUnpack.alignment;
|
||||
break;
|
||||
case GL_UNPACK_SWAP_BYTES:
|
||||
*d = (GLdouble)state->storeUnpack.swapEndian;
|
||||
break;
|
||||
case GL_UNPACK_LSB_FIRST:
|
||||
*d = (GLdouble)state->storeUnpack.lsbFirst;
|
||||
break;
|
||||
|
||||
CASE_ARRAY_ALL(VERTEX, vertex, d, GLdouble);
|
||||
|
||||
CASE_ARRAY_ENABLE(NORMAL, normal, d, GLdouble);
|
||||
CASE_ARRAY_TYPE(NORMAL, normal, d, GLdouble);
|
||||
CASE_ARRAY_STRIDE(NORMAL, normal, d, GLdouble);
|
||||
|
||||
CASE_ARRAY_ALL(COLOR, color, d, GLdouble);
|
||||
|
||||
CASE_ARRAY_ENABLE(INDEX, index, d, GLdouble);
|
||||
CASE_ARRAY_TYPE(INDEX, index, d, GLdouble);
|
||||
CASE_ARRAY_STRIDE(INDEX, index, d, GLdouble);
|
||||
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
*d = (GLdouble) IS_TEXARRAY_ENABLED(state, state->vertArray.activeTexture);
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_SIZE:
|
||||
*d = (GLdouble)state->vertArray.texCoord[state->vertArray.activeTexture].size;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_TYPE:
|
||||
*d = (GLdouble)state->vertArray.texCoord[state->vertArray.activeTexture].type;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_STRIDE:
|
||||
*d = (GLdouble)state->vertArray.texCoord[state->vertArray.activeTexture].stride;
|
||||
break;
|
||||
|
||||
CASE_ARRAY_ENABLE(EDGE_FLAG, edgeFlag, d, GLdouble);
|
||||
CASE_ARRAY_STRIDE(EDGE_FLAG, edgeFlag, d, GLdouble);
|
||||
|
||||
CASE_ARRAY_ALL(SECONDARY_COLOR, secondaryColor, d, GLdouble);
|
||||
|
||||
CASE_ARRAY_ENABLE(FOG_COORD, fogCoord, d, GLdouble);
|
||||
CASE_ARRAY_TYPE(FOG_COORD, fogCoord, d, GLdouble);
|
||||
CASE_ARRAY_STRIDE(FOG_COORD, fogCoord, d, GLdouble);
|
||||
|
||||
case GL_MAX_ELEMENTS_VERTICES:
|
||||
*d = (GLdouble)state->vertArray.maxElementsVertices;
|
||||
break;
|
||||
case GL_MAX_ELEMENTS_INDICES:
|
||||
*d = (GLdouble)state->vertArray.maxElementsIndices;
|
||||
break;
|
||||
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
|
||||
*d = (GLdouble)__GL_CLIENT_ATTRIB_STACK_DEPTH;
|
||||
break;
|
||||
case GL_CLIENT_ACTIVE_TEXTURE_ARB:
|
||||
*d = (GLdouble)(state->vertArray.activeTexture + GL_TEXTURE0_ARB);
|
||||
break;
|
||||
default:
|
||||
if ( get_client_data( state, val, & data ) ) {
|
||||
*d = (GLdouble) data;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
** Not a local value, so use what we got from the server.
|
||||
*/
|
||||
@@ -425,10 +385,10 @@ void __indirect_glGetDoublev(GLenum val, GLdouble *d)
|
||||
__GLX_SINGLE_GET_DOUBLE(d);
|
||||
} else {
|
||||
__GLX_SINGLE_GET_DOUBLE_ARRAY(d,compsize);
|
||||
if (val != origVal) {
|
||||
/* matrix transpose */
|
||||
TransposeMatrixd(d);
|
||||
}
|
||||
if (val != origVal) {
|
||||
/* matrix transpose */
|
||||
TransposeMatrixd(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -455,120 +415,28 @@ void __indirect_glGetFloatv(GLenum val, GLfloat *f)
|
||||
** Error occured; don't modify user's buffer.
|
||||
*/
|
||||
} else {
|
||||
GLintptr data;
|
||||
|
||||
/*
|
||||
** For all the queries listed here, we use the locally stored
|
||||
** values rather than the one returned by the server. Note that
|
||||
** we still needed to send the request to the server in order to
|
||||
** We still needed to send the request to the server in order to
|
||||
** find out whether it was legal to make a query (it's illegal,
|
||||
** for example, to call a query between glBegin() and glEnd()).
|
||||
*/
|
||||
switch (val) {
|
||||
case GL_PACK_ROW_LENGTH:
|
||||
*f = (GLfloat)state->storePack.rowLength;
|
||||
break;
|
||||
case GL_PACK_IMAGE_HEIGHT:
|
||||
*f = (GLfloat)state->storePack.imageHeight;
|
||||
break;
|
||||
case GL_PACK_SKIP_ROWS:
|
||||
*f = (GLfloat)state->storePack.skipRows;
|
||||
break;
|
||||
case GL_PACK_SKIP_PIXELS:
|
||||
*f = (GLfloat)state->storePack.skipPixels;
|
||||
break;
|
||||
case GL_PACK_SKIP_IMAGES:
|
||||
*f = (GLfloat)state->storePack.skipImages;
|
||||
break;
|
||||
case GL_PACK_ALIGNMENT:
|
||||
*f = (GLfloat)state->storePack.alignment;
|
||||
break;
|
||||
case GL_PACK_SWAP_BYTES:
|
||||
*f = (GLfloat)state->storePack.swapEndian;
|
||||
break;
|
||||
case GL_PACK_LSB_FIRST:
|
||||
*f = (GLfloat)state->storePack.lsbFirst;
|
||||
break;
|
||||
case GL_UNPACK_ROW_LENGTH:
|
||||
*f = (GLfloat)state->storeUnpack.rowLength;
|
||||
break;
|
||||
case GL_UNPACK_IMAGE_HEIGHT:
|
||||
*f = (GLfloat)state->storeUnpack.imageHeight;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_ROWS:
|
||||
*f = (GLfloat)state->storeUnpack.skipRows;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_PIXELS:
|
||||
*f = (GLfloat)state->storeUnpack.skipPixels;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_IMAGES:
|
||||
*f = (GLfloat)state->storeUnpack.skipImages;
|
||||
break;
|
||||
case GL_UNPACK_ALIGNMENT:
|
||||
*f = (GLfloat)state->storeUnpack.alignment;
|
||||
break;
|
||||
case GL_UNPACK_SWAP_BYTES:
|
||||
*f = (GLfloat)state->storeUnpack.swapEndian;
|
||||
break;
|
||||
case GL_UNPACK_LSB_FIRST:
|
||||
*f = (GLfloat)state->storeUnpack.lsbFirst;
|
||||
break;
|
||||
|
||||
CASE_ARRAY_ALL(VERTEX, vertex, f, GLfloat);
|
||||
|
||||
CASE_ARRAY_ENABLE(NORMAL, normal, f, GLfloat);
|
||||
CASE_ARRAY_TYPE(NORMAL, normal, f, GLfloat);
|
||||
CASE_ARRAY_STRIDE(NORMAL, normal, f, GLfloat);
|
||||
|
||||
CASE_ARRAY_ALL(COLOR, color, f, GLfloat);
|
||||
|
||||
CASE_ARRAY_ENABLE(INDEX, index, f, GLfloat);
|
||||
CASE_ARRAY_TYPE(INDEX, index, f, GLfloat);
|
||||
CASE_ARRAY_STRIDE(INDEX, index, f, GLfloat);
|
||||
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
*f = (GLfloat) IS_TEXARRAY_ENABLED(state, state->vertArray.activeTexture);
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_SIZE:
|
||||
*f = (GLfloat)state->vertArray.texCoord[state->vertArray.activeTexture].size;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_TYPE:
|
||||
*f = (GLfloat)state->vertArray.texCoord[state->vertArray.activeTexture].type;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_STRIDE:
|
||||
*f = (GLfloat)state->vertArray.texCoord[state->vertArray.activeTexture].stride;
|
||||
break;
|
||||
|
||||
CASE_ARRAY_ENABLE(EDGE_FLAG, edgeFlag, f, GLfloat);
|
||||
CASE_ARRAY_STRIDE(EDGE_FLAG, edgeFlag, f, GLfloat);
|
||||
|
||||
CASE_ARRAY_ALL(SECONDARY_COLOR, secondaryColor, f, GLfloat);
|
||||
|
||||
CASE_ARRAY_ENABLE(FOG_COORD, fogCoord, f, GLfloat);
|
||||
CASE_ARRAY_TYPE(FOG_COORD, fogCoord, f, GLfloat);
|
||||
CASE_ARRAY_STRIDE(FOG_COORD, fogCoord, f, GLfloat);
|
||||
|
||||
case GL_MAX_ELEMENTS_VERTICES:
|
||||
*f = (GLfloat)state->vertArray.maxElementsVertices;
|
||||
break;
|
||||
case GL_MAX_ELEMENTS_INDICES:
|
||||
*f = (GLfloat)state->vertArray.maxElementsIndices;
|
||||
break;
|
||||
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
|
||||
*f = (GLfloat)__GL_CLIENT_ATTRIB_STACK_DEPTH;
|
||||
break;
|
||||
case GL_CLIENT_ACTIVE_TEXTURE_ARB:
|
||||
*f = (GLfloat)(state->vertArray.activeTexture + GL_TEXTURE0_ARB);
|
||||
break;
|
||||
default:
|
||||
if ( get_client_data( state, val, & data ) ) {
|
||||
*f = (GLfloat) data;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
** Not a local value, so use what we got from the server.
|
||||
*/
|
||||
** Not a local value, so use what we got from the server.
|
||||
*/
|
||||
if (compsize == 1) {
|
||||
__GLX_SINGLE_GET_FLOAT(f);
|
||||
} else {
|
||||
__GLX_SINGLE_GET_FLOAT_ARRAY(f,compsize);
|
||||
if (val != origVal) {
|
||||
/* matrix transpose */
|
||||
TransposeMatrixf(f);
|
||||
if (val != origVal) {
|
||||
/* matrix transpose */
|
||||
TransposeMatrixf(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -596,120 +464,28 @@ void __indirect_glGetIntegerv(GLenum val, GLint *i)
|
||||
** Error occured; don't modify user's buffer.
|
||||
*/
|
||||
} else {
|
||||
GLintptr data;
|
||||
|
||||
/*
|
||||
** For all the queries listed here, we use the locally stored
|
||||
** values rather than the one returned by the server. Note that
|
||||
** we still needed to send the request to the server in order to
|
||||
** We still needed to send the request to the server in order to
|
||||
** find out whether it was legal to make a query (it's illegal,
|
||||
** for example, to call a query between glBegin() and glEnd()).
|
||||
*/
|
||||
switch (val) {
|
||||
case GL_PACK_ROW_LENGTH:
|
||||
*i = (GLint)state->storePack.rowLength;
|
||||
break;
|
||||
case GL_PACK_IMAGE_HEIGHT:
|
||||
*i = (GLint)state->storePack.imageHeight;
|
||||
break;
|
||||
case GL_PACK_SKIP_ROWS:
|
||||
*i = (GLint)state->storePack.skipRows;
|
||||
break;
|
||||
case GL_PACK_SKIP_PIXELS:
|
||||
*i = (GLint)state->storePack.skipPixels;
|
||||
break;
|
||||
case GL_PACK_SKIP_IMAGES:
|
||||
*i = (GLint)state->storePack.skipImages;
|
||||
break;
|
||||
case GL_PACK_ALIGNMENT:
|
||||
*i = (GLint)state->storePack.alignment;
|
||||
break;
|
||||
case GL_PACK_SWAP_BYTES:
|
||||
*i = (GLint)state->storePack.swapEndian;
|
||||
break;
|
||||
case GL_PACK_LSB_FIRST:
|
||||
*i = (GLint)state->storePack.lsbFirst;
|
||||
break;
|
||||
case GL_UNPACK_ROW_LENGTH:
|
||||
*i = (GLint)state->storeUnpack.rowLength;
|
||||
break;
|
||||
case GL_UNPACK_IMAGE_HEIGHT:
|
||||
*i = (GLint)state->storeUnpack.imageHeight;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_ROWS:
|
||||
*i = (GLint)state->storeUnpack.skipRows;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_PIXELS:
|
||||
*i = (GLint)state->storeUnpack.skipPixels;
|
||||
break;
|
||||
case GL_UNPACK_SKIP_IMAGES:
|
||||
*i = (GLint)state->storeUnpack.skipImages;
|
||||
break;
|
||||
case GL_UNPACK_ALIGNMENT:
|
||||
*i = (GLint)state->storeUnpack.alignment;
|
||||
break;
|
||||
case GL_UNPACK_SWAP_BYTES:
|
||||
*i = (GLint)state->storeUnpack.swapEndian;
|
||||
break;
|
||||
case GL_UNPACK_LSB_FIRST:
|
||||
*i = (GLint)state->storeUnpack.lsbFirst;
|
||||
break;
|
||||
|
||||
CASE_ARRAY_ALL(VERTEX, vertex, i, GLint);
|
||||
|
||||
CASE_ARRAY_ENABLE(NORMAL, normal, i, GLint);
|
||||
CASE_ARRAY_TYPE(NORMAL, normal, i, GLint);
|
||||
CASE_ARRAY_STRIDE(NORMAL, normal, i, GLint);
|
||||
|
||||
CASE_ARRAY_ALL(COLOR, color, i, GLint);
|
||||
|
||||
CASE_ARRAY_ENABLE(INDEX, index, i, GLint);
|
||||
CASE_ARRAY_TYPE(INDEX, index, i, GLint);
|
||||
CASE_ARRAY_STRIDE(INDEX, index, i, GLint);
|
||||
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
*i = (GLint) IS_TEXARRAY_ENABLED(state, state->vertArray.activeTexture);
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_SIZE:
|
||||
*i = (GLint)state->vertArray.texCoord[state->vertArray.activeTexture].size;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_TYPE:
|
||||
*i = (GLint)state->vertArray.texCoord[state->vertArray.activeTexture].type;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY_STRIDE:
|
||||
*i = (GLint)state->vertArray.texCoord[state->vertArray.activeTexture].stride;
|
||||
break;
|
||||
|
||||
CASE_ARRAY_ENABLE(EDGE_FLAG, edgeFlag, i, GLint);
|
||||
CASE_ARRAY_STRIDE(EDGE_FLAG, edgeFlag, i, GLint);
|
||||
|
||||
CASE_ARRAY_ALL(SECONDARY_COLOR, secondaryColor, i, GLint);
|
||||
|
||||
CASE_ARRAY_ENABLE(FOG_COORD, fogCoord, i, GLint);
|
||||
CASE_ARRAY_TYPE(FOG_COORD, fogCoord, i, GLint);
|
||||
CASE_ARRAY_STRIDE(FOG_COORD, fogCoord, i, GLint);
|
||||
|
||||
case GL_MAX_ELEMENTS_VERTICES:
|
||||
*i = (GLint)state->vertArray.maxElementsVertices;
|
||||
break;
|
||||
case GL_MAX_ELEMENTS_INDICES:
|
||||
*i = (GLint)state->vertArray.maxElementsIndices;
|
||||
break;
|
||||
case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH:
|
||||
*i = (GLint)__GL_CLIENT_ATTRIB_STACK_DEPTH;
|
||||
break;
|
||||
case GL_CLIENT_ACTIVE_TEXTURE_ARB:
|
||||
*i = (GLint)(state->vertArray.activeTexture + GL_TEXTURE0_ARB);
|
||||
break;
|
||||
default:
|
||||
if ( get_client_data( state, val, & data ) ) {
|
||||
*i = (GLint) data;
|
||||
}
|
||||
else {
|
||||
/*
|
||||
** Not a local value, so use what we got from the server.
|
||||
*/
|
||||
** Not a local value, so use what we got from the server.
|
||||
*/
|
||||
if (compsize == 1) {
|
||||
__GLX_SINGLE_GET_LONG(i);
|
||||
} else {
|
||||
__GLX_SINGLE_GET_LONG_ARRAY(i,compsize);
|
||||
if (val != origVal) {
|
||||
/* matrix transpose */
|
||||
TransposeMatrixi(i);
|
||||
if (val != origVal) {
|
||||
/* matrix transpose */
|
||||
TransposeMatrixi(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -981,26 +757,28 @@ GLboolean __indirect_glIsEnabled(GLenum cap)
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
xGLXSingleReply reply;
|
||||
GLboolean retval = 0;
|
||||
GLintptr enable;
|
||||
|
||||
if (!dpy) return 0;
|
||||
|
||||
switch(cap) {
|
||||
case GL_VERTEX_ARRAY:
|
||||
return IS_ARRAY_ENABLED(state, vertex);
|
||||
case GL_NORMAL_ARRAY:
|
||||
return IS_ARRAY_ENABLED(state, normal);
|
||||
case GL_COLOR_ARRAY:
|
||||
return IS_ARRAY_ENABLED(state, color);
|
||||
case GL_INDEX_ARRAY:
|
||||
return IS_ARRAY_ENABLED(state, index);
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
return IS_TEXARRAY_ENABLED(state, state->vertArray.activeTexture);
|
||||
case GL_EDGE_FLAG_ARRAY:
|
||||
return IS_ARRAY_ENABLED(state, edgeFlag);
|
||||
case GL_SECONDARY_COLOR_ARRAY:
|
||||
return IS_ARRAY_ENABLED(state, secondaryColor);
|
||||
case GL_FOG_COORD_ARRAY:
|
||||
return IS_ARRAY_ENABLED(state, fogCoord);
|
||||
case GL_VERTEX_ARRAY:
|
||||
case GL_NORMAL_ARRAY:
|
||||
case GL_COLOR_ARRAY:
|
||||
case GL_INDEX_ARRAY:
|
||||
case GL_EDGE_FLAG_ARRAY:
|
||||
case GL_SECONDARY_COLOR_ARRAY:
|
||||
case GL_FOG_COORD_ARRAY:
|
||||
retval = __glXGetArrayEnable( state, cap, 0, & enable );
|
||||
assert( retval );
|
||||
return (GLboolean) enable;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
retval = __glXGetArrayEnable( state, GL_TEXTURE_COORD_ARRAY,
|
||||
__glXGetActiveTextureUnit( state ), & enable );
|
||||
assert( retval );
|
||||
return (GLboolean) enable;
|
||||
break;
|
||||
}
|
||||
|
||||
__GLX_SINGLE_LOAD_VARIABLES();
|
||||
@@ -1021,37 +799,32 @@ void __indirect_glGetPointerv(GLenum pname, void **params)
|
||||
if (!dpy) return;
|
||||
|
||||
switch(pname) {
|
||||
case GL_VERTEX_ARRAY_POINTER:
|
||||
*params = (void *)state->vertArray.arrays[ vertex_ARRAY ].ptr;
|
||||
return;
|
||||
case GL_NORMAL_ARRAY_POINTER:
|
||||
*params = (void *)state->vertArray.arrays[ normal_ARRAY ].ptr;
|
||||
return;
|
||||
case GL_COLOR_ARRAY_POINTER:
|
||||
*params = (void *)state->vertArray.arrays[ color_ARRAY ].ptr;
|
||||
return;
|
||||
case GL_INDEX_ARRAY_POINTER:
|
||||
*params = (void *)state->vertArray.arrays[ index_ARRAY ].ptr;
|
||||
return;
|
||||
case GL_TEXTURE_COORD_ARRAY_POINTER:
|
||||
*params = (void *)state->vertArray.texCoord[state->vertArray.activeTexture].ptr;
|
||||
return;
|
||||
case GL_EDGE_FLAG_ARRAY_POINTER:
|
||||
*params = (void *)state->vertArray.arrays[ edgeFlag_ARRAY ].ptr;
|
||||
case GL_VERTEX_ARRAY_POINTER:
|
||||
case GL_NORMAL_ARRAY_POINTER:
|
||||
case GL_COLOR_ARRAY_POINTER:
|
||||
case GL_INDEX_ARRAY_POINTER:
|
||||
case GL_EDGE_FLAG_ARRAY_POINTER:
|
||||
__glXGetArrayPointer( state, pname - GL_VERTEX_ARRAY_POINTER
|
||||
+ GL_VERTEX_ARRAY,
|
||||
0, params );
|
||||
return;
|
||||
case GL_SECONDARY_COLOR_ARRAY_POINTER:
|
||||
*params = (void *)state->vertArray.arrays[ secondaryColor_ARRAY ].ptr;
|
||||
case GL_TEXTURE_COORD_ARRAY_POINTER:
|
||||
__glXGetArrayPointer( state, GL_TEXTURE_COORD_ARRAY,
|
||||
__glXGetActiveTextureUnit( state ), params );
|
||||
return;
|
||||
case GL_FOG_COORD_ARRAY_POINTER:
|
||||
*params = (void *)state->vertArray.arrays[ fogCoord_ARRAY ].ptr;
|
||||
case GL_SECONDARY_COLOR_ARRAY_POINTER:
|
||||
case GL_FOG_COORD_ARRAY_POINTER:
|
||||
__glXGetArrayPointer( state, pname - GL_FOG_COORD_ARRAY_POINTER
|
||||
+ GL_FOG_COORD_ARRAY,
|
||||
0, params );
|
||||
return;
|
||||
case GL_FEEDBACK_BUFFER_POINTER:
|
||||
case GL_FEEDBACK_BUFFER_POINTER:
|
||||
*params = (void *)gc->feedbackBuf;
|
||||
return;
|
||||
case GL_SELECTION_BUFFER_POINTER:
|
||||
case GL_SELECTION_BUFFER_POINTER:
|
||||
*params = (void *)gc->selectBuf;
|
||||
return;
|
||||
default:
|
||||
default:
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
@@ -36,222 +36,6 @@
|
||||
|
||||
#include "packsingle.h"
|
||||
|
||||
void __indirect_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, GLvoid *pixels)
|
||||
{
|
||||
__GLX_SINGLE_DECLARE_VARIABLES();
|
||||
const __GLXattribute * state;
|
||||
xGLXReadPixelsReply reply;
|
||||
GLubyte *buf;
|
||||
|
||||
if (!dpy) return;
|
||||
__GLX_SINGLE_LOAD_VARIABLES();
|
||||
state = gc->client_state_private;
|
||||
|
||||
/* Send request */
|
||||
__GLX_SINGLE_BEGIN(X_GLsop_ReadPixels,__GLX_PAD(26));
|
||||
__GLX_SINGLE_PUT_LONG(0,x);
|
||||
__GLX_SINGLE_PUT_LONG(4,y);
|
||||
__GLX_SINGLE_PUT_LONG(8,width);
|
||||
__GLX_SINGLE_PUT_LONG(12,height);
|
||||
__GLX_SINGLE_PUT_LONG(16,format);
|
||||
__GLX_SINGLE_PUT_LONG(20,type);
|
||||
__GLX_SINGLE_PUT_CHAR(24,state->storePack.swapEndian);
|
||||
__GLX_SINGLE_PUT_CHAR(25,GL_FALSE);
|
||||
__GLX_SINGLE_READ_XREPLY();
|
||||
compsize = reply.length << 2;
|
||||
|
||||
if (compsize != 0) {
|
||||
/* Allocate a holding buffer to transform the data from */
|
||||
buf = (GLubyte*) Xmalloc(compsize);
|
||||
if (!buf) {
|
||||
/* Throw data away */
|
||||
_XEatData(dpy, compsize);
|
||||
__glXSetError(gc, GL_OUT_OF_MEMORY);
|
||||
} else {
|
||||
/*
|
||||
** Fetch data into holding buffer. Apply pixel store pack modes
|
||||
** to put data back into client memory
|
||||
*/
|
||||
__GLX_SINGLE_GET_CHAR_ARRAY(buf,compsize);
|
||||
__glEmptyImage(gc, 2, width, height, 1, format, type, buf, pixels);
|
||||
Xfree((char*) buf);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
** GL error occurred; don't modify user's buffer.
|
||||
*/
|
||||
}
|
||||
__GLX_SINGLE_END();
|
||||
}
|
||||
|
||||
void __indirect_glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type,
|
||||
GLvoid *texels)
|
||||
{
|
||||
__GLX_SINGLE_DECLARE_VARIABLES();
|
||||
const __GLXattribute * state;
|
||||
xGLXGetTexImageReply reply;
|
||||
GLubyte *buf;
|
||||
|
||||
if (!dpy) return;
|
||||
__GLX_SINGLE_LOAD_VARIABLES();
|
||||
state = gc->client_state_private;
|
||||
|
||||
/* Send request */
|
||||
__GLX_SINGLE_BEGIN(X_GLsop_GetTexImage,__GLX_PAD(17));
|
||||
__GLX_SINGLE_PUT_LONG(0,target);
|
||||
__GLX_SINGLE_PUT_LONG(4,level);
|
||||
__GLX_SINGLE_PUT_LONG(8,format);
|
||||
__GLX_SINGLE_PUT_LONG(12,type);
|
||||
__GLX_SINGLE_PUT_CHAR(16,state->storePack.swapEndian);
|
||||
__GLX_SINGLE_READ_XREPLY();
|
||||
compsize = reply.length << 2;
|
||||
|
||||
if (compsize != 0) {
|
||||
/* Allocate a holding buffer to transform the data from */
|
||||
buf = (GLubyte*) Xmalloc(compsize);
|
||||
if (!buf) {
|
||||
/* Throw data away */
|
||||
_XEatData(dpy, compsize);
|
||||
__glXSetError(gc, GL_OUT_OF_MEMORY);
|
||||
} else {
|
||||
GLint width, height, depth;
|
||||
|
||||
/*
|
||||
** Fetch data into holding buffer. Apply pixel store pack modes
|
||||
** to put data back into client memory
|
||||
*/
|
||||
width = reply.width;
|
||||
height = reply.height;
|
||||
depth = reply.depth;
|
||||
__GLX_SINGLE_GET_CHAR_ARRAY(buf,compsize);
|
||||
__glEmptyImage(gc, 2, width, height, depth, format, type, buf,
|
||||
texels);
|
||||
Xfree((char*) buf);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
** GL error occured, don't modify user's buffer.
|
||||
*/
|
||||
}
|
||||
__GLX_SINGLE_END();
|
||||
}
|
||||
|
||||
void __indirect_glGetPolygonStipple(GLubyte *mask)
|
||||
{
|
||||
__GLX_SINGLE_DECLARE_VARIABLES();
|
||||
xGLXSingleReply reply;
|
||||
GLubyte buf[128];
|
||||
|
||||
if (!dpy) return;
|
||||
|
||||
__GLX_SINGLE_LOAD_VARIABLES();
|
||||
__GLX_SINGLE_BEGIN(X_GLsop_GetPolygonStipple,__GLX_PAD(1));
|
||||
__GLX_SINGLE_PUT_CHAR(0,GL_FALSE);
|
||||
__GLX_SINGLE_READ_XREPLY();
|
||||
if (reply.length == 32) {
|
||||
__GLX_SINGLE_GET_CHAR_ARRAY(buf,128);
|
||||
__glEmptyImage(gc, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, buf, mask);
|
||||
}
|
||||
__GLX_SINGLE_END();
|
||||
}
|
||||
|
||||
void __indirect_glGetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table)
|
||||
{
|
||||
__GLX_SINGLE_DECLARE_VARIABLES();
|
||||
const __GLXattribute * state;
|
||||
xGLXGetColorTableReply reply;
|
||||
GLubyte *buf;
|
||||
|
||||
if (!dpy) return;
|
||||
__GLX_SINGLE_LOAD_VARIABLES();
|
||||
state = gc->client_state_private;
|
||||
|
||||
/* Send request */
|
||||
__GLX_SINGLE_BEGIN(X_GLsop_GetColorTable,__GLX_PAD(13));
|
||||
__GLX_SINGLE_PUT_LONG(0,(long)target);
|
||||
__GLX_SINGLE_PUT_LONG(4,(long)format);
|
||||
__GLX_SINGLE_PUT_LONG(8,(long)type);
|
||||
__GLX_SINGLE_PUT_CHAR(12,state->storePack.swapEndian);
|
||||
__GLX_SINGLE_READ_XREPLY();
|
||||
compsize = (long)reply.length << 2;
|
||||
|
||||
if (compsize != 0) {
|
||||
/* Allocate a holding buffer to transform the data from */
|
||||
buf = (GLubyte*)Xmalloc(compsize);
|
||||
if (!buf) {
|
||||
/* Throw data away */
|
||||
_XEatData(dpy, compsize);
|
||||
__glXSetError(gc, GL_OUT_OF_MEMORY);
|
||||
} else {
|
||||
GLint width;
|
||||
|
||||
/*
|
||||
** Fetch data into holding buffer. Apply pixel store pack modes
|
||||
** to put data back into client memory
|
||||
*/
|
||||
width = (int)reply.width;
|
||||
__GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize);
|
||||
__glEmptyImage(gc, 1, width, 1, 1, format, type, buf, table);
|
||||
Xfree((char*) buf);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
** GL error occured, don't modify user's buffer.
|
||||
*/
|
||||
}
|
||||
__GLX_SINGLE_END();
|
||||
}
|
||||
|
||||
void __indirect_glGetConvolutionFilter(GLenum target, GLenum format, GLenum type,
|
||||
GLvoid *image)
|
||||
{
|
||||
__GLX_SINGLE_DECLARE_VARIABLES();
|
||||
const __GLXattribute * state;
|
||||
xGLXGetConvolutionFilterReply reply;
|
||||
GLubyte *buf;
|
||||
|
||||
if (!dpy) return;
|
||||
__GLX_SINGLE_LOAD_VARIABLES();
|
||||
state = gc->client_state_private;
|
||||
|
||||
/* Send request */
|
||||
__GLX_SINGLE_BEGIN(X_GLsop_GetConvolutionFilter, __GLX_PAD(13));
|
||||
__GLX_SINGLE_PUT_LONG(0,target);
|
||||
__GLX_SINGLE_PUT_LONG(4,format);
|
||||
__GLX_SINGLE_PUT_LONG(8,type);
|
||||
__GLX_SINGLE_PUT_CHAR(12,state->storePack.swapEndian);
|
||||
__GLX_SINGLE_READ_XREPLY();
|
||||
compsize = reply.length << 2;
|
||||
|
||||
if (compsize != 0) {
|
||||
/* Allocate a holding buffer to transform the data from */
|
||||
buf = (GLubyte*) Xmalloc(compsize);
|
||||
if (!buf) {
|
||||
/* Throw data away */
|
||||
_XEatData(dpy, compsize);
|
||||
__glXSetError(gc, GL_OUT_OF_MEMORY);
|
||||
} else {
|
||||
GLint width, height;
|
||||
|
||||
/*
|
||||
** Fetch data into holding buffer. Apply pixel store pack modes
|
||||
** to put data back into client memory
|
||||
*/
|
||||
width = reply.width;
|
||||
height = reply.height;
|
||||
__GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),compsize);
|
||||
__glEmptyImage(gc, 2, width, height, 1, format, type, buf, image);
|
||||
Xfree((char*) buf);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
** GL error occured, don't modify user's buffer.
|
||||
*/
|
||||
}
|
||||
__GLX_SINGLE_END();
|
||||
}
|
||||
|
||||
void __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type,
|
||||
GLvoid *row, GLvoid *column, GLvoid *span)
|
||||
{
|
||||
@@ -318,98 +102,3 @@ void __indirect_glGetSeparableFilter(GLenum target, GLenum format, GLenum type,
|
||||
__GLX_SINGLE_END();
|
||||
|
||||
}
|
||||
|
||||
void __indirect_glGetHistogram(GLenum target, GLboolean reset, GLenum format,
|
||||
GLenum type, GLvoid *values)
|
||||
{
|
||||
__GLX_SINGLE_DECLARE_VARIABLES();
|
||||
const __GLXattribute * state;
|
||||
xGLXGetHistogramReply reply;
|
||||
GLubyte *buf;
|
||||
|
||||
if (!dpy) return;
|
||||
__GLX_SINGLE_LOAD_VARIABLES();
|
||||
state = gc->client_state_private;
|
||||
|
||||
/* Send request */
|
||||
__GLX_SINGLE_BEGIN(X_GLsop_GetHistogram,__GLX_PAD(14));
|
||||
__GLX_SINGLE_PUT_LONG(0,(long)target);
|
||||
__GLX_SINGLE_PUT_LONG(4,(long)format);
|
||||
__GLX_SINGLE_PUT_LONG(8,(long)type);
|
||||
__GLX_SINGLE_PUT_CHAR(12,state->storePack.swapEndian);
|
||||
__GLX_SINGLE_PUT_CHAR(13,reset);
|
||||
__GLX_SINGLE_READ_XREPLY();
|
||||
compsize = (long)reply.length << 2;
|
||||
|
||||
if (compsize != 0) {
|
||||
/* Allocate a holding buffer to transform the data from */
|
||||
buf = (GLubyte*)Xmalloc(compsize);
|
||||
if (!buf) {
|
||||
/* Throw data away */
|
||||
_XEatData(dpy, compsize);
|
||||
__glXSetError(gc, GL_OUT_OF_MEMORY);
|
||||
} else {
|
||||
GLint width;
|
||||
|
||||
/*
|
||||
** Fetch data into holding buffer. Apply pixel store pack modes
|
||||
** to put data back into client memory
|
||||
*/
|
||||
width = (int)reply.width;
|
||||
__GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize);
|
||||
__glEmptyImage(gc, 1, width, 1, 1, format, type, buf, values);
|
||||
Xfree((char*) buf);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
** GL error occured, don't modify user's buffer.
|
||||
*/
|
||||
}
|
||||
__GLX_SINGLE_END();
|
||||
}
|
||||
|
||||
void __indirect_glGetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type,
|
||||
GLvoid *values)
|
||||
{
|
||||
__GLX_SINGLE_DECLARE_VARIABLES();
|
||||
const __GLXattribute * state;
|
||||
xGLXGetMinmaxReply reply;
|
||||
GLubyte *buf;
|
||||
|
||||
if (!dpy) return;
|
||||
__GLX_SINGLE_LOAD_VARIABLES();
|
||||
state = gc->client_state_private;
|
||||
|
||||
/* Send request */
|
||||
__GLX_SINGLE_BEGIN(X_GLsop_GetMinmax,__GLX_PAD(14));
|
||||
__GLX_SINGLE_PUT_LONG(0,(long)target);
|
||||
__GLX_SINGLE_PUT_LONG(4,(long)format);
|
||||
__GLX_SINGLE_PUT_LONG(8,(long)type);
|
||||
__GLX_SINGLE_PUT_CHAR(12,state->storePack.swapEndian);
|
||||
__GLX_SINGLE_PUT_CHAR(13,reset);
|
||||
__GLX_SINGLE_READ_XREPLY();
|
||||
compsize = (long)reply.length << 2;
|
||||
|
||||
if (compsize != 0) {
|
||||
/* Allocate a holding buffer to transform the data from */
|
||||
buf = (GLubyte*)Xmalloc(compsize);
|
||||
if (!buf) {
|
||||
/* Throw data away */
|
||||
_XEatData(dpy, compsize);
|
||||
__glXSetError(gc, GL_OUT_OF_MEMORY);
|
||||
} else {
|
||||
/*
|
||||
** Fetch data into holding buffer. Apply pixel store pack modes
|
||||
** to put data back into client memory
|
||||
*/
|
||||
__GLX_SINGLE_GET_CHAR_ARRAY(((char*)buf),(long)compsize);
|
||||
__glEmptyImage(gc, 1, 2, 1, 1, format, type, buf, values);
|
||||
Xfree((char*) buf);
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
** GL error occured, don't modify user's buffer.
|
||||
*/
|
||||
}
|
||||
__GLX_SINGLE_END();
|
||||
}
|
||||
|
@@ -34,134 +34,10 @@
|
||||
**
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "glxclient.h"
|
||||
#include "packrender.h"
|
||||
#include "indirect.h"
|
||||
#include <string.h>
|
||||
#include <limits.h> /* INT_MAX */
|
||||
#include "indirect_vertex_array.h"
|
||||
|
||||
/* macros for setting function pointers */
|
||||
#define __GL_VERTEX_FUNC(NAME, let) \
|
||||
case GL_##NAME: \
|
||||
if (size == 2) \
|
||||
vertexPointer->proc = (void (*)(const void *))__indirect_glVertex2##let##v; \
|
||||
else if (size == 3) \
|
||||
vertexPointer->proc = (void (*)(const void *))__indirect_glVertex3##let##v; \
|
||||
else if (size == 4) \
|
||||
vertexPointer->proc = (void (*)(const void *))__indirect_glVertex4##let##v; \
|
||||
break
|
||||
|
||||
#define __GL_NORMAL_FUNC(NAME, let) \
|
||||
case GL_##NAME: \
|
||||
normalPointer->proc = (void (*)(const void *))__indirect_glNormal3##let##v; \
|
||||
break
|
||||
|
||||
#define __GL_COLOR_FUNC(NAME, let) \
|
||||
case GL_##NAME: \
|
||||
if (size == 3) \
|
||||
colorPointer->proc = (void (*)(const void *))__indirect_glColor3##let##v; \
|
||||
else if (size == 4)\
|
||||
colorPointer->proc = (void (*)(const void *))__indirect_glColor4##let##v; \
|
||||
break
|
||||
|
||||
#define __GL_SEC_COLOR_FUNC(NAME, let) \
|
||||
case GL_##NAME: \
|
||||
seccolorPointer->proc = (void (*)(const void *))__indirect_glSecondaryColor3##let##vEXT; \
|
||||
|
||||
#define __GL_FOG_FUNC(NAME, let) \
|
||||
case GL_##NAME: \
|
||||
fogPointer->proc = (void (*)(const void *))__indirect_glFogCoord##let##vEXT; \
|
||||
|
||||
#define __GL_INDEX_FUNC(NAME, let) \
|
||||
case GL_##NAME: \
|
||||
indexPointer->proc = (void (*)(const void *))__indirect_glIndex##let##v; \
|
||||
break
|
||||
|
||||
#define __GL_TEXTURE_FUNC(NAME, let) \
|
||||
case GL_##NAME: \
|
||||
if (size == 1) { \
|
||||
texCoordPointer->proc = (void (*)(const void *))__indirect_glTexCoord1##let##v; \
|
||||
texCoordPointer->mtex_proc = (void (*)(GLenum, const void *))__indirect_glMultiTexCoord1##let##vARB; \
|
||||
} else if (size == 2) { \
|
||||
texCoordPointer->proc = (void (*)(const void *))__indirect_glTexCoord2##let##v; \
|
||||
texCoordPointer->mtex_proc = (void (*)(GLenum, const void *))__indirect_glMultiTexCoord2##let##vARB; \
|
||||
} else if (size == 3) { \
|
||||
texCoordPointer->proc = (void (*)(const void *))__indirect_glTexCoord3##let##v; \
|
||||
texCoordPointer->mtex_proc = (void (*)(GLenum, const void *))__indirect_glMultiTexCoord2##let##vARB; \
|
||||
} else if (size == 4) { \
|
||||
texCoordPointer->proc = (void (*)(const void *))__indirect_glTexCoord4##let##v; \
|
||||
texCoordPointer->mtex_proc = (void (*)(GLenum, const void *))__indirect_glMultiTexCoord4##let##vARB; \
|
||||
} break
|
||||
|
||||
/**
|
||||
* Table of sizes, in bytes, of a GL types. All of the type enums are be in
|
||||
* the range 0x1400 - 0x140F. That includes types added by extensions (i.e.,
|
||||
* \c GL_HALF_FLOAT_NV). This elements of this table correspond to the
|
||||
* type enums masked with 0x0f.
|
||||
*
|
||||
* \notes
|
||||
* \c GL_HAVE_FLOAT_NV is not included. Neither are \c GL_2_BYTES,
|
||||
* \c GL_3_BYTES, or \c GL_4_BYTES.
|
||||
*/
|
||||
static const GLuint __glXTypeSize_table[16] = {
|
||||
1, 1, 2, 2, 4, 4, 4, 0, 0, 0, 8, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
#define __glXTypeSize(e) ((((e) & ~0x0f) != 0x1400) \
|
||||
? 0 : __glXTypeSize_table[ (e) & 0x0f ])
|
||||
|
||||
|
||||
/**
|
||||
* Initialize vertex array state for a GLX context.
|
||||
*
|
||||
* \param gc GLX context whose vertex array state is to be initialized.
|
||||
*
|
||||
* \todo
|
||||
* Someone is going to have to check the spec. This function takes greate
|
||||
* care to initialize the \c size and \c type fields to "correct" values
|
||||
* for each array. I'm not sure this is necessary. I think it should be
|
||||
* acceptable to just \c memset the whole \c arrays and \c texCoord arrays
|
||||
* to zero and be done with it. The spec may say something to the contrary,
|
||||
* however.
|
||||
*/
|
||||
void __glXInitVertexArrayState(__GLXcontext *gc)
|
||||
{
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
__GLXvertArrayState *va = &state->vertArray;
|
||||
GLint i;
|
||||
|
||||
va->enables = 0;
|
||||
va->texture_enables = 0;
|
||||
|
||||
for ( i = 0 ; i < __GLX_MAX_ARRAYS ; i++ ) {
|
||||
va->arrays[ i ].proc = NULL;
|
||||
va->arrays[ i ].skip = 0;
|
||||
va->arrays[ i ].ptr = 0;
|
||||
va->arrays[ i ].size = 1;
|
||||
va->arrays[ i ].type = GL_FLOAT;
|
||||
va->arrays[ i ].stride = 0;
|
||||
}
|
||||
|
||||
va->arrays[ edgeFlag_ARRAY ].type = GL_UNSIGNED_BYTE;;
|
||||
|
||||
va->arrays[ secondaryColor_ARRAY ].size = 3;
|
||||
va->arrays[ color_ARRAY ].size = 4;
|
||||
va->arrays[ normal_ARRAY ].size = 3;
|
||||
va->arrays[ vertex_ARRAY ].size = 4;
|
||||
|
||||
for ( i = 0 ; i < __GLX_MAX_TEXTURE_UNITS ; i++ ) {
|
||||
va->texCoord[ i ].proc = NULL;
|
||||
va->texCoord[ i ].skip = 0;
|
||||
va->texCoord[ i ].ptr = 0;
|
||||
va->texCoord[ i ].size = 4;
|
||||
va->texCoord[ i ].type = GL_FLOAT;
|
||||
va->texCoord[ i ].stride = 0;
|
||||
}
|
||||
|
||||
va->maxElementsVertices = INT_MAX;
|
||||
va->maxElementsIndices = INT_MAX;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -214,296 +90,6 @@ void __indirect_glVertexPointerEXT(GLint size, GLenum type, GLsizei stride,
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void __indirect_glVertexPointer(GLint size, GLenum type, GLsizei stride,
|
||||
const GLvoid *pointer)
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
__GLXvertexArrayPointerState *vertexPointer = &state->vertArray.arrays[ vertex_ARRAY ];
|
||||
|
||||
/* Check arguments */
|
||||
if (size < 2 || size > 4 || stride < 0) {
|
||||
__glXSetError(gc, GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Choose appropriate api proc */
|
||||
switch(type) {
|
||||
__GL_VERTEX_FUNC(SHORT, s);
|
||||
__GL_VERTEX_FUNC(INT, i);
|
||||
__GL_VERTEX_FUNC(FLOAT, f);
|
||||
__GL_VERTEX_FUNC(DOUBLE, d);
|
||||
default:
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
||||
vertexPointer->size = size;
|
||||
vertexPointer->type = type;
|
||||
vertexPointer->stride = stride;
|
||||
vertexPointer->ptr = pointer;
|
||||
|
||||
/* Set internal state */
|
||||
if (stride == 0) {
|
||||
vertexPointer->skip = __glXTypeSize(type) * size;
|
||||
} else {
|
||||
vertexPointer->skip = stride;
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
__GLXvertexArrayPointerState *normalPointer = &state->vertArray.arrays[ normal_ARRAY ];
|
||||
|
||||
/* Check arguments */
|
||||
if (stride < 0) {
|
||||
__glXSetError(gc, GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Choose appropriate api proc */
|
||||
switch(type) {
|
||||
__GL_NORMAL_FUNC(BYTE, b);
|
||||
__GL_NORMAL_FUNC(SHORT, s);
|
||||
__GL_NORMAL_FUNC(INT, i);
|
||||
__GL_NORMAL_FUNC(FLOAT, f);
|
||||
__GL_NORMAL_FUNC(DOUBLE, d);
|
||||
default:
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
||||
normalPointer->type = type;
|
||||
normalPointer->stride = stride;
|
||||
normalPointer->ptr = pointer;
|
||||
|
||||
/* Set internal state */
|
||||
if (stride == 0) {
|
||||
normalPointer->skip = 3 * __glXTypeSize(type);
|
||||
} else {
|
||||
normalPointer->skip = stride;
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glColorPointer(GLint size, GLenum type, GLsizei stride,
|
||||
const GLvoid *pointer)
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
__GLXvertexArrayPointerState *colorPointer = &state->vertArray.arrays[ color_ARRAY ];
|
||||
|
||||
/* Check arguments */
|
||||
if (stride < 0) {
|
||||
__glXSetError(gc, GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Choose appropriate api proc */
|
||||
switch(type) {
|
||||
__GL_COLOR_FUNC(BYTE, b);
|
||||
__GL_COLOR_FUNC(UNSIGNED_BYTE, ub);
|
||||
__GL_COLOR_FUNC(SHORT, s);
|
||||
__GL_COLOR_FUNC(UNSIGNED_SHORT, us);
|
||||
__GL_COLOR_FUNC(INT, i);
|
||||
__GL_COLOR_FUNC(UNSIGNED_INT, ui);
|
||||
__GL_COLOR_FUNC(FLOAT, f);
|
||||
__GL_COLOR_FUNC(DOUBLE, d);
|
||||
default:
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
||||
colorPointer->size = size;
|
||||
colorPointer->type = type;
|
||||
colorPointer->stride = stride;
|
||||
colorPointer->ptr = pointer;
|
||||
|
||||
/* Set internal state */
|
||||
if (stride == 0) {
|
||||
colorPointer->skip = size * __glXTypeSize(type);
|
||||
} else {
|
||||
colorPointer->skip = stride;
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glIndexPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
__GLXvertexArrayPointerState *indexPointer = &state->vertArray.arrays[ index_ARRAY ];
|
||||
|
||||
/* Check arguments */
|
||||
if (stride < 0) {
|
||||
__glXSetError(gc, GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Choose appropriate api proc */
|
||||
switch(type) {
|
||||
__GL_INDEX_FUNC(UNSIGNED_BYTE, ub);
|
||||
__GL_INDEX_FUNC(SHORT, s);
|
||||
__GL_INDEX_FUNC(INT, i);
|
||||
__GL_INDEX_FUNC(FLOAT, f);
|
||||
__GL_INDEX_FUNC(DOUBLE, d);
|
||||
default:
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
||||
indexPointer->type = type;
|
||||
indexPointer->stride = stride;
|
||||
indexPointer->ptr = pointer;
|
||||
|
||||
/* Set internal state */
|
||||
if (stride == 0) {
|
||||
indexPointer->skip = __glXTypeSize(type);
|
||||
} else {
|
||||
indexPointer->skip = stride;
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glTexCoordPointer(GLint size, GLenum type, GLsizei stride,
|
||||
const GLvoid *pointer)
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
__GLXvertexArrayPointerState *texCoordPointer =
|
||||
&state->vertArray.texCoord[state->vertArray.activeTexture];
|
||||
|
||||
/* Check arguments */
|
||||
if (size < 1 || size > 4 || stride < 0) {
|
||||
__glXSetError(gc, GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Choose appropriate api proc */
|
||||
switch(type) {
|
||||
__GL_TEXTURE_FUNC(SHORT, s);
|
||||
__GL_TEXTURE_FUNC(INT, i);
|
||||
__GL_TEXTURE_FUNC(FLOAT, f);
|
||||
__GL_TEXTURE_FUNC(DOUBLE, d);
|
||||
default:
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
||||
texCoordPointer->size = size;
|
||||
texCoordPointer->type = type;
|
||||
texCoordPointer->stride = stride;
|
||||
texCoordPointer->ptr = pointer;
|
||||
|
||||
/* Set internal state */
|
||||
if (stride == 0) {
|
||||
texCoordPointer->skip = __glXTypeSize(type) * size;
|
||||
} else {
|
||||
texCoordPointer->skip = stride;
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glEdgeFlagPointer(GLsizei stride, const GLvoid *pointer)
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
__GLXvertexArrayPointerState *edgeFlagPointer = &state->vertArray.arrays[ edgeFlag_ARRAY ];
|
||||
|
||||
/* Check arguments */
|
||||
if (stride < 0) {
|
||||
__glXSetError(gc, GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Choose appropriate api proc */
|
||||
edgeFlagPointer->proc = (void (*)(const void *))__indirect_glEdgeFlagv;
|
||||
|
||||
edgeFlagPointer->stride = stride;
|
||||
edgeFlagPointer->ptr = pointer;
|
||||
|
||||
/* Set internal state */
|
||||
if (stride == 0) {
|
||||
edgeFlagPointer->skip = sizeof(GLboolean);
|
||||
} else {
|
||||
edgeFlagPointer->skip = stride;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void __indirect_glSecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride,
|
||||
const GLvoid * pointer )
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
__GLXvertexArrayPointerState *seccolorPointer = &state->vertArray.arrays[ secondaryColor_ARRAY ];
|
||||
|
||||
/* Check arguments */
|
||||
if ( (stride < 0) || (size != 3) ) {
|
||||
__glXSetError(gc, GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Choose appropriate api proc */
|
||||
switch(type) {
|
||||
__GL_SEC_COLOR_FUNC(BYTE, b);
|
||||
__GL_SEC_COLOR_FUNC(UNSIGNED_BYTE, ub);
|
||||
__GL_SEC_COLOR_FUNC(SHORT, s);
|
||||
__GL_SEC_COLOR_FUNC(UNSIGNED_SHORT, us);
|
||||
__GL_SEC_COLOR_FUNC(INT, i);
|
||||
__GL_SEC_COLOR_FUNC(UNSIGNED_INT, ui);
|
||||
__GL_SEC_COLOR_FUNC(FLOAT, f);
|
||||
__GL_SEC_COLOR_FUNC(DOUBLE, d);
|
||||
default:
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
||||
seccolorPointer->size = size;
|
||||
seccolorPointer->type = type;
|
||||
seccolorPointer->stride = stride;
|
||||
seccolorPointer->ptr = pointer;
|
||||
|
||||
/* Set internal state */
|
||||
if (stride == 0) {
|
||||
seccolorPointer->skip = size * __glXTypeSize(type);
|
||||
} else {
|
||||
seccolorPointer->skip = stride;
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glFogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid * pointer)
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
__GLXvertexArrayPointerState *fogPointer = &state->vertArray.arrays[ fogCoord_ARRAY ];
|
||||
|
||||
/* Check arguments */
|
||||
if (stride < 0) {
|
||||
__glXSetError(gc, GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Choose appropriate api proc */
|
||||
switch(type) {
|
||||
__GL_FOG_FUNC(FLOAT, f);
|
||||
__GL_FOG_FUNC(DOUBLE, d);
|
||||
default:
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
||||
fogPointer->size = 1;
|
||||
fogPointer->type = type;
|
||||
fogPointer->stride = stride;
|
||||
fogPointer->ptr = pointer;
|
||||
|
||||
/* Set internal state */
|
||||
if (stride == 0) {
|
||||
fogPointer->skip = __glXTypeSize(type);
|
||||
} else {
|
||||
fogPointer->skip = stride;
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer)
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
@@ -642,8 +228,8 @@ void __indirect_glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid
|
||||
|
||||
trueStride = (stride == 0) ? size : stride;
|
||||
|
||||
state->vertArray.enables = 0;
|
||||
state->vertArray.texture_enables = 0;
|
||||
__glXArrayDisableAll( state );
|
||||
|
||||
if (tEnable) {
|
||||
__indirect_glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
__indirect_glTexCoordPointer(tSize, tType, trueStride, (const char *)pointer);
|
||||
@@ -659,543 +245,3 @@ void __indirect_glInterleavedArrays(GLenum format, GLsizei stride, const GLvoid
|
||||
__indirect_glEnableClientState(GL_VERTEX_ARRAY);
|
||||
__indirect_glVertexPointer(vSize, vType, trueStride, (const char *)pointer+vOffset);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void __indirect_glArrayElement(GLint i)
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
__GLXvertArrayState *va = &state->vertArray;
|
||||
GLint j;
|
||||
|
||||
|
||||
if (IS_TEXARRAY_ENABLED(state, 0)) {
|
||||
(*va->texCoord[0].proc)(va->texCoord[0].ptr+i*va->texCoord[0].skip);
|
||||
}
|
||||
|
||||
/* Multitexturing is handled specially because the protocol
|
||||
* requires an extra parameter.
|
||||
*/
|
||||
for (j=1; j<__GLX_MAX_TEXTURE_UNITS; ++j) {
|
||||
if (IS_TEXARRAY_ENABLED(state, j)) {
|
||||
(*va->texCoord[j].mtex_proc)(GL_TEXTURE0 + j, va->texCoord[j].ptr+i*va->texCoord[j].skip);
|
||||
}
|
||||
}
|
||||
|
||||
for ( j = 0 ; j < __GLX_MAX_ARRAYS ; j++ ) {
|
||||
if (IS_ARRAY_ENABLED_BY_INDEX(state, j)) {
|
||||
(*va->arrays[ j ].proc)(va->arrays[ j ].ptr+i*va->arrays[ j ].skip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct array_info {
|
||||
__GLXdispatchDrawArraysComponentHeader ai;
|
||||
GLsizei bytes;
|
||||
const GLubyte *ptr;
|
||||
GLsizei skip;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Initialize a \c array_info structure for each array that is enabled in
|
||||
* \c state. Determine how many arrays are enabled, and store the result
|
||||
* in \c num_arrays. Determine how big each vertex is, and store the result
|
||||
* in \c total_vertex_size.
|
||||
*
|
||||
* \returns The size of the final request. This is the size, in bytes, of
|
||||
* the DrawArrays header, the ARRAY_INFO structures, and all the vertex data.
|
||||
* This value \b assumes a \c X_GLXRender command is used. The true size
|
||||
* will be 4 bytes larger if a \c X_GLXRenderLarge command is used.
|
||||
*/
|
||||
static GLuint
|
||||
prep_arrays(const __GLXattribute * const state, struct array_info * arrays,
|
||||
GLint count,
|
||||
GLsizei *num_arrays, GLsizei *total_vertex_size)
|
||||
{
|
||||
GLsizei na = 0;
|
||||
GLsizei vs = 0;
|
||||
|
||||
#define ASSIGN_ARRAY_INFO(state, enum_name, arr) \
|
||||
do { \
|
||||
arrays[ na ].ai.datatype = state->vertArray. arr .type ; \
|
||||
arrays[ na ].ai.numVals = state->vertArray. arr .size ; \
|
||||
arrays[ na ].ai.component = GL_ ## enum_name ## _ARRAY; \
|
||||
\
|
||||
arrays[ na ].bytes = state->vertArray. arr .size \
|
||||
* __glXTypeSize( state->vertArray. arr .type ); \
|
||||
arrays[ na ].ptr = state->vertArray. arr .ptr; \
|
||||
arrays[ na ].skip = state->vertArray. arr .skip; \
|
||||
\
|
||||
vs += __GLX_PAD(arrays[ na ].bytes); \
|
||||
na++; \
|
||||
} while( 0 )
|
||||
|
||||
#define ADD_ARRAY_IF_ENABLED(state, enum_name, arr) \
|
||||
do { if ( IS_ARRAY_ENABLED(state, arr) ) { \
|
||||
ASSIGN_ARRAY_INFO(state, enum_name, arrays[ arr ## _ARRAY ] ); \
|
||||
} } while( 0 )
|
||||
|
||||
ADD_ARRAY_IF_ENABLED(state, VERTEX, vertex);
|
||||
ADD_ARRAY_IF_ENABLED(state, NORMAL, normal);
|
||||
ADD_ARRAY_IF_ENABLED(state, COLOR, color);
|
||||
ADD_ARRAY_IF_ENABLED(state, SECONDARY_COLOR, secondaryColor);
|
||||
ADD_ARRAY_IF_ENABLED(state, FOG_COORD, fogCoord);
|
||||
ADD_ARRAY_IF_ENABLED(state, EDGE_FLAG, edgeFlag);
|
||||
ADD_ARRAY_IF_ENABLED(state, INDEX, index);
|
||||
|
||||
/* The standard DrawArrays protocol *only* supports a single array of
|
||||
* texture coordinates.
|
||||
*/
|
||||
if ( IS_TEXARRAY_ENABLED(state, 0) ) {
|
||||
ASSIGN_ARRAY_INFO(state, TEXTURE_COORD, texCoord[0]);
|
||||
}
|
||||
|
||||
*num_arrays = na;
|
||||
*total_vertex_size = vs;
|
||||
|
||||
return __GLX_PAD((__GLX_COMPONENT_HDR_SIZE * na)
|
||||
+ (vs * count)
|
||||
+ __GLX_DRAWARRAYS_CMD_HDR_SIZE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Emits the vertex data for the DrawArrays GLX protocol.
|
||||
*/
|
||||
static GLsizei
|
||||
emit_vertex(GLubyte * data, const struct array_info * arrays,
|
||||
GLsizei num_arrays, GLint element, GLsizei offset)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
for ( i = 0 ; i < num_arrays ; i++ ) {
|
||||
(void) memcpy( data + offset,
|
||||
arrays[i].ptr + (arrays[i].skip * element),
|
||||
arrays[i].bytes );
|
||||
offset += __GLX_PAD(arrays[i].bytes);
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
emit_header(GLubyte * pc, const struct array_info * arrays,
|
||||
GLsizei num_arrays, GLsizei count, GLenum mode)
|
||||
{
|
||||
__GLXdispatchDrawArraysComponentHeader *arrayInfo;
|
||||
GLsizei i;
|
||||
|
||||
__GLX_PUT_LONG(0, count);
|
||||
__GLX_PUT_LONG(4, num_arrays);
|
||||
__GLX_PUT_LONG(8, mode);
|
||||
|
||||
arrayInfo = (__GLXdispatchDrawArraysComponentHeader *)
|
||||
(pc + __GLX_DRAWARRAYS_HDR_SIZE);
|
||||
|
||||
|
||||
/* Write the ARRAY_INFO data.
|
||||
*/
|
||||
|
||||
for ( i = 0 ; i < num_arrays ; i++ ) {
|
||||
arrayInfo[i] = arrays[i].ai;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Emit GLX DrawArrays protocol using a GLXRender packet.
|
||||
*/
|
||||
static void
|
||||
emit_Render_DrawArrays(__GLXcontext * gc, const struct array_info * arrays,
|
||||
GLsizei first, GLsizei count, GLsizei num_arrays, GLenum mode,
|
||||
GLsizei cmdlen, GLsizei total_vertex_size)
|
||||
{
|
||||
GLubyte * pc = gc->pc;
|
||||
GLsizei offset;
|
||||
GLsizei i;
|
||||
|
||||
__GLX_BEGIN_VARIABLE(X_GLrop_DrawArrays, cmdlen);
|
||||
emit_header(pc + 4, arrays, num_arrays, count, mode);
|
||||
|
||||
|
||||
/* Write the actual array data.
|
||||
*/
|
||||
|
||||
offset = __GLX_DRAWARRAYS_CMD_HDR_SIZE
|
||||
+ (num_arrays * __GLX_COMPONENT_HDR_SIZE);
|
||||
for ( i = 0 ; i < count ; i++ ) {
|
||||
offset = emit_vertex(pc, arrays, num_arrays, i + first, offset);
|
||||
}
|
||||
|
||||
__GLX_END(cmdlen);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Emit GLX DrawArrays protocol using a GLXRenderLarge packet.
|
||||
*/
|
||||
static void
|
||||
emit_RenderLarge_DrawArrays(__GLXcontext * gc, const struct array_info * arrays,
|
||||
GLsizei first, GLsizei count, GLsizei num_arrays, GLenum mode,
|
||||
GLsizei cmdlen, GLsizei total_vertex_size)
|
||||
{
|
||||
GLubyte * pc = gc->pc;
|
||||
GLsizei offset;
|
||||
GLsizei i;
|
||||
GLint maxSize;
|
||||
GLint totalRequests;
|
||||
GLint requestNumber;
|
||||
GLsizei elements_per_request;
|
||||
|
||||
|
||||
/* Calculate the maximum amount of data can be stuffed into a single
|
||||
* packet. sz_xGLXRenderReq is added because bufSize is the maximum
|
||||
* packet size minus sz_xGLXRenderReq.
|
||||
*
|
||||
* The important value here is elements_per_request. This is the number
|
||||
* of complete array elements that will fit in a single buffer. There
|
||||
* may be some wasted space at the end of the buffer, but splitting
|
||||
* elements across buffer boundries would be painful.
|
||||
*/
|
||||
|
||||
maxSize = (gc->bufSize + sz_xGLXRenderReq) - sz_xGLXRenderLargeReq;
|
||||
|
||||
elements_per_request = maxSize / total_vertex_size;
|
||||
|
||||
totalRequests = ((count + (elements_per_request - 1))
|
||||
/ elements_per_request) + 1;
|
||||
|
||||
|
||||
/* Fill in the header data and send it away.
|
||||
*/
|
||||
|
||||
__GLX_BEGIN_VARIABLE_LARGE(X_GLrop_DrawArrays, cmdlen+4);
|
||||
emit_header(pc + 8, arrays, num_arrays, count, mode);
|
||||
|
||||
gc->pc = pc + (__GLX_DRAWARRAYS_CMD_HDR_SIZE + 4)
|
||||
+ (__GLX_COMPONENT_HDR_SIZE * num_arrays);
|
||||
__glXSendLargeChunk(gc, 1, totalRequests, gc->buf, gc->pc - gc->buf);
|
||||
|
||||
|
||||
/* Write the actual array data.
|
||||
*/
|
||||
offset = 0;
|
||||
requestNumber = 2;
|
||||
for ( i = 0 ; i < count ; i++ ) {
|
||||
if ( i == elements_per_request ) {
|
||||
__glXSendLargeChunk(gc, requestNumber, totalRequests,
|
||||
gc->buf, offset);
|
||||
requestNumber++;
|
||||
offset = 0;
|
||||
|
||||
count -= i;
|
||||
first += i;
|
||||
i = 0;
|
||||
}
|
||||
|
||||
offset = emit_vertex(gc->buf, arrays, num_arrays, i + first, offset);
|
||||
}
|
||||
|
||||
/* If the buffer isn't empty, emit the last, partial request.
|
||||
*/
|
||||
if ( offset != 0 ) {
|
||||
assert(requestNumber == totalRequests);
|
||||
__glXSendLargeChunk(gc, requestNumber, totalRequests, gc->buf, offset);
|
||||
}
|
||||
|
||||
gc->pc = gc->buf;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Emit DrawArrays protocol. This function acts as a switch betteen
|
||||
* \c emit_Render_DrawArrays and \c emit_RenderLarge_DrawArrays depending
|
||||
* on how much array data is to be sent.
|
||||
*/
|
||||
static void
|
||||
emit_DrawArraysEXT(const __GLXattribute * const state,
|
||||
GLint first, GLsizei count, GLenum mode)
|
||||
{
|
||||
struct array_info arrays[32];
|
||||
GLsizei num_arrays;
|
||||
GLsizei total_vertex_size;
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
GLuint cmdlen;
|
||||
|
||||
|
||||
/* Determine how big the final request will be. This depends on a number
|
||||
* of factors. It depends on how many array elemets there are (which is
|
||||
* the passed-in 'count'), how many arrays are enabled, how many elements
|
||||
* are in each array entry, and what the types are for each array.
|
||||
*/
|
||||
|
||||
cmdlen = prep_arrays(state, arrays, count, & num_arrays,
|
||||
& total_vertex_size);
|
||||
|
||||
|
||||
/* If the data payload and the protocol header is too large for a Render
|
||||
* command, use a RenderLarge command.
|
||||
*/
|
||||
if (cmdlen > gc->maxSmallRenderCommandSize) {
|
||||
emit_RenderLarge_DrawArrays(gc, arrays, first, count, num_arrays,
|
||||
mode, cmdlen, total_vertex_size);
|
||||
}
|
||||
else {
|
||||
emit_Render_DrawArrays(gc, arrays, first, count, num_arrays,
|
||||
mode, cmdlen, total_vertex_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Emit a DrawArrays call using the old "protocol." This isn't really
|
||||
* DrawArrays protocol at all. It just simulates DrawArrays by using
|
||||
* immediate-mode vertex calls. Very, very slow for large arrays, but works
|
||||
* with every GLX server.
|
||||
*/
|
||||
static void
|
||||
emit_DrawArrays_old(const __GLXattribute * const state,
|
||||
GLint first, GLsizei count, GLenum mode)
|
||||
{
|
||||
const __GLXvertArrayState *va = &state->vertArray;
|
||||
const GLubyte *vaPtr[__GLX_MAX_ARRAYS];
|
||||
const GLubyte *tcaPtr[__GLX_MAX_TEXTURE_UNITS];
|
||||
GLint i, j;
|
||||
|
||||
/*
|
||||
** Set up pointers for quick array traversal.
|
||||
*/
|
||||
|
||||
(void) memset( vaPtr, 0, sizeof(vaPtr) );
|
||||
(void) memset( tcaPtr, 0, sizeof(tcaPtr) );
|
||||
|
||||
for ( j = 0 ; j < __GLX_MAX_ARRAYS ; j++ ) {
|
||||
if (IS_ARRAY_ENABLED_BY_INDEX(state, j)) {
|
||||
vaPtr[ j ] = va->arrays[ j ].ptr + first * va->arrays[ j ].skip;
|
||||
}
|
||||
}
|
||||
|
||||
for ( j = 0 ; j < __GLX_MAX_TEXTURE_UNITS ; j++ ) {
|
||||
if (IS_TEXARRAY_ENABLED(state, j))
|
||||
tcaPtr[ j ] = va->texCoord[ j ].ptr + first * va->texCoord[ j ].skip;
|
||||
}
|
||||
|
||||
__indirect_glBegin(mode);
|
||||
for (i = 0; i < count; i++) {
|
||||
if (IS_TEXARRAY_ENABLED(state, 0)) {
|
||||
(*va->texCoord[0].proc)(tcaPtr[0]);
|
||||
tcaPtr[0] += va->texCoord[0].skip;
|
||||
}
|
||||
|
||||
/* Multitexturing is handled specially because the protocol
|
||||
* requires an extra parameter.
|
||||
*/
|
||||
for (j=1; j<__GLX_MAX_TEXTURE_UNITS; ++j) {
|
||||
if (IS_TEXARRAY_ENABLED(state, j)) {
|
||||
(*va->texCoord[j].mtex_proc)(GL_TEXTURE0 + j, tcaPtr[j]);
|
||||
tcaPtr[j] += va->texCoord[j].skip;
|
||||
}
|
||||
}
|
||||
|
||||
for ( j = 0 ; j < __GLX_MAX_ARRAYS ; j++ ) {
|
||||
if (IS_ARRAY_ENABLED_BY_INDEX(state, j)) {
|
||||
(*va->arrays[ j ].proc)(vaPtr[ j ]);
|
||||
vaPtr[ j ] += va->arrays[ j ].skip;
|
||||
}
|
||||
}
|
||||
}
|
||||
__indirect_glEnd();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate that the \c mode and \c count parameters to \c glDrawArrays or
|
||||
* \c glDrawElements are valid. If the arguments are not valid, then an
|
||||
* error code is set in the GLX context.
|
||||
*
|
||||
* \returns \c GL_TRUE if the arguments are valide, \c GL_FALSE if they are
|
||||
* not.
|
||||
*/
|
||||
static GLboolean
|
||||
glx_validate_array_args(__GLXcontext *gc, GLenum mode, GLsizei count)
|
||||
{
|
||||
switch(mode) {
|
||||
case GL_POINTS:
|
||||
case GL_LINE_STRIP:
|
||||
case GL_LINE_LOOP:
|
||||
case GL_LINES:
|
||||
case GL_TRIANGLE_STRIP:
|
||||
case GL_TRIANGLE_FAN:
|
||||
case GL_TRIANGLES:
|
||||
case GL_QUAD_STRIP:
|
||||
case GL_QUADS:
|
||||
case GL_POLYGON:
|
||||
break;
|
||||
default:
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
if (count < 0) {
|
||||
__glXSetError(gc, GL_INVALID_VALUE);
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
void __indirect_glDrawArrays(GLenum mode, GLint first, GLsizei count)
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
const __GLXattribute * state =
|
||||
(const __GLXattribute *)(gc->client_state_private);
|
||||
|
||||
|
||||
if ( ! glx_validate_array_args(gc, mode, count) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* The "true" DrawArrays protocol does not support generic attributes,
|
||||
* multiple vertex arrays, or multiple texture coordinate arrays.
|
||||
*/
|
||||
if ( state->NoDrawArraysProtocol
|
||||
|| (state->vertArray.texture_enables > 1) ) {
|
||||
emit_DrawArrays_old(state, first, count, mode);
|
||||
}
|
||||
else {
|
||||
emit_DrawArraysEXT(state, first, count, mode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \todo Modify this to use the "true" DrawArrays protocol if possible. This
|
||||
* would probably require refactoring out parts of \c emit_DrawArraysEXT into
|
||||
* more general functions that could be used in either place.
|
||||
*/
|
||||
void __indirect_glDrawElements(GLenum mode, GLsizei count, GLenum type,
|
||||
const GLvoid *indices)
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
__GLXvertArrayState *va = &state->vertArray;
|
||||
const GLubyte *iPtr1 = NULL;
|
||||
const GLushort *iPtr2 = NULL;
|
||||
const GLuint *iPtr3 = NULL;
|
||||
GLint i, j, offset = 0;
|
||||
|
||||
if ( ! glx_validate_array_args(gc, mode, count) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
iPtr1 = (const GLubyte *)indices;
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
iPtr2 = (const GLushort *)indices;
|
||||
break;
|
||||
case GL_UNSIGNED_INT:
|
||||
iPtr3 = (const GLuint *)indices;
|
||||
break;
|
||||
default:
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
|
||||
__indirect_glBegin(mode);
|
||||
for (i = 0; i < count; i++) {
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
offset = (GLint)(*iPtr1++);
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
offset = (GLint)(*iPtr2++);
|
||||
break;
|
||||
case GL_UNSIGNED_INT:
|
||||
offset = (GLint)(*iPtr3++);
|
||||
break;
|
||||
}
|
||||
|
||||
if (IS_TEXARRAY_ENABLED(state, 0)) {
|
||||
(*va->texCoord[0].proc)(va->texCoord[0].ptr+
|
||||
(offset*va->texCoord[0].skip));
|
||||
}
|
||||
|
||||
/* Multitexturing is handled specially because the protocol
|
||||
* requires an extra parameter.
|
||||
*/
|
||||
for (j=1; j<__GLX_MAX_TEXTURE_UNITS; ++j) {
|
||||
if (IS_TEXARRAY_ENABLED(state, j)) {
|
||||
(*va->texCoord[j].mtex_proc)(GL_TEXTURE0 + j,
|
||||
va->texCoord[j].ptr+
|
||||
(offset*va->texCoord[j].skip));
|
||||
}
|
||||
}
|
||||
|
||||
for ( j = 0 ; j < __GLX_MAX_ARRAYS ; j++ ) {
|
||||
if (IS_ARRAY_ENABLED_BY_INDEX(state, j)) {
|
||||
(*va->arrays[ j ].proc)(va->arrays[ j ].ptr
|
||||
+(offset*va->arrays[ j ].skip));
|
||||
}
|
||||
}
|
||||
}
|
||||
__indirect_glEnd();
|
||||
}
|
||||
|
||||
void __indirect_glDrawRangeElements(GLenum mode, GLuint start, GLuint end,
|
||||
GLsizei count, GLenum type,
|
||||
const GLvoid *indices)
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
|
||||
if (end < start) {
|
||||
__glXSetError(gc, GL_INVALID_VALUE);
|
||||
return;
|
||||
}
|
||||
|
||||
__indirect_glDrawElements(mode,count,type,indices);
|
||||
}
|
||||
|
||||
void __indirect_glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count,
|
||||
GLsizei primcount)
|
||||
{
|
||||
GLsizei i;
|
||||
|
||||
for(i=0; i<primcount; i++) {
|
||||
if ( count[i] > 0 ) {
|
||||
__indirect_glDrawArrays( mode, first[i], count[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei *count,
|
||||
GLenum type, const GLvoid ** indices,
|
||||
GLsizei primcount)
|
||||
{
|
||||
GLsizei i;
|
||||
|
||||
for(i=0; i<primcount; i++) {
|
||||
if ( count[i] > 0 ) {
|
||||
__indirect_glDrawElements( mode, count[i], type, indices[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void __indirect_glClientActiveTextureARB(GLenum texture)
|
||||
{
|
||||
__GLXcontext *gc = __glXGetCurrentContext();
|
||||
__GLXattribute * state = (__GLXattribute *)(gc->client_state_private);
|
||||
GLint unit = (GLint) texture - GL_TEXTURE0;
|
||||
|
||||
if (unit < 0 || __GLX_MAX_TEXTURE_UNITS <= unit) {
|
||||
__glXSetError(gc, GL_INVALID_ENUM);
|
||||
return;
|
||||
}
|
||||
state->vertArray.activeTexture = unit;
|
||||
}
|
||||
|
@@ -148,7 +148,7 @@ subdirs:
|
||||
|
||||
# Make the GL library
|
||||
$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS)
|
||||
@ CC=$(CC) CXX=$(CXX) $(TOP)/bin/mklib -o $(GL_LIB) \
|
||||
@ CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(GL_LIB) \
|
||||
-major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \
|
||||
-install $(LIB_DIR) \
|
||||
$(MKLIB_OPTIONS) $(GL_LIB_DEPS) $(STAND_ALONE_OBJECTS)
|
||||
@@ -156,13 +156,13 @@ $(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS)
|
||||
# Make the OSMesa library
|
||||
$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECTS)
|
||||
@ if [ "${DRIVER_DIRS}" = "osmesa" ] ; then \
|
||||
CC=$(CC) CXX=$(CXX) $(TOP)/bin/mklib -o $(OSMESA_LIB) \
|
||||
CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(OSMESA_LIB) \
|
||||
-major $(MESA_MAJOR) \
|
||||
-minor $(MESA_MINOR) -patch $(MESA_TINY) \
|
||||
-install $(LIB_DIR) $(MKLIB_OPTIONS) \
|
||||
$(OSMESA_LIB_DEPS) $(OSMESA16_OBJECTS) ; \
|
||||
else \
|
||||
CC=$(CC) CXX=$(CXX) $(TOP)/bin/mklib -o $(OSMESA_LIB) \
|
||||
CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(OSMESA_LIB) \
|
||||
-major $(MESA_MAJOR) \
|
||||
-minor $(MESA_MINOR) -patch $(GL_TINY) \
|
||||
-install $(LIB_DIR) $(MKLIB_OPTIONS) \
|
||||
|
@@ -511,7 +511,7 @@ _ac_import_texcoord( GLcontext *ctx,
|
||||
/* Is the request impossible?
|
||||
*/
|
||||
if (reqsize != 0 && ac->Raw.TexCoord[unit].Size > (GLint) reqsize)
|
||||
return 0;
|
||||
return NULL;
|
||||
|
||||
/* Do we need to pull in a copy of the client data:
|
||||
*/
|
||||
@@ -548,7 +548,7 @@ _ac_import_vertex( GLcontext *ctx,
|
||||
/* Is the request impossible?
|
||||
*/
|
||||
if (reqsize != 0 && ac->Raw.Vertex.Size > (GLint) reqsize)
|
||||
return 0;
|
||||
return NULL;
|
||||
|
||||
/* Do we need to pull in a copy of the client data:
|
||||
*/
|
||||
@@ -616,7 +616,7 @@ _ac_import_color( GLcontext *ctx,
|
||||
/* Is the request impossible?
|
||||
*/
|
||||
if (reqsize != 0 && ac->Raw.Color.Size > (GLint) reqsize) {
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Do we need to pull in a copy of the client data:
|
||||
@@ -687,7 +687,7 @@ _ac_import_secondarycolor( GLcontext *ctx,
|
||||
/* Is the request impossible?
|
||||
*/
|
||||
if (reqsize != 0 && ac->Raw.SecondaryColor.Size > (GLint) reqsize)
|
||||
return 0;
|
||||
return NULL;
|
||||
|
||||
/* Do we need to pull in a copy of the client data:
|
||||
*/
|
||||
@@ -866,10 +866,10 @@ _ac_import_elements( GLcontext *ctx,
|
||||
switch (new_type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
ASSERT(0);
|
||||
return 0;
|
||||
return NULL;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
ASSERT(0);
|
||||
return 0;
|
||||
return NULL;
|
||||
case GL_UNSIGNED_INT: {
|
||||
GLuint *out = (GLuint *)ac->Elts;
|
||||
GLuint i;
|
||||
@@ -898,5 +898,5 @@ _ac_import_elements( GLcontext *ctx,
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 6.3
|
||||
*
|
||||
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 1999-2005 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"),
|
||||
@@ -33,7 +33,12 @@
|
||||
#include "teximage.h"
|
||||
#include "texobj.h"
|
||||
#include "texstore.h"
|
||||
#if FEATURE_ARB_vertex_buffer_object
|
||||
#include "bufferobj.h"
|
||||
#endif
|
||||
#if FEATURE_EXT_framebuffer_object
|
||||
#include "fbobject.h"
|
||||
#endif
|
||||
|
||||
#include "driverfuncs.h"
|
||||
#include "swrast/swrast.h"
|
||||
@@ -192,6 +197,11 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
|
||||
driver->UnmapBuffer = _mesa_buffer_unmap;
|
||||
#endif
|
||||
|
||||
#if FEATURE_EXT_framebuffer_object
|
||||
driver->NewFramebuffer = _mesa_new_framebuffer;
|
||||
driver->NewRenderbuffer = _mesa_new_renderbuffer;
|
||||
#endif
|
||||
|
||||
/* T&L stuff */
|
||||
driver->NeedValidate = GL_FALSE;
|
||||
driver->ValidateTnlModule = NULL;
|
||||
|
@@ -111,7 +111,7 @@ static void TAG(WriteDepthPixels)( GLcontext *ctx,
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
GLint i;
|
||||
GLuint i;
|
||||
LOCAL_DEPTH_VARS;
|
||||
|
||||
if ( DBG ) fprintf( stderr, "WriteDepthPixels\n" );
|
||||
@@ -178,7 +178,7 @@ static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n,
|
||||
{
|
||||
HW_READ_LOCK()
|
||||
{
|
||||
GLint i;
|
||||
GLuint i;
|
||||
LOCAL_DEPTH_VARS;
|
||||
|
||||
if ( DBG ) fprintf( stderr, "ReadDepthPixels\n" );
|
||||
|
@@ -1573,7 +1573,7 @@ __driUtilCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
|
||||
*
|
||||
* \sa __glXGetInternalVersion().
|
||||
*/
|
||||
int driCompareGLXAPIVersion( GLuint required_version )
|
||||
int driCompareGLXAPIVersion( GLint required_version )
|
||||
{
|
||||
if ( api_ver > required_version ) {
|
||||
return 1;
|
||||
|
@@ -561,7 +561,7 @@ __driUtilCreateScreen(Display *dpy, int scrn, __DRIscreen *psc,
|
||||
|
||||
/* Test the version of the internal GLX API. Returns a value like strcmp. */
|
||||
extern int
|
||||
driCompareGLXAPIVersion( GLuint required_version );
|
||||
driCompareGLXAPIVersion( GLint required_version );
|
||||
|
||||
extern float
|
||||
driCalculateSwapUsage( __DRIdrawablePrivate *dPriv,
|
||||
|
17
src/mesa/drivers/dri/common/memops.h
Normal file
17
src/mesa/drivers/dri/common/memops.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef DRIMEMSETIO_H
|
||||
#define DRIMEMSETIO_H
|
||||
/*
|
||||
* memset an area in I/O space
|
||||
* We need to be careful about this on some archs
|
||||
*/
|
||||
static __inline__ void drimemsetio(void* address, int c, int size)
|
||||
{
|
||||
#if defined(__powerpc__) || defined(__ia64__)
|
||||
int i;
|
||||
for(i=0;i<size;i++)
|
||||
*((char *)address + i)=c;
|
||||
#else
|
||||
memset(address,c,size);
|
||||
#endif
|
||||
}
|
||||
#endif
|
@@ -54,7 +54,7 @@ memHeap_t *mmInit(int ofs,
|
||||
PMemBlock blocks;
|
||||
|
||||
if (size <= 0) {
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
blocks = (TMemBlock *) calloc(1,sizeof(TMemBlock));
|
||||
if (blocks) {
|
||||
@@ -63,7 +63,7 @@ memHeap_t *mmInit(int ofs,
|
||||
blocks->free = 1;
|
||||
return (memHeap_t *)blocks;
|
||||
} else
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -30,8 +30,8 @@ struct mem_block_t {
|
||||
struct mem_block_t *heap;
|
||||
int ofs,size;
|
||||
int align;
|
||||
int free:1;
|
||||
int reserved:1;
|
||||
unsigned int free:1;
|
||||
unsigned int reserved:1;
|
||||
};
|
||||
typedef struct mem_block_t TMemBlock;
|
||||
typedef struct mem_block_t *PMemBlock;
|
||||
|
@@ -38,12 +38,11 @@
|
||||
static __inline__ u_int32_t
|
||||
read_MMIO_LE32( volatile void * base, unsigned long offset )
|
||||
{
|
||||
volatile void * p = ((volatile char *) base) + offset;
|
||||
u_int32_t val;
|
||||
|
||||
|
||||
__asm__ __volatile__( "lwbrx %0, %1, %2 ; eieio"
|
||||
: "=r" (val)
|
||||
: "b" (base), "r" (offset), "m" (p) );
|
||||
: "b" (base), "r" (offset) );
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@@ -145,7 +145,7 @@ static void TAG(WriteRGBAPixels)( const GLcontext *ctx,
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
GLint i;
|
||||
GLuint i;
|
||||
LOCAL_VARS;
|
||||
|
||||
if (DBG) fprintf(stderr, "WriteRGBAPixels\n");
|
||||
@@ -229,7 +229,7 @@ static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx,
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
GLint i;
|
||||
GLuint i;
|
||||
LOCAL_VARS;
|
||||
INIT_MONO_PIXEL(p, color);
|
||||
|
||||
@@ -293,7 +293,7 @@ static void TAG(ReadRGBAPixels)( const GLcontext *ctx,
|
||||
{
|
||||
HW_READ_LOCK()
|
||||
{
|
||||
GLint i;
|
||||
GLuint i;
|
||||
LOCAL_VARS;
|
||||
|
||||
if (DBG) fprintf(stderr, "ReadRGBAPixels\n");
|
||||
|
@@ -66,7 +66,7 @@ static void TAG(WriteStencilPixels)( GLcontext *ctx,
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
GLint i;
|
||||
GLuint i;
|
||||
LOCAL_STENCIL_VARS;
|
||||
|
||||
if (DBG) fprintf(stderr, "WriteStencilPixels\n");
|
||||
@@ -121,7 +121,7 @@ static void TAG(ReadStencilPixels)( GLcontext *ctx, GLuint n,
|
||||
{
|
||||
HW_READ_LOCK()
|
||||
{
|
||||
GLint i;
|
||||
GLuint i;
|
||||
LOCAL_STENCIL_VARS;
|
||||
|
||||
if (DBG) fprintf(stderr, "ReadStencilPixels\n");
|
||||
|
@@ -188,7 +188,7 @@ static void printLocalLRU( driTexHeap * heap, const char *callername )
|
||||
static void printGlobalLRU( driTexHeap * heap, const char *callername )
|
||||
{
|
||||
drmTextureRegionPtr list = heap->global_regions;
|
||||
int i, j;
|
||||
unsigned int i, j;
|
||||
|
||||
fprintf( stderr, "%s in %s:\nGlobal LRU, heap %d list %p:\n",
|
||||
__FUNCTION__, callername, heap->heapId, (void *)list );
|
||||
@@ -477,6 +477,8 @@ void driAgeTextures( driTexHeap * heap )
|
||||
|
||||
|
||||
|
||||
#define INDEX_ARRAY_SIZE 6 /* I'm not aware of driver with more than 2 heaps */
|
||||
|
||||
/**
|
||||
* Allocate memory from a texture heap to hold a texture object. This
|
||||
* routine will attempt to allocate memory for the texture from the heaps
|
||||
@@ -528,35 +530,91 @@ driAllocateTexture( driTexHeap * const * heap_array, unsigned nr_heaps,
|
||||
*/
|
||||
|
||||
if ( t->memBlock == NULL ) {
|
||||
for ( id = 0 ; (t->memBlock == NULL) && (id < nr_heaps) ; id++ ) {
|
||||
unsigned index[INDEX_ARRAY_SIZE];
|
||||
unsigned nrGoodHeaps = 0;
|
||||
|
||||
/* Trying to avoid dynamic memory allocation. If you have more
|
||||
* heaps, increase INDEX_ARRAY_SIZE. I'm not aware of any
|
||||
* drivers with more than 2 tex heaps. */
|
||||
assert( nr_heaps < INDEX_ARRAY_SIZE );
|
||||
|
||||
/* Sort large enough heaps by duty. Insertion sort should be
|
||||
* fast enough for such a short array. */
|
||||
for ( id = 0 ; id < nr_heaps ; id++ ) {
|
||||
heap = heap_array[ id ];
|
||||
if ( t->totalSize <= heap->size ) {
|
||||
|
||||
for ( cursor = heap->texture_objects.prev, temp = cursor->prev;
|
||||
cursor != &heap->texture_objects ;
|
||||
cursor = temp, temp = cursor->prev ) {
|
||||
|
||||
/* The the LRU element. If the texture is bound to one of
|
||||
* the texture units, then we cannot kick it out.
|
||||
*/
|
||||
if ( cursor->bound /* || cursor->reserved */ ) {
|
||||
continue;
|
||||
}
|
||||
if ( heap != NULL && t->totalSize <= heap->size ) {
|
||||
unsigned j;
|
||||
|
||||
/* If this is a placeholder, there's no need to keep it */
|
||||
if (cursor->tObj)
|
||||
driSwapOutTextureObject( cursor );
|
||||
else
|
||||
driDestroyTextureObject( cursor );
|
||||
|
||||
t->memBlock = mmAllocMem( heap->memory_heap, t->totalSize,
|
||||
heap->alignmentShift, 0 );
|
||||
|
||||
if (t->memBlock)
|
||||
for ( j = 0 ; j < nrGoodHeaps; j++ ) {
|
||||
if ( heap->duty > heap_array[ index[ j ] ]->duty )
|
||||
break;
|
||||
}
|
||||
} /* if ( t->totalSize <= heap->size ) ... */
|
||||
|
||||
if ( j < nrGoodHeaps ) {
|
||||
memmove( &index[ j+1 ], &index[ j ],
|
||||
sizeof(index[ 0 ]) * (nrGoodHeaps - j) );
|
||||
}
|
||||
|
||||
index[ j ] = id;
|
||||
|
||||
nrGoodHeaps++;
|
||||
}
|
||||
}
|
||||
|
||||
for ( id = 0 ; (t->memBlock == NULL) && (id < nrGoodHeaps) ; id++ ) {
|
||||
heap = heap_array[ index[ id ] ];
|
||||
|
||||
for ( cursor = heap->texture_objects.prev, temp = cursor->prev;
|
||||
cursor != &heap->texture_objects ;
|
||||
cursor = temp, temp = cursor->prev ) {
|
||||
|
||||
/* The the LRU element. If the texture is bound to one of
|
||||
* the texture units, then we cannot kick it out.
|
||||
*/
|
||||
if ( cursor->bound /* || cursor->reserved */ ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( cursor->memBlock )
|
||||
heap->duty -= cursor->memBlock->size;
|
||||
|
||||
/* If this is a placeholder, there's no need to keep it */
|
||||
if (cursor->tObj)
|
||||
driSwapOutTextureObject( cursor );
|
||||
else
|
||||
driDestroyTextureObject( cursor );
|
||||
|
||||
t->memBlock = mmAllocMem( heap->memory_heap, t->totalSize,
|
||||
heap->alignmentShift, 0 );
|
||||
|
||||
if (t->memBlock)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Rebalance duties. If a heap kicked more data than its duty,
|
||||
* then all other heaps get that amount multiplied with their
|
||||
* relative weight added to their duty. The negative duty is
|
||||
* reset to 0. In the end all heaps have a duty >= 0.
|
||||
*
|
||||
* CAUTION: we must not change the heap pointer here, because it
|
||||
* is used below to update the texture object.
|
||||
*/
|
||||
for ( id = 0 ; id < nr_heaps ; id++ )
|
||||
if ( heap_array[ id ] != NULL && heap_array[ id ]->duty < 0) {
|
||||
int duty = -heap_array[ id ]->duty;
|
||||
double weight = heap_array[ id ]->weight;
|
||||
unsigned j;
|
||||
|
||||
for ( j = 0 ; j < nr_heaps ; j++ )
|
||||
if ( j != id && heap_array[ j ] != NULL ) {
|
||||
heap_array[ j ]->duty += (double) duty *
|
||||
heap_array[ j ]->weight / weight;
|
||||
}
|
||||
|
||||
heap_array[ id ]->duty = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -675,6 +733,9 @@ driCreateTextureHeap( unsigned heap_id, void * context, unsigned size,
|
||||
|
||||
make_empty_list( & heap->texture_objects );
|
||||
driSetTextureSwapCounterLocation( heap, NULL );
|
||||
|
||||
heap->weight = heap->size;
|
||||
heap->duty = 0;
|
||||
}
|
||||
else {
|
||||
FREE( heap );
|
||||
|
@@ -216,6 +216,23 @@ struct dri_tex_heap {
|
||||
* framebuffer.
|
||||
*/
|
||||
unsigned timestamp;
|
||||
|
||||
/** \brief Kick/upload weight
|
||||
*
|
||||
* When not enough free space is available this weight
|
||||
* influences the choice of the heap from which textures are
|
||||
* kicked. By default the weight is equal to the heap size.
|
||||
*/
|
||||
double weight;
|
||||
|
||||
/** \brief Kick/upload duty
|
||||
*
|
||||
* The heap with the highest duty will be chosen for kicking
|
||||
* textures if not enough free space is available. The duty is
|
||||
* reduced by the amount of data kicked. Rebalancing of
|
||||
* negative duties takes the weights into account.
|
||||
*/
|
||||
int duty;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -293,6 +293,28 @@ DRI_CONF_OPT_BEGIN_V(texture_units,int,def, # min ":" # max ) \
|
||||
DRI_CONF_DESC(de,"Anzahl der Textureinheiten") \
|
||||
DRI_CONF_OPT_END
|
||||
|
||||
#define DRI_CONF_TEXTURE_LEVEL_HACK(def) \
|
||||
DRI_CONF_OPT_BEGIN(texture_level_hack,bool,def) \
|
||||
DRI_CONF_DESC(en,"Enable texture level hack for radeon/r200 for playing games with compressed textures") \
|
||||
DRI_CONF_OPT_END
|
||||
|
||||
#define DRI_CONF_TEXTURE_HEAPS_ALL 0
|
||||
#define DRI_CONF_TEXTURE_HEAPS_CARD 1
|
||||
#define DRI_CONF_TEXTURE_HEAPS_GART 2
|
||||
#define DRI_CONF_TEXTURE_HEAPS(def) \
|
||||
DRI_CONF_OPT_BEGIN_V(texture_heaps,enum,def,"0:2") \
|
||||
DRI_CONF_DESC_BEGIN(en,"Used types of texture memory") \
|
||||
DRI_CONF_ENUM(0,"All available") \
|
||||
DRI_CONF_ENUM(1,"Only card memory (if available)") \
|
||||
DRI_CONF_ENUM(2,"Only GART (AGP/PCIE) memory (if available)") \
|
||||
DRI_CONF_DESC_END \
|
||||
DRI_CONF_DESC_BEGIN(de,"Verwendete Texturspeicherarten") \
|
||||
DRI_CONF_ENUM(0,"Alle verfügbaren") \
|
||||
DRI_CONF_ENUM(1,"Nur Grafikspeicher (falls vorhanden)") \
|
||||
DRI_CONF_ENUM(2,"Nur GART (AGP/PCIE) Speicher (falls vorhanden)") \
|
||||
DRI_CONF_DESC_END \
|
||||
DRI_CONF_OPT_END
|
||||
|
||||
/* Options for features that are not done in hardware by the driver (like GL_ARB_vertex_program
|
||||
On cards where there is no documentation (r200) or on rasterization-only hardware). */
|
||||
#define DRI_CONF_SECTION_SOFTWARE \
|
||||
@@ -314,4 +336,5 @@ DRI_CONF_OPT_BEGIN(nv_vertex_program,bool,def) \
|
||||
DRI_CONF_DESC(fr,"Activer GL_NV_vertex_program") \
|
||||
DRI_CONF_OPT_END
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -285,7 +285,7 @@ typedef struct _drmSetVersion {
|
||||
#define DRM_LOCK_CONT 0x40000000 /**< Hardware lock is contended */
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 2)
|
||||
# if defined(__i386) || defined(__AMD64__)
|
||||
# if defined(__i386) || defined(__amd64__)
|
||||
/* Reflect changes here to drmP.h */
|
||||
#define DRM_CAS(lock,old,new,__ret) \
|
||||
do { \
|
||||
|
@@ -331,7 +331,7 @@ i810DestroyContext(__DRIcontextPrivate *driContextPriv)
|
||||
/* This share group is about to go away, free our private
|
||||
* texture object data.
|
||||
*/
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
for ( i = 0 ; i < imesa->nr_heaps ; i++ ) {
|
||||
driDestroyTextureHeap( imesa->texture_heaps[ i ] );
|
||||
|
@@ -55,7 +55,7 @@ static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
||||
__DRIdrawablePrivate *dPriv = imesa->driDrawable;
|
||||
const GLuint colorMask = *((GLuint *) &ctx->Color.ColorMask);
|
||||
drmI810Clear clear;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
clear.flags = 0;
|
||||
clear.clear_color = imesa->ClearColor;
|
||||
@@ -63,12 +63,12 @@ static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
||||
|
||||
I810_FIREVERTICES( imesa );
|
||||
|
||||
if ((mask & DD_FRONT_LEFT_BIT) && colorMask == ~0) {
|
||||
if ((mask & DD_FRONT_LEFT_BIT) && colorMask == ~0U) {
|
||||
clear.flags |= I810_FRONT;
|
||||
mask &= ~DD_FRONT_LEFT_BIT;
|
||||
}
|
||||
|
||||
if ((mask & DD_BACK_LEFT_BIT) && colorMask == ~0) {
|
||||
if ((mask & DD_BACK_LEFT_BIT) && colorMask == ~0U) {
|
||||
clear.flags |= I810_BACK;
|
||||
mask &= ~DD_BACK_LEFT_BIT;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
||||
|
||||
for (i = 0 ; i < imesa->numClipRects ; )
|
||||
{
|
||||
int nr = MIN2(i + I810_NR_SAREA_CLIPRECTS, imesa->numClipRects);
|
||||
unsigned int nr = MIN2(i + I810_NR_SAREA_CLIPRECTS, imesa->numClipRects);
|
||||
drm_clip_rect_t *box = imesa->pClipRects;
|
||||
drm_clip_rect_t *b = (drm_clip_rect_t *)imesa->sarea->boxes;
|
||||
int n = 0;
|
||||
|
@@ -75,7 +75,7 @@ do { \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
static void __inline__ i810_draw_triangle( i810ContextPtr imesa,
|
||||
static __inline__ void i810_draw_triangle( i810ContextPtr imesa,
|
||||
i810VertexPtr v0,
|
||||
i810VertexPtr v1,
|
||||
i810VertexPtr v2 )
|
||||
@@ -90,7 +90,7 @@ static void __inline__ i810_draw_triangle( i810ContextPtr imesa,
|
||||
}
|
||||
|
||||
|
||||
static void __inline__ i810_draw_quad( i810ContextPtr imesa,
|
||||
static __inline__ void i810_draw_quad( i810ContextPtr imesa,
|
||||
i810VertexPtr v0,
|
||||
i810VertexPtr v1,
|
||||
i810VertexPtr v2,
|
||||
|
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "driver.h"
|
||||
#include "drm.h"
|
||||
#include "memops.h"
|
||||
|
||||
#include "mga_reg.h"
|
||||
#include "mga.h"
|
||||
@@ -805,11 +806,11 @@ static int MGAScreenInit( struct DRIDriverContextRec *ctx, MGAPtr pMga )
|
||||
* the clear ioctl to do this, but would need to setup hw state
|
||||
* first.
|
||||
*/
|
||||
memset((char *)ctx->FBAddress + pMga->frontOffset,
|
||||
drimemsetio((char *)ctx->FBAddress + pMga->frontOffset,
|
||||
0,
|
||||
pMga->frontPitch * ctx->shared.virtualHeight );
|
||||
|
||||
memset((char *)ctx->FBAddress + pMga->backOffset,
|
||||
drimemsetio((char *)ctx->FBAddress + pMga->backOffset,
|
||||
0,
|
||||
pMga->backPitch * ctx->shared.virtualHeight );
|
||||
|
||||
|
@@ -47,6 +47,7 @@
|
||||
|
||||
#include "driver.h"
|
||||
#include "drm.h"
|
||||
#include "memops.h"
|
||||
|
||||
#include "r128.h"
|
||||
#include "r128_dri.h"
|
||||
@@ -826,11 +827,11 @@ static GLboolean R128DRIScreenInit(DRIDriverContext *ctx)
|
||||
* the clear ioctl to do this, but would need to setup hw state
|
||||
* first.
|
||||
*/
|
||||
memset((char *)ctx->FBAddress + info->frontOffset,
|
||||
drimemsetio((char *)ctx->FBAddress + info->frontOffset,
|
||||
0,
|
||||
info->frontPitch * ctx->cpp * ctx->shared.virtualHeight );
|
||||
|
||||
memset((char *)ctx->FBAddress + info->backOffset,
|
||||
drimemsetio((char *)ctx->FBAddress + info->backOffset,
|
||||
0,
|
||||
info->backPitch * ctx->cpp * ctx->shared.virtualHeight );
|
||||
|
||||
|
@@ -195,9 +195,9 @@ void r200EmitState( r200ContextPtr rmesa )
|
||||
/* Fire a section of the retained (indexed_verts) buffer as a regular
|
||||
* primtive.
|
||||
*/
|
||||
extern void r200EmitVbufPrim( r200ContextPtr rmesa,
|
||||
GLuint primitive,
|
||||
GLuint vertex_nr )
|
||||
void r200EmitVbufPrim( r200ContextPtr rmesa,
|
||||
GLuint primitive,
|
||||
GLuint vertex_nr )
|
||||
{
|
||||
drm_radeon_cmd_header_t *cmd;
|
||||
|
||||
@@ -231,7 +231,7 @@ void r200FlushElts( r200ContextPtr rmesa )
|
||||
fprintf(stderr, "%s\n", __FUNCTION__);
|
||||
|
||||
assert( rmesa->dma.flush == r200FlushElts );
|
||||
rmesa->dma.flush = 0;
|
||||
rmesa->dma.flush = NULL;
|
||||
|
||||
/* Cope with odd number of elts:
|
||||
*/
|
||||
|
@@ -182,7 +182,7 @@ static const struct tnl_pipeline_stage *r200_pipeline[] = {
|
||||
*/
|
||||
/* &_r200_render_stage, */ /* FIXME: bugs with ut2003 */
|
||||
&_tnl_render_stage, /* FALLBACK: */
|
||||
0,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
@@ -272,6 +272,9 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
|
||||
else
|
||||
rmesa->using_hyperz = GL_TRUE;
|
||||
}
|
||||
|
||||
if ( sPriv->drmMinor >= 15 )
|
||||
rmesa->texmicrotile = GL_TRUE;
|
||||
|
||||
/* Init default driver functions then plug in our R200-specific functions
|
||||
* (the texture functions are especially important)
|
||||
@@ -362,6 +365,13 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
|
||||
12,
|
||||
GL_FALSE );
|
||||
|
||||
/* adjust max texture size a bit. Hack, but I really want to use larger textures
|
||||
which will work just fine in 99.999999% of all cases, especially with texture compression... */
|
||||
if (driQueryOptionb( &rmesa->optionCache, "texture_level_hack" ))
|
||||
{
|
||||
if (ctx->Const.MaxTextureLevels < 12) ctx->Const.MaxTextureLevels += 1;
|
||||
}
|
||||
|
||||
ctx->Const.MaxTextureMaxAnisotropy = 16.0;
|
||||
|
||||
/* No wide points.
|
||||
@@ -412,9 +422,9 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
|
||||
_math_matrix_set_identity( &rmesa->tmpmat );
|
||||
|
||||
driInitExtensions( ctx, card_extensions, GL_TRUE );
|
||||
if (rmesa->r200Screen->chipset & R200_CHIPSET_REAL_R200) {
|
||||
/* yuv textures only work with r200 chips for unknown reasons, the
|
||||
others get the bit ordering right but don't actually do YUV-RGB conversion */
|
||||
if (!(rmesa->r200Screen->chipset & R200_CHIPSET_YCBCR_BROKEN)) {
|
||||
/* yuv textures don't work with some chips - R200 / rv280 okay so far
|
||||
others get the bit ordering right but don't actually do YUV-RGB conversion */
|
||||
_mesa_enable_extension( ctx, "GL_MESA_ycbcr_texture" );
|
||||
}
|
||||
if (rmesa->glCtx->Mesa_DXTn) {
|
||||
@@ -558,7 +568,7 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv )
|
||||
|
||||
if (rmesa->state.scissor.pClipRects) {
|
||||
FREE(rmesa->state.scissor.pClipRects);
|
||||
rmesa->state.scissor.pClipRects = 0;
|
||||
rmesa->state.scissor.pClipRects = NULL;
|
||||
}
|
||||
|
||||
if ( release_texture_heaps ) {
|
||||
@@ -645,7 +655,7 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
|
||||
} else {
|
||||
if (R200_DEBUG & DEBUG_DRI)
|
||||
fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
|
||||
_mesa_make_current( 0, 0 );
|
||||
_mesa_make_current( NULL, NULL );
|
||||
}
|
||||
|
||||
if (R200_DEBUG & DEBUG_DRI)
|
||||
|
@@ -167,6 +167,8 @@ struct r200_tex_obj {
|
||||
GLuint pp_cubic_faces; /* cube face 1,2,3,4 log2 sizes */
|
||||
|
||||
GLboolean border_fallback;
|
||||
|
||||
GLuint tile_bits; /* hw texture tile bits used on this texture */
|
||||
};
|
||||
|
||||
|
||||
@@ -931,6 +933,7 @@ struct r200_context {
|
||||
driOptionCache optionCache;
|
||||
|
||||
GLboolean using_hyperz;
|
||||
GLboolean texmicrotile;
|
||||
};
|
||||
|
||||
#define R200_CONTEXT(ctx) ((r200ContextPtr)(ctx->DriverCtx))
|
||||
|
@@ -288,7 +288,7 @@ void r200ReleaseDmaRegion( r200ContextPtr rmesa,
|
||||
rmesa->dma.nr_released_bufs++;
|
||||
}
|
||||
|
||||
region->buf = 0;
|
||||
region->buf = NULL;
|
||||
region->start = 0;
|
||||
}
|
||||
|
||||
|
@@ -852,8 +852,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#define R200_TXFORMAT_DXT1 (12 << 0)
|
||||
#define R200_TXFORMAT_DXT23 (14 << 0)
|
||||
#define R200_TXFORMAT_DXT45 (15 << 0)
|
||||
#define R200_TXFORMAT_DVDU88 (18 << 0)
|
||||
#define R200_TXFORMAT_LDVDU655 (19 << 0)
|
||||
#define R200_TXFORMAT_LDVDU8888 (20 << 0)
|
||||
#define R200_TXFORMAT_GR1616 (21 << 0)
|
||||
#define R200_TXFORMAT_ABGR8888 (22 << 0)
|
||||
#define R200_TXFORMAT_BGR111110 (23 << 0)
|
||||
#define R200_TXFORMAT_FORMAT_MASK (31 << 0)
|
||||
#define R200_TXFORMAT_FORMAT_SHIFT 0
|
||||
#define R200_TXFORMAT_APPLE_YUV (1 << 5)
|
||||
#define R200_TXFORMAT_ALPHA_IN_MAP (1 << 6)
|
||||
#define R200_TXFORMAT_NON_POWER2 (1 << 7)
|
||||
#define R200_TXFORMAT_WIDTH_MASK (15 << 8)
|
||||
@@ -872,6 +879,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24)
|
||||
#define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24)
|
||||
#define R200_TXFORMAT_ST_ROUTE_SHIFT 24
|
||||
#define R200_TXFORMAT_LOOKUP_DISABLE (1 << 27)
|
||||
#define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
|
||||
#define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
|
||||
#define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)
|
||||
@@ -968,6 +976,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#define R200_TXO_ENDIAN_BYTE_SWAP (1 << 0)
|
||||
#define R200_TXO_ENDIAN_WORD_SWAP (2 << 0)
|
||||
#define R200_TXO_ENDIAN_HALFDW_SWAP (3 << 0)
|
||||
#define R200_TXO_MACRO_TILE (1 << 2)
|
||||
#define R200_TXO_MICRO_TILE (1 << 3)
|
||||
#define R200_TXO_OFFSET_MASK 0xffffffe0
|
||||
#define R200_TXO_OFFSET_SHIFT 5
|
||||
#define R200_PP_CUBIC_OFFSET_F1_0 0x2d04
|
||||
|
@@ -144,6 +144,12 @@ static struct {
|
||||
{ RADEON_PP_TEX_SIZE_2, 2, "RADEON_PP_TEX_SIZE_2" },
|
||||
{ R200_RB3D_BLENDCOLOR, 3, "R200_RB3D_BLENDCOLOR" },
|
||||
{ R200_SE_TCL_POINT_SPRITE_CNTL, 1, "R200_SE_TCL_POINT_SPRITE_CNTL" },
|
||||
{ RADEON_PP_CUBIC_FACES_0, 1, "RADEON_PP_CUBIC_FACES_0" },
|
||||
{ RADEON_PP_CUBIC_OFFSET_T0_0, 5, "RADEON_PP_CUBIC_OFFSET_T0_0" },
|
||||
{ RADEON_PP_CUBIC_FACES_1, 1, "RADEON_PP_CUBIC_FACES_1" },
|
||||
{ RADEON_PP_CUBIC_OFFSET_T1_0, 5, "RADEON_PP_CUBIC_OFFSET_T1_0" },
|
||||
{ RADEON_PP_CUBIC_FACES_2, 1, "RADEON_PP_CUBIC_FACES_2" },
|
||||
{ RADEON_PP_CUBIC_OFFSET_T2_0, 5, "RADEON_PP_CUBIC_OFFSET_T2_0" },
|
||||
};
|
||||
|
||||
struct reg_names {
|
||||
@@ -617,7 +623,7 @@ static struct reg *lookup_reg( struct reg *tab, int reg )
|
||||
}
|
||||
|
||||
fprintf(stderr, "*** unknown reg 0x%x\n", reg);
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -925,7 +931,7 @@ static char *primname[0x10] = {
|
||||
"TRIANGLE_FAN",
|
||||
"TRIANGLE_STRIP",
|
||||
"RECT_LIST",
|
||||
0,
|
||||
NULL,
|
||||
"3VRT_POINTS",
|
||||
"3VRT_LINES",
|
||||
"POINT_SPRITES",
|
||||
|
@@ -73,6 +73,7 @@ DRI_CONF_BEGIN
|
||||
DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
|
||||
DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
|
||||
DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
|
||||
DRI_CONF_TEXTURE_LEVEL_HACK(false)
|
||||
DRI_CONF_SECTION_END
|
||||
DRI_CONF_SECTION_DEBUG
|
||||
DRI_CONF_NO_RAST(false)
|
||||
@@ -82,7 +83,7 @@ DRI_CONF_BEGIN
|
||||
DRI_CONF_NV_VERTEX_PROGRAM(false)
|
||||
DRI_CONF_SECTION_END
|
||||
DRI_CONF_END;
|
||||
static const GLuint __driNConfigOptions = 15;
|
||||
static const GLuint __driNConfigOptions = 16;
|
||||
|
||||
#if 1
|
||||
/* Including xf86PciInfo.h introduces a bunch of errors...
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user