mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
Merge branch 'master' into i915-unification
Conflicts: src/mesa/drivers/dri/common/dri_drmpool.c src/mesa/drivers/dri/i915tex/i915_vtbl.c src/mesa/drivers/dri/i915tex/intel_batchbuffer.c src/mesa/drivers/dri/i915tex/intel_context.c
This commit is contained in:
commit
4f1c9f7e51
365 changed files with 16066 additions and 7966 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,6 +2,7 @@
|
|||
*.o
|
||||
*.so
|
||||
*.sw[a-z]
|
||||
*.pc
|
||||
*~
|
||||
depend
|
||||
depend.bak
|
||||
|
|
|
|||
22
Makefile
22
Makefile
|
|
@ -66,6 +66,7 @@ aix-64 \
|
|||
aix-64-static \
|
||||
aix-gcc \
|
||||
aix-static \
|
||||
bluegene-osmesa \
|
||||
beos \
|
||||
darwin \
|
||||
darwin-static \
|
||||
|
|
@ -151,8 +152,9 @@ sunos5-v8 \
|
|||
sunos5-v8-static \
|
||||
sunos5-v9 \
|
||||
sunos5-v9-static \
|
||||
sunos5-v9-cc-g++ \
|
||||
ultrix-gcc:
|
||||
@ if [ -e configs/current ] ; then \
|
||||
@ if test -f configs/current || test -L configs/current ; then \
|
||||
echo "Please run 'make realclean' before changing configs" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
|
|
@ -209,6 +211,7 @@ MAIN_FILES = \
|
|||
$(DIRECTORY)/src/mesa/Makefile* \
|
||||
$(DIRECTORY)/src/mesa/sources \
|
||||
$(DIRECTORY)/src/mesa/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/gl.pc.in \
|
||||
$(DIRECTORY)/src/mesa/depend \
|
||||
$(DIRECTORY)/src/mesa/main/*.[chS] \
|
||||
$(DIRECTORY)/src/mesa/main/descrip.mms \
|
||||
|
|
@ -288,17 +291,6 @@ MAIN_FILES = \
|
|||
$(DIRECTORY)/vms/analyze_map.com \
|
||||
$(DIRECTORY)/vms/xlib.opt \
|
||||
$(DIRECTORY)/vms/xlib_share.opt \
|
||||
$(DIRECTORY)/windows/VC6/mesa/gdi/gdi.dsp \
|
||||
$(DIRECTORY)/windows/VC6/mesa/glu/*.txt \
|
||||
$(DIRECTORY)/windows/VC6/mesa/glu/glu.dsp \
|
||||
$(DIRECTORY)/windows/VC6/mesa/mesa.dsw \
|
||||
$(DIRECTORY)/windows/VC6/mesa/mesa/mesa.dsp \
|
||||
$(DIRECTORY)/windows/VC6/mesa/osmesa/osmesa.dsp \
|
||||
$(DIRECTORY)/windows/VC7/mesa/gdi/gdi.vcproj \
|
||||
$(DIRECTORY)/windows/VC7/mesa/glu/glu.vcproj \
|
||||
$(DIRECTORY)/windows/VC7/mesa/mesa.sln \
|
||||
$(DIRECTORY)/windows/VC7/mesa/mesa/mesa.vcproj \
|
||||
$(DIRECTORY)/windows/VC7/mesa/osmesa/osmesa.vcproj \
|
||||
$(DIRECTORY)/windows/VC8/mesa/mesa.sln \
|
||||
$(DIRECTORY)/windows/VC8/mesa/gdi/gdi.vcproj \
|
||||
$(DIRECTORY)/windows/VC8/mesa/glu/glu.vcproj \
|
||||
|
|
@ -327,7 +319,9 @@ DRI_FILES = \
|
|||
SGI_GLU_FILES = \
|
||||
$(DIRECTORY)/src/glu/Makefile \
|
||||
$(DIRECTORY)/src/glu/descrip.mms \
|
||||
$(DIRECTORY)/src/glu/glu.pc.in \
|
||||
$(DIRECTORY)/src/glu/sgi/Makefile \
|
||||
$(DIRECTORY)/src/glu/sgi/Makefile.mgw \
|
||||
$(DIRECTORY)/src/glu/sgi/Makefile.win \
|
||||
$(DIRECTORY)/src/glu/sgi/Makefile.DJ \
|
||||
$(DIRECTORY)/src/glu/sgi/glu.def \
|
||||
|
|
@ -372,6 +366,8 @@ DEMO_FILES = \
|
|||
$(DIRECTORY)/progs/demos/*.cxx \
|
||||
$(DIRECTORY)/progs/demos/*.dat \
|
||||
$(DIRECTORY)/progs/demos/README \
|
||||
$(DIRECTORY)/progs/fbdev/Makefile \
|
||||
$(DIRECTORY)/progs/fbdev/glfbdevtest.c \
|
||||
$(DIRECTORY)/progs/osdemos/Makefile \
|
||||
$(DIRECTORY)/progs/osdemos/*.c \
|
||||
$(DIRECTORY)/progs/xdemos/Makefile* \
|
||||
|
|
@ -400,6 +396,7 @@ GLUT_FILES = \
|
|||
$(DIRECTORY)/include/GL/glutf90.h \
|
||||
$(DIRECTORY)/src/glut/glx/Makefile* \
|
||||
$(DIRECTORY)/src/glut/glx/depend \
|
||||
$(DIRECTORY)/src/glut/glx/glut.pc.in \
|
||||
$(DIRECTORY)/src/glut/glx/*def \
|
||||
$(DIRECTORY)/src/glut/glx/descrip.mms \
|
||||
$(DIRECTORY)/src/glut/glx/mms_depend \
|
||||
|
|
@ -422,6 +419,7 @@ DEPEND_FILES = \
|
|||
$(TOP)/src/mesa/depend \
|
||||
$(TOP)/src/glx/x11/depend \
|
||||
$(TOP)/src/glw/depend \
|
||||
$(TOP)/src/glw/glw.pc.in \
|
||||
$(TOP)/src/glut/glx/depend \
|
||||
$(TOP)/src/glu/sgi/depend
|
||||
|
||||
|
|
|
|||
28
Makefile.mgw
28
Makefile.mgw
|
|
@ -51,37 +51,59 @@
|
|||
# realclean: remove all generated files
|
||||
#
|
||||
|
||||
# MinGW core makefile updated for Mesa 7.0
|
||||
#
|
||||
# Updated : by Heromyth, on 2007-7-21
|
||||
# Email : zxpmyth@yahoo.com.cn
|
||||
# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
|
||||
# The others havn't been tested yet.
|
||||
# 2) The generated DLLs are *not* compatible with the ones built
|
||||
# with the other compilers like VC8, especially for GLUT.
|
||||
# 3) MAlthough more tests are needed, it can be used individually!
|
||||
|
||||
|
||||
.PHONY : all libgl clean realclean
|
||||
|
||||
ifeq ($(ICD),1)
|
||||
# when -std=c99 mingw will not define WIN32
|
||||
CFLAGS = -Wall -W -Werror
|
||||
CFLAGS = -Wall -Werror
|
||||
else
|
||||
# I love c89
|
||||
CFLAGS = -Wall -W -pedantic
|
||||
CFLAGS = -Wall -pedantic
|
||||
endif
|
||||
CFLAGS += -O2 -ffast-math
|
||||
|
||||
export CFLAGS
|
||||
|
||||
|
||||
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
|
||||
UNLINK = del $(subst /,\,$(1))
|
||||
else
|
||||
UNLINK = $(RM) $(1)
|
||||
endif
|
||||
|
||||
all: libgl
|
||||
all: libgl libglu libglut example
|
||||
|
||||
libgl: lib
|
||||
$(MAKE) -f Makefile.mgw -C src/mesa
|
||||
|
||||
libglu: libgl
|
||||
$(MAKE) -f Makefile.mgw -C src/glu/sgi
|
||||
|
||||
libglut: libglu
|
||||
$(MAKE) -f Makefile.mgw -C src/glut/glx
|
||||
|
||||
example: libglut
|
||||
$(MAKE) -f Makefile.mgw star -C progs/samples
|
||||
copy progs\samples\star.exe lib
|
||||
|
||||
lib:
|
||||
mkdir lib
|
||||
|
||||
clean:
|
||||
$(MAKE) -f Makefile.mgw clean -C src/mesa
|
||||
$(MAKE) -f Makefile.mgw clean -C src/glu/sgi
|
||||
$(MAKE) -f Makefile.mgw clean -C src/glut/glx
|
||||
|
||||
realclean: clean
|
||||
-$(call UNLINK,lib/*.a)
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ do
|
|||
# this is a special case (see bugzilla 10876)
|
||||
DEPS="$DEPS $1"
|
||||
;;
|
||||
'-pthread')
|
||||
DEPS="$DEPS -pthread"
|
||||
;;
|
||||
'-cplusplus')
|
||||
CPLUSPLUS=1
|
||||
;;
|
||||
|
|
|
|||
29
configs/bluegene-osmesa
Normal file
29
configs/bluegene-osmesa
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# Configuration for building only libOSMesa on BlueGene, no Xlib driver
|
||||
# This doesn't really have a lot of dependencies, so it should be usable
|
||||
# on other (gcc-based) systems too.
|
||||
# It uses static linking and disables multithreading.
|
||||
|
||||
include $(TOP)/configs/default
|
||||
|
||||
CONFIG_NAME = bluegene-osmesa
|
||||
|
||||
# Compiler and flags
|
||||
CC = /bgl/BlueLight/ppcfloor/blrts-gnu/bin/powerpc-bgl-blrts-gnu-gcc
|
||||
CXX = /bgl/BlueLight/ppcfloor/blrts-gnu/bin/powerpc-bgl-blrts-gnu-g++
|
||||
CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
|
||||
CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURC
|
||||
|
||||
MKLIB_OPTIONS = -static
|
||||
|
||||
OSMESA_LIB_NAME = libOSMesa.a
|
||||
|
||||
# Directories
|
||||
SRC_DIRS = mesa glu
|
||||
DRIVER_DIRS = osmesa
|
||||
PROGRAM_DIRS = osdemos
|
||||
|
||||
|
||||
# Dependencies
|
||||
OSMESA_LIB_DEPS = -lm
|
||||
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
|
||||
APP_LIB_DEPS = -lOSMesa -lGLU -lm
|
||||
42
configs/config.mgw
Normal file
42
configs/config.mgw
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# MinGW config include file updated for Mesa 7.0
|
||||
#
|
||||
# Updated : by Heromyth, on 2007-7-21
|
||||
# Email : zxpmyth@yahoo.com.cn
|
||||
# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
|
||||
# The others havn't been tested yet.
|
||||
# 2) The generated DLLs are *not* compatible with the ones built
|
||||
# with the other compilers like VC8, especially for GLUT.
|
||||
# 3) Although more tests are needed, it can be used individually!
|
||||
|
||||
# The generated DLLs by MingW with STDCALL are not totally compatible
|
||||
# with the ones linked by Microsoft's compilers.
|
||||
#
|
||||
# xxx_USING_STDCALL = 1 Compiling MESA with __stdcall. This is default!
|
||||
#
|
||||
# xxx_USING_STDCALL = 0 Compiling MESA without __stdcall. I like this:)
|
||||
#
|
||||
|
||||
# In fact, GL_USING_STDCALL and GLUT_USING_STDCALL can be
|
||||
# different. For example:
|
||||
#
|
||||
# GL_USING_STDCALL = 0
|
||||
# GLUT_USING_STDCALL = 1
|
||||
#
|
||||
# Suggested setting:
|
||||
#
|
||||
# ALL_USING_STDCALL = 1
|
||||
#
|
||||
# That's default!
|
||||
#
|
||||
|
||||
|
||||
ALL_USING_STDCALL = 1
|
||||
|
||||
|
||||
ifeq ($(ALL_USING_STDCALL),1)
|
||||
GL_USING_STDCALL = 1
|
||||
GLUT_USING_STDCALL = 1
|
||||
else
|
||||
GL_USING_STDCALL = 0
|
||||
GLUT_USING_STDCALL = 0
|
||||
endif
|
||||
|
|
@ -13,7 +13,7 @@ OPT_FLAGS = -O2
|
|||
PIC_FLAGS = -fPIC
|
||||
|
||||
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -DUSE_XSHM \
|
||||
-DHZ=100 -DHAVE_POSIX_MEMALIGN
|
||||
-DHZ=100
|
||||
|
||||
X11_INCLUDES = -I/usr/X11R6/include
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ EXPAT_INCLUDES = -I/usr/local/include
|
|||
X11_INCLUDES = -I/usr/X11R6/include
|
||||
DEFINES = -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
|
||||
-DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \
|
||||
-DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN
|
||||
-DHAVE_ALIAS
|
||||
|
||||
CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) -Wmissing-prototypes -std=c99 -Wundef -ffast-math \
|
||||
$(ASM_FLAGS) $(X11_INCLUDES) $(DEFINES)
|
||||
|
|
@ -27,9 +27,9 @@ ASM_SOURCES =
|
|||
# Library/program dependencies
|
||||
LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
|
||||
LIBDRM_LIB = `pkg-config --libs libdrm`
|
||||
DRI_LIB_DEPS = -L/usr/local/lib -lm -lpthread -lexpat $(LIBDRM_LIB)
|
||||
DRI_LIB_DEPS = -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB)
|
||||
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
|
||||
-lm -lpthread $(LIBDRM_LIB)
|
||||
-lm -pthread $(LIBDRM_LIB)
|
||||
|
||||
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm
|
||||
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lGL -lXt -lX11
|
||||
|
|
|
|||
32
configs/sunos5-v9-cc-g++
Normal file
32
configs/sunos5-v9-cc-g++
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Configuration for SunOS 5, SPARC V9 and cc/g++ (for C and C++ sources)
|
||||
|
||||
include $(TOP)/configs/default
|
||||
|
||||
CONFIG_NAME = sunos5-v9-cc-g++
|
||||
|
||||
MKLIB_OPTIONS = -cplusplus
|
||||
|
||||
LIB_DIR = lib64
|
||||
|
||||
# Compiler and flags
|
||||
CC = cc
|
||||
CXX = g++
|
||||
|
||||
CXX_WARN_FLAGS = -Wall
|
||||
CXX_PIC_FLAGS = -fPIC
|
||||
CXX_OPT_FLAGS = -O3 -m64 -mcpu=ultrasparc -mv8plus -mvis -g -fomit-frame-pointer -pipe
|
||||
CXX_ARCH_FLAGS = -m64
|
||||
|
||||
|
||||
CXXFLAGS = $(CXX_WARN_FLAGS) $(CXX_OPT_FLAGS) $(CXX_PIC_FLAGS) $(CXX_ARCH_FLAGS) $(DEFINES) \
|
||||
-I/usr/openwin/include
|
||||
|
||||
CFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DPTHREADS
|
||||
#CXXFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DPTHREADS
|
||||
GLUT_CFLAGS = -DSOLARIS_2_4_BUG
|
||||
|
||||
GL_LIB_DEPS = -L/usr/openwin/lib -L/usr/dt/lib -lX11 -lXext -lXmu -lXi -lm -lpthread
|
||||
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lCstd -lCrun
|
||||
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
|
||||
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11
|
||||
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lX11 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
|
||||
|
|
@ -88,3 +88,66 @@ Running the Build:
|
|||
|
||||
Paul G. <pgarceau@users.sourceforge.net>
|
||||
Daniel Borca <dborca@users.sourceforge.net>
|
||||
|
||||
|
||||
|
||||
******This section is added by Heromyth <zxpmyth@yahoo.com.cn>*************
|
||||
|
||||
====================
|
||||
Updated on 2007-7-21
|
||||
====================
|
||||
|
||||
Notice:
|
||||
1) The generated DLLs are *not* compatible with the ones built
|
||||
with the other compilers like VC8, especially for GLUT.
|
||||
|
||||
2) Although more tests are needed, it can be used individually!
|
||||
|
||||
3) You can set the options about whether using STDCALL to build MESA. The
|
||||
config file is <Mesa3D-root>\configs\config.mgw. The default setting is that:
|
||||
ALL_USING_STDCALL = 1
|
||||
, which means using STDCALL to build MESA.
|
||||
|
||||
4) Of course, you can MESA without using STDCALL,I like this:)
|
||||
The setting is :
|
||||
ALL_USING_STDCALL = 0
|
||||
To do this, however, you must modify wingdi.h which is in MingW's include dir.
|
||||
For example, run:
|
||||
notepad C:\MingW\include\wingdi.h
|
||||
, and delete all the lines where all the wgl*() functions are. Because they would
|
||||
be conflicted with the ones in <Mesa3D-root>\include\GL\mesa_wgl.h.
|
||||
|
||||
>>>>>>>>>> Conflicted Functions List >>>>>>>>>>
|
||||
WINGDIAPI BOOL WINAPI wglCopyContext(HGLRC,HGLRC,UINT);
|
||||
WINGDIAPI HGLRC WINAPI wglCreateContext(HDC);
|
||||
WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC,int);
|
||||
WINGDIAPI BOOL WINAPI wglDeleteContext(HGLRC);
|
||||
WINGDIAPI BOOL WINAPI wglDescribeLayerPlane(HDC,int,int,UINT,LPLAYERPLANEDESCRIPTOR);
|
||||
WINGDIAPI HGLRC WINAPI wglGetCurrentContext(void);
|
||||
WINGDIAPI HDC WINAPI wglGetCurrentDC(void);
|
||||
WINGDIAPI int WINAPI wglGetLayerPaletteEntries(HDC,int,int,int,COLORREF*);
|
||||
WINGDIAPI PROC WINAPI wglGetProcAddress(LPCSTR);
|
||||
WINGDIAPI BOOL WINAPI wglMakeCurrent(HDC,HGLRC);
|
||||
WINGDIAPI BOOL WINAPI wglRealizeLayerPalette(HDC,int,BOOL);
|
||||
WINGDIAPI int WINAPI wglSetLayerPaletteEntries(HDC,int,int,int,const COLORREF*);
|
||||
WINGDIAPI BOOL WINAPI wglShareLists(HGLRC,HGLRC);
|
||||
WINGDIAPI BOOL WINAPI wglSwapLayerBuffers(HDC,UINT);
|
||||
WINGDIAPI BOOL WINAPI wglUseFontBitmapsA(HDC,DWORD,DWORD,DWORD);
|
||||
WINGDIAPI BOOL WINAPI wglUseFontBitmapsW(HDC,DWORD,DWORD,DWORD);
|
||||
WINGDIAPI BOOL WINAPI wglUseFontOutlinesA(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT);
|
||||
WINGDIAPI BOOL WINAPI wglUseFontOutlinesW(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT);
|
||||
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
====================
|
||||
Updated on 2007-7-22
|
||||
====================
|
||||
I havn't thought that I would find a better way to solve my problems so soon.
|
||||
I changed the method in which the import-libs and DLLs are made. After this update,
|
||||
the DLLs of MESA are more optimized and more compatible.
|
||||
It seems that there is no need to keep the building way of 'NO-STDCALL'.The
|
||||
way of USING_STDCALL is so nice! The file <Mesa3D-root>\configs\config.mgw is
|
||||
also not needed, and can be deleted safely!
|
||||
|
||||
|
||||
|
||||
*********************************************************************************
|
||||
|
|
@ -9,9 +9,9 @@
|
|||
<H1>Bug Database</H1>
|
||||
|
||||
<p>
|
||||
The Mesa bug database is now hosted on
|
||||
<a href="http://freedesktop.org" target="_parent">freedesktop.org</a>
|
||||
instead of SourceForge.
|
||||
The Mesa bug database is hosted on
|
||||
<a href="http://freedesktop.org" target="_parent">freedesktop.org</a>.
|
||||
The old bug database on SourceForge is no longer used.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
@ -26,16 +26,20 @@ Please follow these bug reporting guidelines:
|
|||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Make sure you're using the most recent version of Mesa
|
||||
<li>Make sure your bug isn't already reported
|
||||
<li>Include as much information as possible in the report
|
||||
<li>Check if a new version of Mesa is available which might have fixed
|
||||
the problem.
|
||||
<li>Check if your bug is already reported in the database.
|
||||
<li>Monitor your bug report for requests for additional information, etc.
|
||||
<li>If you're reporting a crash, try to use your debugger (gdb) to get a stack
|
||||
trace. Also, recompile Mesa in debug mode to get more detailed information.
|
||||
<li>Describe in detail how to reproduce the bug, especially with games
|
||||
and applications that the Mesa developers might not be familiar with.
|
||||
<li>Provide a simple GLUT-based test program if possible
|
||||
<li>Check back for follow-ups to the report
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Bug reports will automatically be forwarded to the Mesa developer's mailing
|
||||
list.
|
||||
Bug reports will automatically be forwarded by bugzilla to the Mesa
|
||||
developer's mailing list.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@
|
|||
<H1>Downloading</H1>
|
||||
|
||||
<p>
|
||||
Last development release: <b>6.5.3</b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Last stable release: <b>6.4.2</b>
|
||||
Last stable release: <b>7.0</b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -287,7 +287,15 @@ already installed, you'll have to choose different directories, like
|
|||
To install Mesa's headers and libraries, run <code>make install</code>.
|
||||
But first, check the Mesa/configs/default file and examine the values
|
||||
of the <b>INSTALL_DIR</b> and <b>DRI_DRIVER_INSTALL_DIR</b> variables.
|
||||
Change them if needed, then run <code>make install</code>
|
||||
Change them if needed, then run <code>make install</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The variable
|
||||
<b>DESTDIR</b> may also be used to install the contents to a temporary
|
||||
staging directory.
|
||||
This can be useful for package management.
|
||||
For example: <code>make install DESTDIR=/somepath/</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
@ -298,6 +306,26 @@ This is a handy way to compare multiple OpenGL implementations.
|
|||
</p>
|
||||
|
||||
|
||||
<H3>1.5 pkg-config support</H3>
|
||||
|
||||
<p>
|
||||
Running <code>make install</code> will install package configuration files
|
||||
for the pkg-config utility.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When compiling your OpenGL application you can use pkg-config to determine
|
||||
the proper compiler and linker flags.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For example, compiling and linking a GLUT application can be done with:
|
||||
</p>
|
||||
<pre>
|
||||
gcc `pkg-config --cflags --libs glut` mydemo.c -o mydemo
|
||||
</pre>
|
||||
|
||||
<br>
|
||||
|
||||
<a name="windows">
|
||||
<H2>2. Windows Compilation and Installation</H1>
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ GL_ARB_fragment_program extensions.
|
|||
</p>
|
||||
|
||||
<p>
|
||||
May 2007: Mesa 7.0 is released, implementing the OpenGL 2.1 specification
|
||||
June 2007: Mesa 7.0 is released, implementing the OpenGL 2.1 specification
|
||||
and OpenGL Shading Language.
|
||||
</p>
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
</li><li><a href="http://innovation3d.sourceforge.net/" target="_parent">Innovation3D</a>
|
||||
- 3D modeling program
|
||||
</li><li><a href="http://mesa3d.sourceforge.net/notfound.html" target="_parent">KWRL</a> - VRML browser
|
||||
</li><li><a href="http://www.vermontel.com/%7Ecmorley/vrml.html" target="_parent">LibVRML97/Lookat</a>
|
||||
</li><li><a href="http://www.openvrml.org/" target="_parent">LibVRML97/Lookat</a>
|
||||
- VRML viewer
|
||||
</li><li><a href="http://aig.cs.man.ac.uk/systems/Maverik/" target="_parent">Maverik</a>
|
||||
- VR graphics and interaction system
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<H1>News</H1>
|
||||
|
||||
|
||||
<h2>May ???, 2007</h2>
|
||||
<h2>June 22, 2007</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.0.html">Mesa 7.0</a> is released.
|
||||
This is a stable release featuring OpenGL 2.1 support.
|
||||
|
|
|
|||
|
|
@ -8,16 +8,25 @@
|
|||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.0 Release Notes / (<em>in progress</em>)</H1>
|
||||
<H1>Mesa 7.0 Release Notes / June 22, 2007</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.0 is a stable release, featuring OpenGL 2.1 API support.
|
||||
A number of bugs have been fixed since the 6.5.3 release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
TBD
|
||||
35a1698986f7ac8dc435624ee9256cda MesaLib-7.0.tar.gz
|
||||
50c371455fa7532c04aa0a970f9bc51f MesaLib-7.0.tar.bz2
|
||||
bcedb6f43c97c1bc49e5cc7f12835722 MesaLib-7.0.zip
|
||||
9bad332c7b74f59be96556135212ca9e MesaDemos-7.0.tar.gz
|
||||
fada2bc1f29da513e015fda1e3abd0c0 MesaDemos-7.0.tar.bz2
|
||||
84e3bbe470d983ae32f1f0c779faf99e MesaDemos-7.0.zip
|
||||
76c7bb54f9850c689eba844f6daed332 MesaGLUT-7.0.tar.gz
|
||||
4af28296e02772ef1de00e4e79bf3d12 MesaGLUT-7.0.tar.bz2
|
||||
9043cb0b54cc03d1874728d74b12188c MesaGLUT-7.0.zip
|
||||
</pre>
|
||||
|
||||
|
||||
|
|
@ -37,6 +46,12 @@ TBD
|
|||
<li>Fixed R300 vertex program/matrix bug (10848)
|
||||
<li>GLSL dFdx() and dFdy() work for fragment program inputs now (texcoords)
|
||||
<li>Specifying an invalid texture unit as a sampler could lead to a crash
|
||||
<li>The GLX protocol request for glXDestroyPBuffer() was incorrect (bug 10983)
|
||||
<li>ARB vp state.light[n].half value was incorrect (bug 10987)
|
||||
<li>Fixed a positional light source bug (bug 11009)
|
||||
<li>Fixed point size attenuation problem (bug 11042)
|
||||
<li>glPopAttrib didn't restore texture object's LOD bias (bug 11049)
|
||||
<li>Fixed a TLS / TEXTREL problem (bug 7459)
|
||||
</ul>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ TBD
|
|||
|
||||
<h2>To Do (someday) items</h2>
|
||||
<ul>
|
||||
<li>Remove the MEMCPY() and _mesa_memcpy() wrappers and just use memcpy().
|
||||
Probably do the same for malloc, calloc, etc.
|
||||
The wrappers were useful in the past for memory debugging but now we
|
||||
have valgrind. Not worried about SunOS 4 support anymore either...
|
||||
<li>Switch to freeglut
|
||||
<li>Fix linux-glide target/driver.
|
||||
<li>Improved lambda and derivative calculation for frag progs.
|
||||
|
|
|
|||
|
|
@ -84,7 +84,8 @@
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) \
|
||||
&& !defined(OPENSTEP) && !defined(__CYGWIN__) || defined(__MINGW32__)
|
||||
#include <GL/mesa_wgl.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -2161,11 +2162,11 @@ typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLsh
|
|||
#define GL_DEBUG_PRINT_MESA 0x875A
|
||||
#define GL_DEBUG_ASSERT_MESA 0x875B
|
||||
|
||||
GLAPI GLhandleARB APIENTRY glCreateDebugObjectMESA (void);
|
||||
GLAPI void APIENTRY glClearDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
|
||||
GLAPI void APIENTRY glGetDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType, GLsizei maxLength,
|
||||
GLAPI GLhandleARB GLAPIENTRY glCreateDebugObjectMESA (void);
|
||||
GLAPI void GLAPIENTRY glClearDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
|
||||
GLAPI void GLAPIENTRY glGetDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType, GLsizei maxLength,
|
||||
GLsizei *length, GLcharARB *debugLog);
|
||||
GLAPI GLsizei APIENTRY glGetDebugLogLengthMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
|
||||
GLAPI GLsizei GLAPIENTRY glGetDebugLogLengthMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
|
||||
|
||||
#endif /* GL_MESA_shader_debug */
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#define glActiveStencilFaceEXT MANGLE(ActiveStencilFaceEXT)
|
||||
#define glActiveTextureARB MANGLE(ActiveTextureARB)
|
||||
#define glActiveTexture MANGLE(ActiveTexture)
|
||||
#define glActiveVaryingNV MANGLE(ActiveVaryingNV)
|
||||
#define glAlphaFragmentOp1ATI MANGLE(AlphaFragmentOp1ATI)
|
||||
#define glAlphaFragmentOp2ATI MANGLE(AlphaFragmentOp2ATI)
|
||||
#define glAlphaFragmentOp3ATI MANGLE(AlphaFragmentOp3ATI)
|
||||
|
|
@ -52,11 +53,16 @@
|
|||
#define glBeginOcclusionQueryNV MANGLE(BeginOcclusionQueryNV)
|
||||
#define glBeginQueryARB MANGLE(BeginQueryARB)
|
||||
#define glBeginQuery MANGLE(BeginQuery)
|
||||
#define glBeginTransformFeedbackNV MANGLE(BeginTransformFeedbackNV)
|
||||
#define glBeginVertexShaderEXT MANGLE(BeginVertexShaderEXT)
|
||||
#define glBindAttribLocationARB MANGLE(BindAttribLocationARB)
|
||||
#define glBindAttribLocation MANGLE(BindAttribLocation)
|
||||
#define glBindBufferARB MANGLE(BindBufferARB)
|
||||
#define glBindBufferBaseNV MANGLE(BindBufferBaseNV)
|
||||
#define glBindBuffer MANGLE(BindBuffer)
|
||||
#define glBindBufferOffsetNV MANGLE(BindBufferOffsetNV)
|
||||
#define glBindBufferRangeNV MANGLE(BindBufferRangeNV)
|
||||
#define glBindFragDataLocationEXT MANGLE(BindFragDataLocationEXT)
|
||||
#define glBindFragmentShaderATI MANGLE(BindFragmentShaderATI)
|
||||
#define glBindFramebufferEXT MANGLE(BindFramebufferEXT)
|
||||
#define glBindLightParameterEXT MANGLE(BindLightParameterEXT)
|
||||
|
|
@ -97,6 +103,7 @@
|
|||
#define glBlitFramebufferEXT MANGLE(BlitFramebufferEXT)
|
||||
#define glBufferDataARB MANGLE(BufferDataARB)
|
||||
#define glBufferData MANGLE(BufferData)
|
||||
#define glBufferParameteriAPPLE MANGLE(BufferParameteriAPPLE)
|
||||
#define glBufferSubDataARB MANGLE(BufferSubDataARB)
|
||||
#define glBufferSubData MANGLE(BufferSubData)
|
||||
#define glCallList MANGLE(CallList)
|
||||
|
|
@ -104,8 +111,11 @@
|
|||
#define glCheckFramebufferStatusEXT MANGLE(CheckFramebufferStatusEXT)
|
||||
#define glClampColorARB MANGLE(ClampColorARB)
|
||||
#define glClearAccum MANGLE(ClearAccum)
|
||||
#define glClearColorIiEXT MANGLE(ClearColorIiEXT)
|
||||
#define glClearColorIuiEXT MANGLE(ClearColorIuiEXT)
|
||||
#define glClearColor MANGLE(ClearColor)
|
||||
#define glClearDebugLogMESA MANGLE(ClearDebugLogMESA)
|
||||
#define glClearDepthdNV MANGLE(ClearDepthdNV)
|
||||
#define glClearDepth MANGLE(ClearDepth)
|
||||
#define glClearIndex MANGLE(ClearIndex)
|
||||
#define glClear MANGLE(Clear)
|
||||
|
|
@ -161,6 +171,7 @@
|
|||
#define glColorFragmentOp1ATI MANGLE(ColorFragmentOp1ATI)
|
||||
#define glColorFragmentOp2ATI MANGLE(ColorFragmentOp2ATI)
|
||||
#define glColorFragmentOp3ATI MANGLE(ColorFragmentOp3ATI)
|
||||
#define glColorMaskIndexedEXT MANGLE(ColorMaskIndexedEXT)
|
||||
#define glColorMask MANGLE(ColorMask)
|
||||
#define glColorMaterial MANGLE(ColorMaterial)
|
||||
#define glColorPointerEXT MANGLE(ColorPointerEXT)
|
||||
|
|
@ -261,19 +272,23 @@
|
|||
#define glDeleteTextures MANGLE(DeleteTextures)
|
||||
#define glDeleteVertexArraysAPPLE MANGLE(DeleteVertexArraysAPPLE)
|
||||
#define glDeleteVertexShaderEXT MANGLE(DeleteVertexShaderEXT)
|
||||
#define glDepthBoundsdNV MANGLE(DepthBoundsdNV)
|
||||
#define glDepthBoundsEXT MANGLE(DepthBoundsEXT)
|
||||
#define glDepthFunc MANGLE(DepthFunc)
|
||||
#define glDepthMask MANGLE(DepthMask)
|
||||
#define glDepthRangedNV MANGLE(DepthRangedNV)
|
||||
#define glDepthRange MANGLE(DepthRange)
|
||||
#define glDetachObjectARB MANGLE(DetachObjectARB)
|
||||
#define glDetachShader MANGLE(DetachShader)
|
||||
#define glDetailTexFuncSGIS MANGLE(DetailTexFuncSGIS)
|
||||
#define glDisableClientState MANGLE(DisableClientState)
|
||||
#define glDisableIndexedEXT MANGLE(DisableIndexedEXT)
|
||||
#define glDisable MANGLE(Disable)
|
||||
#define glDisableVariantClientStateEXT MANGLE(DisableVariantClientStateEXT)
|
||||
#define glDisableVertexAttribArrayARB MANGLE(DisableVertexAttribArrayARB)
|
||||
#define glDisableVertexAttribArray MANGLE(DisableVertexAttribArray)
|
||||
#define glDrawArraysEXT MANGLE(DrawArraysEXT)
|
||||
#define glDrawArraysInstancedEXT MANGLE(DrawArraysInstancedEXT)
|
||||
#define glDrawArrays MANGLE(DrawArrays)
|
||||
#define glDrawBuffer MANGLE(DrawBuffer)
|
||||
#define glDrawBuffersARB MANGLE(DrawBuffersARB)
|
||||
|
|
@ -281,6 +296,7 @@
|
|||
#define glDrawBuffers MANGLE(DrawBuffers)
|
||||
#define glDrawElementArrayAPPLE MANGLE(DrawElementArrayAPPLE)
|
||||
#define glDrawElementArrayATI MANGLE(DrawElementArrayATI)
|
||||
#define glDrawElementsInstancedEXT MANGLE(DrawElementsInstancedEXT)
|
||||
#define glDrawElements MANGLE(DrawElements)
|
||||
#define glDrawMeshArraysSUN MANGLE(DrawMeshArraysSUN)
|
||||
#define glDrawPixels MANGLE(DrawPixels)
|
||||
|
|
@ -296,6 +312,7 @@
|
|||
#define glElementPointerAPPLE MANGLE(ElementPointerAPPLE)
|
||||
#define glElementPointerATI MANGLE(ElementPointerATI)
|
||||
#define glEnableClientState MANGLE(EnableClientState)
|
||||
#define glEnableIndexedEXT MANGLE(EnableIndexedEXT)
|
||||
#define glEnable MANGLE(Enable)
|
||||
#define glEnableVariantClientStateEXT MANGLE(EnableVariantClientStateEXT)
|
||||
#define glEnableVertexAttribArrayARB MANGLE(EnableVertexAttribArrayARB)
|
||||
|
|
@ -306,6 +323,7 @@
|
|||
#define glEndOcclusionQueryNV MANGLE(EndOcclusionQueryNV)
|
||||
#define glEndQueryARB MANGLE(EndQueryARB)
|
||||
#define glEndQuery MANGLE(EndQuery)
|
||||
#define glEndTransformFeedbackNV MANGLE(EndTransformFeedbackNV)
|
||||
#define glEndVertexShaderEXT MANGLE(EndVertexShaderEXT)
|
||||
#define glEvalCoord1d MANGLE(EvalCoord1d)
|
||||
#define glEvalCoord1dv MANGLE(EvalCoord1dv)
|
||||
|
|
@ -331,6 +349,7 @@
|
|||
#define glFinishObjectAPPLE MANGLE(FinishObjectAPPLE)
|
||||
#define glFinishTextureSUNX MANGLE(FinishTextureSUNX)
|
||||
#define glFlush MANGLE(Flush)
|
||||
#define glFlushMappedBufferRangeAPPLE MANGLE(FlushMappedBufferRangeAPPLE)
|
||||
#define glFlushPixelDataRangeNV MANGLE(FlushPixelDataRangeNV)
|
||||
#define glFlushRasterSGIX MANGLE(FlushRasterSGIX)
|
||||
#define glFlushVertexArrayRangeAPPLE MANGLE(FlushVertexArrayRangeAPPLE)
|
||||
|
|
@ -370,6 +389,9 @@
|
|||
#define glFramebufferTexture1DEXT MANGLE(FramebufferTexture1DEXT)
|
||||
#define glFramebufferTexture2DEXT MANGLE(FramebufferTexture2DEXT)
|
||||
#define glFramebufferTexture3DEXT MANGLE(FramebufferTexture3DEXT)
|
||||
#define glFramebufferTextureEXT MANGLE(FramebufferTextureEXT)
|
||||
#define glFramebufferTextureFaceEXT MANGLE(FramebufferTextureFaceEXT)
|
||||
#define glFramebufferTextureLayerEXT MANGLE(FramebufferTextureLayerEXT)
|
||||
#define glFrameZoomSGIX MANGLE(FrameZoomSGIX)
|
||||
#define glFreeObjectBufferATI MANGLE(FreeObjectBufferATI)
|
||||
#define glFrontFace MANGLE(FrontFace)
|
||||
|
|
@ -398,12 +420,14 @@
|
|||
#define glGetActiveAttrib MANGLE(GetActiveAttrib)
|
||||
#define glGetActiveUniformARB MANGLE(GetActiveUniformARB)
|
||||
#define glGetActiveUniform MANGLE(GetActiveUniform)
|
||||
#define glGetActiveVaryingNV MANGLE(GetActiveVaryingNV)
|
||||
#define glGetArrayObjectfvATI MANGLE(GetArrayObjectfvATI)
|
||||
#define glGetArrayObjectivATI MANGLE(GetArrayObjectivATI)
|
||||
#define glGetAttachedObjectsARB MANGLE(GetAttachedObjectsARB)
|
||||
#define glGetAttachedShaders MANGLE(GetAttachedShaders)
|
||||
#define glGetAttribLocationARB MANGLE(GetAttribLocationARB)
|
||||
#define glGetAttribLocation MANGLE(GetAttribLocation)
|
||||
#define glGetBooleanIndexedvEXT MANGLE(GetBooleanIndexedvEXT)
|
||||
#define glGetBooleanv MANGLE(GetBooleanv)
|
||||
#define glGetBufferParameterivARB MANGLE(GetBufferParameterivARB)
|
||||
#define glGetBufferParameteriv MANGLE(GetBufferParameteriv)
|
||||
|
|
@ -444,6 +468,7 @@
|
|||
#define glGetFinalCombinerInputParameterivNV MANGLE(GetFinalCombinerInputParameterivNV)
|
||||
#define glGetFloatv MANGLE(GetFloatv)
|
||||
#define glGetFogFuncSGIS MANGLE(GetFogFuncSGIS)
|
||||
#define glGetFragDataLocationEXT MANGLE(GetFragDataLocationEXT)
|
||||
#define glGetFragmentLightfvSGIX MANGLE(GetFragmentLightfvSGIX)
|
||||
#define glGetFragmentLightivSGIX MANGLE(GetFragmentLightivSGIX)
|
||||
#define glGetFragmentMaterialfvSGIX MANGLE(GetFragmentMaterialfvSGIX)
|
||||
|
|
@ -460,6 +485,7 @@
|
|||
#define glGetImageTransformParameterivHP MANGLE(GetImageTransformParameterivHP)
|
||||
#define glGetInfoLogARB MANGLE(GetInfoLogARB)
|
||||
#define glGetInstrumentsSGIX MANGLE(GetInstrumentsSGIX)
|
||||
#define glGetIntegerIndexedvEXT MANGLE(GetIntegerIndexedvEXT)
|
||||
#define glGetIntegerv MANGLE(GetIntegerv)
|
||||
#define glGetInvariantBooleanvEXT MANGLE(GetInvariantBooleanvEXT)
|
||||
#define glGetInvariantFloatvEXT MANGLE(GetInvariantFloatvEXT)
|
||||
|
|
@ -503,12 +529,16 @@
|
|||
#define glGetPolygonStipple MANGLE(GetPolygonStipple)
|
||||
#define glGetProgramEnvParameterdvARB MANGLE(GetProgramEnvParameterdvARB)
|
||||
#define glGetProgramEnvParameterfvARB MANGLE(GetProgramEnvParameterfvARB)
|
||||
#define glGetProgramEnvParameterIivNV MANGLE(GetProgramEnvParameterIivNV)
|
||||
#define glGetProgramEnvParameterIuivNV MANGLE(GetProgramEnvParameterIuivNV)
|
||||
#define glGetProgramInfoLog MANGLE(GetProgramInfoLog)
|
||||
#define glGetProgramivARB MANGLE(GetProgramivARB)
|
||||
#define glGetProgramiv MANGLE(GetProgramiv)
|
||||
#define glGetProgramivNV MANGLE(GetProgramivNV)
|
||||
#define glGetProgramLocalParameterdvARB MANGLE(GetProgramLocalParameterdvARB)
|
||||
#define glGetProgramLocalParameterfvARB MANGLE(GetProgramLocalParameterfvARB)
|
||||
#define glGetProgramLocalParameterIivNV MANGLE(GetProgramLocalParameterIivNV)
|
||||
#define glGetProgramLocalParameterIuivNV MANGLE(GetProgramLocalParameterIuivNV)
|
||||
#define glGetProgramNamedParameterdvNV MANGLE(GetProgramNamedParameterdvNV)
|
||||
#define glGetProgramNamedParameterfvNV MANGLE(GetProgramNamedParameterfvNV)
|
||||
#define glGetProgramParameterdvNV MANGLE(GetProgramParameterdvNV)
|
||||
|
|
@ -545,20 +575,27 @@
|
|||
#define glGetTexLevelParameterfv MANGLE(GetTexLevelParameterfv)
|
||||
#define glGetTexLevelParameteriv MANGLE(GetTexLevelParameteriv)
|
||||
#define glGetTexParameterfv MANGLE(GetTexParameterfv)
|
||||
#define glGetTexParameterIivEXT MANGLE(GetTexParameterIivEXT)
|
||||
#define glGetTexParameterIuivEXT MANGLE(GetTexParameterIuivEXT)
|
||||
#define glGetTexParameteriv MANGLE(GetTexParameteriv)
|
||||
#define glGetTrackMatrixivNV MANGLE(GetTrackMatrixivNV)
|
||||
#define glGetTransformFeedbackVaryingNV MANGLE(GetTransformFeedbackVaryingNV)
|
||||
#define glGetUniformBufferSizeEXT MANGLE(GetUniformBufferSizeEXT)
|
||||
#define glGetUniformfvARB MANGLE(GetUniformfvARB)
|
||||
#define glGetUniformfv MANGLE(GetUniformfv)
|
||||
#define glGetUniformivARB MANGLE(GetUniformivARB)
|
||||
#define glGetUniformiv MANGLE(GetUniformiv)
|
||||
#define glGetUniformLocationARB MANGLE(GetUniformLocationARB)
|
||||
#define glGetUniformLocation MANGLE(GetUniformLocation)
|
||||
#define glGetUniformOffsetEXT MANGLE(GetUniformOffsetEXT)
|
||||
#define glGetUniformuivEXT MANGLE(GetUniformuivEXT)
|
||||
#define glGetVariantArrayObjectfvATI MANGLE(GetVariantArrayObjectfvATI)
|
||||
#define glGetVariantArrayObjectivATI MANGLE(GetVariantArrayObjectivATI)
|
||||
#define glGetVariantBooleanvEXT MANGLE(GetVariantBooleanvEXT)
|
||||
#define glGetVariantFloatvEXT MANGLE(GetVariantFloatvEXT)
|
||||
#define glGetVariantIntegervEXT MANGLE(GetVariantIntegervEXT)
|
||||
#define glGetVariantPointervEXT MANGLE(GetVariantPointervEXT)
|
||||
#define glGetVaryingLocationNV MANGLE(GetVaryingLocationNV)
|
||||
#define glGetVertexAttribArrayObjectfvATI MANGLE(GetVertexAttribArrayObjectfvATI)
|
||||
#define glGetVertexAttribArrayObjectivATI MANGLE(GetVertexAttribArrayObjectivATI)
|
||||
#define glGetVertexAttribdvARB MANGLE(GetVertexAttribdvARB)
|
||||
|
|
@ -567,6 +604,8 @@
|
|||
#define glGetVertexAttribfvARB MANGLE(GetVertexAttribfvARB)
|
||||
#define glGetVertexAttribfv MANGLE(GetVertexAttribfv)
|
||||
#define glGetVertexAttribfvNV MANGLE(GetVertexAttribfvNV)
|
||||
#define glGetVertexAttribIivEXT MANGLE(GetVertexAttribIivEXT)
|
||||
#define glGetVertexAttribIuivEXT MANGLE(GetVertexAttribIuivEXT)
|
||||
#define glGetVertexAttribivARB MANGLE(GetVertexAttribivARB)
|
||||
#define glGetVertexAttribiv MANGLE(GetVertexAttribiv)
|
||||
#define glGetVertexAttribivNV MANGLE(GetVertexAttribivNV)
|
||||
|
|
@ -613,6 +652,7 @@
|
|||
#define glIsAsyncMarkerSGIX MANGLE(IsAsyncMarkerSGIX)
|
||||
#define glIsBufferARB MANGLE(IsBufferARB)
|
||||
#define glIsBuffer MANGLE(IsBuffer)
|
||||
#define glIsEnabledIndexedEXT MANGLE(IsEnabledIndexedEXT)
|
||||
#define glIsEnabled MANGLE(IsEnabled)
|
||||
#define glIsFenceAPPLE MANGLE(IsFenceAPPLE)
|
||||
#define glIsFenceNV MANGLE(IsFenceNV)
|
||||
|
|
@ -852,17 +892,32 @@
|
|||
#define glPrimitiveRestartNV MANGLE(PrimitiveRestartNV)
|
||||
#define glPrioritizeTexturesEXT MANGLE(PrioritizeTexturesEXT)
|
||||
#define glPrioritizeTextures MANGLE(PrioritizeTextures)
|
||||
#define glProgramBufferParametersfvNV MANGLE(ProgramBufferParametersfvNV)
|
||||
#define glProgramBufferParametersIivNV MANGLE(ProgramBufferParametersIivNV)
|
||||
#define glProgramBufferParametersIuivNV MANGLE(ProgramBufferParametersIuivNV)
|
||||
#define glProgramCallbackMESA MANGLE(ProgramCallbackMESA)
|
||||
#define glProgramEnvParameter4dARB MANGLE(ProgramEnvParameter4dARB)
|
||||
#define glProgramEnvParameter4dvARB MANGLE(ProgramEnvParameter4dvARB)
|
||||
#define glProgramEnvParameter4fARB MANGLE(ProgramEnvParameter4fARB)
|
||||
#define glProgramEnvParameter4fvARB MANGLE(ProgramEnvParameter4fvARB)
|
||||
#define glProgramEnvParameterI4iNV MANGLE(ProgramEnvParameterI4iNV)
|
||||
#define glProgramEnvParameterI4ivNV MANGLE(ProgramEnvParameterI4ivNV)
|
||||
#define glProgramEnvParameterI4uiNV MANGLE(ProgramEnvParameterI4uiNV)
|
||||
#define glProgramEnvParameterI4uivNV MANGLE(ProgramEnvParameterI4uivNV)
|
||||
#define glProgramEnvParameters4fvEXT MANGLE(ProgramEnvParameters4fvEXT)
|
||||
#define glProgramEnvParametersI4ivNV MANGLE(ProgramEnvParametersI4ivNV)
|
||||
#define glProgramEnvParametersI4uivNV MANGLE(ProgramEnvParametersI4uivNV)
|
||||
#define glProgramLocalParameter4dARB MANGLE(ProgramLocalParameter4dARB)
|
||||
#define glProgramLocalParameter4dvARB MANGLE(ProgramLocalParameter4dvARB)
|
||||
#define glProgramLocalParameter4fARB MANGLE(ProgramLocalParameter4fARB)
|
||||
#define glProgramLocalParameter4fvARB MANGLE(ProgramLocalParameter4fvARB)
|
||||
#define glProgramLocalParameterI4iNV MANGLE(ProgramLocalParameterI4iNV)
|
||||
#define glProgramLocalParameterI4ivNV MANGLE(ProgramLocalParameterI4ivNV)
|
||||
#define glProgramLocalParameterI4uiNV MANGLE(ProgramLocalParameterI4uiNV)
|
||||
#define glProgramLocalParameterI4uivNV MANGLE(ProgramLocalParameterI4uivNV)
|
||||
#define glProgramLocalParameters4fvEXT MANGLE(ProgramLocalParameters4fvEXT)
|
||||
#define glProgramLocalParametersI4ivNV MANGLE(ProgramLocalParametersI4ivNV)
|
||||
#define glProgramLocalParametersI4uivNV MANGLE(ProgramLocalParametersI4uivNV)
|
||||
#define glProgramNamedParameter4dNV MANGLE(ProgramNamedParameter4dNV)
|
||||
#define glProgramNamedParameter4dvNV MANGLE(ProgramNamedParameter4dvNV)
|
||||
#define glProgramNamedParameter4fNV MANGLE(ProgramNamedParameter4fNV)
|
||||
|
|
@ -871,9 +926,11 @@
|
|||
#define glProgramParameter4dvNV MANGLE(ProgramParameter4dvNV)
|
||||
#define glProgramParameter4fNV MANGLE(ProgramParameter4fNV)
|
||||
#define glProgramParameter4fvNV MANGLE(ProgramParameter4fvNV)
|
||||
#define glProgramParameteriEXT MANGLE(ProgramParameteriEXT)
|
||||
#define glProgramParameters4dvNV MANGLE(ProgramParameters4dvNV)
|
||||
#define glProgramParameters4fvNV MANGLE(ProgramParameters4fvNV)
|
||||
#define glProgramStringARB MANGLE(ProgramStringARB)
|
||||
#define glProgramVertexLimitNV MANGLE(ProgramVertexLimitNV)
|
||||
#define glPushAttrib MANGLE(PushAttrib)
|
||||
#define glPushClientAttrib MANGLE(PushClientAttrib)
|
||||
#define glPushMatrix MANGLE(PushMatrix)
|
||||
|
|
@ -915,6 +972,7 @@
|
|||
#define glRectsv MANGLE(Rectsv)
|
||||
#define glReferencePlaneSGIX MANGLE(ReferencePlaneSGIX)
|
||||
#define glRenderbufferStorageEXT MANGLE(RenderbufferStorageEXT)
|
||||
#define glRenderbufferStorageMultisampleCoverageNV MANGLE(RenderbufferStorageMultisampleCoverageNV)
|
||||
#define glRenderbufferStorageMultisampleEXT MANGLE(RenderbufferStorageMultisampleEXT)
|
||||
#define glRenderMode MANGLE(RenderMode)
|
||||
#define glReplacementCodePointerSUN MANGLE(ReplacementCodePointerSUN)
|
||||
|
|
@ -1043,6 +1101,7 @@
|
|||
#define glTestFenceAPPLE MANGLE(TestFenceAPPLE)
|
||||
#define glTestFenceNV MANGLE(TestFenceNV)
|
||||
#define glTestObjectAPPLE MANGLE(TestObjectAPPLE)
|
||||
#define glTexBufferEXT MANGLE(TexBufferEXT)
|
||||
#define glTexBumpParameterfvATI MANGLE(TexBumpParameterfvATI)
|
||||
#define glTexBumpParameterivATI MANGLE(TexBumpParameterivATI)
|
||||
#define glTexCoord1d MANGLE(TexCoord1d)
|
||||
|
|
@ -1121,7 +1180,9 @@
|
|||
#define glTexImage4DSGIS MANGLE(TexImage4DSGIS)
|
||||
#define glTexParameterf MANGLE(TexParameterf)
|
||||
#define glTexParameterfv MANGLE(TexParameterfv)
|
||||
#define glTexParameterIivEXT MANGLE(TexParameterIivEXT)
|
||||
#define glTexParameteri MANGLE(TexParameteri)
|
||||
#define glTexParameterIuivEXT MANGLE(TexParameterIuivEXT)
|
||||
#define glTexParameteriv MANGLE(TexParameteriv)
|
||||
#define glTexSubImage1DEXT MANGLE(TexSubImage1DEXT)
|
||||
#define glTexSubImage1D MANGLE(TexSubImage1D)
|
||||
|
|
@ -1135,6 +1196,8 @@
|
|||
#define glTextureMaterialEXT MANGLE(TextureMaterialEXT)
|
||||
#define glTextureNormalEXT MANGLE(TextureNormalEXT)
|
||||
#define glTrackMatrixNV MANGLE(TrackMatrixNV)
|
||||
#define glTransformFeedbackAttribsNV MANGLE(TransformFeedbackAttribsNV)
|
||||
#define glTransformFeedbackVaryingsNV MANGLE(TransformFeedbackVaryingsNV)
|
||||
#define glTranslated MANGLE(Translated)
|
||||
#define glTranslatef MANGLE(Translatef)
|
||||
#define glUniform1fARB MANGLE(Uniform1fARB)
|
||||
|
|
@ -1145,6 +1208,8 @@
|
|||
#define glUniform1i MANGLE(Uniform1i)
|
||||
#define glUniform1ivARB MANGLE(Uniform1ivARB)
|
||||
#define glUniform1iv MANGLE(Uniform1iv)
|
||||
#define glUniform1uiEXT MANGLE(Uniform1uiEXT)
|
||||
#define glUniform1uivEXT MANGLE(Uniform1uivEXT)
|
||||
#define glUniform2fARB MANGLE(Uniform2fARB)
|
||||
#define glUniform2f MANGLE(Uniform2f)
|
||||
#define glUniform2fvARB MANGLE(Uniform2fvARB)
|
||||
|
|
@ -1153,6 +1218,8 @@
|
|||
#define glUniform2i MANGLE(Uniform2i)
|
||||
#define glUniform2ivARB MANGLE(Uniform2ivARB)
|
||||
#define glUniform2iv MANGLE(Uniform2iv)
|
||||
#define glUniform2uiEXT MANGLE(Uniform2uiEXT)
|
||||
#define glUniform2uivEXT MANGLE(Uniform2uivEXT)
|
||||
#define glUniform3fARB MANGLE(Uniform3fARB)
|
||||
#define glUniform3f MANGLE(Uniform3f)
|
||||
#define glUniform3fvARB MANGLE(Uniform3fvARB)
|
||||
|
|
@ -1161,6 +1228,8 @@
|
|||
#define glUniform3i MANGLE(Uniform3i)
|
||||
#define glUniform3ivARB MANGLE(Uniform3ivARB)
|
||||
#define glUniform3iv MANGLE(Uniform3iv)
|
||||
#define glUniform3uiEXT MANGLE(Uniform3uiEXT)
|
||||
#define glUniform3uivEXT MANGLE(Uniform3uivEXT)
|
||||
#define glUniform4fARB MANGLE(Uniform4fARB)
|
||||
#define glUniform4f MANGLE(Uniform4f)
|
||||
#define glUniform4fvARB MANGLE(Uniform4fvARB)
|
||||
|
|
@ -1169,6 +1238,9 @@
|
|||
#define glUniform4i MANGLE(Uniform4i)
|
||||
#define glUniform4ivARB MANGLE(Uniform4ivARB)
|
||||
#define glUniform4iv MANGLE(Uniform4iv)
|
||||
#define glUniform4uiEXT MANGLE(Uniform4uiEXT)
|
||||
#define glUniform4uivEXT MANGLE(Uniform4uivEXT)
|
||||
#define glUniformBufferEXT MANGLE(UniformBufferEXT)
|
||||
#define glUniformMatrix2fvARB MANGLE(UniformMatrix2fvARB)
|
||||
#define glUniformMatrix2fv MANGLE(UniformMatrix2fv)
|
||||
#define glUniformMatrix2x3fv MANGLE(UniformMatrix2x3fv)
|
||||
|
|
@ -1340,6 +1412,27 @@
|
|||
#define glVertexAttrib4usvARB MANGLE(VertexAttrib4usvARB)
|
||||
#define glVertexAttrib4usv MANGLE(VertexAttrib4usv)
|
||||
#define glVertexAttribArrayObjectATI MANGLE(VertexAttribArrayObjectATI)
|
||||
#define glVertexAttribI1iEXT MANGLE(VertexAttribI1iEXT)
|
||||
#define glVertexAttribI1ivEXT MANGLE(VertexAttribI1ivEXT)
|
||||
#define glVertexAttribI1uiEXT MANGLE(VertexAttribI1uiEXT)
|
||||
#define glVertexAttribI1uivEXT MANGLE(VertexAttribI1uivEXT)
|
||||
#define glVertexAttribI2iEXT MANGLE(VertexAttribI2iEXT)
|
||||
#define glVertexAttribI2ivEXT MANGLE(VertexAttribI2ivEXT)
|
||||
#define glVertexAttribI2uiEXT MANGLE(VertexAttribI2uiEXT)
|
||||
#define glVertexAttribI2uivEXT MANGLE(VertexAttribI2uivEXT)
|
||||
#define glVertexAttribI3iEXT MANGLE(VertexAttribI3iEXT)
|
||||
#define glVertexAttribI3ivEXT MANGLE(VertexAttribI3ivEXT)
|
||||
#define glVertexAttribI3uiEXT MANGLE(VertexAttribI3uiEXT)
|
||||
#define glVertexAttribI3uivEXT MANGLE(VertexAttribI3uivEXT)
|
||||
#define glVertexAttribI4bvEXT MANGLE(VertexAttribI4bvEXT)
|
||||
#define glVertexAttribI4iEXT MANGLE(VertexAttribI4iEXT)
|
||||
#define glVertexAttribI4ivEXT MANGLE(VertexAttribI4ivEXT)
|
||||
#define glVertexAttribI4svEXT MANGLE(VertexAttribI4svEXT)
|
||||
#define glVertexAttribI4ubvEXT MANGLE(VertexAttribI4ubvEXT)
|
||||
#define glVertexAttribI4uiEXT MANGLE(VertexAttribI4uiEXT)
|
||||
#define glVertexAttribI4uivEXT MANGLE(VertexAttribI4uivEXT)
|
||||
#define glVertexAttribI4usvEXT MANGLE(VertexAttribI4usvEXT)
|
||||
#define glVertexAttribIPointerEXT MANGLE(VertexAttribIPointerEXT)
|
||||
#define glVertexAttribPointerARB MANGLE(VertexAttribPointerARB)
|
||||
#define glVertexAttribPointer MANGLE(VertexAttribPointer)
|
||||
#define glVertexAttribPointerNV MANGLE(VertexAttribPointerNV)
|
||||
|
|
|
|||
|
|
@ -44,9 +44,17 @@
|
|||
#define GLAPIENTRYP GLAPIENTRY *
|
||||
#endif
|
||||
|
||||
#ifndef GLAPI
|
||||
#define GLAPI
|
||||
#endif
|
||||
#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32)
|
||||
# undef GLAPI
|
||||
# define GLAPI __declspec(dllexport)
|
||||
#elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL)
|
||||
/* tag specifying we're building for DLL runtime support */
|
||||
# undef GLAPI
|
||||
# define GLAPI __declspec(dllimport)
|
||||
#elif !defined(GLAPI)
|
||||
/* for use with static link lib build of Win32 edition only */
|
||||
# define GLAPI extern
|
||||
#endif /* _STATIC_MESA support */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@
|
|||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
#include <GL/mesa_wgl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
@ -115,7 +119,7 @@ extern _CRTIMP void __cdecl exit(int);
|
|||
#endif
|
||||
|
||||
/* GLUT API entry point declarations for Win32. */
|
||||
#if defined(GLUT_BUILDING_LIB) && defined(_DLL)
|
||||
#if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && defined(_DLL)
|
||||
# define GLUTAPI __declspec(dllexport)
|
||||
#elif defined(_DLL)
|
||||
# define GLUTAPI __declspec(dllimport)
|
||||
|
|
@ -130,9 +134,12 @@ extern _CRTIMP void __cdecl exit(int);
|
|||
# pragma message( "----: being multiply defined you should include WINDOWS.H priot to gl/glut.h" )
|
||||
# endif
|
||||
# define CALLBACK __stdcall
|
||||
typedef int (GLUTAPIENTRY *PROC)();
|
||||
typedef void *HGLRC;
|
||||
typedef void *HDC;
|
||||
|
||||
#if !defined(__MINGW32__)
|
||||
typedef int (GLUTAPIENTRY *PROC)();
|
||||
typedef void *HGLRC;
|
||||
typedef void *HDC;
|
||||
#endif
|
||||
typedef unsigned long COLORREF;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ typedef void (GLUTCALLBACK *GLUTmenuStatusFCB) (int *, int *, int *);
|
|||
typedef void (GLUTCALLBACK *GLUTidleFCB) (void);
|
||||
|
||||
/* Functions that set and return Fortran callback functions. */
|
||||
GLUTAPI void* APIENTRY __glutGetFCB(int which);
|
||||
GLUTAPI void APIENTRY __glutSetFCB(int which, void *func);
|
||||
GLUTAPI GLUTproc APIENTRY __glutGetFCB(int which);
|
||||
GLUTAPI void APIENTRY __glutSetFCB(int which, GLUTproc func);
|
||||
|
||||
#endif /* __glutf90_h__ */
|
||||
|
|
|
|||
|
|
@ -26,11 +26,12 @@
|
|||
/* prototypes for the Mesa WGL functions */
|
||||
/* relocated here so that I could make GLUT get them properly */
|
||||
|
||||
#define _mesa_wgl_h_
|
||||
|
||||
#ifndef _mesa_wgl_h_
|
||||
#define _mesa_wgl_h_
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
# define __W32API_USE_DLLIMPORT__
|
||||
#endif
|
||||
|
||||
#include <GL/gl.h>
|
||||
|
||||
|
|
@ -39,23 +40,16 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
|
||||
#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN32__))
|
||||
# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
|
||||
# define GLAPI __declspec(dllexport)
|
||||
# define WGLAPI __declspec(dllexport)
|
||||
# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
|
||||
# define GLAPI __declspec(dllimport)
|
||||
# define WGLAPI __declspec(dllimport)
|
||||
# else /* for use with static link lib build of Win32 edition only */
|
||||
# define GLAPI extern
|
||||
# define WGLAPI __declspec(dllimport)
|
||||
# endif /* _STATIC_MESA support */
|
||||
# define GLAPIENTRY __stdcall
|
||||
#else
|
||||
/* non-Windows compilation */
|
||||
# define GLAPI extern
|
||||
# define GLAPIENTRY
|
||||
#endif /* WIN32 / CYGWIN32 bracket */
|
||||
#ifndef WGLAPI
|
||||
#define WGLAPI GLAPI
|
||||
#endif
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
# ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN 1
|
||||
# endif
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP)
|
||||
|
|
@ -80,23 +74,23 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC
|
|||
# pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */
|
||||
#endif
|
||||
|
||||
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC);
|
||||
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC,HGLRC);
|
||||
|
||||
WGLAPI int GLAPIENTRY wglSetPixelFormat(HDC, int, const PIXELFORMATDESCRIPTOR *);
|
||||
WGLAPI int GLAPIENTRY wglSwapBuffers(HDC hdc);
|
||||
WGLAPI HDC GLAPIENTRY wglGetCurrentDC(void);
|
||||
WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *);
|
||||
WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR);
|
||||
WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc);
|
||||
|
||||
WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
|
||||
WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC);
|
||||
WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int);
|
||||
WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
|
||||
WGLAPI PROC GLAPIENTRY wglGetProcAddress(const char*);
|
||||
WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *);
|
||||
WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
|
||||
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC);
|
||||
WGLAPI int GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR);
|
||||
WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR);
|
||||
WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
|
||||
WGLAPI HDC GLAPIENTRY wglGetCurrentDC(void);
|
||||
WGLAPI int GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *);
|
||||
WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc);
|
||||
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC, HGLRC);
|
||||
WGLAPI PROC GLAPIENTRY wglGetProcAddress(const char*);
|
||||
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC,HGLRC);
|
||||
WGLAPI int GLAPIENTRY wglRealizeLayerPalette(HDC, int, int);
|
||||
WGLAPI int GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *);
|
||||
WGLAPI int GLAPIENTRY wglShareLists(HGLRC, HGLRC);
|
||||
|
|
@ -105,12 +99,14 @@ WGLAPI int GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, un
|
|||
WGLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long);
|
||||
WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
|
||||
WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
|
||||
|
||||
#ifndef __MINGW32__
|
||||
WGLAPI int GLAPIENTRY SwapBuffers(HDC);
|
||||
WGLAPI int GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *);
|
||||
WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR);
|
||||
WGLAPI int GLAPIENTRY GetPixelFormat(HDC);
|
||||
WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef WGL_ARB_extensions_string
|
||||
#define WGL_ARB_extensions_string 1
|
||||
|
|
|
|||
13
progs/demos/.gitignore
vendored
13
progs/demos/.gitignore
vendored
|
|
@ -1,17 +1,24 @@
|
|||
.cvsignore
|
||||
arbfplight
|
||||
arbfslight
|
||||
arbocclude
|
||||
bounce
|
||||
clearspd
|
||||
cubemap
|
||||
drawpix
|
||||
engine
|
||||
extfuncs.h
|
||||
fire
|
||||
fogcoord
|
||||
fplight
|
||||
fslight
|
||||
gamma
|
||||
gearbox
|
||||
gears
|
||||
geartrain
|
||||
glinfo
|
||||
gloss
|
||||
glslnoise
|
||||
gltestperf
|
||||
glutfx
|
||||
ipers
|
||||
|
|
@ -33,8 +40,11 @@ renormal
|
|||
shadowtex
|
||||
showbuffer.c
|
||||
showbuffer.h
|
||||
singlebuffer
|
||||
spriteblast
|
||||
spectex
|
||||
stex3d
|
||||
streaming_rect
|
||||
teapot
|
||||
terrain
|
||||
tessdemo
|
||||
|
|
@ -42,7 +52,10 @@ texcyl
|
|||
texdown
|
||||
texenv
|
||||
texobj
|
||||
trackball.c
|
||||
trackball.h
|
||||
trispd
|
||||
tunnel
|
||||
tunnel2
|
||||
vao_demo
|
||||
winpos
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ PROGS = \
|
|||
arbocclude \
|
||||
bounce \
|
||||
clearspd \
|
||||
copypix \
|
||||
cubemap \
|
||||
drawpix \
|
||||
engine \
|
||||
|
|
@ -153,6 +154,10 @@ fslight.o: fslight.c extfuncs.h
|
|||
|
||||
|
||||
|
||||
viewdds: viewdds.c
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $< readtex.o $(APP_LIB_DEPS) -L. -lgltc -o $@
|
||||
|
||||
|
||||
clean:
|
||||
-rm -f $(PROGS)
|
||||
-rm -f *.o *~
|
||||
|
|
|
|||
248
progs/demos/copypix.c
Normal file
248
progs/demos/copypix.c
Normal file
|
|
@ -0,0 +1,248 @@
|
|||
/**
|
||||
* glCopyPixels test
|
||||
*
|
||||
* Brian Paul
|
||||
* 14 Sep 2007
|
||||
*/
|
||||
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
#include "readtex.h"
|
||||
|
||||
#define IMAGE_FILE "../images/arch.rgb"
|
||||
|
||||
static int ImgWidth, ImgHeight;
|
||||
static GLenum ImgFormat;
|
||||
static GLubyte *Image = NULL;
|
||||
|
||||
static int WinWidth = 800, WinHeight = 800;
|
||||
static int Xpos, Ypos;
|
||||
static int Scissor = 0;
|
||||
static float Xzoom, Yzoom;
|
||||
static GLboolean DrawFront = GL_FALSE;
|
||||
static GLboolean Dither = GL_TRUE;
|
||||
|
||||
|
||||
static void Reset( void )
|
||||
{
|
||||
Xpos = Ypos = 20;
|
||||
Scissor = 0;
|
||||
Xzoom = Yzoom = 1.0;
|
||||
}
|
||||
|
||||
|
||||
static void Display( void )
|
||||
{
|
||||
const int dx = (WinWidth - ImgWidth) / 2;
|
||||
const int dy = (WinHeight - ImgHeight) / 2;
|
||||
|
||||
if (DrawFront) {
|
||||
glDrawBuffer(GL_FRONT);
|
||||
glReadBuffer(GL_FRONT);
|
||||
}
|
||||
else {
|
||||
glDrawBuffer(GL_BACK);
|
||||
glReadBuffer(GL_BACK);
|
||||
}
|
||||
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
/* draw original image */
|
||||
glWindowPos2iARB(dx, dy);
|
||||
glDrawPixels(ImgWidth, ImgHeight, ImgFormat, GL_UNSIGNED_BYTE, Image);
|
||||
|
||||
if (Scissor)
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
/* draw copy */
|
||||
glPixelZoom(Xzoom, Yzoom);
|
||||
glWindowPos2iARB(Xpos, Ypos);
|
||||
glCopyPixels(dx, dy, ImgWidth, ImgHeight, GL_COLOR);
|
||||
glPixelZoom(1, 1);
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
|
||||
if (DrawFront)
|
||||
glFinish();
|
||||
else
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
WinWidth = width;
|
||||
WinHeight = height;
|
||||
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glOrtho( 0.0, width, 0.0, height, 0.0, 2.0 );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
glScissor(width/4, height/4, width/2, height/2);
|
||||
}
|
||||
|
||||
|
||||
static void Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case ' ':
|
||||
Reset();
|
||||
break;
|
||||
case 'd':
|
||||
Dither = !Dither;
|
||||
if (Dither)
|
||||
glEnable(GL_DITHER);
|
||||
else
|
||||
glDisable(GL_DITHER);
|
||||
break;
|
||||
case 's':
|
||||
Scissor = !Scissor;
|
||||
break;
|
||||
case 'x':
|
||||
Xzoom -= 0.1;
|
||||
break;
|
||||
case 'X':
|
||||
Xzoom += 0.1;
|
||||
break;
|
||||
case 'y':
|
||||
Yzoom -= 0.1;
|
||||
break;
|
||||
case 'Y':
|
||||
Yzoom += 0.1;
|
||||
break;
|
||||
case 'f':
|
||||
DrawFront = !DrawFront;
|
||||
printf("glDrawBuffer(%s)\n", DrawFront ? "GL_FRONT" : "GL_BACK");
|
||||
break;
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void SpecialKey( int key, int x, int y )
|
||||
{
|
||||
const int step = (glutGetModifiers() & GLUT_ACTIVE_SHIFT) ? 10 : 1;
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case GLUT_KEY_UP:
|
||||
Ypos += step;
|
||||
break;
|
||||
case GLUT_KEY_DOWN:
|
||||
Ypos -= step;
|
||||
break;
|
||||
case GLUT_KEY_LEFT:
|
||||
Xpos -= step;
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
Xpos += step;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void Init( GLboolean ciMode, const char *filename )
|
||||
{
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
||||
Image = LoadRGBImage( filename, &ImgWidth, &ImgHeight, &ImgFormat );
|
||||
if (!Image) {
|
||||
printf("Couldn't read %s\n", filename);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (ciMode) {
|
||||
/* Convert RGB image to grayscale */
|
||||
GLubyte *indexImage = (GLubyte *) malloc( ImgWidth * ImgHeight );
|
||||
GLint i;
|
||||
for (i=0; i<ImgWidth*ImgHeight; i++) {
|
||||
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];
|
||||
indexImage[i] = gray / 3;
|
||||
}
|
||||
free(Image);
|
||||
Image = indexImage;
|
||||
ImgFormat = GL_COLOR_INDEX;
|
||||
|
||||
for (i=0;i<255;i++) {
|
||||
float g = i / 255.0;
|
||||
glutSetColor(i, g, g, g);
|
||||
}
|
||||
}
|
||||
|
||||
printf("Loaded %d by %d image\n", ImgWidth, ImgHeight );
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, ImgWidth);
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
|
||||
static void Usage(void)
|
||||
{
|
||||
printf("Keys:\n");
|
||||
printf(" SPACE Reset Parameters\n");
|
||||
printf(" Up/Down Move image up/down (SHIFT for large step)\n");
|
||||
printf(" Left/Right Move image left/right (SHIFT for large step)\n");
|
||||
printf(" x Decrease X-axis PixelZoom\n");
|
||||
printf(" X Increase X-axis PixelZoom\n");
|
||||
printf(" y Decrease Y-axis PixelZoom\n");
|
||||
printf(" Y Increase Y-axis PixelZoom\n");
|
||||
printf(" s Toggle GL_SCISSOR_TEST\n");
|
||||
printf(" f Toggle front/back buffer drawing\n");
|
||||
printf(" ESC Exit\n");
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
GLboolean ciMode = GL_FALSE;
|
||||
const char *filename = IMAGE_FILE;
|
||||
int i = 1;
|
||||
|
||||
if (argc > i && strcmp(argv[i], "-ci")==0) {
|
||||
ciMode = GL_TRUE;
|
||||
i++;
|
||||
}
|
||||
if (argc > i) {
|
||||
filename = argv[i];
|
||||
}
|
||||
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( WinWidth, WinHeight );
|
||||
|
||||
if (ciMode)
|
||||
glutInitDisplayMode( GLUT_INDEX | GLUT_DOUBLE );
|
||||
else
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
|
||||
|
||||
glutCreateWindow(argv[0]);
|
||||
|
||||
Init(ciMode, filename);
|
||||
Usage();
|
||||
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutSpecialFunc( SpecialKey );
|
||||
glutDisplayFunc( Display );
|
||||
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -47,6 +47,8 @@ static GLfloat Xrot = 0, Yrot = 0;
|
|||
static GLfloat EyeDist = 10;
|
||||
static GLboolean use_vertex_arrays = GL_FALSE;
|
||||
static GLboolean anim = GL_TRUE;
|
||||
static GLboolean NoClear = GL_FALSE;
|
||||
static GLint FrameParity = 0;
|
||||
|
||||
#define eps1 0.99
|
||||
#define br 20.0 /* box radius */
|
||||
|
|
@ -156,7 +158,30 @@ static void draw_skybox( void )
|
|||
|
||||
static void draw( void )
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
if (NoClear) {
|
||||
/* This demonstrates how we can avoid calling glClear.
|
||||
* This method only works if every pixel in the window is painted for
|
||||
* every frame.
|
||||
* We can simply skip clearing of the color buffer in this case.
|
||||
* For the depth buffer, we alternately use a different subrange of
|
||||
* the depth buffer for each frame. For the odd frame use the range
|
||||
* [0, 0.5] with GL_LESS. For the even frames, use the range [1, 0.5]
|
||||
* with GL_GREATER.
|
||||
*/
|
||||
FrameParity = 1 - FrameParity;
|
||||
if (FrameParity) {
|
||||
glDepthRange(0.0, 0.5);
|
||||
glDepthFunc(GL_LESS);
|
||||
}
|
||||
else {
|
||||
glDepthRange(1.0, 0.5);
|
||||
glDepthFunc(GL_GREATER);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* ordinary clearing */
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
glPushMatrix(); /*MODELVIEW*/
|
||||
glTranslatef( 0.0, 0.0, -EyeDist );
|
||||
|
|
@ -452,6 +477,24 @@ static void usage(void)
|
|||
}
|
||||
|
||||
|
||||
static void parse_args(int argc, char *argv[])
|
||||
{
|
||||
int initFlag = 0;
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-i") == 0)
|
||||
initFlag = 1;
|
||||
else if (strcmp(argv[i], "--noclear") == 0)
|
||||
NoClear = GL_TRUE;
|
||||
else {
|
||||
fprintf(stderr, "Bad option: %s\n", argv[i]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
init (initFlag);
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
|
|
@ -459,17 +502,13 @@ int main( int argc, char *argv[] )
|
|||
glutInitWindowSize(600, 500);
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
|
||||
glutCreateWindow("Texture Cube Mapping");
|
||||
|
||||
if (argc > 1 && strcmp(argv[1] , "-i") == 0)
|
||||
init( 1 );
|
||||
else
|
||||
init( 0 );
|
||||
glutReshapeFunc( reshape );
|
||||
glutKeyboardFunc( key );
|
||||
glutSpecialFunc( specialkey );
|
||||
glutDisplayFunc( draw );
|
||||
if (anim)
|
||||
glutIdleFunc(idle);
|
||||
parse_args(argc, argv);
|
||||
usage();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -1053,6 +1053,7 @@ main (int argc, char *argv[])
|
|||
else
|
||||
file = argv[1];
|
||||
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowPosition (0, 0);
|
||||
glutInitWindowSize(640,480);
|
||||
glutInitDisplayMode (GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE );
|
||||
|
|
|
|||
|
|
@ -569,6 +569,7 @@ main(int ac, char **av)
|
|||
if (ac == 2)
|
||||
frontbuffer = 0;
|
||||
|
||||
glutInit(&ac, av);
|
||||
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
|
||||
glutInitWindowPosition(0, 0);
|
||||
glutInitWindowSize(640, 480);
|
||||
|
|
|
|||
|
|
@ -1042,6 +1042,7 @@ int main(int argc, char **argv)
|
|||
|
||||
read_surface( "isosurf.dat" );
|
||||
|
||||
glutInit( &argc, argv);
|
||||
glutInitWindowPosition(0, 0);
|
||||
glutInitWindowSize(400, 400);
|
||||
|
||||
|
|
|
|||
|
|
@ -826,7 +826,7 @@ static void pinit(void)
|
|||
|
||||
}
|
||||
|
||||
static void INIT(void)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
printf("Morph 3D - Shows morphing platonic polyhedra\n");
|
||||
printf("Author: Marcelo Fernandes Vianna (vianna@cat.cbpf.br)\n\n");
|
||||
|
|
@ -841,6 +841,7 @@ static void INIT(void)
|
|||
|
||||
object=1;
|
||||
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowPosition(0,0);
|
||||
glutInitWindowSize(640,480);
|
||||
|
||||
|
|
@ -888,9 +889,3 @@ static void INIT(void)
|
|||
glutMainLoop();
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
INIT();
|
||||
return(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -333,13 +333,13 @@ menu(int option)
|
|||
smooth = 0;
|
||||
break;
|
||||
case 10:
|
||||
glPointSize(4.0);
|
||||
glPointSize(16.0);
|
||||
break;
|
||||
case 11:
|
||||
glPointSize(8.0);
|
||||
glPointSize(32.0);
|
||||
break;
|
||||
case 12:
|
||||
glPointSize(16.0);
|
||||
glPointSize(64.0);
|
||||
break;
|
||||
case 13:
|
||||
spin = 1 - spin;
|
||||
|
|
@ -411,19 +411,19 @@ key(unsigned char c, int x, int y)
|
|||
glutPostRedisplay();
|
||||
break;
|
||||
case '1':
|
||||
glPointSize(2.0);
|
||||
glPointSize(16.0);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case '2':
|
||||
glPointSize(4.0);
|
||||
glPointSize(32.0);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case '3':
|
||||
glPointSize(8.0);
|
||||
glPointSize(64.0);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case '4':
|
||||
glPointSize(16.0);
|
||||
glPointSize(128.0);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 27:
|
||||
|
|
@ -526,9 +526,9 @@ main(int argc, char **argv)
|
|||
glutAddMenuEntry("Threshold 10", 7);
|
||||
glutAddMenuEntry("Point smooth on", 8);
|
||||
glutAddMenuEntry("Point smooth off", 9);
|
||||
glutAddMenuEntry("Point size 4", 10);
|
||||
glutAddMenuEntry("Point size 8", 11);
|
||||
glutAddMenuEntry("Point size 16", 12);
|
||||
glutAddMenuEntry("Point size 16", 10);
|
||||
glutAddMenuEntry("Point size 32", 11);
|
||||
glutAddMenuEntry("Point size 64", 12);
|
||||
glutAddMenuEntry("Toggle spin", 13);
|
||||
glutAddMenuEntry("200 points ", 14);
|
||||
glutAddMenuEntry("500 points ", 15);
|
||||
|
|
@ -544,7 +544,7 @@ main(int argc, char **argv)
|
|||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glPointSize(16.0);
|
||||
glPointSize(32.0);
|
||||
#ifdef GL_ARB_point_parameters
|
||||
glPointParameterfvARB(GL_POINT_DISTANCE_ATTENUATION_ARB, theQuad);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ static void init( void )
|
|||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowPosition(0, 0);
|
||||
glutInitWindowSize(500, 500);
|
||||
glutInitDisplayMode( GLUT_RGB );
|
||||
|
|
|
|||
|
|
@ -23,11 +23,21 @@
|
|||
#include <GL/glfbdev.h>
|
||||
#include <math.h>
|
||||
|
||||
#define DEFAULT_DEPTH 8
|
||||
|
||||
/**
|
||||
* Choose one of these modes
|
||||
*/
|
||||
/*static const int XRes = 1280, YRes = 1024, Hz = 75;*/
|
||||
/*static const int XRes = 1280, YRes = 1024, Hz = 70;*/
|
||||
/*static const int XRes = 1280, YRes = 1024, Hz = 60;*/
|
||||
static const int XRes = 1024, YRes = 768, Hz = 70;
|
||||
|
||||
static int DesiredDepth = 32;
|
||||
|
||||
static int NumFrames = 100;
|
||||
|
||||
static struct fb_fix_screeninfo FixedInfo;
|
||||
static struct fb_var_screeninfo VarInfo, OrigVarInfo;
|
||||
static int DesiredDepth = 0;
|
||||
static int OriginalVT = -1;
|
||||
static int ConsoleFD = -1;
|
||||
static int FrameBufferFD = -1;
|
||||
|
|
@ -227,7 +237,6 @@ initialize_fbdev( void )
|
|||
VarInfo = OrigVarInfo;
|
||||
|
||||
/* set the depth, resolution, etc */
|
||||
DesiredDepth = 32;
|
||||
if (DesiredDepth)
|
||||
VarInfo.bits_per_pixel = DesiredDepth;
|
||||
|
||||
|
|
@ -251,16 +260,60 @@ initialize_fbdev( void )
|
|||
VarInfo.blue.length = 8;
|
||||
VarInfo.transp.length = 8;
|
||||
}
|
||||
/* timing values taken from /etc/fb.modes (1280x1024 @ 75Hz) */
|
||||
VarInfo.xres_virtual = VarInfo.xres = 1280;
|
||||
VarInfo.yres_virtual = VarInfo.yres = 1024;
|
||||
VarInfo.pixclock = 7408;
|
||||
VarInfo.left_margin = 248;
|
||||
VarInfo.right_margin = 16;
|
||||
VarInfo.upper_margin = 38;
|
||||
VarInfo.lower_margin = 1;
|
||||
VarInfo.hsync_len = 144;
|
||||
VarInfo.vsync_len = 3;
|
||||
|
||||
/* timing values taken from /etc/fb.modes */
|
||||
if (XRes == 1280 && YRes == 1024) {
|
||||
VarInfo.xres_virtual = VarInfo.xres = XRes;
|
||||
VarInfo.yres_virtual = VarInfo.yres = YRes;
|
||||
if (Hz == 75) {
|
||||
VarInfo.pixclock = 7408;
|
||||
VarInfo.left_margin = 248;
|
||||
VarInfo.right_margin = 16;
|
||||
VarInfo.upper_margin = 38;
|
||||
VarInfo.lower_margin = 1;
|
||||
VarInfo.hsync_len = 144;
|
||||
VarInfo.vsync_len = 3;
|
||||
}
|
||||
else if (Hz == 70) {
|
||||
VarInfo.pixclock = 7937;
|
||||
VarInfo.left_margin = 216;
|
||||
VarInfo.right_margin = 80;
|
||||
VarInfo.upper_margin = 36;
|
||||
VarInfo.lower_margin = 1;
|
||||
VarInfo.hsync_len = 112;
|
||||
VarInfo.vsync_len = 5;
|
||||
}
|
||||
else if (Hz == 60) {
|
||||
VarInfo.pixclock = 9260;
|
||||
VarInfo.left_margin = 248;
|
||||
VarInfo.right_margin = 48;
|
||||
VarInfo.upper_margin = 38;
|
||||
VarInfo.lower_margin = 1;
|
||||
VarInfo.hsync_len = 112;
|
||||
VarInfo.vsync_len = 3;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "invalid rate for 1280x1024\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else if (XRes == 1024 && YRes == 768 && Hz == 70) {
|
||||
VarInfo.xres_virtual = VarInfo.xres = XRes;
|
||||
VarInfo.yres_virtual = VarInfo.yres = YRes;
|
||||
if (Hz == 70) {
|
||||
VarInfo.pixclock = 13334;
|
||||
VarInfo.left_margin = 144;
|
||||
VarInfo.right_margin = 24;
|
||||
VarInfo.upper_margin = 29;
|
||||
VarInfo.lower_margin = 3;
|
||||
VarInfo.hsync_len = 136;
|
||||
VarInfo.vsync_len = 6;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "invalid rate for 1024x768\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
VarInfo.xoffset = 0;
|
||||
VarInfo.yoffset = 0;
|
||||
|
|
@ -338,7 +391,7 @@ initialize_fbdev( void )
|
|||
printf("MMIOAddress = %p\n", MMIOAddress);
|
||||
|
||||
/* try out some simple MMIO register reads */
|
||||
if (1)
|
||||
if (0)
|
||||
{
|
||||
typedef unsigned int CARD32;
|
||||
typedef unsigned char CARD8;
|
||||
|
|
@ -452,6 +505,7 @@ gltest( void )
|
|||
GLFBDevVisualPtr vis;
|
||||
int bytes, r, g, b, a;
|
||||
float ang;
|
||||
int i;
|
||||
|
||||
printf("GLFBDEV_VENDOR = %s\n", glFBDevGetString(GLFBDEV_VENDOR));
|
||||
printf("GLFBDEV_VERSION = %s\n", glFBDevGetString(GLFBDEV_VERSION));
|
||||
|
|
@ -491,13 +545,17 @@ gltest( void )
|
|||
glEnable(GL_LIGHT0);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
for (ang = 0; ang <= 180; ang += 15) {
|
||||
printf("Drawing %d frames...\n", NumFrames);
|
||||
|
||||
ang = 0.0;
|
||||
for (i = 0; i < NumFrames; i++) {
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glPushMatrix();
|
||||
glRotatef(ang, 1, 0, 0);
|
||||
doughnut(1, 3, 40, 20);
|
||||
glPopMatrix();
|
||||
glFBDevSwapBuffers(buf);
|
||||
ang += 15.0;
|
||||
}
|
||||
|
||||
/* clean up */
|
||||
|
|
@ -510,12 +568,29 @@ gltest( void )
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
parse_args(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-f") == 0) {
|
||||
NumFrames = atoi(argv[i+1]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main( int argc, char *argv[] )
|
||||
{
|
||||
signal(SIGUSR1, signal_handler); /* exit if someone tries a vt switch */
|
||||
signal(SIGSEGV, signal_handler); /* catch segfaults */
|
||||
|
||||
parse_args(argc, argv);
|
||||
|
||||
printf("Setting mode to %d x %d @ %d Hz, %d bpp\n", XRes, YRes, Hz, DesiredDepth);
|
||||
initialize_fbdev();
|
||||
gltest();
|
||||
shutdown_fbdev();
|
||||
|
|
|
|||
|
|
@ -8,13 +8,16 @@ INCDIR = $(TOP)/include
|
|||
LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
|
||||
|
||||
PROGS = \
|
||||
bitmap \
|
||||
brick \
|
||||
bump \
|
||||
deriv \
|
||||
mandelbrot \
|
||||
noise \
|
||||
points \
|
||||
texdemo1 \
|
||||
toyball \
|
||||
texdemo1
|
||||
trirast
|
||||
|
||||
|
||||
##### RULES #####
|
||||
|
|
@ -48,12 +51,16 @@ readtex.h: $(TOP)/progs/util/readtex.h
|
|||
readtex.o: readtex.c readtex.h
|
||||
$(CC) -c -I$(INCDIR) $(CFLAGS) readtex.c
|
||||
|
||||
bitmap.c: extfuncs.h
|
||||
|
||||
brick.c: extfuncs.h
|
||||
|
||||
bump.c: extfuncs.h
|
||||
|
||||
mandelbrot.c: extfuncs.h
|
||||
|
||||
points.c: extfuncs.h
|
||||
|
||||
toyball.c: extfuncs.h
|
||||
|
||||
texdemo1: texdemo1.o readtex.o
|
||||
|
|
|
|||
368
progs/glsl/bitmap.c
Normal file
368
progs/glsl/bitmap.c
Normal file
|
|
@ -0,0 +1,368 @@
|
|||
/**
|
||||
* Implement glRasterPos + glBitmap with textures + shaders.
|
||||
* Brian Paul
|
||||
* 14 May 2007
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
|
||||
|
||||
static GLuint FragShader;
|
||||
static GLuint VertShader;
|
||||
static GLuint Program;
|
||||
|
||||
static GLint Win = 0;
|
||||
static GLint WinWidth = 500, WinHeight = 500;
|
||||
static GLboolean Anim = GL_TRUE;
|
||||
static GLboolean Bitmap = GL_FALSE;
|
||||
static GLfloat Xrot = 20.0f, Yrot = 70.0f;
|
||||
static GLint uTex, uScale;
|
||||
static GLuint Textures[2];
|
||||
|
||||
#define TEX_WIDTH 16
|
||||
#define TEX_HEIGHT 8
|
||||
|
||||
|
||||
static void
|
||||
BitmapText(const char *s)
|
||||
{
|
||||
while (*s) {
|
||||
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Redisplay(void)
|
||||
{
|
||||
static const GLfloat px[3] = { 1.2, 0, 0};
|
||||
static const GLfloat nx[3] = {-1.2, 0, 0};
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(Xrot, 1.0f, 0.0f, 0.0f);
|
||||
glRotatef(Yrot, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
|
||||
glPushMatrix();
|
||||
glScalef(0.5, 0.5, 0.5);
|
||||
glutSolidDodecahedron();
|
||||
glPopMatrix();
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
|
||||
glColor3f(0, 1, 0);
|
||||
glBegin(GL_LINES);
|
||||
glVertex3f(-1, 0, 0);
|
||||
glVertex3f( 1, 0, 0);
|
||||
glEnd();
|
||||
|
||||
glColor3f(1, 1, 0);
|
||||
|
||||
if (Bitmap) {
|
||||
glRasterPos3fv(px);
|
||||
BitmapText("+X");
|
||||
glRasterPos3fv(nx);
|
||||
BitmapText("-X");
|
||||
}
|
||||
else {
|
||||
glUseProgram_func(Program);
|
||||
|
||||
/* vertex positions (deltas) depend on texture size and window size */
|
||||
if (uScale != -1) {
|
||||
glUniform2f_func(uScale,
|
||||
2.0 * TEX_WIDTH / WinWidth,
|
||||
2.0 * TEX_HEIGHT / WinHeight);
|
||||
}
|
||||
|
||||
/* draw +X */
|
||||
glBindTexture(GL_TEXTURE_2D, Textures[0]);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0); glVertex3fv(px);
|
||||
glTexCoord2f(1, 0); glVertex3fv(px);
|
||||
glTexCoord2f(1, 1); glVertex3fv(px);
|
||||
glTexCoord2f(0, 1); glVertex3fv(px);
|
||||
glEnd();
|
||||
|
||||
/* draw -X */
|
||||
glBindTexture(GL_TEXTURE_2D, Textures[1]);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0); glVertex3fv(nx);
|
||||
glTexCoord2f(1, 0); glVertex3fv(nx);
|
||||
glTexCoord2f(1, 1); glVertex3fv(nx);
|
||||
glTexCoord2f(0, 1); glVertex3fv(nx);
|
||||
glEnd();
|
||||
|
||||
glUseProgram_func(0);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Idle(void)
|
||||
{
|
||||
Yrot = glutGet(GLUT_ELAPSED_TIME) * 0.01;
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape(int width, int height)
|
||||
{
|
||||
WinWidth = width;
|
||||
WinHeight = height;
|
||||
glViewport(0, 0, width, height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0f, 0.0f, -10.0f);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Key(unsigned char key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
|
||||
switch(key) {
|
||||
case ' ':
|
||||
case 'a':
|
||||
Anim = !Anim;
|
||||
if (Anim)
|
||||
glutIdleFunc(Idle);
|
||||
else
|
||||
glutIdleFunc(NULL);
|
||||
break;
|
||||
case 'b':
|
||||
Bitmap = !Bitmap;
|
||||
if (Bitmap)
|
||||
printf("Using glBitmap\n");
|
||||
else
|
||||
printf("Using billboard texture\n");
|
||||
break;
|
||||
case 27:
|
||||
glDeleteShader_func(FragShader);
|
||||
glDeleteShader_func(VertShader);
|
||||
glDeleteProgram_func(Program);
|
||||
glutDestroyWindow(Win);
|
||||
exit(0);
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
SpecialKey(int key, int x, int y)
|
||||
{
|
||||
const GLfloat step = 0.125f;
|
||||
switch(key) {
|
||||
case GLUT_KEY_UP:
|
||||
Xrot -= step;
|
||||
break;
|
||||
case GLUT_KEY_DOWN:
|
||||
Xrot += step;
|
||||
break;
|
||||
case GLUT_KEY_LEFT:
|
||||
Yrot -= step;
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
Yrot += step;
|
||||
break;
|
||||
}
|
||||
/*printf("Xrot: %f Yrot: %f\n", Xrot, Yrot);*/
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
MakeTexImage(const char *p, GLuint texobj)
|
||||
{
|
||||
GLubyte image[TEX_HEIGHT][TEX_WIDTH];
|
||||
GLuint i, j, k;
|
||||
|
||||
for (i = 0; i < TEX_HEIGHT; i++) {
|
||||
for (j = 0; j < TEX_WIDTH; j++) {
|
||||
k = i * TEX_WIDTH + j;
|
||||
if (p[k] == ' ') {
|
||||
image[i][j] = 0;
|
||||
}
|
||||
else {
|
||||
image[i][j] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texobj);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY, TEX_WIDTH, TEX_HEIGHT, 0,
|
||||
GL_RED, GL_UNSIGNED_BYTE, image);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
MakeBitmapTextures(void)
|
||||
{
|
||||
const char *px =
|
||||
" X X "
|
||||
" X X X "
|
||||
" X X X "
|
||||
" XXXXX X "
|
||||
" X X X "
|
||||
" X X X "
|
||||
" X X "
|
||||
" X X ";
|
||||
const char *nx =
|
||||
" X X "
|
||||
" X X "
|
||||
" X X "
|
||||
" XXXXX X "
|
||||
" X X "
|
||||
" X X "
|
||||
" X X "
|
||||
" X X ";
|
||||
glGenTextures(2, Textures);
|
||||
MakeTexImage(px, Textures[0]);
|
||||
MakeTexImage(nx, Textures[1]);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
LoadAndCompileShader(GLuint shader, const char *text)
|
||||
{
|
||||
GLint stat;
|
||||
|
||||
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
|
||||
|
||||
glCompileShader_func(shader);
|
||||
|
||||
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog_func(shader, 1000, &len, log);
|
||||
fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CheckLink(GLuint prog)
|
||||
{
|
||||
GLint stat;
|
||||
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog_func(prog, 1000, &len, log);
|
||||
fprintf(stderr, "Linker error:\n%s\n", log);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
/* Fragment shader: modulate raster color by texture, discard fragments
|
||||
* with alpha < 1.0
|
||||
*/
|
||||
static const char *fragShaderText =
|
||||
"uniform sampler2D tex2d; \n"
|
||||
"void main() {\n"
|
||||
" vec4 c = texture2D(tex2d, gl_TexCoord[0].xy); \n"
|
||||
" if (c.w < 1.0) \n"
|
||||
" discard; \n"
|
||||
" gl_FragColor = c * gl_Color; \n"
|
||||
"}\n";
|
||||
/* Vertex shader: compute new vertex position based on incoming vertex pos,
|
||||
* texcoords and special scale factor.
|
||||
*/
|
||||
static const char *vertShaderText =
|
||||
"uniform vec2 scale; \n"
|
||||
"void main() {\n"
|
||||
" vec4 p = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||
" gl_Position.xy = p.xy + gl_MultiTexCoord0.xy * scale * p.w; \n"
|
||||
" gl_Position.zw = p.zw; \n"
|
||||
" gl_TexCoord[0] = gl_MultiTexCoord0; \n"
|
||||
" gl_FrontColor = gl_Color; \n"
|
||||
"}\n";
|
||||
const char *version;
|
||||
|
||||
version = (const char *) glGetString(GL_VERSION);
|
||||
if (version[0] != '2' || version[1] != '.') {
|
||||
printf("This program requires OpenGL 2.x, found %s\n", version);
|
||||
exit(1);
|
||||
}
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
FragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
|
||||
LoadAndCompileShader(FragShader, fragShaderText);
|
||||
|
||||
VertShader = glCreateShader_func(GL_VERTEX_SHADER);
|
||||
LoadAndCompileShader(VertShader, vertShaderText);
|
||||
|
||||
Program = glCreateProgram_func();
|
||||
glAttachShader_func(Program, FragShader);
|
||||
glAttachShader_func(Program, VertShader);
|
||||
glLinkProgram_func(Program);
|
||||
CheckLink(Program);
|
||||
glUseProgram_func(Program);
|
||||
|
||||
uScale = glGetUniformLocation_func(Program, "scale");
|
||||
uTex = glGetUniformLocation_func(Program, "tex2d");
|
||||
if (uTex != -1) {
|
||||
glUniform1i_func(uTex, 0); /* tex unit 0 */
|
||||
}
|
||||
|
||||
glUseProgram_func(0);
|
||||
|
||||
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_NORMALIZE);
|
||||
glEnable(GL_LIGHT0);
|
||||
|
||||
MakeBitmapTextures();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
glutDisplayFunc(Redisplay);
|
||||
if (Anim)
|
||||
glutIdleFunc(Idle);
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
305
progs/glsl/points.c
Normal file
305
progs/glsl/points.c
Normal file
|
|
@ -0,0 +1,305 @@
|
|||
/**
|
||||
* Implement smooth (AA) points with shaders.
|
||||
* A simple variation could be used for sprite points.
|
||||
* Brian Paul
|
||||
* 29 July 2007
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
|
||||
|
||||
static GLuint FragShader;
|
||||
static GLuint VertShader;
|
||||
static GLuint Program;
|
||||
|
||||
static GLint Win = 0;
|
||||
static GLint WinWidth = 500, WinHeight = 200;
|
||||
static GLfloat Xpos = 0.0f, Ypos = 0.0f;
|
||||
static GLint uViewportInv;
|
||||
static GLboolean Smooth = GL_TRUE, Blend = GL_TRUE;
|
||||
|
||||
|
||||
/**
|
||||
* Issue vertices for a "shader point".
|
||||
* The position is duplicated, only texcoords (or other vertex attrib) change.
|
||||
* The vertex program will compute the "real" quad corners.
|
||||
*/
|
||||
static void
|
||||
PointVertex3f(GLfloat x, GLfloat y, GLfloat z)
|
||||
{
|
||||
glTexCoord2f(-1, -1);
|
||||
glVertex3f(x, y, z);
|
||||
|
||||
glTexCoord2f( 1, -1);
|
||||
glVertex3f(x, y, z);
|
||||
|
||||
glTexCoord2f( 1, 1);
|
||||
glVertex3f(x, y, z);
|
||||
|
||||
glTexCoord2f(-1, 1);
|
||||
glVertex3f(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
DrawPoints(GLboolean shaderPoints)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 9; i++) {
|
||||
GLfloat x = i - 4, y = 0, z = 0;
|
||||
/* note: can't call glPointSize inside Begin/End :( */
|
||||
glPointSize( 2 + i * 5 );
|
||||
if (shaderPoints) {
|
||||
glBegin(GL_QUADS);
|
||||
PointVertex3f(x, y, z);
|
||||
glEnd();
|
||||
}
|
||||
else {
|
||||
glBegin(GL_POINTS);
|
||||
glVertex3f(x, y, z);
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Top row of points rendered convetionally,
|
||||
* bottom row rendered with shaders.
|
||||
*/
|
||||
static void
|
||||
Redisplay(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
if (Smooth)
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
else
|
||||
glDisable(GL_POINT_SMOOTH);
|
||||
|
||||
if (Blend)
|
||||
glEnable(GL_BLEND);
|
||||
else
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(Xpos, Ypos, 0);
|
||||
|
||||
/*
|
||||
* regular points
|
||||
*/
|
||||
glPushMatrix();
|
||||
glTranslatef(0, 1.2, 0);
|
||||
glUseProgram_func(0);
|
||||
DrawPoints(GL_FALSE);
|
||||
glPopMatrix();
|
||||
|
||||
/*
|
||||
* shader points
|
||||
*/
|
||||
glPushMatrix();
|
||||
glTranslatef(0, -1.2, 0);
|
||||
glUseProgram_func(Program);
|
||||
if (uViewportInv != -1) {
|
||||
glUniform2f_func(uViewportInv, 1.0 / WinWidth, 1.0 / WinHeight);
|
||||
}
|
||||
DrawPoints(GL_TRUE);
|
||||
glPopMatrix();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape(int width, int height)
|
||||
{
|
||||
WinWidth = width;
|
||||
WinHeight = height;
|
||||
glViewport(0, 0, width, height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-1.0, 1.0, -1.0, 1.0, 4.0, 30.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0f, 0.0f, -20.0f);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Key(unsigned char key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
|
||||
switch(key) {
|
||||
case 'b':
|
||||
Blend = !Blend;
|
||||
break;
|
||||
case 's':
|
||||
Smooth = !Smooth;
|
||||
break;
|
||||
case 27:
|
||||
glDeleteShader_func(FragShader);
|
||||
glDeleteShader_func(VertShader);
|
||||
glDeleteProgram_func(Program);
|
||||
glutDestroyWindow(Win);
|
||||
exit(0);
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
SpecialKey(int key, int x, int y)
|
||||
{
|
||||
const GLfloat step = 1/100.0;
|
||||
switch(key) {
|
||||
case GLUT_KEY_UP:
|
||||
Ypos += step;
|
||||
break;
|
||||
case GLUT_KEY_DOWN:
|
||||
Ypos -= step;
|
||||
break;
|
||||
case GLUT_KEY_LEFT:
|
||||
Xpos -= step;
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
Xpos += step;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
LoadAndCompileShader(GLuint shader, const char *text)
|
||||
{
|
||||
GLint stat;
|
||||
|
||||
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
|
||||
|
||||
glCompileShader_func(shader);
|
||||
|
||||
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog_func(shader, 1000, &len, log);
|
||||
fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CheckLink(GLuint prog)
|
||||
{
|
||||
GLint stat;
|
||||
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog_func(prog, 1000, &len, log);
|
||||
fprintf(stderr, "Linker error:\n%s\n", log);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
/* Fragment shader: compute distance of fragment from center of point
|
||||
* (we're using texcoords but another varying could be used).
|
||||
* if dist > 1, discard (coverage==0)
|
||||
* if dist < k, coverage = 1
|
||||
* else, coverage = func(dist)
|
||||
* Note: length() uses sqrt() and may be expensive. The distance could
|
||||
* be squared instead (with adjustments to the threshold (k) test)
|
||||
*/
|
||||
static const char *fragShaderText =
|
||||
"void main() {\n"
|
||||
" float cover; \n"
|
||||
" float k = 2.0 / gl_Point.size; \n"
|
||||
" float d = length(gl_TexCoord[0].xy); \n"
|
||||
" if (d >= 1.0) \n"
|
||||
" discard; \n"
|
||||
" if (d < 1.0 - k) \n"
|
||||
" cover = 1.0; \n"
|
||||
" else \n"
|
||||
" cover = (1.0 - d) * 0.5 * gl_Point.size; \n"
|
||||
" gl_FragColor.rgb = gl_Color.rgb; \n"
|
||||
" gl_FragColor.a = cover; \n"
|
||||
"}\n";
|
||||
/* Vertex shader: compute new vertex position based on incoming vertex pos,
|
||||
* texcoords, point size, and inverse viewport scale factor.
|
||||
* Note: should compute point size attenuation here too.
|
||||
*/
|
||||
static const char *vertShaderText =
|
||||
"uniform vec2 viewportInv; \n"
|
||||
"void main() {\n"
|
||||
" vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||
" gl_Position.xy = pos.xy + gl_MultiTexCoord0.xy * viewportInv \n"
|
||||
" * gl_Point.size * pos.w; \n"
|
||||
" gl_Position.zw = pos.zw; \n"
|
||||
" gl_TexCoord[0] = gl_MultiTexCoord0; \n"
|
||||
" gl_FrontColor = gl_Color; \n"
|
||||
"}\n";
|
||||
const char *version;
|
||||
|
||||
version = (const char *) glGetString(GL_VERSION);
|
||||
if (version[0] != '2' || version[1] != '.') {
|
||||
printf("This program requires OpenGL 2.x, found %s\n", version);
|
||||
exit(1);
|
||||
}
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
FragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
|
||||
LoadAndCompileShader(FragShader, fragShaderText);
|
||||
|
||||
VertShader = glCreateShader_func(GL_VERTEX_SHADER);
|
||||
LoadAndCompileShader(VertShader, vertShaderText);
|
||||
|
||||
Program = glCreateProgram_func();
|
||||
glAttachShader_func(Program, FragShader);
|
||||
glAttachShader_func(Program, VertShader);
|
||||
glLinkProgram_func(Program);
|
||||
CheckLink(Program);
|
||||
glUseProgram_func(Program);
|
||||
|
||||
uViewportInv = glGetUniformLocation_func(Program, "viewportInv");
|
||||
|
||||
glUseProgram_func(0);
|
||||
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
glutDisplayFunc(Redisplay);
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
326
progs/glsl/trirast.c
Normal file
326
progs/glsl/trirast.c
Normal file
|
|
@ -0,0 +1,326 @@
|
|||
/**
|
||||
* Demonstration of doing triangle rasterization with a fragment program.
|
||||
* Basic idea:
|
||||
* 1. Draw screen-aligned quad / bounding box around the triangle verts.
|
||||
* 2. For each pixel in the quad, determine if pixel is inside/outside
|
||||
* the triangle edges.
|
||||
*
|
||||
* Brian Paul
|
||||
* 1 Aug 2007
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glut.h>
|
||||
#include <GL/glext.h>
|
||||
#include "extfuncs.h"
|
||||
|
||||
|
||||
static GLint WinWidth = 300, WinHeight = 300;
|
||||
static char *FragProgFile = NULL;
|
||||
static char *VertProgFile = NULL;
|
||||
static GLuint fragShader;
|
||||
static GLuint vertShader;
|
||||
static GLuint program;
|
||||
static GLint win = 0;
|
||||
static GLboolean anim = GL_TRUE;
|
||||
static GLfloat Zrot = 0.0f;
|
||||
static GLint uv0, uv1, uv2;
|
||||
|
||||
|
||||
static const GLfloat TriVerts[3][2] = {
|
||||
{ 50, 50 },
|
||||
{ 250, 50 },
|
||||
{ 150, 250 }
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
RotateVerts(GLfloat a,
|
||||
GLuint n, const GLfloat vertsIn[][2], GLfloat vertsOut[][2])
|
||||
{
|
||||
GLuint i;
|
||||
GLfloat cx = WinWidth / 2, cy = WinHeight / 2;
|
||||
for (i = 0; i < n; i++) {
|
||||
float x = vertsIn[i][0] - cx;
|
||||
float y = vertsIn[i][1] - cy;
|
||||
|
||||
vertsOut[i][0] = x * cos(a) + y * sin(a) + cx;
|
||||
vertsOut[i][1] = -x * sin(a) + y * cos(a) + cy;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ComputeBounds(GLuint n, GLfloat vertsIn[][2],
|
||||
GLfloat *xmin, GLfloat *ymin,
|
||||
GLfloat *xmax, GLfloat *ymax)
|
||||
{
|
||||
GLuint i;
|
||||
*xmin = *xmax = vertsIn[0][0];
|
||||
*ymin = *ymax = vertsIn[0][1];
|
||||
for (i = 1; i < n; i++) {
|
||||
if (vertsIn[i][0] < *xmin)
|
||||
*xmin = vertsIn[i][0];
|
||||
else if (vertsIn[i][0] > *xmax)
|
||||
*xmax = vertsIn[i][0];
|
||||
if (vertsIn[i][1] < *ymin)
|
||||
*ymin = vertsIn[i][1];
|
||||
else if (vertsIn[i][1] > *ymax)
|
||||
*ymax = vertsIn[i][1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Redisplay(void)
|
||||
{
|
||||
GLfloat v[3][2], xmin, ymin, xmax, ymax;
|
||||
|
||||
RotateVerts(Zrot, 3, TriVerts, v);
|
||||
ComputeBounds(3, v, &xmin, &ymin, &xmax, &ymax);
|
||||
|
||||
glUniform2fv_func(uv0, 1, v[0]);
|
||||
glUniform2fv_func(uv1, 1, v[1]);
|
||||
glUniform2fv_func(uv2, 1, v[2]);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex2f(xmin, ymin);
|
||||
glVertex2f(xmax, ymin);
|
||||
glVertex2f(xmax, ymax);
|
||||
glVertex2f(xmin, ymax);
|
||||
glEnd();
|
||||
glPopMatrix();
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Idle(void)
|
||||
{
|
||||
Zrot = glutGet(GLUT_ELAPSED_TIME) * 0.0005;
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0, width, 0, height, -1, 1);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CleanUp(void)
|
||||
{
|
||||
glDeleteShader_func(fragShader);
|
||||
glDeleteShader_func(vertShader);
|
||||
glDeleteProgram_func(program);
|
||||
glutDestroyWindow(win);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Key(unsigned char key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
|
||||
switch(key) {
|
||||
case ' ':
|
||||
case 'a':
|
||||
anim = !anim;
|
||||
if (anim)
|
||||
glutIdleFunc(Idle);
|
||||
else
|
||||
glutIdleFunc(NULL);
|
||||
break;
|
||||
case 27:
|
||||
CleanUp();
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
LoadAndCompileShader(GLuint shader, const char *text)
|
||||
{
|
||||
GLint stat;
|
||||
|
||||
glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
|
||||
|
||||
glCompileShader_func(shader);
|
||||
|
||||
glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetShaderInfoLog_func(shader, 1000, &len, log);
|
||||
fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read a shader from a file.
|
||||
*/
|
||||
static void
|
||||
ReadShader(GLuint shader, const char *filename)
|
||||
{
|
||||
const int max = 100*1000;
|
||||
int n;
|
||||
char *buffer = (char*) malloc(max);
|
||||
FILE *f = fopen(filename, "r");
|
||||
if (!f) {
|
||||
fprintf(stderr, "fslight: Unable to open shader file %s\n", filename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
n = fread(buffer, 1, max, f);
|
||||
printf("fslight: read %d bytes from shader file %s\n", n, filename);
|
||||
if (n > 0) {
|
||||
buffer[n] = 0;
|
||||
LoadAndCompileShader(shader, buffer);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
CheckLink(GLuint prog)
|
||||
{
|
||||
GLint stat;
|
||||
glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
|
||||
if (!stat) {
|
||||
GLchar log[1000];
|
||||
GLsizei len;
|
||||
glGetProgramInfoLog_func(prog, 1000, &len, log);
|
||||
fprintf(stderr, "Linker error:\n%s\n", log);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
static const char *fragShaderText =
|
||||
"uniform vec2 v0, v1, v2; \n"
|
||||
"float crs(const vec2 u, const vec2 v) \n"
|
||||
"{ \n"
|
||||
" return u.x * v.y - u.y * v.x; \n"
|
||||
"} \n"
|
||||
"\n"
|
||||
"void main() {\n"
|
||||
" vec2 p = gl_FragCoord.xy; \n"
|
||||
" if (crs(v1 - v0, p - v0) >= 0 && \n"
|
||||
" crs(v2 - v1, p - v1) >= 0 && \n"
|
||||
" crs(v0 - v2, p - v2) >= 0) \n"
|
||||
" gl_FragColor = vec4(1.0); \n"
|
||||
" else \n"
|
||||
" gl_FragColor = vec4(0.5); \n"
|
||||
"}\n";
|
||||
static const char *vertShaderText =
|
||||
"void main() {\n"
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||
"}\n";
|
||||
const char *version;
|
||||
|
||||
version = (const char *) glGetString(GL_VERSION);
|
||||
if (version[0] != '2' || version[1] != '.') {
|
||||
printf("This program requires OpenGL 2.x, found %s\n", version);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
GetExtensionFuncs();
|
||||
|
||||
fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
|
||||
if (FragProgFile)
|
||||
ReadShader(fragShader, FragProgFile);
|
||||
else
|
||||
LoadAndCompileShader(fragShader, fragShaderText);
|
||||
|
||||
vertShader = glCreateShader_func(GL_VERTEX_SHADER);
|
||||
if (VertProgFile)
|
||||
ReadShader(vertShader, VertProgFile);
|
||||
else
|
||||
LoadAndCompileShader(vertShader, vertShaderText);
|
||||
|
||||
program = glCreateProgram_func();
|
||||
glAttachShader_func(program, fragShader);
|
||||
glAttachShader_func(program, vertShader);
|
||||
glLinkProgram_func(program);
|
||||
CheckLink(program);
|
||||
glUseProgram_func(program);
|
||||
|
||||
uv0 = glGetUniformLocation_func(program, "v0");
|
||||
uv1 = glGetUniformLocation_func(program, "v1");
|
||||
uv2 = glGetUniformLocation_func(program, "v2");
|
||||
printf("Uniforms: %d %d %d\n", uv0, uv1, uv2);
|
||||
|
||||
/*assert(glGetError() == 0);*/
|
||||
|
||||
glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
assert(glIsProgram_func(program));
|
||||
assert(glIsShader_func(fragShader));
|
||||
assert(glIsShader_func(vertShader));
|
||||
|
||||
glColor3f(1, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ParseOptions(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-fs") == 0) {
|
||||
FragProgFile = argv[i+1];
|
||||
}
|
||||
else if (strcmp(argv[i], "-vs") == 0) {
|
||||
VertProgFile = argv[i+1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowPosition( 0, 0);
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
win = glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Redisplay);
|
||||
if (anim)
|
||||
glutIdleFunc(Idle);
|
||||
ParseOptions(argc, argv);
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -409,6 +409,8 @@ test(GLenum type, GLint bits, const char *filename)
|
|||
|
||||
printf("Rendering %d bit/channel image: %s\n", bits, filename);
|
||||
|
||||
OSMesaColorClamp(GL_TRUE);
|
||||
|
||||
init_context();
|
||||
render_image();
|
||||
if (Gradient)
|
||||
|
|
@ -421,7 +423,7 @@ test(GLenum type, GLint bits, const char *filename)
|
|||
if (WriteFiles && filename != NULL) {
|
||||
if (type == GL_UNSIGNED_SHORT) {
|
||||
GLushort *buffer16 = (GLushort *) buffer;
|
||||
GLubyte *buffer8 = malloc(WIDTH * HEIGHT * 4);
|
||||
GLubyte *buffer8 = (GLubyte *) malloc(WIDTH * HEIGHT * 4);
|
||||
int i;
|
||||
for (i = 0; i < WIDTH * HEIGHT * 4; i++)
|
||||
buffer8[i] = buffer16[i] >> 8;
|
||||
|
|
@ -430,8 +432,9 @@ test(GLenum type, GLint bits, const char *filename)
|
|||
}
|
||||
else if (type == GL_FLOAT) {
|
||||
GLfloat *buffer32 = (GLfloat *) buffer;
|
||||
GLubyte *buffer8 = malloc(WIDTH * HEIGHT * 4);
|
||||
GLubyte *buffer8 = (GLubyte *) malloc(WIDTH * HEIGHT * 4);
|
||||
int i;
|
||||
/* colors may be outside [0,1] so we need to clamp */
|
||||
for (i = 0; i < WIDTH * HEIGHT * 4; i++)
|
||||
buffer8[i] = (GLubyte) (buffer32[i] * 255.0);
|
||||
write_ppm(filename, buffer8, WIDTH, HEIGHT);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,15 @@
|
|||
# Email : dborca@users.sourceforge.net
|
||||
# Web : http://www.geocities.com/dborca
|
||||
|
||||
# MinGW samples makefile updated for Mesa 7.0
|
||||
#
|
||||
# Updated : by Heromyth, on 2007-7-21
|
||||
# Email : zxpmyth@yahoo.com.cn
|
||||
# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
|
||||
# The others havn't been tested yet.
|
||||
# 2) The generated DLLs are *not* compatible with the ones built
|
||||
# with the other compilers like VC8, especially for GLUT.
|
||||
# 3) Although more tests are needed, it can be used individually!
|
||||
|
||||
#
|
||||
# Available options:
|
||||
|
|
@ -45,14 +54,14 @@
|
|||
TOP = ../..
|
||||
|
||||
CC = mingw32-gcc
|
||||
CFLAGS = -Wall -W -pedantic
|
||||
CFLAGS += -O2 -ffast-math
|
||||
CFLAGS = -Wall -pedantic
|
||||
CFLAGS += -O2 -ffast-math -D_DLL
|
||||
CFLAGS += -I$(TOP)/include -I../util
|
||||
ifeq ($(FX),1)
|
||||
CFLAGS += -DFX
|
||||
CFLAGS += -DFX
|
||||
endif
|
||||
CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK -D_STDCALL_SUPPORTED
|
||||
CFLAGS += -D_WINDEF_ -D_WINGDI_
|
||||
|
||||
CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK
|
||||
|
||||
LD = mingw32-g++
|
||||
LDFLAGS = -s -L$(TOP)/lib
|
||||
|
|
@ -62,7 +71,8 @@ LDLIBS = -lglut32 -lglu32 -lopengl32
|
|||
.c.o:
|
||||
$(CC) -o $@ $(CFLAGS) -c $<
|
||||
%.exe: ../util/readtex.o ../util/showbuffer.o %.o
|
||||
$(LD) -o $@ $(LDFLAGS) $^ $(LDLIBS)
|
||||
$(LD) -o $@ $(LDFLAGS) $(LDLIBS) $^
|
||||
|
||||
|
||||
all:
|
||||
$(error Must specify <filename.exe> to build)
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ SOURCES = \
|
|||
pbo.c \
|
||||
prog_parameter.c \
|
||||
projtex.c \
|
||||
random.c \
|
||||
readrate.c \
|
||||
seccolor.c \
|
||||
sharedtex.c \
|
||||
|
|
|
|||
457
progs/tests/random.c
Normal file
457
progs/tests/random.c
Normal file
|
|
@ -0,0 +1,457 @@
|
|||
/**
|
||||
* Random rendering, to check for crashes, hangs, etc.
|
||||
*
|
||||
* Brian Paul
|
||||
* 21 June 2007
|
||||
*/
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
static int Win;
|
||||
static GLboolean Anim = GL_TRUE;
|
||||
static int Width = 200, Height = 200;
|
||||
static int DB = 0;
|
||||
static int MinVertexCount = 0, MaxVertexCount = 1000;
|
||||
static int Count = 0;
|
||||
|
||||
struct vertex
|
||||
{
|
||||
int type;
|
||||
float v[4];
|
||||
};
|
||||
|
||||
static int BufferSize = 10000;
|
||||
static struct vertex *Vbuffer = NULL;
|
||||
static int Vcount, Vprim;
|
||||
|
||||
enum {
|
||||
BEGIN,
|
||||
END,
|
||||
VERTEX2,
|
||||
VERTEX3,
|
||||
VERTEX4,
|
||||
COLOR3,
|
||||
COLOR4,
|
||||
TEX2,
|
||||
TEX3,
|
||||
TEX4,
|
||||
SECCOLOR3,
|
||||
NORMAL3
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This can be called from within gdb after a crash:
|
||||
* (gdb) call ReportState()
|
||||
*/
|
||||
static void
|
||||
ReportState(void)
|
||||
{
|
||||
static const struct {
|
||||
GLenum token;
|
||||
char *str;
|
||||
GLenum type;
|
||||
} state [] = {
|
||||
{ GL_ALPHA_TEST, "GL_ALPHA_TEST", GL_INT },
|
||||
{ GL_BLEND, "GL_BLEND", GL_INT },
|
||||
{ GL_CLIP_PLANE0, "GL_CLIP_PLANE0", GL_INT },
|
||||
{ GL_DEPTH_TEST, "GL_DEPTH_TEST", GL_INT },
|
||||
{ GL_LIGHTING, "GL_LIGHTING", GL_INT },
|
||||
{ GL_LINE_WIDTH, "GL_LINE_WIDTH", GL_FLOAT },
|
||||
{ GL_POINT_SIZE, "GL_POINT_SIZE", GL_FLOAT },
|
||||
{ GL_SHADE_MODEL, "GL_SHADE_MODEL", GL_INT },
|
||||
{ GL_SCISSOR_TEST, "GL_SCISSOR_TEST", GL_INT },
|
||||
{ 0, NULL, 0 }
|
||||
};
|
||||
|
||||
GLint i;
|
||||
|
||||
for (i = 0; state[i].token; i++) {
|
||||
if (state[i].type == GL_INT) {
|
||||
GLint v;
|
||||
glGetIntegerv(state[i].token, &v);
|
||||
printf("%s = %d\n", state[i].str, v);
|
||||
}
|
||||
else {
|
||||
GLfloat v;
|
||||
glGetFloatv(state[i].token, &v);
|
||||
printf("%s = %f\n", state[i].str, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
PrintVertex(const char *f, const struct vertex *v, int sz)
|
||||
{
|
||||
int i;
|
||||
printf("%s(", f);
|
||||
for (i = 0; i < sz; i++) {
|
||||
printf("%g%s", v->v[i], (i == sz-1) ? "" : ", ");
|
||||
}
|
||||
printf(");\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* This can be called from within gdb after a crash:
|
||||
* (gdb) call ReportState()
|
||||
*/
|
||||
static void
|
||||
LastPrim(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < Vcount; i++) {
|
||||
switch (Vbuffer[i].type) {
|
||||
case BEGIN:
|
||||
printf("glBegin(%d);\n", (int) Vbuffer[i].v[0]);
|
||||
break;
|
||||
case END:
|
||||
printf("glEnd();\n");
|
||||
break;
|
||||
case VERTEX2:
|
||||
PrintVertex("glVertex2f", Vbuffer + i, 2);
|
||||
break;
|
||||
case VERTEX3:
|
||||
PrintVertex("glVertex3f", Vbuffer + i, 3);
|
||||
break;
|
||||
case VERTEX4:
|
||||
PrintVertex("glVertex4f", Vbuffer + i, 4);
|
||||
break;
|
||||
case COLOR3:
|
||||
PrintVertex("glColor3f", Vbuffer + i, 3);
|
||||
break;
|
||||
case COLOR4:
|
||||
PrintVertex("glColor4f", Vbuffer + i, 4);
|
||||
break;
|
||||
case TEX2:
|
||||
PrintVertex("glTexCoord2f", Vbuffer + i, 2);
|
||||
break;
|
||||
case TEX3:
|
||||
PrintVertex("glTexCoord3f", Vbuffer + i, 3);
|
||||
break;
|
||||
case TEX4:
|
||||
PrintVertex("glTexCoord4f", Vbuffer + i, 4);
|
||||
break;
|
||||
case SECCOLOR3:
|
||||
PrintVertex("glSecondaryColor3f", Vbuffer + i, 3);
|
||||
break;
|
||||
case NORMAL3:
|
||||
PrintVertex("glNormal3f", Vbuffer + i, 3);
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
RandomInt(int max)
|
||||
{
|
||||
if (max == 0)
|
||||
return 0;
|
||||
return rand() % max;
|
||||
}
|
||||
|
||||
static float
|
||||
RandomFloat(float min, float max)
|
||||
{
|
||||
int k = rand() % 10000;
|
||||
float x = min + (max - min) * k / 10000.0;
|
||||
return x;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return true if random number in [0,1] is <= percentile.
|
||||
*/
|
||||
static GLboolean
|
||||
RandomChoice(float percentile)
|
||||
{
|
||||
return RandomFloat(0.0, 1.0) <= percentile;
|
||||
}
|
||||
|
||||
static void
|
||||
RandomStateChange(void)
|
||||
{
|
||||
int k = RandomInt(19);
|
||||
switch (k) {
|
||||
case 0:
|
||||
glEnable(GL_BLEND);
|
||||
break;
|
||||
case 1:
|
||||
glDisable(GL_BLEND);
|
||||
break;
|
||||
case 2:
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
break;
|
||||
case 3:
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
break;
|
||||
case 4:
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
break;
|
||||
case 5:
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
break;
|
||||
case 6:
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
break;
|
||||
case 7:
|
||||
glPointSize(10.0);
|
||||
break;
|
||||
case 8:
|
||||
glPointSize(1.0);
|
||||
break;
|
||||
case 9:
|
||||
glLineWidth(10.0);
|
||||
break;
|
||||
case 10:
|
||||
glLineWidth(1.0);
|
||||
break;
|
||||
case 11:
|
||||
glEnable(GL_LIGHTING);
|
||||
break;
|
||||
case 12:
|
||||
glDisable(GL_LIGHTING);
|
||||
break;
|
||||
case 13:
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
break;
|
||||
case 14:
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
break;
|
||||
case 15:
|
||||
glEnable(GL_CLIP_PLANE0);
|
||||
break;
|
||||
case 16:
|
||||
glDisable(GL_CLIP_PLANE0);
|
||||
break;
|
||||
case 17:
|
||||
glShadeModel(GL_FLAT);
|
||||
break;
|
||||
case 18:
|
||||
glShadeModel(GL_SMOOTH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
RandomPrimitive(void)
|
||||
{
|
||||
int i;
|
||||
int len = MinVertexCount + RandomInt(MaxVertexCount - MinVertexCount);
|
||||
|
||||
Vprim = RandomInt(10);
|
||||
|
||||
glBegin(Vprim);
|
||||
Vbuffer[Vcount].type = BEGIN;
|
||||
Vbuffer[Vcount].v[0] = Vprim;
|
||||
Vcount++;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
Vbuffer[Vcount].v[0] = RandomFloat(-3, 3);
|
||||
Vbuffer[Vcount].v[1] = RandomFloat(-3, 3);
|
||||
Vbuffer[Vcount].v[2] = RandomFloat(-3, 3);
|
||||
Vbuffer[Vcount].v[3] = RandomFloat(-3, 3);
|
||||
int k = RandomInt(9);
|
||||
switch (k) {
|
||||
case 0:
|
||||
glVertex2fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = VERTEX2;
|
||||
break;
|
||||
case 1:
|
||||
glVertex3fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = VERTEX3;
|
||||
break;
|
||||
case 2:
|
||||
glVertex4fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = VERTEX4;
|
||||
break;
|
||||
case 3:
|
||||
glColor3fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = COLOR3;
|
||||
break;
|
||||
case 4:
|
||||
glColor4fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = COLOR4;
|
||||
break;
|
||||
case 5:
|
||||
glTexCoord2fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = TEX2;
|
||||
break;
|
||||
case 6:
|
||||
glTexCoord3fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = TEX3;
|
||||
break;
|
||||
case 7:
|
||||
glTexCoord4fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = TEX4;
|
||||
break;
|
||||
case 8:
|
||||
glSecondaryColor3fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = SECCOLOR3;
|
||||
break;
|
||||
case 9:
|
||||
glNormal3fv(Vbuffer[Vcount].v);
|
||||
Vbuffer[Vcount].type = NORMAL3;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
Vcount++;
|
||||
|
||||
if (Vcount >= BufferSize - 2) {
|
||||
/* reset */
|
||||
Vcount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Vbuffer[Vcount++].type = END;
|
||||
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
RandomDraw(void)
|
||||
{
|
||||
int i;
|
||||
GLboolean dlist = RandomChoice(0.1);
|
||||
if (dlist)
|
||||
glNewList(1, GL_COMPILE);
|
||||
for (i = 0; i < 3; i++) {
|
||||
RandomStateChange();
|
||||
}
|
||||
RandomPrimitive();
|
||||
|
||||
if (dlist) {
|
||||
glEndList();
|
||||
glCallList(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Idle(void)
|
||||
{
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Draw(void)
|
||||
{
|
||||
#if 1
|
||||
RandomDraw();
|
||||
Count++;
|
||||
#else
|
||||
/* cut & paste temp code here */
|
||||
#endif
|
||||
|
||||
assert(glGetError() == 0);
|
||||
|
||||
if (DB)
|
||||
glutSwapBuffers();
|
||||
else
|
||||
glFinish();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape(int width, int height)
|
||||
{
|
||||
Width = width;
|
||||
Height = height;
|
||||
glViewport(0, 0, width, height);
|
||||
glScissor(20, 20, Width-40, Height-40);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -15.0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Key(unsigned char key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
glutDestroyWindow(Win);
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
static const GLdouble plane[4] = {1, 1, 0, 0};
|
||||
glDrawBuffer(GL_FRONT);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
glEnable(GL_LIGHT0);
|
||||
glClipPlane(GL_CLIP_PLANE0, plane);
|
||||
|
||||
Vbuffer = (struct vertex *)
|
||||
malloc(BufferSize * sizeof(struct vertex));
|
||||
|
||||
/* silence warnings */
|
||||
(void) ReportState;
|
||||
(void) LastPrim;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ParseArgs(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-s") == 0) {
|
||||
int j = atoi(argv[i + 1]);
|
||||
printf("Random seed value: %d\n", j);
|
||||
srand(j);
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-a") == 0) {
|
||||
i++;
|
||||
MinVertexCount = atoi(argv[i]);
|
||||
}
|
||||
else if (strcmp(argv[i], "-b") == 0) {
|
||||
i++;
|
||||
MaxVertexCount = atoi(argv[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowPosition(0, 0);
|
||||
glutInitWindowSize(Width, Height);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
ParseArgs(argc, argv);
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Draw);
|
||||
if (Anim)
|
||||
glutIdleFunc(Idle);
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -26,6 +26,13 @@ static PFNGLISSHADERPROC glIsShader_func = NULL;
|
|||
static PFNGLLINKPROGRAMPROC glLinkProgram_func = NULL;
|
||||
static PFNGLSHADERSOURCEPROC glShaderSource_func = NULL;
|
||||
static PFNGLUNIFORM1IPROC glUniform1i_func = NULL;
|
||||
static PFNGLUNIFORM2IPROC glUniform2i_func = NULL;
|
||||
static PFNGLUNIFORM3IPROC glUniform3i_func = NULL;
|
||||
static PFNGLUNIFORM4IPROC glUniform4i_func = NULL;
|
||||
static PFNGLUNIFORM1FPROC glUniform1f_func = NULL;
|
||||
static PFNGLUNIFORM2FPROC glUniform2f_func = NULL;
|
||||
static PFNGLUNIFORM3FPROC glUniform3f_func = NULL;
|
||||
static PFNGLUNIFORM4FPROC glUniform4f_func = NULL;
|
||||
static PFNGLUNIFORM1FVPROC glUniform1fv_func = NULL;
|
||||
static PFNGLUNIFORM2FVPROC glUniform2fv_func = NULL;
|
||||
static PFNGLUNIFORM3FVPROC glUniform3fv_func = NULL;
|
||||
|
|
@ -47,6 +54,9 @@ static PFNGLUNIFORMMATRIX4X2FVPROC glUniformMatrix4x2fv_func = NULL;
|
|||
static PFNGLUNIFORMMATRIX3X4FVPROC glUniformMatrix3x4fv_func = NULL;
|
||||
static PFNGLUNIFORMMATRIX4X3FVPROC glUniformMatrix4x3fv_func = NULL;
|
||||
|
||||
/* OpenGL 1.4 */
|
||||
static PFNGLPOINTPARAMETERFVPROC glPointParameterfv_func = NULL;
|
||||
|
||||
/* GL_ARB_vertex/fragment_program */
|
||||
static PFNGLBINDPROGRAMARBPROC glBindProgramARB_func = NULL;
|
||||
static PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB_func = NULL;
|
||||
|
|
@ -94,6 +104,13 @@ GetExtensionFuncs(void)
|
|||
glLinkProgram_func = (PFNGLLINKPROGRAMPROC) glutGetProcAddress("glLinkProgram");
|
||||
glShaderSource_func = (PFNGLSHADERSOURCEPROC) glutGetProcAddress("glShaderSource");
|
||||
glUniform1i_func = (PFNGLUNIFORM1IPROC) glutGetProcAddress("glUniform1i");
|
||||
glUniform2i_func = (PFNGLUNIFORM2IPROC) glutGetProcAddress("glUniform2i");
|
||||
glUniform3i_func = (PFNGLUNIFORM3IPROC) glutGetProcAddress("glUniform3i");
|
||||
glUniform4i_func = (PFNGLUNIFORM4IPROC) glutGetProcAddress("glUniform3i");
|
||||
glUniform1f_func = (PFNGLUNIFORM1FPROC) glutGetProcAddress("glUniform1f");
|
||||
glUniform2f_func = (PFNGLUNIFORM2FPROC) glutGetProcAddress("glUniform2f");
|
||||
glUniform3f_func = (PFNGLUNIFORM3FPROC) glutGetProcAddress("glUniform3f");
|
||||
glUniform4f_func = (PFNGLUNIFORM4FPROC) glutGetProcAddress("glUniform3f");
|
||||
glUniform1fv_func = (PFNGLUNIFORM1FVPROC) glutGetProcAddress("glUniform1fv");
|
||||
glUniform2fv_func = (PFNGLUNIFORM2FVPROC) glutGetProcAddress("glUniform2fv");
|
||||
glUniform3fv_func = (PFNGLUNIFORM3FVPROC) glutGetProcAddress("glUniform3fv");
|
||||
|
|
@ -115,6 +132,8 @@ GetExtensionFuncs(void)
|
|||
glUniformMatrix3x4fv_func = (PFNGLUNIFORMMATRIX3X4FVPROC) glutGetProcAddress("glUniformMatrix3x4fv");
|
||||
glUniformMatrix4x3fv_func = (PFNGLUNIFORMMATRIX4X3FVPROC) glutGetProcAddress("glUniformMatrix4x3fv");
|
||||
|
||||
glPointParameterfv_func = (PFNGLPOINTPARAMETERFVPROC) glutGetProcAddress("glPointParameterfv");
|
||||
|
||||
/* GL_ARB_vertex/fragment_program */
|
||||
glBindProgramARB_func = (PFNGLBINDPROGRAMARBPROC) glutGetProcAddress("glBindProgramARB");
|
||||
glDeleteProgramsARB_func = (PFNGLDELETEPROGRAMSARBPROC) glutGetProcAddress("glDeleteProgramsARB");
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ PROGS = glthreads \
|
|||
.SUFFIXES: .c
|
||||
|
||||
.c: $(LIB_DEP)
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) $< $(APP_LIB_DEPS) -o $@
|
||||
$(CC) -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) $< $(APP_LIB_DEPS) -o $@
|
||||
|
||||
|
||||
##### TARGETS #####
|
||||
|
|
@ -53,32 +53,32 @@ clean:
|
|||
|
||||
# special cases
|
||||
pbinfo: pbinfo.o pbutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) pbinfo.o pbutil.o $(APP_LIB_DEPS) -o $@
|
||||
$(CC) pbinfo.o pbutil.o $(APP_LIB_DEPS) -o $@
|
||||
|
||||
pbdemo: pbdemo.o pbutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) pbdemo.o pbutil.o $(APP_LIB_DEPS) -o $@
|
||||
$(CC) pbdemo.o pbutil.o $(APP_LIB_DEPS) -o $@
|
||||
|
||||
pbinfo.o: pbinfo.c pbutil.h
|
||||
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) pbinfo.c
|
||||
$(CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) pbinfo.c
|
||||
|
||||
pbdemo.o: pbdemo.c pbutil.h
|
||||
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) pbdemo.c
|
||||
$(CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) pbdemo.c
|
||||
|
||||
pbutil.o: pbutil.c pbutil.h
|
||||
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) pbutil.c
|
||||
$(CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) pbutil.c
|
||||
|
||||
glxgears_fbconfig: glxgears_fbconfig.o pbutil.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) glxgears_fbconfig.o pbutil.o $(APP_LIB_DEPS) -o $@
|
||||
$(CC) glxgears_fbconfig.o pbutil.o $(APP_LIB_DEPS) -o $@
|
||||
|
||||
glxgears_fbconfig.o: glxgears_fbconfig.c pbutil.h
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) -c -I. $(CFLAGS) glxgears_fbconfig.c
|
||||
$(CC) -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) -c -I. $(CFLAGS) glxgears_fbconfig.c
|
||||
|
||||
xrotfontdemo: xrotfontdemo.o xuserotfont.o
|
||||
$(CC) -I$(INCDIR) $(CFLAGS) xrotfontdemo.o xuserotfont.o $(APP_LIB_DEPS) -o $@
|
||||
$(CC) xrotfontdemo.o xuserotfont.o $(APP_LIB_DEPS) -o $@
|
||||
|
||||
xuserotfont.o: xuserotfont.c xuserotfont.h
|
||||
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) xuserotfont.c
|
||||
$(CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) xuserotfont.c
|
||||
|
||||
xrotfontdemo.o: xrotfontdemo.c xuserotfont.h
|
||||
$(CC) -c -I. -I$(INCDIR) $(CFLAGS) xrotfontdemo.c
|
||||
$(CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) xrotfontdemo.c
|
||||
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ make_window( Display *dpy, const char *name,
|
|||
attr.override_redirect = fullscreen;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect;
|
||||
|
||||
win = XCreateWindow( dpy, root, 0, 0, width, height,
|
||||
win = XCreateWindow( dpy, root, x, y, width, height,
|
||||
0, visinfo->depth, InputOutput,
|
||||
visinfo->visual, mask, &attr );
|
||||
|
||||
|
|
@ -548,13 +548,16 @@ usage(void)
|
|||
printf(" -stereo run in stereo mode\n");
|
||||
printf(" -fullscreen run in fullscreen mode\n");
|
||||
printf(" -info display OpenGL renderer info\n");
|
||||
printf(" -winwidth <width> window width (default: 300)\n");
|
||||
printf(" -winheight <height> window height (default: 300)\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const int winWidth = 300, winHeight = 300;
|
||||
unsigned int winWidth = 300, winHeight = 300;
|
||||
int x = 0, y = 0;
|
||||
Display *dpy;
|
||||
Window win;
|
||||
GLXContext ctx;
|
||||
|
|
@ -576,6 +579,10 @@ main(int argc, char *argv[])
|
|||
else if (strcmp(argv[i], "-fullscreen") == 0) {
|
||||
fullscreen = GL_TRUE;
|
||||
}
|
||||
else if (i < argc-1 && strcmp(argv[i], "-geometry") == 0) {
|
||||
XParseGeometry(argv[i+1], &x, &y, &winWidth, &winHeight);
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
return -1;
|
||||
|
|
@ -589,7 +596,7 @@ main(int argc, char *argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
make_window(dpy, "glxgears", 0, 0, winWidth, winHeight, &win, &ctx);
|
||||
make_window(dpy, "glxgears", x, y, winWidth, winHeight, &win, &ctx);
|
||||
XMapWindow(dpy, win);
|
||||
glXMakeCurrent(dpy, win, ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -814,6 +814,11 @@ main(int argc, char *argv[])
|
|||
|
||||
init();
|
||||
|
||||
/* Set initial projection/viewing transformation.
|
||||
* same as glxgears.c
|
||||
*/
|
||||
reshape(300, 300);
|
||||
|
||||
event_loop(dpy, win);
|
||||
|
||||
glXDestroyContext(dpy, ctx);
|
||||
|
|
|
|||
|
|
@ -71,12 +71,12 @@ typedef Vertex Quad[4];
|
|||
|
||||
/* data to define the six faces of a unit cube */
|
||||
Quad quads[MAXQUAD] = {
|
||||
{ {0,0,0}, {1,0,0}, {1,1,0}, {0,1,0} },
|
||||
{ {0,0,1}, {1,0,1}, {1,1,1}, {0,1,1} },
|
||||
{ {0,0,0}, {1,0,0}, {1,0,1}, {0,0,1} },
|
||||
{ {0,1,0}, {1,1,0}, {1,1,1}, {0,1,1} },
|
||||
{ {0,0,0}, {0,0,1}, {0,1,1}, {0,1,0} },
|
||||
{ {1,0,0}, {1,0,1}, {1,1,1}, {1,1,0} }
|
||||
{ {0,0,0}, {0,0,1}, {0,1,1}, {0,1,0} }, /* x = 0 */
|
||||
{ {0,0,0}, {1,0,0}, {1,0,1}, {0,0,1} }, /* y = 0 */
|
||||
{ {0,0,0}, {1,0,0}, {1,1,0}, {0,1,0} }, /* z = 0 */
|
||||
{ {1,0,0}, {1,0,1}, {1,1,1}, {1,1,0} }, /* x = 1 */
|
||||
{ {0,1,0}, {1,1,0}, {1,1,1}, {0,1,1} }, /* y = 1 */
|
||||
{ {0,0,1}, {1,0,1}, {1,1,1}, {0,1,1} } /* z = 1 */
|
||||
};
|
||||
|
||||
#define WIREFRAME 0
|
||||
|
|
@ -86,7 +86,7 @@ static void error(const char* prog, const char* msg);
|
|||
static void cubes(int mx, int my, int mode);
|
||||
static void fill(Quad quad);
|
||||
static void outline(Quad quad);
|
||||
static void draw_hidden(Quad quad, int mode);
|
||||
static void draw_hidden(Quad quad, int mode, int face);
|
||||
static void process_input(Display *dpy, Window win);
|
||||
static int query_extension(char* extName);
|
||||
|
||||
|
|
@ -101,6 +101,7 @@ int main(int argc, char** argv) {
|
|||
XSetWindowAttributes swa;
|
||||
Window win;
|
||||
GLXContext cx;
|
||||
GLint z;
|
||||
|
||||
dpy = XOpenDisplay(0);
|
||||
if (!dpy) error(argv[0], "can't open display");
|
||||
|
|
@ -134,13 +135,16 @@ int main(int argc, char** argv) {
|
|||
|
||||
/* set up viewing parameters */
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
gluPerspective(20, 1, 0.1, 20);
|
||||
gluPerspective(20, 1, 10, 20);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glTranslatef(0, 0, -15);
|
||||
|
||||
/* set other relevant state information */
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glGetIntegerv(GL_DEPTH_BITS, &z);
|
||||
printf("GL_DEPTH_BITS = %d\n", z);
|
||||
|
||||
#ifdef GL_EXT_polygon_offset
|
||||
printf("using 1.0 offset extension\n");
|
||||
glPolygonOffsetEXT( 1.0, 0.00001 );
|
||||
|
|
@ -160,6 +164,7 @@ int main(int argc, char** argv) {
|
|||
|
||||
static void
|
||||
draw_scene(int mx, int my) {
|
||||
glClearColor(0.25, 0.25, 0.25, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
|
|
@ -206,7 +211,7 @@ cubes(int mx, int my, int mode) {
|
|||
glTranslatef(x, y, z);
|
||||
glScalef(0.8, 0.8, 0.8);
|
||||
for (i = 0; i < MAXQUAD; i++)
|
||||
draw_hidden(quads[i], mode);
|
||||
draw_hidden(quads[i], mode, i);
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
@ -236,13 +241,18 @@ outline(Quad quad) {
|
|||
}
|
||||
|
||||
static void
|
||||
draw_hidden(Quad quad, int mode) {
|
||||
draw_hidden(Quad quad, int mode, int face) {
|
||||
static const GLfloat colors[3][3] = {
|
||||
{0.5, 0.5, 0.0},
|
||||
{0.8, 0.5, 0.0},
|
||||
{0.0, 0.5, 0.8}
|
||||
};
|
||||
if (mode == HIDDEN_LINE) {
|
||||
glColor3f(0, 0, 0);
|
||||
glColor3fv(colors[face % 3]);
|
||||
fill(quad);
|
||||
}
|
||||
|
||||
/* draw the outline using white, optionally fill the interior with black */
|
||||
/* draw the outline using white */
|
||||
glColor3f(1, 1, 1);
|
||||
outline(quad);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
|
|||
None
|
||||
},
|
||||
{
|
||||
/* Single bufferd, without depth buffer */
|
||||
/* Single buffered, without depth buffer */
|
||||
GLX_RENDER_TYPE, GLX_RGBA_BIT,
|
||||
GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
|
||||
GLX_RED_SIZE, 1,
|
||||
|
|
@ -105,7 +105,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
|
|||
None
|
||||
},
|
||||
{
|
||||
/* Double bufferd, without depth buffer */
|
||||
/* Double buffered, without depth buffer */
|
||||
GLX_RENDER_TYPE, GLX_RGBA_BIT,
|
||||
GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
|
||||
GLX_RED_SIZE, 1,
|
||||
|
|
@ -130,9 +130,8 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
|
|||
/* Get list of possible frame buffer configurations */
|
||||
fbConfigs = ChooseFBConfig(dpy, screen, fbAttribs[attempt], &nConfigs);
|
||||
if (nConfigs==0 || !fbConfigs) {
|
||||
printf("Error: glXChooseFBConfig failed\n");
|
||||
XCloseDisplay(dpy);
|
||||
return 0;
|
||||
printf("Note: glXChooseFBConfig(%s) failed\n", fbString[attempt]);
|
||||
continue;
|
||||
}
|
||||
|
||||
#if 0 /*DEBUG*/
|
||||
|
|
|
|||
|
|
@ -13,9 +13,19 @@ default: $(TOP)/configs/current
|
|||
(cd $$dir ; $(MAKE)) ; \
|
||||
done
|
||||
|
||||
install:
|
||||
$(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLU.* $(INSTALL_DIR)/$(LIB_DIR)
|
||||
# GLU pkg-config file
|
||||
pcedit = sed \
|
||||
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
|
||||
-e 's,@LIB_DIR@,$(LIB_DIR),' \
|
||||
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),'
|
||||
glu.pc: glu.pc.in
|
||||
$(pcedit) $< > $@
|
||||
|
||||
install: glu.pc
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLU.* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
|
||||
clean:
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
|
|
|
|||
11
src/glu/glu.pc.in
Normal file
11
src/glu/glu.pc.in
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
prefix=@INSTALL_DIR@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/@LIB_DIR@
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: glu
|
||||
Description: Mesa OpenGL Utility library
|
||||
Requires: gl
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lGLU
|
||||
Cflags: -I${includedir}
|
||||
|
|
@ -23,7 +23,7 @@ C_SOURCES = \
|
|||
|
||||
OBJECTS = $(C_SOURCES:.c=.o)
|
||||
|
||||
INCLUDES = -I. -I- -I$(TOP)/include
|
||||
INCLUDES = -I. -I$(TOP)/include
|
||||
|
||||
##### RULES #####
|
||||
|
||||
|
|
|
|||
|
|
@ -346,7 +346,8 @@ gluUnProject(GLdouble winx, GLdouble winy, GLdouble winz,
|
|||
|
||||
/* calcul transformation inverse */
|
||||
matmul(A, proj, model);
|
||||
invert_matrix(A, m);
|
||||
if (!invert_matrix(A, m))
|
||||
return GL_FALSE;
|
||||
|
||||
/* d'ou les coordonnees objets */
|
||||
transform_point(out, m, in);
|
||||
|
|
@ -386,7 +387,8 @@ gluUnProject4(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble clipw,
|
|||
|
||||
/* calcul transformation inverse */
|
||||
matmul(A, projMatrix, modelMatrix);
|
||||
invert_matrix(A, m);
|
||||
if (!invert_matrix(A, m))
|
||||
return GL_FALSE;
|
||||
|
||||
/* d'ou les coordonnees objets */
|
||||
transform_point(out, m, in);
|
||||
|
|
|
|||
|
|
@ -347,7 +347,8 @@ gluUnProject(GLdouble winx, GLdouble winy, GLdouble winz,
|
|||
|
||||
/* calcul transformation inverse */
|
||||
matmul(A, proj, model);
|
||||
invert_matrix(A, m);
|
||||
if (!invert_matrix(A, m))
|
||||
return GL_FALSE;
|
||||
|
||||
/* d'ou les coordonnees objets */
|
||||
transform_point(out, m, in);
|
||||
|
|
@ -387,7 +388,8 @@ gluUnProject4(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble clipw,
|
|||
|
||||
/* calcul transformation inverse */
|
||||
matmul(A, projMatrix, modelMatrix);
|
||||
invert_matrix(A, m);
|
||||
if (!invert_matrix(A, m))
|
||||
return GL_FALSE;
|
||||
|
||||
/* d'ou les coordonnees objets */
|
||||
transform_point(out, m, in);
|
||||
|
|
|
|||
230
src/glu/sgi/Makefile.mgw
Normal file
230
src/glu/sgi/Makefile.mgw
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
# Mesa 3-D graphics library
|
||||
# Version: 5.1
|
||||
#
|
||||
# Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# MinGW core makefile v1.4 for Mesa
|
||||
#
|
||||
# Copyright (C) 2002 - Daniel Borca
|
||||
# Email : dborca@users.sourceforge.net
|
||||
# Web : http://www.geocities.com/dborca
|
||||
|
||||
# MinGW core-glu makefile updated for Mesa 7.0
|
||||
#
|
||||
# Updated : by Heromyth, on 2007-7-21
|
||||
# Email : zxpmyth@yahoo.com.cn
|
||||
# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
|
||||
# The others havn't been tested yet.
|
||||
# 2) The generated DLLs are *not* compatible with the ones built
|
||||
# with the other compilers like VC8, especially for GLUT.
|
||||
# 3) Although more tests are needed, it can be used individually!
|
||||
|
||||
#
|
||||
# Available options:
|
||||
#
|
||||
# Environment variables:
|
||||
# CFLAGS
|
||||
#
|
||||
# GLIDE path to Glide3 SDK; used with FX.
|
||||
# default = $(TOP)/glide3
|
||||
# FX=1 build for 3dfx Glide3. Note that this disables
|
||||
# compilation of most WMesa code and requires fxMesa.
|
||||
# As a consequence, you'll need the Win32 Glide3
|
||||
# library to build any application.
|
||||
# default = no
|
||||
# ICD=1 build the installable client driver interface
|
||||
# (windows opengl driver interface)
|
||||
# default = no
|
||||
# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow).
|
||||
# default = no
|
||||
#
|
||||
# Targets:
|
||||
# all: build GL
|
||||
# clean: remove object files
|
||||
#
|
||||
|
||||
|
||||
|
||||
.PHONY: all clean
|
||||
.INTERMEDIATE: x86/gen_matypes.exe
|
||||
.SUFFIXES: .rc .res
|
||||
|
||||
# Set this to the prefix of your build tools, i.e. mingw32-
|
||||
TOOLS_PREFIX = mingw32-
|
||||
|
||||
TOP = ../../..
|
||||
LIBDIR = $(TOP)/lib
|
||||
|
||||
LIB_NAME = glu32
|
||||
DLL_EXT = .dll
|
||||
IMP_EXT = .a
|
||||
LIB_PRE = lib
|
||||
STRIP = -s
|
||||
|
||||
AR = ar
|
||||
ARFLAGS = crus
|
||||
DLLTOOL = dlltool
|
||||
|
||||
GLU_DLL = $(LIB_NAME)$(DLL_EXT)
|
||||
GLU_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT)
|
||||
GLU_DEF = $(LIB_NAME).def
|
||||
|
||||
LDLIBS = -L$(LIBDIR) -lopengl32
|
||||
LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at
|
||||
|
||||
CFLAGS += -DBUILD_GLU32 -D_DLL
|
||||
|
||||
|
||||
CC = $(TOOLS_PREFIX)gcc
|
||||
CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include -Iinclude
|
||||
CXX = $(TOOLS_PREFIX)g++
|
||||
CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess
|
||||
|
||||
AR = ar
|
||||
ARFLAGS = crus
|
||||
|
||||
UNLINK = del $(subst /,\,$(1))
|
||||
ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
|
||||
UNLINK = $(RM) $(1)
|
||||
endif
|
||||
ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
|
||||
UNLINK = $(RM) $(1)
|
||||
endif
|
||||
|
||||
C_SOURCES = \
|
||||
libutil/error.c \
|
||||
libutil/glue.c \
|
||||
libutil/mipmap.c \
|
||||
libutil/project.c \
|
||||
libutil/quad.c \
|
||||
libutil/registry.c \
|
||||
libtess/dict.c \
|
||||
libtess/geom.c \
|
||||
libtess/memalloc.c \
|
||||
libtess/mesh.c \
|
||||
libtess/normal.c \
|
||||
libtess/priorityq.c \
|
||||
libtess/render.c \
|
||||
libtess/sweep.c \
|
||||
libtess/tess.c \
|
||||
libtess/tessmono.c
|
||||
|
||||
CC_SOURCES = \
|
||||
libnurbs/interface/bezierEval.cc \
|
||||
libnurbs/interface/bezierPatch.cc \
|
||||
libnurbs/interface/bezierPatchMesh.cc \
|
||||
libnurbs/interface/glcurveval.cc \
|
||||
libnurbs/interface/glinterface.cc \
|
||||
libnurbs/interface/glrenderer.cc \
|
||||
libnurbs/interface/glsurfeval.cc \
|
||||
libnurbs/interface/incurveeval.cc \
|
||||
libnurbs/interface/insurfeval.cc \
|
||||
libnurbs/internals/arc.cc \
|
||||
libnurbs/internals/arcsorter.cc \
|
||||
libnurbs/internals/arctess.cc \
|
||||
libnurbs/internals/backend.cc \
|
||||
libnurbs/internals/basiccrveval.cc \
|
||||
libnurbs/internals/basicsurfeval.cc \
|
||||
libnurbs/internals/bin.cc \
|
||||
libnurbs/internals/bufpool.cc \
|
||||
libnurbs/internals/cachingeval.cc \
|
||||
libnurbs/internals/ccw.cc \
|
||||
libnurbs/internals/coveandtiler.cc \
|
||||
libnurbs/internals/curve.cc \
|
||||
libnurbs/internals/curvelist.cc \
|
||||
libnurbs/internals/curvesub.cc \
|
||||
libnurbs/internals/dataTransform.cc \
|
||||
libnurbs/internals/displaylist.cc \
|
||||
libnurbs/internals/flist.cc \
|
||||
libnurbs/internals/flistsorter.cc \
|
||||
libnurbs/internals/hull.cc \
|
||||
libnurbs/internals/intersect.cc \
|
||||
libnurbs/internals/knotvector.cc \
|
||||
libnurbs/internals/mapdesc.cc \
|
||||
libnurbs/internals/mapdescv.cc \
|
||||
libnurbs/internals/maplist.cc \
|
||||
libnurbs/internals/mesher.cc \
|
||||
libnurbs/internals/monoTriangulationBackend.cc \
|
||||
libnurbs/internals/monotonizer.cc \
|
||||
libnurbs/internals/mycode.cc \
|
||||
libnurbs/internals/nurbsinterfac.cc \
|
||||
libnurbs/internals/nurbstess.cc \
|
||||
libnurbs/internals/patch.cc \
|
||||
libnurbs/internals/patchlist.cc \
|
||||
libnurbs/internals/quilt.cc \
|
||||
libnurbs/internals/reader.cc \
|
||||
libnurbs/internals/renderhints.cc \
|
||||
libnurbs/internals/slicer.cc \
|
||||
libnurbs/internals/sorter.cc \
|
||||
libnurbs/internals/splitarcs.cc \
|
||||
libnurbs/internals/subdivider.cc \
|
||||
libnurbs/internals/tobezier.cc \
|
||||
libnurbs/internals/trimline.cc \
|
||||
libnurbs/internals/trimregion.cc \
|
||||
libnurbs/internals/trimvertpool.cc \
|
||||
libnurbs/internals/uarray.cc \
|
||||
libnurbs/internals/varray.cc \
|
||||
libnurbs/nurbtess/directedLine.cc \
|
||||
libnurbs/nurbtess/gridWrap.cc \
|
||||
libnurbs/nurbtess/monoChain.cc \
|
||||
libnurbs/nurbtess/monoPolyPart.cc \
|
||||
libnurbs/nurbtess/monoTriangulation.cc \
|
||||
libnurbs/nurbtess/partitionX.cc \
|
||||
libnurbs/nurbtess/partitionY.cc \
|
||||
libnurbs/nurbtess/polyDBG.cc \
|
||||
libnurbs/nurbtess/polyUtil.cc \
|
||||
libnurbs/nurbtess/primitiveStream.cc \
|
||||
libnurbs/nurbtess/quicksort.cc \
|
||||
libnurbs/nurbtess/rectBlock.cc \
|
||||
libnurbs/nurbtess/sampleComp.cc \
|
||||
libnurbs/nurbtess/sampleCompBot.cc \
|
||||
libnurbs/nurbtess/sampleCompRight.cc \
|
||||
libnurbs/nurbtess/sampleCompTop.cc \
|
||||
libnurbs/nurbtess/sampleMonoPoly.cc \
|
||||
libnurbs/nurbtess/sampledLine.cc \
|
||||
libnurbs/nurbtess/searchTree.cc
|
||||
|
||||
SOURCES = $(C_SOURCES) $(CC_SOURCES)
|
||||
|
||||
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
|
||||
|
||||
.c.o:
|
||||
$(CC) -o $@ $(CFLAGS) -c $<
|
||||
.cc.o:
|
||||
$(CXX) -o $@ $(CXXFLAGS) -c $<
|
||||
|
||||
|
||||
all: $(LIBDIR) $(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP)
|
||||
|
||||
$(LIBDIR):
|
||||
mkdir -p $(LIBDIR)
|
||||
|
||||
$(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP): $(OBJECTS)
|
||||
$(CXX) $(LDFLAGS) -o $(LIBDIR)/$(GLU_DLL) $^ $(LDLIBS)
|
||||
$(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GLU_DEF) $^
|
||||
$(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GLU_IMP) --def $(LIBDIR)/$(GLU_DEF)
|
||||
|
||||
|
||||
clean:
|
||||
-$(call UNLINK,libutil/*.o)
|
||||
-$(call UNLINK,libtess/*.o)
|
||||
-$(call UNLINK,libnurbs/interface/*.o)
|
||||
-$(call UNLINK,libnurbs/internals/*.o)
|
||||
-$(call UNLINK,libnurbs/nurbtess/*.o)
|
||||
|
|
@ -111,8 +111,11 @@ void bezierPatchDelete(bezierPatch *b)
|
|||
void bezierPatchDeleteList(bezierPatch *b)
|
||||
{
|
||||
bezierPatch *temp;
|
||||
for(temp = b; temp != NULL; temp = temp->next)
|
||||
bezierPatchDelete(temp);
|
||||
while (b != NULL) {
|
||||
temp = b;
|
||||
b = b->next;
|
||||
bezierPatchDelete(temp);
|
||||
}
|
||||
}
|
||||
|
||||
bezierPatch* bezierPatchInsert(bezierPatch *list, bezierPatch *b)
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public:
|
|||
output_triangles = flag;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
void putCallBack(GLenum which, void (APIENTRY *fn)() );
|
||||
void putCallBack(GLenum which, void (GLAPIENTRY *fn)() );
|
||||
#else
|
||||
void putCallBack(GLenum which, _GLUfuncptr fn );
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1184,8 +1184,11 @@ return;
|
|||
|
||||
}
|
||||
|
||||
void
|
||||
OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn )
|
||||
#ifdef _WIN32
|
||||
void OpenGLSurfaceEvaluator::putCallBack(GLenum which, void (GLAPIENTRY *fn)() )
|
||||
#else
|
||||
void OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn )
|
||||
#endif
|
||||
{
|
||||
switch(which)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ public:
|
|||
void newtmeshvert( long, long );
|
||||
|
||||
#ifdef _WIN32
|
||||
void putCallBack(GLenum which, void (APIENTRY *fn)() );
|
||||
void putCallBack(GLenum which, void (GLAPIENTRY *fn)() );
|
||||
#else
|
||||
void putCallBack(GLenum which, _GLUfuncptr fn );
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1533,8 +1533,8 @@ void OpenGLSurfaceEvaluator::inEvalVStrip(int n_left, REAL u_left, REAL* left_va
|
|||
}
|
||||
//clean up
|
||||
free(leftXYZ);
|
||||
free(leftXYZ);
|
||||
free(rightNormal);
|
||||
free(rightXYZ);
|
||||
free(leftNormal);
|
||||
free(rightNormal);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,10 +43,9 @@
|
|||
#include "definitions.h"
|
||||
#include "primitiveStream.h"
|
||||
#include "directedLine.h"
|
||||
#include "arc.h"
|
||||
|
||||
class Backend;
|
||||
class Arc;
|
||||
typedef Arc *Arc_ptr;
|
||||
|
||||
class reflexChain{
|
||||
Real2 *queue;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ gluErrorString(GLenum errorCode)
|
|||
if ((errorCode >= GLU_NURBS_ERROR1) && (errorCode <= GLU_NURBS_ERROR37)) {
|
||||
return (const GLubyte *) __gluNURBSErrorString(errorCode - (GLU_NURBS_ERROR1 - 1));
|
||||
}
|
||||
if ((errorCode >= GLU_TESS_ERROR1) && (errorCode <= GLU_TESS_ERROR8)) {
|
||||
if ((errorCode >= GLU_TESS_ERROR1) && (errorCode <= GLU_TESS_ERROR6)) {
|
||||
return (const GLubyte *) __gluTessErrorString(errorCode - (GLU_TESS_ERROR1 - 1));
|
||||
}
|
||||
return (const GLubyte *) 0;
|
||||
|
|
|
|||
|
|
@ -168,74 +168,57 @@ static void __gluMultMatrixVecd(const GLdouble matrix[16], const GLdouble in[4],
|
|||
}
|
||||
|
||||
/*
|
||||
** inverse = invert(src)
|
||||
** New, faster implementation by Shan Hao Bo, April 2006.
|
||||
** Invert 4x4 matrix.
|
||||
** Contributed by David Moore (See Mesa bug #6748)
|
||||
*/
|
||||
static int __gluInvertMatrixd(const GLdouble src[16], GLdouble inverse[16])
|
||||
static int __gluInvertMatrixd(const GLdouble m[16], GLdouble invOut[16])
|
||||
{
|
||||
int i, j, k;
|
||||
double t;
|
||||
GLdouble temp[4][4];
|
||||
|
||||
for (i=0; i<4; i++) {
|
||||
for (j=0; j<4; j++) {
|
||||
temp[i][j] = src[i*4+j];
|
||||
}
|
||||
}
|
||||
__gluMakeIdentityd(inverse);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (temp[i][i] == 0.0f) {
|
||||
/*
|
||||
** Look for non-zero element in column
|
||||
*/
|
||||
for (j = i + 1; j < 4; j++) {
|
||||
if (temp[j][i] != 0.0f) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (j != 4) {
|
||||
/*
|
||||
** Swap rows.
|
||||
*/
|
||||
for (k = 0; k < 4; k++) {
|
||||
t = temp[i][k];
|
||||
temp[i][k] = temp[j][k];
|
||||
temp[j][k] = t;
|
||||
|
||||
t = inverse[i*4+k];
|
||||
inverse[i*4+k] = inverse[j*4+k];
|
||||
inverse[j*4+k] = t;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
** No non-zero pivot. The matrix is singular,
|
||||
which shouldn't
|
||||
** happen. This means the user gave us a bad
|
||||
matrix.
|
||||
*/
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
t = 1.0f / temp[i][i];
|
||||
for (k = 0; k < 4; k++) {
|
||||
temp[i][k] *= t;
|
||||
inverse[i*4+k] *= t;
|
||||
}
|
||||
for (j = 0; j < 4; j++) {
|
||||
if (j != i) {
|
||||
t = temp[j][i];
|
||||
for (k = 0; k < 4; k++) {
|
||||
temp[j][k] -= temp[i][k]*t;
|
||||
inverse[j*4+k] -= inverse[i*4+k]*t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return GL_TRUE;
|
||||
double inv[16], det;
|
||||
int i;
|
||||
|
||||
inv[0] = m[5]*m[10]*m[15] - m[5]*m[11]*m[14] - m[9]*m[6]*m[15]
|
||||
+ m[9]*m[7]*m[14] + m[13]*m[6]*m[11] - m[13]*m[7]*m[10];
|
||||
inv[4] = -m[4]*m[10]*m[15] + m[4]*m[11]*m[14] + m[8]*m[6]*m[15]
|
||||
- m[8]*m[7]*m[14] - m[12]*m[6]*m[11] + m[12]*m[7]*m[10];
|
||||
inv[8] = m[4]*m[9]*m[15] - m[4]*m[11]*m[13] - m[8]*m[5]*m[15]
|
||||
+ m[8]*m[7]*m[13] + m[12]*m[5]*m[11] - m[12]*m[7]*m[9];
|
||||
inv[12] = -m[4]*m[9]*m[14] + m[4]*m[10]*m[13] + m[8]*m[5]*m[14]
|
||||
- m[8]*m[6]*m[13] - m[12]*m[5]*m[10] + m[12]*m[6]*m[9];
|
||||
inv[1] = -m[1]*m[10]*m[15] + m[1]*m[11]*m[14] + m[9]*m[2]*m[15]
|
||||
- m[9]*m[3]*m[14] - m[13]*m[2]*m[11] + m[13]*m[3]*m[10];
|
||||
inv[5] = m[0]*m[10]*m[15] - m[0]*m[11]*m[14] - m[8]*m[2]*m[15]
|
||||
+ m[8]*m[3]*m[14] + m[12]*m[2]*m[11] - m[12]*m[3]*m[10];
|
||||
inv[9] = -m[0]*m[9]*m[15] + m[0]*m[11]*m[13] + m[8]*m[1]*m[15]
|
||||
- m[8]*m[3]*m[13] - m[12]*m[1]*m[11] + m[12]*m[3]*m[9];
|
||||
inv[13] = m[0]*m[9]*m[14] - m[0]*m[10]*m[13] - m[8]*m[1]*m[14]
|
||||
+ m[8]*m[2]*m[13] + m[12]*m[1]*m[10] - m[12]*m[2]*m[9];
|
||||
inv[2] = m[1]*m[6]*m[15] - m[1]*m[7]*m[14] - m[5]*m[2]*m[15]
|
||||
+ m[5]*m[3]*m[14] + m[13]*m[2]*m[7] - m[13]*m[3]*m[6];
|
||||
inv[6] = -m[0]*m[6]*m[15] + m[0]*m[7]*m[14] + m[4]*m[2]*m[15]
|
||||
- m[4]*m[3]*m[14] - m[12]*m[2]*m[7] + m[12]*m[3]*m[6];
|
||||
inv[10] = m[0]*m[5]*m[15] - m[0]*m[7]*m[13] - m[4]*m[1]*m[15]
|
||||
+ m[4]*m[3]*m[13] + m[12]*m[1]*m[7] - m[12]*m[3]*m[5];
|
||||
inv[14] = -m[0]*m[5]*m[14] + m[0]*m[6]*m[13] + m[4]*m[1]*m[14]
|
||||
- m[4]*m[2]*m[13] - m[12]*m[1]*m[6] + m[12]*m[2]*m[5];
|
||||
inv[3] = -m[1]*m[6]*m[11] + m[1]*m[7]*m[10] + m[5]*m[2]*m[11]
|
||||
- m[5]*m[3]*m[10] - m[9]*m[2]*m[7] + m[9]*m[3]*m[6];
|
||||
inv[7] = m[0]*m[6]*m[11] - m[0]*m[7]*m[10] - m[4]*m[2]*m[11]
|
||||
+ m[4]*m[3]*m[10] + m[8]*m[2]*m[7] - m[8]*m[3]*m[6];
|
||||
inv[11] = -m[0]*m[5]*m[11] + m[0]*m[7]*m[9] + m[4]*m[1]*m[11]
|
||||
- m[4]*m[3]*m[9] - m[8]*m[1]*m[7] + m[8]*m[3]*m[5];
|
||||
inv[15] = m[0]*m[5]*m[10] - m[0]*m[6]*m[9] - m[4]*m[1]*m[10]
|
||||
+ m[4]*m[2]*m[9] + m[8]*m[1]*m[6] - m[8]*m[2]*m[5];
|
||||
|
||||
det = m[0]*inv[0] + m[1]*inv[4] + m[2]*inv[8] + m[3]*inv[12];
|
||||
if (det == 0)
|
||||
return GL_FALSE;
|
||||
|
||||
det = 1.0 / det;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
invOut[i] = inv[i] * det;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static void __gluMultMatricesd(const GLdouble a[16], const GLdouble b[16],
|
||||
|
|
|
|||
|
|
@ -28,14 +28,13 @@
|
|||
typedef void (GLUTCALLBACK *__GlutTimerCallback) ( int value );
|
||||
|
||||
typedef struct __GlutTimer_s {
|
||||
unsigned int interval;
|
||||
struct timeval interval;
|
||||
struct timeval expire;
|
||||
|
||||
__GlutTimerCallback func;
|
||||
int value;
|
||||
|
||||
struct __GlutTimer_s *next;
|
||||
struct __GlutTimer_s *prev;
|
||||
} __GlutTimer;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -207,8 +206,7 @@ glutIdleFunc( void (GLUTCALLBACK *func) (void) )
|
|||
void GLUTAPIENTRY
|
||||
glutTimerFunc( unsigned int msec, void (GLUTCALLBACK *func) (int value), int value )
|
||||
{
|
||||
__GlutTimer *timer;
|
||||
struct timeval now;
|
||||
__GlutTimer *timer;
|
||||
|
||||
if (!func)
|
||||
return;
|
||||
|
|
@ -217,24 +215,19 @@ glutTimerFunc( unsigned int msec, void (GLUTCALLBACK *func) (int value), int val
|
|||
if (!timer)
|
||||
__glutFatalError( "out of memory" );
|
||||
|
||||
gettimeofday( &now, NULL );
|
||||
|
||||
timer->interval = msec;
|
||||
timer->expire.tv_sec = now.tv_sec + (now.tv_usec/1000 + msec) / 1000;
|
||||
timer->expire.tv_usec = (now.tv_usec + msec*1000) % 1000000;
|
||||
timer->interval.tv_sec = msec / 1000;
|
||||
timer->interval.tv_usec = (msec % 1000) * 1000;
|
||||
|
||||
gettimeofday( &timer->expire, NULL );
|
||||
timer->expire.tv_usec += timer->interval.tv_usec;
|
||||
timer->expire.tv_sec += timer->interval.tv_sec + timer->expire.tv_usec/1000000;
|
||||
timer->expire.tv_usec %= 1000000;
|
||||
|
||||
timer->func = func;
|
||||
timer->value = value;
|
||||
|
||||
if (g_timers) {
|
||||
timer->prev = g_timers->prev;
|
||||
g_timers->prev->next = timer;
|
||||
g_timers->prev = timer;
|
||||
}
|
||||
else {
|
||||
g_timers = timer;
|
||||
g_timers->prev = timer;
|
||||
}
|
||||
timer->next = g_timers;
|
||||
g_timers = timer;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -254,12 +247,41 @@ __glutHandleTimers( void )
|
|||
g_idle = GL_FALSE;
|
||||
|
||||
cur->func( cur->value );
|
||||
|
||||
cur->expire.tv_sec += (cur->expire.tv_usec/1000 + cur->interval) / 1000;
|
||||
cur->expire.tv_usec = (cur->expire.tv_usec + cur->interval*1000) % 1000000;
|
||||
|
||||
cur->expire.tv_usec += cur->interval.tv_usec;
|
||||
cur->expire.tv_sec += cur->interval.tv_sec + cur->expire.tv_usec/1000000;
|
||||
cur->expire.tv_usec %= 1000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GLboolean
|
||||
__glutGetTimeout( int *ret_msec )
|
||||
{
|
||||
__GlutTimer *cur;
|
||||
struct timeval *time = NULL;
|
||||
struct timeval now;
|
||||
|
||||
for (cur = g_timers; cur; cur = cur->next) {
|
||||
if (time == NULL ||
|
||||
time->tv_sec > cur->expire.tv_sec ||
|
||||
(time->tv_sec == cur->expire.tv_sec &&
|
||||
time->tv_usec > cur->expire.tv_usec)) {
|
||||
time = &cur->expire;
|
||||
}
|
||||
}
|
||||
|
||||
if (time == NULL)
|
||||
return GL_FALSE;
|
||||
|
||||
gettimeofday( &now, NULL );
|
||||
|
||||
*ret_msec = (time->tv_sec - now.tv_sec) * 1000 +
|
||||
(time->tv_usec - now.tv_usec + 500) / 1000;
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
|
|
@ -275,4 +297,4 @@ __glutFreeTimers( void )
|
|||
|
||||
g_timers = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -435,13 +435,14 @@ glutMainLoop( void )
|
|||
{
|
||||
__glutAssert( events != NULL );
|
||||
|
||||
__glutHandleWindows();
|
||||
|
||||
while (GL_TRUE) {
|
||||
DFBEvent evt, prev;
|
||||
|
||||
g_idle = GL_TRUE;
|
||||
|
||||
__glutHandleTimers();
|
||||
__glutHandleWindows();
|
||||
|
||||
prev.clazz = DFEC_NONE;
|
||||
|
||||
|
|
@ -471,13 +472,19 @@ glutMainLoop( void )
|
|||
__glutHandleTimers();
|
||||
}
|
||||
|
||||
__glutHandleWindows();
|
||||
|
||||
if (g_idle) {
|
||||
if (idle_func) {
|
||||
idle_func();
|
||||
}
|
||||
else {
|
||||
int msec;
|
||||
__glutSetWindow( NULL );
|
||||
usleep( 500 );
|
||||
if (__glutGetTimeout( &msec ))
|
||||
events->WaitForEventWithTimeout( events, msec/1000, msec%1000 );
|
||||
else
|
||||
events->WaitForEvent( events );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ extern void __glutDestroyWindow( __GlutWindow *window );
|
|||
extern void __glutDestroyWindows( void );
|
||||
/* callback.c */
|
||||
extern void __glutHandleTimers( void );
|
||||
extern GLboolean __glutGetTimeout( int *ret_msec );
|
||||
extern void __glutFreeTimers( void );
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -69,10 +69,10 @@ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
|
|||
$(MKLIB_OPTIONS) $(OBJECTS)
|
||||
|
||||
install:
|
||||
$(INSTALL) -d $(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
|
||||
# Run 'make -f Makefile.solo dep' to update the dependencies if you change
|
||||
# what's included by any source file.
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ SOURCES = \
|
|||
glut_dstr.c \
|
||||
glut_event.c \
|
||||
glut_ext.c \
|
||||
glut_fcb.c \
|
||||
glut_fullscrn.c \
|
||||
glut_gamemode.c \
|
||||
glut_get.c \
|
||||
|
|
@ -96,11 +97,21 @@ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
|
|||
$(GLUT_LIB_DEPS) $(OBJECTS)
|
||||
|
||||
|
||||
install:
|
||||
$(INSTALL) -d $(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(INSTALL_DIR)/$(LIB_DIR)
|
||||
# glut pkgconfig file
|
||||
pcedit = sed \
|
||||
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
|
||||
-e 's,@LIB_DIR@,$(LIB_DIR),' \
|
||||
-e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),'
|
||||
glut.pc: glut.pc.in
|
||||
$(pcedit) $< > $@
|
||||
|
||||
install: glut.pc
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
|
||||
|
||||
clean:
|
||||
|
|
|
|||
191
src/glut/glx/Makefile.mgw
Normal file
191
src/glut/glx/Makefile.mgw
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
# Mesa 3-D graphics library
|
||||
# Version: 5.1
|
||||
#
|
||||
# Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# MinGW core makefile v1.4 for Mesa
|
||||
#
|
||||
# Copyright (C) 2002 - Daniel Borca
|
||||
# Email : dborca@users.sourceforge.net
|
||||
# Web : http://www.geocities.com/dborca
|
||||
|
||||
# MinGW core-glut makefile updated for Mesa 7.0
|
||||
#
|
||||
# Updated : by Heromyth, on 2007-7-21
|
||||
# Email : zxpmyth@yahoo.com.cn
|
||||
# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
|
||||
# The others havn't been tested yet.
|
||||
# 2) The generated DLLs are *not* compatible with the ones built
|
||||
# with the other compilers like VC8, especially for GLUT.
|
||||
# 3) Although more tests are needed, it can be used individually!
|
||||
|
||||
|
||||
#
|
||||
# Available options:
|
||||
#
|
||||
# Environment variables:
|
||||
# CFLAGS
|
||||
#
|
||||
# GLIDE path to Glide3 SDK; used with FX.
|
||||
# default = $(TOP)/glide3
|
||||
# FX=1 build for 3dfx Glide3. Note that this disables
|
||||
# compilation of most WMesa code and requires fxMesa.
|
||||
# As a consequence, you'll need the Win32 Glide3
|
||||
# library to build any application.
|
||||
# default = no
|
||||
# ICD=1 build the installable client driver interface
|
||||
# (windows opengl driver interface)
|
||||
# default = no
|
||||
# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow).
|
||||
# default = no
|
||||
#
|
||||
# Targets:
|
||||
# all: build GL
|
||||
# clean: remove object files
|
||||
#
|
||||
|
||||
|
||||
|
||||
.PHONY: all clean
|
||||
.INTERMEDIATE: x86/gen_matypes.exe
|
||||
.SUFFIXES: .rc .res
|
||||
|
||||
# Set this to the prefix of your build tools, i.e. mingw32-
|
||||
TOOLS_PREFIX = mingw32-
|
||||
|
||||
TOP = ../../..
|
||||
|
||||
LIBDIR = $(TOP)/lib
|
||||
|
||||
LIB_NAME = glut32
|
||||
|
||||
DLL_EXT = .dll
|
||||
IMP_EXT = .a
|
||||
LIB_PRE = lib
|
||||
STRIP = -s
|
||||
|
||||
AR = ar
|
||||
ARFLAGS = crus
|
||||
DLLTOOL = dlltool
|
||||
|
||||
GLUT_DLL = $(LIB_NAME)$(DLL_EXT)
|
||||
GLUT_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT)
|
||||
GLUT_DEF = $(LIB_NAME).def
|
||||
|
||||
LDLIBS = -L$(LIBDIR) -lwinmm -lgdi32 -luser32 -lopengl32 -lglu32
|
||||
LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at
|
||||
|
||||
CFLAGS += -DBUILD_GLUT32 -DGLUT_BUILDING_LIB -DMESA -D_DLL
|
||||
CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include
|
||||
|
||||
CC = $(TOOLS_PREFIX)gcc
|
||||
CXX = $(TOOLS_PREFIX)g++
|
||||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
AR = ar
|
||||
ARFLAGS = crus
|
||||
|
||||
UNLINK = del $(subst /,\,$(1))
|
||||
ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
|
||||
UNLINK = $(RM) $(1)
|
||||
endif
|
||||
ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
|
||||
UNLINK = $(RM) $(1)
|
||||
endif
|
||||
|
||||
HDRS = glutint.h glutstroke.h glutbitmap.h glutwin32.h stroke.h win32_glx.h win32_x11.h
|
||||
|
||||
SRCS = \
|
||||
glut_bitmap.c \
|
||||
glut_bwidth.c \
|
||||
glut_cindex.c \
|
||||
glut_cmap.c \
|
||||
glut_cursor.c \
|
||||
glut_dials.c \
|
||||
glut_dstr.c \
|
||||
glut_event.c \
|
||||
glut_ext.c \
|
||||
glut_fbc.c \
|
||||
glut_fullscrn.c \
|
||||
glut_gamemode.c \
|
||||
glut_get.c \
|
||||
glut_init.c \
|
||||
glut_input.c \
|
||||
glut_joy.c \
|
||||
glut_key.c \
|
||||
glut_keyctrl.c \
|
||||
glut_keyup.c \
|
||||
glut_mesa.c \
|
||||
glut_modifier.c \
|
||||
glut_overlay.c \
|
||||
glut_shapes.c \
|
||||
glut_space.c \
|
||||
glut_stroke.c \
|
||||
glut_swap.c \
|
||||
glut_swidth.c \
|
||||
glut_tablet.c \
|
||||
glut_teapot.c \
|
||||
glut_util.c \
|
||||
glut_vidresize.c \
|
||||
glut_warp.c \
|
||||
glut_win.c \
|
||||
glut_winmisc.c \
|
||||
win32_glx.c \
|
||||
win32_menu.c \
|
||||
win32_util.c \
|
||||
win32_winproc.c \
|
||||
win32_x11.c
|
||||
|
||||
|
||||
SRCSSEMIGENS = \
|
||||
glut_8x13.c \
|
||||
glut_9x15.c \
|
||||
glut_hel10.c \
|
||||
glut_hel12.c \
|
||||
glut_hel18.c \
|
||||
glut_mroman.c \
|
||||
glut_roman.c \
|
||||
glut_tr10.c \
|
||||
glut_tr24.c
|
||||
|
||||
|
||||
|
||||
SOURCES = $(SRCS) $(SRCSSEMIGENS)
|
||||
|
||||
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
|
||||
|
||||
.c.o:
|
||||
$(CC) -o $@ $(CFLAGS) -c $<
|
||||
.cc.o:
|
||||
$(CXX) -o $@ $(CXXFLAGS) -c $<
|
||||
|
||||
|
||||
all: $(LIBDIR) $(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP)
|
||||
|
||||
$(LIBDIR):
|
||||
mkdir -p $(LIBDIR)
|
||||
|
||||
$(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)
|
||||
$(CXX) $(LDFLAGS) -o $(LIBDIR)/$(GLUT_DLL) $^ $(LDLIBS)
|
||||
$(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GLUT_DEF) $^
|
||||
$(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GLUT_IMP) --def $(LIBDIR)/$(GLUT_DEF)
|
||||
|
||||
clean:
|
||||
-$(call UNLINK,*.o)
|
||||
11
src/glut/glx/glut.pc.in
Normal file
11
src/glut/glx/glut.pc.in
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
prefix=@INSTALL_DIR@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/@LIB_DIR@
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: glut
|
||||
Description: Mesa OpenGL Utility Toolkit library
|
||||
Requires: gl glu
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lglut
|
||||
Cflags: -I${includedir}
|
||||
|
|
@ -291,6 +291,7 @@ loadVisuals(int *nitems_return)
|
|||
fbmodes = (FrameBufferMode *) malloc(n * sizeof(FrameBufferMode));
|
||||
if (fbmodes == NULL) {
|
||||
*nitems_return = -1;
|
||||
free(vlist);
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < n; i++) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
# ifdef __sgi
|
||||
# include <bstring.h> /* prototype for bzero used by FD_ZERO */
|
||||
# endif
|
||||
# if (defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE)
|
||||
# if (defined(__FreeBSD__) || defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE)
|
||||
# include <sys/select.h> /* select system call interface */
|
||||
# ifdef luna
|
||||
# include <sysent.h>
|
||||
|
|
@ -172,10 +172,14 @@ handleTimeouts(void)
|
|||
GETTIMEOFDAY(&now);
|
||||
while (IS_AT_OR_AFTER(__glutTimerList->timeout, now)) {
|
||||
timer = __glutTimerList;
|
||||
__glutTimerList = timer->next;
|
||||
/* call the timer function */
|
||||
timer->func(timer->value);
|
||||
/* remove from the linked list */
|
||||
__glutTimerList = timer->next;
|
||||
/* put this timer on the "free" list */
|
||||
timer->next = freeTimerList;
|
||||
freeTimerList = timer;
|
||||
|
||||
if (!__glutTimerList)
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
/* Set a Fortran callback function. */
|
||||
|
||||
void GLUTAPIENTRY
|
||||
void APIENTRY
|
||||
__glutSetFCB(int which, void *func)
|
||||
{
|
||||
#ifdef SUPPORT_FORTRAN
|
||||
|
|
@ -100,7 +100,7 @@ __glutSetFCB(int which, void *func)
|
|||
|
||||
/* Get a Fortran callback function. */
|
||||
|
||||
void* GLUTAPIENTRY
|
||||
void* APIENTRY
|
||||
__glutGetFCB(int which)
|
||||
{
|
||||
#ifdef SUPPORT_FORTRAN
|
||||
|
|
|
|||
164
src/glut/glx/glut_fcb.c
Normal file
164
src/glut/glx/glut_fcb.c
Normal file
|
|
@ -0,0 +1,164 @@
|
|||
|
||||
/* Copyright (c) Mark J. Kilgard, 1998. */
|
||||
|
||||
/* This program is freely distributable without licensing fees
|
||||
and is provided without guarantee or warrantee expressed or
|
||||
implied. This program is -not- in the public domain. */
|
||||
|
||||
/* I appreciate the guidance from William Mitchell
|
||||
(mitchell@cam.nist.gov) in developing this friend interface
|
||||
for use by the f90gl package. See ../../README.fortran */
|
||||
|
||||
#include "glutint.h"
|
||||
|
||||
/* FCB stands for Fortran CallBack. */
|
||||
|
||||
/* There is only one idleFunc, menuStateFunc, and menuStatusFunc, so they
|
||||
can be saved in the wrappers for Fortran rather than the C structures. */
|
||||
|
||||
/* Set a Fortran callback function. */
|
||||
|
||||
void APIENTRY
|
||||
__glutSetFCB(int which, GLUTproc func)
|
||||
{
|
||||
#ifdef SUPPORT_FORTRAN
|
||||
switch (which) {
|
||||
case GLUT_FCB_DISPLAY:
|
||||
__glutCurrentWindow->fdisplay = (GLUTdisplayFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_RESHAPE:
|
||||
__glutCurrentWindow->freshape = (GLUTreshapeFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_MOUSE:
|
||||
__glutCurrentWindow->fmouse = (GLUTmouseFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_MOTION:
|
||||
__glutCurrentWindow->fmotion = (GLUTmotionFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_PASSIVE:
|
||||
__glutCurrentWindow->fpassive = (GLUTpassiveFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_ENTRY:
|
||||
__glutCurrentWindow->fentry = (GLUTentryFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_KEYBOARD:
|
||||
__glutCurrentWindow->fkeyboard = (GLUTkeyboardFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_KEYBOARD_UP:
|
||||
__glutCurrentWindow->fkeyboardUp = (GLUTkeyboardFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_WINDOW_STATUS:
|
||||
__glutCurrentWindow->fwindowStatus = (GLUTwindowStatusFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_VISIBILITY:
|
||||
__glutCurrentWindow->fvisibility = (GLUTvisibilityFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_SPECIAL:
|
||||
__glutCurrentWindow->fspecial = (GLUTspecialFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_SPECIAL_UP:
|
||||
__glutCurrentWindow->fspecialUp = (GLUTspecialFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_BUTTON_BOX:
|
||||
__glutCurrentWindow->fbuttonBox = (GLUTbuttonBoxFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_DIALS:
|
||||
__glutCurrentWindow->fdials = (GLUTdialsFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_SPACE_MOTION:
|
||||
__glutCurrentWindow->fspaceMotion = (GLUTspaceMotionFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_SPACE_ROTATE:
|
||||
__glutCurrentWindow->fspaceRotate = (GLUTspaceRotateFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_SPACE_BUTTON:
|
||||
__glutCurrentWindow->fspaceButton = (GLUTspaceButtonFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_TABLET_MOTION:
|
||||
__glutCurrentWindow->ftabletMotion = (GLUTtabletMotionFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_TABLET_BUTTON:
|
||||
__glutCurrentWindow->ftabletButton = (GLUTtabletButtonFCB) func;
|
||||
break;
|
||||
#ifdef _WIN32
|
||||
case GLUT_FCB_JOYSTICK:
|
||||
__glutCurrentWindow->fjoystick = (GLUTjoystickFCB) func;
|
||||
break;
|
||||
#endif
|
||||
case GLUT_FCB_OVERLAY_DISPLAY:
|
||||
__glutCurrentWindow->overlay->fdisplay = (GLUTdisplayFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_SELECT:
|
||||
__glutCurrentMenu->fselect = (GLUTselectFCB) func;
|
||||
break;
|
||||
case GLUT_FCB_TIMER:
|
||||
__glutNewTimer->ffunc = (GLUTtimerFCB) func;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Get a Fortran callback function. */
|
||||
|
||||
GLUTproc APIENTRY
|
||||
__glutGetFCB(int which)
|
||||
{
|
||||
#ifdef SUPPORT_FORTRAN
|
||||
switch (which) {
|
||||
case GLUT_FCB_DISPLAY:
|
||||
return __glutCurrentWindow->fdisplay;
|
||||
case GLUT_FCB_RESHAPE:
|
||||
return __glutCurrentWindow->freshape;
|
||||
case GLUT_FCB_MOUSE:
|
||||
return __glutCurrentWindow->fmouse;
|
||||
case GLUT_FCB_MOTION:
|
||||
return __glutCurrentWindow->fmotion;
|
||||
case GLUT_FCB_PASSIVE:
|
||||
return __glutCurrentWindow->fpassive;
|
||||
case GLUT_FCB_ENTRY:
|
||||
return __glutCurrentWindow->fentry;
|
||||
case GLUT_FCB_KEYBOARD:
|
||||
return __glutCurrentWindow->fkeyboard;
|
||||
case GLUT_FCB_KEYBOARD_UP:
|
||||
return __glutCurrentWindow->fkeyboardUp;
|
||||
case GLUT_FCB_WINDOW_STATUS:
|
||||
return __glutCurrentWindow->fwindowStatus;
|
||||
case GLUT_FCB_VISIBILITY:
|
||||
return __glutCurrentWindow->fvisibility;
|
||||
case GLUT_FCB_SPECIAL:
|
||||
return __glutCurrentWindow->fspecial;
|
||||
case GLUT_FCB_SPECIAL_UP:
|
||||
return __glutCurrentWindow->fspecialUp;
|
||||
case GLUT_FCB_BUTTON_BOX:
|
||||
return __glutCurrentWindow->fbuttonBox;
|
||||
case GLUT_FCB_DIALS:
|
||||
return __glutCurrentWindow->fdials;
|
||||
case GLUT_FCB_SPACE_MOTION:
|
||||
return __glutCurrentWindow->fspaceMotion;
|
||||
case GLUT_FCB_SPACE_ROTATE:
|
||||
return __glutCurrentWindow->fspaceRotate;
|
||||
case GLUT_FCB_SPACE_BUTTON:
|
||||
return __glutCurrentWindow->fspaceButton;
|
||||
case GLUT_FCB_TABLET_MOTION:
|
||||
return __glutCurrentWindow->ftabletMotion;
|
||||
case GLUT_FCB_TABLET_BUTTON:
|
||||
return __glutCurrentWindow->ftabletButton;
|
||||
case GLUT_FCB_JOYSTICK:
|
||||
#ifdef _WIN32
|
||||
return __glutCurrentWindow->fjoystick;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
case GLUT_FCB_OVERLAY_DISPLAY:
|
||||
return __glutCurrentWindow->overlay->fdisplay;
|
||||
case GLUT_FCB_SELECT:
|
||||
return __glutCurrentMenu->fselect;
|
||||
case GLUT_FCB_TIMER:
|
||||
return __glutTimerList ? __glutTimerList->ffunc : NULL;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -23,6 +23,9 @@
|
|||
#endif
|
||||
#include <X11/Xutil.h>
|
||||
#else
|
||||
#ifdef __MINGW32__
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifndef __CYGWIN32__
|
||||
#include <mmsystem.h> /* Win32 Multimedia API header. */
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@
|
|||
implied. This program is -not- in the public domain. */
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef __MINGW32__
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#ifndef __CYGWIN32__
|
||||
#include <mmsystem.h> /* Win32 Multimedia API header. */
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@
|
|||
#include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
#ifndef GLUT_BUILDING_LIB
|
||||
#define GLUT_BUILDING_LIB /* Building the GLUT library itself. */
|
||||
#endif
|
||||
|
||||
#include <GL/glut.h>
|
||||
|
||||
#if defined(MESA) && defined(_WIN32) && !defined(__CYGWIN32__)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
/* The following added by Paul Garceau <pgarceau@teleport.com> */
|
||||
#if defined(__MINGW32__)
|
||||
#include <GL/gl.h>
|
||||
#include <time.h>
|
||||
#include <windows.h>
|
||||
struct timeval;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
|
||||
#include "glutint.h"
|
||||
#include <sys/timeb.h>
|
||||
#ifdef __MINGW32__
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN32__)
|
||||
#include <mmsystem.h> /* Win32 Multimedia API header. */
|
||||
|
|
|
|||
|
|
@ -6,16 +6,14 @@
|
|||
/* This program is freely distributable without licensing fees
|
||||
and is provided without guarantee or warrantee expressed or
|
||||
implied. This program is -not- in the public domain. */
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
|
||||
/* These definitions are missing from windows.h */
|
||||
WINGDIAPI int WINAPI wglChoosePixelFormat(HDC, PIXELFORMATDESCRIPTOR *);
|
||||
WINGDIAPI int WINAPI wglDescribePixelFormat(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
|
||||
WINGDIAPI int WINAPI wglGetPixelFormat(HDC);
|
||||
WINGDIAPI BOOL WINAPI wglSetPixelFormat(HDC, int, PIXELFORMATDESCRIPTOR *);
|
||||
WINGDIAPI BOOL WINAPI wglSwapBuffers(HDC);
|
||||
|
||||
|
||||
/* Type definitions (conversions) */
|
||||
typedef int Visual; /* Win32 equivalent of X11 type */
|
||||
|
|
|
|||
|
|
@ -25,11 +25,21 @@ OBJECTS = $(GLW_SOURCES:.c=.o)
|
|||
|
||||
default: $(TOP)/$(LIB_DIR)/$(GLW_LIB_NAME)
|
||||
|
||||
install:
|
||||
$(INSTALL) -d $(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -m 644 *.h $(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLw.* $(INSTALL_DIR)/$(LIB_DIR)
|
||||
# GLU pkg-config file
|
||||
pcedit = sed \
|
||||
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
|
||||
-e 's,@LIB_DIR@,$(LIB_DIR),' \
|
||||
-e 's,@VERSION@,$(MAJOR).$(MINOR).$(TINY),'
|
||||
glw.pc: glw.pc.in
|
||||
$(pcedit) $< > $@
|
||||
|
||||
install: glw.pc
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -m 644 *.h $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libGLw.* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -m 644 glw.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
|
||||
clean:
|
||||
-rm depend depend.bak
|
||||
|
|
|
|||
11
src/glw/glw.pc.in
Normal file
11
src/glw/glw.pc.in
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
prefix=@INSTALL_DIR@
|
||||
exec_prefix=${prefix}
|
||||
libdir=${exec_prefix}/@LIB_DIR@
|
||||
includedir=${prefix}/include
|
||||
|
||||
Name: glw
|
||||
Description: Mesa OpenGL widget library
|
||||
Requires: gl
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lGLU
|
||||
Cflags: -I${includedir}
|
||||
|
|
@ -672,8 +672,11 @@ filter_modes( __GLcontextModes ** server_modes,
|
|||
if ( do_delete && (m->visualID != 0) ) {
|
||||
do_delete = GL_FALSE;
|
||||
|
||||
fprintf(stderr, "libGL warning: 3D driver claims to not support "
|
||||
"visual 0x%02x\n", m->visualID);
|
||||
/* don't warn for this visual (Novell #247471 / X.Org #6689) */
|
||||
if (m->visualRating != GLX_NON_CONFORMANT_CONFIG) {
|
||||
fprintf(stderr, "libGL warning: 3D driver claims to not "
|
||||
"support visual 0x%02x\n", m->visualID);
|
||||
}
|
||||
}
|
||||
|
||||
if ( do_delete ) {
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ static GLubyte *
|
|||
emit_DrawArrays_header_old( __GLXcontext * gc,
|
||||
struct array_state_vector * arrays,
|
||||
size_t * elements_per_request,
|
||||
size_t * total_requests,
|
||||
unsigned int * total_requests,
|
||||
GLenum mode, GLsizei count )
|
||||
{
|
||||
size_t command_size;
|
||||
|
|
@ -640,7 +640,7 @@ emit_DrawArrays_old( GLenum mode, GLint first, GLsizei count )
|
|||
|
||||
GLubyte * pc;
|
||||
size_t elements_per_request;
|
||||
size_t total_requests = 0;
|
||||
unsigned total_requests = 0;
|
||||
unsigned i;
|
||||
size_t total_sent = 0;
|
||||
|
||||
|
|
@ -770,9 +770,10 @@ emit_DrawElements_old( GLenum mode, GLsizei count, GLenum type,
|
|||
|
||||
GLubyte * pc;
|
||||
size_t elements_per_request;
|
||||
size_t total_requests = 0;
|
||||
unsigned total_requests = 0;
|
||||
unsigned i;
|
||||
unsigned req;
|
||||
unsigned req_element=0;
|
||||
|
||||
|
||||
pc = emit_DrawArrays_header_old( gc, arrays, & elements_per_request,
|
||||
|
|
@ -790,7 +791,7 @@ emit_DrawElements_old( GLenum mode, GLsizei count, GLenum type,
|
|||
|
||||
switch( type ) {
|
||||
case GL_UNSIGNED_INT: {
|
||||
const GLuint * ui_ptr = (const GLuint *) indices;
|
||||
const GLuint * ui_ptr = (const GLuint *) indices + req_element;
|
||||
|
||||
for ( i = 0 ; i < elements_per_request ; i++ ) {
|
||||
const GLint index = (GLint) *(ui_ptr++);
|
||||
|
|
@ -799,7 +800,7 @@ emit_DrawElements_old( GLenum mode, GLsizei count, GLenum type,
|
|||
break;
|
||||
}
|
||||
case GL_UNSIGNED_SHORT: {
|
||||
const GLushort * us_ptr = (const GLushort *) indices;
|
||||
const GLushort * us_ptr = (const GLushort *) indices + req_element;
|
||||
|
||||
for ( i = 0 ; i < elements_per_request ; i++ ) {
|
||||
const GLint index = (GLint) *(us_ptr++);
|
||||
|
|
@ -808,7 +809,7 @@ emit_DrawElements_old( GLenum mode, GLsizei count, GLenum type,
|
|||
break;
|
||||
}
|
||||
case GL_UNSIGNED_BYTE: {
|
||||
const GLubyte * ub_ptr = (const GLubyte *) indices;
|
||||
const GLubyte * ub_ptr = (const GLubyte *) indices + req_element;
|
||||
|
||||
for ( i = 0 ; i < elements_per_request ; i++ ) {
|
||||
const GLint index = (GLint) *(ub_ptr++);
|
||||
|
|
@ -826,6 +827,7 @@ emit_DrawElements_old( GLenum mode, GLsizei count, GLenum type,
|
|||
}
|
||||
|
||||
count -= elements_per_request;
|
||||
req_element += elements_per_request;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -133,6 +133,15 @@ $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME): $(OSMESA_DRIVER_OBJECTS) $(OSMESA16_OBJECT
|
|||
fi
|
||||
|
||||
|
||||
######################################################################
|
||||
# libGL pkg-config file
|
||||
pcedit = sed \
|
||||
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
|
||||
-e 's,@LIB_DIR@,$(LIB_DIR),' \
|
||||
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),'
|
||||
gl.pc: gl.pc.in
|
||||
$(pcedit) $< > $@
|
||||
|
||||
######################################################################
|
||||
# Generic stuff
|
||||
|
||||
|
|
@ -148,23 +157,25 @@ subdirs:
|
|||
@ (cd x86-64 ; $(MAKE))
|
||||
|
||||
|
||||
install: default
|
||||
$(INSTALL) -d $(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -m 644 $(TOP)/include/GL/*.h $(INSTALL_DIR)/include/GL
|
||||
install: default gl.pc
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
$(INSTALL) -m 644 $(TOP)/include/GL/*.h $(DESTDIR)$(INSTALL_DIR)/include/GL
|
||||
@if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libGL* $(INSTALL_DIR)/$(LIB_DIR); \
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libGL* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \
|
||||
fi
|
||||
$(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
|
||||
@if [ -e $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) ]; then \
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libOSMesa* $(INSTALL_DIR)/$(LIB_DIR); \
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libOSMesa* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR); \
|
||||
fi
|
||||
@if [ "${DRIVER_DIRS}" = "dri" ] ; then \
|
||||
cd drivers/dri ; $(MAKE) install ; \
|
||||
fi
|
||||
|
||||
## NOT INSTALLED YET:
|
||||
## $(INSTALL) -d $(INSTALL_DIR)/include/GLES
|
||||
## $(INSTALL) -m 644 include/GLES/*.h $(INSTALL_DIR)/include/GLES
|
||||
## $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GLES
|
||||
## $(INSTALL) -m 644 include/GLES/*.h $(DESTDIR)$(INSTALL_DIR)/include/GLES
|
||||
|
||||
|
||||
# Emacs tags
|
||||
|
|
@ -176,9 +187,9 @@ clean:
|
|||
-rm -f */*/*.o
|
||||
-rm -f depend depend.bak libmesa.a
|
||||
-rm -f drivers/*/*.o
|
||||
(cd drivers/dri ; $(MAKE) clean)
|
||||
(cd x86 ; $(MAKE) clean)
|
||||
(cd x86-64 ; $(MAKE) clean)
|
||||
(cd drivers/dri && $(MAKE) clean)
|
||||
(cd x86 && $(MAKE) clean)
|
||||
(cd x86-64 && $(MAKE) clean)
|
||||
|
||||
|
||||
include depend
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Mesa 3-D graphics library
|
||||
# Version: 5.1
|
||||
# Version: 7.0
|
||||
#
|
||||
# Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
|
||||
#
|
||||
|
|
@ -26,6 +26,16 @@
|
|||
# Email : dborca@users.sourceforge.net
|
||||
# Web : http://www.geocities.com/dborca
|
||||
|
||||
# MinGW core-gl makefile updated for Mesa 7.0
|
||||
#
|
||||
# updated : by Heromyth, on 2007-7-21
|
||||
# Email : zxpmyth@yahoo.com.cn
|
||||
# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
|
||||
# The others havn't been tested yet.
|
||||
# 2) The generated DLLs are *not* compatible with the ones built
|
||||
# with the other compilers like VC8, especially for GLUT.
|
||||
# 3) Although more tests are needed, it can be used individually!
|
||||
|
||||
|
||||
#
|
||||
# Available options:
|
||||
|
|
@ -52,7 +62,6 @@
|
|||
#
|
||||
|
||||
|
||||
|
||||
.PHONY: all clean
|
||||
.INTERMEDIATE: x86/gen_matypes.exe
|
||||
.SUFFIXES: .rc .res
|
||||
|
|
@ -60,23 +69,37 @@
|
|||
# Set this to the prefix of your build tools, i.e. mingw32-
|
||||
TOOLS_PREFIX = mingw32-
|
||||
|
||||
ifeq ($(ICD),1)
|
||||
LIB_NAME = mesa32
|
||||
else
|
||||
LIB_NAME = opengl32
|
||||
endif
|
||||
|
||||
DLL_EXT = .dll
|
||||
IMP_EXT = .a
|
||||
LIB_PRE = lib
|
||||
STRIP = -s
|
||||
|
||||
AR = ar
|
||||
ARFLAGS = crus
|
||||
DLLTOOL = dlltool
|
||||
|
||||
TOP = ../..
|
||||
GLIDE ?= $(TOP)/glide3
|
||||
LIBDIR = $(TOP)/lib
|
||||
ifeq ($(ICD),1)
|
||||
GL_DLL = mesa32.dll
|
||||
GL_IMP = libmesa32.a
|
||||
else
|
||||
GL_DLL = opengl32.dll
|
||||
GL_IMP = libopengl32.a
|
||||
endif
|
||||
|
||||
LDLIBS = -lgdi32
|
||||
GL_DLL = $(LIB_NAME)$(DLL_EXT)
|
||||
GL_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT)
|
||||
|
||||
MESA_LIB = libmesa.a
|
||||
CC = $(TOOLS_PREFIX)gcc
|
||||
CFLAGS += -DBUILD_GL32 -D_OPENGL32_
|
||||
CFLAGS += $(INCLUDE_DIRS)
|
||||
CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1
|
||||
|
||||
LDLIBS = -lgdi32 -luser32 -liberty
|
||||
LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at
|
||||
|
||||
CFLAGS += -DBUILD_GL32 -D_DLL -DMESA_MINWARN
|
||||
CFLAGS += -DNDEBUG -DUSE_EXTERNAL_DXTN_LIB=1
|
||||
|
||||
ifeq ($(FX),1)
|
||||
CFLAGS += -I$(GLIDE)/include -DFX
|
||||
LDLIBS += -L$(GLIDE)/lib -lglide3x
|
||||
|
|
@ -87,12 +110,11 @@ else
|
|||
CFLAGS += -DUSE_MGL_NAMESPACE
|
||||
GL_DEF = drivers/windows/icd/mesa.def
|
||||
else
|
||||
GL_DEF = drivers/windows/gdi/mesa.def
|
||||
GL_DEF = $(LIB_NAME).def
|
||||
endif
|
||||
endif
|
||||
|
||||
AR = ar
|
||||
ARFLAGS = crus
|
||||
|
||||
|
||||
UNLINK = del $(subst /,\,$(1))
|
||||
ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
|
||||
|
|
@ -104,6 +126,8 @@ endif
|
|||
|
||||
include sources
|
||||
|
||||
CFLAGS += $(INCLUDE_DIRS)
|
||||
|
||||
ifeq ($(X86),1)
|
||||
CFLAGS += -DUSE_X86_ASM
|
||||
CFLAGS += -DUSE_MMX_ASM
|
||||
|
|
@ -140,22 +164,23 @@ RESOURCE = $(GL_RES:.rc=.res)
|
|||
|
||||
.c.o:
|
||||
$(CC) -o $@ $(CFLAGS) -c $<
|
||||
.S.o:
|
||||
$(CC) -o $@ $(CFLAGS) -c $<
|
||||
.s.o:
|
||||
$(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
|
||||
|
||||
.rc.res:
|
||||
windres -o $@ -Irc -Ocoff $<
|
||||
|
||||
|
||||
all: $(LIBDIR) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP)
|
||||
|
||||
$(LIBDIR):
|
||||
mkdir -p $(LIBDIR)
|
||||
|
||||
$(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE)
|
||||
$(TOOLS_PREFIX)dllwrap -o $(LIBDIR)/$(GL_DLL) --output-lib $(LIBDIR)/$(GL_IMP) \
|
||||
--target i386-mingw32 --def $(GL_DEF) -Wl,-enable-stdcall-fixup \
|
||||
$^ $(LDLIBS)
|
||||
$(CC) $(LDFLAGS) -o $(LIBDIR)/$(GL_DLL) $^ $(LDLIBS)
|
||||
$(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GL_DEF) $^
|
||||
$(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GL_IMP) --def $(LIBDIR)/$(GL_DEF)
|
||||
|
||||
|
||||
$(X86_OBJECTS): x86/matypes.h
|
||||
|
||||
|
|
@ -187,17 +212,21 @@ tnl/t_vtx_x86_gcc.o: tnl/t_vtx_x86_gcc.S
|
|||
$(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $<
|
||||
|
||||
clean:
|
||||
-$(call UNLINK,array_cache/*.o)
|
||||
-$(call UNLINK,glapi/*.o)
|
||||
-$(call UNLINK,main/*.o)
|
||||
-$(call UNLINK,math/*.o)
|
||||
-$(call UNLINK,vbo/*.o)
|
||||
-$(call UNLINK,shader/*.o)
|
||||
-$(call UNLINK,shader/slang/*.o)
|
||||
-$(call UNLINK,shader/grammar/*.o)
|
||||
-$(call UNLINK,sparc/*.o)
|
||||
-$(call UNLINK,ppc/*.o)
|
||||
-$(call UNLINK,swrast/*.o)
|
||||
-$(call UNLINK,swrast_setup/*.o)
|
||||
-$(call UNLINK,tnl/*.o)
|
||||
-$(call UNLINK,x86/*.o)
|
||||
-$(call UNLINK,x86/rtasm/*.o)
|
||||
-$(call UNLINK,x86-64/*.o)
|
||||
-$(call UNLINK,drivers/common/*.o)
|
||||
-$(call UNLINK,drivers/glide/*.o)
|
||||
-$(call UNLINK,drivers/windows/fx/*.o)
|
||||
|
|
|
|||
|
|
@ -25,11 +25,10 @@
|
|||
|
||||
#include "glheader.h"
|
||||
#include "imports.h"
|
||||
#include "arrayobj.h"
|
||||
#include "buffers.h"
|
||||
#include "context.h"
|
||||
#include "framebuffer.h"
|
||||
#include "program.h"
|
||||
#include "prog_execute.h"
|
||||
#include "queryobj.h"
|
||||
#include "renderbuffer.h"
|
||||
#include "texcompress.h"
|
||||
|
|
@ -44,9 +43,10 @@
|
|||
#include "fbobject.h"
|
||||
#include "texrender.h"
|
||||
#endif
|
||||
#include "shader_api.h"
|
||||
#include "arrayobj.h"
|
||||
|
||||
#include "shader/program.h"
|
||||
#include "shader/prog_execute.h"
|
||||
#include "shader/shader_api.h"
|
||||
#include "driverfuncs.h"
|
||||
#include "tnl/tnl.h"
|
||||
#include "swrast/swrast.h"
|
||||
|
|
|
|||
|
|
@ -134,7 +134,6 @@ static bool directfbgl_init_visual ( GLvisual *visual,
|
|||
static bool directfbgl_create_context ( GLcontext *context,
|
||||
GLframebuffer *framebuffer,
|
||||
GLvisual *visual,
|
||||
DFBSurfacePixelFormat format,
|
||||
IDirectFBGL_data *data );
|
||||
static void directfbgl_destroy_context( GLcontext *context,
|
||||
GLframebuffer *framebuffer );
|
||||
|
|
@ -340,8 +339,9 @@ Construct( IDirectFBGL *thiz, IDirectFBSurface *surface )
|
|||
}
|
||||
|
||||
/* Create context. */
|
||||
if (!directfbgl_create_context( &data->context, &data->framebuffer,
|
||||
&data->visual, data->format, data )) {
|
||||
if (!directfbgl_create_context( &data->context,
|
||||
&data->framebuffer,
|
||||
&data->visual, data )) {
|
||||
D_ERROR( "DirectFBGL/Mesa: failed to create context.\n" );
|
||||
IDirectFBGL_Mesa_Destruct( thiz );
|
||||
return DFB_UNSUPPORTED;
|
||||
|
|
@ -762,11 +762,10 @@ directfbgl_init_visual( GLvisual *visual,
|
|||
}
|
||||
|
||||
static bool
|
||||
directfbgl_create_context( GLcontext *context,
|
||||
GLframebuffer *framebuffer,
|
||||
GLvisual *visual,
|
||||
DFBSurfacePixelFormat format,
|
||||
IDirectFBGL_data *data )
|
||||
directfbgl_create_context( GLcontext *context,
|
||||
GLframebuffer *framebuffer,
|
||||
GLvisual *visual,
|
||||
IDirectFBGL_data *data )
|
||||
{
|
||||
struct dd_function_table functions;
|
||||
|
||||
|
|
@ -800,7 +799,7 @@ directfbgl_create_context( GLcontext *context,
|
|||
data->render.Delete = dfbDeleteRenderbuffer;
|
||||
data->render.AllocStorage = dfbRenderbufferStorage;
|
||||
|
||||
switch (format) {
|
||||
switch (data->format) {
|
||||
case DSPF_RGB332:
|
||||
data->render.GetRow = get_row_RGB332;
|
||||
data->render.GetValues = get_values_RGB332;
|
||||
|
|
@ -887,6 +886,9 @@ directfbgl_create_context( GLcontext *context,
|
|||
return false;
|
||||
}
|
||||
|
||||
data->render.Width = data->width;
|
||||
data->render.Height = data->height;
|
||||
|
||||
_mesa_add_renderbuffer( framebuffer, BUFFER_FRONT_LEFT, &data->render );
|
||||
|
||||
_mesa_add_soft_renderbuffers( framebuffer,
|
||||
|
|
@ -908,8 +910,11 @@ static void
|
|||
directfbgl_destroy_context( GLcontext *context,
|
||||
GLframebuffer *framebuffer )
|
||||
{
|
||||
_mesa_free_framebuffer_data( framebuffer );
|
||||
_mesa_notifyDestroy( context );
|
||||
_swsetup_DestroyContext( context );
|
||||
_swrast_DestroyContext( context );
|
||||
_tnl_DestroyContext( context );
|
||||
_vbo_DestroyContext( context );
|
||||
//_mesa_free_framebuffer_data( framebuffer );
|
||||
_mesa_free_context_data( context );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,11 +50,6 @@ SHARED_INCLUDES = \
|
|||
-I$(TOP)/src/mesa \
|
||||
-I$(TOP)/src/mesa/main \
|
||||
-I$(TOP)/src/mesa/glapi \
|
||||
-I$(TOP)/src/mesa/math \
|
||||
-I$(TOP)/src/mesa/transform \
|
||||
-I$(TOP)/src/mesa/shader \
|
||||
-I$(TOP)/src/mesa/swrast \
|
||||
-I$(TOP)/src/mesa/swrast_setup \
|
||||
-I$(TOP)/src/egl/main \
|
||||
-I$(TOP)/src/egl/drivers/dri \
|
||||
$(LIBDRM_CFLAGS)
|
||||
|
|
@ -101,8 +96,8 @@ clean:
|
|||
|
||||
|
||||
install: $(LIBNAME)
|
||||
$(INSTALL) -d $(DRI_DRIVER_INSTALL_DIR)
|
||||
$(INSTALL) -m 755 $(LIBNAME) $(DRI_DRIVER_INSTALL_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
|
||||
$(INSTALL) -m 755 $(LIBNAME) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR)
|
||||
|
||||
|
||||
include depend
|
||||
|
|
|
|||
|
|
@ -428,10 +428,12 @@ __driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp)
|
|||
|
||||
if (pdp->pClipRects) {
|
||||
_mesa_free(pdp->pClipRects);
|
||||
pdp->pClipRects = NULL;
|
||||
}
|
||||
|
||||
if (pdp->pBackClipRects) {
|
||||
_mesa_free(pdp->pBackClipRects);
|
||||
pdp->pBackClipRects = NULL;
|
||||
}
|
||||
|
||||
DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
|
||||
|
|
|
|||
|
|
@ -1478,9 +1478,10 @@ static const char ImageTransformParameterfvHP_names[] =
|
|||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_ARB_vertex_program)
|
||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
|
||||
static const char VertexAttrib4ivARB_names[] =
|
||||
"ip\0" /* Parameter signature */
|
||||
"glVertexAttrib4iv\0"
|
||||
"glVertexAttrib4ivARB\0"
|
||||
"";
|
||||
#endif
|
||||
|
|
@ -1586,9 +1587,10 @@ static const char PixelTransformParameterfvEXT_names[] =
|
|||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_ARB_vertex_program)
|
||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
|
||||
static const char VertexAttrib4bvARB_names[] =
|
||||
"ip\0" /* Parameter signature */
|
||||
"glVertexAttrib4bv\0"
|
||||
"glVertexAttrib4bvARB\0"
|
||||
"";
|
||||
#endif
|
||||
|
|
@ -2391,9 +2393,10 @@ static const char GetAttribLocationARB_names[] =
|
|||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_ARB_vertex_program)
|
||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
|
||||
static const char VertexAttrib4ubvARB_names[] =
|
||||
"ip\0" /* Parameter signature */
|
||||
"glVertexAttrib4ubv\0"
|
||||
"glVertexAttrib4ubvARB\0"
|
||||
"";
|
||||
#endif
|
||||
|
|
@ -2910,9 +2913,10 @@ static const char ReplacementCodeuiColor4ubVertex3fSUN_names[] =
|
|||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_ARB_vertex_program)
|
||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
|
||||
static const char VertexAttrib4usvARB_names[] =
|
||||
"ip\0" /* Parameter signature */
|
||||
"glVertexAttrib4usv\0"
|
||||
"glVertexAttrib4usvARB\0"
|
||||
"";
|
||||
#endif
|
||||
|
|
@ -4393,9 +4397,10 @@ static const char WindowPos4iMESA_names[] =
|
|||
"";
|
||||
#endif
|
||||
|
||||
#if defined(need_GL_ARB_vertex_program)
|
||||
#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program)
|
||||
static const char VertexAttrib4uivARB_names[] =
|
||||
"ip\0" /* Parameter signature */
|
||||
"glVertexAttrib4uiv\0"
|
||||
"glVertexAttrib4uivARB\0"
|
||||
"";
|
||||
#endif
|
||||
|
|
@ -6257,6 +6262,8 @@ static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
|
|||
{ GetVertexAttribivARB_names, GetVertexAttribivARB_remap_index, -1 },
|
||||
{ CreateProgram_names, CreateProgram_remap_index, -1 },
|
||||
{ StencilFuncSeparate_names, StencilFuncSeparate_remap_index, -1 },
|
||||
{ VertexAttrib4ivARB_names, VertexAttrib4ivARB_remap_index, -1 },
|
||||
{ VertexAttrib4bvARB_names, VertexAttrib4bvARB_remap_index, -1 },
|
||||
{ VertexAttrib3dARB_names, VertexAttrib3dARB_remap_index, -1 },
|
||||
{ VertexAttrib4fARB_names, VertexAttrib4fARB_remap_index, -1 },
|
||||
{ VertexAttrib4fvARB_names, VertexAttrib4fvARB_remap_index, -1 },
|
||||
|
|
@ -6270,6 +6277,7 @@ static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
|
|||
{ VertexAttrib1dvARB_names, VertexAttrib1dvARB_remap_index, -1 },
|
||||
{ GetVertexAttribfvARB_names, GetVertexAttribfvARB_remap_index, -1 },
|
||||
{ GetAttribLocationARB_names, GetAttribLocationARB_remap_index, -1 },
|
||||
{ VertexAttrib4ubvARB_names, VertexAttrib4ubvARB_remap_index, -1 },
|
||||
{ Uniform3ivARB_names, Uniform3ivARB_remap_index, -1 },
|
||||
{ VertexAttrib4sARB_names, VertexAttrib4sARB_remap_index, -1 },
|
||||
{ VertexAttrib2dvARB_names, VertexAttrib2dvARB_remap_index, -1 },
|
||||
|
|
@ -6282,6 +6290,7 @@ static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
|
|||
{ VertexAttrib4NuivARB_names, VertexAttrib4NuivARB_remap_index, -1 },
|
||||
{ Uniform4fARB_names, Uniform4fARB_remap_index, -1 },
|
||||
{ VertexAttrib1dARB_names, VertexAttrib1dARB_remap_index, -1 },
|
||||
{ VertexAttrib4usvARB_names, VertexAttrib4usvARB_remap_index, -1 },
|
||||
{ LinkProgramARB_names, LinkProgramARB_remap_index, -1 },
|
||||
{ ShaderSourceARB_names, ShaderSourceARB_remap_index, -1 },
|
||||
{ VertexAttrib3svARB_names, VertexAttrib3svARB_remap_index, -1 },
|
||||
|
|
@ -6311,6 +6320,7 @@ static const struct dri_extension_function GL_VERSION_2_0_functions[] = {
|
|||
{ DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 },
|
||||
{ Uniform1fvARB_names, Uniform1fvARB_remap_index, -1 },
|
||||
{ EnableVertexAttribArrayARB_names, EnableVertexAttribArrayARB_remap_index, -1 },
|
||||
{ VertexAttrib4uivARB_names, VertexAttrib4uivARB_remap_index, -1 },
|
||||
{ VertexAttrib4svARB_names, VertexAttrib4svARB_remap_index, -1 },
|
||||
{ GetShaderiv_names, GetShaderiv_remap_index, -1 },
|
||||
{ VertexAttrib2svARB_names, VertexAttrib2svARB_remap_index, -1 },
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@
|
|||
do { \
|
||||
GLuint p = *(volatile GLuint *) GET_PTR(_x, _y); \
|
||||
__asm__ __volatile__( "bswap %0; rorl $8, %0" \
|
||||
: "=r" (p) : "r" (p) ); \
|
||||
: "=r" (p) : "0" (p) ); \
|
||||
((GLuint *)rgba)[0] = p; \
|
||||
} while (0)
|
||||
# elif defined( MESA_BIG_ENDIAN )
|
||||
|
|
|
|||
|
|
@ -288,8 +288,8 @@ i810InitDriver(__DRIscreenPrivate *sPriv)
|
|||
i810Screen->depth.handle,
|
||||
i810Screen->depth.size,
|
||||
(drmAddress *)&i810Screen->depth.map) != 0) {
|
||||
FREE(i810Screen);
|
||||
drmUnmap(i810Screen->back.map, i810Screen->back.size);
|
||||
FREE(i810Screen);
|
||||
sPriv->private = NULL;
|
||||
__driUtilMessage("i810InitDriver: drmMap (2) failed");
|
||||
return GL_FALSE;
|
||||
|
|
|
|||
|
|
@ -380,7 +380,10 @@ static void i810CullFaceFrontFace(GLcontext *ctx, GLenum unused)
|
|||
static void i810LineWidth( GLcontext *ctx, GLfloat widthf )
|
||||
{
|
||||
i810ContextPtr imesa = I810_CONTEXT( ctx );
|
||||
int width = (int)ctx->Line._Width;
|
||||
/* AA, non-AA limits are same */
|
||||
const int width = (int) CLAMP(ctx->Line.Width,
|
||||
ctx->Const.MinLineWidth,
|
||||
ctx->Const.MaxLineWidth);
|
||||
|
||||
imesa->LcsLineWidth = 0;
|
||||
if (width & 1) imesa->LcsLineWidth |= LCS_LINEWIDTH_1_0;
|
||||
|
|
@ -396,7 +399,10 @@ static void i810LineWidth( GLcontext *ctx, GLfloat widthf )
|
|||
static void i810PointSize( GLcontext *ctx, GLfloat sz )
|
||||
{
|
||||
i810ContextPtr imesa = I810_CONTEXT( ctx );
|
||||
int size = (int)ctx->Point._Size;
|
||||
/* AA, non-AA limits are same */
|
||||
const int size = (int) CLAMP(ctx->Point.Size,
|
||||
ctx->Const.MinPointSize,
|
||||
ctx->Const.MaxPointSize);
|
||||
|
||||
imesa->LcsPointSize = 0;
|
||||
if (size & 1) imesa->LcsPointSize |= LCS_LINEWIDTH_1_0;
|
||||
|
|
|
|||
|
|
@ -112,7 +112,9 @@ static __inline__ void i810_draw_quad( i810ContextPtr imesa,
|
|||
static __inline__ void i810_draw_point( i810ContextPtr imesa,
|
||||
i810VertexPtr tmp )
|
||||
{
|
||||
GLfloat sz = imesa->glCtx->Point._Size * .5;
|
||||
GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
|
||||
imesa->glCtx->Const.MinPointSize,
|
||||
imesa->glCtx->Const.MaxPointSize);
|
||||
int vertsize = imesa->vertex_size;
|
||||
GLuint *vb = i810AllocDmaLow( imesa, 2 * 4 * vertsize );
|
||||
int j;
|
||||
|
|
|
|||
|
|
@ -59,6 +59,11 @@ do { \
|
|||
#define VRTX_TEX_SET_FMT(n, x) ((x)<<((n)*2))
|
||||
#define TEXBIND_SET(n, x) ((x)<<((n)*4))
|
||||
|
||||
static void
|
||||
i830_render_prevalidate(struct intel_context *intel)
|
||||
{
|
||||
}
|
||||
|
||||
static void i830_render_start( intelContextPtr intel )
|
||||
{
|
||||
GLcontext *ctx = &intel->ctx;
|
||||
|
|
@ -531,4 +536,5 @@ void i830InitVtbl( i830ContextPtr i830 )
|
|||
i830->intel.vtbl.update_texture_state = i830UpdateTextureState;
|
||||
i830->intel.vtbl.emit_flush = i830_emit_flush;
|
||||
i830->intel.vtbl.render_start = i830_render_start;
|
||||
i830->intel.vtbl.render_prevalidate = i830_render_prevalidate;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,19 +29,20 @@
|
|||
#include "macros.h"
|
||||
#include "enums.h"
|
||||
|
||||
#include "shader/prog_instruction.h"
|
||||
#include "shader/prog_parameter.h"
|
||||
#include "shader/program.h"
|
||||
#include "shader/programopt.h"
|
||||
|
||||
#include "tnl/tnl.h"
|
||||
#include "tnl/t_context.h"
|
||||
|
||||
#include "intel_batchbuffer.h"
|
||||
|
||||
#include "i915_reg.h"
|
||||
#include "i915_context.h"
|
||||
#include "i915_program.h"
|
||||
|
||||
#include "prog_instruction.h"
|
||||
#include "prog_parameter.h"
|
||||
#include "program.h"
|
||||
#include "programopt.h"
|
||||
|
||||
|
||||
|
||||
/* 1, -1/3!, 1/5!, -1/7! */
|
||||
|
|
@ -304,7 +305,7 @@ static void upload_program( struct i915_fragment_program *p )
|
|||
A0_MUL,
|
||||
tmp, A0_DEST_CHANNEL_X, 0,
|
||||
src0,
|
||||
i915_emit_const1f(p, 1.0/(M_PI * 2)),
|
||||
i915_emit_const1f(p, 1.0/(M_PI)),
|
||||
0);
|
||||
|
||||
i915_emit_arith( p,
|
||||
|
|
@ -319,7 +320,7 @@ static void upload_program( struct i915_fragment_program *p )
|
|||
A0_MUL,
|
||||
tmp, A0_DEST_CHANNEL_X, 0,
|
||||
tmp,
|
||||
i915_emit_const1f(p, (M_PI * 2)),
|
||||
i915_emit_const1f(p, (M_PI)),
|
||||
0);
|
||||
|
||||
/*
|
||||
|
|
@ -645,7 +646,7 @@ static void upload_program( struct i915_fragment_program *p )
|
|||
A0_MUL,
|
||||
tmp, A0_DEST_CHANNEL_X, 0,
|
||||
src0,
|
||||
i915_emit_const1f(p, 1.0/(M_PI * 2)),
|
||||
i915_emit_const1f(p, 1.0/(M_PI)),
|
||||
0);
|
||||
|
||||
i915_emit_arith( p,
|
||||
|
|
@ -660,7 +661,7 @@ static void upload_program( struct i915_fragment_program *p )
|
|||
A0_MUL,
|
||||
tmp, A0_DEST_CHANNEL_X, 0,
|
||||
tmp,
|
||||
i915_emit_const1f(p, (M_PI * 2)),
|
||||
i915_emit_const1f(p, (M_PI)),
|
||||
0);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -60,6 +60,33 @@ static GLint step_offsets[6][2] = { {0,2},
|
|||
|
||||
#define I915_TEX_UNIT_ENABLED(unit) (1<<unit)
|
||||
|
||||
static GLuint i915_compressed_alignment(GLint internal_fmt)
|
||||
{
|
||||
GLuint alignment = 4;
|
||||
|
||||
switch (internal_fmt) {
|
||||
case GL_COMPRESSED_RGB_FXT1_3DFX:
|
||||
case GL_COMPRESSED_RGBA_FXT1_3DFX:
|
||||
alignment = 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return alignment;
|
||||
}
|
||||
|
||||
static int align(int value, GLuint alignment)
|
||||
{
|
||||
return (value + alignment - 1) & ~(alignment - 1);
|
||||
}
|
||||
|
||||
static GLuint minify(GLuint d)
|
||||
{
|
||||
return MAX2(1, d >> 1);
|
||||
}
|
||||
|
||||
static void i915LayoutTextureImages( i915ContextPtr i915,
|
||||
struct gl_texture_object *tObj )
|
||||
{
|
||||
|
|
@ -161,8 +188,15 @@ static void i915LayoutTextureImages( i915ContextPtr i915,
|
|||
break;
|
||||
}
|
||||
default:
|
||||
pitch = tObj->Image[0][firstLevel]->Width * t->intel.texelBytes;
|
||||
pitch = (pitch + 3) & ~3;
|
||||
if (baseImage->IsCompressed) {
|
||||
GLuint alignment = i915_compressed_alignment(baseImage->InternalFormat);
|
||||
|
||||
pitch = align(tObj->Image[0][firstLevel]->Width, alignment) * t->intel.texelBytes;
|
||||
} else {
|
||||
pitch = tObj->Image[0][firstLevel]->Width * t->intel.texelBytes;
|
||||
pitch = (pitch + 3) & ~3;
|
||||
}
|
||||
|
||||
t->intel.base.dirty_images[0] = ~0;
|
||||
|
||||
for ( total_height = i = 0 ; i < numLevels ; i++ ) {
|
||||
|
|
@ -343,8 +377,23 @@ static void i945LayoutTextureImages( i915ContextPtr i915,
|
|||
break;
|
||||
}
|
||||
default:
|
||||
pitch = tObj->Image[0][firstLevel]->Width * t->intel.texelBytes;
|
||||
pitch = (pitch + 3) & ~3;
|
||||
if (baseImage->IsCompressed) {
|
||||
GLuint alignment = i915_compressed_alignment(baseImage->InternalFormat);
|
||||
|
||||
pitch = align(tObj->Image[0][firstLevel]->Width, alignment);
|
||||
if (numLevels > 2) {
|
||||
GLint width0 = align(minify(tObj->Image[0][firstLevel]->Width), alignment) +
|
||||
+ align(minify(minify(tObj->Image[0][firstLevel]->Width)), alignment);
|
||||
|
||||
if (width0 > pitch)
|
||||
pitch = width0;
|
||||
}
|
||||
pitch = pitch * t->intel.texelBytes;
|
||||
} else {
|
||||
pitch = tObj->Image[0][firstLevel]->Width * t->intel.texelBytes;
|
||||
pitch = (pitch + 3) & ~3;
|
||||
}
|
||||
|
||||
t->intel.base.dirty_images[0] = ~0;
|
||||
max_offset = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@
|
|||
#include "i915_reg.h"
|
||||
#include "i915_context.h"
|
||||
|
||||
static void i915_render_start( intelContextPtr intel )
|
||||
static void
|
||||
i915_render_prevalidate(struct intel_context *intel)
|
||||
{
|
||||
GLcontext *ctx = &intel->ctx;
|
||||
i915ContextPtr i915 = I915_CONTEXT(intel);
|
||||
|
|
@ -54,6 +55,10 @@ static void i915_render_start( intelContextPtr intel )
|
|||
}
|
||||
}
|
||||
|
||||
static void i915_render_start( intelContextPtr intel )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void i915_reduced_primitive_state( intelContextPtr intel,
|
||||
GLenum rprim )
|
||||
|
|
@ -64,6 +69,7 @@ static void i915_reduced_primitive_state( intelContextPtr intel,
|
|||
st1 &= ~ST1_ENABLE;
|
||||
|
||||
switch (rprim) {
|
||||
case GL_QUADS: /* from RASTERIZE(GL_QUADS) in t_dd_tritemp.h */
|
||||
case GL_TRIANGLES:
|
||||
if (intel->ctx.Polygon.StippleFlag &&
|
||||
intel->hw_stipple)
|
||||
|
|
@ -453,6 +459,7 @@ void i915InitVtbl( i915ContextPtr i915 )
|
|||
i915->intel.vtbl.lost_hardware = i915_lost_hardware;
|
||||
i915->intel.vtbl.reduced_primitive_state = i915_reduced_primitive_state;
|
||||
i915->intel.vtbl.render_start = i915_render_start;
|
||||
i915->intel.vtbl.render_prevalidate = i915_render_prevalidate;
|
||||
i915->intel.vtbl.set_color_region = i915_set_color_region;
|
||||
i915->intel.vtbl.set_z_region = i915_set_z_region;
|
||||
i915->intel.vtbl.update_color_z_regions = i915_update_color_z_regions;
|
||||
|
|
|
|||
|
|
@ -564,16 +564,16 @@ void intelWindowMoved( intelContextPtr intel )
|
|||
drmI830Sarea *sarea = intel->sarea;
|
||||
drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w,
|
||||
.y1 = dPriv->y, .y2 = dPriv->y + dPriv->h };
|
||||
drm_clip_rect_t pipeA_rect = { .x1 = sarea->pipeA_x,
|
||||
.x2 = sarea->pipeA_x + sarea->pipeA_w,
|
||||
.y1 = sarea->pipeA_y,
|
||||
.y2 = sarea->pipeA_y + sarea->pipeA_h };
|
||||
drm_clip_rect_t pipeB_rect = { .x1 = sarea->pipeB_x,
|
||||
.x2 = sarea->pipeB_x + sarea->pipeB_w,
|
||||
.y1 = sarea->pipeB_y,
|
||||
.y2 = sarea->pipeB_y + sarea->pipeB_h };
|
||||
GLint areaA = driIntersectArea( drw_rect, pipeA_rect );
|
||||
GLint areaB = driIntersectArea( drw_rect, pipeB_rect );
|
||||
drm_clip_rect_t planeA_rect = { .x1 = sarea->planeA_x,
|
||||
.x2 = sarea->planeA_x + sarea->planeA_w,
|
||||
.y1 = sarea->planeA_y,
|
||||
.y2 = sarea->planeA_y + sarea->planeA_h };
|
||||
drm_clip_rect_t planeB_rect = { .x1 = sarea->planeB_x,
|
||||
.x2 = sarea->planeB_x + sarea->planeB_w,
|
||||
.y1 = sarea->planeB_y,
|
||||
.y2 = sarea->planeB_y + sarea->planeB_h };
|
||||
GLint areaA = driIntersectArea( drw_rect, planeA_rect );
|
||||
GLint areaB = driIntersectArea( drw_rect, planeB_rect );
|
||||
GLuint flags = intel->vblank_flags;
|
||||
|
||||
if (areaB > areaA || (areaA == areaB && areaB > 0)) {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue