mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
Merge branch 'master' of ssh://git.freedesktop.org/git/mesa/mesa into pipe-video
Conflicts: src/gallium/auxiliary/Makefile src/gallium/auxiliary/SConscript src/gallium/auxiliary/util/u_format.csv src/gallium/auxiliary/vl/vl_compositor.c src/gallium/auxiliary/vl/vl_compositor.h src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h src/gallium/drivers/identity/id_objects.c src/gallium/drivers/identity/id_objects.h src/gallium/drivers/identity/id_screen.c src/gallium/drivers/nv40/Makefile src/gallium/drivers/nv40/nv40_screen.c src/gallium/drivers/softpipe/sp_texture.c src/gallium/drivers/softpipe/sp_texture.h src/gallium/drivers/softpipe/sp_video_context.c src/gallium/drivers/softpipe/sp_video_context.h src/gallium/include/pipe/p_format.h src/gallium/include/pipe/p_screen.h src/gallium/include/pipe/p_video_context.h src/gallium/include/pipe/p_video_state.h src/gallium/include/state_tracker/dri1_api.h src/gallium/include/state_tracker/drm_api.h src/gallium/state_trackers/dri/common/dri_context.c src/gallium/state_trackers/xorg/xvmc/attributes.c src/gallium/state_trackers/xorg/xvmc/block.c src/gallium/state_trackers/xorg/xvmc/context.c src/gallium/state_trackers/xorg/xvmc/subpicture.c src/gallium/state_trackers/xorg/xvmc/surface.c src/gallium/state_trackers/xorg/xvmc/tests/.gitignore src/gallium/state_trackers/xorg/xvmc/tests/Makefile src/gallium/state_trackers/xorg/xvmc/xvmc_private.h src/gallium/winsys/drm/radeon/core/radeon_drm.c src/gallium/winsys/g3dvl/vl_winsys.h src/gallium/winsys/g3dvl/xlib/xsp_winsys.c src/gallium/winsys/sw/Makefile
This commit is contained in:
commit
a8ea1dacc6
1694 changed files with 152939 additions and 74344 deletions
34
Makefile
34
Makefile
|
|
@ -180,7 +180,7 @@ ultrix-gcc:
|
|||
|
||||
# Rules for making release tarballs
|
||||
|
||||
VERSION=7.8-devel
|
||||
VERSION=7.9-devel
|
||||
DIRECTORY = Mesa-$(VERSION)
|
||||
LIB_NAME = MesaLib-$(VERSION)
|
||||
DEMO_NAME = MesaDemos-$(VERSION)
|
||||
|
|
@ -215,7 +215,6 @@ MAIN_FILES = \
|
|||
$(DIRECTORY)/include/GL/glx_mangle.h \
|
||||
$(DIRECTORY)/include/GL/glfbdev.h \
|
||||
$(DIRECTORY)/include/GL/mesa_wgl.h \
|
||||
$(DIRECTORY)/include/GL/mglmesa.h \
|
||||
$(DIRECTORY)/include/GL/osmesa.h \
|
||||
$(DIRECTORY)/include/GL/vms_x_fix.h \
|
||||
$(DIRECTORY)/include/GL/wglext.h \
|
||||
|
|
@ -244,7 +243,6 @@ MAIN_FILES = \
|
|||
$(DIRECTORY)/src/mesa/shader/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/descrip.mms \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/library/*.[ch] \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/library/*.gc \
|
||||
$(DIRECTORY)/src/mesa/shader/slang/library/Makefile \
|
||||
$(DIRECTORY)/src/mesa/swrast/*.[ch] \
|
||||
|
|
@ -322,9 +320,12 @@ GALLIUM_FILES = \
|
|||
$(DIRECTORY)/src/gallium/Makefile \
|
||||
$(DIRECTORY)/src/gallium/Makefile.template \
|
||||
$(DIRECTORY)/src/gallium/SConscript \
|
||||
$(DIRECTORY)/src/gallium/targets/Makefile.dri \
|
||||
$(DIRECTORY)/src/gallium/targets/Makefile.egl \
|
||||
$(DIRECTORY)/src/gallium/*/Makefile \
|
||||
$(DIRECTORY)/src/gallium/*/SConscript \
|
||||
$(DIRECTORY)/src/gallium/*/*/Makefile \
|
||||
$(DIRECTORY)/src/gallium/*/*/Makefile.egl \
|
||||
$(DIRECTORY)/src/gallium/*/*/Makefile.template \
|
||||
$(DIRECTORY)/src/gallium/*/*/SConscript \
|
||||
$(DIRECTORY)/src/gallium/*/*/*.[ch] \
|
||||
|
|
@ -380,15 +381,6 @@ SGI_GLU_FILES = \
|
|||
$(DIRECTORY)/src/glu/sgi/libtess/*.[ch] \
|
||||
$(DIRECTORY)/src/glu/sgi/libutil/*.[ch]
|
||||
|
||||
MESA_GLU_FILES = \
|
||||
$(DIRECTORY)/src/glu/mesa/README[12] \
|
||||
$(DIRECTORY)/src/glu/mesa/Makefile* \
|
||||
$(DIRECTORY)/src/glu/mesa/descrip.mms \
|
||||
$(DIRECTORY)/src/glu/mesa/mms_depend \
|
||||
$(DIRECTORY)/src/glu/mesa/*.def \
|
||||
$(DIRECTORY)/src/glu/mesa/depend \
|
||||
$(DIRECTORY)/src/glu/mesa/*.[ch]
|
||||
|
||||
GLW_FILES = \
|
||||
$(DIRECTORY)/src/glw/*.[ch] \
|
||||
$(DIRECTORY)/src/glw/Makefile* \
|
||||
|
|
@ -417,6 +409,18 @@ DEMO_FILES = \
|
|||
$(DIRECTORY)/progs/demos/*.cxx \
|
||||
$(DIRECTORY)/progs/demos/*.dat \
|
||||
$(DIRECTORY)/progs/demos/README \
|
||||
$(DIRECTORY)/progs/egl/eglut/Makefile \
|
||||
$(DIRECTORY)/progs/egl/eglut/*.[ch] \
|
||||
$(DIRECTORY)/progs/egl/opengl/Makefile \
|
||||
$(DIRECTORY)/progs/egl/opengl/*.[ch] \
|
||||
$(DIRECTORY)/progs/egl/opengles1/Makefile \
|
||||
$(DIRECTORY)/progs/egl/opengles1/*.[ch] \
|
||||
$(DIRECTORY)/progs/egl/opengles2/Makefile \
|
||||
$(DIRECTORY)/progs/egl/opengles2/*.[ch] \
|
||||
$(DIRECTORY)/progs/egl/openvg/Makefile \
|
||||
$(DIRECTORY)/progs/egl/openvg/*.[ch] \
|
||||
$(DIRECTORY)/progs/egl/openvg/*/Makefile \
|
||||
$(DIRECTORY)/progs/egl/openvg/*/*.[ch] \
|
||||
$(DIRECTORY)/progs/fbdev/Makefile \
|
||||
$(DIRECTORY)/progs/fbdev/glfbdevtest.c \
|
||||
$(DIRECTORY)/progs/objviewer/*.[ch] \
|
||||
|
|
@ -451,11 +455,7 @@ GLUT_FILES = \
|
|||
$(DIRECTORY)/src/glut/glx/*.[ch] \
|
||||
$(DIRECTORY)/src/glut/beos/*.[ch] \
|
||||
$(DIRECTORY)/src/glut/beos/*.cpp \
|
||||
$(DIRECTORY)/src/glut/beos/Makefile \
|
||||
$(DIRECTORY)/src/glut/fbdev/Makefile \
|
||||
$(DIRECTORY)/src/glut/fbdev/*[ch] \
|
||||
$(DIRECTORY)/src/glut/mini/*[ch] \
|
||||
$(DIRECTORY)/src/glut/mini/glut.pc.in \
|
||||
$(DIRECTORY)/src/glut/beos/Makefile
|
||||
|
||||
DEPEND_FILES = \
|
||||
$(TOP)/src/mesa/depend \
|
||||
|
|
|
|||
52
SConstruct
52
SConstruct
|
|
@ -50,9 +50,9 @@ common.AddOptions(opts)
|
|||
opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
|
||||
['mesa', 'python', 'xorg']))
|
||||
opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
|
||||
['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'identity', 'llvmpipe']))
|
||||
['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'identity', 'llvmpipe', 'nouveau', 'nv50', 'nvfx']))
|
||||
opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
|
||||
['xlib', 'vmware', 'intel', 'i965', 'gdi', 'radeon']))
|
||||
['xlib', 'vmware', 'i915', 'i965', 'gdi', 'radeon', 'graw-xlib']))
|
||||
|
||||
opts.Add(EnumVariable('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
|
||||
|
||||
|
|
@ -81,13 +81,6 @@ debug = env['debug']
|
|||
dri = env['dri']
|
||||
machine = env['machine']
|
||||
platform = env['platform']
|
||||
drawllvm = 'llvmpipe' in env['drivers']
|
||||
|
||||
# LLVM support in the Draw module
|
||||
if drawllvm:
|
||||
env.Tool('llvm')
|
||||
if not env.has_key('LLVM_VERSION'):
|
||||
drawllvm = False
|
||||
|
||||
# derived options
|
||||
x86 = machine == 'x86'
|
||||
|
|
@ -100,7 +93,6 @@ Export([
|
|||
'x86',
|
||||
'ppc',
|
||||
'dri',
|
||||
'drawllvm',
|
||||
'platform',
|
||||
'gcc',
|
||||
'msvc',
|
||||
|
|
@ -110,16 +102,25 @@ Export([
|
|||
#######################################################################
|
||||
# Environment setup
|
||||
|
||||
# Always build trace driver
|
||||
# Always build trace, identity, softpipe, and llvmpipe (where possible)
|
||||
if 'trace' not in env['drivers']:
|
||||
env['drivers'].append('trace')
|
||||
if 'identity' not in env['drivers']:
|
||||
env['drivers'].append('identity')
|
||||
if 'softpipe' not in env['drivers']:
|
||||
env['drivers'].append('softpipe')
|
||||
if env['llvm'] and 'llvmpipe' not in env['drivers']:
|
||||
env['drivers'].append('llvmpipe')
|
||||
|
||||
# Includes
|
||||
env.Append(CPPPATH = [
|
||||
env.Prepend(CPPPATH = [
|
||||
'#/include',
|
||||
])
|
||||
env.Append(CPPPATH = [
|
||||
'#/src/gallium/include',
|
||||
'#/src/gallium/auxiliary',
|
||||
'#/src/gallium/drivers',
|
||||
'#/src/gallium/winsys',
|
||||
])
|
||||
|
||||
if env['msvc']:
|
||||
|
|
@ -156,39 +157,12 @@ if platform in ('posix', 'linux', 'freebsd', 'darwin'):
|
|||
])
|
||||
if platform == 'darwin':
|
||||
env.Append(CPPDEFINES = ['_DARWIN_C_SOURCE'])
|
||||
env.Append(CPPPATH = ['/usr/X11R6/include'])
|
||||
env.Append(LIBPATH = ['/usr/X11R6/lib'])
|
||||
env.Append(LIBS = [
|
||||
'm',
|
||||
'pthread',
|
||||
'expat',
|
||||
'dl',
|
||||
])
|
||||
|
||||
# DRI
|
||||
if dri:
|
||||
env.ParseConfig('pkg-config --cflags --libs libdrm')
|
||||
env.Append(CPPDEFINES = [
|
||||
('USE_EXTERNAL_DXTN_LIB', '1'),
|
||||
'IN_DRI_DRIVER',
|
||||
'GLX_DIRECT_RENDERING',
|
||||
'GLX_INDIRECT_RENDERING',
|
||||
])
|
||||
|
||||
# LLVM support in the Draw module
|
||||
if drawllvm:
|
||||
env.Append(CPPDEFINES = ['DRAW_LLVM'])
|
||||
|
||||
# libGL
|
||||
if platform in ('linux', 'freebsd', 'darwin'):
|
||||
env.Append(LIBS = [
|
||||
'X11',
|
||||
'Xext',
|
||||
'Xxf86vm',
|
||||
'Xdamage',
|
||||
'Xfixes',
|
||||
])
|
||||
|
||||
# for debugging
|
||||
#print env.Dump()
|
||||
|
||||
|
|
|
|||
11
bin/mklib
11
bin/mklib
|
|
@ -494,13 +494,16 @@ case $ARCH in
|
|||
OPTS="${OPTS} -Wl,-Mmapfile.scope"
|
||||
fi
|
||||
|
||||
# Check if objects are SPARC v9
|
||||
# Check if objects are 64-bit
|
||||
# file says: ELF 64-bit MSB relocatable SPARCV9 Version 1
|
||||
set ${OBJECTS}
|
||||
if [ ${LINK} = "cc" -o ${LINK} = "CC" ] ; then
|
||||
SPARCV9=`file $1 | grep SPARCV9`
|
||||
if [ "${SPARCV9}" ] ; then
|
||||
OPTS="${OPTS} -xarch=v9"
|
||||
ABI64=`file $1 | grep "ELF 64-bit"`
|
||||
if [ "${ABI64}" ] ; then
|
||||
case `uname -p` in
|
||||
sparc) OPTS="${OPTS} -xarch=v9" ;;
|
||||
i386) OPTS="${OPTS} -xarch=amd64" ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
if [ "${ALTOPTS}" ] ; then
|
||||
|
|
|
|||
18
common.py
18
common.py
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
import platform as _platform
|
||||
|
||||
|
|
@ -33,6 +34,16 @@ else:
|
|||
default_machine = _platform.machine()
|
||||
default_machine = _machine_map.get(default_machine, 'generic')
|
||||
|
||||
if 'LLVM' in os.environ:
|
||||
default_llvm = 'yes'
|
||||
else:
|
||||
default_llvm = 'no'
|
||||
try:
|
||||
if subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0:
|
||||
default_llvm = 'yes'
|
||||
except:
|
||||
pass
|
||||
|
||||
if default_platform in ('linux', 'freebsd'):
|
||||
default_dri = 'yes'
|
||||
elif default_platform in ('winddk', 'windows', 'wince', 'darwin'):
|
||||
|
|
@ -53,14 +64,13 @@ def AddOptions(opts):
|
|||
from SCons.Variables.EnumVariable import EnumVariable as EnumOption
|
||||
except ImportError:
|
||||
from SCons.Options.EnumOption import EnumOption
|
||||
opts.Add(BoolOption('debug', 'debug build', 'no'))
|
||||
opts.Add(BoolOption('debug', 'debug build', 'yes'))
|
||||
opts.Add(BoolOption('profile', 'profile build', 'no'))
|
||||
opts.Add(BoolOption('quiet', 'quiet command lines', 'yes'))
|
||||
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
|
||||
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
|
||||
opts.Add(EnumOption('platform', 'target platform', default_platform,
|
||||
allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince', 'darwin', 'embedded')))
|
||||
opts.Add(EnumOption('toolchain', 'compiler toolchain', 'default',
|
||||
allowed_values=('default', 'crossmingw', 'winsdk', 'winddk')))
|
||||
opts.Add(BoolOption('llvm', 'use LLVM', 'no'))
|
||||
opts.Add('toolchain', 'compiler toolchain', 'default')
|
||||
opts.Add(BoolOption('llvm', 'use LLVM', default_llvm))
|
||||
opts.Add(BoolOption('dri', 'build DRI drivers', default_dri))
|
||||
|
|
|
|||
|
|
@ -24,6 +24,12 @@ RADEON_CFLAGS = @RADEON_CFLAGS@
|
|||
RADEON_LDFLAGS = @RADEON_LDFLAGS@
|
||||
INTEL_LIBS = @INTEL_LIBS@
|
||||
INTEL_CFLAGS = @INTEL_CFLAGS@
|
||||
X11_LIBS = @X11_LIBS@
|
||||
X11_CFLAGS = @X11_CFLAGS@
|
||||
LLVM_CFLAGS = @LLVM_CFLAGS@
|
||||
LLVM_LDFLAGS = @LLVM_LDFLAGS@
|
||||
LLVM_LIBS = @LLVM_LIBS@
|
||||
|
||||
|
||||
# Assembler
|
||||
MESA_ASM_SOURCES = @MESA_ASM_SOURCES@
|
||||
|
|
@ -73,7 +79,7 @@ EGL_DRIVERS_DIRS = @EGL_DRIVERS_DIRS@
|
|||
GALLIUM_DIRS = @GALLIUM_DIRS@
|
||||
GALLIUM_DRIVERS_DIRS = @GALLIUM_DRIVERS_DIRS@
|
||||
GALLIUM_WINSYS_DIRS = @GALLIUM_WINSYS_DIRS@
|
||||
GALLIUM_WINSYS_DRM_DIRS = @GALLIUM_WINSYS_DRM_DIRS@
|
||||
GALLIUM_TARGET_DIRS = @GALLIUM_TARGET_DIRS@
|
||||
GALLIUM_STATE_TRACKERS_DIRS = @GALLIUM_STATE_TRACKERS_DIRS@
|
||||
GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a
|
||||
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
|
||||
|
|
@ -83,7 +89,6 @@ PROGRAM_DIRS = @PROGRAM_DIRS@
|
|||
|
||||
# Driver specific build vars
|
||||
DRI_DIRS = @DRI_DIRS@
|
||||
WINDOW_SYSTEM = @WINDOW_SYSTEM@
|
||||
EGL_DISPLAYS = @EGL_DISPLAYS@
|
||||
|
||||
# Dependencies
|
||||
|
|
@ -156,3 +161,11 @@ OSMESA_PC_LIB_PRIV = @OSMESA_PC_LIB_PRIV@
|
|||
|
||||
EGL_DRI2_CFLAGS = @EGL_DRI2_CFLAGS@
|
||||
EGL_DRI2_LIBS = @EGL_DRI2_LIBS@
|
||||
|
||||
MESA_LLVM = @MESA_LLVM@
|
||||
|
||||
LLVM_VERSION = @LLVM_VERSION@
|
||||
ifneq ($(LLVM_VERSION),)
|
||||
HAVE_LLVM := 0x0$(subst .,0,$(LLVM_VERSION:svn=))
|
||||
DEFINES += -DHAVE_LLVM=$(HAVE_LLVM)
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -13,7 +13,10 @@ CC = gcc
|
|||
CXX = g++
|
||||
PIC_FLAGS = -fPIC
|
||||
DEFINES = -D_DARWIN_C_SOURCE -DPTHREADS -D_GNU_SOURCE \
|
||||
-DGLX_ALIAS_UNSUPPORTED -DGLX_INDIRECT_RENDERING
|
||||
-DGLX_ALIAS_UNSUPPORTED \
|
||||
-DGLX_DIRECT_RENDERING -DGLX_USE_APPLEGL
|
||||
|
||||
# -DGLX_INDIRECT_RENDERING \
|
||||
|
||||
# -D_GNU_SOURCE - for src/mesa/main ...
|
||||
# -DGLX_DIRECT_RENDERING - pulls in libdrm stuff in glx
|
||||
|
|
@ -49,7 +52,7 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X
|
|||
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm
|
||||
|
||||
# omit glw lib for now:
|
||||
SRC_DIRS = glsl glx mesa gallium glu glut/glx glew
|
||||
SRC_DIRS = glsl glx/apple mesa gallium glu glut/glx glew
|
||||
GLU_DIRS = sgi
|
||||
DRIVER_DIRS = osmesa
|
||||
#DRIVER_DIRS = dri
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ CONFIG_NAME = default
|
|||
|
||||
# Version info
|
||||
MESA_MAJOR=7
|
||||
MESA_MINOR=8
|
||||
MESA_MINOR=9
|
||||
MESA_TINY=0
|
||||
MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY)
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ MOTIF_CFLAGS = -I/usr/include/Motif1.2
|
|||
|
||||
# Directories to build
|
||||
LIB_DIR = lib
|
||||
SRC_DIRS = glsl mesa gallium egl gallium/winsys glu glut/glx glew glw
|
||||
SRC_DIRS = glsl mesa gallium egl gallium/winsys gallium/targets glu glut/glx glew glw
|
||||
GLU_DIRS = sgi
|
||||
DRIVER_DIRS = x11 osmesa
|
||||
# Which subdirs under $(TOP)/progs/ to enter:
|
||||
|
|
@ -98,10 +98,10 @@ EGL_DRIVERS_DIRS = glx
|
|||
# Gallium directories and
|
||||
GALLIUM_DIRS = auxiliary drivers state_trackers
|
||||
GALLIUM_AUXILIARIES = $(TOP)/src/gallium/auxiliary/libgallium.a
|
||||
GALLIUM_DRIVERS_DIRS = softpipe failover svga i915 i965 r300 trace identity
|
||||
GALLIUM_DRIVERS_DIRS = softpipe trace identity i915 i965 svga r300 nvfx nv50 failover
|
||||
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
|
||||
GALLIUM_WINSYS_DIRS = drm xlib
|
||||
GALLIUM_WINSYS_DRM_DIRS = swrast
|
||||
GALLIUM_WINSYS_DIRS = sw sw/xlib
|
||||
GALLIUM_TARGET_DIRS = libgl-xlib
|
||||
GALLIUM_STATE_TRACKERS_DIRS = glx vega
|
||||
|
||||
# native displays EGL should support
|
||||
|
|
@ -119,7 +119,7 @@ APP_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LI
|
|||
|
||||
# Program dependencies - specific GL/glut libraries added in Makefiles
|
||||
APP_LIB_DEPS = -lm
|
||||
|
||||
X11_LIBS = -lX11
|
||||
|
||||
# Installation directories (for make install)
|
||||
INSTALL_DIR = /usr/local
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGL -lXt -lX11
|
|||
SRC_DIRS = glx gallium mesa glu glut/glx glew glw
|
||||
DRIVER_DIRS = dri
|
||||
PROGRAM_DIRS =
|
||||
WINDOW_SYSTEM=dri
|
||||
|
||||
DRM_SOURCE_PATH=$(TOP)/../drm
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ CONFIG_NAME = linux-cell
|
|||
|
||||
|
||||
# Omiting other gallium drivers:
|
||||
GALLIUM_DRIVERS_DIRS = cell softpipe trace
|
||||
GALLIUM_DRIVERS_DIRS = cell softpipe trace identity
|
||||
|
||||
|
||||
# Compiler and flags
|
||||
|
|
@ -37,7 +37,7 @@ CXXFLAGS = $(COMMON_C_CPP_FLAGS)
|
|||
|
||||
|
||||
# Omitting glw here:
|
||||
SRC_DIRS = glsl mesa gallium gallium/winsys glu glut/glx glew
|
||||
SRC_DIRS = glsl mesa gallium gallium/winsys gallium/targets glu glut/glx glew
|
||||
|
||||
# Build no traditional Mesa drivers:
|
||||
DRIVER_DIRS =
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ include $(TOP)/configs/linux
|
|||
CONFIG_NAME = linux-debug
|
||||
|
||||
OPT_FLAGS = -g
|
||||
CFLAGS += -pedantic
|
||||
#CFLAGS += -pedantic
|
||||
DEFINES += -DDEBUG -DDEBUG_MATH
|
||||
|
|
|
|||
|
|
@ -52,15 +52,14 @@ GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
|
|||
|
||||
# Directories
|
||||
SRC_DIRS := glx egl $(SRC_DIRS)
|
||||
PROGRAM_DIRS := egl $(PROGRAM_DIRS)
|
||||
PROGRAM_DIRS := egl/eglut egl/opengl $(PROGRAM_DIRS)
|
||||
|
||||
# EGL directories
|
||||
EGL_DRIVERS_DIRS = glx
|
||||
|
||||
DRIVER_DIRS = dri
|
||||
WINDOW_SYSTEM = dri
|
||||
GALLIUM_WINSYS_DIRS = drm
|
||||
GALLIUM_WINSYS_DRM_DIRS = vmware intel i965
|
||||
GALLIUM_WINSYS_DIRS = sw sw/xlib drm/vmware drm/intel drm/i965
|
||||
GALLIUM_TARGET_DIRS = egl-swrast
|
||||
GALLIUM_STATE_TRACKERS_DIRS = egl
|
||||
|
||||
DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon \
|
||||
|
|
|
|||
|
|
@ -51,7 +51,5 @@ SRC_DIRS = glx gallium mesa glu glut/glx glew glw
|
|||
PROGRAM_DIRS = xdemos
|
||||
|
||||
DRIVER_DIRS = dri
|
||||
WINDOW_SYSTEM=dri
|
||||
|
||||
DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon \
|
||||
savage sis tdfx unichrome
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
|
|||
|
||||
|
||||
# Directories
|
||||
SRC_DIRS = gallium mesa gallium/winsys glu egl
|
||||
PROGRAM_DIRS = egl
|
||||
SRC_DIRS = gallium mesa gallium/winsys gallium/targets glu egl
|
||||
PROGRAM_DIRS = egl/eglut egl/opengl
|
||||
|
||||
DRIVER_DIRS = dri
|
||||
WINDOW_SYSTEM = dri
|
||||
GALLIUM_WINSYS_DIRS = egl_drm
|
||||
GALLIUM_TARGET_DIRS =
|
||||
|
||||
DRI_DIRS = intel
|
||||
|
|
|
|||
|
|
@ -6,3 +6,4 @@ CONFIG_NAME = linux-i965
|
|||
|
||||
GALLIUM_DRIVER_DIRS = i965
|
||||
GALLIUM_WINSYS_DIRS = drm/i965/xlib
|
||||
GALLIUM_TARGET_DIRS =
|
||||
|
|
|
|||
|
|
@ -50,4 +50,3 @@ GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl
|
|||
SRC_DIRS = glx glu glut/glx glew glw
|
||||
DRIVER_DIRS =
|
||||
PROGRAM_DIRS =
|
||||
WINDOW_SYSTEM=dri
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ CONFIG_NAME = linux-llvm
|
|||
GALLIUM_DRIVERS_DIRS += llvmpipe
|
||||
|
||||
OPT_FLAGS = -O3 -ansi -pedantic
|
||||
ARCH_FLAGS = -m32 -mmmx -msse -msse2 -mstackrealign
|
||||
ARCH_FLAGS = -mmmx -msse -msse2 -mstackrealign
|
||||
|
||||
DEFINES += -DNDEBUG -DGALLIUM_LLVMPIPE -DDRAW_LLVM -DHAVE_UDIS86
|
||||
DEFINES += -DNDEBUG -DGALLIUM_LLVMPIPE -DHAVE_UDIS86
|
||||
|
||||
# override -std=c99
|
||||
CFLAGS += -std=gnu99
|
||||
CFLAGS += -std=gnu99 -D__STDC_CONSTANT_MACROS
|
||||
|
||||
LLVM_VERSION := $(shell llvm-config --version)
|
||||
|
||||
|
|
@ -24,6 +24,8 @@ ifeq ($(LLVM_VERSION),)
|
|||
MESA_LLVM=0
|
||||
else
|
||||
MESA_LLVM=1
|
||||
HAVE_LLVM := 0x0$(subst .,0,$(LLVM_VERSION:svn=))
|
||||
DEFINES += -DHAVE_LLVM=$(HAVE_LLVM)
|
||||
# $(info Using LLVM version: $(LLVM_VERSION))
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ CONFIG_NAME = linux-opengl-es
|
|||
|
||||
# Directories to build
|
||||
LIB_DIR = lib
|
||||
SRC_DIRS = egl glsl mesa/es gallium gallium/winsys
|
||||
PROGRAM_DIRS = es1/screen es1/xegl es2/xegl
|
||||
SRC_DIRS = egl glsl mesa/es gallium gallium/winsys gallium/targets
|
||||
PROGRAM_DIRS = egl/eglut egl/opengles1 egl/opengles2
|
||||
|
||||
# egl st needs this
|
||||
DEFINES += -DGLX_DIRECT_RENDERING
|
||||
|
|
@ -24,5 +24,5 @@ GALLIUM_STATE_TRACKERS_DIRS = es
|
|||
# build egl_x11_{swrast,i915}.so
|
||||
GALLIUM_DRIVERS_DIRS += trace i915
|
||||
GALLIUM_STATE_TRACKERS_DIRS += egl
|
||||
GALLIUM_WINSYS_DIRS += drm
|
||||
GALLIUM_WINSYS_DRM_DIRS += intel swrast
|
||||
GALLIUM_WINSYS_DIRS += drm/intel
|
||||
GALLIUM_TARGET_DIRS += egl-swrast egl-i915
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ CONFIG_NAME = linux-osmesa
|
|||
# Compiler and flags
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS
|
||||
CFLAGS = -g -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DPTHREADS
|
||||
CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
|
||||
|
||||
# Work around aliasing bugs - developers should comment this out
|
||||
|
|
@ -17,12 +17,12 @@ CFLAGS += -fno-strict-aliasing
|
|||
CXXFLAGS += -fno-strict-aliasing
|
||||
|
||||
# Directories
|
||||
SRC_DIRS = gallium mesa glu
|
||||
SRC_DIRS = glsl mesa glu
|
||||
DRIVER_DIRS = osmesa
|
||||
PROGRAM_DIRS = osdemos
|
||||
|
||||
|
||||
# Dependencies
|
||||
OSMESA_LIB_DEPS = -lm -lpthread
|
||||
OSMESA_LIB_DEPS = -lm -lpthread -ldl
|
||||
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
|
||||
APP_LIB_DEPS = -lm -lpthread
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ OSMESA_LIB_NAME = libOSMesa16.so
|
|||
|
||||
|
||||
# Directories
|
||||
SRC_DIRS = gallium mesa glu
|
||||
SRC_DIRS = glsl mesa glu
|
||||
DRIVER_DIRS = osmesa
|
||||
PROGRAM_DIRS =
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ OSMESA_LIB_NAME = libOSMesa32.so
|
|||
|
||||
|
||||
# Directories
|
||||
SRC_DIRS = gallium mesa glu
|
||||
SRC_DIRS = glsl mesa glu
|
||||
DRIVER_DIRS = osmesa
|
||||
PROGRAM_DIRS =
|
||||
|
||||
|
|
|
|||
146
configure.ac
146
configure.ac
|
|
@ -22,6 +22,8 @@ LIBDRM_REQUIRED=2.4.15
|
|||
LIBDRM_RADEON_REQUIRED=2.4.17
|
||||
DRI2PROTO_REQUIRED=2.1
|
||||
GLPROTO_REQUIRED=1.4.11
|
||||
LIBDRM_XORG_REQUIRED=2.4.17
|
||||
LIBKMS_XORG_REQUIRED=1.0.0
|
||||
|
||||
dnl Check for progs
|
||||
AC_PROG_CPP
|
||||
|
|
@ -457,23 +459,22 @@ CORE_DIRS="glsl mesa"
|
|||
|
||||
SRC_DIRS="glew"
|
||||
GLU_DIRS="sgi"
|
||||
WINDOW_SYSTEM=""
|
||||
GALLIUM_DIRS="auxiliary drivers state_trackers"
|
||||
GALLIUM_WINSYS_DIRS=""
|
||||
GALLIUM_WINSYS_DRM_DIRS=""
|
||||
GALLIUM_TARGET_DIRS=""
|
||||
GALLIUM_WINSYS_DIRS="sw"
|
||||
GALLIUM_DRIVERS_DIRS="softpipe failover trace identity"
|
||||
GALLIUM_STATE_TRACKERS_DIRS=""
|
||||
|
||||
case "$mesa_driver" in
|
||||
xlib)
|
||||
DRIVER_DIRS="x11"
|
||||
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib"
|
||||
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
|
||||
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
|
||||
;;
|
||||
dri)
|
||||
SRC_DIRS="$SRC_DIRS glx"
|
||||
DRIVER_DIRS="dri"
|
||||
WINDOW_SYSTEM="dri"
|
||||
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm"
|
||||
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib sw/dri sw/drm"
|
||||
;;
|
||||
osmesa)
|
||||
DRIVER_DIRS="osmesa"
|
||||
|
|
@ -482,12 +483,12 @@ esac
|
|||
AC_SUBST([SRC_DIRS])
|
||||
AC_SUBST([GLU_DIRS])
|
||||
AC_SUBST([DRIVER_DIRS])
|
||||
AC_SUBST([WINDOW_SYSTEM])
|
||||
AC_SUBST([GALLIUM_DIRS])
|
||||
AC_SUBST([GALLIUM_TARGET_DIRS])
|
||||
AC_SUBST([GALLIUM_WINSYS_DIRS])
|
||||
AC_SUBST([GALLIUM_WINSYS_DRM_DIRS])
|
||||
AC_SUBST([GALLIUM_DRIVERS_DIRS])
|
||||
AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS])
|
||||
AC_SUBST([MESA_LLVM])
|
||||
|
||||
dnl
|
||||
dnl User supplied program configuration
|
||||
|
|
@ -545,8 +546,14 @@ else
|
|||
x11_pkgconfig=no
|
||||
fi
|
||||
dnl Use the autoconf macro if no pkg-config files
|
||||
if test "$x11_pkgconfig" = no; then
|
||||
if test "$x11_pkgconfig" = yes; then
|
||||
PKG_CHECK_MODULES([X11], [x11])
|
||||
else
|
||||
AC_PATH_XTRA
|
||||
test -z "$X11_CFLAGS" && X11_CFLAGS="$X_CFLAGS"
|
||||
test -z "$X11_LIBS" && X11_LIBS="$X_LIBS -lX11"
|
||||
AC_SUBST([X11_CFLAGS])
|
||||
AC_SUBST([X11_LIBS])
|
||||
fi
|
||||
|
||||
dnl Try to tell the user that the --x-* options are only used when
|
||||
|
|
@ -948,7 +955,7 @@ if test "x$enable_egl" = xyes; then
|
|||
fi
|
||||
|
||||
if test "$with_demos" = yes; then
|
||||
PROGRAM_DIRS="$PROGRAM_DIRS egl"
|
||||
PROGRAM_DIRS="$PROGRAM_DIRS egl/eglut egl/opengl"
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([EGL_LIB_DEPS])
|
||||
|
|
@ -1174,9 +1181,17 @@ AC_ARG_ENABLE([gallium],
|
|||
[enable_gallium="$enableval"],
|
||||
[enable_gallium=yes])
|
||||
if test "x$enable_gallium" = xyes; then
|
||||
SRC_DIRS="$SRC_DIRS gallium gallium/winsys"
|
||||
SRC_DIRS="$SRC_DIRS gallium gallium/winsys gallium/targets"
|
||||
AC_CHECK_HEADER([udis86.h], [HAS_UDIS86="yes"],
|
||||
[HAS_UDIS86="no"])
|
||||
AC_PATH_PROG([LLVM_CONFIG], [llvm-config], [no])
|
||||
fi
|
||||
|
||||
AC_SUBST([LLVM_CFLAGS])
|
||||
AC_SUBST([LLVM_LIBS])
|
||||
AC_SUBST([LLVM_LDFLAGS])
|
||||
AC_SUBST([LLVM_VERSION])
|
||||
|
||||
dnl
|
||||
dnl Gallium state trackers configuration
|
||||
dnl
|
||||
|
|
@ -1199,13 +1214,15 @@ yes)
|
|||
;;
|
||||
dri)
|
||||
GALLIUM_STATE_TRACKERS_DIRS="dri"
|
||||
HAVE_ST_DRI="yes"
|
||||
if test "x$enable_egl" = xyes; then
|
||||
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS egl"
|
||||
HAVE_ST_EGL="yes"
|
||||
fi
|
||||
# Have only tested st/xorg on 1.6.0 servers
|
||||
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0],
|
||||
HAVE_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
|
||||
HAVE_XORG="no")
|
||||
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6.0 libdrm >= $LIBDRM_XORG_REQUIRED libkms >= $LIBKMS_XORG_REQUIRED],
|
||||
HAVE_ST_XORG="yes"; GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg",
|
||||
HAVE_ST_XORG="no")
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
|
@ -1217,15 +1234,22 @@ yes)
|
|||
AC_MSG_ERROR([state tracker '$tracker' doesn't exist])
|
||||
|
||||
case "$tracker" in
|
||||
dri)
|
||||
if test "x$mesa_driver" != xdri; then
|
||||
AC_MSG_ERROR([cannot build dri state tracker without mesa driver set to dri])
|
||||
fi
|
||||
HAVE_ST_DRI="yes"
|
||||
;;
|
||||
egl)
|
||||
if test "x$enable_egl" != xyes; then
|
||||
AC_MSG_ERROR([cannot build egl state tracker without EGL library])
|
||||
fi
|
||||
HAVE_ST_EGL="yes"
|
||||
;;
|
||||
xorg)
|
||||
PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
|
||||
HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
|
||||
HAVE_XEXTPROTO_71="no")
|
||||
PKG_CHECK_MODULES([LIBDRM_XORG], [libdrm >= $LIBDRM_XORG_REQUIRED])
|
||||
PKG_CHECK_MODULES([LIBKMS_XORG], [libkms >= $LIBKMS_XORG_REQUIRED])
|
||||
HAVE_ST_XORG="yes"
|
||||
;;
|
||||
es)
|
||||
# mesa/es is required to build es state tracker
|
||||
|
|
@ -1237,6 +1261,12 @@ yes)
|
|||
;;
|
||||
esac
|
||||
|
||||
if test "x$HAVE_ST_XORG" = xyes; then
|
||||
PKG_CHECK_MODULES(XEXT, [xextproto >= 7.0.99.1],
|
||||
HAVE_XEXTPROTO_71="yes"; DEFINES="$DEFINES -DHAVE_XEXTPROTO_71",
|
||||
HAVE_XEXTPROTO_71="no")
|
||||
fi
|
||||
|
||||
AC_ARG_WITH([egl-displays],
|
||||
[AS_HELP_STRING([--with-egl-displays@<:@=DIRS...@:>@],
|
||||
[comma delimited native displays libEGL supports, e.g.
|
||||
|
|
@ -1295,6 +1325,54 @@ AC_ARG_WITH([max-height],
|
|||
[AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])]
|
||||
)
|
||||
|
||||
dnl
|
||||
dnl Gallium LLVM
|
||||
dnl
|
||||
AC_ARG_ENABLE([gallium-llvm],
|
||||
[AS_HELP_STRING([--enable-gallium-llvm],
|
||||
[build gallium LLVM support @<:@default=disabled@:>@])],
|
||||
[enable_gallium_llvm="$enableval"],
|
||||
[enable_gallium_llvm=auto])
|
||||
if test "x$enable_gallium_llvm" = xyes; then
|
||||
if test "x$LLVM_CONFIG" != xno; then
|
||||
LLVM_VERSION=`$LLVM_CONFIG --version`
|
||||
LLVM_CFLAGS=`$LLVM_CONFIG --cflags`
|
||||
LLVM_LIBS="`$LLVM_CONFIG --libs jit interpreter nativecodegen bitwriter` -lstdc++"
|
||||
|
||||
if test "x$HAS_UDIS86" != xno; then
|
||||
LLVM_LIBS="$LLVM_LIBS -ludis86"
|
||||
DEFINES="$DEFINES -DHAVE_UDIS86"
|
||||
fi
|
||||
LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
|
||||
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS llvmpipe"
|
||||
DEFINES="$DEFINES -DMESA_LLVM -D__STDC_CONSTANT_MACROS"
|
||||
MESA_LLVM=1
|
||||
else
|
||||
MESA_LLVM=0
|
||||
fi
|
||||
else
|
||||
MESA_LLVM=0
|
||||
fi
|
||||
|
||||
dnl
|
||||
dnl Gallium helper functions
|
||||
dnl
|
||||
gallium_check_st() {
|
||||
if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_EGL" = xyes || test "x$HAVE_ST_XORG" = xyes; then
|
||||
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
|
||||
fi
|
||||
if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
|
||||
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $2"
|
||||
fi
|
||||
if test "x$HAVE_ST_EGL" = xyes && test "x$3" != x; then
|
||||
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $3"
|
||||
fi
|
||||
if test "x$HAVE_ST_XORG" = xyes && test "x$4" != x; then
|
||||
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $4"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
dnl
|
||||
dnl Gallium SVGA configuration
|
||||
dnl
|
||||
|
|
@ -1304,8 +1382,8 @@ AC_ARG_ENABLE([gallium-svga],
|
|||
[enable_gallium_svga="$enableval"],
|
||||
[enable_gallium_svga=auto])
|
||||
if test "x$enable_gallium_svga" = xyes; then
|
||||
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS vmware"
|
||||
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
|
||||
gallium_check_st "svga/drm" "dri-vmwgfx" "egl-vmwgfx" "xorg-vmwgfx"
|
||||
elif test "x$enable_gallium_svga" = xauto; then
|
||||
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS svga"
|
||||
fi
|
||||
|
|
@ -1319,9 +1397,11 @@ AC_ARG_ENABLE([gallium-intel],
|
|||
[enable_gallium_intel="$enableval"],
|
||||
[enable_gallium_intel=auto])
|
||||
if test "x$enable_gallium_intel" = xyes; then
|
||||
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel i965"
|
||||
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
|
||||
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
|
||||
gallium_check_st "i915/drm i965/drm" "dri-i915 dri-i965" "egl-i915 egl-i965" "xorg-i915 xorg-i965"
|
||||
elif test "x$enable_gallium_intel" = xauto; then
|
||||
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS i915/sw"
|
||||
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915 i965"
|
||||
fi
|
||||
|
||||
|
|
@ -1334,8 +1414,8 @@ AC_ARG_ENABLE([gallium-radeon],
|
|||
[enable_gallium_radeon="$enableval"],
|
||||
[enable_gallium_radeon=auto])
|
||||
if test "x$enable_gallium_radeon" = xyes; then
|
||||
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon"
|
||||
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
|
||||
gallium_check_st "radeon/drm" "dri-radeong" "egl-radeon" "xorg-radeon"
|
||||
elif test "x$enable_gallium_radeon" = xauto; then
|
||||
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
|
||||
fi
|
||||
|
|
@ -1349,8 +1429,8 @@ AC_ARG_ENABLE([gallium-nouveau],
|
|||
[enable_gallium_nouveau="$enableval"],
|
||||
[enable_gallium_nouveau=no])
|
||||
if test "x$enable_gallium_nouveau" = xyes; then
|
||||
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
|
||||
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv30 nv40 nv50"
|
||||
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50"
|
||||
gallium_check_st "nouveau/drm" "dri-nouveau" "egl-nouveau" "xorg-nouveau"
|
||||
fi
|
||||
|
||||
dnl
|
||||
|
|
@ -1379,11 +1459,16 @@ dnl Gallium swrast configuration
|
|||
dnl
|
||||
AC_ARG_ENABLE([gallium-swrast],
|
||||
[AS_HELP_STRING([--enable-gallium-swrast],
|
||||
[build gallium swrast @<:@default=disabled@:>@])],
|
||||
[build gallium swrast @<:@default=auto@:>@])],
|
||||
[enable_gallium_swrast="$enableval"],
|
||||
[enable_gallium_swrast=auto])
|
||||
if test "x$enable_gallium_swrast" = xyes; then
|
||||
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS swrast"
|
||||
if test "x$enable_gallium_swrast" = xyes || test "x$enable_gallium_swrast" = xauto; then
|
||||
if test "x$HAVE_ST_DRI" = xyes; then
|
||||
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS dri-swrast"
|
||||
fi
|
||||
if test "x$HAVE_ST_EGL" = xyes; then
|
||||
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS egl-swrast"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl prepend CORE_DIRS to SRC_DIRS
|
||||
|
|
@ -1435,12 +1520,21 @@ fi
|
|||
fi
|
||||
echo " Use XCB: $enable_xcb"
|
||||
|
||||
echo ""
|
||||
if test "x$MESA_LLVM" == x1; then
|
||||
echo " llvm: yes"
|
||||
echo " llvm-config: $LLVM_CONFIG"
|
||||
echo " llvm-version: $LLVM_VERSION"
|
||||
else
|
||||
echo " llvm: no"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then
|
||||
echo " Gallium: yes"
|
||||
echo " Gallium dirs: $GALLIUM_DIRS"
|
||||
echo " Target dirs: $GALLIUM_TARGET_DIRS"
|
||||
echo " Winsys dirs: $GALLIUM_WINSYS_DIRS"
|
||||
echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS"
|
||||
echo " Driver dirs: $GALLIUM_DRIVERS_DIRS"
|
||||
echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS"
|
||||
else
|
||||
|
|
|
|||
11
docs/GL3.txt
11
docs/GL3.txt
|
|
@ -16,6 +16,7 @@ GLSL changes (GL_EXT_gpu_shader4, etc) not started
|
|||
Conditional rendering (GL_NV_conditional_render) DONE (swrast & softpipe)
|
||||
Map buffer subranges (GL_APPLE_flush_buffer_range) not started
|
||||
Float textures, renderbuffers some infrastructure done
|
||||
(incl. GL_EXT_packed_float, GL_EXT_shared_exponent)
|
||||
Framebuffer objects (GL_EXT_framebuffer_object) DONE
|
||||
Half-float some infrastructure done
|
||||
Multisample blit DONE
|
||||
|
|
@ -25,7 +26,7 @@ Packed depth/stencil formats DONE
|
|||
Per-buffer blend and masks (GL_EXT_draw_buffers2) DONE
|
||||
GL_EXT_texture_compression_rgtc not started
|
||||
Red and red/green texture formats Ian?
|
||||
Transform feedback (GL_EXT_transform_feedback) not started
|
||||
Transform feedback (GL_EXT_transform_feedback) ~50% done
|
||||
Vertex array objects (GL_APPLE_vertex_array_object) DONE
|
||||
sRGB framebuffer format (GL_EXT_framebuffer_sRGB) not started
|
||||
glClearBuffer commands DONE, except for dispatch
|
||||
|
|
@ -33,20 +34,20 @@ glGetStringi command DONE, except for dispatch
|
|||
glTexParameterI, glGetTexParameterI commands DONE, except for dispatch
|
||||
glVertexAttribI commands not started
|
||||
glBindFragDataLocation, glGetFragDataLocation cmds not started
|
||||
glBindBufferRange, glBindBufferBase commands not started
|
||||
glBindBufferRange, glBindBufferBase commands DONE
|
||||
|
||||
|
||||
GL 3.1:
|
||||
|
||||
GLSL 1.30 and 1.40 not started
|
||||
Instanced drawing (GL_ARB_draw_instanced) not started
|
||||
Instanced drawing (GL_ARB_draw_instanced) ~50% done
|
||||
Buffer copying (GL_ARB_copy_buffer) DONE
|
||||
Primitive restart (GL_NV_primitive_restart) not started
|
||||
16 vertex texture image units not started
|
||||
Texture buffer objs (GL_ARB_textur_buffer_object) not started
|
||||
Rectangular textures (GL_ARB_texture_rectangle) DONE
|
||||
Uniform buffer objs (GL_ARB_uniform_buffer_object) not started
|
||||
Signed normalized texture formats not started
|
||||
Signed normalized texture formats ~50% done
|
||||
|
||||
|
||||
GL 3.2:
|
||||
|
|
@ -56,7 +57,7 @@ GLSL 1.50 not started
|
|||
Geometry shaders (GL_ARB_geometry_shader4) partially done (Zack)
|
||||
BGRA vertex order (GL_ARB_vertex_array_bgra) DONE
|
||||
Base vertex offset(GL_ARB_draw_elements_base_vertex) DONE
|
||||
Frag shader coord (GL_ARB_fragment_coord_conventions) not started
|
||||
Frag shader coord (GL_ARB_fragment_coord_conventions) DONE (swrast, gallium)
|
||||
Provoking vertex (GL_ARB_provoking_vertex) DONE
|
||||
Seamless cubemaps (GL_ARB_seamless_cube_map) DONE, mostly?
|
||||
Multisample textures (GL_ARB_texture_multisample) not started
|
||||
|
|
|
|||
|
|
@ -644,7 +644,7 @@ Hints and Special Features:
|
|||
|
||||
- The Voodoo driver supports the GL_EXT_paletted_texture. it works
|
||||
only with GL_COLOR_INDEX8_EXT, GL_RGBA palettes and the alpha value
|
||||
is ignored because this is a limitation of the the current Glide
|
||||
is ignored because this is a limitation of the current Glide
|
||||
version and of the Voodoo hardware. See Mesa-3.1/3Dfx/demos/paltex.c for
|
||||
a demo of this extension.
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ cards.</p>
|
|||
|
||||
<ol>
|
||||
<li>
|
||||
<p>Run <code>configure</code> with the desired state trackers and and enable
|
||||
<p>Run <code>configure</code> with the desired state trackers and enable
|
||||
the Gallium driver for your hardware. For example</p>
|
||||
|
||||
<pre>
|
||||
|
|
@ -106,11 +106,11 @@ noted that the classic <code>libGL</code> is not a state tracker and cannot be
|
|||
used with EGL (unless the EGL driver in use is <code>egl_glx</code>). To build
|
||||
the OpenGL state tracker, one may append <code>glx</code> to
|
||||
<code>--with-state-trackers</code> and manually build
|
||||
<code>src/gallium/winsys/xlib/</code>.</p>
|
||||
<code>src/gallium/targets/libgl-xlib/</code>.</p>
|
||||
|
||||
<h2>Use EGL</h2>
|
||||
|
||||
<p> The demos for OpenGL ES and OpenVG can be found in <code>progs/es1/</code>,
|
||||
<p>The demos for OpenGL ES and OpenVG can be found in <code>progs/es1/</code>,
|
||||
<code>progs/es2/</code> and <code>progs/openvg/</code>. You can use them to
|
||||
test your build. For example,</p>
|
||||
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler tool
|
|||
This will create:
|
||||
</p>
|
||||
<ul>
|
||||
<li>build/windows-x86-debug/gallium/winsys/gdi/opengl32.dll — Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll
|
||||
<li>build/windows-x86-debug/gallium/targets/libgl-gdi/opengl32.dll — Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll
|
||||
<li>build/windows-x86-debug/glut/glx/glut32.dll
|
||||
<li>progs/build/windows-x86-debug/wgl/wglinfo.exe
|
||||
<li>progs/build/windows-x86-debug/trivial/tri.exe
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@
|
|||
</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-users"
|
||||
target="_parent">mesa3d-users</a> - intended for end-users of Mesa and DRI
|
||||
<li><a href="http://lists.freedesktop.org/mailman/listinfo/mesa-users"
|
||||
target="_parent">mesa-users</a> - intended for end-users of Mesa and DRI
|
||||
drivers. Newbie questions are OK, but please try the general OpenGL
|
||||
resources and Mesa/DRI documentation first.
|
||||
</li>
|
||||
<br>
|
||||
<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-dev"
|
||||
target="_parent">mesa3d-dev</a> - for Mesa, Gallium and DRI development
|
||||
<li><a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev"
|
||||
target="_parent">mesa-dev</a> - for Mesa, Gallium and DRI development
|
||||
discussion. Not for beginners.
|
||||
</li>
|
||||
<br>
|
||||
|
|
@ -30,8 +30,8 @@ target="_parent">mesa-commit</a> - relays git check-in messages
|
|||
In general, people should not post to this list.
|
||||
</li>
|
||||
<br>
|
||||
<li><a href="https://lists.sourceforge.net/lists/listinfo/mesa3d-announce"
|
||||
target="_parent">mesa3d-announce</a> - announcements of new Mesa
|
||||
<li><a href="http://lists.freedesktop.org/mailman/listinfo/mesa-announce"
|
||||
target="_parent">mesa-announce</a> - announcements of new Mesa
|
||||
versions are sent to this list. Very low traffic.
|
||||
</li>
|
||||
</ul>
|
||||
|
|
@ -40,6 +40,15 @@ versions are sent to this list. Very low traffic.
|
|||
Follow the links above for list archives.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The old Mesa lists hosted at SourceForge are no longer in use.
|
||||
The archives are still available, however:
|
||||
<a href="http://sourceforge.net/mailarchive/forum.php?forum_name=mesa3d-announce" target="_parent">mesa3d-announce</a>,
|
||||
<a href="http://sourceforge.net/mailarchive/forum.php?forum_name=mesa3d-users" target="_parent">mesa3d-users</a>,
|
||||
<a href="http://sourceforge.net/mailarchive/forum.php?forum_name=mesa3d-dev" target="_parent">mesa3d-dev</a>.
|
||||
</p>
|
||||
|
||||
|
||||
<p>For mailing lists about Direct Rendering Modules (drm) in Linux/BSD
|
||||
kernels, see the
|
||||
<a href="http://dri.freedesktop.org/wiki/MailingLists" target="_parent">
|
||||
|
|
|
|||
|
|
@ -10,6 +10,27 @@
|
|||
|
||||
<H1>News</H1>
|
||||
|
||||
|
||||
<h2>April 5, 2010</h2>
|
||||
|
||||
<p>
|
||||
<a href="relnotes-7.8.1.html">Mesa 7.8.1</a> is released. This is a bug-fix
|
||||
release for a few critical issues in the 7.8 release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>March 28, 2010</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.7.1.html">Mesa 7.7.1</a> is released. This is a bug-fix
|
||||
release fixing issues found in the 7.7 release.
|
||||
</p>
|
||||
<p>
|
||||
Also, <a href="relnotes-7.8.html">Mesa 7.8</a> is released. This is a new
|
||||
development release.
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
<h2>December 21, 2009</h2>
|
||||
<p>
|
||||
<a href="relnotes-7.6.1.html">Mesa 7.6.1</a> is released. This is a bug-fix
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.7.1 Release Notes / date tbd</H1>
|
||||
<H1>Mesa 7.7.1 Release Notes / March 28, 2010</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.7.1 is a bug-fix release.
|
||||
|
|
@ -26,16 +26,18 @@ for DRI hardware acceleration.
|
|||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
tbd
|
||||
3ab0638cfa7ce8157337a229cf0db2c4 MesaLib-7.7.1.tar.gz
|
||||
46664d99e03f1e3ac078a7fea02af115 MesaLib-7.7.1.tar.bz2
|
||||
4e73ba8abb59aff79485eb95d7cefff7 MesaLib-7.7.1.zip
|
||||
bf1b108983995f7a712cf3343df1c918 MesaDemos-7.7.1.tar.gz
|
||||
aeb39645d80d656e0adebaa09e5bcd03 MesaDemos-7.7.1.tar.bz2
|
||||
01c49b7454fd292244eaf8bdc6ed8cf0 MesaDemos-7.7.1.zip
|
||||
37ec6386693dcb6dc770d1efd63a7a93 MesaGLUT-7.7.1.tar.gz
|
||||
1e16c85282f843791a21f7bc7b6a1ca8 MesaGLUT-7.7.1.tar.bz2
|
||||
d352c9e36a8e4d1059f4abc017b131e0 MesaGLUT-7.7.1.zip
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>New features</h2>
|
||||
<ul>
|
||||
<li>tbd
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Assorted fixes to VMware SVGA gallium driver.
|
||||
|
|
@ -45,6 +47,12 @@ tbd
|
|||
<li>Gallium SSE codegen for XPD didn't always work.
|
||||
<li>Fixed Windows build.
|
||||
<li>Fixed broken glMultiDrawElements().
|
||||
<li>Silence bogus GL errors generated in glxinfo.
|
||||
<li>Fixed several render to texture bugs.
|
||||
<li>Assorted bug fixes in Mesa/Gallium state tracker including
|
||||
glCopy/DrawPixels() to FBOs.
|
||||
<li>Assorted fixes to Gallium drivers.
|
||||
<li>Fixed broken glPush/PopClientAttrib() for vertex arrays in GLX code.
|
||||
</ul>
|
||||
|
||||
|
||||
|
|
|
|||
62
docs/relnotes-7.8.1.html
Normal file
62
docs/relnotes-7.8.1.html
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<HTML>
|
||||
|
||||
<TITLE>Mesa Release Notes</TITLE>
|
||||
|
||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.8.1 Release Notes / April, 5, 2010</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.8.1 fixes a couple critical bugs in the recent Mesa 7.8 release. Even
|
||||
though this is a bug fix release, given its proximity to the 7.8 release, a
|
||||
new development release, it should also be considered new development release.
|
||||
People who are concerned with stability and reliability should stick
|
||||
with a previous release, such as 7.7.1, or wait for Mesa 7.8.2.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.8.1 implements the OpenGL 2.1 API, but the version reported by
|
||||
glGetString(GL_VERSION) depends on the particular driver being used.
|
||||
Some drivers don't support all the features required in OpenGL 2.1.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
62e8e47cbd63741b4bbe634dcdc8a56a MesaLib-7.8.1.tar.gz
|
||||
25ec15f8e41fde6d206118cc786dbac4 MesaLib-7.8.1.tar.bz2
|
||||
22b1153010ffdf513836ea9931159e80 MesaLib-7.8.1.zip
|
||||
c9c0a830923d3820807a08c09d521b3e MesaDemos-7.8.1.tar.gz
|
||||
9ef47f911869657c6bf2f43ebce86b61 MesaDemos-7.8.1.tar.bz2
|
||||
93720605eb3f784f9bcc289a4dd2ff52 MesaDemos-7.8.1.zip
|
||||
ed1d0b1e960afe6a3768eab747cbdbd3 MesaGLUT-7.8.1.tar.gz
|
||||
6bae516a44c6d26ff3152c960ab648e7 MesaGLUT-7.8.1.tar.bz2
|
||||
ba306f603ea73c30ee0e7efa14dc5581 MesaGLUT-7.8.1.zip
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>New features</h2>
|
||||
<p>None.</p>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Fix incorrect enums for GLX_INTEL_swap_event by updating glxext.h to
|
||||
version 27 from OpenGL.org.</li>
|
||||
<li>Fix compilation errors on non-GLX_DIRECT_RENDERING builds.</li>
|
||||
<li>Various fixes for building Mesa on OS X.</li>
|
||||
<li>Pass GLX drawable ID to dri2InvalidateBuffers. Fixes bug #27190.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Changes</h2>
|
||||
<p>None.</p>
|
||||
</body>
|
||||
</html>
|
||||
52
docs/relnotes-7.8.2.html
Normal file
52
docs/relnotes-7.8.2.html
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<HTML>
|
||||
|
||||
<TITLE>Mesa Release Notes</TITLE>
|
||||
|
||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.8.2 Release Notes / April, 5, 2010</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.8.2 is a bug fix release which fixes bugs found since the 7.8.1 release.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.8.2 implements the OpenGL 2.1 API, but the version reported by
|
||||
glGetString(GL_VERSION) depends on the particular driver being used.
|
||||
Some drivers don't support all the features required in OpenGL 2.1.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
tbd
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>New features</h2>
|
||||
<p>None.</p>
|
||||
|
||||
|
||||
<h2>Changes</h2>
|
||||
<ul>
|
||||
<li>Upgraded glext.h to version 61, and upgraded glxext.h
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
<li>Fixed Gallium glDrawPixels(GL_DEPTH_COMPONENT).
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Changes</h2>
|
||||
<p>None.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.8 Release Notes / date TBD</H1>
|
||||
<H1>Mesa 7.8 Release Notes / March 28, 2010</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.8 is a new development release.
|
||||
|
|
@ -28,7 +28,15 @@ for DRI hardware acceleration.
|
|||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
tbd
|
||||
5fcfde5383eccb3e9fd665f08a0ea59b MesaLib-7.8.tar.gz
|
||||
85cb891eecb89aae4fdd3499cccd934b MesaLib-7.8.tar.bz2
|
||||
754f39593006effc1c8ec3c27c2f1296 MesaLib-7.8.zip
|
||||
c3869c29fa6c3dbdd763f7428d271e12 MesaDemos-7.8.tar.gz
|
||||
9fe8ec184c7f78691e43c4c0a7f97d56 MesaDemos-7.8.tar.bz2
|
||||
063a96947f7b83d4ad789c6cf291b184 MesaDemos-7.8.zip
|
||||
5f4246756b7daaddb4fb3f970cad1e28 MesaGLUT-7.8.tar.gz
|
||||
ca7048a4aa7a437dcc84cc2c7d731336 MesaGLUT-7.8.tar.bz2
|
||||
b54581aeb79b585b158d6a32f94feff2 MesaGLUT-7.8.zip
|
||||
</pre>
|
||||
|
||||
|
||||
|
|
@ -38,6 +46,7 @@ tbd
|
|||
<li>GL_EXT_draw_buffers2 extension (swrast and i965 driver only)
|
||||
<li>GL_ARB_fragment_coord_conventions extension (for swrast, i965, and Gallium drivers)
|
||||
<li>GL_EXT_texture_array extension (swrast driver only)
|
||||
<li>GL_APPLE_object_purgeable extension (swrast and i945/i965 DRI drivers)
|
||||
<li>Much improved support for <a href="egl.html">EGL in Mesa</a>
|
||||
<li>New state trackers for <a href="opengles.html">OpenGL ES 1.1 and 2.0</a>
|
||||
<li>Dedicated documentation for Gallium
|
||||
|
|
|
|||
50
docs/relnotes-7.9.html
Normal file
50
docs/relnotes-7.9.html
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<HTML>
|
||||
|
||||
<TITLE>Mesa Release Notes</TITLE>
|
||||
|
||||
<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
|
||||
|
||||
<BODY>
|
||||
|
||||
<body bgcolor="#eeeeee">
|
||||
|
||||
<H1>Mesa 7.9 Release Notes / date TBD</H1>
|
||||
|
||||
<p>
|
||||
Mesa 7.9 is a new development release.
|
||||
People who are concerned with stability and reliability should stick
|
||||
with a previous release or wait for Mesa 7.9.1.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 7.9 implements the OpenGL 2.1 API, but the version reported by
|
||||
glGetString(GL_VERSION) depends on the particular driver being used.
|
||||
Some drivers don't support all the features required in OpenGL 2.1.
|
||||
</p>
|
||||
<p>
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
<pre>
|
||||
tbd
|
||||
</pre>
|
||||
|
||||
|
||||
<h2>New features</h2>
|
||||
<ul>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Bug fixes</h2>
|
||||
<ul>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Changes</h2>
|
||||
<ul>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -13,7 +13,8 @@ The release notes summarize what's new or changed in each Mesa release.
|
|||
</p>
|
||||
|
||||
<UL>
|
||||
<<<<<<< HEAD:docs/relnotes.html
|
||||
<LI><A HREF="relnotes-7.8.2.html">7.8.2 release notes</A>
|
||||
<LI><A HREF="relnotes-7.8.1.html">7.8.1 release notes</A>
|
||||
<LI><A HREF="relnotes-7.8.html">7.8 release notes</A>
|
||||
<LI><A HREF="relnotes-7.7.1.html">7.7.1 release notes</A>
|
||||
<LI><A HREF="relnotes-7.7.html">7.7 release notes</A>
|
||||
|
|
|
|||
|
|
@ -14,10 +14,6 @@ This page describes the features and status of Mesa's support for the
|
|||
OpenGL Shading Language</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Last updated on 15 December 2008.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Contents
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -393,6 +393,8 @@
|
|||
#define glEdgeFlagPointerListIBM MANGLE(EdgeFlagPointerListIBM)
|
||||
#define glEdgeFlagPointer MANGLE(EdgeFlagPointer)
|
||||
#define glEdgeFlagv MANGLE(EdgeFlagv)
|
||||
#define glEGLImageTargetRenderbufferStorageOES MANGLE(EGLImageTargetRenderbufferStorageOES)
|
||||
#define glEGLImageTargetTexture2DOES MANGLE(EGLImageTargetTexture2DOES)
|
||||
#define glElementPointerAPPLE MANGLE(ElementPointerAPPLE)
|
||||
#define glElementPointerATI MANGLE(ElementPointerATI)
|
||||
#define glEnableClientStateIndexedEXT MANGLE(EnableClientStateIndexedEXT)
|
||||
|
|
|
|||
3806
include/GL/glext.h
3806
include/GL/glext.h
File diff suppressed because it is too large
Load diff
|
|
@ -1,340 +0,0 @@
|
|||
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 3.1
|
||||
* Copyright (C) 1995-1998 Brian Paul
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* This header file is based on the REAL glut.h by Mark J. Kilgard.
|
||||
*
|
||||
* The DJGPP/ALLEGRO (DJA) GLUT implementation was written by
|
||||
* Bernhard Tschirren (bernie-t@geocities.com) for the sole purpose
|
||||
* of compiling all the sample programs (which use GLUT). Therefore,
|
||||
* is NOT AT ALL a complete version of GLUT!
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __AGLUT_H__
|
||||
#define __AGLUT_H__
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
||||
#define GLUTCALLBACK
|
||||
#define APIENTRY
|
||||
#define GLUTAPI extern
|
||||
|
||||
#define GLUT_RGB 0
|
||||
#define GLUT_RGBA GLUT_RGB
|
||||
#define GLUT_INDEX 1
|
||||
#define GLUT_SINGLE 0
|
||||
#define GLUT_DOUBLE 2
|
||||
#define GLUT_ACCUM 4
|
||||
#define GLUT_ALPHA 8
|
||||
#define GLUT_DEPTH 16
|
||||
#define GLUT_STENCIL 32
|
||||
|
||||
/* Mouse buttons. */
|
||||
#define GLUT_LEFT_BUTTON 0
|
||||
#define GLUT_MIDDLE_BUTTON 1
|
||||
#define GLUT_RIGHT_BUTTON 2
|
||||
|
||||
/* Mouse button state. */
|
||||
#define GLUT_DOWN 0
|
||||
#define GLUT_UP 1
|
||||
|
||||
/* function keys */
|
||||
#define GLUT_KEY_F1 1
|
||||
#define GLUT_KEY_F2 2
|
||||
#define GLUT_KEY_F3 3
|
||||
#define GLUT_KEY_F4 4
|
||||
#define GLUT_KEY_F5 5
|
||||
#define GLUT_KEY_F6 6
|
||||
#define GLUT_KEY_F7 7
|
||||
#define GLUT_KEY_F8 8
|
||||
#define GLUT_KEY_F9 9
|
||||
#define GLUT_KEY_F10 10
|
||||
#define GLUT_KEY_F11 11
|
||||
#define GLUT_KEY_F12 12
|
||||
|
||||
/* directional keys */
|
||||
#define GLUT_KEY_LEFT 100
|
||||
#define GLUT_KEY_UP 101
|
||||
#define GLUT_KEY_RIGHT 102
|
||||
#define GLUT_KEY_DOWN 103
|
||||
#define GLUT_KEY_PAGE_UP 104
|
||||
#define GLUT_KEY_PAGE_DOWN 105
|
||||
#define GLUT_KEY_HOME 106
|
||||
#define GLUT_KEY_END 107
|
||||
#define GLUT_KEY_INSERT 108
|
||||
|
||||
/* Entry/exit state. */
|
||||
#define GLUT_LEFT 0
|
||||
#define GLUT_ENTERED 1
|
||||
|
||||
/* Visibility state. */
|
||||
#define GLUT_NOT_VISIBLE 0
|
||||
#define GLUT_VISIBLE 1
|
||||
|
||||
/* Color index component selection values. */
|
||||
#define GLUT_RED 0
|
||||
#define GLUT_GREEN 1
|
||||
#define GLUT_BLUE 2
|
||||
|
||||
/* Layers for use. */
|
||||
#define GLUT_NORMAL 0
|
||||
#define GLUT_OVERLAY 1
|
||||
|
||||
/* Stroke font constants (use these in GLUT program). */
|
||||
#define GLUT_STROKE_ROMAN ((void*)0)
|
||||
#define GLUT_STROKE_MONO_ROMAN ((void*)1)
|
||||
|
||||
/* Bitmap font constants (use these in GLUT program). */
|
||||
#define GLUT_BITMAP_9_BY_15 ((void*)2)
|
||||
#define GLUT_BITMAP_8_BY_13 ((void*)3)
|
||||
#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
|
||||
#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
|
||||
#define GLUT_BITMAP_HELVETICA_10 ((void*)6)
|
||||
#define GLUT_BITMAP_HELVETICA_12 ((void*)7)
|
||||
#define GLUT_BITMAP_HELVETICA_18 ((void*)8)
|
||||
|
||||
/* glutGet parameters. */
|
||||
#define GLUT_WINDOW_X 100
|
||||
#define GLUT_WINDOW_Y 101
|
||||
#define GLUT_WINDOW_WIDTH 102
|
||||
#define GLUT_WINDOW_HEIGHT 103
|
||||
#define GLUT_WINDOW_BUFFER_SIZE 104
|
||||
#define GLUT_WINDOW_STENCIL_SIZE 105
|
||||
#define GLUT_WINDOW_DEPTH_SIZE 106
|
||||
#define GLUT_WINDOW_RED_SIZE 107
|
||||
#define GLUT_WINDOW_GREEN_SIZE 108
|
||||
#define GLUT_WINDOW_BLUE_SIZE 109
|
||||
#define GLUT_WINDOW_ALPHA_SIZE 110
|
||||
#define GLUT_WINDOW_ACCUM_RED_SIZE 111
|
||||
#define GLUT_WINDOW_ACCUM_GREEN_SIZE 112
|
||||
#define GLUT_WINDOW_ACCUM_BLUE_SIZE 113
|
||||
#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114
|
||||
#define GLUT_WINDOW_DOUBLEBUFFER 115
|
||||
#define GLUT_WINDOW_RGBA 116
|
||||
#define GLUT_WINDOW_PARENT 117
|
||||
#define GLUT_WINDOW_NUM_CHILDREN 118
|
||||
#define GLUT_WINDOW_COLORMAP_SIZE 119
|
||||
#define GLUT_WINDOW_NUM_SAMPLES 120
|
||||
#define GLUT_WINDOW_STEREO 121
|
||||
#define GLUT_WINDOW_CURSOR 122
|
||||
#define GLUT_SCREEN_WIDTH 200
|
||||
#define GLUT_SCREEN_HEIGHT 201
|
||||
#define GLUT_SCREEN_WIDTH_MM 202
|
||||
#define GLUT_SCREEN_HEIGHT_MM 203
|
||||
#define GLUT_MENU_NUM_ITEMS 300
|
||||
#define GLUT_DISPLAY_MODE_POSSIBLE 400
|
||||
#define GLUT_INIT_WINDOW_X 500
|
||||
#define GLUT_INIT_WINDOW_Y 501
|
||||
#define GLUT_INIT_WINDOW_WIDTH 502
|
||||
#define GLUT_INIT_WINDOW_HEIGHT 503
|
||||
#define GLUT_INIT_DISPLAY_MODE 504
|
||||
#define GLUT_ELAPSED_TIME 700
|
||||
#define GLUT_WINDOW_FORMAT_ID 123
|
||||
|
||||
/* glutDeviceGet parameters. */
|
||||
#define GLUT_HAS_KEYBOARD 600
|
||||
#define GLUT_HAS_MOUSE 601
|
||||
#define GLUT_HAS_SPACEBALL 602
|
||||
#define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
|
||||
#define GLUT_HAS_TABLET 604
|
||||
#define GLUT_NUM_MOUSE_BUTTONS 605
|
||||
#define GLUT_NUM_SPACEBALL_BUTTONS 606
|
||||
#define GLUT_NUM_BUTTON_BOX_BUTTONS 607
|
||||
#define GLUT_NUM_DIALS 608
|
||||
#define GLUT_NUM_TABLET_BUTTONS 609
|
||||
#define GLUT_DEVICE_IGNORE_KEY_REPEAT 610
|
||||
#define GLUT_DEVICE_KEY_REPEAT 611
|
||||
#define GLUT_HAS_JOYSTICK 612
|
||||
#define GLUT_OWNS_JOYSTICK 613
|
||||
#define GLUT_JOYSTICK_BUTTONS 614
|
||||
#define GLUT_JOYSTICK_AXES 615
|
||||
#define GLUT_JOYSTICK_POLL_RATE 616
|
||||
|
||||
/* glutLayerGet parameters. */
|
||||
#define GLUT_OVERLAY_POSSIBLE 800
|
||||
#define GLUT_LAYER_IN_USE 801
|
||||
#define GLUT_HAS_OVERLAY 802
|
||||
#define GLUT_TRANSPARENT_INDEX 803
|
||||
#define GLUT_NORMAL_DAMAGED 804
|
||||
#define GLUT_OVERLAY_DAMAGED 805
|
||||
|
||||
/* glutVideoResizeGet parameters. */
|
||||
#define GLUT_VIDEO_RESIZE_POSSIBLE 900
|
||||
#define GLUT_VIDEO_RESIZE_IN_USE 901
|
||||
#define GLUT_VIDEO_RESIZE_X_DELTA 902
|
||||
#define GLUT_VIDEO_RESIZE_Y_DELTA 903
|
||||
#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904
|
||||
#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905
|
||||
#define GLUT_VIDEO_RESIZE_X 906
|
||||
#define GLUT_VIDEO_RESIZE_Y 907
|
||||
#define GLUT_VIDEO_RESIZE_WIDTH 908
|
||||
#define GLUT_VIDEO_RESIZE_HEIGHT 909
|
||||
|
||||
/* glutUseLayer parameters. */
|
||||
#define GLUT_NORMAL 0
|
||||
#define GLUT_OVERLAY 1
|
||||
|
||||
/* glutGetModifiers return mask. */
|
||||
#define GLUT_ACTIVE_SHIFT 1
|
||||
#define GLUT_ACTIVE_CTRL 2
|
||||
#define GLUT_ACTIVE_ALT 4
|
||||
|
||||
/* glutSetCursor parameters. */
|
||||
/* Basic arrows. */
|
||||
#define GLUT_CURSOR_RIGHT_ARROW 0
|
||||
#define GLUT_CURSOR_LEFT_ARROW 1
|
||||
/* Symbolic cursor shapes. */
|
||||
#define GLUT_CURSOR_INFO 2
|
||||
#define GLUT_CURSOR_DESTROY 3
|
||||
#define GLUT_CURSOR_HELP 4
|
||||
#define GLUT_CURSOR_CYCLE 5
|
||||
#define GLUT_CURSOR_SPRAY 6
|
||||
#define GLUT_CURSOR_WAIT 7
|
||||
#define GLUT_CURSOR_TEXT 8
|
||||
#define GLUT_CURSOR_CROSSHAIR 9
|
||||
/* Directional cursors. */
|
||||
#define GLUT_CURSOR_UP_DOWN 10
|
||||
#define GLUT_CURSOR_LEFT_RIGHT 11
|
||||
/* Sizing cursors. */
|
||||
#define GLUT_CURSOR_TOP_SIDE 12
|
||||
#define GLUT_CURSOR_BOTTOM_SIDE 13
|
||||
#define GLUT_CURSOR_LEFT_SIDE 14
|
||||
#define GLUT_CURSOR_RIGHT_SIDE 15
|
||||
#define GLUT_CURSOR_TOP_LEFT_CORNER 16
|
||||
#define GLUT_CURSOR_TOP_RIGHT_CORNER 17
|
||||
#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
|
||||
#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
|
||||
/* Inherit from parent window. */
|
||||
#define GLUT_CURSOR_INHERIT 100
|
||||
/* Blank cursor. */
|
||||
#define GLUT_CURSOR_NONE 101
|
||||
/* Fullscreen crosshair (if available). */
|
||||
#define GLUT_CURSOR_FULL_CROSSHAIR 102
|
||||
|
||||
/* GLUT initialization sub-API. */
|
||||
GLUTAPI void APIENTRY glutInit(int *argcp, char **argv);
|
||||
GLUTAPI void APIENTRY glutInitDisplayMode(unsigned int mode);
|
||||
GLUTAPI void APIENTRY glutInitWindowPosition(int x, int y);
|
||||
GLUTAPI void APIENTRY glutInitWindowSize(int width, int height);
|
||||
GLUTAPI void APIENTRY glutMainLoop(void);
|
||||
|
||||
/* GLUT window sub-API. */
|
||||
GLUTAPI int APIENTRY glutCreateWindow(const char *title);
|
||||
GLUTAPI int APIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
|
||||
GLUTAPI void APIENTRY glutDestroyWindow(int win);
|
||||
GLUTAPI void APIENTRY glutPostRedisplay(void);
|
||||
GLUTAPI void APIENTRY glutSwapBuffers(void);
|
||||
GLUTAPI int APIENTRY glutGetWindow(void);
|
||||
GLUTAPI void APIENTRY glutSetWindow(int win);
|
||||
GLUTAPI void APIENTRY glutSetWindowTitle(const char *title);
|
||||
GLUTAPI void APIENTRY glutSetIconTitle(const char *title);
|
||||
GLUTAPI void APIENTRY glutPositionWindow(int x, int y);
|
||||
GLUTAPI void APIENTRY glutReshapeWindow(int width, int height);
|
||||
GLUTAPI void APIENTRY glutPopWindow(void);
|
||||
GLUTAPI void APIENTRY glutPushWindow(void);
|
||||
GLUTAPI void APIENTRY glutIconifyWindow(void);
|
||||
GLUTAPI void APIENTRY glutShowWindow(void);
|
||||
GLUTAPI void APIENTRY glutHideWindow(void);
|
||||
|
||||
/* GLUT overlay sub-API. */
|
||||
GLUTAPI void APIENTRY glutEstablishOverlay(void);
|
||||
GLUTAPI void APIENTRY glutRemoveOverlay(void);
|
||||
GLUTAPI void APIENTRY glutUseLayer(GLenum layer);
|
||||
GLUTAPI void APIENTRY glutPostOverlayRedisplay(void);
|
||||
GLUTAPI void APIENTRY glutShowOverlay(void);
|
||||
GLUTAPI void APIENTRY glutHideOverlay(void);
|
||||
|
||||
/* GLUT menu sub-API. */
|
||||
GLUTAPI int APIENTRY glutCreateMenu(void (GLUTCALLBACK *)(int));
|
||||
GLUTAPI void APIENTRY glutDestroyMenu(int menu);
|
||||
GLUTAPI int APIENTRY glutGetMenu(void);
|
||||
GLUTAPI void APIENTRY glutSetMenu(int menu);
|
||||
GLUTAPI void APIENTRY glutAddMenuEntry(const char *label, int value);
|
||||
GLUTAPI void APIENTRY glutAddSubMenu(const char *label, int submenu);
|
||||
GLUTAPI void APIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
|
||||
GLUTAPI void APIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
|
||||
GLUTAPI void APIENTRY glutRemoveMenuItem(int item);
|
||||
GLUTAPI void APIENTRY glutAttachMenu(int button);
|
||||
GLUTAPI void APIENTRY glutDetachMenu(int button);
|
||||
|
||||
/* GLUT window callback sub-API. */
|
||||
GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK * func)(void));
|
||||
GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK * func)(int width, int height));
|
||||
GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
|
||||
GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
|
||||
GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
|
||||
GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
|
||||
GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK * func)(int state));
|
||||
GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK * func)(int state));
|
||||
GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK * func)(void));
|
||||
GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK * func)(int value), int value);
|
||||
GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK * func)(int state));
|
||||
GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
|
||||
GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
|
||||
GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
|
||||
GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK * func)(int button, int state));
|
||||
GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK * func)(int button, int state));
|
||||
GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK * func)(int dial, int value));
|
||||
GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
|
||||
GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
|
||||
GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK * func)(int status, int x, int y));
|
||||
GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK * func)(void));
|
||||
GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK * func)(int state));
|
||||
|
||||
/* GLUT color index sub-API. */
|
||||
GLUTAPI void APIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);
|
||||
GLUTAPI GLfloat APIENTRY glutGetColor(int ndx, int component);
|
||||
GLUTAPI void APIENTRY glutCopyColormap(int win);
|
||||
|
||||
/* GLUT state retrieval sub-API. */
|
||||
GLUTAPI int APIENTRY glutGet(GLenum type);
|
||||
GLUTAPI int APIENTRY glutDeviceGet(GLenum type);
|
||||
|
||||
/* GLUT font sub-API */
|
||||
GLUTAPI void APIENTRY glutBitmapCharacter(void *font, int character);
|
||||
GLUTAPI int APIENTRY glutBitmapWidth(void *font, int character);
|
||||
GLUTAPI void APIENTRY glutStrokeCharacter(void *font, int character);
|
||||
GLUTAPI int APIENTRY glutStrokeWidth(void *font, int character);
|
||||
|
||||
/* GLUT pre-built models sub-API */
|
||||
GLUTAPI void APIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
|
||||
GLUTAPI void APIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
|
||||
GLUTAPI void APIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
|
||||
GLUTAPI void APIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
|
||||
GLUTAPI void APIENTRY glutWireCube(GLdouble size);
|
||||
GLUTAPI void APIENTRY glutSolidCube(GLdouble size);
|
||||
GLUTAPI void APIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
|
||||
GLUTAPI void APIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
|
||||
GLUTAPI void APIENTRY glutWireDodecahedron(void);
|
||||
GLUTAPI void APIENTRY glutSolidDodecahedron(void);
|
||||
GLUTAPI void APIENTRY glutWireTeapot(GLdouble size);
|
||||
GLUTAPI void APIENTRY glutSolidTeapot(GLdouble size);
|
||||
GLUTAPI void APIENTRY glutWireOctahedron(void);
|
||||
GLUTAPI void APIENTRY glutSolidOctahedron(void);
|
||||
GLUTAPI void APIENTRY glutWireTetrahedron(void);
|
||||
GLUTAPI void APIENTRY glutSolidTetrahedron(void);
|
||||
GLUTAPI void APIENTRY glutWireIcosahedron(void);
|
||||
GLUTAPI void APIENTRY glutSolidIcosahedron(void);
|
||||
|
||||
#endif /* __AGLUT_H__ */
|
||||
|
|
@ -6,7 +6,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2009 The Khronos Group Inc.
|
||||
** Copyright (c) 2007-2010 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
|
|
@ -48,9 +48,9 @@ extern "C" {
|
|||
/*************************************************************/
|
||||
|
||||
/* Header file version number, required by OpenGL ABI for Linux */
|
||||
/* glxext.h last updated 2009/10/08 */
|
||||
/* glxext.h last updated 2010/02/10 */
|
||||
/* Current version at http://www.opengl.org/registry/ */
|
||||
#define GLX_GLXEXT_VERSION 25
|
||||
#define GLX_GLXEXT_VERSION 27
|
||||
|
||||
#ifndef GLX_VERSION_1_3
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
|
|
@ -124,6 +124,10 @@ extern "C" {
|
|||
#define GLX_SAMPLES_ARB 100001
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_vertex_buffer_object
|
||||
#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095
|
||||
#endif
|
||||
|
||||
#ifndef GLX_ARB_fbconfig_float
|
||||
#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9
|
||||
#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004
|
||||
|
|
@ -396,6 +400,13 @@ extern "C" {
|
|||
#ifndef GLX_NV_copy_image
|
||||
#endif
|
||||
|
||||
#ifndef GLX_INTEL_swap_event
|
||||
#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000
|
||||
#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180
|
||||
#define GLX_COPY_COMPLETE_INTEL 0x8181
|
||||
#define GLX_FLIP_COMPLETE_INTEL 0x8182
|
||||
#endif
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
|
|
@ -477,24 +488,24 @@ typedef unsigned __int64 uint64_t;
|
|||
#ifndef GLX_VERSION_1_3
|
||||
#define GLX_VERSION_1_3 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXFBConfig * glXGetFBConfigs (Display *, int, int *);
|
||||
extern GLXFBConfig * glXChooseFBConfig (Display *, int, const int *, int *);
|
||||
extern int glXGetFBConfigAttrib (Display *, GLXFBConfig, int, int *);
|
||||
extern XVisualInfo * glXGetVisualFromFBConfig (Display *, GLXFBConfig);
|
||||
extern GLXWindow glXCreateWindow (Display *, GLXFBConfig, Window, const int *);
|
||||
extern void glXDestroyWindow (Display *, GLXWindow);
|
||||
extern GLXPixmap glXCreatePixmap (Display *, GLXFBConfig, Pixmap, const int *);
|
||||
extern void glXDestroyPixmap (Display *, GLXPixmap);
|
||||
extern GLXPbuffer glXCreatePbuffer (Display *, GLXFBConfig, const int *);
|
||||
extern void glXDestroyPbuffer (Display *, GLXPbuffer);
|
||||
extern void glXQueryDrawable (Display *, GLXDrawable, int, unsigned int *);
|
||||
extern GLXContext glXCreateNewContext (Display *, GLXFBConfig, int, GLXContext, Bool);
|
||||
extern Bool glXMakeContextCurrent (Display *, GLXDrawable, GLXDrawable, GLXContext);
|
||||
extern GLXFBConfig * glXGetFBConfigs (Display *dpy, int screen, int *nelements);
|
||||
extern GLXFBConfig * glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements);
|
||||
extern int glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value);
|
||||
extern XVisualInfo * glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config);
|
||||
extern GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
|
||||
extern void glXDestroyWindow (Display *dpy, GLXWindow win);
|
||||
extern GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
|
||||
extern void glXDestroyPixmap (Display *dpy, GLXPixmap pixmap);
|
||||
extern GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list);
|
||||
extern void glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf);
|
||||
extern void glXQueryDrawable (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
|
||||
extern GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
|
||||
extern Bool glXMakeContextCurrent (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
|
||||
extern GLXDrawable glXGetCurrentReadDrawable (void);
|
||||
extern Display * glXGetCurrentDisplay (void);
|
||||
extern int glXQueryContext (Display *, GLXContext, int, int *);
|
||||
extern void glXSelectEvent (Display *, GLXDrawable, unsigned long);
|
||||
extern void glXGetSelectedEvent (Display *, GLXDrawable, unsigned long *);
|
||||
extern int glXQueryContext (Display *dpy, GLXContext ctx, int attribute, int *value);
|
||||
extern void glXSelectEvent (Display *dpy, GLXDrawable draw, unsigned long event_mask);
|
||||
extern void glXGetSelectedEvent (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
|
||||
typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
|
||||
|
|
@ -519,7 +530,7 @@ typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, un
|
|||
#ifndef GLX_VERSION_1_4
|
||||
#define GLX_VERSION_1_4 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *);
|
||||
extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *procName);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
|
||||
#endif
|
||||
|
|
@ -527,7 +538,7 @@ typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
|
|||
#ifndef GLX_ARB_get_proc_address
|
||||
#define GLX_ARB_get_proc_address 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *);
|
||||
extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName);
|
||||
#endif
|
||||
|
|
@ -543,7 +554,7 @@ typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procNam
|
|||
#ifndef GLX_ARB_create_context
|
||||
#define GLX_ARB_create_context 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXContext glXCreateContextAttribsARB (Display *, GLXFBConfig, GLXContext, Bool, const int *);
|
||||
extern GLXContext glXCreateContextAttribsARB (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
|
||||
#endif
|
||||
|
|
@ -563,7 +574,7 @@ typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBCo
|
|||
#ifndef GLX_SGI_swap_control
|
||||
#define GLX_SGI_swap_control 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXSwapIntervalSGI (int);
|
||||
extern int glXSwapIntervalSGI (int interval);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);
|
||||
#endif
|
||||
|
|
@ -571,8 +582,8 @@ typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);
|
|||
#ifndef GLX_SGI_video_sync
|
||||
#define GLX_SGI_video_sync 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXGetVideoSyncSGI (unsigned int *);
|
||||
extern int glXWaitVideoSyncSGI (int, int, unsigned int *);
|
||||
extern int glXGetVideoSyncSGI (unsigned int *count);
|
||||
extern int glXWaitVideoSyncSGI (int divisor, int remainder, unsigned int *count);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count);
|
||||
typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count);
|
||||
|
|
@ -581,7 +592,7 @@ typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigne
|
|||
#ifndef GLX_SGI_make_current_read
|
||||
#define GLX_SGI_make_current_read 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXMakeCurrentReadSGI (Display *, GLXDrawable, GLXDrawable, GLXContext);
|
||||
extern Bool glXMakeCurrentReadSGI (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
|
||||
extern GLXDrawable glXGetCurrentReadDrawableSGI (void);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
|
||||
|
|
@ -592,8 +603,8 @@ typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void);
|
|||
#define GLX_SGIX_video_source 1
|
||||
#ifdef _VL_H
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *, int, VLServer, VLPath, int, VLNode);
|
||||
extern void glXDestroyGLXVideoSourceSGIX (Display *, GLXVideoSourceSGIX);
|
||||
extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
|
||||
extern void glXDestroyGLXVideoSourceSGIX (Display *dpy, GLXVideoSourceSGIX glxvideosource);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXVideoSourceSGIX ( * PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
|
||||
typedef void ( * PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource);
|
||||
|
|
@ -608,10 +619,10 @@ typedef void ( * PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSou
|
|||
#define GLX_EXT_import_context 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Display * glXGetCurrentDisplayEXT (void);
|
||||
extern int glXQueryContextInfoEXT (Display *, GLXContext, int, int *);
|
||||
extern GLXContextID glXGetContextIDEXT (const GLXContext);
|
||||
extern GLXContext glXImportContextEXT (Display *, GLXContextID);
|
||||
extern void glXFreeContextEXT (Display *, GLXContext);
|
||||
extern int glXQueryContextInfoEXT (Display *dpy, GLXContext context, int attribute, int *value);
|
||||
extern GLXContextID glXGetContextIDEXT (const GLXContext context);
|
||||
extern GLXContext glXImportContextEXT (Display *dpy, GLXContextID contextID);
|
||||
extern void glXFreeContextEXT (Display *dpy, GLXContext context);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void);
|
||||
typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value);
|
||||
|
|
@ -623,12 +634,12 @@ typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context);
|
|||
#ifndef GLX_SGIX_fbconfig
|
||||
#define GLX_SGIX_fbconfig 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXGetFBConfigAttribSGIX (Display *, GLXFBConfigSGIX, int, int *);
|
||||
extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *, int, int *, int *);
|
||||
extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *, GLXFBConfigSGIX, Pixmap);
|
||||
extern GLXContext glXCreateContextWithConfigSGIX (Display *, GLXFBConfigSGIX, int, GLXContext, Bool);
|
||||
extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *, GLXFBConfigSGIX);
|
||||
extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *, XVisualInfo *);
|
||||
extern int glXGetFBConfigAttribSGIX (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
|
||||
extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *dpy, int screen, int *attrib_list, int *nelements);
|
||||
extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
|
||||
extern GLXContext glXCreateContextWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
|
||||
extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *dpy, GLXFBConfigSGIX config);
|
||||
extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *dpy, XVisualInfo *vis);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
|
||||
typedef GLXFBConfigSGIX * ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements);
|
||||
|
|
@ -641,11 +652,11 @@ typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy,
|
|||
#ifndef GLX_SGIX_pbuffer
|
||||
#define GLX_SGIX_pbuffer 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *);
|
||||
extern void glXDestroyGLXPbufferSGIX (Display *, GLXPbufferSGIX);
|
||||
extern int glXQueryGLXPbufferSGIX (Display *, GLXPbufferSGIX, int, unsigned int *);
|
||||
extern void glXSelectEventSGIX (Display *, GLXDrawable, unsigned long);
|
||||
extern void glXGetSelectedEventSGIX (Display *, GLXDrawable, unsigned long *);
|
||||
extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
|
||||
extern void glXDestroyGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf);
|
||||
extern int glXQueryGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
|
||||
extern void glXSelectEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long mask);
|
||||
extern void glXGetSelectedEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long *mask);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
|
||||
typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf);
|
||||
|
|
@ -657,7 +668,7 @@ typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable draw
|
|||
#ifndef GLX_SGI_cushion
|
||||
#define GLX_SGI_cushion 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXCushionSGI (Display *, Window, float);
|
||||
extern void glXCushionSGI (Display *dpy, Window window, float cushion);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion);
|
||||
#endif
|
||||
|
|
@ -665,11 +676,11 @@ typedef void ( * PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushi
|
|||
#ifndef GLX_SGIX_video_resize
|
||||
#define GLX_SGIX_video_resize 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXBindChannelToWindowSGIX (Display *, int, int, Window);
|
||||
extern int glXChannelRectSGIX (Display *, int, int, int, int, int, int);
|
||||
extern int glXQueryChannelRectSGIX (Display *, int, int, int *, int *, int *, int *);
|
||||
extern int glXQueryChannelDeltasSGIX (Display *, int, int, int *, int *, int *, int *);
|
||||
extern int glXChannelRectSyncSGIX (Display *, int, int, GLenum);
|
||||
extern int glXBindChannelToWindowSGIX (Display *display, int screen, int channel, Window window);
|
||||
extern int glXChannelRectSGIX (Display *display, int screen, int channel, int x, int y, int w, int h);
|
||||
extern int glXQueryChannelRectSGIX (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
|
||||
extern int glXQueryChannelDeltasSGIX (Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
|
||||
extern int glXChannelRectSyncSGIX (Display *display, int screen, int channel, GLenum synctype);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window);
|
||||
typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h);
|
||||
|
|
@ -682,7 +693,7 @@ typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, in
|
|||
#define GLX_SGIX_dmbuffer 1
|
||||
#ifdef _DM_BUFFER_H_
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXAssociateDMPbufferSGIX (Display *, GLXPbufferSGIX, DMparams *, DMbuffer);
|
||||
extern Bool glXAssociateDMPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
|
||||
#endif /* _DM_BUFFER_H_ */
|
||||
|
|
@ -691,24 +702,16 @@ typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX
|
|||
#ifndef GLX_SGIX_swap_group
|
||||
#define GLX_SGIX_swap_group 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXJoinSwapGroupSGIX (Display *, GLXDrawable, GLXDrawable);
|
||||
extern void glXJoinSwapGroupSGIX (Display *dpy, GLXDrawable drawable, GLXDrawable member);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_INTEL_swap_event
|
||||
#define GLX_INTEL_swap_event
|
||||
#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x10000000
|
||||
#define GLX_EXCHANGE_COMPLETE_INTEL 0x8024
|
||||
#define GLX_BLIT_COMPLETE_INTEL 0x8025
|
||||
#define GLX_FLIP_COMPLETE_INTEL 0x8026
|
||||
#endif
|
||||
|
||||
#ifndef GLX_SGIX_swap_barrier
|
||||
#define GLX_SGIX_swap_barrier 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXBindSwapBarrierSGIX (Display *, GLXDrawable, int);
|
||||
extern Bool glXQueryMaxSwapBarriersSGIX (Display *, int, int *);
|
||||
extern void glXBindSwapBarrierSGIX (Display *dpy, GLXDrawable drawable, int barrier);
|
||||
extern Bool glXQueryMaxSwapBarriersSGIX (Display *dpy, int screen, int *max);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier);
|
||||
typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max);
|
||||
|
|
@ -717,7 +720,7 @@ typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen,
|
|||
#ifndef GLX_SUN_get_transparent_index
|
||||
#define GLX_SUN_get_transparent_index 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Status glXGetTransparentIndexSUN (Display *, Window, Window, long *);
|
||||
extern Status glXGetTransparentIndexSUN (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
|
||||
#endif
|
||||
|
|
@ -725,7 +728,7 @@ typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overl
|
|||
#ifndef GLX_MESA_copy_sub_buffer
|
||||
#define GLX_MESA_copy_sub_buffer 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXCopySubBufferMESA (Display *, GLXDrawable, int, int, int, int);
|
||||
extern void glXCopySubBufferMESA (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
|
||||
#endif
|
||||
|
|
@ -733,7 +736,7 @@ typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawabl
|
|||
#ifndef GLX_MESA_pixmap_colormap
|
||||
#define GLX_MESA_pixmap_colormap 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXPixmap glXCreateGLXPixmapMESA (Display *, XVisualInfo *, Pixmap, Colormap);
|
||||
extern GLXPixmap glXCreateGLXPixmapMESA (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
|
||||
#endif
|
||||
|
|
@ -741,7 +744,7 @@ typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo
|
|||
#ifndef GLX_MESA_release_buffers
|
||||
#define GLX_MESA_release_buffers 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXReleaseBuffersMESA (Display *, GLXDrawable);
|
||||
extern Bool glXReleaseBuffersMESA (Display *dpy, GLXDrawable drawable);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable);
|
||||
#endif
|
||||
|
|
@ -749,7 +752,7 @@ typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawab
|
|||
#ifndef GLX_MESA_set_3dfx_mode
|
||||
#define GLX_MESA_set_3dfx_mode 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXSet3DfxModeMESA (int);
|
||||
extern Bool glXSet3DfxModeMESA (int mode);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode);
|
||||
#endif
|
||||
|
|
@ -765,11 +768,11 @@ typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode);
|
|||
#ifndef GLX_OML_sync_control
|
||||
#define GLX_OML_sync_control 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXGetSyncValuesOML (Display *, GLXDrawable, int64_t *, int64_t *, int64_t *);
|
||||
extern Bool glXGetMscRateOML (Display *, GLXDrawable, int32_t *, int32_t *);
|
||||
extern int64_t glXSwapBuffersMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t);
|
||||
extern Bool glXWaitForMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t, int64_t *, int64_t *, int64_t *);
|
||||
extern Bool glXWaitForSbcOML (Display *, GLXDrawable, int64_t, int64_t *, int64_t *, int64_t *);
|
||||
extern Bool glXGetSyncValuesOML (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
|
||||
extern Bool glXGetMscRateOML (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
|
||||
extern int64_t glXSwapBuffersMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
|
||||
extern Bool glXWaitForMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
|
||||
extern Bool glXWaitForSbcOML (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
|
||||
typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
|
||||
|
|
@ -810,14 +813,14 @@ typedef struct {
|
|||
} GLXPipeRectLimits;
|
||||
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern GLXHyperpipeNetworkSGIX * glXQueryHyperpipeNetworkSGIX (Display *, int *);
|
||||
extern int glXHyperpipeConfigSGIX (Display *, int, int, GLXHyperpipeConfigSGIX *, int *);
|
||||
extern GLXHyperpipeConfigSGIX * glXQueryHyperpipeConfigSGIX (Display *, int, int *);
|
||||
extern int glXDestroyHyperpipeConfigSGIX (Display *, int);
|
||||
extern int glXBindHyperpipeSGIX (Display *, int);
|
||||
extern int glXQueryHyperpipeBestAttribSGIX (Display *, int, int, int, void *, void *);
|
||||
extern int glXHyperpipeAttribSGIX (Display *, int, int, int, void *);
|
||||
extern int glXQueryHyperpipeAttribSGIX (Display *, int, int, int, void *);
|
||||
extern GLXHyperpipeNetworkSGIX * glXQueryHyperpipeNetworkSGIX (Display *dpy, int *npipes);
|
||||
extern int glXHyperpipeConfigSGIX (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);
|
||||
extern GLXHyperpipeConfigSGIX * glXQueryHyperpipeConfigSGIX (Display *dpy, int hpId, int *npipes);
|
||||
extern int glXDestroyHyperpipeConfigSGIX (Display *dpy, int hpId);
|
||||
extern int glXBindHyperpipeSGIX (Display *dpy, int hpId);
|
||||
extern int glXQueryHyperpipeBestAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);
|
||||
extern int glXHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList);
|
||||
extern int glXQueryHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes);
|
||||
typedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);
|
||||
|
|
@ -832,7 +835,7 @@ typedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice
|
|||
#ifndef GLX_MESA_agp_offset
|
||||
#define GLX_MESA_agp_offset 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern unsigned int glXGetAGPOffsetMESA (const void *);
|
||||
extern unsigned int glXGetAGPOffsetMESA (const void *pointer);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer);
|
||||
#endif
|
||||
|
|
@ -848,8 +851,8 @@ typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer);
|
|||
#ifndef GLX_EXT_texture_from_pixmap
|
||||
#define GLX_EXT_texture_from_pixmap 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXBindTexImageEXT (Display *, GLXDrawable, int, const int *);
|
||||
extern void glXReleaseTexImageEXT (Display *, GLXDrawable, int);
|
||||
extern void glXBindTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
|
||||
extern void glXReleaseTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
|
||||
typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer);
|
||||
|
|
@ -858,8 +861,8 @@ typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawab
|
|||
#ifndef GLX_NV_present_video
|
||||
#define GLX_NV_present_video 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern unsigned int * glXEnumerateVideoDevicesNV (Display *, int, int *);
|
||||
extern int glXBindVideoDeviceNV (Display *, unsigned int, unsigned int, const int *);
|
||||
extern unsigned int * glXEnumerateVideoDevicesNV (Display *dpy, int screen, int *nelements);
|
||||
extern int glXBindVideoDeviceNV (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef unsigned int * ( * PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements);
|
||||
typedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
|
||||
|
|
@ -868,12 +871,12 @@ typedef int ( * PFNGLXBINDVIDEODEVICENVPROC) (Display *dpy, unsigned int video_s
|
|||
#ifndef GLX_NV_video_output
|
||||
#define GLX_NV_video_output 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXGetVideoDeviceNV (Display *, int, int, GLXVideoDeviceNV *);
|
||||
extern int glXReleaseVideoDeviceNV (Display *, int, GLXVideoDeviceNV);
|
||||
extern int glXBindVideoImageNV (Display *, GLXVideoDeviceNV, GLXPbuffer, int);
|
||||
extern int glXReleaseVideoImageNV (Display *, GLXPbuffer);
|
||||
extern int glXSendPbufferToVideoNV (Display *, GLXPbuffer, int, unsigned long *, GLboolean);
|
||||
extern int glXGetVideoInfoNV (Display *, int, GLXVideoDeviceNV, unsigned long *, unsigned long *);
|
||||
extern int glXGetVideoDeviceNV (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
|
||||
extern int glXReleaseVideoDeviceNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
|
||||
extern int glXBindVideoImageNV (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
|
||||
extern int glXReleaseVideoImageNV (Display *dpy, GLXPbuffer pbuf);
|
||||
extern int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
|
||||
extern int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXGETVIDEODEVICENVPROC) (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
|
||||
typedef int ( * PFNGLXRELEASEVIDEODEVICENVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
|
||||
|
|
@ -886,12 +889,12 @@ typedef int ( * PFNGLXGETVIDEOINFONVPROC) (Display *dpy, int screen, GLXVideoDev
|
|||
#ifndef GLX_NV_swap_group
|
||||
#define GLX_NV_swap_group 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern Bool glXJoinSwapGroupNV (Display *, GLXDrawable, GLuint);
|
||||
extern Bool glXBindSwapBarrierNV (Display *, GLuint, GLuint);
|
||||
extern Bool glXQuerySwapGroupNV (Display *, GLXDrawable, GLuint *, GLuint *);
|
||||
extern Bool glXQueryMaxSwapGroupsNV (Display *, int, GLuint *, GLuint *);
|
||||
extern Bool glXQueryFrameCountNV (Display *, int, GLuint *);
|
||||
extern Bool glXResetFrameCountNV (Display *, int);
|
||||
extern Bool glXJoinSwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint group);
|
||||
extern Bool glXBindSwapBarrierNV (Display *dpy, GLuint group, GLuint barrier);
|
||||
extern Bool glXQuerySwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
|
||||
extern Bool glXQueryMaxSwapGroupsNV (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
|
||||
extern Bool glXQueryFrameCountNV (Display *dpy, int screen, GLuint *count);
|
||||
extern Bool glXResetFrameCountNV (Display *dpy, int screen);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef Bool ( * PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group);
|
||||
typedef Bool ( * PFNGLXBINDSWAPBARRIERNVPROC) (Display *dpy, GLuint group, GLuint barrier);
|
||||
|
|
@ -904,11 +907,11 @@ typedef Bool ( * PFNGLXRESETFRAMECOUNTNVPROC) (Display *dpy, int screen);
|
|||
#ifndef GLX_NV_video_capture
|
||||
#define GLX_NV_video_capture 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXBindVideoCaptureDeviceNV (Display *, unsigned int, GLXVideoCaptureDeviceNV);
|
||||
extern GLXVideoCaptureDeviceNV * glXEnumerateVideoCaptureDevicesNV (Display *, int, int *);
|
||||
extern void glXLockVideoCaptureDeviceNV (Display *, GLXVideoCaptureDeviceNV);
|
||||
extern int glXQueryVideoCaptureDeviceNV (Display *, GLXVideoCaptureDeviceNV, int, int *);
|
||||
extern void glXReleaseVideoCaptureDeviceNV (Display *, GLXVideoCaptureDeviceNV);
|
||||
extern int glXBindVideoCaptureDeviceNV (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
|
||||
extern GLXVideoCaptureDeviceNV * glXEnumerateVideoCaptureDevicesNV (Display *dpy, int screen, int *nelements);
|
||||
extern void glXLockVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device);
|
||||
extern int glXQueryVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
|
||||
extern void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
|
||||
typedef GLXVideoCaptureDeviceNV * ( * PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display *dpy, int screen, int *nelements);
|
||||
|
|
@ -920,7 +923,7 @@ typedef void ( * PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoC
|
|||
#ifndef GLX_EXT_swap_control
|
||||
#define GLX_EXT_swap_control 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern int glXSwapIntervalEXT (Display *, GLXDrawable, int);
|
||||
extern int glXSwapIntervalEXT (Display *dpy, GLXDrawable drawable, int interval);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef int ( * PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, int interval);
|
||||
#endif
|
||||
|
|
@ -928,11 +931,15 @@ typedef int ( * PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable,
|
|||
#ifndef GLX_NV_copy_image
|
||||
#define GLX_NV_copy_image 1
|
||||
#ifdef GLX_GLXEXT_PROTOTYPES
|
||||
extern void glXCopyImageSubDataNV (Display *, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLXContext, GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei);
|
||||
extern void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif /* GLX_GLXEXT_PROTOTYPES */
|
||||
typedef void ( * PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
|
||||
#endif
|
||||
|
||||
#ifndef GLX_INTEL_swap_event
|
||||
#define GLX_INTEL_swap_event 1
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,13 @@
|
|||
#define DRI_INTERFACE_H
|
||||
|
||||
/* For archs with no drm.h */
|
||||
#if !defined(__APPLE__) && !defined(__CYGWIN__) && !defined(__GNU__)
|
||||
#if defined(__APPLE__) || defined(__CYGWIN__) || defined(__GNU__)
|
||||
#ifndef __NOT_HAVE_DRM_H
|
||||
#define __NOT_HAVE_DRM_H
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __NOT_HAVE_DRM_H
|
||||
#include <drm.h>
|
||||
#else
|
||||
typedef unsigned int drm_context_t;
|
||||
|
|
@ -410,15 +416,15 @@ struct __DRIswrastLoaderExtensionRec {
|
|||
* Put image to drawable
|
||||
*/
|
||||
void (*putImage)(__DRIdrawable *drawable, int op,
|
||||
int x, int y, int width, int height, char *data,
|
||||
void *loaderPrivate);
|
||||
int x, int y, int width, int height,
|
||||
char *data, void *loaderPrivate);
|
||||
|
||||
/**
|
||||
* Get image from drawable
|
||||
* Get image from readable
|
||||
*/
|
||||
void (*getImage)(__DRIdrawable *drawable,
|
||||
int x, int y, int width, int height, char *data,
|
||||
void *loaderPrivate);
|
||||
void (*getImage)(__DRIdrawable *readable,
|
||||
int x, int y, int width, int height,
|
||||
char *data, void *loaderPrivate);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -806,4 +812,18 @@ struct __DRIimageLookupExtensionRec {
|
|||
void *loaderPrivate);
|
||||
};
|
||||
|
||||
/**
|
||||
* This extension allows for common DRI2 options
|
||||
*/
|
||||
#define __DRI2_CONFIG_QUERY "DRI_CONFIG_QUERY"
|
||||
#define __DRI2_CONFIG_QUERY_VERSION 1
|
||||
|
||||
typedef struct __DRI2configQueryExtensionRec __DRI2configQueryExtension;
|
||||
struct __DRI2configQueryExtensionRec {
|
||||
__DRIextension base;
|
||||
|
||||
int (*configQueryb)(__DRIscreen *screen, const char *var, GLboolean *val);
|
||||
int (*configQueryi)(__DRIscreen *screen, const char *var, GLint *val);
|
||||
int (*configQueryf)(__DRIscreen *screen, const char *var, GLfloat *val);
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,79 +0,0 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Mesa bindings for SciTech MGL
|
||||
*
|
||||
* Copyright (C) 1996 SciTech Software.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Filename: mglmesa.h
|
||||
* Version: Revision: 1.1.1.1
|
||||
*
|
||||
* Language: ANSI C
|
||||
* Environment: Any
|
||||
*
|
||||
* Description: Header file for the Mesa/OpenGL interface bindings for the
|
||||
* SciTech MGL graphics library. Uses the MGL internal
|
||||
* device context structures to get direct access to the
|
||||
* high performance MGL rasterization functions for maximum
|
||||
* performance. Utilizes the VESA VBE/AF Accelerator Functions
|
||||
* via the MGL's accelerated device driver functions, as well
|
||||
* as basic DirectDraw accelerated functions provided by the
|
||||
* MGL.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __MGLMESA_H
|
||||
#define __MGLMESA_H
|
||||
|
||||
#include "mgraph.h"
|
||||
|
||||
/*------------------------- Function Prototypes ---------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" { /* Use "C" linkage when in C++ mode */
|
||||
#endif
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
#define GLAPIENTRY
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
bool GLAPIENTRY MGLMesaInitDLL(MGLCallbacks *cb,char *version);
|
||||
#endif
|
||||
void GLAPIENTRY MGLMesaChooseVisual(MGLDC *dc,MGLVisual *visual);
|
||||
bool GLAPIENTRY MGLMesaSetVisual(MGLDC *dc,MGLVisual *visual);
|
||||
bool GLAPIENTRY MGLMesaCreateContext(MGLDC *dc,bool forceMemDC);
|
||||
void GLAPIENTRY MGLMesaDestroyContext(MGLDC *dc);
|
||||
void GLAPIENTRY MGLMesaMakeCurrent(MGLDC *dc);
|
||||
void GLAPIENTRY MGLMesaSwapBuffers(MGLDC *dc,bool waitVRT);
|
||||
|
||||
/* Palette manipulation support. The reason we provide palette manipulation
|
||||
* routines is so that when rendering in double buffered modes with a
|
||||
* software backbuffer, the palette for the backbuffer is kept consistent
|
||||
* with the hardware front buffer.
|
||||
*/
|
||||
|
||||
void GLAPIENTRY MGLMesaSetPaletteEntry(MGLDC *dc,int entry,uchar red,uchar green,uchar blue);
|
||||
void GLAPIENTRY MGLMesaSetPalette(MGLDC *dc,palette_t *pal,int numColors,int startIndex);
|
||||
void GLAPIENTRY MGLMesaRealizePalette(MGLDC *dc,int numColors,int startIndex,int waitVRT);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* End of "C" linkage for C++ */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MGLMESA_H */
|
||||
|
|
@ -24,6 +24,7 @@ if progs_env['platform'] == 'windows':
|
|||
if progs_env['platform'] == 'windows':
|
||||
progs_env.Prepend(LIBS = ['glu32', 'opengl32'])
|
||||
else:
|
||||
progs_env.Tool('x11')
|
||||
progs_env.Prepend(LIBS = ['GLU', 'GL'])
|
||||
|
||||
# Glut
|
||||
|
|
@ -55,5 +56,4 @@ SConscript([
|
|||
'fp/SConscript',
|
||||
'wgl/SConscript',
|
||||
'perf/SConscript',
|
||||
'gallium/unit/SConscript',
|
||||
])
|
||||
|
|
|
|||
1
progs/demos/.gitignore
vendored
1
progs/demos/.gitignore
vendored
|
|
@ -1,6 +1,7 @@
|
|||
arbfplight
|
||||
arbfslight
|
||||
arbocclude
|
||||
arbocclude2
|
||||
bounce
|
||||
clearspd
|
||||
copypix
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ PROGS = \
|
|||
arbfplight \
|
||||
arbfslight \
|
||||
arbocclude \
|
||||
arbocclude2 \
|
||||
bounce \
|
||||
clearspd \
|
||||
copypix \
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ progs = [
|
|||
'arbfplight',
|
||||
'arbfslight',
|
||||
'arbocclude',
|
||||
'arbocclude2',
|
||||
'bounce',
|
||||
'clearspd',
|
||||
'copypix',
|
||||
|
|
|
|||
314
progs/demos/arbocclude2.c
Normal file
314
progs/demos/arbocclude2.c
Normal file
|
|
@ -0,0 +1,314 @@
|
|||
/*
|
||||
* GL_ARB_occlusion_query demo
|
||||
*
|
||||
* Brian Paul
|
||||
* 12 June 2003
|
||||
*
|
||||
* Copyright (C) 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.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
static GLboolean Anim = GL_TRUE;
|
||||
static GLfloat Xpos = 0;
|
||||
static GLuint OccQuery1;
|
||||
static GLuint OccQuery2;
|
||||
static GLint Win = 0;
|
||||
|
||||
|
||||
static void
|
||||
PrintString(const char *s)
|
||||
{
|
||||
while (*s) {
|
||||
glutBitmapCharacter(GLUT_BITMAP_8_BY_13, (int) *s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void Idle(void)
|
||||
{
|
||||
static int lastTime = 0;
|
||||
static int sign = +1;
|
||||
int time = glutGet(GLUT_ELAPSED_TIME);
|
||||
float step;
|
||||
|
||||
if (lastTime == 0)
|
||||
lastTime = time;
|
||||
else if (time - lastTime < 20) /* 50Hz update */
|
||||
return;
|
||||
|
||||
step = (time - lastTime) / 1000.0 * sign;
|
||||
lastTime = time;
|
||||
|
||||
Xpos += step;
|
||||
|
||||
if (Xpos > 2.5) {
|
||||
Xpos = 2.5;
|
||||
sign = -1;
|
||||
}
|
||||
else if (Xpos < -2.5) {
|
||||
Xpos = -2.5;
|
||||
sign = +1;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void Display( void )
|
||||
{
|
||||
GLuint passed1, passed2;
|
||||
GLint ready;
|
||||
char s[100];
|
||||
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
|
||||
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 );
|
||||
|
||||
/* draw the occluding polygons */
|
||||
glColor3f(0, 0.6, 0.8);
|
||||
glBegin(GL_QUADS);
|
||||
glVertex2f(-1.6, -1.5);
|
||||
glVertex2f(-0.4, -1.5);
|
||||
glVertex2f(-0.4, 1.5);
|
||||
glVertex2f(-1.6, 1.5);
|
||||
|
||||
glVertex2f( 0.4, -1.5);
|
||||
glVertex2f( 1.6, -1.5);
|
||||
glVertex2f( 1.6, 1.5);
|
||||
glVertex2f( 0.4, 1.5);
|
||||
glEnd();
|
||||
|
||||
#if defined(GL_ARB_occlusion_query)
|
||||
glColorMask(0, 0, 0, 0);
|
||||
glDepthMask(GL_FALSE);
|
||||
|
||||
/* draw the first polygon with occlusion testing */
|
||||
glPushMatrix();
|
||||
glTranslatef(Xpos, 0.4, -0.5);
|
||||
glScalef(0.3, 0.3, 1.0);
|
||||
glRotatef(-90.0 * Xpos, 0, 0, 1);
|
||||
|
||||
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery1);
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex3f(-1, -1, 0);
|
||||
glVertex3f( 1, -1, 0);
|
||||
glVertex3f( 1, 1, 0);
|
||||
glVertex3f(-1, 1, 0);
|
||||
glEnd();
|
||||
|
||||
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
|
||||
|
||||
/* draw the second polygon with occlusion testing */
|
||||
glPopMatrix();
|
||||
glPushMatrix();
|
||||
glTranslatef(Xpos, -0.4, -0.5);
|
||||
glScalef(0.3, 0.3, 1.0);
|
||||
|
||||
glBeginQueryARB(GL_SAMPLES_PASSED_ARB, OccQuery2);
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex3f(-1, -1, 0);
|
||||
glVertex3f( 1, -1, 0);
|
||||
glVertex3f( 1, 1, 0);
|
||||
glVertex3f(-1, 1, 0);
|
||||
glEnd();
|
||||
|
||||
glEndQueryARB(GL_SAMPLES_PASSED_ARB);
|
||||
|
||||
/* turn off occlusion testing */
|
||||
glColorMask(1, 1, 1, 1);
|
||||
glDepthMask(GL_TRUE);
|
||||
|
||||
do {
|
||||
/* do useful work here, if any */
|
||||
glGetQueryObjectivARB(OccQuery1, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
|
||||
} while (!ready);
|
||||
glGetQueryObjectuivARB(OccQuery1, GL_QUERY_RESULT_ARB, &passed1);
|
||||
|
||||
do {
|
||||
/* do useful work here, if any */
|
||||
glGetQueryObjectivARB(OccQuery2, GL_QUERY_RESULT_AVAILABLE_ARB, &ready);
|
||||
} while (!ready);
|
||||
glGetQueryObjectuivARB(OccQuery2, GL_QUERY_RESULT_ARB, &passed2);
|
||||
#endif /* GL_ARB_occlusion_query */
|
||||
|
||||
/* draw the second rect, so we can see what's going on */
|
||||
glColor3f(0.8, 0.5, 0);
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex3f(-1, -1, 0);
|
||||
glVertex3f( 1, -1, 0);
|
||||
glVertex3f( 1, 1, 0);
|
||||
glVertex3f(-1, 1, 0);
|
||||
glEnd();
|
||||
|
||||
glPopMatrix();
|
||||
glPushMatrix();
|
||||
glTranslatef(Xpos, 0.4, -0.5);
|
||||
glScalef(0.3, 0.3, 1.0);
|
||||
glRotatef(-90.0 * Xpos, 0, 0, 1);
|
||||
|
||||
/* draw the first rect, so we can see what's going on */
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex3f(-1, -1, 0);
|
||||
glVertex3f( 1, -1, 0);
|
||||
glVertex3f( 1, 1, 0);
|
||||
glVertex3f(-1, 1, 0);
|
||||
glEnd();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
/* Print result message */
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 );
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
|
||||
glColor3f(1, 1, 1);
|
||||
#if defined(GL_ARB_occlusion_query)
|
||||
sprintf(s, " %4d Fragments Visible", passed1);
|
||||
glRasterPos3f(-0.50, -0.6, 0);
|
||||
PrintString(s);
|
||||
if (!passed1) {
|
||||
glRasterPos3f(-0.25, -0.7, 0);
|
||||
PrintString("Fully Occluded");
|
||||
}
|
||||
sprintf(s, " %4d Fragments Visible", passed2);
|
||||
glRasterPos3f(-0.50, -0.8, 0);
|
||||
PrintString(s);
|
||||
if (!passed2) {
|
||||
glRasterPos3f(-0.25, -0.9, 0);
|
||||
PrintString("Fully Occluded");
|
||||
}
|
||||
#else
|
||||
glRasterPos3f(-0.25, -0.8, 0);
|
||||
PrintString("GL_ARB_occlusion_query not available at compile time");
|
||||
#endif /* GL_ARB_occlusion_query */
|
||||
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void Reshape( int width, int height )
|
||||
{
|
||||
glViewport( 0, 0, width, height );
|
||||
}
|
||||
|
||||
|
||||
static void Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
glutDestroyWindow(Win);
|
||||
exit(0);
|
||||
break;
|
||||
case ' ':
|
||||
Anim = !Anim;
|
||||
if (Anim)
|
||||
glutIdleFunc(Idle);
|
||||
else
|
||||
glutIdleFunc(NULL);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void SpecialKey( int key, int x, int y )
|
||||
{
|
||||
const GLfloat step = 0.1;
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case GLUT_KEY_LEFT:
|
||||
Xpos -= step;
|
||||
break;
|
||||
case GLUT_KEY_RIGHT:
|
||||
Xpos += step;
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void Init( void )
|
||||
{
|
||||
const char *ext = (const char *) glGetString(GL_EXTENSIONS);
|
||||
GLint bits;
|
||||
|
||||
if (!strstr(ext, "GL_ARB_occlusion_query")) {
|
||||
printf("Sorry, this demo requires the GL_ARB_occlusion_query extension\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
#if defined(GL_ARB_occlusion_query)
|
||||
glGetQueryivARB(GL_SAMPLES_PASSED_ARB, GL_QUERY_COUNTER_BITS_ARB, &bits);
|
||||
if (!bits) {
|
||||
printf("Hmmm, GL_QUERY_COUNTER_BITS_ARB is zero!\n");
|
||||
exit(-1);
|
||||
}
|
||||
#endif /* GL_ARB_occlusion_query */
|
||||
|
||||
glGetIntegerv(GL_DEPTH_BITS, &bits);
|
||||
printf("Depthbits: %d\n", bits);
|
||||
|
||||
#if defined(GL_ARB_occlusion_query)
|
||||
glGenQueriesARB(1, &OccQuery1);
|
||||
assert(OccQuery1 > 0);
|
||||
glGenQueriesARB(1, &OccQuery2);
|
||||
assert(OccQuery2 > 0);
|
||||
#endif /* GL_ARB_occlusion_query */
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
glutInitWindowSize( 400, 400 );
|
||||
glutInit( &argc, argv );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutSpecialFunc( SpecialKey );
|
||||
glutIdleFunc( Idle );
|
||||
glutDisplayFunc( Display );
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Dissolve between two images using randomized stencil buffer
|
||||
* Dissolve between two images using randomized/patterned stencil buffer
|
||||
* and varying stencil ref.
|
||||
*
|
||||
* Brian Paul
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <GL/glut.h>
|
||||
#include "readtex.h"
|
||||
|
|
@ -28,6 +29,8 @@ static GLfloat ScaleX[2], ScaleY[2];
|
|||
|
||||
static GLubyte StencilRef = 0;
|
||||
|
||||
static int Mode = 0;
|
||||
|
||||
|
||||
static void
|
||||
Idle(void)
|
||||
|
|
@ -38,13 +41,114 @@ Idle(void)
|
|||
|
||||
|
||||
static void
|
||||
RandomizeStencilBuffer(void)
|
||||
FillRandomPixels(GLubyte *b)
|
||||
{
|
||||
GLubyte *b = malloc(WinWidth * WinHeight);
|
||||
int i;
|
||||
for (i = 0; i < WinWidth * WinHeight; i++) {
|
||||
b[i] = rand() & 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
FillRandomRects(GLubyte *b)
|
||||
{
|
||||
int i;
|
||||
|
||||
memset(b, 0, WinWidth * WinHeight);
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
int x = rand() % WinWidth;
|
||||
int y = rand() % WinHeight;
|
||||
int w = rand() % 60;
|
||||
int h = rand() % 60;
|
||||
int ix, iy;
|
||||
|
||||
if (x + w > WinWidth)
|
||||
w = WinWidth - x;
|
||||
if (y + h > WinHeight)
|
||||
h = WinHeight - y;
|
||||
|
||||
for (iy = 0; iy < h; iy++) {
|
||||
for (ix = 0; ix < w; ix++) {
|
||||
int p = (y + iy) * WinWidth + x + ix;
|
||||
b[p] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
FillWipe(GLubyte *b)
|
||||
{
|
||||
int iy, ix;
|
||||
|
||||
memset(b, 0, WinWidth * WinHeight);
|
||||
|
||||
for (iy = 0; iy < WinHeight; iy++) {
|
||||
for (ix = 0; ix < WinWidth; ix++) {
|
||||
int p = iy * WinWidth + ix;
|
||||
b[p] = 2 * ix + iy / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
FillMoire(GLubyte *b)
|
||||
{
|
||||
int iy, ix;
|
||||
|
||||
memset(b, 0, WinWidth * WinHeight);
|
||||
|
||||
for (iy = 0; iy < WinHeight; iy++) {
|
||||
for (ix = 0; ix < WinWidth; ix++) {
|
||||
int p = iy * WinWidth + ix;
|
||||
b[p] = (ix / 2) * (ix / 2) - (iy / 2) * (iy / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
FillWaves(GLubyte *b)
|
||||
{
|
||||
int iy, ix;
|
||||
|
||||
memset(b, 0, WinWidth * WinHeight);
|
||||
|
||||
for (iy = 0; iy < WinHeight; iy++) {
|
||||
for (ix = 0; ix < WinWidth; ix++) {
|
||||
int p = iy * WinWidth + ix;
|
||||
float x = 8.0 * 3.1415 * ix / (float) WinWidth;
|
||||
b[p] = (int) (25.0 * sin(x) ) - iy*2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
typedef void (*FillFunc)(GLubyte *b);
|
||||
|
||||
|
||||
static FillFunc Funcs[] = {
|
||||
FillRandomPixels,
|
||||
FillRandomRects,
|
||||
FillWipe,
|
||||
FillMoire,
|
||||
FillWaves
|
||||
};
|
||||
|
||||
#define NUM_MODES (sizeof(Funcs) / sizeof(Funcs[0]))
|
||||
|
||||
|
||||
|
||||
static void
|
||||
InitStencilBuffer(void)
|
||||
{
|
||||
GLubyte *b = malloc(WinWidth * WinHeight);
|
||||
|
||||
Funcs[Mode](b);
|
||||
|
||||
glStencilFunc(GL_ALWAYS, 0, ~0);
|
||||
glPixelZoom(1.0, 1.0);
|
||||
|
|
@ -54,7 +158,6 @@ RandomizeStencilBuffer(void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
Draw(void)
|
||||
{
|
||||
|
|
@ -85,7 +188,7 @@ Reshape(int width, int height)
|
|||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -15.0);
|
||||
|
||||
RandomizeStencilBuffer();
|
||||
InitStencilBuffer();
|
||||
|
||||
ScaleX[0] = (float) width / ImgWidth[0];
|
||||
ScaleY[0] = (float) height / ImgHeight[0];
|
||||
|
|
@ -102,12 +205,26 @@ Key(unsigned char key, int x, int y)
|
|||
(void) y;
|
||||
switch (key) {
|
||||
case 'a':
|
||||
case ' ':
|
||||
Anim = !Anim;
|
||||
if (Anim)
|
||||
glutIdleFunc(Idle);
|
||||
else
|
||||
glutIdleFunc(NULL);
|
||||
break;
|
||||
case 'i':
|
||||
InitStencilBuffer();
|
||||
break;
|
||||
case '-':
|
||||
StencilRef--;
|
||||
break;
|
||||
case '+':
|
||||
StencilRef++;
|
||||
break;
|
||||
case 'm':
|
||||
Mode = (Mode + 1) % NUM_MODES;
|
||||
InitStencilBuffer();
|
||||
break;
|
||||
case 27:
|
||||
glutDestroyWindow(Win);
|
||||
exit(0);
|
||||
|
|
@ -143,8 +260,8 @@ Init(void)
|
|||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowSize(WinWidth, WinHeight);
|
||||
glutInit(&argc, argv);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH | GLUT_STENCIL);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc(Reshape);
|
||||
|
|
@ -153,6 +270,14 @@ main(int argc, char *argv[])
|
|||
if (Anim)
|
||||
glutIdleFunc(Idle);
|
||||
Init();
|
||||
|
||||
printf("Keys:\n");
|
||||
printf(" a/SPACE toggle animation\n");
|
||||
printf(" +/- single step\n");
|
||||
printf(" i re-init pattern\n");
|
||||
printf(" m change pattern/dissolve mode\n");
|
||||
printf(" ESC exit\n");
|
||||
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ static void printhelp(void)
|
|||
glRasterPos2i(60,240);
|
||||
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"l - Increase rain length");
|
||||
glRasterPos2i(60,210);
|
||||
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"k - Increase rain length");
|
||||
printstring(GLUT_BITMAP_TIMES_ROMAN_24,"k - Decrease rain length");
|
||||
}
|
||||
|
||||
static void drawrain(void)
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ static int tex_width=64, tex_height=64, tex_depth=64;
|
|||
static float angx=0, angy=0, angz=0;
|
||||
static int texgen = 2, animate = 1, smooth = 1, wireframe = 0;
|
||||
static int CurTexture = NOISE_TEXTURE, CurObject = TORUS;
|
||||
static GLenum Filter = GL_LINEAR;
|
||||
|
||||
|
||||
static void
|
||||
|
|
@ -298,8 +299,6 @@ create3Dtexture(void)
|
|||
printf("setting up 3d texture...\n");
|
||||
|
||||
glBindTexture(GL_TEXTURE_3D, NOISE_TEXTURE);
|
||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
|
||||
|
|
@ -406,6 +405,9 @@ drawScene(void)
|
|||
glDisable(GL_TEXTURE_GEN_R);
|
||||
}
|
||||
|
||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, Filter);
|
||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, Filter);
|
||||
|
||||
glCallList(CurObject);
|
||||
glPopMatrix();
|
||||
|
||||
|
|
@ -505,6 +507,12 @@ KeyHandler(unsigned char key, int x, int y)
|
|||
else
|
||||
CurObject = TORUS;
|
||||
break;
|
||||
case 'f':
|
||||
if (Filter == GL_LINEAR)
|
||||
Filter = GL_NEAREST;
|
||||
else
|
||||
Filter = GL_LINEAR;
|
||||
break;
|
||||
case 'i':
|
||||
if (CurTexture == NOISE_TEXTURE)
|
||||
CurTexture = GRADIENT_TEXTURE;
|
||||
|
|
@ -513,6 +521,7 @@ KeyHandler(unsigned char key, int x, int y)
|
|||
glBindTexture(GL_TEXTURE_3D, CurTexture);
|
||||
break;
|
||||
case 'a':
|
||||
case ' ':
|
||||
animate = !animate;
|
||||
if (animate)
|
||||
glutIdleFunc(Idle);
|
||||
|
|
@ -559,8 +568,6 @@ create3Dgradient(void)
|
|||
|
||||
|
||||
glBindTexture(GL_TEXTURE_3D, GRADIENT_TEXTURE);
|
||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
|
||||
|
|
|
|||
|
|
@ -6,11 +6,13 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#include "readtex.h"
|
||||
|
||||
#define TEST_CLAMP 0
|
||||
#define TEST_MIPMAPS 0
|
||||
#define TEST_GEN_COMPRESSED_MIPMAPS 0
|
||||
|
||||
#define MAX_TEXTURES 8
|
||||
|
||||
|
|
@ -304,6 +306,69 @@ LoadTextures(GLuint n, const char *files[])
|
|||
GL_RGBA, GL_UNSIGNED_BYTE, image);
|
||||
}
|
||||
}
|
||||
#elif TEST_GEN_COMPRESSED_MIPMAPS
|
||||
{
|
||||
GLenum intFormat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
|
||||
int f;
|
||||
GLenum format;
|
||||
GLubyte *img = LoadRGBImage(files[i], &w, &h, &format);
|
||||
GLboolean write_compressed = GL_FALSE;
|
||||
GLboolean read_compressed = GL_FALSE;
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, intFormat, w, h, 0,
|
||||
format, GL_UNSIGNED_BYTE, img);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE);
|
||||
free(img);
|
||||
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i,
|
||||
GL_TEXTURE_INTERNAL_FORMAT, &f);
|
||||
printf("actual internal format 0x%x\n", f);
|
||||
|
||||
if (write_compressed) {
|
||||
GLint i, sz, w, h;
|
||||
int num_levels = 8;
|
||||
for (i = 0; i < num_levels; i++) {
|
||||
char name[20], *buf;
|
||||
FILE *f;
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_WIDTH, &w);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_HEIGHT, &h);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i,
|
||||
GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &sz);
|
||||
printf("Writing level %d: %d x %d bytes: %d\n", i, w, h, sz);
|
||||
buf = malloc(sz);
|
||||
glGetCompressedTexImageARB(GL_TEXTURE_2D, i, buf);
|
||||
sprintf(name, "comp%d", i);
|
||||
f = fopen(name, "w");
|
||||
fwrite(buf, 1, sz, f);
|
||||
fclose(f);
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
|
||||
if (read_compressed) {
|
||||
GLint i, sz, w, h;
|
||||
int num_levels = 8;
|
||||
for (i = 01; i < num_levels; i++) {
|
||||
char name[20], *buf;
|
||||
FILE *f;
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_WIDTH, &w);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i, GL_TEXTURE_HEIGHT, &h);
|
||||
glGetTexLevelParameteriv(GL_TEXTURE_2D, i,
|
||||
GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &sz);
|
||||
buf = malloc(sz);
|
||||
sprintf(name, "comp%d", i);
|
||||
printf("Reading level %d: %d x %d bytes: %d from %s\n",
|
||||
i, w, h, sz, name);
|
||||
f = fopen(name, "r");
|
||||
fread(buf, 1, sz, f);
|
||||
fclose(f);
|
||||
glCompressedTexImage2DARB(GL_TEXTURE_2D, i, intFormat,
|
||||
w, h, 0, sz, buf);
|
||||
free(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (!LoadRGBMipmaps2(files[i], GL_TEXTURE_2D, GL_RGB, &w, &h)) {
|
||||
printf("Error: couldn't load %s\n", files[i]);
|
||||
|
|
@ -360,6 +425,7 @@ main(int argc, char *argv[])
|
|||
glutInit(&argc, argv);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
|
||||
Win = glutCreateWindow(argv[0]);
|
||||
glewInit();
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutSpecialFunc(SpecialKey);
|
||||
|
|
|
|||
|
|
@ -1,70 +0,0 @@
|
|||
# progs/egl/Makefile
|
||||
|
||||
TOP = ../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
|
||||
INCLUDE_DIRS = -I$(TOP)/include
|
||||
|
||||
HEADERS = $(TOP)/include/GLES/egl.h
|
||||
LIB_DEP = $(TOP)/$(LIB_DIR)/libEGL.so
|
||||
|
||||
LIBS = -L$(TOP)/$(LIB_DIR) -lEGL -lGL
|
||||
|
||||
PROGRAMS = \
|
||||
demo1 \
|
||||
demo2 \
|
||||
demo3 \
|
||||
egltri \
|
||||
eglinfo \
|
||||
eglgears \
|
||||
eglscreen \
|
||||
peglgears \
|
||||
xeglgears \
|
||||
xeglthreads \
|
||||
xegl_tri
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
|
||||
|
||||
|
||||
|
||||
default: $(PROGRAMS)
|
||||
|
||||
demo1: demo1.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
|
||||
|
||||
demo2: demo2.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
|
||||
|
||||
demo3: demo3.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
|
||||
|
||||
egltri: egltri.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
|
||||
|
||||
eglinfo: eglinfo.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
|
||||
|
||||
eglgears: eglgears.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB) -lm
|
||||
|
||||
eglscreen: eglscreen.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
|
||||
|
||||
peglgears: peglgears.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB) -lm
|
||||
|
||||
xeglgears: xeglgears.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11 -lm
|
||||
|
||||
xeglthreads: xeglthreads.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11 -lm
|
||||
|
||||
xegl_tri: xegl_tri.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lX11
|
||||
|
||||
clean:
|
||||
-rm -f *.o *~
|
||||
-rm -f $(PROGRAMS)
|
||||
|
|
@ -1,264 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 2008 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 2008 Jakob Bornecrantz 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This program is based on eglgears and xegl_tri.
|
||||
* Remixed by Jakob Bornecrantz
|
||||
*
|
||||
* No command line options.
|
||||
* Program runs for 5 seconds then exits, outputing framerate to console
|
||||
*/
|
||||
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <GL/gl.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#define MAX_CONFIGS 10
|
||||
#define MAX_MODES 100
|
||||
|
||||
|
||||
/* XXX this probably isn't very portable */
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* return current time (in seconds) */
|
||||
static double
|
||||
current_time(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
#ifdef __VMS
|
||||
(void) gettimeofday(&tv, NULL );
|
||||
#else
|
||||
struct timezone tz;
|
||||
(void) gettimeofday(&tv, &tz);
|
||||
#endif
|
||||
return (double) tv.tv_sec + tv.tv_usec / 1000000.0;
|
||||
}
|
||||
|
||||
|
||||
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
|
||||
|
||||
static void draw()
|
||||
{
|
||||
static const GLfloat verts[3][2] = {
|
||||
{ -1, -1 },
|
||||
{ 1, -1 },
|
||||
{ 0, 1 }
|
||||
};
|
||||
static const GLfloat colors[3][3] = {
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 1, 0 },
|
||||
{ 0, 0, 1 }
|
||||
};
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(view_rotx, 1, 0, 0);
|
||||
glRotatef(view_roty, 0, 1, 0);
|
||||
glRotatef(view_rotz, 0, 0, 1);
|
||||
|
||||
{
|
||||
glVertexPointer(2, GL_FLOAT, 0, verts);
|
||||
glColorPointer(3, GL_FLOAT, 0, colors);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
static void init()
|
||||
{
|
||||
glClearColor(0.4, 0.4, 0.4, 0.0);
|
||||
}
|
||||
|
||||
/* new window size or exposure */
|
||||
static void reshape(int width, int height)
|
||||
{
|
||||
GLfloat ar = (GLfloat) width / (GLfloat) height;
|
||||
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -10.0);
|
||||
}
|
||||
|
||||
static void run(EGLDisplay dpy, EGLSurface surf, int ttr)
|
||||
{
|
||||
double st = current_time();
|
||||
double ct = st;
|
||||
int frames = 0;
|
||||
GLfloat seconds, fps;
|
||||
|
||||
while (ct - st < ttr)
|
||||
{
|
||||
ct = current_time();
|
||||
|
||||
draw();
|
||||
|
||||
eglSwapBuffers(dpy, surf);
|
||||
|
||||
frames++;
|
||||
}
|
||||
|
||||
seconds = ct - st;
|
||||
fps = frames / seconds;
|
||||
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int maj, min;
|
||||
EGLContext ctx;
|
||||
EGLSurface screen_surf;
|
||||
EGLConfig configs[MAX_CONFIGS];
|
||||
EGLint numConfigs, i;
|
||||
EGLBoolean b;
|
||||
EGLDisplay d;
|
||||
EGLint screenAttribs[10];
|
||||
EGLModeMESA mode[MAX_MODES];
|
||||
EGLScreenMESA screen;
|
||||
EGLint count, chosenMode = 0;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
EGLint width = 0, height = 0;
|
||||
|
||||
/* parse cmd line args */
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (strcmp(argv[i], "-info") == 0)
|
||||
{
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else
|
||||
printf("Warning: unknown parameter: %s\n", argv[i]);
|
||||
}
|
||||
|
||||
/* DBR : Create EGL context/surface etc */
|
||||
d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
assert(d);
|
||||
|
||||
if (!eglInitialize(d, &maj, &min)) {
|
||||
printf("egltri: eglInitialize failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("egltri: EGL version = %d.%d\n", maj, min);
|
||||
printf("egltri: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
|
||||
|
||||
/* XXX use ChooseConfig */
|
||||
eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
|
||||
eglGetScreensMESA(d, &screen, 1, &count);
|
||||
|
||||
if (!eglGetModesMESA(d, screen, mode, MAX_MODES, &count) || count == 0) {
|
||||
printf("egltri: eglGetModesMESA failed!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Print list of modes, and find the one to use */
|
||||
printf("egltri: Found %d modes:\n", count);
|
||||
for (i = 0; i < count; i++) {
|
||||
EGLint w, h;
|
||||
eglGetModeAttribMESA(d, mode[i], EGL_WIDTH, &w);
|
||||
eglGetModeAttribMESA(d, mode[i], EGL_HEIGHT, &h);
|
||||
printf("%3d: %d x %d\n", i, w, h);
|
||||
if (w > width && h > height) {
|
||||
width = w;
|
||||
height = h;
|
||||
chosenMode = i;
|
||||
}
|
||||
}
|
||||
printf("egltri: Using screen mode/size %d: %d x %d\n", chosenMode, width, height);
|
||||
|
||||
eglBindAPI(EGL_OPENGL_API);
|
||||
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
|
||||
if (ctx == EGL_NO_CONTEXT) {
|
||||
printf("egltri: failed to create context\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* build up screenAttribs array */
|
||||
i = 0;
|
||||
screenAttribs[i++] = EGL_WIDTH;
|
||||
screenAttribs[i++] = width;
|
||||
screenAttribs[i++] = EGL_HEIGHT;
|
||||
screenAttribs[i++] = height;
|
||||
screenAttribs[i++] = EGL_NONE;
|
||||
|
||||
screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
|
||||
if (screen_surf == EGL_NO_SURFACE) {
|
||||
printf("egltri: failed to create screen surface\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
b = eglShowScreenSurfaceMESA(d, screen, screen_surf, mode[chosenMode]);
|
||||
if (!b) {
|
||||
printf("egltri: show surface failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
|
||||
if (!b) {
|
||||
printf("egltri: make current failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (printInfo)
|
||||
{
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
|
||||
init();
|
||||
reshape(width, height);
|
||||
|
||||
glDrawBuffer( GL_BACK );
|
||||
|
||||
run(d, screen_surf, 5.0);
|
||||
|
||||
eglDestroySurface(d, screen_surf);
|
||||
eglDestroyContext(d, ctx);
|
||||
eglTerminate(d);
|
||||
|
||||
return 0;
|
||||
}
|
||||
39
progs/egl/eglut/Makefile
Normal file
39
progs/egl/eglut/Makefile
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# progs/egl/eglut
|
||||
|
||||
TOP = ../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
INCLUDES = \
|
||||
-I$(TOP)/include \
|
||||
$(X11_CFLAGS)
|
||||
|
||||
SOURCES = \
|
||||
eglut.c \
|
||||
eglut_screen.c \
|
||||
eglut_x11.c
|
||||
|
||||
EGLUT_X11_OBJECTS = eglut.o eglut_x11.o
|
||||
EGLUT_SCREEN_OBJECTS = eglut.o eglut_screen.o
|
||||
|
||||
default: depend libeglut-x11.a libeglut-screen.a
|
||||
|
||||
libeglut-x11.a: $(EGLUT_X11_OBJECTS)
|
||||
$(MKLIB) -o eglut-x11 -static $(EGLUT_X11_OBJECTS)
|
||||
|
||||
libeglut-screen.a: $(EGLUT_SCREEN_OBJECTS)
|
||||
$(MKLIB) -o eglut-screen -static $(EGLUT_SCREEN_OBJECTS)
|
||||
|
||||
.c.o:
|
||||
$(CC) -c -o $@ $< $(INCLUDES) $(DEFINES) $(CFLAGS)
|
||||
|
||||
depend: $(SOURCES)
|
||||
@rm -f depend
|
||||
@touch depend
|
||||
@$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) \
|
||||
> /dev/null 2>/dev/null
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a
|
||||
rm -f depend depend.bak
|
||||
|
||||
sinclude depend
|
||||
346
progs/egl/eglut/eglut.c
Normal file
346
progs/egl/eglut/eglut.c
Normal file
|
|
@ -0,0 +1,346 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "EGL/egl.h"
|
||||
#include "EGL/eglext.h"
|
||||
|
||||
#include "eglutint.h"
|
||||
|
||||
static struct eglut_state _eglut_state = {
|
||||
.api_mask = EGLUT_OPENGL_ES1_BIT,
|
||||
.window_width = 300,
|
||||
.window_height = 300,
|
||||
.verbose = 0,
|
||||
.num_windows = 0,
|
||||
};
|
||||
|
||||
struct eglut_state *_eglut = &_eglut_state;
|
||||
|
||||
void
|
||||
_eglutFatal(char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
|
||||
fprintf(stderr, "EGLUT: ");
|
||||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
putc('\n', stderr);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* return current time (in milliseconds) */
|
||||
int
|
||||
_eglutNow(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
#ifdef __VMS
|
||||
(void) gettimeofday(&tv, NULL );
|
||||
#else
|
||||
struct timezone tz;
|
||||
(void) gettimeofday(&tv, &tz);
|
||||
#endif
|
||||
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
}
|
||||
|
||||
static void
|
||||
_eglutDestroyWindow(struct eglut_window *win)
|
||||
{
|
||||
if (_eglut->surface_type != EGL_PBUFFER_BIT &&
|
||||
_eglut->surface_type != EGL_SCREEN_BIT_MESA)
|
||||
eglDestroySurface(_eglut->dpy, win->surface);
|
||||
|
||||
_eglutNativeFiniWindow(win);
|
||||
|
||||
eglDestroyContext(_eglut->dpy, win->context);
|
||||
}
|
||||
|
||||
static EGLConfig
|
||||
_eglutChooseConfig(void)
|
||||
{
|
||||
EGLConfig config;
|
||||
EGLint config_attribs[32];
|
||||
EGLint renderable_type, num_configs, i;
|
||||
|
||||
i = 0;
|
||||
config_attribs[i++] = EGL_RED_SIZE;
|
||||
config_attribs[i++] = 1;
|
||||
config_attribs[i++] = EGL_GREEN_SIZE;
|
||||
config_attribs[i++] = 1;
|
||||
config_attribs[i++] = EGL_BLUE_SIZE;
|
||||
config_attribs[i++] = 1;
|
||||
config_attribs[i++] = EGL_DEPTH_SIZE;
|
||||
config_attribs[i++] = 1;
|
||||
|
||||
config_attribs[i++] = EGL_SURFACE_TYPE;
|
||||
config_attribs[i++] = _eglut->surface_type;
|
||||
|
||||
config_attribs[i++] = EGL_RENDERABLE_TYPE;
|
||||
renderable_type = 0x0;
|
||||
if (_eglut->api_mask & EGLUT_OPENGL_BIT)
|
||||
renderable_type |= EGL_OPENGL_BIT;
|
||||
if (_eglut->api_mask & (EGLUT_OPENGL_ES1_BIT | EGLUT_OPENGL_ES2_BIT))
|
||||
renderable_type |= EGL_OPENGL_ES_BIT;
|
||||
if (_eglut->api_mask & EGLUT_OPENVG_BIT)
|
||||
renderable_type |= EGL_OPENVG_BIT;
|
||||
config_attribs[i++] = renderable_type;
|
||||
|
||||
config_attribs[i] = EGL_NONE;
|
||||
|
||||
if (!eglChooseConfig(_eglut->dpy,
|
||||
config_attribs, &config, 1, &num_configs) || !num_configs)
|
||||
_eglutFatal("failed to choose a config");
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
static struct eglut_window *
|
||||
_eglutCreateWindow(const char *title, int x, int y, int w, int h)
|
||||
{
|
||||
struct eglut_window *win;
|
||||
EGLint context_attribs[4];
|
||||
EGLint api, i;
|
||||
|
||||
win = calloc(1, sizeof(*win));
|
||||
if (!win)
|
||||
_eglutFatal("failed to allocate window");
|
||||
|
||||
win->config = _eglutChooseConfig();
|
||||
|
||||
i = 0;
|
||||
context_attribs[i] = EGL_NONE;
|
||||
|
||||
/* multiple APIs? */
|
||||
|
||||
api = EGL_OPENGL_ES_API;
|
||||
if (_eglut->api_mask & EGLUT_OPENGL_BIT) {
|
||||
api = EGL_OPENGL_API;
|
||||
}
|
||||
else if (_eglut->api_mask & EGLUT_OPENVG_BIT) {
|
||||
api = EGL_OPENVG_API;
|
||||
}
|
||||
else if (_eglut->api_mask & EGLUT_OPENGL_ES2_BIT) {
|
||||
context_attribs[i++] = EGL_CONTEXT_CLIENT_VERSION;
|
||||
context_attribs[i++] = 2;
|
||||
}
|
||||
|
||||
context_attribs[i] = EGL_NONE;
|
||||
|
||||
eglBindAPI(api);
|
||||
win->context = eglCreateContext(_eglut->dpy,
|
||||
win->config, EGL_NO_CONTEXT, context_attribs);
|
||||
if (!win->context)
|
||||
_eglutFatal("failed to create context");
|
||||
|
||||
_eglutNativeInitWindow(win, title, x, y, w, h);
|
||||
switch (_eglut->surface_type) {
|
||||
case EGL_WINDOW_BIT:
|
||||
win->surface = eglCreateWindowSurface(_eglut->dpy,
|
||||
win->config, win->native.u.window, NULL);
|
||||
break;
|
||||
case EGL_PIXMAP_BIT:
|
||||
win->surface = eglCreatePixmapSurface(_eglut->dpy,
|
||||
win->config, win->native.u.pixmap, NULL);
|
||||
break;
|
||||
case EGL_PBUFFER_BIT:
|
||||
case EGL_SCREEN_BIT_MESA:
|
||||
win->surface = win->native.u.surface;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (win->surface == EGL_NO_SURFACE)
|
||||
_eglutFatal("failed to create surface");
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
void
|
||||
eglutInitAPIMask(int mask)
|
||||
{
|
||||
_eglut->api_mask = mask;
|
||||
}
|
||||
|
||||
void
|
||||
eglutInitWindowSize(int width, int height)
|
||||
{
|
||||
_eglut->window_width = width;
|
||||
_eglut->window_height = height;
|
||||
}
|
||||
|
||||
void
|
||||
eglutInit(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-display") == 0)
|
||||
_eglut->display_name = argv[++i];
|
||||
else if (strcmp(argv[i], "-info") == 0) {
|
||||
_eglut->verbose = 1;
|
||||
}
|
||||
}
|
||||
|
||||
_eglutNativeInitDisplay();
|
||||
_eglut->dpy = eglGetDisplay(_eglut->native_dpy);
|
||||
|
||||
if (!eglInitialize(_eglut->dpy, &_eglut->major, &_eglut->minor))
|
||||
_eglutFatal("failed to initialize EGL display");
|
||||
|
||||
_eglut->init_time = _eglutNow();
|
||||
|
||||
printf("EGL_VERSION = %s\n", eglQueryString(_eglut->dpy, EGL_VERSION));
|
||||
if (_eglut->verbose) {
|
||||
printf("EGL_VENDOR = %s\n", eglQueryString(_eglut->dpy, EGL_VENDOR));
|
||||
printf("EGL_EXTENSIONS = %s\n",
|
||||
eglQueryString(_eglut->dpy, EGL_EXTENSIONS));
|
||||
printf("EGL_CLIENT_APIS = %s\n",
|
||||
eglQueryString(_eglut->dpy, EGL_CLIENT_APIS));
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
eglutGet(int state)
|
||||
{
|
||||
int val;
|
||||
|
||||
switch (state) {
|
||||
case EGLUT_ELAPSED_TIME:
|
||||
val = _eglutNow() - _eglut->init_time;
|
||||
break;
|
||||
default:
|
||||
val = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
void
|
||||
eglutIdleFunc(EGLUTidleCB func)
|
||||
{
|
||||
_eglut->idle_cb = func;
|
||||
}
|
||||
|
||||
void
|
||||
eglutPostRedisplay(void)
|
||||
{
|
||||
_eglut->redisplay = 1;
|
||||
}
|
||||
|
||||
void
|
||||
eglutMainLoop(void)
|
||||
{
|
||||
struct eglut_window *win = _eglut->current;
|
||||
|
||||
if (!win)
|
||||
_eglutFatal("no window is created\n");
|
||||
|
||||
if (win->reshape_cb)
|
||||
win->reshape_cb(win->native.width, win->native.height);
|
||||
|
||||
_eglutNativeEventLoop();
|
||||
}
|
||||
|
||||
static void
|
||||
_eglutFini(void)
|
||||
{
|
||||
eglTerminate(_eglut->dpy);
|
||||
_eglutNativeFiniDisplay();
|
||||
}
|
||||
|
||||
void
|
||||
eglutDestroyWindow(int win)
|
||||
{
|
||||
struct eglut_window *window = _eglut->current;
|
||||
|
||||
if (window->index != win)
|
||||
return;
|
||||
|
||||
/* XXX it causes some bug in st/egl KMS backend */
|
||||
if ( _eglut->surface_type != EGL_SCREEN_BIT_MESA)
|
||||
eglMakeCurrent(_eglut->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
_eglutDestroyWindow(_eglut->current);
|
||||
}
|
||||
|
||||
static void
|
||||
_eglutDefaultKeyboard(unsigned char key)
|
||||
{
|
||||
if (key == 27) {
|
||||
if (_eglut->current)
|
||||
eglutDestroyWindow(_eglut->current->index);
|
||||
_eglutFini();
|
||||
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
eglutCreateWindow(const char *title)
|
||||
{
|
||||
struct eglut_window *win;
|
||||
|
||||
win = _eglutCreateWindow(title, 0, 0,
|
||||
_eglut->window_width, _eglut->window_height);
|
||||
|
||||
win->index = _eglut->num_windows++;
|
||||
win->reshape_cb = NULL;
|
||||
win->display_cb = NULL;
|
||||
win->keyboard_cb = _eglutDefaultKeyboard;
|
||||
win->special_cb = NULL;
|
||||
|
||||
if (!eglMakeCurrent(_eglut->dpy, win->surface, win->surface, win->context))
|
||||
_eglutFatal("failed to make window current");
|
||||
_eglut->current = win;
|
||||
|
||||
return win->index;
|
||||
}
|
||||
|
||||
int
|
||||
eglutGetWindowWidth(void)
|
||||
{
|
||||
struct eglut_window *win = _eglut->current;
|
||||
return win->native.width;
|
||||
}
|
||||
|
||||
int
|
||||
eglutGetWindowHeight(void)
|
||||
{
|
||||
struct eglut_window *win = _eglut->current;
|
||||
return win->native.height;
|
||||
}
|
||||
|
||||
void
|
||||
eglutDisplayFunc(EGLUTdisplayCB func)
|
||||
{
|
||||
struct eglut_window *win = _eglut->current;
|
||||
win->display_cb = func;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
eglutReshapeFunc(EGLUTreshapeCB func)
|
||||
{
|
||||
struct eglut_window *win = _eglut->current;
|
||||
win->reshape_cb = func;
|
||||
}
|
||||
|
||||
void
|
||||
eglutKeyboardFunc(EGLUTkeyboardCB func)
|
||||
{
|
||||
struct eglut_window *win = _eglut->current;
|
||||
win->keyboard_cb = func;
|
||||
}
|
||||
|
||||
void
|
||||
eglutSpecialFunc(EGLUTspecialCB func)
|
||||
{
|
||||
struct eglut_window *win = _eglut->current;
|
||||
win->special_cb = func;
|
||||
}
|
||||
68
progs/egl/eglut/eglut.h
Normal file
68
progs/egl/eglut/eglut.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#ifndef EGLUT_H
|
||||
#define EGLUT_H
|
||||
|
||||
/* used by eglutInitAPIMask */
|
||||
enum {
|
||||
EGLUT_OPENGL_BIT = 0x1,
|
||||
EGLUT_OPENGL_ES1_BIT = 0x2,
|
||||
EGLUT_OPENGL_ES2_BIT = 0x4,
|
||||
EGLUT_OPENVG_BIT = 0x8
|
||||
};
|
||||
|
||||
/* used by EGLUTspecialCB */
|
||||
enum {
|
||||
/* function keys */
|
||||
EGLUT_KEY_F1,
|
||||
EGLUT_KEY_F2,
|
||||
EGLUT_KEY_F3,
|
||||
EGLUT_KEY_F4,
|
||||
EGLUT_KEY_F5,
|
||||
EGLUT_KEY_F6,
|
||||
EGLUT_KEY_F7,
|
||||
EGLUT_KEY_F8,
|
||||
EGLUT_KEY_F9,
|
||||
EGLUT_KEY_F10,
|
||||
EGLUT_KEY_F11,
|
||||
EGLUT_KEY_F12,
|
||||
|
||||
/* directional keys */
|
||||
EGLUT_KEY_LEFT,
|
||||
EGLUT_KEY_UP,
|
||||
EGLUT_KEY_RIGHT,
|
||||
EGLUT_KEY_DOWN,
|
||||
};
|
||||
|
||||
/* used by eglutGet */
|
||||
enum {
|
||||
EGLUT_ELAPSED_TIME
|
||||
};
|
||||
|
||||
typedef void (*EGLUTidleCB)(void);
|
||||
typedef void (*EGLUTreshapeCB)(int, int);
|
||||
typedef void (*EGLUTdisplayCB)(void);
|
||||
typedef void (*EGLUTkeyboardCB)(unsigned char);
|
||||
typedef void (*EGLUTspecialCB)(int);
|
||||
|
||||
void eglutInitAPIMask(int mask);
|
||||
void eglutInitWindowSize(int width, int height);
|
||||
void eglutInit(int argc, char **argv);
|
||||
|
||||
int eglutGet(int state);
|
||||
|
||||
void eglutIdleFunc(EGLUTidleCB func);
|
||||
void eglutPostRedisplay(void);
|
||||
|
||||
void eglutMainLoop(void);
|
||||
|
||||
int eglutCreateWindow(const char *title);
|
||||
void eglutDestroyWindow(int win);
|
||||
|
||||
int eglutGetWindowWidth(void);
|
||||
int eglutGetWindowHeight(void);
|
||||
|
||||
void eglutDisplayFunc(EGLUTdisplayCB func);
|
||||
void eglutReshapeFunc(EGLUTreshapeCB func);
|
||||
void eglutKeyboardFunc(EGLUTkeyboardCB func);
|
||||
void eglutSpecialFunc(EGLUTspecialCB func);
|
||||
|
||||
#endif /* EGLUT_H */
|
||||
154
progs/egl/eglut/eglut_screen.c
Normal file
154
progs/egl/eglut/eglut_screen.c
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
#include "EGL/egl.h"
|
||||
#include "EGL/eglext.h"
|
||||
|
||||
#include "eglutint.h"
|
||||
|
||||
#define MAX_MODES 100
|
||||
|
||||
static EGLScreenMESA kms_screen;
|
||||
static EGLModeMESA kms_mode;
|
||||
static EGLint kms_width, kms_height;
|
||||
|
||||
void
|
||||
_eglutNativeInitDisplay(void)
|
||||
{
|
||||
_eglut->native_dpy = EGL_DEFAULT_DISPLAY;
|
||||
_eglut->surface_type = EGL_SCREEN_BIT_MESA;
|
||||
}
|
||||
|
||||
void
|
||||
_eglutNativeFiniDisplay(void)
|
||||
{
|
||||
kms_screen = 0;
|
||||
kms_mode = 0;
|
||||
kms_width = 0;
|
||||
kms_height = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
init_kms(void)
|
||||
{
|
||||
EGLModeMESA modes[MAX_MODES];
|
||||
EGLint num_screens, num_modes;
|
||||
EGLint width, height, best_mode;
|
||||
EGLint i;
|
||||
|
||||
if (!eglGetScreensMESA(_eglut->dpy, &kms_screen, 1, &num_screens) ||
|
||||
!num_screens)
|
||||
_eglutFatal("eglGetScreensMESA failed\n");
|
||||
|
||||
if (!eglGetModesMESA(_eglut->dpy, kms_screen,
|
||||
modes, MAX_MODES, &num_modes) || !num_modes)
|
||||
_eglutFatal("eglGetModesMESA failed!\n");
|
||||
|
||||
printf("Found %d modes:\n", num_modes);
|
||||
|
||||
best_mode = 0;
|
||||
width = 0;
|
||||
height = 0;
|
||||
for (i = 0; i < num_modes; i++) {
|
||||
EGLint w, h;
|
||||
eglGetModeAttribMESA(_eglut->dpy, modes[i], EGL_WIDTH, &w);
|
||||
eglGetModeAttribMESA(_eglut->dpy, modes[i], EGL_HEIGHT, &h);
|
||||
printf("%3d: %d x %d\n", i, w, h);
|
||||
if (w > width && h > height) {
|
||||
width = w;
|
||||
height = h;
|
||||
best_mode = i;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Will use screen size: %d x %d\n", width, height);
|
||||
|
||||
kms_mode = modes[best_mode];
|
||||
kms_width = width;
|
||||
kms_height = height;
|
||||
}
|
||||
|
||||
void
|
||||
_eglutNativeInitWindow(struct eglut_window *win, const char *title,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
EGLint surf_attribs[16];
|
||||
EGLint i;
|
||||
const char *exts;
|
||||
|
||||
exts = eglQueryString(_eglut->dpy, EGL_EXTENSIONS);
|
||||
if (!exts || !strstr(exts, "EGL_MESA_screen_surface"))
|
||||
_eglutFatal("EGL_MESA_screen_surface is not supported\n");
|
||||
|
||||
init_kms();
|
||||
|
||||
i = 0;
|
||||
surf_attribs[i++] = EGL_WIDTH;
|
||||
surf_attribs[i++] = kms_width;
|
||||
surf_attribs[i++] = EGL_HEIGHT;
|
||||
surf_attribs[i++] = kms_height;
|
||||
surf_attribs[i++] = EGL_NONE;
|
||||
|
||||
/* create surface */
|
||||
win->native.u.surface = eglCreateScreenSurfaceMESA(_eglut->dpy,
|
||||
win->config, surf_attribs);
|
||||
if (win->native.u.surface == EGL_NO_SURFACE)
|
||||
_eglutFatal("eglCreateScreenSurfaceMESA failed\n");
|
||||
|
||||
if (!eglShowScreenSurfaceMESA(_eglut->dpy, kms_screen,
|
||||
win->native.u.surface, kms_mode))
|
||||
_eglutFatal("eglShowScreenSurfaceMESA failed\n");
|
||||
|
||||
win->native.width = kms_width;
|
||||
win->native.height = kms_height;
|
||||
}
|
||||
|
||||
void
|
||||
_eglutNativeFiniWindow(struct eglut_window *win)
|
||||
{
|
||||
eglShowScreenSurfaceMESA(_eglut->dpy,
|
||||
kms_screen, EGL_NO_SURFACE, 0);
|
||||
eglDestroySurface(_eglut->dpy, win->native.u.surface);
|
||||
}
|
||||
|
||||
void
|
||||
_eglutNativeEventLoop(void)
|
||||
{
|
||||
int start = _eglutNow();
|
||||
int frames = 0;
|
||||
|
||||
_eglut->redisplay = 1;
|
||||
|
||||
while (1) {
|
||||
struct eglut_window *win = _eglut->current;
|
||||
int now = _eglutNow();
|
||||
|
||||
if (now - start > 5000) {
|
||||
double elapsed = (double) (now - start) / 1000.0;
|
||||
|
||||
printf("%d frames in %3.1f seconds = %6.3f FPS\n",
|
||||
frames, elapsed, frames / elapsed);
|
||||
|
||||
start = now;
|
||||
frames = 0;
|
||||
|
||||
/* send escape */
|
||||
if (win->keyboard_cb)
|
||||
win->keyboard_cb(27);
|
||||
}
|
||||
|
||||
if (_eglut->idle_cb)
|
||||
_eglut->idle_cb();
|
||||
|
||||
if (_eglut->redisplay) {
|
||||
_eglut->redisplay = 0;
|
||||
|
||||
if (win->display_cb)
|
||||
win->display_cb();
|
||||
eglSwapBuffers(_eglut->dpy, win->surface);
|
||||
frames++;
|
||||
}
|
||||
}
|
||||
}
|
||||
220
progs/egl/eglut/eglut_x11.c
Normal file
220
progs/egl/eglut/eglut_x11.c
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
|
||||
#include "eglutint.h"
|
||||
|
||||
void
|
||||
_eglutNativeInitDisplay(void)
|
||||
{
|
||||
_eglut->native_dpy = XOpenDisplay(_eglut->display_name);
|
||||
if (!_eglut->native_dpy)
|
||||
_eglutFatal("failed to initialize native display");
|
||||
|
||||
_eglut->surface_type = EGL_WINDOW_BIT;
|
||||
}
|
||||
|
||||
void
|
||||
_eglutNativeFiniDisplay(void)
|
||||
{
|
||||
XCloseDisplay(_eglut->native_dpy);
|
||||
}
|
||||
|
||||
void
|
||||
_eglutNativeInitWindow(struct eglut_window *win, const char *title,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
XVisualInfo *visInfo, visTemplate;
|
||||
int num_visuals;
|
||||
Window root, xwin;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
EGLint vid;
|
||||
|
||||
if (!eglGetConfigAttrib(_eglut->dpy,
|
||||
win->config, EGL_NATIVE_VISUAL_ID, &vid))
|
||||
_eglutFatal("failed to get visual id");
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
visInfo = XGetVisualInfo(_eglut->native_dpy,
|
||||
VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!visInfo)
|
||||
_eglutFatal("failed to get an visual of id 0x%x", vid);
|
||||
|
||||
root = RootWindow(_eglut->native_dpy, DefaultScreen(_eglut->native_dpy));
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap(_eglut->native_dpy,
|
||||
root, visInfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
xwin = XCreateWindow(_eglut->native_dpy, root, x, y, w, h,
|
||||
0, visInfo->depth, InputOutput, visInfo->visual, mask, &attr);
|
||||
if (!xwin)
|
||||
_eglutFatal("failed to create a window");
|
||||
|
||||
XFree(visInfo);
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = w;
|
||||
sizehints.height = h;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(_eglut->native_dpy, xwin, &sizehints);
|
||||
XSetStandardProperties(_eglut->native_dpy, xwin,
|
||||
title, title, None, (char **) NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
XMapWindow(_eglut->native_dpy, xwin);
|
||||
|
||||
win->native.u.window = xwin;
|
||||
win->native.width = w;
|
||||
win->native.height = h;
|
||||
}
|
||||
|
||||
void
|
||||
_eglutNativeFiniWindow(struct eglut_window *win)
|
||||
{
|
||||
XDestroyWindow(_eglut->native_dpy, win->native.u.window);
|
||||
}
|
||||
|
||||
static int
|
||||
lookup_keysym(KeySym sym)
|
||||
{
|
||||
int special;
|
||||
|
||||
switch (sym) {
|
||||
case XK_F1:
|
||||
special = EGLUT_KEY_F1;
|
||||
break;
|
||||
case XK_F2:
|
||||
special = EGLUT_KEY_F2;
|
||||
break;
|
||||
case XK_F3:
|
||||
special = EGLUT_KEY_F3;
|
||||
break;
|
||||
case XK_F4:
|
||||
special = EGLUT_KEY_F4;
|
||||
break;
|
||||
case XK_F5:
|
||||
special = EGLUT_KEY_F5;
|
||||
break;
|
||||
case XK_F6:
|
||||
special = EGLUT_KEY_F6;
|
||||
break;
|
||||
case XK_F7:
|
||||
special = EGLUT_KEY_F7;
|
||||
break;
|
||||
case XK_F8:
|
||||
special = EGLUT_KEY_F8;
|
||||
break;
|
||||
case XK_F9:
|
||||
special = EGLUT_KEY_F9;
|
||||
break;
|
||||
case XK_F10:
|
||||
special = EGLUT_KEY_F10;
|
||||
break;
|
||||
case XK_F11:
|
||||
special = EGLUT_KEY_F11;
|
||||
break;
|
||||
case XK_F12:
|
||||
special = EGLUT_KEY_F12;
|
||||
break;
|
||||
case XK_KP_Left:
|
||||
case XK_Left:
|
||||
special = EGLUT_KEY_LEFT;
|
||||
break;
|
||||
case XK_KP_Up:
|
||||
case XK_Up:
|
||||
special = EGLUT_KEY_UP;
|
||||
break;
|
||||
case XK_KP_Right:
|
||||
case XK_Right:
|
||||
special = EGLUT_KEY_RIGHT;
|
||||
break;
|
||||
case XK_KP_Down:
|
||||
case XK_Down:
|
||||
special = EGLUT_KEY_DOWN;
|
||||
break;
|
||||
default:
|
||||
special = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
return special;
|
||||
}
|
||||
|
||||
static void
|
||||
next_event(struct eglut_window *win)
|
||||
{
|
||||
int redraw = 0;
|
||||
XEvent event;
|
||||
|
||||
if (!XPending(_eglut->native_dpy)) {
|
||||
if (_eglut->idle_cb)
|
||||
_eglut->idle_cb();
|
||||
return;
|
||||
}
|
||||
|
||||
XNextEvent(_eglut->native_dpy, &event);
|
||||
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
redraw = 1;
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
win->native.width = event.xconfigure.width;
|
||||
win->native.height = event.xconfigure.height;
|
||||
if (win->reshape_cb)
|
||||
win->reshape_cb(win->native.width, win->native.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[1];
|
||||
KeySym sym;
|
||||
int r;
|
||||
|
||||
r = XLookupString(&event.xkey,
|
||||
buffer, sizeof(buffer), &sym, NULL);
|
||||
if (r && win->keyboard_cb) {
|
||||
win->keyboard_cb(buffer[0]);
|
||||
}
|
||||
else if (!r && win->special_cb) {
|
||||
r = lookup_keysym(sym);
|
||||
if (r >= 0)
|
||||
win->special_cb(r);
|
||||
}
|
||||
}
|
||||
redraw = 1;
|
||||
break;
|
||||
default:
|
||||
; /*no-op*/
|
||||
}
|
||||
|
||||
_eglut->redisplay = redraw;
|
||||
}
|
||||
|
||||
void
|
||||
_eglutNativeEventLoop(void)
|
||||
{
|
||||
while (1) {
|
||||
struct eglut_window *win = _eglut->current;
|
||||
|
||||
next_event(win);
|
||||
|
||||
if (_eglut->redisplay) {
|
||||
_eglut->redisplay = 0;
|
||||
|
||||
if (win->display_cb)
|
||||
win->display_cb();
|
||||
eglSwapBuffers(_eglut->dpy, win->surface);
|
||||
}
|
||||
}
|
||||
}
|
||||
78
progs/egl/eglut/eglutint.h
Normal file
78
progs/egl/eglut/eglutint.h
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
#ifndef _EGLUTINT_H_
|
||||
#define _EGLUTINT_H_
|
||||
|
||||
#include "EGL/egl.h"
|
||||
#include "eglut.h"
|
||||
|
||||
struct eglut_window {
|
||||
EGLConfig config;
|
||||
EGLContext context;
|
||||
|
||||
/* initialized by native display */
|
||||
struct {
|
||||
union {
|
||||
EGLNativeWindowType window;
|
||||
EGLNativePixmapType pixmap;
|
||||
EGLSurface surface; /* pbuffer or screen surface */
|
||||
} u;
|
||||
int width, height;
|
||||
} native;
|
||||
|
||||
EGLSurface surface;
|
||||
|
||||
int index;
|
||||
|
||||
EGLUTreshapeCB reshape_cb;
|
||||
EGLUTdisplayCB display_cb;
|
||||
EGLUTkeyboardCB keyboard_cb;
|
||||
EGLUTspecialCB special_cb;
|
||||
};
|
||||
|
||||
struct eglut_state {
|
||||
int api_mask;
|
||||
int window_width, window_height;
|
||||
const char *display_name;
|
||||
int verbose;
|
||||
int init_time;
|
||||
|
||||
EGLUTidleCB idle_cb;
|
||||
|
||||
int num_windows;
|
||||
|
||||
/* initialized by native display */
|
||||
EGLNativeDisplayType native_dpy;
|
||||
EGLint surface_type;
|
||||
|
||||
EGLDisplay dpy;
|
||||
EGLint major, minor;
|
||||
|
||||
struct eglut_window *current;
|
||||
|
||||
int redisplay;
|
||||
};
|
||||
|
||||
extern struct eglut_state *_eglut;
|
||||
|
||||
void
|
||||
_eglutFatal(char *format, ...);
|
||||
|
||||
int
|
||||
_eglutNow(void);
|
||||
|
||||
void
|
||||
_eglutNativeInitDisplay(void);
|
||||
|
||||
void
|
||||
_eglutNativeFiniDisplay(void);
|
||||
|
||||
void
|
||||
_eglutNativeInitWindow(struct eglut_window *win, const char *title,
|
||||
int x, int y, int w, int h);
|
||||
|
||||
void
|
||||
_eglutNativeFiniWindow(struct eglut_window *win);
|
||||
|
||||
void
|
||||
_eglutNativeEventLoop(void);
|
||||
|
||||
#endif /* _EGLUTINT_H_ */
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
demo1
|
||||
demo2
|
||||
demo3
|
||||
eglgears
|
||||
eglgears_x11
|
||||
eglgears_screen
|
||||
eglinfo
|
||||
eglscreen
|
||||
egltri
|
||||
egltri_x11
|
||||
egltri_screen
|
||||
peglgears
|
||||
xeglbindtex
|
||||
xeglgears
|
||||
xeglthreads
|
||||
xegl_tri
|
||||
79
progs/egl/opengl/Makefile
Normal file
79
progs/egl/opengl/Makefile
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
# progs/egl/Makefile
|
||||
|
||||
TOP = ../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
|
||||
INCLUDE_DIRS = -I$(TOP)/include $(X11_CFLAGS)
|
||||
|
||||
HEADERS = $(TOP)/include/GLES/egl.h
|
||||
LIB_DEP = $(TOP)/$(LIB_DIR)/libEGL.so
|
||||
|
||||
LIBS = -L$(TOP)/$(LIB_DIR) -lEGL -lGL -lm
|
||||
|
||||
EGLUT_DIR = $(TOP)/progs/egl/eglut
|
||||
|
||||
EGLUT_DEMOS = \
|
||||
eglgears \
|
||||
egltri
|
||||
|
||||
EGLUT_X11_DEMOS := $(addsuffix _x11,$(EGLUT_DEMOS))
|
||||
EGLUT_SCREEN_DEMOS := $(addsuffix _screen,$(EGLUT_DEMOS))
|
||||
|
||||
PROGRAMS = \
|
||||
demo1 \
|
||||
demo2 \
|
||||
demo3 \
|
||||
eglinfo \
|
||||
eglscreen \
|
||||
peglgears \
|
||||
xeglgears \
|
||||
xeglthreads
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDE_DIRS) -I$(EGLUT_DIR) $(CFLAGS) $< -o $@
|
||||
|
||||
|
||||
|
||||
default: $(PROGRAMS) $(EGLUT_X11_DEMOS) $(EGLUT_SCREEN_DEMOS)
|
||||
|
||||
demo1: demo1.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
|
||||
|
||||
demo2: demo2.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
|
||||
|
||||
demo3: demo3.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
|
||||
|
||||
eglinfo: eglinfo.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
|
||||
|
||||
eglscreen: eglscreen.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB)
|
||||
|
||||
peglgears: peglgears.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(LIBDRM_LIB) -lm
|
||||
|
||||
xeglgears: xeglgears.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lm $(X11_LIBS)
|
||||
|
||||
xeglthreads: xeglthreads.o $(HEADERS) $(LIB_DEP)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) -lpthread -lm $(X11_LIBS)
|
||||
|
||||
# define the rules for EGLUT demos
|
||||
define eglut-demo-rule
|
||||
$(1)_x11 $(1)_screen: $(1)_%: $(1).o $(EGLUT_DIR)/libeglut-%.a $(LIB_DEP)
|
||||
endef
|
||||
$(foreach demo, $(EGLUT_DEMOS), $(eval $(call eglut-demo-rule,$(demo))))
|
||||
|
||||
# build EGLUT demos
|
||||
$(EGLUT_X11_DEMOS):
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L$(EGLUT_DIR) -leglut-$* $(LIBS) $(X11_LIBS)
|
||||
$(EGLUT_SCREEN_DEMOS):
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L$(EGLUT_DIR) -leglut-$* $(LIBS)
|
||||
|
||||
clean:
|
||||
-rm -f *.o *~
|
||||
-rm -f $(PROGRAMS) $(EGLUT_X11_DEMOS) $(EGLUT_SCREEN_DEMOS)
|
||||
|
|
@ -27,78 +27,16 @@
|
|||
* Program runs for 5 seconds then exits, outputing framerate to console
|
||||
*/
|
||||
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <GL/gl.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#define MAX_CONFIGS 10
|
||||
#define MAX_MODES 100
|
||||
|
||||
#define BENCHMARK
|
||||
|
||||
#ifdef BENCHMARK
|
||||
|
||||
/* XXX this probably isn't very portable */
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* return current time (in seconds) */
|
||||
static double
|
||||
current_time(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
#ifdef __VMS
|
||||
(void) gettimeofday(&tv, NULL );
|
||||
#else
|
||||
struct timezone tz;
|
||||
(void) gettimeofday(&tv, &tz);
|
||||
#endif
|
||||
return (double) tv.tv_sec + tv.tv_usec / 1000000.0;
|
||||
}
|
||||
|
||||
#else /*BENCHMARK*/
|
||||
|
||||
/* dummy */
|
||||
static double
|
||||
current_time(void)
|
||||
{
|
||||
/* update this function for other platforms! */
|
||||
static double t = 0.0;
|
||||
static int warn = 1;
|
||||
if (warn) {
|
||||
fprintf(stderr, "Warning: current_time() not implemented!!\n");
|
||||
warn = 0;
|
||||
}
|
||||
return t += 1.0;
|
||||
}
|
||||
|
||||
#endif /*BENCHMARK*/
|
||||
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265
|
||||
#endif
|
||||
|
||||
#include "eglut.h"
|
||||
|
||||
static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
|
||||
static GLint gear1, gear2, gear3;
|
||||
static GLfloat angle = 0.0;
|
||||
|
||||
#if 0
|
||||
static GLfloat eyesep = 5.0; /* Eye separation. */
|
||||
static GLfloat fix_point = 40.0; /* Fixation point distance. */
|
||||
static GLfloat left, right, asp; /* Stereo frustum params. */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Draw a gear wheel. You'll probably want to call this function when
|
||||
|
|
@ -270,6 +208,22 @@ draw(void)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
idle(void)
|
||||
{
|
||||
static double t0 = -1.;
|
||||
double dt, t = eglutGet(EGLUT_ELAPSED_TIME) / 1000.0;
|
||||
if (t0 < 0.0)
|
||||
t0 = t;
|
||||
dt = t - t0;
|
||||
t0 = t;
|
||||
|
||||
angle += 70.0 * dt; /* 70 degrees per second */
|
||||
angle = fmod(angle, 360.0); /* prevents eventual overflow */
|
||||
|
||||
eglutPostRedisplay();
|
||||
}
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
|
|
@ -325,158 +279,23 @@ init(void)
|
|||
glEnable(GL_NORMALIZE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void run_gears(EGLDisplay dpy, EGLSurface surf, int ttr)
|
||||
{
|
||||
double st = current_time();
|
||||
double ct = st;
|
||||
int frames = 0;
|
||||
GLfloat seconds, fps;
|
||||
|
||||
while (ct - st < ttr)
|
||||
{
|
||||
double tt = current_time();
|
||||
double dt = tt - ct;
|
||||
ct = tt;
|
||||
|
||||
/* advance rotation for next frame */
|
||||
angle += 70.0 * dt; /* 70 degrees per second */
|
||||
if (angle > 3600.0)
|
||||
angle -= 3600.0;
|
||||
|
||||
draw();
|
||||
|
||||
eglSwapBuffers(dpy, surf);
|
||||
|
||||
|
||||
frames++;
|
||||
}
|
||||
|
||||
seconds = ct - st;
|
||||
fps = frames / seconds;
|
||||
printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, fps);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int maj, min;
|
||||
EGLContext ctx;
|
||||
EGLSurface screen_surf;
|
||||
EGLConfig configs[MAX_CONFIGS];
|
||||
EGLint numConfigs, i;
|
||||
EGLBoolean b;
|
||||
EGLDisplay d;
|
||||
EGLint screenAttribs[10];
|
||||
EGLModeMESA mode[MAX_MODES];
|
||||
EGLScreenMESA screen;
|
||||
EGLint count;
|
||||
EGLint chosenMode = 0;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
EGLint width = 0, height = 0;
|
||||
|
||||
/* parse cmd line args */
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
if (strcmp(argv[i], "-info") == 0)
|
||||
{
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else
|
||||
printf("Warning: unknown parameter: %s\n", argv[i]);
|
||||
}
|
||||
|
||||
/* DBR : Create EGL context/surface etc */
|
||||
d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
assert(d);
|
||||
eglutInitWindowSize(300, 300);
|
||||
eglutInitAPIMask(EGLUT_OPENGL_BIT);
|
||||
eglutInit(argc, argv);
|
||||
|
||||
if (!eglInitialize(d, &maj, &min)) {
|
||||
printf("eglgears: eglInitialize failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("eglgears: EGL version = %d.%d\n", maj, min);
|
||||
printf("eglgears: EGL_VENDOR = %s\n", eglQueryString(d, EGL_VENDOR));
|
||||
|
||||
/* XXX use ChooseConfig */
|
||||
eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
|
||||
eglGetScreensMESA(d, &screen, 1, &count);
|
||||
eglutCreateWindow("eglgears");
|
||||
|
||||
if (!eglGetModesMESA(d, screen, mode, MAX_MODES, &count) || count == 0) {
|
||||
printf("eglgears: eglGetModesMESA failed!\n");
|
||||
return 0;
|
||||
}
|
||||
eglutIdleFunc(idle);
|
||||
eglutReshapeFunc(reshape);
|
||||
eglutDisplayFunc(draw);
|
||||
|
||||
/* Print list of modes, and find the one to use */
|
||||
printf("eglgears: Found %d modes:\n", count);
|
||||
for (i = 0; i < count; i++) {
|
||||
EGLint w, h;
|
||||
eglGetModeAttribMESA(d, mode[i], EGL_WIDTH, &w);
|
||||
eglGetModeAttribMESA(d, mode[i], EGL_HEIGHT, &h);
|
||||
printf("%3d: %d x %d\n", i, w, h);
|
||||
if (w > width && h > height) {
|
||||
width = w;
|
||||
height = h;
|
||||
chosenMode = i;
|
||||
}
|
||||
}
|
||||
printf("eglgears: Using screen mode/size %d: %d x %d\n", chosenMode, width, height);
|
||||
init();
|
||||
glDrawBuffer(GL_BACK);
|
||||
|
||||
eglutMainLoop();
|
||||
|
||||
eglBindAPI(EGL_OPENGL_API);
|
||||
ctx = eglCreateContext(d, configs[0], EGL_NO_CONTEXT, NULL);
|
||||
if (ctx == EGL_NO_CONTEXT) {
|
||||
printf("eglgears: failed to create context\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* build up screenAttribs array */
|
||||
i = 0;
|
||||
screenAttribs[i++] = EGL_WIDTH;
|
||||
screenAttribs[i++] = width;
|
||||
screenAttribs[i++] = EGL_HEIGHT;
|
||||
screenAttribs[i++] = height;
|
||||
screenAttribs[i++] = EGL_NONE;
|
||||
|
||||
screen_surf = eglCreateScreenSurfaceMESA(d, configs[0], screenAttribs);
|
||||
if (screen_surf == EGL_NO_SURFACE) {
|
||||
printf("eglgears: failed to create screen surface\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
b = eglShowScreenSurfaceMESA(d, screen, screen_surf, mode[chosenMode]);
|
||||
if (!b) {
|
||||
printf("eglgears: show surface failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
b = eglMakeCurrent(d, screen_surf, screen_surf, ctx);
|
||||
if (!b) {
|
||||
printf("eglgears: make current failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (printInfo)
|
||||
{
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
|
||||
init();
|
||||
reshape(width, height);
|
||||
|
||||
glDrawBuffer( GL_BACK );
|
||||
|
||||
run_gears(d, screen_surf, 5.0);
|
||||
|
||||
eglDestroySurface(d, screen_surf);
|
||||
eglDestroyContext(d, ctx);
|
||||
eglTerminate(d);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,21 +1,16 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Chia-I Wu <olv@0xlab.org>
|
||||
*
|
||||
* Based on egltri by
|
||||
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 2008 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 2008 Jakob Bornecrantz 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
|
||||
|
|
@ -24,45 +19,36 @@
|
|||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
/*
|
||||
* Draw a triangle with X/EGL.
|
||||
* Brian Paul
|
||||
* 3 June 2008
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <GLES/gl.h>
|
||||
#include "winsys.h"
|
||||
#include <GL/gl.h>
|
||||
|
||||
#include "eglut.h"
|
||||
|
||||
|
||||
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
|
||||
|
||||
static void tri_init()
|
||||
{
|
||||
glClearColor(0.4, 0.4, 0.4, 0.0);
|
||||
}
|
||||
|
||||
static void tri_reshape(int width, int height)
|
||||
{
|
||||
GLfloat ar = (GLfloat) width / (GLfloat) height;
|
||||
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -10.0);
|
||||
}
|
||||
|
||||
static void tri_draw(void *data)
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
static const GLfloat verts[3][2] = {
|
||||
{ -1, -1 },
|
||||
{ 1, -1 },
|
||||
{ 0, 1 }
|
||||
};
|
||||
static const GLfloat colors[3][4] = {
|
||||
{ 1, 0, 0, 1 },
|
||||
{ 0, 1, 0, 1 },
|
||||
{ 0, 0, 1, 1 }
|
||||
static const GLfloat colors[3][3] = {
|
||||
{ 1, 0, 0 },
|
||||
{ 0, 1, 0 },
|
||||
{ 0, 0, 1 }
|
||||
};
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
|
@ -74,7 +60,7 @@ static void tri_draw(void *data)
|
|||
|
||||
{
|
||||
glVertexPointer(2, GL_FLOAT, 0, verts);
|
||||
glColorPointer(4, GL_FLOAT, 0, colors);
|
||||
glColorPointer(3, GL_FLOAT, 0, colors);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
|
|
@ -87,43 +73,69 @@ static void tri_draw(void *data)
|
|||
glPopMatrix();
|
||||
}
|
||||
|
||||
static void tri_run(void)
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
winsysRun(3.0, tri_draw, NULL);
|
||||
GLfloat ar = (GLfloat) width / (GLfloat) height;
|
||||
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -10.0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
EGLint width, height;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
int i;
|
||||
glClearColor(0.4, 0.4, 0.4, 0.0);
|
||||
}
|
||||
|
||||
/* parse cmd line args */
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-info") == 0) {
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else {
|
||||
printf("Warning: unknown parameter: %s\n", argv[i]);
|
||||
}
|
||||
|
||||
static void
|
||||
special_key(int special)
|
||||
{
|
||||
switch (special) {
|
||||
case EGLUT_KEY_LEFT:
|
||||
view_roty += 5.0;
|
||||
break;
|
||||
case EGLUT_KEY_RIGHT:
|
||||
view_roty -= 5.0;
|
||||
break;
|
||||
case EGLUT_KEY_UP:
|
||||
view_rotx += 5.0;
|
||||
break;
|
||||
case EGLUT_KEY_DOWN:
|
||||
view_rotx -= 5.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!winsysInitScreen())
|
||||
exit(1);
|
||||
winsysQueryScreenSize(&width, &height);
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
eglutInitWindowSize(300, 300);
|
||||
eglutInitAPIMask(EGLUT_OPENGL_BIT);
|
||||
eglutInit(argc, argv);
|
||||
|
||||
if (printInfo) {
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
eglutCreateWindow("egltri");
|
||||
|
||||
tri_init();
|
||||
tri_reshape(width, height);
|
||||
tri_run();
|
||||
eglutReshapeFunc(reshape);
|
||||
eglutDisplayFunc(draw);
|
||||
eglutSpecialFunc(special_key);
|
||||
|
||||
winsysFiniScreen();
|
||||
init();
|
||||
|
||||
eglutMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
15
progs/egl/opengles1/.gitignore
vendored
Normal file
15
progs/egl/opengles1/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
bindtex
|
||||
drawtex_x11
|
||||
drawtex_screen
|
||||
es1_info
|
||||
gears_x11
|
||||
gears_screen
|
||||
msaa
|
||||
pbuffer
|
||||
render_tex
|
||||
texture_from_pixmap
|
||||
torus_x11
|
||||
torus_screen
|
||||
tri_x11
|
||||
tri_screen
|
||||
two_win
|
||||
99
progs/egl/opengles1/Makefile
Normal file
99
progs/egl/opengles1/Makefile
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
# progs/egl/opengles1/Makefile
|
||||
|
||||
TOP = ../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
|
||||
INCLUDE_DIRS = \
|
||||
-I$(TOP)/include \
|
||||
$(X11_CFLAGS)
|
||||
|
||||
HEADERS = $(TOP)/include/GLES/egl.h
|
||||
|
||||
|
||||
ES1_LIB_DEPS = \
|
||||
$(TOP)/$(LIB_DIR)/libEGL.so \
|
||||
$(TOP)/$(LIB_DIR)/libGLESv1_CM.so
|
||||
|
||||
|
||||
ES1_LIBS = \
|
||||
-L$(TOP)/$(LIB_DIR) -lEGL \
|
||||
-L$(TOP)/$(LIB_DIR) -lGLESv1_CM $(LIBDRM_LIB) $(X11_LIBS)
|
||||
|
||||
EGLUT_DIR = $(TOP)/progs/egl/eglut
|
||||
|
||||
EGLUT_DEMOS = \
|
||||
drawtex \
|
||||
gears \
|
||||
torus \
|
||||
tri
|
||||
|
||||
EGLUT_X11_DEMOS := $(addsuffix _x11,$(EGLUT_DEMOS))
|
||||
EGLUT_SCREEN_DEMOS := $(addsuffix _screen,$(EGLUT_DEMOS))
|
||||
|
||||
PROGRAMS = \
|
||||
bindtex \
|
||||
es1_info \
|
||||
msaa \
|
||||
pbuffer \
|
||||
render_tex \
|
||||
texture_from_pixmap \
|
||||
two_win
|
||||
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDE_DIRS) -I$(EGLUT_DIR) $(CFLAGS) $< -o $@
|
||||
|
||||
|
||||
|
||||
default: $(PROGRAMS) $(EGLUT_X11_DEMOS) $(EGLUT_SCREEN_DEMOS)
|
||||
|
||||
|
||||
|
||||
bindtex: bindtex.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) bindtex.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
es1_info: es1_info.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) es1_info.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
msaa: msaa.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) msaa.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
pbuffer: pbuffer.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) pbuffer.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
render_tex: render_tex.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) render_tex.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
texture_from_pixmap: texture_from_pixmap.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) texture_from_pixmap.o $(ES1_LIBS) -o $@
|
||||
|
||||
torus: torus.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) torus.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
two_win: two_win.o $(ES1_LIB_DEPS)
|
||||
$(CC) $(CFLAGS) two_win.o $(ES1_LIBS) -o $@
|
||||
|
||||
|
||||
# define the rules for EGLUT demos
|
||||
define eglut-demo-rule
|
||||
$(1)_x11 $(1)_screen: $(1)_%: $(1).o $(EGLUT_DIR)/libeglut-%.a $(ES1_LIB_DEPS)
|
||||
endef
|
||||
$(foreach demo, $(EGLUT_DEMOS), $(eval $(call eglut-demo-rule,$(demo))))
|
||||
|
||||
# build EGLUT demos
|
||||
$(EGLUT_X11_DEMOS):
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L$(EGLUT_DIR) -leglut-$* $(ES1_LIBS) $(X11_LIBS)
|
||||
$(EGLUT_SCREEN_DEMOS):
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L$(EGLUT_DIR) -leglut-$* $(ES1_LIBS)
|
||||
|
||||
|
||||
clean:
|
||||
-rm -f *.o *~
|
||||
-rm -f $(PROGRAMS) $(EGLUT_X11_DEMOS) $(EGLUT_SCREEN_DEMOS)
|
||||
217
progs/egl/opengles1/drawtex.c
Normal file
217
progs/egl/opengles1/drawtex.c
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
/*
|
||||
* Copyright (C) 2008 Tunsgten Graphics,Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Test GL_OES_draw_texture
|
||||
* Brian Paul
|
||||
* August 2008
|
||||
*/
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
|
||||
#include "eglut.h"
|
||||
|
||||
|
||||
static GLfloat view_posx = 10.0, view_posy = 20.0;
|
||||
static GLfloat width = 200, height = 200;
|
||||
static GLboolean animate = GL_FALSE;
|
||||
static int win;
|
||||
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glDrawTexfOES(view_posx, view_posy, 0.0, width, height);
|
||||
}
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
GLfloat ar = (GLfloat) width / (GLfloat) height;
|
||||
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
|
||||
#ifdef GL_VERSION_ES_CM_1_0
|
||||
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
#else
|
||||
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
#endif
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -15.0);
|
||||
}
|
||||
|
||||
|
||||
static float
|
||||
dist(GLuint i, GLuint j, float x, float y)
|
||||
{
|
||||
return sqrt((i-x) * (i-x) + (j-y) * (j-y));
|
||||
}
|
||||
|
||||
static void
|
||||
make_smile_texture(void)
|
||||
{
|
||||
#define SZ 128
|
||||
GLenum Filter = GL_LINEAR;
|
||||
GLubyte image[SZ][SZ][4];
|
||||
GLuint i, j;
|
||||
GLint cropRect[4];
|
||||
|
||||
for (i = 0; i < SZ; i++) {
|
||||
for (j = 0; j < SZ; j++) {
|
||||
GLfloat d_mouth = dist(i, j, SZ/2, SZ/2);
|
||||
GLfloat d_rt_eye = dist(i, j, SZ*3/4, SZ*3/4);
|
||||
GLfloat d_lt_eye = dist(i, j, SZ*3/4, SZ*1/4);
|
||||
if (d_rt_eye < SZ / 8 || d_lt_eye < SZ / 8) {
|
||||
image[i][j][0] = 20;
|
||||
image[i][j][1] = 50;
|
||||
image[i][j][2] = 255;
|
||||
image[i][j][3] = 255;
|
||||
}
|
||||
else if (i < SZ/2 && d_mouth < SZ/3) {
|
||||
image[i][j][0] = 255;
|
||||
image[i][j][1] = 20;
|
||||
image[i][j][2] = 20;
|
||||
image[i][j][3] = 255;
|
||||
}
|
||||
else {
|
||||
image[i][j][0] = 200;
|
||||
image[i][j][1] = 200;
|
||||
image[i][j][2] = 200;
|
||||
image[i][j][3] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE0); /* unit 0 */
|
||||
glBindTexture(GL_TEXTURE_2D, 42);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, SZ, SZ, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, image);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, Filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, Filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
|
||||
cropRect[0] = 0;
|
||||
cropRect[1] = 0;
|
||||
cropRect[2] = SZ;
|
||||
cropRect[3] = SZ;
|
||||
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect);
|
||||
#undef SZ
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
const char *ext = (char *) glGetString(GL_EXTENSIONS);
|
||||
|
||||
if (!strstr(ext, "GL_OES_draw_texture")) {
|
||||
fprintf(stderr, "Sorry, this program requires GL_OES_draw_texture");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
glClearColor(0.4, 0.4, 0.4, 0.0);
|
||||
|
||||
make_smile_texture();
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
idle(void)
|
||||
{
|
||||
if (animate) {
|
||||
view_posx += 1.0;
|
||||
view_posy += 2.0;
|
||||
eglutPostRedisplay();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
key(unsigned char key)
|
||||
{
|
||||
switch (key) {
|
||||
case ' ':
|
||||
animate = !animate;
|
||||
break;
|
||||
case 'w':
|
||||
width -= 1.0f;
|
||||
break;
|
||||
case 'W':
|
||||
width += 1.0f;
|
||||
break;
|
||||
case 'h':
|
||||
height -= 1.0f;
|
||||
break;
|
||||
case 'H':
|
||||
height += 1.0f;
|
||||
break;
|
||||
case 27:
|
||||
eglutDestroyWindow(win);
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
special_key(int key)
|
||||
{
|
||||
switch (key) {
|
||||
case EGLUT_KEY_LEFT:
|
||||
view_posx -= 1.0;
|
||||
break;
|
||||
case EGLUT_KEY_RIGHT:
|
||||
view_posx += 1.0;
|
||||
break;
|
||||
case EGLUT_KEY_UP:
|
||||
view_posy += 1.0;
|
||||
break;
|
||||
case EGLUT_KEY_DOWN:
|
||||
view_posy -= 1.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
eglutInitWindowSize(400, 300);
|
||||
eglutInitAPIMask(EGLUT_OPENGL_ES1_BIT);
|
||||
eglutInit(argc, argv);
|
||||
|
||||
win = eglutCreateWindow("drawtex");
|
||||
|
||||
eglutIdleFunc(idle);
|
||||
eglutReshapeFunc(reshape);
|
||||
eglutDisplayFunc(draw);
|
||||
eglutKeyboardFunc(key);
|
||||
eglutSpecialFunc(special_key);
|
||||
|
||||
init();
|
||||
|
||||
eglutMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
#include <assert.h>
|
||||
|
||||
#include <GLES/gl.h>
|
||||
#include "winsys.h"
|
||||
#include "eglut.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265
|
||||
|
|
@ -247,7 +247,7 @@ draw_gear(const struct gear *gear)
|
|||
|
||||
|
||||
static void
|
||||
gears_draw(void *data)
|
||||
gears_draw(void)
|
||||
{
|
||||
static const GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
|
||||
static const GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
|
||||
|
|
@ -288,11 +288,6 @@ gears_draw(void *data)
|
|||
glPopMatrix();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
/* advance rotation for next frame */
|
||||
angle += 0.5; /* 0.5 degree per frame */
|
||||
if (angle > 3600.0)
|
||||
angle -= 3600.0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -348,27 +343,41 @@ gears_reshape(int width, int height)
|
|||
}
|
||||
|
||||
|
||||
static void gears_run(void)
|
||||
static void
|
||||
gears_idle(void)
|
||||
{
|
||||
winsysRun(5.0, gears_draw, NULL);
|
||||
static double t0 = -1.;
|
||||
double dt, t = eglutGet(EGLUT_ELAPSED_TIME) / 1000.0;
|
||||
if (t0 < 0.0)
|
||||
t0 = t;
|
||||
dt = t - t0;
|
||||
t0 = t;
|
||||
|
||||
angle += 70.0 * dt; /* 70 degrees per second */
|
||||
angle = fmod(angle, 360.0); /* prevents eventual overflow */
|
||||
|
||||
eglutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
EGLint width, height;
|
||||
eglutInitWindowSize(300, 300);
|
||||
eglutInitAPIMask(EGLUT_OPENGL_ES1_BIT);
|
||||
eglutInit(argc, argv);
|
||||
|
||||
if (!winsysInitScreen())
|
||||
exit(1);
|
||||
winsysQueryScreenSize(&width, &height);
|
||||
eglutCreateWindow("gears");
|
||||
|
||||
eglutIdleFunc(gears_idle);
|
||||
eglutReshapeFunc(gears_reshape);
|
||||
eglutDisplayFunc(gears_draw);
|
||||
|
||||
gears_init();
|
||||
gears_reshape(width, height);
|
||||
gears_run();
|
||||
gears_fini();
|
||||
|
||||
winsysFiniScreen();
|
||||
eglutMainLoop();
|
||||
|
||||
gears_fini();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -168,6 +168,8 @@ draw_both(EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
|
|||
glReadPixels(0, 0, WinWidth, WinHeight, GL_RGBA, GL_UNSIGNED_BYTE, wbuf);
|
||||
printf("Window[%d,%d] = 0x%08x\n", x, y, wbuf[y*WinWidth+x]);
|
||||
|
||||
eglSwapBuffers(egl_dpy, egl_surf);
|
||||
|
||||
/* then draw to pbuffer */
|
||||
if (!eglMakeCurrent(egl_dpy, egl_pbuf, egl_pbuf, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent(pbuffer) failed\n");
|
||||
|
|
@ -177,7 +179,6 @@ draw_both(EGLDisplay egl_dpy, EGLSurface egl_surf, EGLSurface egl_pbuf,
|
|||
glReadPixels(0, 0, WinWidth, WinHeight, GL_RGBA, GL_UNSIGNED_BYTE, pbuf);
|
||||
printf("Pbuffer[%d,%d] = 0x%08x\n", x, y, pbuf[y*WinWidth+x]);
|
||||
|
||||
eglSwapBuffers(egl_dpy, egl_surf);
|
||||
|
||||
/* compare renderings */
|
||||
for (dif = i = 0; i < WinWidth * WinHeight; i++) {
|
||||
579
progs/egl/opengles1/texture_from_pixmap.c
Normal file
579
progs/egl/opengles1/texture_from_pixmap.c
Normal file
|
|
@ -0,0 +1,579 @@
|
|||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 7.9
|
||||
*
|
||||
* Copyright (C) 2010 LunarG Inc.
|
||||
*
|
||||
* 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
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
|
||||
*
|
||||
* Authors:
|
||||
* Chia-I Wu <olv@lunarg.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
* This demo uses EGL_KHR_image_pixmap and GL_OES_EGL_image to demonstrate
|
||||
* texture-from-pixmap.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h> /* for usleep */
|
||||
#include <sys/time.h> /* for gettimeofday */
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
struct app_data {
|
||||
/* native */
|
||||
Display *xdpy;
|
||||
Window canvas, cube;
|
||||
Pixmap pix;
|
||||
unsigned int width, height, depth;
|
||||
GC fg, bg;
|
||||
|
||||
/* EGL */
|
||||
EGLDisplay dpy;
|
||||
EGLContext ctx;
|
||||
EGLSurface surf;
|
||||
EGLImageKHR img;
|
||||
|
||||
/* OpenGL ES */
|
||||
GLuint texture;
|
||||
|
||||
PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
|
||||
PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
|
||||
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
|
||||
|
||||
/* app state */
|
||||
Bool loop;
|
||||
Bool redraw, reshape;
|
||||
|
||||
struct {
|
||||
Bool active;
|
||||
unsigned long next_frame; /* in ms */
|
||||
float view_rotx;
|
||||
float view_roty;
|
||||
float view_rotz;
|
||||
|
||||
} animate;
|
||||
|
||||
struct {
|
||||
Bool active;
|
||||
int x1, y1;
|
||||
int x2, y2;
|
||||
} paint;
|
||||
};
|
||||
|
||||
static void
|
||||
gl_redraw(void)
|
||||
{
|
||||
const GLfloat verts[4][2] = {
|
||||
{ -1, -1 },
|
||||
{ 1, -1 },
|
||||
{ 1, 1 },
|
||||
{ -1, 1 }
|
||||
};
|
||||
const GLfloat texcoords[4][2] = {
|
||||
{ 0, 1 },
|
||||
{ 1, 1 },
|
||||
{ 1, 0 },
|
||||
{ 0, 0 }
|
||||
};
|
||||
const GLfloat faces[6][4] = {
|
||||
{ 0, 0, 1, 0 },
|
||||
{ 90, 0, 1, 0 },
|
||||
{ 180, 0, 1, 0 },
|
||||
{ 270, 0, 1, 0 },
|
||||
{ 90, 1, 0, 0 },
|
||||
{ -90, 1, 0, 0 }
|
||||
};
|
||||
GLint i;
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glVertexPointer(2, GL_FLOAT, 0, verts);
|
||||
glTexCoordPointer(2, GL_FLOAT, 0, texcoords);
|
||||
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
glPushMatrix();
|
||||
glRotatef(faces[i][0], faces[i][1], faces[i][2], faces[i][3]);
|
||||
glTranslatef(0, 0, 1.0);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
}
|
||||
|
||||
static void
|
||||
gl_reshape(int width, int height)
|
||||
{
|
||||
GLfloat ar = (GLfloat) width / (GLfloat) height;
|
||||
|
||||
glViewport(0, 0, width, height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -10.0);
|
||||
}
|
||||
|
||||
static void
|
||||
app_redraw(struct app_data *data)
|
||||
{
|
||||
/* pixmap has changed */
|
||||
if (data->reshape || data->paint.active) {
|
||||
eglWaitNative(EGL_CORE_NATIVE_ENGINE);
|
||||
|
||||
if (data->reshape) {
|
||||
data->glEGLImageTargetTexture2DOES(GL_TEXTURE_2D,
|
||||
(GLeglImageOES) data->img);
|
||||
}
|
||||
}
|
||||
|
||||
XCopyArea(data->xdpy, data->pix, data->canvas, data->fg,
|
||||
0, 0, data->width, data->height, 0, 0);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(data->animate.view_rotx, 1, 0, 0);
|
||||
glRotatef(data->animate.view_roty, 0, 1, 0);
|
||||
glRotatef(data->animate.view_rotz, 0, 0, 1);
|
||||
gl_redraw();
|
||||
glPopMatrix();
|
||||
|
||||
eglSwapBuffers(data->dpy, data->surf);
|
||||
}
|
||||
|
||||
static void
|
||||
app_reshape(struct app_data *data)
|
||||
{
|
||||
const EGLint img_attribs[] = {
|
||||
EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
XResizeWindow(data->xdpy, data->cube, data->width, data->height);
|
||||
XMoveWindow(data->xdpy, data->cube, data->width, 0);
|
||||
|
||||
if (data->img)
|
||||
data->eglDestroyImageKHR(data->dpy, data->img);
|
||||
if (data->pix)
|
||||
XFreePixmap(data->xdpy, data->pix);
|
||||
|
||||
data->pix = XCreatePixmap(data->xdpy, data->canvas, data->width, data->height, data->depth);
|
||||
XFillRectangle(data->xdpy, data->pix, data->bg, 0, 0, data->width, data->height);
|
||||
|
||||
data->img = data->eglCreateImageKHR(data->dpy, EGL_NO_CONTEXT,
|
||||
EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer) data->pix, img_attribs);
|
||||
|
||||
gl_reshape(data->width, data->height);
|
||||
}
|
||||
|
||||
static void
|
||||
app_toggle_animate(struct app_data *data)
|
||||
{
|
||||
data->animate.active = !data->animate.active;
|
||||
|
||||
if (data->animate.active) {
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
data->animate.next_frame = tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
app_next_event(struct app_data *data)
|
||||
{
|
||||
XEvent event;
|
||||
|
||||
data->reshape = False;
|
||||
data->redraw = False;
|
||||
data->paint.active = False;
|
||||
|
||||
if (data->animate.active) {
|
||||
struct timeval tv;
|
||||
unsigned long now;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
now = tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
|
||||
/* wait for next frame */
|
||||
if (!XPending(data->xdpy) && now < data->animate.next_frame) {
|
||||
usleep((data->animate.next_frame - now) * 1000);
|
||||
gettimeofday(&tv, NULL);
|
||||
now = tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
}
|
||||
|
||||
while (now >= data->animate.next_frame) {
|
||||
data->animate.view_rotx += 1.0;
|
||||
data->animate.view_roty += 2.0;
|
||||
data->animate.view_rotz += 1.5;
|
||||
|
||||
/* 30fps */
|
||||
data->animate.next_frame += 1000 / 30;
|
||||
}
|
||||
|
||||
/* check again in case there were events when sleeping */
|
||||
if (!XPending(data->xdpy)) {
|
||||
data->redraw = True;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
XNextEvent(data->xdpy, &event);
|
||||
|
||||
switch (event.type) {
|
||||
case ConfigureNotify:
|
||||
data->width = event.xconfigure.width / 2;
|
||||
data->height = event.xconfigure.height;
|
||||
data->reshape = True;
|
||||
break;
|
||||
case Expose:
|
||||
data->redraw = True;
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
int code;
|
||||
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
switch (code) {
|
||||
case XK_a:
|
||||
app_toggle_animate(data);
|
||||
break;
|
||||
case XK_Escape:
|
||||
data->loop = False;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ButtonPress:
|
||||
data->paint.x1 = data->paint.x2 = event.xbutton.x;
|
||||
data->paint.y1 = data->paint.y2 = event.xbutton.y;
|
||||
break;
|
||||
case ButtonRelease:
|
||||
data->paint.active = False;
|
||||
break;
|
||||
case MotionNotify:
|
||||
data->paint.x1 = data->paint.x2;
|
||||
data->paint.y1 = data->paint.y2;
|
||||
data->paint.x2 = event.xmotion.x;
|
||||
data->paint.y2 = event.xmotion.y;
|
||||
data->paint.active = True;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (data->paint.active || data->reshape)
|
||||
data->redraw = True;
|
||||
}
|
||||
|
||||
static void
|
||||
app_init_gl(struct app_data *data)
|
||||
{
|
||||
glClearColor(0.1, 0.1, 0.3, 0.0);
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
glGenTextures(1, &data->texture);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, data->texture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
static Bool
|
||||
app_init_exts(struct app_data *data)
|
||||
{
|
||||
const char *exts;
|
||||
|
||||
exts = eglQueryString(data->dpy, EGL_EXTENSIONS);
|
||||
data->eglCreateImageKHR =
|
||||
(PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR");
|
||||
data->eglDestroyImageKHR =
|
||||
(PFNEGLDESTROYIMAGEKHRPROC) eglGetProcAddress("eglDestroyImageKHR");
|
||||
if (!exts || !strstr(exts, "EGL_KHR_image_pixmap") ||
|
||||
!data->eglCreateImageKHR || !data->eglDestroyImageKHR) {
|
||||
printf("EGL does not support EGL_KHR_image_pixmap\n");
|
||||
return False;
|
||||
}
|
||||
|
||||
exts = (const char *) glGetString(GL_EXTENSIONS);
|
||||
data->glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)
|
||||
eglGetProcAddress("glEGLImageTargetTexture2DOES");
|
||||
if (!exts || !strstr(exts, "GL_OES_EGL_image") ||
|
||||
!data->glEGLImageTargetTexture2DOES) {
|
||||
printf("OpenGL ES does not support GL_OES_EGL_image\n");
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static void
|
||||
app_run(struct app_data *data)
|
||||
{
|
||||
Window root;
|
||||
int x, y;
|
||||
unsigned int border;
|
||||
|
||||
if (!eglMakeCurrent(data->dpy, data->surf, data->surf, data->ctx))
|
||||
return;
|
||||
|
||||
if (!app_init_exts(data))
|
||||
return;
|
||||
|
||||
printf("Draw something on the left with the mouse!\n");
|
||||
|
||||
app_init_gl(data);
|
||||
|
||||
if (!XGetGeometry(data->xdpy, data->canvas, &root, &x, &y,
|
||||
&data->width, &data->height, &border, &data->depth))
|
||||
return;
|
||||
data->width /= 2;
|
||||
|
||||
app_reshape(data);
|
||||
|
||||
XMapWindow(data->xdpy, data->canvas);
|
||||
XMapWindow(data->xdpy, data->cube);
|
||||
|
||||
app_toggle_animate(data);
|
||||
data->loop = True;
|
||||
|
||||
while (data->loop) {
|
||||
app_next_event(data);
|
||||
|
||||
if (data->reshape)
|
||||
app_reshape(data);
|
||||
if (data->paint.active) {
|
||||
XDrawLine(data->xdpy, data->pix, data->fg,
|
||||
data->paint.x1, data->paint.y1,
|
||||
data->paint.x2, data->paint.y2);
|
||||
}
|
||||
|
||||
if (data->redraw)
|
||||
app_redraw(data);
|
||||
}
|
||||
|
||||
eglMakeCurrent(data->dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
}
|
||||
|
||||
static Bool
|
||||
make_x_window(struct app_data *data, const char *name,
|
||||
int x, int y, int width, int height)
|
||||
{
|
||||
static const EGLint attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_DEPTH_SIZE, 1,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
|
||||
EGL_NONE
|
||||
};
|
||||
static const EGLint ctx_attribs[] = {
|
||||
EGL_CONTEXT_CLIENT_VERSION, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
Window win;
|
||||
XVisualInfo *visInfo, visTemplate;
|
||||
int num_visuals;
|
||||
EGLConfig config;
|
||||
EGLint num_configs;
|
||||
EGLint vid;
|
||||
|
||||
scrnum = DefaultScreen( data->xdpy );
|
||||
root = RootWindow( data->xdpy, scrnum );
|
||||
|
||||
if (!eglChooseConfig( data->dpy, attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL visual config\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
assert(config);
|
||||
assert(num_configs > 0);
|
||||
|
||||
if (!eglGetConfigAttrib(data->dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
||||
printf("Error: eglGetConfigAttrib() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
visInfo = XGetVisualInfo(data->xdpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!visInfo) {
|
||||
printf("Error: couldn't get X visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( data->xdpy, root, visInfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask |
|
||||
KeyPressMask | ButtonPressMask | ButtonMotionMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow( data->xdpy, root, 0, 0, width * 2, height,
|
||||
0, visInfo->depth, InputOutput,
|
||||
visInfo->visual, mask, &attr );
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(data->xdpy, win, &sizehints);
|
||||
XSetStandardProperties(data->xdpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
data->canvas = win;
|
||||
|
||||
attr.event_mask = 0x0;
|
||||
win = XCreateWindow( data->xdpy, win, width, 0, width, height,
|
||||
0, visInfo->depth, InputOutput,
|
||||
visInfo->visual, mask, &attr );
|
||||
data->cube = win;
|
||||
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
data->ctx = eglCreateContext(data->dpy, config, EGL_NO_CONTEXT, ctx_attribs );
|
||||
if (!data->ctx) {
|
||||
printf("Error: eglCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
data->surf = eglCreateWindowSurface(data->dpy, config, data->cube, NULL);
|
||||
if (!data->surf) {
|
||||
printf("Error: eglCreateWindowSurface failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
XFree(visInfo);
|
||||
|
||||
return (data->canvas && data->cube && data->ctx && data->surf);
|
||||
}
|
||||
|
||||
static void
|
||||
app_fini(struct app_data *data)
|
||||
{
|
||||
if (data->img)
|
||||
data->eglDestroyImageKHR(data->dpy, data->img);
|
||||
if (data->pix)
|
||||
XFreePixmap(data->xdpy, data->pix);
|
||||
|
||||
if (data->fg)
|
||||
XFreeGC(data->xdpy, data->fg);
|
||||
if (data->bg)
|
||||
XFreeGC(data->xdpy, data->bg);
|
||||
|
||||
if (data->surf)
|
||||
eglDestroySurface(data->dpy, data->surf);
|
||||
if (data->ctx)
|
||||
eglDestroyContext(data->dpy, data->ctx);
|
||||
|
||||
if (data->cube)
|
||||
XDestroyWindow(data->xdpy, data->cube);
|
||||
if (data->canvas)
|
||||
XDestroyWindow(data->xdpy, data->canvas);
|
||||
|
||||
if (data->dpy)
|
||||
eglTerminate(data->dpy);
|
||||
if (data->xdpy)
|
||||
XCloseDisplay(data->xdpy);
|
||||
}
|
||||
|
||||
static Bool
|
||||
app_init(struct app_data *data, int argc, char **argv)
|
||||
{
|
||||
XGCValues gc_vals;
|
||||
|
||||
memset(data, 0, sizeof(*data));
|
||||
|
||||
data->xdpy = XOpenDisplay(NULL);
|
||||
if (!data->xdpy)
|
||||
goto fail;
|
||||
|
||||
data->dpy = eglGetDisplay(data->xdpy);
|
||||
if (!data->dpy || !eglInitialize(data->dpy, NULL, NULL))
|
||||
goto fail;
|
||||
|
||||
if (!make_x_window(data, "EGLImage TFP", 0, 0, 300, 300))
|
||||
goto fail;
|
||||
|
||||
gc_vals.function = GXcopy;
|
||||
gc_vals.foreground = WhitePixel(data->xdpy, DefaultScreen(data->xdpy));
|
||||
gc_vals.line_width = 3;
|
||||
gc_vals.line_style = LineSolid;
|
||||
gc_vals.fill_style = FillSolid;
|
||||
|
||||
data->fg = XCreateGC(data->xdpy, data->canvas,
|
||||
GCFunction | GCForeground | GCLineWidth | GCLineStyle | GCFillStyle,
|
||||
&gc_vals);
|
||||
gc_vals.foreground = BlackPixel(data->xdpy, DefaultScreen(data->xdpy));
|
||||
data->bg = XCreateGC(data->xdpy, data->canvas,
|
||||
GCFunction | GCForeground | GCLineWidth | GCLineStyle | GCFillStyle,
|
||||
&gc_vals);
|
||||
if (!data->fg || !data->bg)
|
||||
goto fail;
|
||||
|
||||
return True;
|
||||
|
||||
fail:
|
||||
app_fini(data);
|
||||
return False;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
struct app_data data;
|
||||
|
||||
if (app_init(&data, argc, argv)) {
|
||||
app_run(&data);
|
||||
app_fini(&data);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -13,14 +13,9 @@
|
|||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <GLES/gl.h>
|
||||
#include <GLES/glext.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#include "eglut.h"
|
||||
|
||||
static const struct {
|
||||
GLenum internalFormat;
|
||||
|
|
@ -43,6 +38,8 @@ static const struct {
|
|||
|
||||
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
|
||||
static GLint tex_format = NUM_CPAL_FORMATS;
|
||||
static GLboolean animate = GL_TRUE;
|
||||
static int win;
|
||||
|
||||
|
||||
static void
|
||||
|
|
@ -364,293 +361,88 @@ init(void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create an RGB, double-buffered X window.
|
||||
* Return the window and context handles.
|
||||
*/
|
||||
static void
|
||||
make_x_window(Display *x_dpy, EGLDisplay egl_dpy,
|
||||
const char *name,
|
||||
int x, int y, int width, int height,
|
||||
Window *winRet,
|
||||
EGLContext *ctxRet,
|
||||
EGLSurface *surfRet)
|
||||
idle(void)
|
||||
{
|
||||
static const EGLint attribs[] = {
|
||||
EGL_RED_SIZE, 1,
|
||||
EGL_GREEN_SIZE, 1,
|
||||
EGL_BLUE_SIZE, 1,
|
||||
EGL_DEPTH_SIZE, 1,
|
||||
EGL_NONE
|
||||
};
|
||||
|
||||
int scrnum;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
Window root;
|
||||
Window win;
|
||||
XVisualInfo *visInfo, visTemplate;
|
||||
int num_visuals;
|
||||
EGLContext ctx;
|
||||
EGLConfig config;
|
||||
EGLint num_configs;
|
||||
EGLint vid;
|
||||
|
||||
scrnum = DefaultScreen( x_dpy );
|
||||
root = RootWindow( x_dpy, scrnum );
|
||||
|
||||
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs)) {
|
||||
printf("Error: couldn't get an EGL visual config\n");
|
||||
exit(1);
|
||||
if (animate) {
|
||||
view_rotx += 1.0;
|
||||
view_roty += 2.0;
|
||||
eglutPostRedisplay();
|
||||
}
|
||||
|
||||
assert(config);
|
||||
assert(num_configs > 0);
|
||||
|
||||
if (!eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
||||
printf("Error: eglGetConfigAttrib() failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* The X window visual must match the EGL config */
|
||||
visTemplate.visualid = vid;
|
||||
visInfo = XGetVisualInfo(x_dpy, VisualIDMask, &visTemplate, &num_visuals);
|
||||
if (!visInfo) {
|
||||
printf("Error: couldn't get X visual\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* window attributes */
|
||||
attr.background_pixel = 0;
|
||||
attr.border_pixel = 0;
|
||||
attr.colormap = XCreateColormap( x_dpy, root, visInfo->visual, AllocNone);
|
||||
attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
|
||||
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
|
||||
|
||||
win = XCreateWindow( x_dpy, root, 0, 0, width, height,
|
||||
0, visInfo->depth, InputOutput,
|
||||
visInfo->visual, mask, &attr );
|
||||
|
||||
/* set hints and properties */
|
||||
{
|
||||
XSizeHints sizehints;
|
||||
sizehints.x = x;
|
||||
sizehints.y = y;
|
||||
sizehints.width = width;
|
||||
sizehints.height = height;
|
||||
sizehints.flags = USSize | USPosition;
|
||||
XSetNormalHints(x_dpy, win, &sizehints);
|
||||
XSetStandardProperties(x_dpy, win, name, name,
|
||||
None, (char **)NULL, 0, &sizehints);
|
||||
}
|
||||
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, NULL );
|
||||
if (!ctx) {
|
||||
printf("Error: eglCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
*surfRet = eglCreateWindowSurface(egl_dpy, config, win, NULL);
|
||||
|
||||
if (!*surfRet) {
|
||||
printf("Error: eglCreateWindowSurface failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
XFree(visInfo);
|
||||
|
||||
*winRet = win;
|
||||
*ctxRet = ctx;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
event_loop(Display *dpy, Window win,
|
||||
EGLDisplay egl_dpy, EGLSurface egl_surf)
|
||||
key(unsigned char key)
|
||||
{
|
||||
int anim = 1;
|
||||
|
||||
while (1) {
|
||||
int redraw = 0;
|
||||
|
||||
if (!anim || XPending(dpy)) {
|
||||
XEvent event;
|
||||
XNextEvent(dpy, &event);
|
||||
|
||||
switch (event.type) {
|
||||
case Expose:
|
||||
redraw = 1;
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
reshape(event.xconfigure.width, event.xconfigure.height);
|
||||
break;
|
||||
case KeyPress:
|
||||
{
|
||||
char buffer[10];
|
||||
int r, code;
|
||||
code = XLookupKeysym(&event.xkey, 0);
|
||||
if (code == XK_Left) {
|
||||
view_roty += 5.0;
|
||||
}
|
||||
else if (code == XK_Right) {
|
||||
view_roty -= 5.0;
|
||||
}
|
||||
else if (code == XK_Up) {
|
||||
view_rotx += 5.0;
|
||||
}
|
||||
else if (code == XK_Down) {
|
||||
view_rotx -= 5.0;
|
||||
}
|
||||
else if (code == XK_t) {
|
||||
GLint size;
|
||||
tex_format = (tex_format + 1) % (NUM_CPAL_FORMATS + 1);
|
||||
if (tex_format < NUM_CPAL_FORMATS) {
|
||||
size = make_cpal_texture(tex_format);
|
||||
printf("Using %s (%d bytes)\n",
|
||||
cpal_formats[tex_format].name, size);
|
||||
}
|
||||
else {
|
||||
size = make_texture();
|
||||
printf("Using uncompressed texture (%d bytes)\n", size);
|
||||
}
|
||||
}
|
||||
else {
|
||||
r = XLookupString(&event.xkey, buffer, sizeof(buffer),
|
||||
NULL, NULL);
|
||||
if (buffer[0] == ' ') {
|
||||
anim = !anim;
|
||||
}
|
||||
else if (buffer[0] == 27) {
|
||||
/* escape */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
redraw = 1;
|
||||
break;
|
||||
default:
|
||||
; /*no-op*/
|
||||
switch (key) {
|
||||
case ' ':
|
||||
animate = !animate;
|
||||
break;
|
||||
case 't':
|
||||
{
|
||||
GLint size;
|
||||
tex_format = (tex_format + 1) % (NUM_CPAL_FORMATS + 1);
|
||||
if (tex_format < NUM_CPAL_FORMATS) {
|
||||
size = make_cpal_texture(tex_format);
|
||||
printf("Using %s (%d bytes)\n",
|
||||
cpal_formats[tex_format].name, size);
|
||||
}
|
||||
else {
|
||||
size = make_texture();
|
||||
printf("Using uncompressed texture (%d bytes)\n", size);
|
||||
}
|
||||
}
|
||||
|
||||
if (anim) {
|
||||
view_rotx += 1.0;
|
||||
view_roty += 2.0;
|
||||
redraw = 1;
|
||||
}
|
||||
|
||||
if (redraw) {
|
||||
draw();
|
||||
eglSwapBuffers(egl_dpy, egl_surf);
|
||||
eglutPostRedisplay();
|
||||
}
|
||||
break;
|
||||
case 27:
|
||||
eglutDestroyWindow(win);
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
special_key(int key)
|
||||
{
|
||||
printf("Usage:\n");
|
||||
printf(" -display <displayname> set the display to run on\n");
|
||||
printf(" -info display OpenGL renderer info\n");
|
||||
switch (key) {
|
||||
case EGLUT_KEY_LEFT:
|
||||
view_roty += 5.0;
|
||||
break;
|
||||
case EGLUT_KEY_RIGHT:
|
||||
view_roty -= 5.0;
|
||||
break;
|
||||
case EGLUT_KEY_UP:
|
||||
view_rotx += 5.0;
|
||||
break;
|
||||
case EGLUT_KEY_DOWN:
|
||||
view_rotx -= 5.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const int winWidth = 300, winHeight = 300;
|
||||
Display *x_dpy;
|
||||
Window win;
|
||||
EGLSurface egl_surf;
|
||||
EGLContext egl_ctx;
|
||||
EGLDisplay egl_dpy;
|
||||
char *dpyName = NULL;
|
||||
GLboolean printInfo = GL_FALSE;
|
||||
EGLint egl_major, egl_minor;
|
||||
int i;
|
||||
const char *s;
|
||||
eglutInitWindowSize(300, 300);
|
||||
eglutInitAPIMask(EGLUT_OPENGL_ES1_BIT);
|
||||
eglutInit(argc, argv);
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-display") == 0) {
|
||||
dpyName = argv[i+1];
|
||||
i++;
|
||||
}
|
||||
else if (strcmp(argv[i], "-info") == 0) {
|
||||
printInfo = GL_TRUE;
|
||||
}
|
||||
else {
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
win = eglutCreateWindow("torus");
|
||||
|
||||
x_dpy = XOpenDisplay(dpyName);
|
||||
if (!x_dpy) {
|
||||
printf("Error: couldn't open display %s\n",
|
||||
dpyName ? dpyName : getenv("DISPLAY"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
egl_dpy = eglGetDisplay(x_dpy);
|
||||
if (!egl_dpy) {
|
||||
printf("Error: eglGetDisplay() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor)) {
|
||||
printf("Error: eglInitialize() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VERSION);
|
||||
printf("EGL_VERSION = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_VENDOR);
|
||||
printf("EGL_VENDOR = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
|
||||
printf("EGL_EXTENSIONS = %s\n", s);
|
||||
|
||||
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
|
||||
printf("EGL_CLIENT_APIS = %s\n", s);
|
||||
|
||||
make_x_window(x_dpy, egl_dpy,
|
||||
"torus", 0, 0, winWidth, winHeight,
|
||||
&win, &egl_ctx, &egl_surf);
|
||||
|
||||
XMapWindow(x_dpy, win);
|
||||
if (!eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx)) {
|
||||
printf("Error: eglMakeCurrent() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (printInfo) {
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
|
||||
printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
|
||||
printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
|
||||
}
|
||||
eglutIdleFunc(idle);
|
||||
eglutReshapeFunc(reshape);
|
||||
eglutDisplayFunc(draw);
|
||||
eglutKeyboardFunc(key);
|
||||
eglutSpecialFunc(special_key);
|
||||
|
||||
init();
|
||||
|
||||
/* Set initial projection/viewing transformation.
|
||||
* We can't be sure we'll get a ConfigureNotify event when the window
|
||||
* first appears.
|
||||
*/
|
||||
reshape(winWidth, winHeight);
|
||||
|
||||
event_loop(x_dpy, win, egl_dpy, egl_surf);
|
||||
|
||||
eglDestroyContext(egl_dpy, egl_ctx);
|
||||
eglDestroySurface(egl_dpy, egl_surf);
|
||||
eglTerminate(egl_dpy);
|
||||
|
||||
|
||||
XDestroyWindow(x_dpy, win);
|
||||
XCloseDisplay(x_dpy);
|
||||
eglutMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
211
progs/egl/opengles1/tri.c
Normal file
211
progs/egl/opengles1/tri.c
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
/*
|
||||
* Copyright (C) 2008 Brian Paul All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Draw a triangle with X/EGL and OpenGL ES 1.x
|
||||
* Brian Paul
|
||||
* 5 June 2008
|
||||
*/
|
||||
|
||||
#define USE_FIXED_POINT 0
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <GLES/gl.h> /* use OpenGL ES 1.x */
|
||||
#include <GLES/glext.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#include "eglut.h"
|
||||
|
||||
|
||||
#define FLOAT_TO_FIXED(X) ((X) * 65535.0)
|
||||
|
||||
|
||||
|
||||
static GLfloat view_rotx = 0.0, view_roty = 0.0, view_rotz = 0.0;
|
||||
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
#if USE_FIXED_POINT
|
||||
static const GLfixed verts[3][2] = {
|
||||
{ -65536, -65536 },
|
||||
{ 65536, -65536 },
|
||||
{ 0, 65536 }
|
||||
};
|
||||
static const GLfixed colors[3][4] = {
|
||||
{ 65536, 0, 0, 65536 },
|
||||
{ 0, 65536, 0 , 65536},
|
||||
{ 0, 0, 65536 , 65536}
|
||||
};
|
||||
#else
|
||||
static const GLfloat verts[3][2] = {
|
||||
{ -1, -1 },
|
||||
{ 1, -1 },
|
||||
{ 0, 1 }
|
||||
};
|
||||
static const GLfloat colors[3][4] = {
|
||||
{ 1, 0, 0, 1 },
|
||||
{ 0, 1, 0, 1 },
|
||||
{ 0, 0, 1, 1 }
|
||||
};
|
||||
#endif
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(view_rotx, 1, 0, 0);
|
||||
glRotatef(view_roty, 0, 1, 0);
|
||||
glRotatef(view_rotz, 0, 0, 1);
|
||||
|
||||
{
|
||||
#if USE_FIXED_POINT
|
||||
glVertexPointer(2, GL_FIXED, 0, verts);
|
||||
glColorPointer(4, GL_FIXED, 0, colors);
|
||||
#else
|
||||
glVertexPointer(2, GL_FLOAT, 0, verts);
|
||||
glColorPointer(4, GL_FLOAT, 0, colors);
|
||||
#endif
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_COLOR_ARRAY);
|
||||
|
||||
/* draw triangle */
|
||||
glDrawArrays(GL_TRIANGLES, 0, 3);
|
||||
|
||||
/* draw some points */
|
||||
glPointSizex(FLOAT_TO_FIXED(15.5));
|
||||
glDrawArrays(GL_POINTS, 0, 3);
|
||||
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
if (0) {
|
||||
/* test code */
|
||||
GLfixed size;
|
||||
glGetFixedv(GL_POINT_SIZE, &size);
|
||||
printf("GL_POINT_SIZE = 0x%x %f\n", size, size / 65536.0);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int width, int height)
|
||||
{
|
||||
GLfloat ar = (GLfloat) width / (GLfloat) height;
|
||||
|
||||
glViewport(0, 0, (GLint) width, (GLint) height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
#ifdef GL_VERSION_ES_CM_1_0
|
||||
glFrustumf(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
#else
|
||||
glFrustum(-ar, ar, -1, 1, 5.0, 60.0);
|
||||
#endif
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -10.0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
test_query_matrix(void)
|
||||
{
|
||||
PFNGLQUERYMATRIXXOESPROC procQueryMatrixx;
|
||||
typedef void (*voidproc)();
|
||||
GLfixed mantissa[16];
|
||||
GLint exponent[16];
|
||||
GLbitfield rv;
|
||||
int i;
|
||||
|
||||
procQueryMatrixx = (PFNGLQUERYMATRIXXOESPROC) eglGetProcAddress("glQueryMatrixxOES");
|
||||
assert(procQueryMatrixx);
|
||||
/* Actually try out this one */
|
||||
rv = (*procQueryMatrixx)(mantissa, exponent);
|
||||
for (i = 0; i < 16; i++) {
|
||||
if (rv & (1<<i)) {
|
||||
printf("matrix[%d] invalid\n", i);
|
||||
}
|
||||
else {
|
||||
printf("matrix[%d] = %f * 2^(%d)\n", i, mantissa[i]/65536.0, exponent[i]);
|
||||
}
|
||||
}
|
||||
assert(!eglGetProcAddress("glFoo"));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
glClearColor(0.4, 0.4, 0.4, 0.0);
|
||||
|
||||
if (0)
|
||||
test_query_matrix();
|
||||
}
|
||||
|
||||
static void
|
||||
special_key(int special)
|
||||
{
|
||||
switch (special) {
|
||||
case EGLUT_KEY_LEFT:
|
||||
view_roty += 5.0;
|
||||
break;
|
||||
case EGLUT_KEY_RIGHT:
|
||||
view_roty -= 5.0;
|
||||
break;
|
||||
case EGLUT_KEY_UP:
|
||||
view_rotx += 5.0;
|
||||
break;
|
||||
case EGLUT_KEY_DOWN:
|
||||
view_rotx -= 5.0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
eglutInitWindowSize(300, 300);
|
||||
eglutInitAPIMask(EGLUT_OPENGL_ES1_BIT);
|
||||
eglutInit(argc, argv);
|
||||
|
||||
eglutCreateWindow("tri");
|
||||
|
||||
eglutReshapeFunc(reshape);
|
||||
eglutDisplayFunc(draw);
|
||||
eglutSpecialFunc(special_key);
|
||||
|
||||
init();
|
||||
|
||||
eglutMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
3
progs/egl/opengles2/.gitignore
vendored
Normal file
3
progs/egl/opengles2/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
es2_info.c
|
||||
es2_info
|
||||
tri
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# progs/es2/xegl/Makefile
|
||||
# progs/egl/opengles2/Makefile
|
||||
|
||||
TOP = ../../..
|
||||
include $(TOP)/configs/current
|
||||
|
|
@ -6,6 +6,7 @@ include $(TOP)/configs/current
|
|||
|
||||
INCLUDE_DIRS = \
|
||||
-I$(TOP)/include \
|
||||
$(X11_CFLAGS)
|
||||
|
||||
HEADERS = $(TOP)/include/GLES/egl.h
|
||||
|
||||
|
|
@ -17,7 +18,7 @@ ES2_LIB_DEPS = \
|
|||
|
||||
ES2_LIBS = \
|
||||
-L$(TOP)/$(LIB_DIR) -lEGL \
|
||||
-L$(TOP)/$(LIB_DIR) -lGLESv2 $(LIBDRM_LIB) -lX11
|
||||
-L$(TOP)/$(LIB_DIR) -lGLESv2 $(LIBDRM_LIB) $(X11_LIBS)
|
||||
|
||||
PROGRAMS = \
|
||||
es2_info \
|
||||
|
|
@ -33,7 +34,7 @@ default: $(PROGRAMS)
|
|||
|
||||
|
||||
|
||||
es2_info.c: ../../es1/xegl/es1_info.c
|
||||
es2_info.c: ../opengles1/es1_info.c
|
||||
cp -f $^ $@
|
||||
|
||||
es2_info: es2_info.o $(ES2_LIB_DEPS)
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
demos/lion
|
||||
demos/sp
|
||||
lion_x11
|
||||
lion_screen
|
||||
sp_x11
|
||||
sp_screen
|
||||
trivial/arc
|
||||
trivial/cap
|
||||
trivial/clear
|
||||
51
progs/egl/openvg/Makefile
Normal file
51
progs/egl/openvg/Makefile
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# progs/egl/openvg/Makefile
|
||||
|
||||
TOP = ../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
VG_LIBS=-lm -lEGL -lOpenVG -L$(TOP)/lib -L$(TOP)/lib/gallium
|
||||
INCLUDE_DIRS = -I$(TOP)/include $(X11_CFLAGS)
|
||||
|
||||
EGLUT_DIR = $(TOP)/progs/egl/eglut
|
||||
|
||||
EGLUT_DEMOS = \
|
||||
sp
|
||||
|
||||
EGLUT_X11_DEMOS := $(addsuffix _x11,$(EGLUT_DEMOS))
|
||||
EGLUT_SCREEN_DEMOS := $(addsuffix _screen,$(EGLUT_DEMOS))
|
||||
|
||||
PROGRAMS = \
|
||||
lion_x11 \
|
||||
lion_screen
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(INCLUDE_DIRS) -I$(EGLUT_DIR) $(CFLAGS) $< -o $@
|
||||
|
||||
|
||||
|
||||
default: $(PROGRAMS) $(EGLUT_X11_DEMOS) $(EGLUT_SCREEN_DEMOS)
|
||||
|
||||
lion_x11: lion.o lion-render.o $(EGLUT_DIR)/libeglut-x11.a
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ lion.o lion-render.o \
|
||||
-L$(EGLUT_DIR) -leglut-x11 $(VG_LIBS) $(X11_LIBS)
|
||||
|
||||
lion_screen: lion.o lion-render.o $(EGLUT_DIR)/libeglut-screen.a
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ lion.o lion-render.o \
|
||||
-L$(EGLUT_DIR) -leglut-screen $(VG_LIBS)
|
||||
|
||||
|
||||
# define the rules for EGLUT demos
|
||||
define eglut-demo-rule
|
||||
$(1)_x11 $(1)_screen: $(1)_%: $(1).o $(EGLUT_DIR)/libeglut-%.a
|
||||
endef
|
||||
$(foreach demo, $(EGLUT_DEMOS), $(eval $(call eglut-demo-rule,$(demo))))
|
||||
|
||||
# build EGLUT demos
|
||||
$(EGLUT_X11_DEMOS):
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L$(EGLUT_DIR) -leglut-$* $(VG_LIBS) $(X11_LIBS)
|
||||
$(EGLUT_SCREEN_DEMOS):
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -L$(EGLUT_DIR) -leglut-$* $(VG_LIBS)
|
||||
|
||||
clean:
|
||||
rm -f *.o *~
|
||||
rm -f $(EGLUT_X11_DEMOS) $(EGLUT_SCREEN_DEMOS)
|
||||
65
progs/egl/openvg/lion.c
Normal file
65
progs/egl/openvg/lion.c
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
#include <VG/openvg.h>
|
||||
#include <EGL/egl.h>
|
||||
|
||||
#include "lion-render.h"
|
||||
#include "eglut.h"
|
||||
|
||||
static VGint width, height;
|
||||
struct lion *lion = 0;
|
||||
VGfloat angle = 0;
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
vgClear(0, 0, width, height);
|
||||
|
||||
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
|
||||
vgLoadIdentity();
|
||||
vgTranslate(width/2, height/2);
|
||||
vgRotate(angle);
|
||||
vgTranslate(-width/2, -height/2);
|
||||
|
||||
lion_render(lion);
|
||||
|
||||
++angle;
|
||||
eglutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
/* new window size or exposure */
|
||||
static void
|
||||
reshape(int w, int h)
|
||||
{
|
||||
width = w;
|
||||
height = h;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
init(void)
|
||||
{
|
||||
float clear_color[4] = {1.0, 1.0, 1.0, 1.0};
|
||||
vgSetfv(VG_CLEAR_COLOR, 4, clear_color);
|
||||
|
||||
lion = lion_create();
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
eglutInitWindowSize(350, 450);
|
||||
eglutInitAPIMask(EGLUT_OPENVG_BIT);
|
||||
eglutInit(argc, argv);
|
||||
|
||||
eglutCreateWindow("Lion Example");
|
||||
|
||||
eglutReshapeFunc(reshape);
|
||||
eglutDisplayFunc(draw);
|
||||
|
||||
init();
|
||||
|
||||
eglutMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,13 +1,9 @@
|
|||
#include "eglcommon.h"
|
||||
|
||||
#include <VG/openvg.h>
|
||||
#include <VG/vgu.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <X11/keysym.h>
|
||||
#include "eglut.h"
|
||||
|
||||
#define ELEMENTS(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
|
|
@ -475,36 +471,13 @@ reshape(int w, int h)
|
|||
{
|
||||
}
|
||||
|
||||
static int
|
||||
key_press(unsigned key)
|
||||
{
|
||||
switch(key) {
|
||||
case XK_Right:
|
||||
|
||||
break;
|
||||
case XK_Left:
|
||||
break;
|
||||
case XK_Up:
|
||||
break;
|
||||
case XK_Down:
|
||||
break;
|
||||
case 'a':
|
||||
break;
|
||||
case 's':
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return VG_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
draw(void)
|
||||
{
|
||||
VGint i;
|
||||
VGfloat save_matrix[9];
|
||||
|
||||
vgClear(0, 0, window_width(), window_height());
|
||||
vgClear(0, 0, eglutGetWindowWidth(), eglutGetWindowHeight());
|
||||
|
||||
vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
|
||||
vgLoadIdentity();
|
||||
|
|
@ -532,6 +505,18 @@ draw(void)
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
set_window_size(400, 400);
|
||||
return run(argc, argv, init, reshape, draw, key_press);
|
||||
eglutInitWindowSize(400, 400);
|
||||
eglutInitAPIMask(EGLUT_OPENVG_BIT);
|
||||
eglutInit(argc, argv);
|
||||
|
||||
eglutCreateWindow("sp");
|
||||
|
||||
eglutReshapeFunc(reshape);
|
||||
eglutDisplayFunc(draw);
|
||||
|
||||
init();
|
||||
|
||||
eglutMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
# progs/egl/openvg/trivial/Makefile
|
||||
# These programs aren't intended to be included with the normal distro.
|
||||
# They're not too interesting but they're good for testing.
|
||||
|
||||
TOP = ../../../
|
||||
TOP = ../../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
INCLUDES = -I. -I$(TOP)/include
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue