aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/build.xml176
-rwxr-xr-xmake/gl-common-es1.cfg7
-rwxr-xr-xmake/gl-common-es2.cfg7
-rw-r--r--make/gl-common.cfg95
-rwxr-xr-xmake/gl-desktop.cfg101
-rwxr-xr-xmake/gl-es1.cfg39
-rwxr-xr-xmake/gl-es2.cfg38
-rw-r--r--make/gl-impl-CustomCCode.c4
-rwxr-xr-xmake/gl-impl-CustomJavaCode-gles1.java301
-rwxr-xr-xmake/gl-impl-CustomJavaCode-gles2.java290
-rw-r--r--make/gl-macosx.cfg1
-rw-r--r--make/gl-win32.cfg1
-rw-r--r--make/gl-x11.cfg1
-rwxr-xr-xmake/glu-CustomJavaCode-gles1.java480
-rwxr-xr-xmake/glu-CustomJavaCode-gles2.java38
-rw-r--r--make/glu-common.cfg75
-rwxr-xr-xmake/glu-desktop.cfg53
-rwxr-xr-xmake/glu-es1.cfg15
-rwxr-xr-xmake/glu-macosx.cfg2
-rwxr-xr-xmake/glu-win32.cfg3
-rwxr-xr-xmake/glu-x11.cfg2
-rwxr-xr-xmake/stub_includes/common/gles1.c9
-rwxr-xr-xmake/stub_includes/common/gles2.c8
-rwxr-xr-xmake/stub_includes/opengl/GLES/gl.h801
-rwxr-xr-xmake/stub_includes/opengl/GLES/glext.h662
-rwxr-xr-xmake/stub_includes/opengl/GLES/glplatform.h74
-rwxr-xr-xmake/stub_includes/opengl/GLES/glu.h1
-rwxr-xr-xmake/stub_includes/opengl/GLES2/gl2.h677
-rwxr-xr-xmake/stub_includes/opengl/GLES2/gl2ext.h248
-rwxr-xr-xsrc/classes/com/sun/javafx/audio/windows/waveout/Audio.java66
-rwxr-xr-xsrc/classes/com/sun/javafx/audio/windows/waveout/Mixer.java362
-rwxr-xr-xsrc/classes/com/sun/javafx/audio/windows/waveout/SoundBuffer.java124
-rwxr-xr-xsrc/classes/com/sun/javafx/audio/windows/waveout/TestSpatialization.java86
-rwxr-xr-xsrc/classes/com/sun/javafx/audio/windows/waveout/Track.java206
-rwxr-xr-xsrc/classes/com/sun/javafx/audio/windows/waveout/Vec3f.java212
-rw-r--r--src/classes/com/sun/opengl/impl/FunctionAvailabilityCache.java15
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/GLBufferSizeTracker.java6
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/GLBufferStateTracker.java20
-rw-r--r--src/classes/com/sun/opengl/impl/GLContextImpl.java37
-rw-r--r--src/classes/com/sun/opengl/impl/GLContextShareSet.java260
-rw-r--r--src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java6
-rw-r--r--src/classes/com/sun/opengl/impl/NativeLibLoader.java7
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/ProjectES1.java1033
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/egl/EGLContext.java90
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/egl/EGLDrawable.java39
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java259
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/egl/EGLExternalContext.java88
-rw-r--r--src/classes/com/sun/opengl/impl/windows/WindowsDummyGLDrawable.java3
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java3
-rw-r--r--src/classes/com/sun/opengl/impl/windows/WindowsGLContext.java10
-rwxr-xr-xsrc/classes/com/sun/opengl/util/BufferUtil.java315
-rw-r--r--src/classes/javax/media/opengl/GLAutoDrawable.java2
-rw-r--r--src/classes/javax/media/opengl/GLDrawableFactory.java8
-rwxr-xr-xsrc/classes/javax/media/opengl/Threading.java18
-rwxr-xr-xsrc/native/jogl/EGLDrawableFactory.c319
-rwxr-xr-xsrc/native/jogl/Mixer.cpp199
56 files changed, 7455 insertions, 547 deletions
diff --git a/make/build.xml b/make/build.xml
index 5e7bd006f..7119ce631 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -66,6 +66,27 @@
- Base initialization and detection of operating system.
-->
<target name="base.init" depends="gluegen.cpptasks.detect.os">
+ <condition property="isGLES">
+ <or>
+ <isset property="jogl.es1" />
+ <isset property="jogl.es2" />
+ </or>
+ </condition>
+
+ <!-- Also set isCDCFP for the GlueGen build.xml to keep GL
+ references there to a minimum -->
+ <condition property="isCDCFP">
+ <isset property="isGLES" />
+ </condition>
+
+ <condition property="isGLES1">
+ <isset property="jogl.es1" />
+ </condition>
+
+ <condition property="isGLES2">
+ <isset property="jogl.es2" />
+ </condition>
+
<!-- Set the project root directory to be up one directory. -->
<property name="project.root" value=".." />
@@ -115,7 +136,27 @@
<!--
- Declare all paths and user defined variables.
-->
- <target name="declare.common" description="Declare properties" depends="setup.java.home.dir, gluegen.cpptasks.detect.compiler">
+ <target name="declare.gl.gles1" if="isGLES1">
+ <property name="gl.headers" value="${stub.includes.dir}/opengl/GLES/*.h" /> <!-- NOTE: this MUST be relative for FileSet --> <!-- CHECK: this may need to be pruned for each platform -->
+ <property name="java.excludes.gles" value="javax/media/opengl/AWTGraphicsConfiguration.java, javax/media/opengl/AWTGraphicsDevice.java, javax/media/opengl/ComponentEvents.java, javax/media/opengl/GLCanvas.java, javax/media/opengl/GLJPanel.java, com/sun/opengl/util/j2d/**, com/sun/opengl/util/texture/**, com/sun/opengl/util/Animator.java, com/sun/opengl/util/FPSAnimator.java, com/sun/opengl/util/*Rec.java, com/sun/opengl/util/GLUT*.java, com/sun/opengl/util/Gamma.java, com/sun/opengl/util/ImageUtil.java, com/sun/opengl/util/JOGLAppletLauncher.java, com/sun/opengl/util/Screenshot.java, com/sun/opengl/util/TGAWriter.java, com/sun/opengl/util/TileRenderer.java, com/sun/opengl/impl/GLObjectTracker.java, com/sun/opengl/impl/GLPbufferImpl.java, com/sun/opengl/impl/GLUquadricImpl.java, com/sun/opengl/impl/Java2D.java, com/sun/opengl/impl/Java2DGLContext.java, com/sun/opengl/impl/JAWT_PlatformInfo.java, com/sun/opengl/impl/Project.java, com/sun/opengl/impl/Util.java, com/sun/opengl/impl/error/**, com/sun/opengl/impl/glue/**, com/sun/opengl/impl/mipmap/**, com/sun/opengl/impl/nurbs/**, com/sun/opengl/impl/packrect/**, com/sun/opengl/impl/registry/**, com/sun/opengl/impl/tessellator/**, com/sun/opengl/impl/windows/**, com/sun/opengl/impl/x11/**, com/sun/opengl/impl/macosx/**" />
+ </target>
+
+ <target name="declare.gl.gles2" if="isGLES2">
+ <property name="gl.headers" value="${stub.includes.dir}/opengl/GLES2/*.h" /> <!-- NOTE: this MUST be relative for FileSet --> <!-- CHECK: this may need to be pruned for each platform -->
+ <property name="java.excludes.gles" value="javax/media/opengl/AWTGraphicsConfiguration.java, javax/media/opengl/AWTGraphicsDevice.java, javax/media/opengl/ComponentEvents.java, javax/media/opengl/GLCanvas.java, javax/media/opengl/GLJPanel.java, com/sun/opengl/util/j2d/**, com/sun/opengl/util/texture/**, com/sun/opengl/util/Animator.java, com/sun/opengl/util/FPSAnimator.java, com/sun/opengl/util/*Rec.java, com/sun/opengl/util/GLUT*.java, com/sun/opengl/util/Gamma.java, com/sun/opengl/util/ImageUtil.java, com/sun/opengl/util/JOGLAppletLauncher.java, com/sun/opengl/util/Screenshot.java, com/sun/opengl/util/TGAWriter.java, com/sun/opengl/util/TileRenderer.java, com/sun/opengl/impl/GLObjectTracker.java, com/sun/opengl/impl/GLPbufferImpl.java, com/sun/opengl/impl/GLUquadricImpl.java, com/sun/opengl/impl/Java2D.java, com/sun/opengl/impl/Java2DGLContext.java, com/sun/opengl/impl/JAWT_PlatformInfo.java, com/sun/opengl/impl/Project.java, com/sun/opengl/impl/ProjectES1.java, com/sun/opengl/impl/Util.java, com/sun/opengl/impl/error/**, com/sun/opengl/impl/glue/**, com/sun/opengl/impl/mipmap/**, com/sun/opengl/impl/nurbs/**, com/sun/opengl/impl/packrect/**, com/sun/opengl/impl/registry/**, com/sun/opengl/impl/tessellator/**, com/sun/opengl/impl/windows/**, com/sun/opengl/impl/x11/**, com/sun/opengl/impl/macosx/**" />
+ </target>
+
+ <target name="declare.gl.gles" if="isGLES" depends="declare.gl.gles1, declare.gl.gles2">
+ <!-- Use the CDC / FP classes only if we're building for the embedded system -->
+ <property name="javac.bootclasspath.jar" value="../../gluegen/make/lib/cdc_fp.jar" />
+ </target>
+
+ <target name="declare.gl.desktop" unless="isGLES">
+ <property name="gl.headers" value="${stub.includes.dir}/opengl/GL/*.h" /> <!-- NOTE: this MUST be relative for FileSet --> <!-- CHECK: this may need to be pruned for each platform -->
+ <property name="java.excludes.gles" value="com/sun/opengl/impl/egl/**, com/sun/opengl/impl/ProjectES1.java" />
+ </target>
+
+ <target name="declare.common" description="Declare properties" depends="setup.java.home.dir, gluegen.cpptasks.detect.compiler, declare.gl.gles, declare.gl.desktop">
<!-- The location and name of the configuration ANT file that will
- validate to ensure that all user-define variables are set. -->
<property name="validate.user.properties" value="${make}/validate-properties.xml" />
@@ -230,12 +271,13 @@
<property name="java.lib.dir.solaris" value="${java.home.dir}/jre/lib/${cpu}" />
<property name="java.lib.dir.macosx" value="/System/Library/Frameworks/JavaVM.framework/Libraries" />
- <property name="gl.headers" value="${stub.includes.dir}/opengl/**/*.h" /> <!-- NOTE: this MUST be relative for FileSet --> <!-- CHECK: this may need to be pruned for each platform -->
<!-- Java files to exclude based on platform (relative to "src.java") -->
- <property name="java.excludes.win32" value="com/sun/opengl/impl/x11/**, com/sun/opengl/impl/macosx/**" />
- <property name="java.excludes.x11" value="com/sun/opengl/impl/windows/**, com/sun/opengl/impl/macosx/**" />
- <property name="java.excludes.macosx" value="com/sun/opengl/impl/x11/**, com/sun/opengl/impl/windows/**" />
+ <!-- NOTE: the OpenGL ES exclusions are due to references to unsupported APIs -->
+ <property name="java.excludes.win32.gles" value="com/sun/opengl/impl/windows/*.java" />
+ <property name="java.excludes.win32" value="com/sun/opengl/impl/x11/**, com/sun/opengl/impl/macosx/**, ${java.excludes.gles}, ${java.excludes.win32.gles}" />
+ <property name="java.excludes.x11" value="com/sun/opengl/impl/windows/**, com/sun/opengl/impl/macosx/**, ${java.excludes.gles}" />
+ <property name="java.excludes.macosx" value="com/sun/opengl/impl/x11/**, com/sun/opengl/impl/windows/**, ${java.excludes.gles}" />
<!-- Create the classpath that includes GlueGen and
- ANTLR. This requires the user-defined "antlr.jar"
@@ -306,12 +348,29 @@
<property name="linker.cfg.id.core" value="linker.cfg.win32.mingw.jogl" />
</target>
- <target name="declare.win32" depends="declare.win32.vc6,declare.win32.vc7,declare.win32.vc8,declare.win32.vc8_x64,declare.win32.mingw" if="isWindows">
- <!-- Set platform configuration files. -->
+ <target name="declare.win32.gles1" if="isGLES1">
+ <property name="gl.cfg" value="${config}/gl-es1.cfg" />
+ <property name="gl.c" value="${stub.includes.common}/gles1.c" />
+ <property name="glu.cfg" value="${config}/glu-es1.cfg" />
+ </target>
+
+ <target name="declare.win32.gles2" if="isGLES2">
+ <property name="gl.cfg" value="${config}/gl-es2.cfg" />
+ <property name="gl.c" value="${stub.includes.common}/gles2.c" />
+ </target>
+
+ <target name="declare.win32.gles" depends="declare.win32.gles1, declare.win32.gles2" />
+
+ <target name="declare.win32.desktop" unless="isGLES">
<property name="gl.cfg" value="${config}/gl-win32.cfg" />
+ <property name="gl.c" value="${stub.includes.common}/gl.c" />
+ <property name="glu.cfg" value="${config}/glu-win32.cfg" />
+ </target>
+
+ <target name="declare.win32" depends="declare.win32.vc6,declare.win32.vc7,declare.win32.vc8,declare.win32.vc8_x64,declare.win32.mingw,declare.win32.gles,declare.win32.desktop" if="isWindows">
+ <!-- Set platform configuration files. -->
<property name="gl.cfg.nsig" value="${config}/gl-win32-nsig.cfg" />
<property name="glext.platform.cfg" value="${config}/wglext.cfg" />
- <property name="glu.cfg" value="${config}/glu-win32.cfg" />
<property name="jawt.cfg" value="${config}/jawt-win32.cfg" />
<property name="window.cfg" value="${config}/wingdi-win32.cfg" />
@@ -488,6 +547,7 @@
<propertyset>
<propertyref name="antlr.jar" />
<propertyref name="gluegen.nsig" />
+ <propertyref name="isCDCFP" />
</propertyset>
</ant>
</target>
@@ -520,7 +580,7 @@
<target name="java.generate.gl" unless="gluegen.nsig">
<!-- Generate GL interface and implementation -->
<echo message="Generating GL interface and implementation" />
- <gluegen src="${stub.includes.common}/gl.c"
+ <gluegen src="${gl.c}"
config="${gl.cfg}"
includeRefid="stub.includes.fileset.all"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -531,7 +591,7 @@
<target name="java.generate.gl.nsig" if="gluegen.nsig">
<!-- Generate GL interface and implementation -->
<echo message="Generating GL interface and implementation" />
- <gluegen src="${stub.includes.common}/gl.c"
+ <gluegen src="${gl.c}"
config="${gl.cfg.nsig}"
includeRefid="stub.includes.fileset.all"
emitter="com.sun.gluegen.nativesig.NativeSignatureEmitter">
@@ -539,25 +599,18 @@
</gluegen>
</target>
- <!--
- - Setup the generating ANT tasks and use it to generate the Java files
- - from the C GL headers. This involves setting the taskdef and creating
- - the classpath reference id then running the task on each header.
- -->
- <target name="java.generate" depends="build.gluegen, java.generate.check" unless="java.generate.skip">
- <!-- Add the GlueGen and BuildStaticGLInfo tasks to ANT -->
- <taskdef name="gluegen" classname="com.sun.gluegen.ant.GlueGenTask"
- classpathref="gluegen.classpath" />
- <taskdef name="staticglgen" classname="com.sun.gluegen.ant.StaticGLGenTask"
- classpathref="gluegen.classpath" />
-
- <!-- Use the GlueGen and BuildStaticGLInfo tasks to generate the
- - Java files -->
+ <target name="java.generate.glu" unless="isGLES2">
+ <echo message="Generating GLU class" />
+ <gluegen src="${stub.includes.common}/glu.c"
+ config="${glu.cfg}"
+ includeRefid="stub.includes.fileset.all"
+ emitter="com.sun.gluegen.opengl.GLEmitter">
+ <classpath refid="gluegen.classpath" />
+ </gluegen>
+ </target>
- <!-- Generate GL interface and implementation -->
- <antcall target="java.generate.gl" inheritRefs="true" />
- <antcall target="java.generate.gl.nsig" inheritRefs="true" />
+ <target name="java.generate.platform.glext" unless="isGLES">
<!-- Generate platform-specific extension class (WGLExt, GLXExt, etc.) -->
<echo message="Generating platform-specific OpenGL extension class" />
<gluegen src="${glext.platform.header}"
@@ -566,7 +619,9 @@
emitter="com.sun.gluegen.opengl.GLEmitter">
<classpath refid="gluegen.classpath" />
</gluegen>
+ </target>
+ <target name="java.generate.window.system" unless="isGLES">
<!-- Generate WGL/GLX/CGL implementation class -->
<echo message="Generating WGL/GLX/CGL implementation class" />
<dirset id="stub.includes.fileset.platform" dir="." includes="${stub.includes.fileset.platform.params}" />
@@ -576,8 +631,9 @@
emitter="com.sun.gluegen.opengl.GLEmitter">
<classpath refid="gluegen.classpath" />
</gluegen>
+ </target>
- <!-- Generate JAWT class -->
+ <target name="java.generate.jawt" unless="isGLES">
<!-- NOTE: the "literalInclude" in this GlueGen call is simply to
- get around the fact that neither FileSet nor DirSet can
- handle different drives in an effective manner. -->
@@ -590,6 +646,35 @@
emitter="com.sun.gluegen.JavaEmitter">
<classpath refid="gluegen.classpath" />
</gluegen>
+ </target>
+
+ <!--
+ - Setup the generating ANT tasks and use it to generate the Java files
+ - from the C GL headers. This involves setting the taskdef and creating
+ - the classpath reference id then running the task on each header.
+ -->
+ <target name="java.generate" depends="build.gluegen, java.generate.check" unless="java.generate.skip">
+ <!-- Add the GlueGen and BuildStaticGLInfo tasks to ANT -->
+ <taskdef name="gluegen" classname="com.sun.gluegen.ant.GlueGenTask"
+ classpathref="gluegen.classpath" />
+ <taskdef name="staticglgen" classname="com.sun.gluegen.ant.StaticGLGenTask"
+ classpathref="gluegen.classpath" />
+
+ <!-- Use the GlueGen and BuildStaticGLInfo tasks to generate the
+ - Java files -->
+
+ <!-- Generate GL interface and implementation -->
+ <antcall target="java.generate.gl" inheritRefs="true" />
+ <antcall target="java.generate.gl.nsig" inheritRefs="true" />
+
+ <!-- Generate platform-specific extension class (WGLExt, GLXExt, etc.) -->
+ <antcall target="java.generate.platform.glext" inheritRefs="true" />
+
+ <!-- Generate WGL/GLX/CGL implementation class -->
+ <antcall target="java.generate.window.system" inheritRefs="true" />
+
+ <!-- Generate JAWT class -->
+ <antcall target="java.generate.jawt" inheritRefs="true" />
<!-- Generate StaticGLInfo class -->
<echo message="Generating StaticGLInfo class" />
@@ -599,14 +684,11 @@
<classpath refid="gluegen.classpath" />
</staticglgen>
- <!-- Generate GLU class -->
- <echo message="Generating GLU class" />
- <gluegen src="${stub.includes.common}/glu.c"
- config="${glu.cfg}"
- includeRefid="stub.includes.fileset.all"
- emitter="com.sun.gluegen.opengl.GLEmitter">
- <classpath refid="gluegen.classpath" />
- </gluegen>
+ <!-- Generate GLU class -->
+ <!-- NOTE: massively stripped down for embedded OpenGL
+ because the implementation uses immediate mode calls not
+ available on GLES1 or GLES2 -->
+ <antcall target="java.generate.glu" inheritrefs="true" />
<!-- Inform the user that the generators have successfully created
- the necessary Java files -->
@@ -704,6 +786,7 @@
excludes="${java.excludes.platform}"
source="${jogl.sourcelevel}"
classpath="${gluegen-rt.jar}"
+ bootclasspath="${javac.bootclasspath.jar}"
fork="yes"
memoryMaximumSize="128m"
debug="true" debuglevel="source,lines">
@@ -770,6 +853,8 @@
<linker id="linker.cfg.win32.msvc.jogl" extends="linker.cfg.win32.msvc">
<syslibset libs="opengl32, gdi32, user32, kernel32" />
<syslibset dir="${windows.cg.lib}" libs="cg, cgGL" if="c.compiler.use-cglib"/>
+ <!-- This is temporary -->
+ <syslibset libs="winmm" />
</linker>
<linker id="linker.cfg.macosx.jogl" extends="linker.cfg.macosx">
@@ -789,7 +874,9 @@
<patternset id="c.src.files.jogl">
<include name="${rootrel.src.c.jogl}/InternalBufferUtils.c"/>
<include name="${rootrel.src.c.jogl}/*.m" if="isOSX"/>
- <include name="${rootrel.generated.c.jogl}/*GL*.c"/>
+ <!-- FIXME: the Mixer should be moved to another library -->
+ <include name="${rootrel.src.c.jogl}/Mixer.cpp" if="isWindows"/>
+ <include name="${rootrel.generated.c.jogl}/*GL*.c" unless="jogl.noglnatives"/>
<include name="${rootrel.src.c.jogl}/XineramaHelper.c" if="isX11"/>
<!-- Xinerama supporting functions for Linux only (for now) -->
<!-- Also supported on Solaris, but works differently -->
@@ -853,6 +940,10 @@
<sysincludepath path="${java.includes.dir.platform}"/>
<includepath path="stub_includes/opengl"/>
<includepath path="stub_includes/cg" if="c.compiler.use-cglib"/>
+
+ <!-- This is for the generated headers for handwritten C code -->
+ <includepath path="${src.generated.c}" />
+
<!-- This must come last to not override real include paths -->
<!-- includepath path="stub_includes/macosx" if="isOSX" / -->
</compiler>
@@ -896,6 +987,14 @@
</target>
<target name="c.build.jogl.core">
+ <!-- Generate the EGLDrawableFactory header -->
+ <!-- FIXME: this is temporary until we fully autogenerate the EGL interface -->
+ <javah destdir="../build/gensrc/native/jogl" classpath="${jogl.jar}" class="com.sun.opengl.impl.egl.EGLDrawableFactory" />
+ <!-- Generate the waveout Mixer header -->
+ <!-- FIXME: this is temporary until we move this to another workspace -->
+ <javah destdir="../build/gensrc/native/jogl" classpath="${jogl.jar}" class="com.sun.javafx.audio.windows.waveout.Mixer" />
+
+ <!-- Compile stuff -->
<antcall target="c.build" inheritRefs="true">
<param name="c.compiler.src.files" value="c.src.files.jogl"/>
<param name="output.lib.name" value="jogl"/>
@@ -976,6 +1075,8 @@
<include name="javax/media/opengl/**" />
<include name="com/sun/gluegen/runtime/**" />
<include name="com/sun/opengl/**" />
+ <!-- FIXME: this is temporary until we move these classes to another workspace -->
+ <include name="com/sun/javafx/**" />
</fileset>
</jar>
<delete file="tempversion"/>
@@ -999,6 +1100,7 @@
<include name="javax/media/opengl/**" />
<include name="com/sun/gluegen/runtime/**" />
<include name="com/sun/opengl/**" />
+ <include name="com/sun/javafx/**" />
</fileset>
</jar>
<delete file="tempversion"/>
diff --git a/make/gl-common-es1.cfg b/make/gl-common-es1.cfg
new file mode 100755
index 000000000..578312e79
--- /dev/null
+++ b/make/gl-common-es1.cfg
@@ -0,0 +1,7 @@
+# This .cfg file provides common options used among all GL glue code
+# generated for Jogl on OpenGL ES 1.
+
+HierarchicalNativeOutput false
+Include gl-common.cfg
+JavaOutputDir ../build/gensrc/classes
+NativeOutputDir ../build/gensrc/native/jogl
diff --git a/make/gl-common-es2.cfg b/make/gl-common-es2.cfg
new file mode 100755
index 000000000..e4765f00a
--- /dev/null
+++ b/make/gl-common-es2.cfg
@@ -0,0 +1,7 @@
+# This .cfg file provides common options used among all GL glue code
+# generated for Jogl on OpenGL ES 2.
+
+HierarchicalNativeOutput false
+Include gl-common.cfg
+JavaOutputDir ../build/gensrc/classes
+NativeOutputDir ../build/gensrc/native/jogl
diff --git a/make/gl-common.cfg b/make/gl-common.cfg
index e33bba2e1..771b34526 100644
--- a/make/gl-common.cfg
+++ b/make/gl-common.cfg
@@ -10,10 +10,9 @@ Import java.util.*
Import javax.media.opengl.*
Import com.sun.opengl.impl.*
-# Inform the glue code generator of the association between #defines
-# and functions and the extensions in which they are defined
-GLHeader GL/gl.h
-GLHeader GL/glext.h
+#####################################################################
+# Mostly desktop OpenGL stuff below
+#
# Don't output #defines of GL version identifier strings as constants,
# because we don't need them java-side.
@@ -266,51 +265,6 @@ JavaEpilogue glBindBuffer bufferStateTracker.setBoundBufferObject({0}, {1}
JavaEpilogue glBindBufferARB bufferStateTracker.setBoundBufferObject({0}, {1});
JavaEpilogue glPushClientAttrib bufferStateTracker.clearBufferObjectState();
JavaEpilogue glPopClientAttrib bufferStateTracker.clearBufferObjectState();
-JavaEpilogue glBufferData bufferSizeTracker.setBufferSize(bufferStateTracker, {0}, this, {1});
-JavaEpilogue glBufferDataARB bufferSizeTracker.setBufferSize(bufferStateTracker, {0}, this, {1});
-BufferObjectKind UnpackPixel glBitmap
-BufferObjectKind UnpackPixel glColorTable
-BufferObjectKind UnpackPixel glColorSubTable
-BufferObjectKind UnpackPixel glCompressedTexImage1D
-BufferObjectKind UnpackPixel glCompressedTexImage1DARB
-BufferObjectKind UnpackPixel glCompressedTexImage2D
-BufferObjectKind UnpackPixel glCompressedTexImage2DARB
-BufferObjectKind UnpackPixel glCompressedTexImage3D
-BufferObjectKind UnpackPixel glCompressedTexImage3DARB
-BufferObjectKind UnpackPixel glCompressedTexSubImage1D
-BufferObjectKind UnpackPixel glCompressedTexSubImage1DARB
-BufferObjectKind UnpackPixel glCompressedTexSubImage2D
-BufferObjectKind UnpackPixel glCompressedTexSubImage2DARB
-BufferObjectKind UnpackPixel glCompressedTexSubImage3D
-BufferObjectKind UnpackPixel glCompressedTexSubImage3DARB
-BufferObjectKind UnpackPixel glConvolutionFilter1D
-BufferObjectKind UnpackPixel glConvolutionFilter2D
-BufferObjectKind UnpackPixel glDrawPixels
-BufferObjectKind UnpackPixel glPixelMapfv
-BufferObjectKind UnpackPixel glPixelMapuiv
-BufferObjectKind UnpackPixel glPixelMapusv
-BufferObjectKind UnpackPixel glPolygonStipple
-BufferObjectKind UnpackPixel glSeparableFilter2D
-BufferObjectKind UnpackPixel glTexImage1D
-BufferObjectKind UnpackPixel glTexImage2D
-BufferObjectKind UnpackPixel glTexImage3D
-BufferObjectKind UnpackPixel glTexSubImage1D
-BufferObjectKind UnpackPixel glTexSubImage2D
-BufferObjectKind UnpackPixel glTexSubImage3D
-
-BufferObjectKind PackPixel glGetColorTable
-BufferObjectKind PackPixel glGetCompressedTexImage
-BufferObjectKind PackPixel glGetCompressedTexImageARB
-BufferObjectKind PackPixel glGetConvolutionFilter
-BufferObjectKind PackPixel glGetHistogram
-BufferObjectKind PackPixel glGetMinmax
-BufferObjectKind PackPixel glGetPixelMapfv
-BufferObjectKind PackPixel glGetPixelMapuiv
-BufferObjectKind PackPixel glGetPixelMapusv
-BufferObjectKind PackPixel glGetPolygonStipple
-BufferObjectKind PackPixel glGetSeparableFilter
-BufferObjectKind PackPixel glGetTexImage
-BufferObjectKind PackPixel glReadPixels
BufferObjectKind Array glColorPointer
BufferObjectKind Array glEdgeFlagPointer
@@ -408,49 +362,6 @@ RangeCheck glDeleteTextures 1 {0}
RangeCheck glGenVertexArraysAPPLE 1 {0}
RangeCheck glDeleteVertexArraysAPPLE 1 {0}
-# Track server-side object creation and deletion when necessary
-JavaEpilogue glGenBuffers if (tracker != null) tracker.addBuffers({0}, {1});
-JavaEpilogue glGenBuffersARB if (tracker != null) tracker.addBuffersARB({0}, {1});
-JavaEpilogue glGenFencesAPPLE if (tracker != null) tracker.addFencesAPPLE({0}, {1});
-JavaEpilogue glGenFencesNV if (tracker != null) tracker.addFencesNV({0}, {1});
-JavaEpilogue glGenFragmentShadersATI if (tracker != null) tracker.addFragmentShadersATI(_res, {0});
-JavaEpilogue glGenFramebuffersEXT if (tracker != null) tracker.addFramebuffersEXT({0}, {1});
-JavaEpilogue glGenLists if (tracker != null) tracker.addLists(_res, {0});
-JavaEpilogue glGenOcclusionQueriesNV if (tracker != null) tracker.addOcclusionQueriesNV({0}, {1});
-JavaEpilogue glCreateProgram if (tracker != null) tracker.addProgramObject(_res);
-JavaEpilogue glCreateProgramObjectARB if (tracker != null) tracker.addProgramObjectARB(_res);
-JavaEpilogue glGenProgramsARB if (tracker != null) tracker.addProgramsARB({0}, {1});
-JavaEpilogue glGenProgramsNV if (tracker != null) tracker.addProgramsNV({0}, {1});
-JavaEpilogue glGenQueries if (tracker != null) tracker.addQueries({0}, {1});
-JavaEpilogue glGenQueriesARB if (tracker != null) tracker.addQueriesARB({0}, {1});
-JavaEpilogue glGenRenderbuffersEXT if (tracker != null) tracker.addRenderbuffersEXT({0}, {1});
-JavaEpilogue glCreateShader if (tracker != null) tracker.addShaderObject(_res);
-JavaEpilogue glCreateShaderObjectARB if (tracker != null) tracker.addShaderObjectARB(_res);
-JavaEpilogue glGenTextures if (tracker != null) tracker.addTextures({0}, {1});
-JavaEpilogue glGenVertexArraysAPPLE if (tracker != null) tracker.addVertexArraysAPPLE({0}, {1});
-JavaEpilogue glGenVertexShadersEXT if (tracker != null) tracker.addVertexShadersEXT(_res, {0});
-
-JavaEpilogue glDeleteBuffers if (tracker != null) tracker.removeBuffers({0}, {1});
-JavaEpilogue glDeleteBuffersARB if (tracker != null) tracker.removeBuffersARB({0}, {1});
-JavaEpilogue glDeleteFencesAPPLE if (tracker != null) tracker.removeFencesAPPLE({0}, {1});
-JavaEpilogue glDeleteFencesNV if (tracker != null) tracker.removeFencesNV({0}, {1});
-JavaEpilogue glDeleteFragmentShaderATI if (tracker != null) tracker.removeFragmentShaderATI({0});
-JavaEpilogue glDeleteFramebuffersEXT if (tracker != null) tracker.removeFramebuffersEXT({0}, {1});
-JavaEpilogue glDeleteLists if (tracker != null) tracker.removeLists({0}, {1});
-JavaEpilogue glDeleteOcclusionQueriesNV if (tracker != null) tracker.removeOcclusionQueriesNV({0}, {1});
-JavaEpilogue glDeleteProgram if (tracker != null) tracker.removeProgramObject({0});
-JavaEpilogue glDeleteObjectARB if (tracker != null) tracker.removeProgramOrShaderObjectARB({0});
-JavaEpilogue glDeleteProgramsARB if (tracker != null) tracker.removeProgramsARB({0}, {1});
-JavaEpilogue glDeleteProgramsNV if (tracker != null) tracker.removeProgramsNV({0}, {1});
-JavaEpilogue glDeleteQueries if (tracker != null) tracker.removeQueries({0}, {1});
-JavaEpilogue glDeleteQueriesARB if (tracker != null) tracker.removeQueriesARB({0}, {1});
-JavaEpilogue glDeleteRenderbuffersEXT if (tracker != null) tracker.removeRenderbuffersEXT({0}, {1});
-JavaEpilogue glDeleteShader if (tracker != null) tracker.removeShaderObject({0});
-JavaEpilogue glDeleteTextures if (tracker != null) tracker.removeTextures({0}, {1});
-JavaEpilogue glDeleteVertexArraysAPPLE if (tracker != null) tracker.removeVertexArraysAPPLE({0}, {1});
-JavaEpilogue glDeleteVertexShaderEXT if (tracker != null) tracker.removeVertexShaderEXT({0});
-
-
# Javadoc for the GL class
ClassJavadoc GL /**
ClassJavadoc GL * <P> The basic interface to OpenGL, providing access to core
diff --git a/make/gl-desktop.cfg b/make/gl-desktop.cfg
new file mode 100755
index 000000000..808f02f94
--- /dev/null
+++ b/make/gl-desktop.cfg
@@ -0,0 +1,101 @@
+# This .cfg file provides common options used by the desktop OpenGL
+# implementation on all platforms.
+
+# Inform the glue code generator of the association between #defines
+# and functions and the extensions in which they are defined
+GLHeader GL/gl.h
+GLHeader GL/glext.h
+
+# Right now the implementations for these don't work on the embedded
+# OpenGL variants (FIXME)
+JavaEpilogue glBufferData bufferSizeTracker.setBufferSize(bufferStateTracker, {0}, this, {1});
+JavaEpilogue glBufferDataARB bufferSizeTracker.setBufferSize(bufferStateTracker, {0}, this, {1});
+
+# There are no PBOs in the embedded OpenGL variants right now
+BufferObjectKind UnpackPixel glBitmap
+BufferObjectKind UnpackPixel glColorTable
+BufferObjectKind UnpackPixel glColorSubTable
+BufferObjectKind UnpackPixel glCompressedTexImage1D
+BufferObjectKind UnpackPixel glCompressedTexImage1DARB
+BufferObjectKind UnpackPixel glCompressedTexImage2D
+BufferObjectKind UnpackPixel glCompressedTexImage2DARB
+BufferObjectKind UnpackPixel glCompressedTexImage3D
+BufferObjectKind UnpackPixel glCompressedTexImage3DARB
+BufferObjectKind UnpackPixel glCompressedTexSubImage1D
+BufferObjectKind UnpackPixel glCompressedTexSubImage1DARB
+BufferObjectKind UnpackPixel glCompressedTexSubImage2D
+BufferObjectKind UnpackPixel glCompressedTexSubImage2DARB
+BufferObjectKind UnpackPixel glCompressedTexSubImage3D
+BufferObjectKind UnpackPixel glCompressedTexSubImage3DARB
+BufferObjectKind UnpackPixel glConvolutionFilter1D
+BufferObjectKind UnpackPixel glConvolutionFilter2D
+BufferObjectKind UnpackPixel glDrawPixels
+BufferObjectKind UnpackPixel glPixelMapfv
+BufferObjectKind UnpackPixel glPixelMapuiv
+BufferObjectKind UnpackPixel glPixelMapusv
+BufferObjectKind UnpackPixel glPolygonStipple
+BufferObjectKind UnpackPixel glSeparableFilter2D
+BufferObjectKind UnpackPixel glTexImage1D
+BufferObjectKind UnpackPixel glTexImage2D
+BufferObjectKind UnpackPixel glTexImage3D
+BufferObjectKind UnpackPixel glTexSubImage1D
+BufferObjectKind UnpackPixel glTexSubImage2D
+BufferObjectKind UnpackPixel glTexSubImage3D
+
+BufferObjectKind PackPixel glGetColorTable
+BufferObjectKind PackPixel glGetCompressedTexImage
+BufferObjectKind PackPixel glGetCompressedTexImageARB
+BufferObjectKind PackPixel glGetConvolutionFilter
+BufferObjectKind PackPixel glGetHistogram
+BufferObjectKind PackPixel glGetMinmax
+BufferObjectKind PackPixel glGetPixelMapfv
+BufferObjectKind PackPixel glGetPixelMapuiv
+BufferObjectKind PackPixel glGetPixelMapusv
+BufferObjectKind PackPixel glGetPolygonStipple
+BufferObjectKind PackPixel glGetSeparableFilter
+BufferObjectKind PackPixel glGetTexImage
+BufferObjectKind PackPixel glReadPixels
+
+# Track server-side object creation and deletion when necessary
+# Note that this is only necessary when the Java 2D / JOGL bridge is active,
+# so will never be needed for the embedded OpenGL variants
+JavaEpilogue glGenBuffers if (tracker != null) tracker.addBuffers({0}, {1});
+JavaEpilogue glGenBuffersARB if (tracker != null) tracker.addBuffersARB({0}, {1});
+JavaEpilogue glGenFencesAPPLE if (tracker != null) tracker.addFencesAPPLE({0}, {1});
+JavaEpilogue glGenFencesNV if (tracker != null) tracker.addFencesNV({0}, {1});
+JavaEpilogue glGenFragmentShadersATI if (tracker != null) tracker.addFragmentShadersATI(_res, {0});
+JavaEpilogue glGenFramebuffersEXT if (tracker != null) tracker.addFramebuffersEXT({0}, {1});
+JavaEpilogue glGenLists if (tracker != null) tracker.addLists(_res, {0});
+JavaEpilogue glGenOcclusionQueriesNV if (tracker != null) tracker.addOcclusionQueriesNV({0}, {1});
+JavaEpilogue glCreateProgram if (tracker != null) tracker.addProgramObject(_res);
+JavaEpilogue glCreateProgramObjectARB if (tracker != null) tracker.addProgramObjectARB(_res);
+JavaEpilogue glGenProgramsARB if (tracker != null) tracker.addProgramsARB({0}, {1});
+JavaEpilogue glGenProgramsNV if (tracker != null) tracker.addProgramsNV({0}, {1});
+JavaEpilogue glGenQueries if (tracker != null) tracker.addQueries({0}, {1});
+JavaEpilogue glGenQueriesARB if (tracker != null) tracker.addQueriesARB({0}, {1});
+JavaEpilogue glGenRenderbuffersEXT if (tracker != null) tracker.addRenderbuffersEXT({0}, {1});
+JavaEpilogue glCreateShader if (tracker != null) tracker.addShaderObject(_res);
+JavaEpilogue glCreateShaderObjectARB if (tracker != null) tracker.addShaderObjectARB(_res);
+JavaEpilogue glGenTextures if (tracker != null) tracker.addTextures({0}, {1});
+JavaEpilogue glGenVertexArraysAPPLE if (tracker != null) tracker.addVertexArraysAPPLE({0}, {1});
+JavaEpilogue glGenVertexShadersEXT if (tracker != null) tracker.addVertexShadersEXT(_res, {0});
+
+JavaEpilogue glDeleteBuffers if (tracker != null) tracker.removeBuffers({0}, {1});
+JavaEpilogue glDeleteBuffersARB if (tracker != null) tracker.removeBuffersARB({0}, {1});
+JavaEpilogue glDeleteFencesAPPLE if (tracker != null) tracker.removeFencesAPPLE({0}, {1});
+JavaEpilogue glDeleteFencesNV if (tracker != null) tracker.removeFencesNV({0}, {1});
+JavaEpilogue glDeleteFragmentShaderATI if (tracker != null) tracker.removeFragmentShaderATI({0});
+JavaEpilogue glDeleteFramebuffersEXT if (tracker != null) tracker.removeFramebuffersEXT({0}, {1});
+JavaEpilogue glDeleteLists if (tracker != null) tracker.removeLists({0}, {1});
+JavaEpilogue glDeleteOcclusionQueriesNV if (tracker != null) tracker.removeOcclusionQueriesNV({0}, {1});
+JavaEpilogue glDeleteProgram if (tracker != null) tracker.removeProgramObject({0});
+JavaEpilogue glDeleteObjectARB if (tracker != null) tracker.removeProgramOrShaderObjectARB({0});
+JavaEpilogue glDeleteProgramsARB if (tracker != null) tracker.removeProgramsARB({0}, {1});
+JavaEpilogue glDeleteProgramsNV if (tracker != null) tracker.removeProgramsNV({0}, {1});
+JavaEpilogue glDeleteQueries if (tracker != null) tracker.removeQueries({0}, {1});
+JavaEpilogue glDeleteQueriesARB if (tracker != null) tracker.removeQueriesARB({0}, {1});
+JavaEpilogue glDeleteRenderbuffersEXT if (tracker != null) tracker.removeRenderbuffersEXT({0}, {1});
+JavaEpilogue glDeleteShader if (tracker != null) tracker.removeShaderObject({0});
+JavaEpilogue glDeleteTextures if (tracker != null) tracker.removeTextures({0}, {1});
+JavaEpilogue glDeleteVertexArraysAPPLE if (tracker != null) tracker.removeVertexArraysAPPLE({0}, {1});
+JavaEpilogue glDeleteVertexShaderEXT if (tracker != null) tracker.removeVertexShaderEXT({0});
diff --git a/make/gl-es1.cfg b/make/gl-es1.cfg
new file mode 100755
index 000000000..4a3832bce
--- /dev/null
+++ b/make/gl-es1.cfg
@@ -0,0 +1,39 @@
+# This .cfg file is used to generate the GL interface and implementing class.
+Package javax.media.opengl
+Style InterfaceAndImpl
+JavaClass GL
+ImplPackage com.sun.opengl.impl
+ImplJavaClass GLImpl
+Include gl-common-es1.cfg
+
+EmitProcAddressTable true
+ProcAddressTableClassName GLProcAddressTable
+GetProcAddressTableExpr _context.getGLProcAddressTable()
+
+# Inform the glue code generator of the association between #defines
+# and functions and the extensions in which they are defined
+GLHeader GLES/gl.h
+GLHeader GLES/glext.h
+
+# For the time being, ignore glMapBufferOES (FIXME)
+Ignore glMapBufferOES
+
+# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums
+TagNativeBinding true
+
+CustomCCode /* Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in
+CustomCCode "glext.h" are parsed. */
+CustomCCode #define GL_GLEXT_PROTOTYPES
+
+CustomCCode /* Include the OpenGL headers */
+CustomCCode #define GL_APICALL __declspec(dllimport)
+CustomCCode #include <GLES/gl.h>
+CustomCCode #include <GLES/glext.h>
+CustomCCode #include <stdlib.h>
+CustomCCode /* Include missing function pointer typedef */
+CustomCCode typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+
+CustomCCode typedef int intptr_t;
+
+IncludeAs CustomJavaCode GLImpl gl-impl-CustomJavaCode-gles1.java
+IncludeAs CustomCCode gl-impl-CustomCCode.c
diff --git a/make/gl-es2.cfg b/make/gl-es2.cfg
new file mode 100755
index 000000000..aa1ad8e26
--- /dev/null
+++ b/make/gl-es2.cfg
@@ -0,0 +1,38 @@
+# This .cfg file is used to generate the GL interface and implementing class.
+Package javax.media.opengl
+Style InterfaceAndImpl
+JavaClass GL
+ImplPackage com.sun.opengl.impl
+ImplJavaClass GLImpl
+Include gl-common-es2.cfg
+
+EmitProcAddressTable true
+ProcAddressTableClassName GLProcAddressTable
+GetProcAddressTableExpr _context.getGLProcAddressTable()
+
+# Inform the glue code generator of the association between #defines
+# and functions and the extensions in which they are defined
+GLHeader GLES2/gl2.h
+GLHeader GLES2/gl2ext.h
+
+# For the time being, ignore glMapBufferOES (FIXME)
+Ignore glMapBufferOES
+
+# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums
+TagNativeBinding true
+
+CustomCCode /* Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in
+CustomCCode "glext.h" are parsed. */
+CustomCCode #define GL_GLEXT_PROTOTYPES
+
+CustomCCode /* Include the OpenGL headers */
+CustomCCode #define GL_APICALL __declspec(dllimport)
+CustomCCode #include <GLES2/gl2ext.h>
+CustomCCode #include <stdlib.h>
+CustomCCode /* Include missing function pointer typedef */
+CustomCCode typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+
+CustomCCode typedef int intptr_t;
+
+IncludeAs CustomJavaCode GLImpl gl-impl-CustomJavaCode-gles2.java
+IncludeAs CustomCCode gl-impl-CustomCCode.c
diff --git a/make/gl-impl-CustomCCode.c b/make/gl-impl-CustomCCode.c
index 2ea5376e7..20d4b0430 100644
--- a/make/gl-impl-CustomCCode.c
+++ b/make/gl-impl-CustomCCode.c
@@ -3,6 +3,7 @@
* Java method: long dispatch_glMapBuffer(int target, int access)
* C function: LPVOID glMapBuffer(GLenum target, GLenum access);
*/
+/*
JNIEXPORT jlong JNICALL
Java_com_sun_opengl_impl_GLImpl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) {
PFNGLMAPBUFFERPROC ptr_glMapBuffer;
@@ -12,12 +13,14 @@ Java_com_sun_opengl_impl_GLImpl_dispatch_1glMapBuffer(JNIEnv *env, jobject _unus
_res = (* ptr_glMapBuffer) ((GLenum) target, (GLenum) access);
return (jlong) (intptr_t) _res;
}
+*/
/* Java->C glue code:
* Java package: net.java.games.jogl.impl.GLImpl
* Java method: long dispatch_glMapBufferARB(int target, int access)
* C function: LPVOID glMapBufferARB(GLenum target, GLenum access);
*/
+/*
JNIEXPORT jlong JNICALL
Java_com_sun_opengl_impl_GLImpl_dispatch_1glMapBufferARB(JNIEnv *env, jobject _unused, jint target, jint access, jlong glProcAddress) {
PFNGLMAPBUFFERARBPROC ptr_glMapBufferARB;
@@ -27,3 +30,4 @@ Java_com_sun_opengl_impl_GLImpl_dispatch_1glMapBufferARB(JNIEnv *env, jobject _u
_res = (* ptr_glMapBufferARB) ((GLenum) target, (GLenum) access);
return (jlong) (intptr_t) _res;
}
+*/
diff --git a/make/gl-impl-CustomJavaCode-gles1.java b/make/gl-impl-CustomJavaCode-gles1.java
new file mode 100755
index 000000000..7f10c661b
--- /dev/null
+++ b/make/gl-impl-CustomJavaCode-gles1.java
@@ -0,0 +1,301 @@
+// Tracks glBegin/glEnd calls to determine whether it is legal to
+// query Vertex Buffer Object state
+private boolean inBeginEndPair;
+
+public GLImpl(GLContextImpl context) {
+ this._context = context;
+ this.bufferSizeTracker = context.getBufferSizeTracker();
+}
+
+public boolean isFunctionAvailable(String glFunctionName) {
+ return _context.isFunctionAvailable(glFunctionName);
+}
+
+public boolean isExtensionAvailable(String glExtensionName) {
+ return _context.isExtensionAvailable(glExtensionName);
+}
+
+public Object getExtension(String extensionName) {
+ // At this point we don't expose any extensions using this mechanism
+ return null;
+}
+
+/** Returns the context this GL object is associated with for better
+ error checking by DebugGL. */
+public GLContext getContext() {
+ return _context;
+}
+
+private GLContextImpl _context;
+
+/**
+ * Provides platform-independent access to the wglAllocateMemoryNV /
+ * glXAllocateMemoryNV extension.
+ */
+public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) {
+ return _context.glAllocateMemoryNV(arg0, arg1, arg2, arg3);
+}
+
+public void setSwapInterval(int interval) {
+ _context.setSwapInterval(interval);
+}
+
+public Object getPlatformGLExtensions() {
+ return _context.getPlatformGLExtensions();
+}
+
+//
+// Helpers for ensuring the correct amount of texture data
+//
+
+/** Returns the number of bytes required to fill in the appropriate
+ texture. This is regrettably a lower bound as in certain
+ circumstances OpenGL state such as unpack alignment can cause more
+ data to be required. However this should be close enough that it
+ should catch most crashes. The logic in this routine is based on
+ code in the SGI OpenGL sample implementation. */
+
+private int imageSizeInBytes(int format, int type, int w, int h, int d) {
+ int elements = 0;
+ int esize = 0;
+
+ if (w < 0) return 0;
+ if (h < 0) return 0;
+ if (d < 0) return 0;
+ switch (format) {
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ elements = 4;
+ break;
+ default:
+ return 0;
+ }
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ default:
+ return 0;
+ }
+ return (elements * esize * w * h * d);
+}
+
+private boolean bufferObjectExtensionsInitialized = false;
+private boolean haveARBPixelBufferObject;
+private boolean haveEXTPixelBufferObject;
+private boolean haveGL15;
+private boolean haveGL21;
+private boolean haveARBVertexBufferObject;
+private GLBufferStateTracker bufferStateTracker = new GLBufferStateTracker();
+private GLBufferSizeTracker bufferSizeTracker;
+
+private void initBufferObjectExtensionChecks() {
+ if (bufferObjectExtensionsInitialized)
+ return;
+ bufferObjectExtensionsInitialized = true;
+ haveARBPixelBufferObject = isExtensionAvailable("GL_ARB_pixel_buffer_object");
+ haveEXTPixelBufferObject = isExtensionAvailable("GL_EXT_pixel_buffer_object");
+ haveGL15 = isExtensionAvailable("GL_VERSION_1_5");
+ haveGL21 = isExtensionAvailable("GL_VERSION_2_1");
+ haveARBVertexBufferObject = isExtensionAvailable("GL_ARB_vertex_buffer_object");
+}
+
+//
+// FIXME: all of these error checking routines had to be disabled
+// because our version and extension querying mechanisms aren't
+// working on the device yet
+//
+
+
+private void checkBufferObject(boolean extension1,
+ boolean extension2,
+ boolean extension3,
+ boolean enabled,
+ int state,
+ String kind) {
+ /*
+ if (inBeginEndPair) {
+ throw new GLException("May not call this between glBegin and glEnd");
+ }
+ boolean avail = (extension1 || extension2 || extension3);
+ if (!avail) {
+ if (!enabled)
+ return;
+ throw new GLException("Required extensions not available to call this function");
+ }
+ int buffer = bufferStateTracker.getBoundBufferObject(state, this);
+ if (enabled) {
+ if (buffer == 0) {
+ throw new GLException(kind + " must be enabled to call this method");
+ }
+ } else {
+ if (buffer != 0) {
+ throw new GLException(kind + " must be disabled to call this method");
+ }
+ }
+ */
+}
+
+private void checkArrayVBODisabled() {
+ /*
+ initBufferObjectExtensionChecks();
+ checkBufferObject(haveGL15,
+ haveARBVertexBufferObject,
+ false,
+ false,
+ GL.GL_ARRAY_BUFFER,
+ "array vertex_buffer_object");
+ */
+}
+
+private void checkArrayVBOEnabled() {
+ /*
+ initBufferObjectExtensionChecks();
+ checkBufferObject(haveGL15,
+ haveARBVertexBufferObject,
+ false,
+ true,
+ GL.GL_ARRAY_BUFFER,
+ "array vertex_buffer_object");
+ */
+}
+
+private void checkElementVBODisabled() {
+ /*
+ initBufferObjectExtensionChecks();
+ checkBufferObject(haveGL15,
+ haveARBVertexBufferObject,
+ false,
+ false,
+ GL.GL_ELEMENT_ARRAY_BUFFER,
+ "element vertex_buffer_object");
+ */
+}
+
+private void checkElementVBOEnabled() {
+ /*
+ initBufferObjectExtensionChecks();
+ checkBufferObject(haveGL15,
+ haveARBVertexBufferObject,
+ false,
+ true,
+ GL.GL_ELEMENT_ARRAY_BUFFER,
+ "element vertex_buffer_object");
+ */
+}
+
+// FIXME: bind this up to glMapBufferOES
+
+/*
+
+// Attempt to return the same ByteBuffer object from glMapBufferARB if
+// the vertex buffer object's base address and size haven't changed
+private static class ARBVBOKey {
+ private long addr;
+ private int capacity;
+
+ ARBVBOKey(long addr, int capacity) {
+ this.addr = addr;
+ this.capacity = capacity;
+ }
+
+ public int hashCode() {
+ return (int) addr;
+ }
+
+ public boolean equals(Object o) {
+ if ((o == null) || (!(o instanceof ARBVBOKey))) {
+ return false;
+ }
+
+ ARBVBOKey other = (ARBVBOKey) o;
+ return ((addr == other.addr) && (capacity == other.capacity));
+ }
+}
+
+*/
+
+//private Map/*<ARBVBOKey, ByteBuffer>*/ arbVBOCache = new HashMap();
+
+/** Entry point to C language function: <br> <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */
+/*
+public java.nio.ByteBuffer glMapBuffer(int target, int access) {
+ final long __addr_ = _context.getGLProcAddressTable()._addressof_glMapBuffer;
+ if (__addr_ == 0) {
+ throw new GLException("Method \"glMapBuffer\" not available");
+ }
+ int sz = bufferSizeTracker.getBufferSize(bufferStateTracker,
+ target,
+ this);
+ long addr;
+ addr = dispatch_glMapBuffer(target, access, __addr_);
+ if (addr == 0 || sz == 0) {
+ return null;
+ }
+ ARBVBOKey key = new ARBVBOKey(addr, sz);
+ java.nio.ByteBuffer _res = (java.nio.ByteBuffer) arbVBOCache.get(key);
+ if (_res == null) {
+ _res = InternalBufferUtils.newDirectByteBuffer(addr, sz);
+ _res.order(java.nio.ByteOrder.nativeOrder());
+ arbVBOCache.put(key, _res);
+ }
+ _res.position(0);
+ return _res;
+}
+*/
+
+/** Entry point to C language function: <br> <code> LPVOID glMapBufferARB(GLenum target, GLenum access); </code> */
+/*
+public java.nio.ByteBuffer glMapBufferARB(int target, int access) {
+ final long __addr_ = _context.getGLProcAddressTable()._addressof_glMapBufferARB;
+ if (__addr_ == 0) {
+ throw new GLException("Method \"glMapBufferARB\" not available");
+ }
+ int sz = bufferSizeTracker.getBufferSize(bufferStateTracker,
+ target,
+ this);
+ long addr;
+ addr = dispatch_glMapBufferARB(target, access, __addr_);
+ if (addr == 0 || sz == 0) {
+ return null;
+ }
+ ARBVBOKey key = new ARBVBOKey(addr, sz);
+ java.nio.ByteBuffer _res = (java.nio.ByteBuffer) arbVBOCache.get(key);
+ if (_res == null) {
+ _res = InternalBufferUtils.newDirectByteBuffer(addr, sz);
+ _res.order(java.nio.ByteOrder.nativeOrder());
+ arbVBOCache.put(key, _res);
+ }
+ _res.position(0);
+ return _res;
+}
+*/
+
+/** Encapsulates function pointer for OpenGL function <br>: <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */
+//native private long dispatch_glMapBuffer(int target, int access, long glProcAddress);
+
+/** Encapsulates function pointer for OpenGL function <br>: <code> LPVOID glMapBufferARB(GLenum target, GLenum access); </code> */
+//native private long dispatch_glMapBufferARB(int target, int access, long glProcAddress);
diff --git a/make/gl-impl-CustomJavaCode-gles2.java b/make/gl-impl-CustomJavaCode-gles2.java
new file mode 100755
index 000000000..99b2b9267
--- /dev/null
+++ b/make/gl-impl-CustomJavaCode-gles2.java
@@ -0,0 +1,290 @@
+// Tracks glBegin/glEnd calls to determine whether it is legal to
+// query Vertex Buffer Object state
+private boolean inBeginEndPair;
+
+public GLImpl(GLContextImpl context) {
+ this._context = context;
+ this.bufferSizeTracker = context.getBufferSizeTracker();
+}
+
+public boolean isFunctionAvailable(String glFunctionName) {
+ return _context.isFunctionAvailable(glFunctionName);
+}
+
+public boolean isExtensionAvailable(String glExtensionName) {
+ return _context.isExtensionAvailable(glExtensionName);
+}
+
+public Object getExtension(String extensionName) {
+ // At this point we don't expose any extensions using this mechanism
+ return null;
+}
+
+/** Returns the context this GL object is associated with for better
+ error checking by DebugGL. */
+public GLContext getContext() {
+ return _context;
+}
+
+private GLContextImpl _context;
+
+/**
+ * Provides platform-independent access to the wglAllocateMemoryNV /
+ * glXAllocateMemoryNV extension.
+ */
+public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) {
+ return _context.glAllocateMemoryNV(arg0, arg1, arg2, arg3);
+}
+
+public void setSwapInterval(int interval) {
+ _context.setSwapInterval(interval);
+}
+
+public Object getPlatformGLExtensions() {
+ return _context.getPlatformGLExtensions();
+}
+
+//
+// Helpers for ensuring the correct amount of texture data
+//
+
+/** Returns the number of bytes required to fill in the appropriate
+ texture. This is regrettably a lower bound as in certain
+ circumstances OpenGL state such as unpack alignment can cause more
+ data to be required. However this should be close enough that it
+ should catch most crashes. The logic in this routine is based on
+ code in the SGI OpenGL sample implementation. */
+
+private int imageSizeInBytes(int format, int type, int w, int h, int d) {
+ int elements = 0;
+ int esize = 0;
+
+ if (w < 0) return 0;
+ if (h < 0) return 0;
+ if (d < 0) return 0;
+ switch (format) {
+ case GL_STENCIL_INDEX:
+ elements = 1;
+ break;
+ case GL_ALPHA:
+ case GL_LUMINANCE:
+ case GL_DEPTH_COMPONENT:
+ elements = 1;
+ break;
+ case GL_LUMINANCE_ALPHA:
+ elements = 2;
+ break;
+ case GL_RGB:
+ elements = 3;
+ break;
+ case GL_RGBA:
+ elements = 4;
+ break;
+ default:
+ return 0;
+ }
+ switch (type) {
+ case GL_BYTE:
+ case GL_UNSIGNED_BYTE:
+ esize = 1;
+ break;
+ case GL_SHORT:
+ case GL_UNSIGNED_SHORT:
+ esize = 2;
+ break;
+ case GL_UNSIGNED_SHORT_5_6_5:
+ case GL_UNSIGNED_SHORT_4_4_4_4:
+ case GL_UNSIGNED_SHORT_5_5_5_1:
+ esize = 2;
+ elements = 1;
+ break;
+ case GL_INT:
+ case GL_UNSIGNED_INT:
+ case GL_FLOAT:
+ esize = 4;
+ break;
+ default:
+ return 0;
+ }
+ return (elements * esize * w * h * d);
+}
+
+private boolean bufferObjectExtensionsInitialized = false;
+private boolean haveARBPixelBufferObject;
+private boolean haveEXTPixelBufferObject;
+private boolean haveGL15;
+private boolean haveGL21;
+private boolean haveARBVertexBufferObject;
+private GLBufferStateTracker bufferStateTracker = new GLBufferStateTracker();
+private GLBufferSizeTracker bufferSizeTracker;
+
+private void initBufferObjectExtensionChecks() {
+ if (bufferObjectExtensionsInitialized)
+ return;
+ bufferObjectExtensionsInitialized = true;
+ haveARBPixelBufferObject = isExtensionAvailable("GL_ARB_pixel_buffer_object");
+ haveEXTPixelBufferObject = isExtensionAvailable("GL_EXT_pixel_buffer_object");
+ haveGL15 = isExtensionAvailable("GL_VERSION_1_5");
+ haveGL21 = isExtensionAvailable("GL_VERSION_2_1");
+ haveARBVertexBufferObject = isExtensionAvailable("GL_ARB_vertex_buffer_object");
+}
+
+private void checkBufferObject(boolean extension1,
+ boolean extension2,
+ boolean extension3,
+ boolean enabled,
+ int state,
+ String kind) {
+ if (inBeginEndPair) {
+ throw new GLException("May not call this between glBegin and glEnd");
+ }
+ boolean avail = (extension1 || extension2 || extension3);
+ if (!avail) {
+ if (!enabled)
+ return;
+ throw new GLException("Required extensions not available to call this function");
+ }
+ int buffer = bufferStateTracker.getBoundBufferObject(state, this);
+ if (enabled) {
+ if (buffer == 0) {
+ throw new GLException(kind + " must be enabled to call this method");
+ }
+ } else {
+ if (buffer != 0) {
+ throw new GLException(kind + " must be disabled to call this method");
+ }
+ }
+}
+
+private void checkArrayVBODisabled() {
+ initBufferObjectExtensionChecks();
+ checkBufferObject(haveGL15,
+ haveARBVertexBufferObject,
+ false,
+ false,
+ GL.GL_ARRAY_BUFFER,
+ "array vertex_buffer_object");
+}
+
+private void checkArrayVBOEnabled() {
+ initBufferObjectExtensionChecks();
+ checkBufferObject(haveGL15,
+ haveARBVertexBufferObject,
+ false,
+ true,
+ GL.GL_ARRAY_BUFFER,
+ "array vertex_buffer_object");
+}
+
+private void checkElementVBODisabled() {
+ initBufferObjectExtensionChecks();
+ checkBufferObject(haveGL15,
+ haveARBVertexBufferObject,
+ false,
+ false,
+ GL.GL_ELEMENT_ARRAY_BUFFER,
+ "element vertex_buffer_object");
+}
+
+private void checkElementVBOEnabled() {
+ initBufferObjectExtensionChecks();
+ checkBufferObject(haveGL15,
+ haveARBVertexBufferObject,
+ false,
+ true,
+ GL.GL_ELEMENT_ARRAY_BUFFER,
+ "element vertex_buffer_object");
+}
+
+// FIXME: bind this up to glMapBufferOES
+
+/*
+
+// Attempt to return the same ByteBuffer object from glMapBufferARB if
+// the vertex buffer object's base address and size haven't changed
+private static class ARBVBOKey {
+ private long addr;
+ private int capacity;
+
+ ARBVBOKey(long addr, int capacity) {
+ this.addr = addr;
+ this.capacity = capacity;
+ }
+
+ public int hashCode() {
+ return (int) addr;
+ }
+
+ public boolean equals(Object o) {
+ if ((o == null) || (!(o instanceof ARBVBOKey))) {
+ return false;
+ }
+
+ ARBVBOKey other = (ARBVBOKey) o;
+ return ((addr == other.addr) && (capacity == other.capacity));
+ }
+}
+
+*/
+
+//private Map/*<ARBVBOKey, ByteBuffer>*/ arbVBOCache = new HashMap();
+
+/** Entry point to C language function: <br> <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */
+/*
+public java.nio.ByteBuffer glMapBuffer(int target, int access) {
+ final long __addr_ = _context.getGLProcAddressTable()._addressof_glMapBuffer;
+ if (__addr_ == 0) {
+ throw new GLException("Method \"glMapBuffer\" not available");
+ }
+ int sz = bufferSizeTracker.getBufferSize(bufferStateTracker,
+ target,
+ this);
+ long addr;
+ addr = dispatch_glMapBuffer(target, access, __addr_);
+ if (addr == 0 || sz == 0) {
+ return null;
+ }
+ ARBVBOKey key = new ARBVBOKey(addr, sz);
+ java.nio.ByteBuffer _res = (java.nio.ByteBuffer) arbVBOCache.get(key);
+ if (_res == null) {
+ _res = InternalBufferUtils.newDirectByteBuffer(addr, sz);
+ _res.order(java.nio.ByteOrder.nativeOrder());
+ arbVBOCache.put(key, _res);
+ }
+ _res.position(0);
+ return _res;
+}
+*/
+
+/** Entry point to C language function: <br> <code> LPVOID glMapBufferARB(GLenum target, GLenum access); </code> */
+/*
+public java.nio.ByteBuffer glMapBufferARB(int target, int access) {
+ final long __addr_ = _context.getGLProcAddressTable()._addressof_glMapBufferARB;
+ if (__addr_ == 0) {
+ throw new GLException("Method \"glMapBufferARB\" not available");
+ }
+ int sz = bufferSizeTracker.getBufferSize(bufferStateTracker,
+ target,
+ this);
+ long addr;
+ addr = dispatch_glMapBufferARB(target, access, __addr_);
+ if (addr == 0 || sz == 0) {
+ return null;
+ }
+ ARBVBOKey key = new ARBVBOKey(addr, sz);
+ java.nio.ByteBuffer _res = (java.nio.ByteBuffer) arbVBOCache.get(key);
+ if (_res == null) {
+ _res = InternalBufferUtils.newDirectByteBuffer(addr, sz);
+ _res.order(java.nio.ByteOrder.nativeOrder());
+ arbVBOCache.put(key, _res);
+ }
+ _res.position(0);
+ return _res;
+}
+*/
+
+/** Encapsulates function pointer for OpenGL function <br>: <code> LPVOID glMapBuffer(GLenum target, GLenum access); </code> */
+//native private long dispatch_glMapBuffer(int target, int access, long glProcAddress);
+
+/** Encapsulates function pointer for OpenGL function <br>: <code> LPVOID glMapBufferARB(GLenum target, GLenum access); </code> */
+//native private long dispatch_glMapBufferARB(int target, int access, long glProcAddress);
diff --git a/make/gl-macosx.cfg b/make/gl-macosx.cfg
index dc8d41ac8..58883ebec 100644
--- a/make/gl-macosx.cfg
+++ b/make/gl-macosx.cfg
@@ -5,6 +5,7 @@ JavaClass GL
ImplPackage com.sun.opengl.impl
ImplJavaClass GLImpl
Include gl-common-macosx.cfg
+Include gl-desktop.cfg
EmitProcAddressTable true
ProcAddressTableClassName GLProcAddressTable
diff --git a/make/gl-win32.cfg b/make/gl-win32.cfg
index 96234241c..5c1c9e26a 100644
--- a/make/gl-win32.cfg
+++ b/make/gl-win32.cfg
@@ -5,6 +5,7 @@ JavaClass GL
ImplPackage com.sun.opengl.impl
ImplJavaClass GLImpl
Include gl-common-win32.cfg
+Include gl-desktop.cfg
EmitProcAddressTable true
ProcAddressTableClassName GLProcAddressTable
diff --git a/make/gl-x11.cfg b/make/gl-x11.cfg
index eaa968cbe..6470ce5b8 100644
--- a/make/gl-x11.cfg
+++ b/make/gl-x11.cfg
@@ -5,6 +5,7 @@ JavaClass GL
ImplPackage com.sun.opengl.impl
ImplJavaClass GLImpl
Include gl-common-x11.cfg
+Include gl-desktop.cfg
EmitProcAddressTable true
ProcAddressTableClassName GLProcAddressTable
diff --git a/make/glu-CustomJavaCode-gles1.java b/make/glu-CustomJavaCode-gles1.java
new file mode 100755
index 000000000..d0b1f03de
--- /dev/null
+++ b/make/glu-CustomJavaCode-gles1.java
@@ -0,0 +1,480 @@
+/*
+private static boolean useJavaMipmapCode = true;
+
+static {
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ String val = System.getProperty("jogl.glu.nojava");
+ if (val != null && !val.toLowerCase().equals("false")) {
+ useJavaMipmapCode = false;
+ }
+ return null;
+ }
+ });
+}
+*/
+
+/**
+ * Instantiates a new OpenGL Utility Library object. A GLU object may
+ * be instantiated at any point in the application and is not
+ * inherently tied to any particular OpenGL context; however, the GLU
+ * object may only be used when an OpenGL context is current on the
+ * current thread. Attempts to call most of the methods in the GLU
+ * library when no OpenGL context is current will cause an exception
+ * to be thrown.
+ *
+ * <P>
+ *
+ * The returned GLU object is not guaranteed to be thread-safe and
+ * should only be used from one thread at a time. Multiple GLU objects
+ * may be instantiated to be used from different threads
+ * simultaneously.
+ */
+
+public GLU()
+{
+ this.project = new ProjectES1();
+}
+
+//----------------------------------------------------------------------
+// Utility routines
+//
+
+/**
+ * Returns the GL object associated with the OpenGL context current on
+ * the current thread. Throws GLException if no OpenGL context is
+ * current.
+ */
+
+public static GL getCurrentGL() throws GLException {
+ GLContext curContext = GLContext.getCurrent();
+ if (curContext == null) {
+ throw new GLException("No OpenGL context current on this thread");
+ }
+ return curContext.getGL();
+}
+
+/*
+public String gluErrorString(int errorCode) {
+ return Error.gluErrorString(errorCode);
+}
+*/
+
+/* extName is an extension name.
+ * extString is a string of extensions separated by blank(s). There may or
+ * may not be leading or trailing blank(s) in extString.
+ * This works in cases of extensions being prefixes of another like
+ * GL_EXT_texture and GL_EXT_texture3D.
+ * Returns true if extName is found otherwise it returns false.
+ */
+/*
+public boolean gluCheckExtension(java.lang.String extName, java.lang.String extString) {
+ return Registry.gluCheckExtension(extName, extString);
+}
+*/
+
+/*
+public String gluGetString(int name) {
+ return Registry.gluGetString(name);
+}
+*/
+
+/**
+ * Returns true if the specified GLU core- or extension-function can be
+ * successfully used through this GLU instance. By "successfully" we mean
+ * that the function is both <i>callable</i> on the machine running the
+ * program and <i>available</i> on the current display.<P>
+ *
+ * A GLU function is <i>callable</i> if it is a GLU core- or extension-function
+ * that is supported by the underlying GLU implementation. The function is
+ * <i>available</i> if the OpenGL implementation on the display meets the
+ * requirements of the GLU function being called (because GLU functions utilize
+ * OpenGL functions). <P>
+ *
+ * Whether or not a GLU function is <i>callable</i> is determined as follows:
+ * <ul>
+ * <li>If the function is a GLU core function (i.e., not an
+ * extension), <code>gluGetString(GLU_VERSION)</code> is used to determine the
+ * version number of the underlying GLU implementation on the host.
+ * then the function name is cross-referenced with that specification to
+ * see if it is part of that version's specification.
+ *
+ * <li> If the function is a GLU extension, the function name is
+ * cross-referenced with the list returned by
+ * <code>gluGetString(GLU_EXTENSIONS)</code> to see if the function is one of
+ * the extensions that is supported by the underlying GLU implementation.
+ * </ul>
+ *
+ * Whether or not a GLU function is <i>available</i> is determined as follows:
+ * <ul>
+ * <li>If the function is a GLU core function then the function is first
+ * cross-referenced with the GLU specifications to find the minimum GLU
+ * version required to <i>call</i> that GLU function. Then the following table
+ * is consulted to determine the minimum GL version required for that version
+ * of GLU:
+ * <ul>
+ * <li> GLU 1.0 requires OpenGL 1.0
+ * <li> GLU 1.1 requires OpenGL 1.0
+ * <li> GLU 1.2 requires OpenGL 1.1
+ * <li> GLU 1.3 requires OpenGL 1.2
+ * </ul>
+ * Finally, <code>glGetString(GL_VERSION)</code> is used to determine the
+ * highest OpenGL version that both host and display support, and from that it
+ * is possible to determine if the GL facilities required by the GLU function
+ * are <i>available</i> on the display.
+ *
+ * <li> If the function is a GLU extension, the function name is
+ * cross-referenced with the list returned by
+ * <code>gluGetString(GLU_EXTENSIONS)</code> to see if the function is one of
+ * the extensions that is supported by the underlying GLU implementation.
+ * </ul>
+ *
+ * <b>NOTE:</b>The availability of a function may change at runtime in
+ * response to changes in the display environment. For example, when a window
+ * is dragged from one display to another on a multi-display system, or when
+ * the properties of the display device are modified (e.g., changing the color
+ * depth of the display). Any application that is concerned with handling
+ * these situations correctly should confirm availability after a display
+ * change before calling a questionable OpenGL function. To detect a change in
+ * the display device, please see {@link
+ * GLEventListener#displayChanged(GLAutoDrawable,boolean,boolean)}.
+ *
+ * @param gluFunctionName the name of the OpenGL function (e.g., use
+ * "gluNurbsCallbackDataEXT" to check if the <code>
+ * gluNurbsCallbackDataEXT(GLUnurbs, GLvoid)</code> extension is available).
+ */
+public boolean isFunctionAvailable(String gluFunctionName)
+{
+ // if (useJavaMipmapCode) {
+ // All GLU functions are available in Java port
+ return true;
+ // }
+ // return (gluProcAddressTable.getAddressFor(gluFunctionName) != 0);
+}
+
+//----------------------------------------------------------------------
+// Projection routines
+//
+
+private ProjectES1 project;
+
+public void gluOrtho2D(float left, float right, float bottom, float top) {
+ project.gluOrtho2D(getCurrentGL(), left, right, bottom, top);
+}
+
+public void gluPerspective(float fovy, float aspect, float zNear, float zFar) {
+ project.gluPerspective(getCurrentGL(), fovy, aspect, zNear, zFar);
+}
+
+public void gluLookAt(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ) {
+ project.gluLookAt(getCurrentGL(), eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
+}
+
+/** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * winX, GLdouble * winY, GLdouble * winZ); </code>
+ * <P> Accepts the outgoing window coordinates as a single array.
+ */
+public boolean gluProject(float objX, float objY, float objZ, float[] model, int model_offset, float[] proj, int proj_offset, int[] view, int view_offset, float[] winPos, int winPos_offset) {
+ return project.gluProject(objX, objY, objZ, model, model_offset, proj, proj_offset, view, view_offset, winPos, winPos_offset);
+}
+
+/** Interface to C language function: <br> <code> GLint gluProject(GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * winX, GLdouble * winY, GLdouble * winZ); </code>
+ * <P> Accepts the outgoing window coordinates as a single buffer.
+ */
+public boolean gluProject(float objX, float objY, float objZ, java.nio.FloatBuffer model, java.nio.FloatBuffer proj, java.nio.IntBuffer view, java.nio.FloatBuffer winPos) {
+ return project.gluProject(objX, objY, objZ, model, proj, view, winPos);
+}
+
+/** Interface to C language function: <br> <code> GLint gluUnProject(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * objX, GLdouble * objY, GLdouble * objZ); </code>
+ * <P> Accepts the outgoing object coordinates (a 3-vector) as a single array.
+ */
+public boolean gluUnProject(float winX, float winY, float winZ, float[] model, int model_offset, float[] proj, int proj_offset, int[] view, int view_offset, float[] objPos, int objPos_offset) {
+ return project.gluUnProject(winX, winY, winZ, model, model_offset, proj, proj_offset, view, view_offset, objPos, objPos_offset);
+}
+
+/** Interface to C language function: <br> <code> GLint gluUnProject(GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble * objX, GLdouble * objY, GLdouble * objZ); </code>
+ * <P> Accepts the outgoing object coordinates (a 3-vector) as a single buffer.
+ */
+public boolean gluUnProject(float winX, float winY, float winZ, java.nio.FloatBuffer model, java.nio.FloatBuffer proj, java.nio.IntBuffer view, java.nio.FloatBuffer objPos) {
+ return project.gluUnProject(winX, winY, winZ, model, proj, view, objPos);
+}
+
+/** Interface to C language function: <br> <code> GLint gluUnProject4(GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble nearVal, GLdouble farVal, GLdouble * objX, GLdouble * objY, GLdouble * objZ, GLdouble * objW); </code>
+ * <P> Accepts the outgoing object coordinates (a 4-vector) as a single array.
+ */
+public boolean gluUnProject4(float winX, float winY, float winZ, float clipW, float[] model, int model_offset, float[] proj, int proj_offset, int[] view, int view_offset, float nearVal, float farVal, float[] objPos, int objPos_offset) {
+ return project.gluUnProject4(winX, winY, winZ, clipW, model, model_offset, proj, proj_offset, view, view_offset, nearVal, farVal, objPos, objPos_offset);
+}
+
+/** Interface to C language function: <br> <code> GLint gluUnProject4(GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble * model, const GLdouble * proj, const GLint * view, GLdouble nearVal, GLdouble farVal, GLdouble * objX, GLdouble * objY, GLdouble * objZ, GLdouble * objW); </code>
+ * <P> Accepts the outgoing object coordinates (a 4-vector) as a single buffer.
+ */
+public boolean gluUnProject4(float winX, float winY, float winZ, float clipW, java.nio.FloatBuffer model, java.nio.FloatBuffer proj, java.nio.IntBuffer view, float nearVal, float farVal, java.nio.FloatBuffer objPos) {
+ return project.gluUnProject4(winX, winY, winZ, clipW, model, proj, view, nearVal, farVal, objPos);
+}
+
+public void gluPickMatrix(float x, float y, float delX, float delY, int[] viewport, int viewport_offset) {
+ project.gluPickMatrix(getCurrentGL(), x, y, delX, delY, viewport, viewport_offset);
+}
+
+public void gluPickMatrix(float x, float y, float delX, float delY, java.nio.IntBuffer viewport) {
+ project.gluPickMatrix(getCurrentGL(), x, y, delX, delY, viewport);
+}
+
+// Boolean
+public static final int GLU_FALSE = 0;
+public static final int GLU_TRUE = 1;
+
+// String Name
+public static final int GLU_VERSION = 100800;
+public static final int GLU_EXTENSIONS = 100801;
+
+// Extensions
+public static final String versionString = "1.3";
+public static final String extensionString = "GLU_EXT_nurbs_tessellator " +
+ "GLU_EXT_object_space_tess ";
+
+// ErrorCode
+public static final int GLU_INVALID_ENUM = 100900;
+public static final int GLU_INVALID_VALUE = 100901;
+public static final int GLU_OUT_OF_MEMORY = 100902;
+public static final int GLU_INVALID_OPERATION = 100904;
+
+/*************
+
+//----------------------------------------------------------------------
+// Mipmap and image scaling functionality
+
+
+// Boolean
+public static final int GLU_FALSE = 0;
+public static final int GLU_TRUE = 1;
+
+// String Name
+public static final int GLU_VERSION = 100800;
+public static final int GLU_EXTENSIONS = 100801;
+
+// Extensions
+public static final String versionString = "1.3";
+public static final String extensionString = "GLU_EXT_nurbs_tessellator " +
+ "GLU_EXT_object_space_tess ";
+
+// ErrorCode
+public static final int GLU_INVALID_ENUM = 100900;
+public static final int GLU_INVALID_VALUE = 100901;
+public static final int GLU_OUT_OF_MEMORY = 100902;
+public static final int GLU_INVALID_OPERATION = 100904;
+
+private java.nio.ByteBuffer copyToByteBuffer(java.nio.Buffer buf) {
+ if (buf instanceof java.nio.ByteBuffer) {
+ if (buf.position() == 0) {
+ return (java.nio.ByteBuffer) buf;
+ }
+ return BufferUtil.copyByteBuffer((java.nio.ByteBuffer) buf);
+ } else if (buf instanceof java.nio.ShortBuffer) {
+ return BufferUtil.copyShortBufferAsByteBuffer((java.nio.ShortBuffer) buf);
+ } else if (buf instanceof java.nio.IntBuffer) {
+ return BufferUtil.copyIntBufferAsByteBuffer((java.nio.IntBuffer) buf);
+ } else if (buf instanceof java.nio.FloatBuffer) {
+ return BufferUtil.copyFloatBufferAsByteBuffer((java.nio.FloatBuffer) buf);
+ } else {
+ throw new IllegalArgumentException("Unsupported buffer type (must be one of byte, short, int, or float)");
+ }
+}
+
+private int gluScaleImageJava( int format, int widthin, int heightin,
+ int typein, java.nio.Buffer datain, int widthout, int heightout,
+ int typeout, java.nio.Buffer dataout ) {
+ java.nio.ByteBuffer in = null;
+ java.nio.ByteBuffer out = null;
+ in = copyToByteBuffer(datain);
+ if( dataout instanceof java.nio.ByteBuffer ) {
+ out = (java.nio.ByteBuffer)dataout;
+ } else if( dataout instanceof java.nio.ShortBuffer ) {
+ out = BufferUtil.newByteBuffer(dataout.remaining() * BufferUtil.SIZEOF_SHORT);
+ } else if ( dataout instanceof java.nio.IntBuffer ) {
+ out = BufferUtil.newByteBuffer(dataout.remaining() * BufferUtil.SIZEOF_INT);
+ } else if ( dataout instanceof java.nio.FloatBuffer ) {
+ out = BufferUtil.newByteBuffer(dataout.remaining() * BufferUtil.SIZEOF_FLOAT);
+ } else {
+ throw new IllegalArgumentException("Unsupported destination buffer type (must be byte, short, int, or float)");
+ }
+ int errno = Mipmap.gluScaleImage( getCurrentGL(), format, widthin, heightin, typein, in,
+ widthout, heightout, typeout, out );
+ if( errno == 0 ) {
+ out.rewind();
+ if (out != dataout) {
+ if( dataout instanceof java.nio.ShortBuffer ) {
+ ((java.nio.ShortBuffer) dataout).put(out.asShortBuffer());
+ } else if( dataout instanceof java.nio.IntBuffer ) {
+ ((java.nio.IntBuffer) dataout).put(out.asIntBuffer());
+ } else if( dataout instanceof java.nio.FloatBuffer ) {
+ ((java.nio.FloatBuffer) dataout).put(out.asFloatBuffer());
+ } else {
+ throw new RuntimeException("Should not reach here");
+ }
+ }
+ }
+ return( errno );
+}
+
+
+private int gluBuild1DMipmapLevelsJava( int target, int internalFormat, int width,
+ int format, int type, int userLevel, int baseLevel, int maxLevel,
+ java.nio.Buffer data ) {
+ java.nio.ByteBuffer buffer = copyToByteBuffer(data);
+ return( Mipmap.gluBuild1DMipmapLevels( getCurrentGL(), target, internalFormat, width,
+ format, type, userLevel, baseLevel, maxLevel, buffer ) );
+}
+
+
+private int gluBuild1DMipmapsJava( int target, int internalFormat, int width,
+ int format, int type, java.nio.Buffer data ) {
+ java.nio.ByteBuffer buffer = copyToByteBuffer(data);
+ return( Mipmap.gluBuild1DMipmaps( getCurrentGL(), target, internalFormat, width, format,
+ type, buffer ) );
+}
+
+
+private int gluBuild2DMipmapLevelsJava( int target, int internalFormat, int width,
+ int height, int format, int type, int userLevel, int baseLevel,
+ int maxLevel, java.nio.Buffer data ) {
+ // While the code below handles other data types, it doesn't handle non-ByteBuffers
+ data = copyToByteBuffer(data);
+ return( Mipmap.gluBuild2DMipmapLevels( getCurrentGL(), target, internalFormat, width,
+ height, format, type, userLevel, baseLevel, maxLevel, data ) );
+}
+
+private int gluBuild2DMipmapsJava( int target, int internalFormat, int width,
+ int height, int format, int type, java.nio.Buffer data ) {
+ // While the code below handles other data types, it doesn't handle non-ByteBuffers
+ data = copyToByteBuffer(data);
+ return( Mipmap.gluBuild2DMipmaps( getCurrentGL(), target, internalFormat, width, height,
+ format, type, data) );
+}
+
+private int gluBuild3DMipmapLevelsJava( int target, int internalFormat, int width,
+ int height, int depth, int format, int type, int userLevel, int baseLevel,
+ int maxLevel, java.nio.Buffer data) {
+ java.nio.ByteBuffer buffer = copyToByteBuffer(data);
+ return( Mipmap.gluBuild3DMipmapLevels( getCurrentGL(), target, internalFormat, width,
+ height, depth, format, type, userLevel, baseLevel, maxLevel, buffer) );
+}
+
+private int gluBuild3DMipmapsJava( int target, int internalFormat, int width,
+ int height, int depth, int format, int type, java.nio.Buffer data ) {
+ java.nio.ByteBuffer buffer = copyToByteBuffer(data);
+ return( Mipmap.gluBuild3DMipmaps( getCurrentGL(), target, internalFormat, width, height,
+ depth, format, type, buffer ) );
+}
+
+*********************/
+
+//----------------------------------------------------------------------
+// Wrappers for mipmap and image scaling entry points which dispatch either
+// to the Java or C versions.
+//
+
+/** Interface to C language function: <br> <code> GLint gluBuild1DMipmapLevels(GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void * data); </code> */
+/*
+public int gluBuild1DMipmapLevels(int target, int internalFormat, int width, int format, int type, int level, int base, int max, java.nio.Buffer data) {
+ if (useJavaMipmapCode) {
+ return gluBuild1DMipmapLevelsJava(target, internalFormat, width, format, type, level, base, max, data);
+ } else {
+ return gluBuild1DMipmapLevelsC(target, internalFormat, width, format, type, level, base, max, data);
+ }
+}
+*/
+
+/** Interface to C language function: <br> <code> GLint gluBuild1DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void * data); </code> */
+/*
+public int gluBuild1DMipmaps(int target, int internalFormat, int width, int format, int type, java.nio.Buffer data) {
+ if (useJavaMipmapCode) {
+ return gluBuild1DMipmapsJava(target, internalFormat, width, format, type, data);
+ } else {
+ return gluBuild1DMipmapsC(target, internalFormat, width, format, type, data);
+ }
+}
+*/
+
+/** Interface to C language function: <br> <code> GLint gluBuild2DMipmapLevels(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void * data); </code> */
+/*
+public int gluBuild2DMipmapLevels(int target, int internalFormat, int width, int height, int format, int type, int level, int base, int max, java.nio.Buffer data) {
+ if (useJavaMipmapCode) {
+ return gluBuild2DMipmapLevelsJava(target, internalFormat, width, height, format, type, level, base, max, data);
+ } else {
+ return gluBuild2DMipmapLevelsC(target, internalFormat, width, height, format, type, level, base, max, data);
+ }
+}
+*/
+
+/** Interface to C language function: <br> <code> GLint gluBuild2DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * data); </code> */
+/*
+public int gluBuild2DMipmaps(int target, int internalFormat, int width, int height, int format, int type, java.nio.Buffer data) {
+ if (useJavaMipmapCode) {
+ return gluBuild2DMipmapsJava(target, internalFormat, width, height, format, type, data);
+ } else {
+ return gluBuild2DMipmapsC(target, internalFormat, width, height, format, type, data);
+ }
+}
+*/
+
+/** Interface to C language function: <br> <code> GLint gluBuild3DMipmapLevels(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void * data); </code> */
+/*
+public int gluBuild3DMipmapLevels(int target, int internalFormat, int width, int height, int depth, int format, int type, int level, int base, int max, java.nio.Buffer data) {
+ if (useJavaMipmapCode) {
+ return gluBuild3DMipmapLevelsJava(target, internalFormat, width, height, depth, format, type, level, base, max, data);
+ } else {
+ return gluBuild3DMipmapLevelsC(target, internalFormat, width, height, depth, format, type, level, base, max, data);
+ }
+}
+*/
+
+/** Interface to C language function: <br> <code> GLint gluBuild3DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * data); </code> */
+/*
+public int gluBuild3DMipmaps(int target, int internalFormat, int width, int height, int depth, int format, int type, java.nio.Buffer data) {
+ if (useJavaMipmapCode) {
+ return gluBuild3DMipmapsJava(target, internalFormat, width, height, depth, format, type, data);
+ } else {
+ return gluBuild3DMipmapsC(target, internalFormat, width, height, depth, format, type, data);
+ }
+}
+*/
+
+/** Interface to C language function: <br> <code> GLint gluScaleImage(GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void * dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid * dataOut); </code> */
+/*
+public int gluScaleImage(int format, int wIn, int hIn, int typeIn, java.nio.Buffer dataIn, int wOut, int hOut, int typeOut, java.nio.Buffer dataOut) {
+ if (useJavaMipmapCode) {
+ return gluScaleImageJava(format, wIn, hIn, typeIn, dataIn, wOut, hOut, typeOut, dataOut);
+ } else {
+ return gluScaleImageC(format, wIn, hIn, typeIn, dataIn, wOut, hOut, typeOut, dataOut);
+ }
+}
+*/
+
+//----------------------------------------------------------------------
+// GLUProcAddressTable handling
+//
+
+/*
+private static GLUProcAddressTable gluProcAddressTable;
+private static volatile boolean gluLibraryLoaded;
+
+private static GLUProcAddressTable getGLUProcAddressTable() {
+ if (!gluLibraryLoaded) {
+ loadGLULibrary();
+ }
+ if (gluProcAddressTable == null) {
+ GLUProcAddressTable tmp = new GLUProcAddressTable();
+ ProcAddressHelper.resetProcAddressTable(tmp, GLDrawableFactoryImpl.getFactoryImpl());
+ gluProcAddressTable = tmp;
+ }
+ return gluProcAddressTable;
+}
+
+private static synchronized void loadGLULibrary() {
+ if (!gluLibraryLoaded) {
+ GLDrawableFactoryImpl.getFactoryImpl().loadGLULibrary();
+ gluLibraryLoaded = true;
+ }
+}
+*/
diff --git a/make/glu-CustomJavaCode-gles2.java b/make/glu-CustomJavaCode-gles2.java
new file mode 100755
index 000000000..dc036ac1a
--- /dev/null
+++ b/make/glu-CustomJavaCode-gles2.java
@@ -0,0 +1,38 @@
+/**
+ * Instantiates a new OpenGL Utility Library object. A GLU object may
+ * be instantiated at any point in the application and is not
+ * inherently tied to any particular OpenGL context; however, the GLU
+ * object may only be used when an OpenGL context is current on the
+ * current thread. Attempts to call most of the methods in the GLU
+ * library when no OpenGL context is current will cause an exception
+ * to be thrown.
+ *
+ * <P>
+ *
+ * The returned GLU object is not guaranteed to be thread-safe and
+ * should only be used from one thread at a time. Multiple GLU objects
+ * may be instantiated to be used from different threads
+ * simultaneously.
+ */
+
+public GLU()
+{
+}
+
+//----------------------------------------------------------------------
+// Utility routines
+//
+
+/**
+ * Returns the GL object associated with the OpenGL context current on
+ * the current thread. Throws GLException if no OpenGL context is
+ * current.
+ */
+
+public static GL getCurrentGL() throws GLException {
+ GLContext curContext = GLContext.getCurrent();
+ if (curContext == null) {
+ throw new GLException("No OpenGL context current on this thread");
+ }
+ return curContext.getGL();
+}
diff --git a/make/glu-common.cfg b/make/glu-common.cfg
index 679e4aef4..b5a92819b 100644
--- a/make/glu-common.cfg
+++ b/make/glu-common.cfg
@@ -7,11 +7,6 @@ JavaOutputDir ../build/gensrc/classes
NativeOutputDir ../build/gensrc/native/jogl
HierarchicalNativeOutput false
-EmitProcAddressTable true
-ProcAddressTablePackage com.sun.opengl.impl
-ProcAddressTableClassName GLUProcAddressTable
-GetProcAddressTableExpr getGLUProcAddressTable()
-
# Pick up on-line OpenGL javadoc thanks to user cylab on javagaming.org forums
TagNativeBinding true
@@ -23,23 +18,6 @@ Import javax.media.opengl.*
Import javax.media.opengl.glu.*
Import com.sun.opengl.impl.*
-# GLU needs access to the GLUtesselatorImpl class for GLUtesselator,
-# to the Mipmap class for scaling and mipmap generation,
-# and to the nurbs.* package for the NURBS functionality
-Import com.sun.opengl.impl.tessellator.GLUtessellatorImpl
-Import com.sun.opengl.impl.error.Error
-Import com.sun.opengl.impl.mipmap.Mipmap
-Import com.sun.opengl.impl.registry.Registry
-Import com.sun.opengl.impl.nurbs.*
-Import com.sun.opengl.util.*
-Import java.security.*
-
-# Custom Java code for GLU class
-IncludeAs CustomJavaCode GLU glu-CustomJavaCode.java
-
-CustomCCode /* Include the OpenGL GLU header */
-CustomCCode #include <GL/glu.h>
-
# Raise GLException instead of RuntimeException in glue code
RuntimeExceptionType GLException
@@ -199,56 +177,3 @@ Ignore gluOrtho2D
Ignore gluPerspective
Ignore gluLookAt
Ignore gluPickMatrix
-
-
-
-
-
-#
-# Some functions that return native byte pointers or accept them as
-# arguments should have them auto-converted to Java Strings
-#
-# ReturnsString gluGetString
-# ReturnsString gluErrorString
-# ArgumentIsString gluCheckExtension 0 1
-
-#
-# Some routines should only use the Java New IO package
-#
-#NIOOnly gluScaleImage
-#NIOOnly gluBuild1DMipmaps
-#NIOOnly gluBuild2DMipmaps
-#NIOOnly gluBuild3DMipmaps
-#NIOOnly gluBuild1DMipmapLevels
-#NIOOnly gluBuild2DMipmapLevels
-#NIOOnly gluBuild3DMipmapLevels
-
-#
-# ------------------------
-# Mipmaps
-# ------------------------
-#
-# Ignore the C versions of the mipmap code in the public interface and
-# use GKW's Java port instead. The bindings to the C entry points are
-# still being left in for now, but only for debugging purposes and the
-# intent is to remove them in a future release.
-
-# Emit these entry points as private
-
-AccessControl gluBuild1DMipmapLevels PRIVATE
-AccessControl gluBuild1DMipmaps PRIVATE
-AccessControl gluBuild2DMipmapLevels PRIVATE
-AccessControl gluBuild2DMipmaps PRIVATE
-AccessControl gluBuild3DMipmapLevels PRIVATE
-AccessControl gluBuild3DMipmaps PRIVATE
-AccessControl gluScaleImage PRIVATE
-
-# Rename these methods in the implementing class
-
-RenameJavaMethod gluBuild1DMipmapLevels gluBuild1DMipmapLevelsC
-RenameJavaMethod gluBuild1DMipmaps gluBuild1DMipmapsC
-RenameJavaMethod gluBuild2DMipmapLevels gluBuild2DMipmapLevelsC
-RenameJavaMethod gluBuild2DMipmaps gluBuild2DMipmapsC
-RenameJavaMethod gluBuild3DMipmapLevels gluBuild3DMipmapLevelsC
-RenameJavaMethod gluBuild3DMipmaps gluBuild3DMipmapsC
-RenameJavaMethod gluScaleImage gluScaleImageC
diff --git a/make/glu-desktop.cfg b/make/glu-desktop.cfg
new file mode 100755
index 000000000..6ff160e80
--- /dev/null
+++ b/make/glu-desktop.cfg
@@ -0,0 +1,53 @@
+EmitProcAddressTable true
+ProcAddressTablePackage com.sun.opengl.impl
+ProcAddressTableClassName GLUProcAddressTable
+GetProcAddressTableExpr getGLUProcAddressTable()
+
+CustomCCode /* Include the OpenGL GLU header */
+CustomCCode #include <GL/glu.h>
+
+# Custom Java code for GLU class
+IncludeAs CustomJavaCode GLU glu-CustomJavaCode.java
+
+# GLU needs access to the GLUtesselatorImpl class for GLUtesselator,
+# to the Mipmap class for scaling and mipmap generation,
+# and to the nurbs.* package for the NURBS functionality
+Import com.sun.opengl.impl.tessellator.GLUtessellatorImpl
+Import com.sun.opengl.impl.error.Error
+Import com.sun.opengl.impl.mipmap.Mipmap
+Import com.sun.opengl.impl.registry.Registry
+Import com.sun.opengl.impl.nurbs.*
+Import com.sun.opengl.util.*
+Import java.security.*
+
+#
+# ------------------------
+# Mipmaps
+# ------------------------
+#
+# Ignore the C versions of the mipmap code in the public interface and
+# use GKW's Java port instead. The bindings to the C entry points are
+# still being left in for now, but only for debugging purposes and the
+# intent is to remove them in a future release.
+
+# Emit these entry points as private
+
+AccessControl gluBuild1DMipmapLevels PRIVATE
+AccessControl gluBuild1DMipmaps PRIVATE
+AccessControl gluBuild2DMipmapLevels PRIVATE
+AccessControl gluBuild2DMipmaps PRIVATE
+AccessControl gluBuild3DMipmapLevels PRIVATE
+AccessControl gluBuild3DMipmaps PRIVATE
+AccessControl gluScaleImage PRIVATE
+
+# Rename these methods in the implementing class
+
+RenameJavaMethod gluBuild1DMipmapLevels gluBuild1DMipmapLevelsC
+RenameJavaMethod gluBuild1DMipmaps gluBuild1DMipmapsC
+RenameJavaMethod gluBuild2DMipmapLevels gluBuild2DMipmapLevelsC
+RenameJavaMethod gluBuild2DMipmaps gluBuild2DMipmapsC
+RenameJavaMethod gluBuild3DMipmapLevels gluBuild3DMipmapLevelsC
+RenameJavaMethod gluBuild3DMipmaps gluBuild3DMipmapsC
+RenameJavaMethod gluScaleImage gluScaleImageC
+
+Include glu-common.cfg
diff --git a/make/glu-es1.cfg b/make/glu-es1.cfg
new file mode 100755
index 000000000..4aa982ecf
--- /dev/null
+++ b/make/glu-es1.cfg
@@ -0,0 +1,15 @@
+# This .cfg file is used to generate the GLU implementation for OpenGL ES 1.0,
+# where it is pure Java.
+
+Ignore gluBuild1DMipmapLevels
+Ignore gluBuild1DMipmaps
+Ignore gluBuild2DMipmapLevels
+Ignore gluBuild2DMipmaps
+Ignore gluBuild3DMipmapLevels
+Ignore gluBuild3DMipmaps
+Ignore gluScaleImage
+
+# Custom Java code for GLU class
+IncludeAs CustomJavaCode GLU glu-CustomJavaCode-gles1.java
+
+Include glu-common.cfg
diff --git a/make/glu-macosx.cfg b/make/glu-macosx.cfg
index ef106a3eb..85d75b3c5 100755
--- a/make/glu-macosx.cfg
+++ b/make/glu-macosx.cfg
@@ -6,4 +6,4 @@ CustomCCode #include <jni.h>
CustomCCode #include </usr/include/machine/types.h>
-Include glu-common.cfg
+Include glu-desktop.cfg
diff --git a/make/glu-win32.cfg b/make/glu-win32.cfg
index 5221a5c01..341a88e98 100755
--- a/make/glu-win32.cfg
+++ b/make/glu-win32.cfg
@@ -11,5 +11,4 @@ CustomCCode #if _MSC_VER <= 1200
CustomCCode typedef int intptr_t;
CustomCCode #endif
-Include glu-common.cfg
-
+Include glu-desktop.cfg
diff --git a/make/glu-x11.cfg b/make/glu-x11.cfg
index ec7b1bce4..8b204fe2c 100755
--- a/make/glu-x11.cfg
+++ b/make/glu-x11.cfg
@@ -3,5 +3,5 @@
CustomCCode #include <inttypes.h>
-Include glu-common.cfg
+Include glu-desktop.cfg
diff --git a/make/stub_includes/common/gles1.c b/make/stub_includes/common/gles1.c
new file mode 100755
index 000000000..63df1c967
--- /dev/null
+++ b/make/stub_includes/common/gles1.c
@@ -0,0 +1,9 @@
+#define GLAPI
+#define GL_APICALL
+
+// Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in
+// "glext.h" are parsed.
+#define GL_GLEXT_PROTOTYPES
+
+#include <GLES/gl.h>
+#include <GLES/glext.h>
diff --git a/make/stub_includes/common/gles2.c b/make/stub_includes/common/gles2.c
new file mode 100755
index 000000000..d0b44a46f
--- /dev/null
+++ b/make/stub_includes/common/gles2.c
@@ -0,0 +1,8 @@
+#define GLAPI
+#define GL_APICALL
+
+// Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in
+// "glext.h" are parsed.
+#define GL_GLEXT_PROTOTYPES
+
+#include <GLES2/gl2ext.h>
diff --git a/make/stub_includes/opengl/GLES/gl.h b/make/stub_includes/opengl/GLES/gl.h
new file mode 100755
index 000000000..da71230b5
--- /dev/null
+++ b/make/stub_includes/opengl/GLES/gl.h
@@ -0,0 +1,801 @@
+#ifndef __gl_h_
+#define __gl_h_
+
+/* $Id$ */
+
+#include <GLES/glplatform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.0 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+*/
+
+typedef unsigned int GLenum;
+typedef unsigned char GLboolean;
+typedef unsigned int GLbitfield;
+typedef signed char GLbyte;
+typedef short GLshort;
+typedef int GLint;
+typedef int GLsizei;
+typedef unsigned char GLubyte;
+typedef unsigned short GLushort;
+typedef unsigned int GLuint;
+typedef float GLfloat;
+typedef float GLclampf;
+typedef void GLvoid;
+typedef int GLfixed;
+typedef int GLclampx;
+
+typedef int GLintptr;
+typedef int GLsizeiptr;
+
+
+/*************************************************************/
+
+/* OpenGL ES core versions */
+#define GL_VERSION_ES_CM_1_0 1
+#define GL_VERSION_ES_CL_1_0 1
+#define GL_VERSION_ES_CM_1_1 1
+#define GL_VERSION_ES_CL_1_1 1
+
+/* ClearBufferMask */
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+
+/* Boolean */
+#define GL_FALSE 0
+#define GL_TRUE 1
+
+/* BeginMode */
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+
+/* AlphaFunction */
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+
+/* BlendingFactorDest */
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+
+/* BlendingFactorSrc */
+/* GL_ZERO */
+/* GL_ONE */
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+/* GL_SRC_ALPHA */
+/* GL_ONE_MINUS_SRC_ALPHA */
+/* GL_DST_ALPHA */
+/* GL_ONE_MINUS_DST_ALPHA */
+
+/* ClipPlaneName */
+#define GL_CLIP_PLANE0 0x3000
+#define GL_CLIP_PLANE1 0x3001
+#define GL_CLIP_PLANE2 0x3002
+#define GL_CLIP_PLANE3 0x3003
+#define GL_CLIP_PLANE4 0x3004
+#define GL_CLIP_PLANE5 0x3005
+
+/* ColorMaterialFace */
+/* GL_FRONT_AND_BACK */
+
+/* ColorMaterialParameter */
+/* GL_AMBIENT_AND_DIFFUSE */
+
+/* ColorPointerType */
+/* GL_UNSIGNED_BYTE */
+/* GL_FLOAT */
+/* GL_FIXED */
+
+/* CullFaceMode */
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+
+/* DepthFunction */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* EnableCap */
+#define GL_FOG 0x0B60
+#define GL_LIGHTING 0x0B50
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_CULL_FACE 0x0B44
+#define GL_ALPHA_TEST 0x0BC0
+#define GL_BLEND 0x0BE2
+#define GL_COLOR_LOGIC_OP 0x0BF2
+#define GL_DITHER 0x0BD0
+#define GL_STENCIL_TEST 0x0B90
+#define GL_DEPTH_TEST 0x0B71
+/* GL_LIGHT0 */
+/* GL_LIGHT1 */
+/* GL_LIGHT2 */
+/* GL_LIGHT3 */
+/* GL_LIGHT4 */
+/* GL_LIGHT5 */
+/* GL_LIGHT6 */
+/* GL_LIGHT7 */
+#define GL_POINT_SMOOTH 0x0B10
+#define GL_LINE_SMOOTH 0x0B20
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_COLOR_MATERIAL 0x0B57
+#define GL_NORMALIZE 0x0BA1
+#define GL_RESCALE_NORMAL 0x803A
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_VERTEX_ARRAY 0x8074
+#define GL_NORMAL_ARRAY 0x8075
+#define GL_COLOR_ARRAY 0x8076
+#define GL_TEXTURE_COORD_ARRAY 0x8078
+#define GL_MULTISAMPLE 0x809D
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
+#define GL_SAMPLE_COVERAGE 0x80A0
+
+/* ErrorCode */
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_STACK_OVERFLOW 0x0503
+#define GL_STACK_UNDERFLOW 0x0504
+#define GL_OUT_OF_MEMORY 0x0505
+
+/* FogMode */
+/* GL_LINEAR */
+#define GL_EXP 0x0800
+#define GL_EXP2 0x0801
+
+/* FogParameter */
+#define GL_FOG_DENSITY 0x0B62
+#define GL_FOG_START 0x0B63
+#define GL_FOG_END 0x0B64
+#define GL_FOG_MODE 0x0B65
+#define GL_FOG_COLOR 0x0B66
+
+/* FrontFaceDirection */
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+
+/* GetPName */
+#define GL_CURRENT_COLOR 0x0B00
+#define GL_CURRENT_NORMAL 0x0B02
+#define GL_CURRENT_TEXTURE_COORDS 0x0B03
+#define GL_POINT_SIZE 0x0B11
+#define GL_POINT_SIZE_MIN 0x8126
+#define GL_POINT_SIZE_MAX 0x8127
+#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
+#define GL_POINT_DISTANCE_ATTENUATION 0x8129
+#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
+#define GL_LINE_WIDTH 0x0B21
+#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_SHADE_MODEL 0x0B54
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_MATRIX_MODE 0x0BA0
+#define GL_VIEWPORT 0x0BA2
+#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
+#define GL_PROJECTION_STACK_DEPTH 0x0BA4
+#define GL_TEXTURE_STACK_DEPTH 0x0BA5
+#define GL_MODELVIEW_MATRIX 0x0BA6
+#define GL_PROJECTION_MATRIX 0x0BA7
+#define GL_TEXTURE_MATRIX 0x0BA8
+#define GL_ALPHA_TEST_FUNC 0x0BC1
+#define GL_ALPHA_TEST_REF 0x0BC2
+#define GL_BLEND_DST 0x0BE0
+#define GL_BLEND_SRC 0x0BE1
+#define GL_LOGIC_OP_MODE 0x0BF0
+#define GL_SCISSOR_BOX 0x0C10
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_MAX_LIGHTS 0x0D31
+#define GL_MAX_CLIP_PLANES 0x0D32
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
+#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
+#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_MAX_TEXTURE_UNITS 0x84E2
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_ALPHA_BITS 0x0D55
+#define GL_DEPTH_BITS 0x0D56
+#define GL_STENCIL_BITS 0x0D57
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_VERTEX_ARRAY_SIZE 0x807A
+#define GL_VERTEX_ARRAY_TYPE 0x807B
+#define GL_VERTEX_ARRAY_STRIDE 0x807C
+#define GL_NORMAL_ARRAY_TYPE 0x807E
+#define GL_NORMAL_ARRAY_STRIDE 0x807F
+#define GL_COLOR_ARRAY_SIZE 0x8081
+#define GL_COLOR_ARRAY_TYPE 0x8082
+#define GL_COLOR_ARRAY_STRIDE 0x8083
+#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
+#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
+#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
+#define GL_VERTEX_ARRAY_POINTER 0x808E
+#define GL_NORMAL_ARRAY_POINTER 0x808F
+#define GL_COLOR_ARRAY_POINTER 0x8090
+#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+
+/* GetTextureParameter */
+/* GL_TEXTURE_MAG_FILTER */
+/* GL_TEXTURE_MIN_FILTER */
+/* GL_TEXTURE_WRAP_S */
+/* GL_TEXTURE_WRAP_T */
+
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+
+/* HintMode */
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+
+/* HintTarget */
+#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
+#define GL_POINT_SMOOTH_HINT 0x0C51
+#define GL_LINE_SMOOTH_HINT 0x0C52
+#define GL_FOG_HINT 0x0C54
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+
+/* LightModelParameter */
+#define GL_LIGHT_MODEL_AMBIENT 0x0B53
+#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
+
+/* LightParameter */
+#define GL_AMBIENT 0x1200
+#define GL_DIFFUSE 0x1201
+#define GL_SPECULAR 0x1202
+#define GL_POSITION 0x1203
+#define GL_SPOT_DIRECTION 0x1204
+#define GL_SPOT_EXPONENT 0x1205
+#define GL_SPOT_CUTOFF 0x1206
+#define GL_CONSTANT_ATTENUATION 0x1207
+#define GL_LINEAR_ATTENUATION 0x1208
+#define GL_QUADRATIC_ATTENUATION 0x1209
+
+/* DataType */
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_FLOAT 0x1406
+#define GL_FIXED 0x140C
+
+/* LogicOp */
+#define GL_CLEAR 0x1500
+#define GL_AND 0x1501
+#define GL_AND_REVERSE 0x1502
+#define GL_COPY 0x1503
+#define GL_AND_INVERTED 0x1504
+#define GL_NOOP 0x1505
+#define GL_XOR 0x1506
+#define GL_OR 0x1507
+#define GL_NOR 0x1508
+#define GL_EQUIV 0x1509
+#define GL_INVERT 0x150A
+#define GL_OR_REVERSE 0x150B
+#define GL_COPY_INVERTED 0x150C
+#define GL_OR_INVERTED 0x150D
+#define GL_NAND 0x150E
+#define GL_SET 0x150F
+
+/* MaterialFace */
+/* GL_FRONT_AND_BACK */
+
+/* MaterialParameter */
+#define GL_EMISSION 0x1600
+#define GL_SHININESS 0x1601
+#define GL_AMBIENT_AND_DIFFUSE 0x1602
+/* GL_AMBIENT */
+/* GL_DIFFUSE */
+/* GL_SPECULAR */
+
+/* MatrixMode */
+#define GL_MODELVIEW 0x1700
+#define GL_PROJECTION 0x1701
+#define GL_TEXTURE 0x1702
+
+/* NormalPointerType */
+/* GL_BYTE */
+/* GL_SHORT */
+/* GL_FLOAT */
+/* GL_FIXED */
+
+/* PixelFormat */
+#define GL_ALPHA 0x1906
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+
+/* PixelStoreParameter */
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+
+/* PixelType */
+/* GL_UNSIGNED_BYTE */
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+
+/* ShadingModel */
+#define GL_FLAT 0x1D00
+#define GL_SMOOTH 0x1D01
+
+/* StencilFunction */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* StencilOp */
+/* GL_ZERO */
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+/* GL_INVERT */
+
+/* StringName */
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+
+/* TexCoordPointerType */
+/* GL_SHORT */
+/* GL_FLOAT */
+/* GL_FIXED */
+/* GL_BYTE */
+
+/* TextureEnvMode */
+#define GL_MODULATE 0x2100
+#define GL_DECAL 0x2101
+/* GL_BLEND */
+#define GL_ADD 0x0104
+/* GL_REPLACE */
+
+/* TextureEnvParameter */
+#define GL_TEXTURE_ENV_MODE 0x2200
+#define GL_TEXTURE_ENV_COLOR 0x2201
+
+/* TextureEnvTarget */
+#define GL_TEXTURE_ENV 0x2300
+
+/* TextureMagFilter */
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+
+/* TextureMinFilter */
+/* GL_NEAREST */
+/* GL_LINEAR */
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+
+/* TextureParameterName */
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+#define GL_GENERATE_MIPMAP 0x8191
+
+/* TextureTarget */
+/* GL_TEXTURE_2D */
+
+/* TextureUnit */
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
+
+/* TextureWrapMode */
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+
+/* VertexPointerType */
+/* GL_SHORT */
+/* GL_FLOAT */
+/* GL_FIXED */
+/* GL_BYTE */
+
+/* LightName */
+#define GL_LIGHT0 0x4000
+#define GL_LIGHT1 0x4001
+#define GL_LIGHT2 0x4002
+#define GL_LIGHT3 0x4003
+#define GL_LIGHT4 0x4004
+#define GL_LIGHT5 0x4005
+#define GL_LIGHT6 0x4006
+#define GL_LIGHT7 0x4007
+
+/* Buffer Objects */
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
+#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
+#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
+#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
+
+#define GL_STATIC_DRAW 0x88E4
+#define GL_DYNAMIC_DRAW 0x88E8
+
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+
+/* Texture combine + dot3 */
+#define GL_SUBTRACT 0x84E7
+#define GL_COMBINE 0x8570
+#define GL_COMBINE_RGB 0x8571
+#define GL_COMBINE_ALPHA 0x8572
+#define GL_RGB_SCALE 0x8573
+#define GL_ADD_SIGNED 0x8574
+#define GL_INTERPOLATE 0x8575
+#define GL_CONSTANT 0x8576
+#define GL_PRIMARY_COLOR 0x8577
+#define GL_PREVIOUS 0x8578
+#define GL_OPERAND0_RGB 0x8590
+#define GL_OPERAND1_RGB 0x8591
+#define GL_OPERAND2_RGB 0x8592
+#define GL_OPERAND0_ALPHA 0x8598
+#define GL_OPERAND1_ALPHA 0x8599
+#define GL_OPERAND2_ALPHA 0x859A
+
+#define GL_ALPHA_SCALE 0x0D1C
+
+#define GL_SRC0_RGB 0x8580
+#define GL_SRC1_RGB 0x8581
+#define GL_SRC2_RGB 0x8582
+#define GL_SRC0_ALPHA 0x8588
+#define GL_SRC1_ALPHA 0x8589
+#define GL_SRC2_ALPHA 0x858A
+
+#define GL_DOT3_RGB 0x86AE
+#define GL_DOT3_RGBA 0x86AF
+
+/*------------------------------------------------------------------------*
+ * required OES extension tokens
+ *------------------------------------------------------------------------*/
+
+/* OES_read_format */
+#ifndef GL_OES_read_format
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
+#endif
+
+/* GL_OES_compressed_paletted_texture */
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_PALETTE4_RGB8_OES 0x8B90
+#define GL_PALETTE4_RGBA8_OES 0x8B91
+#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
+#define GL_PALETTE4_RGBA4_OES 0x8B93
+#define GL_PALETTE4_RGB5_A1_OES 0x8B94
+#define GL_PALETTE8_RGB8_OES 0x8B95
+#define GL_PALETTE8_RGBA8_OES 0x8B96
+#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
+#define GL_PALETTE8_RGBA4_OES 0x8B98
+#define GL_PALETTE8_RGB5_A1_OES 0x8B99
+#endif
+
+/* OES_point_size_array */
+#ifndef GL_OES_point_size_array
+#define GL_POINT_SIZE_ARRAY_OES 0x8B9C
+#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A
+#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B
+#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C
+#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F
+#endif
+
+/* GL_OES_point_sprite */
+#ifndef GL_OES_point_sprite
+#define GL_POINT_SPRITE_OES 0x8861
+#define GL_COORD_REPLACE_OES 0x8862
+#endif
+
+/*************************************************************/
+
+/* Available only in Common profile */
+GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLclampf ref);
+GL_API void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+GL_API void GL_APIENTRY glClearDepthf (GLclampf depth);
+GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation);
+GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
+GL_API void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
+GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
+/* FIXME: GlueGen generates incorrect code for this one */
+/* GL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat eqn[4]); */
+GL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat* eqn);
+GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glGetTexEnvfv (GLenum tenv, GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glLineWidth (GLfloat width);
+GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m);
+GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m);
+GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
+GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
+GL_API void GL_APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
+GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glPointSize (GLfloat size);
+GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
+GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
+GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);
+GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);
+
+/* Available in both Common and Common-Lite profiles */
+GL_API void GL_APIENTRY glActiveTexture (GLenum texture);
+GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref);
+GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
+GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
+GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
+GL_API void GL_APIENTRY glClear (GLbitfield mask);
+GL_API void GL_APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
+GL_API void GL_APIENTRY glClearDepthx (GLclampx depth);
+GL_API void GL_APIENTRY glClearStencil (GLint s);
+GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture);
+GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation);
+GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
+GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
+GL_API void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
+GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_API void GL_APIENTRY glCullFace (GLenum mode);
+GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
+GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
+GL_API void GL_APIENTRY glDepthFunc (GLenum func);
+GL_API void GL_APIENTRY glDepthMask (GLboolean flag);
+GL_API void GL_APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar);
+GL_API void GL_APIENTRY glDisable (GLenum cap);
+GL_API void GL_APIENTRY glDisableClientState (GLenum array);
+GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
+GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
+GL_API void GL_APIENTRY glEnable (GLenum cap);
+GL_API void GL_APIENTRY glEnableClientState (GLenum array);
+GL_API void GL_APIENTRY glFinish (void);
+GL_API void GL_APIENTRY glFlush (void);
+GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glFrontFace (GLenum mode);
+GL_API void GL_APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
+GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *params);
+GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
+/* FIXME: GlueGen generates incorrect code for this one */
+/* GL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed eqn[4]); */
+GL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed* eqn);
+GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
+GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
+GL_API GLenum GL_APIENTRY glGetError (void);
+GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *params);
+GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetPointerv (GLenum pname, void **params);
+GL_API const GLubyte * GL_APIENTRY glGetString (GLenum name);
+GL_API void GL_APIENTRY glGetTexEnviv (GLenum tenv, GLenum pname, GLint *params);
+GL_API void GL_APIENTRY glGetTexEnvxv (GLenum tenv, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
+GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode);
+GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
+GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
+GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture);
+GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glLineWidthx (GLfixed width);
+GL_API void GL_APIENTRY glLoadIdentity (void);
+GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m);
+GL_API void GL_APIENTRY glLogicOp (GLenum opcode);
+GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glMatrixMode (GLenum mode);
+GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m);
+GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
+GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);
+GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);
+GL_API void GL_APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
+GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glPointSizex (GLfixed size);
+GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units);
+GL_API void GL_APIENTRY glPopMatrix (void);
+GL_API void GL_APIENTRY glPushMatrix (void);
+GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
+GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
+GL_API void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
+GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert);
+GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z);
+GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_API void GL_APIENTRY glShadeModel (GLenum mode);
+GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_API void GL_APIENTRY glStencilMask (GLuint mask);
+GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);
+GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);
+GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
+GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
+GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
+GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
+GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
+GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+
+/*------------------------------------------------------------------------*
+ * Required OES extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_OES_read_format */
+#ifndef GL_OES_read_format
+#define GL_OES_read_format 1
+#endif
+
+/* GL_OES_compressed_paletted_texture */
+#ifndef GL_OES_compressed_paletted_texture
+#define GL_OES_compressed_paletted_texture 1
+#endif
+
+/* GL_OES_point_size_array */
+#ifndef GL_OES_point_size_array
+#define GL_OES_point_size_array 1
+GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif
+
+/* GL_OES_point_sprite */
+#ifndef GL_OES_point_sprite
+#define GL_OES_point_sprite 1
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl_h_ */
diff --git a/make/stub_includes/opengl/GLES/glext.h b/make/stub_includes/opengl/GLES/glext.h
new file mode 100755
index 000000000..ee6ebae20
--- /dev/null
+++ b/make/stub_includes/opengl/GLES/glext.h
@@ -0,0 +1,662 @@
+/*
+ * Copyright (c) 2007 NVIDIA Corporation. All rights reserved.
+ *
+ * NVIDIA Corporation and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA Corporation is strictly prohibited.
+ */
+
+#ifndef __glext_h_
+#define __glext_h_
+
+/* $Id$ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.0 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+*/
+
+#ifndef GL_APIENTRYP
+# define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+/*------------------------------------------------------------------------*
+ * OES extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_OES_blend_equation_separate */
+#ifndef GL_OES_blend_equation_separate
+/* BLEND_EQUATION_RGB_OES same as BLEND_EQUATION_OES */
+#define GL_BLEND_EQUATION_RGB_OES 0x8009
+#define GL_BLEND_EQUATION_ALPHA_OES 0x883D
+#endif
+
+/* GL_OES_blend_func_separate */
+#ifndef GL_OES_blend_func_separate
+#define GL_BLEND_DST_RGB_OES 0x80C8
+#define GL_BLEND_SRC_RGB_OES 0x80C9
+#define GL_BLEND_DST_ALPHA_OES 0x80CA
+#define GL_BLEND_SRC_ALPHA_OES 0x80CB
+#endif
+
+/* GL_OES_blend_subtract */
+#ifndef GL_OES_blend_subtract
+#define GL_BLEND_EQUATION_OES 0x8009
+#define GL_FUNC_ADD_OES 0x8006
+#define GL_FUNC_SUBTRACT_OES 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT_OES 0x800B
+#endif
+
+/* GL_OES_compressed_ETC1_RGB8_texture */
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_ETC1_RGB8_OES 0x8D64
+#endif
+
+/* OES_draw_texture */
+#ifndef GL_OES_draw_texture
+#define GL_TEXTURE_CROP_RECT_OES 0x8B9D
+#endif
+
+/* OES_fixed_point */
+#ifndef GL_OES_fixed_point
+#define GL_FIXED_OES 0x140C
+#endif
+
+/* OES_framebuffer_object */
+#ifndef GL_OES_framebuffer_object
+#define GL_NONE_OES 0
+#define GL_FRAMEBUFFER_OES 0x8D40
+#define GL_RENDERBUFFER_OES 0x8D41
+#define GL_RGBA4_OES 0x8056
+#define GL_RGB5_A1_OES 0x8057
+#define GL_RGB565_OES 0x8D62
+#define GL_DEPTH_COMPONENT16_OES 0x81A5
+#define GL_RENDERBUFFER_WIDTH_OES 0x8D42
+#define GL_RENDERBUFFER_HEIGHT_OES 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT_OES 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE_OES 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE_OES 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE_OES 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE_OES 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE_OES 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE_OES 0x8D55
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES 0x8CD3
+#define GL_COLOR_ATTACHMENT0_OES 0x8CE0
+#define GL_DEPTH_ATTACHMENT_OES 0x8D00
+#define GL_STENCIL_ATTACHMENT_OES 0x8D20
+#define GL_FRAMEBUFFER_COMPLETE_OES 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES 0x8CD9
+#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES 0x8CDA
+#define GL_FRAMEBUFFER_UNSUPPORTED_OES 0x8CDD
+#define GL_FRAMEBUFFER_BINDING_OES 0x8CA6
+#define GL_RENDERBUFFER_BINDING_OES 0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE_OES 0x84E8
+#define GL_INVALID_FRAMEBUFFER_OPERATION_OES 0x0506
+#endif
+
+/* OES_matrix_get */
+#ifndef GL_OES_matrix_get
+#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D
+#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E
+#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F
+#endif
+
+/* OES_matrix_palette */
+#ifndef GL_OES_matrix_palette
+#define GL_MAX_VERTEX_UNITS_OES 0x86A4
+#define GL_MAX_PALETTE_MATRICES_OES 0x8842
+#define GL_MATRIX_PALETTE_OES 0x8840
+#define GL_MATRIX_INDEX_ARRAY_OES 0x8844
+#define GL_WEIGHT_ARRAY_OES 0x86AD
+#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843
+#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846
+#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847
+#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848
+#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849
+#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E
+#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB
+#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9
+#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA
+#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC
+#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E
+#endif
+
+/* GL_OES_stencil_wrap */
+#ifndef GL_OES_stencil_wrap
+#define GL_INCR_WRAP_OES 0x8507
+#define GL_DECR_WRAP_OES 0x8508
+#endif
+
+/* GL_OES_texture_cube_map */
+#ifndef GL_OES_texture_cube_map
+#define GL_NORMAL_MAP_OES 0x8511
+#define GL_REFLECTION_MAP_OES 0x8512
+#define GL_TEXTURE_CUBE_MAP_OES 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP_OES 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x851A
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES 0x851C
+#define GL_TEXTURE_GEN_MODE_OES 0x2500
+#define GL_TEXTURE_GEN_STR_OES 0x8D60
+#endif
+
+/* GL_OES_texture_mirrored_repeat */
+#ifndef GL_OES_texture_mirrored_repeat
+#define GL_MIRRORED_REPEAT_OES 0x8370
+#endif
+
+/* GL_OES_EGL_image */
+#ifndef GL_OES_EGL_image
+typedef void* GLeglImageOES;
+#endif
+
+/* GL_OES_depth24 */
+#ifndef GL_OES_depth24
+#define GL_DEPTH_COMPONENT24_OES 0x81A6
+#endif
+
+/* GL_OES_depth32 */
+#ifndef GL_OES_depth32
+#define GL_DEPTH_COMPONENT32_OES 0x81A7
+#endif
+
+/* GL_OES_mapbuffer */
+#ifndef GL_OES_mapbuffer
+#define GL_WRITE_ONLY_OES 0x88B9
+#define GL_BUFFER_ACCESS_OES 0x88BB
+#define GL_BUFFER_MAPPED_OES 0x88BC
+#define GL_BUFFER_MAP_POINTER_OES 0x88BD
+#endif
+
+/* GL_OES_rgb8_rgba8 */
+#ifndef GL_OES_rgb8_rgba8
+#define GL_RGB8_OES 0x8051
+#define GL_RGBA8_OES 0x8058
+#endif
+
+/* GL_OES_stencil1 */
+#ifndef GL_OES_stencil1
+#define GL_STENCIL_INDEX1_OES 0x8D46
+#endif
+
+/* GL_OES_stencil4 */
+#ifndef GL_OES_stencil4
+#define GL_STENCIL_INDEX4_OES 0x8D47
+#endif
+
+/* GL_OES_stencil8 */
+#ifndef GL_OES_stencil8
+#define GL_STENCIL_INDEX8_OES 0x8D48
+#endif
+
+/* GL_OES_vertex_half_float */
+#ifndef GL_OES_vertex_half_float
+#define GL_HALF_FLOAT_OES 0x8D61
+#endif
+
+/* GL_AMD_compressed_3DC_texture */
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_3DC_X_AMD 0x87F9
+#define GL_3DC_XY_AMD 0x87FA
+#endif
+
+/* GL_AMD_compressed_ATC_texture */
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_ATC_RGB_AMD 0x8C92
+#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
+#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+#endif
+
+/* GL_EXT_texture_compression_dxt1 */
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
+#endif
+
+/* GL_EXT_texture_compression_s3tc */
+#ifndef GL_EXT_texture_compression_s3tc
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
+#endif
+
+/*------------------------------------------------------------------------*
+ * OES extension functions
+ *------------------------------------------------------------------------*/
+
+/* GL_OES_blend_equation_separate */
+#ifndef GL_OES_blend_equation_separate
+#define GL_OES_blend_equation_separate 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glBlendEquationSeparateOES (GLenum modeRGB, GLenum modeAlpha);
+#endif
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEOESPROC) (GLenum modeRGB, GLenum modeAlpha);
+#endif
+
+/* GL_OES_blend_func_separate */
+#ifndef GL_OES_blend_func_separate
+#define GL_OES_blend_func_separate 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glBlendFuncSeparateOES (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+#endif
+typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEOESPROC) (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+#endif
+
+/* GL_OES_blend_subtract */
+#ifndef GL_OES_blend_subtract
+#define GL_OES_blend_subtract 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glBlendEquationOES (GLenum mode);
+#endif
+typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONOESPROC) (GLenum mode);
+#endif
+
+/* GL_OES_byte_coordinates */
+#ifndef GL_OES_byte_coordinates
+#define GL_OES_byte_coordinates 1
+#endif
+
+/* GL_OES_compressed_ETC1_RGB8_texture */
+#ifndef GL_OES_compressed_ETC1_RGB8_texture
+#define GL_OES_compressed_ETC1_RGB8_texture 1
+#endif
+
+/* GL_OES_draw_texture */
+#ifndef GL_OES_draw_texture
+#define GL_OES_draw_texture 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
+GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height);
+GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
+GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort *coords);
+GL_API void GL_APIENTRY glDrawTexivOES (const GLint *coords);
+GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed *coords);
+GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
+GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords);
+#endif
+typedef void (GL_APIENTRYP PFNGLDRAWTEXSOESPROC) (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXIOESPROC) (GLint x, GLint y, GLint z, GLint width, GLint height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXXOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXSVOESPROC) (const GLshort *coords);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXIVOESPROC) (const GLint *coords);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXXVOESPROC) (const GLfixed *coords);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXFOESPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
+typedef void (GL_APIENTRYP PFNGLDRAWTEXFVOESPROC) (const GLfloat *coords);
+#endif
+
+/* GL_OES_extended_matrix_palette */
+#ifndef GL_OES_extended_matrix_palette
+#define GL_OES_extended_matrix_palette 1
+#endif
+
+/* GL_OES_fixed_point */
+#ifndef GL_OES_fixed_point
+#define GL_OES_fixed_point 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glAlphaFuncxOES (GLenum func, GLclampx ref);
+GL_API void GL_APIENTRY glClearColorxOES (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
+GL_API void GL_APIENTRY glClearDepthxOES (GLclampx depth);
+GL_API void GL_APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation);
+GL_API void GL_APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+GL_API void GL_APIENTRY glDepthRangexOES (GLclampx zNear, GLclampx zFar);
+GL_API void GL_APIENTRY glFogxOES (GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glFogxvOES (GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glFrustumxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
+/* FIXME: GlueGen generates incorrect code for this one */
+/* GL_API void GL_APIENTRY glGetClipPlanexOES (GLenum pname, GLfixed eqn[4]); */
+GL_API void GL_APIENTRY glGetClipPlanexOES (GLenum pname, GLfixed* eqn);
+GL_API void GL_APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetLightxvOES (GLenum light, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetMaterialxvOES (GLenum face, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetTexEnvxvOES (GLenum tenv, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params);
+GL_API void GL_APIENTRY glLightModelxOES (GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glLineWidthxOES (GLfixed width);
+GL_API void GL_APIENTRY glLoadMatrixxOES (const GLfixed *m);
+GL_API void GL_APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glMultMatrixxOES (const GLfixed *m);
+GL_API void GL_APIENTRY glMultiTexCoord4xOES (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
+GL_API void GL_APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz);
+GL_API void GL_APIENTRY glOrthoxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
+GL_API void GL_APIENTRY glPointParameterxOES (GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glPointSizexOES (GLfixed size);
+GL_API void GL_APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units);
+GL_API void GL_APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
+GL_API void GL_APIENTRY glSampleCoveragexOES (GLclampx value, GLboolean invert);
+GL_API void GL_APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z);
+GL_API void GL_APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z);
+#endif
+typedef void (GL_APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLclampx ref);
+typedef void (GL_APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
+typedef void (GL_APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLclampx depth);
+typedef void (GL_APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation);
+typedef void (GL_APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLclampx zNear, GLclampx zFar);
+typedef void (GL_APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
+/* FIXME: GlueGen generates incorrect code for this one */
+/* typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum pname, GLfixed eqn[4]); */
+typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum pname, GLfixed* eqn);
+typedef void (GL_APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETLIGHTXVOESPROC) (GLenum light, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETMATERIALXVOESPROC) (GLenum face, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum tenv, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width);
+typedef void (GL_APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m);
+typedef void (GL_APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m);
+typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
+typedef void (GL_APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz);
+typedef void (GL_APIENTRYP PFNGLORTHOXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
+typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXOESPROC) (GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size);
+typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units);
+typedef void (GL_APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
+typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEXOESPROC) (GLclampx value, GLboolean invert);
+typedef void (GL_APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
+typedef void (GL_APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
+#endif
+
+/* GL_OES_framebuffer_object */
+#ifndef GL_OES_framebuffer_object
+#define GL_OES_framebuffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API GLboolean GL_APIENTRY glIsRenderbufferOES (GLuint renderbuffer);
+GL_API void GL_APIENTRY glBindRenderbufferOES (GLenum target, GLuint renderbuffer);
+GL_API void GL_APIENTRY glDeleteRenderbuffersOES (GLsizei n, const GLuint* renderbuffers);
+GL_API void GL_APIENTRY glGenRenderbuffersOES (GLsizei n, GLuint* renderbuffers);
+GL_API void GL_APIENTRY glRenderbufferStorageOES (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_API void GL_APIENTRY glGetRenderbufferParameterivOES (GLenum target, GLenum pname, GLint* params);
+GL_API GLboolean GL_APIENTRY glIsFramebufferOES (GLuint framebuffer);
+GL_API void GL_APIENTRY glBindFramebufferOES (GLenum target, GLuint framebuffer);
+GL_API void GL_APIENTRY glDeleteFramebuffersOES (GLsizei n, const GLuint* framebuffers);
+GL_API void GL_APIENTRY glGenFramebuffersOES (GLsizei n, GLuint* framebuffers);
+GL_API GLenum GL_APIENTRY glCheckFramebufferStatusOES (GLenum target);
+GL_API void GL_APIENTRY glFramebufferRenderbufferOES (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_API void GL_APIENTRY glFramebufferTexture2DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_API void GL_APIENTRY glGetFramebufferAttachmentParameterivOES (GLenum target, GLenum attachment, GLenum pname, GLint* params);
+GL_API void GL_APIENTRY glGenerateMipmapOES (GLenum target);
+#endif
+typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint* renderbuffers);
+typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint* renderbuffers);
+typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint* params);
+typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer);
+typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer);
+typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint* framebuffers);
+typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint* framebuffers);
+typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
+typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPOESPROC) (GLenum target);
+#endif
+
+/* GL_OES_matrix_get */
+#ifndef GL_OES_matrix_get
+#define GL_OES_matrix_get 1
+#endif
+
+/* GL_OES_matrix_palette */
+#ifndef GL_OES_matrix_palette
+#define GL_OES_matrix_palette 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glCurrentPaletteMatrixOES (GLuint matrixpaletteindex);
+GL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES (void);
+GL_API void GL_APIENTRY glMatrixIndexPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+GL_API void GL_APIENTRY glWeightPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif
+typedef void (GL_APIENTRYP PFNGLCURRENTPALETTEMATRIXOESPROC) (GLuint matrixpaletteindex);
+typedef void (GL_APIENTRYP PFNGLLOADPALETTEFROMMODELVIEWMATRIXOESPROC) (void);
+typedef void (GL_APIENTRYP PFNGLMATRIXINDEXPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+typedef void (GL_APIENTRYP PFNGLWEIGHTPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif
+
+/* GL_OES_query_matrix */
+#ifndef GL_OES_query_matrix
+#define GL_OES_query_matrix 1
+#ifdef GL_GLEXT_PROTOTYPES
+/* FIXME: GlueGen generates incorrect code for this one */
+/* GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES (GLfixed mantissa[16], GLint exponent[16]); */
+GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES (GLfixed* mantissa, GLint* exponent);
+#endif
+/* FIXME: GlueGen generates incorrect code for this one */
+/* typedef GLbitfield (GL_APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed mantissa[16], GLint exponent[16]); */
+typedef GLbitfield (GL_APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed* mantissa, GLint* exponent);
+#endif
+
+/* GL_OES_single_precision */
+#ifndef GL_OES_single_precision
+#define GL_OES_single_precision 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glDepthRangefOES (GLclampf zNear, GLclampf zFar);
+GL_API void GL_APIENTRY glFrustumfOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
+GL_API void GL_APIENTRY glOrthofOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
+GL_API void GL_APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation);
+/* FIXME: GlueGen generates incorrect code for this one */
+/* GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum pname, GLfloat eqn[4]); */
+GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum pname, GLfloat* eqn);
+GL_API void GL_APIENTRY glClearDepthfOES (GLclampf depth);
+#endif
+typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf zNear, GLclampf zFar);
+typedef void (GL_APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
+typedef void (GL_APIENTRYP PFNGLORTHOFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
+typedef void (GL_APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation);
+/* FIXME: GlueGen generates incorrect code for this one */
+/* typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum pname, GLfloat eqn[4]); */
+typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum pname, GLfloat* eqn);
+typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth);
+#endif
+
+/* GL_OES_stencil_wrap */
+#ifndef GL_OES_stencil_wrap
+#define GL_OES_stencil_wrap 1
+#endif
+
+/* GL_OES_texture_cube_map */
+#ifndef GL_OES_texture_cube_map
+#define GL_OES_texture_cube_map 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param);
+GL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat *params);
+GL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param);
+GL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint *params);
+GL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param);
+GL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params);
+GL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *params);
+GL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *params);
+GL_API void GL_APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params);
+#endif
+typedef void (GL_APIENTRYP PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param);
+typedef void (GL_APIENTRYP PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param);
+typedef void (GL_APIENTRYP PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params);
+typedef void (GL_APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param);
+typedef void (GL_APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params);
+typedef void (GL_APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
+#endif
+
+/* GL_OES_texture_env_crossbar */
+#ifndef GL_OES_texture_env_crossbar
+#define GL_OES_texture_env_crossbar 1
+#endif
+
+/* GL_OES_texture_mirrored_repeat */
+#ifndef GL_OES_texture_mirrored_repeat
+#define GL_OES_texture_mirrored_repeat 1
+#endif
+
+/* GL_OES_EGL_image */
+#ifndef GL_OES_EGL_image
+#define GL_OES_EGL_image 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
+GL_API void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
+#endif
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
+#endif
+
+/* GL_OES_depth24 */
+#ifndef GL_OES_depth24
+#define GL_OES_depth24 1
+#endif
+
+/* GL_OES_depth32 */
+#ifndef GL_OES_depth32
+#define GL_OES_depth32 1
+#endif
+
+/* GL_OES_element_index_uint */
+#ifndef GL_OES_element_index_uint
+#define GL_OES_element_index_uint 1
+#endif
+
+/* GL_OES_fbo_render_mipmap */
+#ifndef GL_OES_fbo_render_mipmap
+#define GL_OES_fbo_render_mipmap 1
+#endif
+
+/* GL_OES_mapbuffer */
+#ifndef GL_OES_mapbuffer
+#define GL_OES_mapbuffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_API void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
+GL_API GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
+GL_API void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void** params);
+#endif
+typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void** params);
+#endif
+
+/* GL_OES_rgb8_rgba8 */
+#ifndef GL_OES_rgb8_rgba8
+#define GL_OES_rgb8_rgba8 1
+#endif
+
+/* GL_OES_stencil1 */
+#ifndef GL_OES_stencil1
+#define GL_OES_stencil1 1
+#endif
+
+/* GL_OES_stencil4 */
+#ifndef GL_OES_stencil4
+#define GL_OES_stencil4 1
+#endif
+
+/* GL_OES_stencil8 */
+#ifndef GL_OES_stencil8
+#define GL_OES_stencil8 1
+#endif
+
+/* GL_OES_vertex_half_float */
+#ifndef GL_OES_vertex_half_float
+#define GL_OES_vertex_half_float 1
+#endif
+
+/* GL_AMD_compressed_3DC_texture */
+#ifndef GL_AMD_compressed_3DC_texture
+#define GL_AMD_compressed_3DC_texture 1
+#endif
+
+/* GL_AMD_compressed_ATC_texture */
+#ifndef GL_AMD_compressed_ATC_texture
+#define GL_AMD_compressed_ATC_texture 1
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#endif
+
+/* GL_EXT_texture_compression_dxt1 */
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_EXT_texture_compression_dxt1 1
+#endif
+
+/* GL_EXT_texture_compression_s3tc */
+#ifndef GL_EXT_texture_compression_s3tc
+#define GL_EXT_texture_compression_s3tc 1
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __glext_h_ */
+
diff --git a/make/stub_includes/opengl/GLES/glplatform.h b/make/stub_includes/opengl/GLES/glplatform.h
new file mode 100755
index 000000000..dd2f20ec3
--- /dev/null
+++ b/make/stub_includes/opengl/GLES/glplatform.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2007 NVIDIA Corporation. All rights reserved.
+ *
+ * NVIDIA Corporation and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA Corporation is strictly prohibited.
+ */
+
+#ifndef __glplatform_h_
+#define __glplatform_h_
+
+/* $Id$ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.0 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+*/
+
+/*-------------------------------------------------------------------------
+ * Definition of GL_API and GL_APIENTRY
+ *-----------------------------------------------------------------------*/
+
+#if defined(AEE_SIMULATOR)
+#define __GL_EXPORTS
+#endif
+
+#ifdef __GL_EXPORTS
+# define GL_API
+#else
+# define GL_API extern
+#endif
+
+#define GL_APIENTRY
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __glplatform_h_ */
diff --git a/make/stub_includes/opengl/GLES/glu.h b/make/stub_includes/opengl/GLES/glu.h
new file mode 100755
index 000000000..50a94f34e
--- /dev/null
+++ b/make/stub_includes/opengl/GLES/glu.h
@@ -0,0 +1 @@
+// Empty glu.h so that we pick up only the Java routines
diff --git a/make/stub_includes/opengl/GLES2/gl2.h b/make/stub_includes/opengl/GLES2/gl2.h
new file mode 100755
index 000000000..172c5adb0
--- /dev/null
+++ b/make/stub_includes/opengl/GLES2/gl2.h
@@ -0,0 +1,677 @@
+#ifndef __gl2_h_
+#define __gl2_h_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.0 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+*/
+
+/*-------------------------------------------------------------------------
+ * Definition of GL_APICALL and GL_APIENTRY
+ *-----------------------------------------------------------------------*/
+
+/*
+#if defined(_WIN32) || defined(__VC32__) // Win32
+# if defined (_DLL_EXPORTS)
+# define GL_APICALL __declspec(dllexport)
+# else
+# define GL_APICALL __declspec(dllimport)
+# endif
+#elif defined (__ARMCC_VERSION) // ADS
+# define GL_APICALL
+#elif defined (__SYMBIAN32__) && defined (__GCC32__) // Symbian GCC
+# define GL_APICALL __declspec(dllexport)
+#elif defined (__GNUC__) // GCC dependencies (kludge)
+# define GL_APICALL
+#endif
+
+#if !defined (GL_APICALL)
+# error Unsupported platform!
+#endif
+*/
+
+#define GL_APIENTRY
+
+/*-------------------------------------------------------------------------
+ * Data type definitions
+ *-----------------------------------------------------------------------*/
+
+typedef void GLvoid;
+typedef unsigned int GLenum;
+typedef unsigned char GLboolean;
+typedef unsigned int GLbitfield;
+typedef signed char GLbyte;
+typedef short GLshort;
+typedef int GLint;
+typedef int GLsizei;
+typedef unsigned char GLubyte;
+typedef unsigned short GLushort;
+typedef unsigned int GLuint;
+typedef float GLfloat;
+typedef float GLclampf;
+typedef int GLfixed;
+typedef int GLclampx;
+
+/* GL types for handling large vertex buffer objects */
+typedef int GLintptr;
+typedef int GLsizeiptr;
+
+/* OpenGL ES core versions */
+#define GL_ES_VERSION_2_0 1
+
+/* ClearBufferMask */
+#define GL_DEPTH_BUFFER_BIT 0x00000100
+#define GL_STENCIL_BUFFER_BIT 0x00000400
+#define GL_COLOR_BUFFER_BIT 0x00004000
+
+/* Boolean */
+#define GL_FALSE 0
+#define GL_TRUE 1
+
+/* \todo check that this should be in core. */
+#define GL_NONE 0
+
+/* BeginMode */
+#define GL_POINTS 0x0000
+#define GL_LINES 0x0001
+#define GL_LINE_LOOP 0x0002
+#define GL_LINE_STRIP 0x0003
+#define GL_TRIANGLES 0x0004
+#define GL_TRIANGLE_STRIP 0x0005
+#define GL_TRIANGLE_FAN 0x0006
+
+/* AlphaFunction (not supported in ES20) */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* BlendingFactorDest */
+#define GL_ZERO 0
+#define GL_ONE 1
+#define GL_SRC_COLOR 0x0300
+#define GL_ONE_MINUS_SRC_COLOR 0x0301
+#define GL_SRC_ALPHA 0x0302
+#define GL_ONE_MINUS_SRC_ALPHA 0x0303
+#define GL_DST_ALPHA 0x0304
+#define GL_ONE_MINUS_DST_ALPHA 0x0305
+
+/* BlendingFactorSrc */
+/* GL_ZERO */
+/* GL_ONE */
+#define GL_DST_COLOR 0x0306
+#define GL_ONE_MINUS_DST_COLOR 0x0307
+#define GL_SRC_ALPHA_SATURATE 0x0308
+/* GL_SRC_ALPHA */
+/* GL_ONE_MINUS_SRC_ALPHA */
+/* GL_DST_ALPHA */
+/* GL_ONE_MINUS_DST_ALPHA */
+
+/* BlendEquationSeparate */
+#define GL_FUNC_ADD 0x8006
+#define GL_BLEND_EQUATION 0x8009
+#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */
+#define GL_BLEND_EQUATION_ALPHA 0x883D
+
+/* BlendSubtract */
+#define GL_FUNC_SUBTRACT 0x800A
+#define GL_FUNC_REVERSE_SUBTRACT 0x800B
+
+/* Separate Blend Functions */
+#define GL_BLEND_DST_RGB 0x80C8
+#define GL_BLEND_SRC_RGB 0x80C9
+#define GL_BLEND_DST_ALPHA 0x80CA
+#define GL_BLEND_SRC_ALPHA 0x80CB
+#define GL_CONSTANT_COLOR 0x8001
+#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
+#define GL_CONSTANT_ALPHA 0x8003
+#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
+#define GL_BLEND_COLOR 0x8005
+
+/* Buffer Objects */
+#define GL_ARRAY_BUFFER 0x8892
+#define GL_ELEMENT_ARRAY_BUFFER 0x8893
+#define GL_ARRAY_BUFFER_BINDING 0x8894
+#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
+
+#define GL_STREAM_DRAW 0x88E0
+#define GL_STATIC_DRAW 0x88E4
+#define GL_DYNAMIC_DRAW 0x88E8
+
+#define GL_BUFFER_SIZE 0x8764
+#define GL_BUFFER_USAGE 0x8765
+
+#define GL_CURRENT_VERTEX_ATTRIB 0x8626
+
+/* CullFaceMode */
+#define GL_FRONT 0x0404
+#define GL_BACK 0x0405
+#define GL_FRONT_AND_BACK 0x0408
+
+/* DepthFunction */
+/* GL_NEVER */
+/* GL_LESS */
+/* GL_EQUAL */
+/* GL_LEQUAL */
+/* GL_GREATER */
+/* GL_NOTEQUAL */
+/* GL_GEQUAL */
+/* GL_ALWAYS */
+
+/* EnableCap */
+#define GL_TEXTURE_2D 0x0DE1
+#define GL_CULL_FACE 0x0B44
+#define GL_BLEND 0x0BE2
+#define GL_DITHER 0x0BD0
+#define GL_STENCIL_TEST 0x0B90
+#define GL_DEPTH_TEST 0x0B71
+#define GL_SCISSOR_TEST 0x0C11
+#define GL_POLYGON_OFFSET_FILL 0x8037
+#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
+#define GL_SAMPLE_COVERAGE 0x80A0
+
+/* ErrorCode */
+#define GL_NO_ERROR 0
+#define GL_INVALID_ENUM 0x0500
+#define GL_INVALID_VALUE 0x0501
+#define GL_INVALID_OPERATION 0x0502
+#define GL_OUT_OF_MEMORY 0x0505
+
+/* FrontFaceDirection */
+#define GL_CW 0x0900
+#define GL_CCW 0x0901
+
+/* GetPName */
+#define GL_LINE_WIDTH 0x0B21
+#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
+#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
+#define GL_CULL_FACE_MODE 0x0B45
+#define GL_FRONT_FACE 0x0B46
+#define GL_DEPTH_RANGE 0x0B70
+#define GL_DEPTH_WRITEMASK 0x0B72
+#define GL_DEPTH_CLEAR_VALUE 0x0B73
+#define GL_DEPTH_FUNC 0x0B74
+#define GL_STENCIL_CLEAR_VALUE 0x0B91
+#define GL_STENCIL_FUNC 0x0B92
+#define GL_STENCIL_FAIL 0x0B94
+#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
+#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
+#define GL_STENCIL_REF 0x0B97
+#define GL_STENCIL_VALUE_MASK 0x0B93
+#define GL_STENCIL_WRITEMASK 0x0B98
+#define GL_STENCIL_BACK_FUNC 0x8800
+#define GL_STENCIL_BACK_FAIL 0x8801
+#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
+#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
+#define GL_STENCIL_BACK_REF 0x8CA3
+#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
+#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
+#define GL_VIEWPORT 0x0BA2
+#define GL_SCISSOR_BOX 0x0C10
+/* GL_SCISSOR_TEST */
+#define GL_COLOR_CLEAR_VALUE 0x0C22
+#define GL_COLOR_WRITEMASK 0x0C23
+#define GL_UNPACK_ALIGNMENT 0x0CF5
+#define GL_PACK_ALIGNMENT 0x0D05
+#define GL_MAX_TEXTURE_SIZE 0x0D33
+#define GL_MAX_VIEWPORT_DIMS 0x0D3A
+#define GL_SUBPIXEL_BITS 0x0D50
+#define GL_RED_BITS 0x0D52
+#define GL_GREEN_BITS 0x0D53
+#define GL_BLUE_BITS 0x0D54
+#define GL_ALPHA_BITS 0x0D55
+#define GL_DEPTH_BITS 0x0D56
+#define GL_STENCIL_BITS 0x0D57
+#define GL_POLYGON_OFFSET_UNITS 0x2A00
+/* GL_POLYGON_OFFSET_FILL */
+#define GL_POLYGON_OFFSET_FACTOR 0x8038
+#define GL_TEXTURE_BINDING_2D 0x8069
+#define GL_SAMPLE_BUFFERS 0x80A8
+#define GL_SAMPLES 0x80A9
+#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
+#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
+
+/* GetTextureParameter */
+/* GL_TEXTURE_MAG_FILTER */
+/* GL_TEXTURE_MIN_FILTER */
+/* GL_TEXTURE_WRAP_S */
+/* GL_TEXTURE_WRAP_T */
+
+#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
+#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
+
+/* HintMode */
+#define GL_DONT_CARE 0x1100
+#define GL_FASTEST 0x1101
+#define GL_NICEST 0x1102
+
+/* HintTarget */
+#define GL_GENERATE_MIPMAP_HINT 0x8192
+#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
+
+/* DataType */
+#define GL_BYTE 0x1400
+#define GL_UNSIGNED_BYTE 0x1401
+#define GL_SHORT 0x1402
+#define GL_UNSIGNED_SHORT 0x1403
+#define GL_INT 0x1404
+#define GL_UNSIGNED_INT 0x1405
+#define GL_FLOAT 0x1406
+#define GL_FIXED 0x140C
+
+/* PixelFormat */
+#define GL_DEPTH_COMPONENT 0x1902
+#define GL_ALPHA 0x1906
+#define GL_RGB 0x1907
+#define GL_RGBA 0x1908
+#define GL_LUMINANCE 0x1909
+#define GL_LUMINANCE_ALPHA 0x190A
+
+/* PixelType */
+/* GL_UNSIGNED_BYTE */
+#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
+#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
+#define GL_UNSIGNED_SHORT_5_6_5 0x8363
+
+/* Shaders */
+#define GL_FRAGMENT_SHADER 0x8B30
+#define GL_VERTEX_SHADER 0x8B31
+#define GL_MAX_VERTEX_ATTRIBS 0x8869
+#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
+#define GL_MAX_VARYING_VECTORS 0x8DFC
+#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
+#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
+#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
+#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
+#define GL_SHADER_TYPE 0x8B4F
+#define GL_DELETE_STATUS 0x8B80
+#define GL_LINK_STATUS 0x8B82
+#define GL_VALIDATE_STATUS 0x8B83
+#define GL_ATTACHED_SHADERS 0x8B85
+#define GL_ACTIVE_UNIFORMS 0x8B86
+#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
+#define GL_ACTIVE_ATTRIBUTES 0x8B89
+#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
+#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
+#define GL_CURRENT_PROGRAM 0x8B8D
+
+/* StencilFunction */
+#define GL_NEVER 0x0200
+#define GL_LESS 0x0201
+#define GL_EQUAL 0x0202
+#define GL_LEQUAL 0x0203
+#define GL_GREATER 0x0204
+#define GL_NOTEQUAL 0x0205
+#define GL_GEQUAL 0x0206
+#define GL_ALWAYS 0x0207
+
+/* StencilOp */
+/* GL_ZERO */
+#define GL_KEEP 0x1E00
+#define GL_REPLACE 0x1E01
+#define GL_INCR 0x1E02
+#define GL_DECR 0x1E03
+#define GL_INVERT 0x150A
+#define GL_INCR_WRAP 0x8507
+#define GL_DECR_WRAP 0x8508
+
+/* StringName */
+#define GL_VENDOR 0x1F00
+#define GL_RENDERER 0x1F01
+#define GL_VERSION 0x1F02
+#define GL_EXTENSIONS 0x1F03
+
+/* TextureMagFilter */
+#define GL_NEAREST 0x2600
+#define GL_LINEAR 0x2601
+
+/* TextureMinFilter */
+/* GL_NEAREST */
+/* GL_LINEAR */
+#define GL_NEAREST_MIPMAP_NEAREST 0x2700
+#define GL_LINEAR_MIPMAP_NEAREST 0x2701
+#define GL_NEAREST_MIPMAP_LINEAR 0x2702
+#define GL_LINEAR_MIPMAP_LINEAR 0x2703
+
+/* TextureParameterName */
+#define GL_TEXTURE_MAG_FILTER 0x2800
+#define GL_TEXTURE_MIN_FILTER 0x2801
+#define GL_TEXTURE_WRAP_S 0x2802
+#define GL_TEXTURE_WRAP_T 0x2803
+
+/* TextureTarget */
+/* GL_TEXTURE_2D */
+#define GL_TEXTURE 0x1702
+
+#define GL_TEXTURE_CUBE_MAP 0x8513
+#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
+#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
+
+/* TextureUnit */
+#define GL_TEXTURE0 0x84C0
+#define GL_TEXTURE1 0x84C1
+#define GL_TEXTURE2 0x84C2
+#define GL_TEXTURE3 0x84C3
+#define GL_TEXTURE4 0x84C4
+#define GL_TEXTURE5 0x84C5
+#define GL_TEXTURE6 0x84C6
+#define GL_TEXTURE7 0x84C7
+#define GL_TEXTURE8 0x84C8
+#define GL_TEXTURE9 0x84C9
+#define GL_TEXTURE10 0x84CA
+#define GL_TEXTURE11 0x84CB
+#define GL_TEXTURE12 0x84CC
+#define GL_TEXTURE13 0x84CD
+#define GL_TEXTURE14 0x84CE
+#define GL_TEXTURE15 0x84CF
+#define GL_TEXTURE16 0x84D0
+#define GL_TEXTURE17 0x84D1
+#define GL_TEXTURE18 0x84D2
+#define GL_TEXTURE19 0x84D3
+#define GL_TEXTURE20 0x84D4
+#define GL_TEXTURE21 0x84D5
+#define GL_TEXTURE22 0x84D6
+#define GL_TEXTURE23 0x84D7
+#define GL_TEXTURE24 0x84D8
+#define GL_TEXTURE25 0x84D9
+#define GL_TEXTURE26 0x84DA
+#define GL_TEXTURE27 0x84DB
+#define GL_TEXTURE28 0x84DC
+#define GL_TEXTURE29 0x84DD
+#define GL_TEXTURE30 0x84DE
+#define GL_TEXTURE31 0x84DF
+#define GL_ACTIVE_TEXTURE 0x84E0
+
+/* TextureWrapMode */
+#define GL_REPEAT 0x2901
+#define GL_CLAMP_TO_EDGE 0x812F
+#define GL_MIRRORED_REPEAT 0x8370
+
+/* Uniform Types */
+#define GL_FLOAT_VEC2 0x8B50
+#define GL_FLOAT_VEC3 0x8B51
+#define GL_FLOAT_VEC4 0x8B52
+#define GL_INT_VEC2 0x8B53
+#define GL_INT_VEC3 0x8B54
+#define GL_INT_VEC4 0x8B55
+#define GL_BOOL 0x8B56
+#define GL_BOOL_VEC2 0x8B57
+#define GL_BOOL_VEC3 0x8B58
+#define GL_BOOL_VEC4 0x8B59
+#define GL_FLOAT_MAT2 0x8B5A
+#define GL_FLOAT_MAT3 0x8B5B
+#define GL_FLOAT_MAT4 0x8B5C
+#define GL_SAMPLER_2D 0x8B5E
+#define GL_SAMPLER_CUBE 0x8B60
+
+/* Vertex Arrays */
+#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
+#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
+#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
+#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
+#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
+#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
+#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
+
+/* Read Format */
+#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
+#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
+
+/* Shader Source */
+#define GL_COMPILE_STATUS 0x8B81
+#define GL_INFO_LOG_LENGTH 0x8B84
+#define GL_SHADER_SOURCE_LENGTH 0x8B88
+#define GL_SHADER_COMPILER 0x8DFA
+
+/* Shader Binary */
+#define GL_PLATFORM_BINARY 0x8D63
+#define GL_SHADER_BINARY_FORMATS 0x8DF8
+#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
+
+/* Shader Precision-Specified Types */
+#define GL_LOW_FLOAT 0x8DF0
+#define GL_MEDIUM_FLOAT 0x8DF1
+#define GL_HIGH_FLOAT 0x8DF2
+#define GL_LOW_INT 0x8DF3
+#define GL_MEDIUM_INT 0x8DF4
+#define GL_HIGH_INT 0x8DF5
+
+/* Framebuffer Object. */
+#define GL_FRAMEBUFFER 0x8D40
+#define GL_RENDERBUFFER 0x8D41
+
+#define GL_RGBA4 0x8056
+#define GL_RGB5_A1 0x8057
+#define GL_RGB565 0x8D62
+#define GL_DEPTH_COMPONENT16 0x81A5
+#define GL_STENCIL_INDEX 0x1901
+#define GL_STENCIL_INDEX8 0x8D48
+
+#define GL_RENDERBUFFER_WIDTH 0x8D42
+#define GL_RENDERBUFFER_HEIGHT 0x8D43
+#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
+#define GL_RENDERBUFFER_RED_SIZE 0x8D50
+#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
+#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
+#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
+#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
+#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
+
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
+#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
+
+#define GL_COLOR_ATTACHMENT0 0x8CE0
+#define GL_DEPTH_ATTACHMENT 0x8D00
+#define GL_STENCIL_ATTACHMENT 0x8D20
+
+#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
+#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
+#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
+#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
+#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS 0x8CDA
+#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
+
+#define GL_FRAMEBUFFER_BINDING 0x8CA6
+#define GL_RENDERBUFFER_BINDING 0x8CA7
+#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
+
+#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
+
+/*-------------------------------------------------------------------------
+ * GL core functions.
+ *-----------------------------------------------------------------------*/
+
+GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
+GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const char* name);
+GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
+GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
+GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
+GL_APICALL void GL_APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+GL_APICALL void GL_APIENTRY glBlendEquation( GLenum mode );
+GL_APICALL void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
+GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
+GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
+GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void* data, GLenum usage);
+GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* data);
+GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
+GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
+GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth);
+GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
+GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
+GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data);
+GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data);
+GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
+GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
+GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
+GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers);
+GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers);
+GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures);
+GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers);
+GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
+GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
+GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
+GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
+GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
+GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
+GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
+GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void* indices);
+GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
+GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
+GL_APICALL void GL_APIENTRY glFinish (void);
+GL_APICALL void GL_APIENTRY glFlush (void);
+GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
+GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
+GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
+GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers);
+GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
+GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers);
+GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers);
+GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures);
+GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
+GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name);
+GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
+GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const char* name);
+GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params);
+GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL GLenum GL_APIENTRY glGetError (void);
+GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog);
+GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog);
+GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, char* source);
+GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name);
+GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params);
+GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const char* name);
+GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params);
+GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void** pointer);
+GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
+GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
+GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
+GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
+GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
+GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
+GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
+GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
+GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
+GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels);
+GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
+GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
+GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
+GL_APICALL void GL_APIENTRY glShaderBinary (GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length);
+GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const char** string, const GLint* length);
+GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
+GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
+GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels);
+GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
+GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params);
+GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
+GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params);
+GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels);
+GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x);
+GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x);
+GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y);
+GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z);
+GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v);
+GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w);
+GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v);
+GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
+GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
+GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x);
+GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y);
+GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z);
+GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
+GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values);
+GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr);
+GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl2_h_ */
+
diff --git a/make/stub_includes/opengl/GLES2/gl2ext.h b/make/stub_includes/opengl/GLES2/gl2ext.h
new file mode 100755
index 000000000..b531df2fb
--- /dev/null
+++ b/make/stub_includes/opengl/GLES2/gl2ext.h
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2005-2007 NVIDIA Corporation. All rights reserved.
+ *
+ * NVIDIA Corporation and its licensors retain all intellectual property
+ * and proprietary rights in and to this software, related documentation
+ * and any modifications thereto. Any use, reproduction, disclosure or
+ * distribution of this software and related documentation without an express
+ * license agreement from NVIDIA Corporation is strictly prohibited.
+ */
+
+#ifndef __gl2ext_h_
+#define __gl2ext_h_
+
+#ifndef __gl2_h_
+# include <GLES2/gl2.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.0 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+*/
+
+#ifndef GL_APIENTRYP
+# define GL_APIENTRYP GL_APIENTRY*
+#endif
+
+#define GL_GLEXT_PROTOTYPES
+
+#define GL_NVIDIA_PLATFORM_BINARY_NV 0x890B
+
+#define GL_OES_EGL_image 1
+
+#ifdef GL_OES_EGL_image
+#define GL_TEXTURE_2D_OES 0x1
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x3
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x4
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x5
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x6
+#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x7
+#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x8
+#define GL_RENDERBUFFER_OES 0x9
+#define GL_TEXTURE_RECTANGLE_NV_OES 0xb
+
+typedef void *GLeglImageOES;
+GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
+#ifdef GL_GLEXT_PROTOTYPES
+typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
+
+#endif
+#endif
+
+
+/*------------------------------------------------------------------------*
+ * OES extension tokens
+ *------------------------------------------------------------------------*/
+
+#ifndef GL_OES_texture_half_float
+#define GL_OES_texture_half_float 1
+#define GL_HALF_FLOAT_OES 0x8D61
+#endif
+
+/* GL_OES_mapbuffer */
+#ifndef GL_OES_mapbuffer
+#define GL_BUFFER_MAPPED_OES 0x88BC
+#define GL_BUFFER_MAP_POINTER_OES 0x88BD
+#endif
+
+/* GL_OES_rgb8_rgba8 */
+#ifndef GL_OES_rgb8_rgba8
+#define GL_RGB8_OES 0x8051
+#define GL_RGBA8_OES 0x8058
+#endif
+
+/* GL_OES_mapbuffer */
+#ifndef GL_OES_mapbuffer
+#define GL_OES_mapbuffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
+GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
+GL_APICALL void GL_APIENTRY glGetBufferPointerivNV (GLenum target, GLenum pname, void **params );
+#endif
+typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
+typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
+typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERIVNVPROC) (GLenum target, GLenum pname, void **params );
+#endif
+
+/* GL_OES_rgb8_rgba8 */
+#ifndef GL_OES_rgb8_rgba8
+#define GL_OES_rgb8_rgba8 1
+#endif
+
+/*------------------------------------------------------------------------*
+ * EXT extension tokens
+ *------------------------------------------------------------------------*/
+
+/* GL_EXT_framebuffer_mixed_formats */
+#ifndef GL_EXT_framebuffer_mixed_formats
+#define GL_EXT_framebuffer_mixed_formats 1
+#endif
+
+/* GL_EXT_packed_float */
+#ifndef GL_EXT_packed_float
+#define GL_R11F_G11F_B10F_EXT 0x8C3A
+#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B
+#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C
+#endif
+
+/* GL_EXT_texture_array */
+#ifndef GL_EXT_texture_array
+#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A
+#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1
+#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
+#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
+#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
+#endif
+
+
+/* GL_EXT_texture_compression_dxt1 */
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
+#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
+#endif
+
+/* GL_EXT_texture_compression_s3tc */
+#ifndef GL_EXT_texture_compression_s3tc
+/* GL_COMPRESSED_RGB_S3TC_DXT1_EXT defined in GL_EXT_texture_compression_dxt1 already. */
+/* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT defined in GL_EXT_texture_compression_dxt1 already. */
+#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
+#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
+#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
+#endif
+
+
+/* GL_EXT_texture_compression_dxt1 */
+#ifndef GL_EXT_texture_compression_dxt1
+#define GL_EXT_texture_compression_dxt1 1
+#endif
+
+/* GL_EXT_texture_compression_s3tc */
+#ifndef GL_EXT_texture_compression_s3tc
+#define GL_EXT_texture_compression_s3tc 1
+#endif
+
+/* GL_EXT_texture_filter_anisotropic */
+#ifndef GL_EXT_texture_filter_anisotropic
+#define GL_EXT_texture_filter_anisotropic 1
+#endif
+
+#define GL_TEXTURE_MAX_LEVEL_NV 0x813D
+
+/* GL_NV_coverage_sample */
+#ifndef GL_NV_coverage_sample
+#define GL_COVERAGE_COMPONENT_NV 0x8522
+#define GL_COVERAGE_COMPONENT4_NV 0x8523
+#define GL_COVERAGE_ATTACHMENT_NV 0x8527
+#define GL_COVERAGE_BUFFER_BIT_NV 0x8000
+#define GL_COVERAGE_BUFFERS_NV 0x8528
+#define GL_COVERAGE_SAMPLES_NV 0x8529
+#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8524
+#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8525
+#define GL_COVERAGE_AUTOMATIC_NV 0x8526
+#endif
+
+
+/* GL_NV_framebuffer_vertex_attrib_array */
+#ifndef GL_NV_framebuffer_vertex_attrib_array
+#define GL_FRAMEBUFFER_ATTACHABLE_NV 0x852A
+#define GL_VERTEX_ATTRIB_ARRAY_NV 0x852B
+#define GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_SIZE_NV 0x852C
+#define GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_TYPE_NV 0x852D
+#define GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_NORMALIZED_NV 0x852E
+#define GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_OFFSET_NV 0x852F
+#define GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_WIDTH_NV 0x8530
+#define GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_STRIDE_NV 0x8531
+#define GL_FRAMEBUFFER_ATTACHMENT_VERTEX_ATTRIB_ARRAY_HEIGHT_NV 0x8532
+#endif
+
+
+/* GL_NV_framebuffer_vertex_attrib_array */
+#ifndef GL_NV_framebuffer_vertex_attrib_array
+#define GL_NV_framebuffer_vertex_attrib_array 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glFramebufferVertexAttribArrayNV (GLenum target, GLenum attachment, GLenum buffertarget, GLuint bufferobject, GLint size, GLenum type, GLboolean normalized, GLintptr offset, GLsizeiptr width, GLsizeiptr height, GLsizei stride);
+#endif
+typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERVERTEXATTRIBARRAYNVPROC) (GLenum target, GLenum attachment, GLenum buffertarget, GLuint bufferobject, GLint size, GLenum type, GLboolean normalized, GLintptr offset, GLsizeiptr width, GLsizeiptr height, GLsizei stride);
+#endif
+
+/* GL_NV_coverage_sample */
+#ifndef GL_NV_coverage_sample
+#define GL_NV_coverage_sample 1
+#ifdef GL_GLEXT_PROTOTYPES
+GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
+GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
+#endif
+typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
+typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
+#endif
+
+
+
+/*------------------------------------------------------------------------*
+ * NV extension tokens
+ *------------------------------------------------------------------------*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gl2ext_h_ */
diff --git a/src/classes/com/sun/javafx/audio/windows/waveout/Audio.java b/src/classes/com/sun/javafx/audio/windows/waveout/Audio.java
new file mode 100755
index 000000000..8e4e97b0c
--- /dev/null
+++ b/src/classes/com/sun/javafx/audio/windows/waveout/Audio.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.sun.javafx.audio.windows.waveout;
+
+import java.io.*;
+
+public class Audio {
+ private static Audio instance = null;
+ private Mixer mixer;
+
+ public synchronized static Audio getInstance() {
+ if (instance == null) {
+ instance = new Audio();
+ }
+ return instance;
+ }
+
+ private Audio() {
+ mixer = Mixer.getMixer();
+ }
+
+ public Mixer getMixer() {
+ return mixer;
+ }
+
+ public Track newTrack(File file) throws IOException
+ {
+ Track res = new Track(file);
+ mixer.add(res);
+ return res;
+ }
+
+ public void shutdown() {
+ mixer.shutdown();
+ }
+}
diff --git a/src/classes/com/sun/javafx/audio/windows/waveout/Mixer.java b/src/classes/com/sun/javafx/audio/windows/waveout/Mixer.java
new file mode 100755
index 000000000..814a74a8c
--- /dev/null
+++ b/src/classes/com/sun/javafx/audio/windows/waveout/Mixer.java
@@ -0,0 +1,362 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.sun.javafx.audio.windows.waveout;
+
+import java.io.*;
+import java.nio.*;
+import java.util.*;
+
+// Needed only for NIO workarounds on CVM
+import java.lang.reflect.*;
+
+public class Mixer {
+ // This class is a singleton
+ private static Mixer mixer;
+
+ private volatile boolean shutdown;
+ private volatile Object shutdownLock = new Object();
+ private volatile boolean shutdownDone;
+
+ // Windows Event object
+ private long event;
+
+ private volatile ArrayList/*<Track>*/ tracks = new ArrayList();
+
+ private Vec3f leftSpeakerPosition = new Vec3f(-1, 0, 0);
+ private Vec3f rightSpeakerPosition = new Vec3f( 1, 0, 0);
+
+ private float falloffFactor = 1.0f;
+
+ static {
+ mixer = new Mixer();
+ }
+
+ private Mixer() {
+ event = CreateEvent();
+ new FillerThread().start();
+ MixerThread m = new MixerThread();
+ m.setPriority(Thread.MAX_PRIORITY - 1);
+ m.start();
+ }
+
+ public static Mixer getMixer() {
+ return mixer;
+ }
+
+ synchronized void add(Track track) {
+ ArrayList/*<Track>*/ newTracks = (ArrayList) tracks.clone();
+ newTracks.add(track);
+ tracks = newTracks;
+ }
+
+ synchronized void remove(Track track) {
+ ArrayList/*<Track>*/ newTracks = (ArrayList) tracks.clone();
+ newTracks.remove(track);
+ tracks = newTracks;
+ }
+
+ // NOTE: due to a bug on the APX device, we only have mono sounds,
+ // so we currently only pay attention to the position of the left
+ // speaker
+ public void setLeftSpeakerPosition(float x, float y, float z) {
+ leftSpeakerPosition.set(x, y, z);
+ }
+
+ // NOTE: due to a bug on the APX device, we only have mono sounds,
+ // so we currently only pay attention to the position of the left
+ // speaker
+ public void setRightSpeakerPosition(float x, float y, float z) {
+ rightSpeakerPosition.set(x, y, z);
+ }
+
+ /** This defines a scale factor of sorts -- the higher the number,
+ the larger an area the sound will affect. Default value is
+ 1.0f. Valid values are [1.0f, ...]. The formula for the gain
+ for each channel is
+<PRE>
+ falloffFactor
+ -------------------
+ falloffFactor + r^2
+</PRE>
+*/
+ public void setFalloffFactor(float factor) {
+ falloffFactor = factor;
+ }
+
+ public void shutdown() {
+ synchronized(shutdownLock) {
+ shutdown = true;
+ SetEvent(event);
+ try {
+ shutdownLock.wait();
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+
+ class FillerThread extends Thread {
+ FillerThread() {
+ super("Mixer Thread");
+ }
+
+ public void run() {
+ while (!shutdown) {
+ List/*<Track>*/ curTracks = tracks;
+
+ for (Iterator iter = curTracks.iterator(); iter.hasNext(); ) {
+ Track track = (Track) iter.next();
+ try {
+ track.fill();
+ } catch (IOException e) {
+ e.printStackTrace();
+ remove(track);
+ }
+ }
+
+ try {
+ // Run ten times per second
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ class MixerThread extends Thread {
+ // Temporary mixing buffer
+ // Interleaved left and right channels
+ float[] mixingBuffer;
+ private Vec3f temp = new Vec3f();
+
+ MixerThread() {
+ super("Mixer Thread");
+ if (!initializeWaveOut(event)) {
+ throw new InternalError("Error initializing waveout device");
+ }
+ }
+
+ public void run() {
+ while (!shutdown) {
+ // Get the next buffer
+ long mixerBuffer = getNextMixerBuffer();
+ if (mixerBuffer != 0) {
+ ByteBuffer buf = getMixerBufferData(mixerBuffer);
+
+ if (buf == null) {
+ // This is happening on CVM because
+ // JNI_NewDirectByteBuffer isn't implemented
+ // by default and isn't compatible with the
+ // JSR-239 NIO implementation (apparently)
+ buf = newDirectByteBuffer(getMixerBufferDataAddress(mixerBuffer),
+ getMixerBufferDataCapacity(mixerBuffer));
+ }
+
+ if (buf == null) {
+ throw new InternalError("Couldn't wrap the native address with a direct byte buffer");
+ }
+
+ // System.out.println("Mixing buffer");
+
+ // If we don't have enough samples in our mixing buffer, expand it
+ // FIXME: knowledge of native output rendering format
+ if ((mixingBuffer == null) || (mixingBuffer.length < (buf.capacity() / 2 /* bytes / sample */))) {
+ mixingBuffer = new float[buf.capacity() / 2];
+ } else {
+ // Zap it
+ for (int i = 0; i < mixingBuffer.length; i++) {
+ mixingBuffer[i] = 0.0f;
+ }
+ }
+
+ // This assertion should be in place if we have stereo
+ if ((mixingBuffer.length % 2) != 0) {
+ String msg = "FATAL ERROR: odd number of samples in the mixing buffer";
+ System.out.println(msg);
+ throw new InternalError(msg);
+ }
+
+ // Run down all of the registered tracks mixing them in
+ List/*<Track>*/ curTracks = tracks;
+
+ for (Iterator iter = curTracks.iterator(); iter.hasNext(); ) {
+ Track track = (Track) iter.next();
+ // Consider only playing tracks
+ if (track.isPlaying()) {
+ // First recompute its gain
+ Vec3f pos = track.getPosition();
+ float leftGain = gain(pos, leftSpeakerPosition);
+ float rightGain = gain(pos, rightSpeakerPosition);
+ // Now mix it in
+ int i = 0;
+ while (i < mixingBuffer.length) {
+ if (track.hasNextSample()) {
+ float sample = track.nextSample();
+ mixingBuffer[i++] = sample * leftGain;
+ mixingBuffer[i++] = sample * rightGain;
+ } else {
+ // This allows tracks to stall without being abruptly cancelled
+ if (track.done()) {
+ remove(track);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ // Now that we have our data, send it down to the card
+ int outPos = 0;
+ for (int i = 0; i < mixingBuffer.length; i++) {
+ short val = (short) mixingBuffer[i];
+ buf.put(outPos++, (byte) val);
+ buf.put(outPos++, (byte) (val >> 8));
+ }
+ if (!prepareMixerBuffer(mixerBuffer)) {
+ throw new RuntimeException("Error preparing mixer buffer");
+ }
+ if (!writeMixerBuffer(mixerBuffer)) {
+ throw new RuntimeException("Error writing mixer buffer to device");
+ }
+ } else {
+ // System.out.println("No mixer buffer available");
+
+ // Wait for a buffer to become available
+ if (!WaitForSingleObject(event)) {
+ throw new RuntimeException("Error while waiting for event object");
+ }
+
+ /*
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e) {
+ }
+ */
+ }
+ }
+
+ // Need to shut down
+ shutdownWaveOut();
+ synchronized(shutdownLock) {
+ shutdownLock.notifyAll();
+ }
+ }
+
+ // This defines the 3D spatialization gain function.
+ // The function is defined as:
+ // falloffFactor
+ // -------------------
+ // falloffFactor + r^2
+ private float gain(Vec3f pos, Vec3f speakerPos) {
+ temp.sub(pos, speakerPos);
+ float dotp = temp.dot(temp);
+ return (falloffFactor / (falloffFactor + dotp));
+ }
+ }
+
+ // Initializes waveout device
+ private static native boolean initializeWaveOut(long eventObject);
+ // Shuts down waveout device
+ private static native void shutdownWaveOut();
+
+ // Gets the next (opaque) buffer of data to fill from the native
+ // code, or 0 if none was available yet (it should not happen that
+ // none is available the way the code is written).
+ private static native long getNextMixerBuffer();
+ // Gets the next ByteBuffer to fill out of the mixer buffer. It
+ // requires interleaved left and right channel samples, 16 signed
+ // bits per sample, little endian. Implicit 44.1 kHz sample rate.
+ private static native ByteBuffer getMixerBufferData(long mixerBuffer);
+ // We need these to work around the lack of
+ // JNI_NewDirectByteBuffer in CVM + the JSR 239 NIO classes
+ private static native long getMixerBufferDataAddress(long mixerBuffer);
+ private static native int getMixerBufferDataCapacity(long mixerBuffer);
+ // Prepares this mixer buffer for writing to the device.
+ private static native boolean prepareMixerBuffer(long mixerBuffer);
+ // Writes this mixer buffer to the device.
+ private static native boolean writeMixerBuffer(long mixerBuffer);
+
+ // Helpers to prevent mixer thread from busy waiting
+ private static native long CreateEvent();
+ private static native boolean WaitForSingleObject(long event);
+ private static native void SetEvent(long event);
+ private static native void CloseHandle(long handle);
+
+ // We need a reflective hack to wrap a direct ByteBuffer around
+ // the native memory because JNI_NewDirectByteBuffer doesn't work
+ // in CVM + JSR-239 NIO
+ private static Class directByteBufferClass;
+ private static Constructor directByteBufferConstructor;
+ private static Map createdBuffers = new HashMap(); // Map Long, ByteBuffer
+
+ private static ByteBuffer newDirectByteBuffer(long address, long capacity) {
+ Long key = new Long(address);
+ ByteBuffer buf = (ByteBuffer) createdBuffers.get(key);
+ if (buf == null) {
+ buf = newDirectByteBufferImpl(address, capacity);
+ if (buf != null) {
+ createdBuffers.put(key, buf);
+ }
+ }
+ return buf;
+ }
+ private static ByteBuffer newDirectByteBufferImpl(long address, long capacity) {
+ if (directByteBufferClass == null) {
+ try {
+ directByteBufferClass = Class.forName("java.nio.DirectByteBuffer");
+ byte[] tmp = new byte[0];
+ directByteBufferConstructor =
+ directByteBufferClass.getDeclaredConstructor(new Class[] { Integer.TYPE,
+ tmp.getClass(),
+ Integer.TYPE });
+ directByteBufferConstructor.setAccessible(true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ if (directByteBufferConstructor != null) {
+ try {
+ return (ByteBuffer)
+ directByteBufferConstructor.newInstance(new Object[] {
+ new Integer((int) capacity),
+ null,
+ new Integer((int) address)
+ });
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/classes/com/sun/javafx/audio/windows/waveout/SoundBuffer.java b/src/classes/com/sun/javafx/audio/windows/waveout/SoundBuffer.java
new file mode 100755
index 000000000..b0404673e
--- /dev/null
+++ b/src/classes/com/sun/javafx/audio/windows/waveout/SoundBuffer.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.sun.javafx.audio.windows.waveout;
+
+import java.io.*;
+
+class SoundBuffer {
+ private byte[] data;
+ private boolean needsByteSwap;
+ private int numBytes;
+ private int bytesPerSample;
+ private int numSamples;
+ private boolean playing;
+ private boolean empty;
+
+ // Note: needsByteSwap argument makes assumptions about the format
+ SoundBuffer(int size, int bytesPerSample, boolean needsByteSwap) {
+ this.bytesPerSample = bytesPerSample;
+ this.needsByteSwap = needsByteSwap;
+ data = new byte[size * bytesPerSample];
+ empty = true;
+ }
+
+ boolean playing() {
+ return playing;
+ }
+
+ void playing(boolean playing) {
+ this.playing = playing;
+ }
+
+ boolean empty() {
+ return empty;
+ }
+
+ void empty(boolean empty) {
+ this.empty = empty;
+ }
+
+ void fill(InputStream input) throws IOException {
+ synchronized(this) {
+ if (playing) {
+ throw new IllegalStateException("Can not fill a buffer that is playing");
+ }
+ }
+
+ empty(true);
+ int num = input.read(data);
+ if (num > 0) {
+ numBytes = num;
+ numSamples = numBytes / bytesPerSample;
+ empty(false);
+ if ((numBytes % bytesPerSample) != 0) {
+ System.out.println("WARNING: needed integral multiple of " + bytesPerSample +
+ " bytes, but read " + numBytes + " bytes");
+ }
+ } else {
+ numBytes = 0;
+ }
+ }
+
+ int numSamples() {
+ return numSamples;
+ }
+
+ // This is called by the mixer and must be extremely fast
+ // FIXME: may want to reconsider use of floating point at this point
+ // FIXME: assumes all sounds are of the same format to avoid normalization
+ float getSample(int sample) {
+ int startByte = sample * bytesPerSample;
+ // FIXME: assumes no more than 4 bytes per sample
+ int res = 0;
+ if (needsByteSwap) {
+ for (int i = startByte + bytesPerSample - 1; i >= startByte; i--) {
+ res <<= 8;
+ res |= (data[i] & 0xff);
+ }
+ } else {
+ int endByte = startByte + bytesPerSample - 1;
+ for (int i = startByte; i <= endByte; i++) {
+ res <<= 8;
+ res |= (data[i] & 0xff);
+ }
+ }
+ // Sign extend
+ if (bytesPerSample == 2) {
+ res = (short) res;
+ } else if (bytesPerSample == 1) {
+ res = (byte) res;
+ }
+
+ return (float) res;
+ }
+}
diff --git a/src/classes/com/sun/javafx/audio/windows/waveout/TestSpatialization.java b/src/classes/com/sun/javafx/audio/windows/waveout/TestSpatialization.java
new file mode 100755
index 000000000..e4ade6375
--- /dev/null
+++ b/src/classes/com/sun/javafx/audio/windows/waveout/TestSpatialization.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.sun.javafx.audio.windows.waveout;
+
+import java.io.*;
+import javax.media.opengl.GLDrawableFactory;
+
+public class TestSpatialization {
+ public static void main(String[] args) {
+ if (args.length != 1) {
+ System.out.println("Usage: TestSpatialization [file name]");
+ System.exit(1);
+ }
+
+ try {
+ // FIXME: this is a hack to get the native library loaded
+ GLDrawableFactory.getFactory();
+ // Initialize the audio subsystem
+ Audio audio = Audio.getInstance();
+ // Create a track
+ Track track = audio.newTrack(new File(args[0]));
+ track.setPosition(1, 0, 0);
+ // Run for ten seconds
+ long startTime = System.currentTimeMillis();
+ long duration = 10000;
+ long curTime = 0;
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ }
+ System.out.println("Playing...");
+ track.setLooping(true);
+ track.play();
+ while ((curTime = System.currentTimeMillis()) < startTime + duration) {
+ // Make one revolution every two seconds
+ float rads = (float) (((2 * Math.PI) * (((float) (curTime - startTime)) / 1000.0f)) / 2);
+ track.setPosition((float) Math.cos(rads), 0, (float) Math.sin(rads));
+ // Would like to make it go in a circle, but since
+ // stereo doesn't work now, make it move along a line
+ // track.setPosition(-1.0f, 0, 2.0f * (float) Math.sin(rads));
+ // Sleep a little between updates
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e) {
+ }
+ }
+ System.out.println("Shutting down audio subsystem");
+ audio.shutdown();
+ System.out.println("Exiting.");
+ System.exit(0);
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+}
diff --git a/src/classes/com/sun/javafx/audio/windows/waveout/Track.java b/src/classes/com/sun/javafx/audio/windows/waveout/Track.java
new file mode 100755
index 000000000..190396112
--- /dev/null
+++ b/src/classes/com/sun/javafx/audio/windows/waveout/Track.java
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.sun.javafx.audio.windows.waveout;
+
+import java.io.*;
+import java.nio.*;
+
+public class Track {
+ // Default number of samples per buffer
+ private static final int BUFFER_SIZE = 32768;
+ // Number of bytes per sample (FIXME: dependence on audio format)
+ static final int BYTES_PER_SAMPLE = 2;
+ // Whether we need byte swapping (FIXME: dependence on audio format)
+ static final boolean NEEDS_BYTE_SWAP = true;
+
+ // This is the buffer this track is currently playing from
+ private SoundBuffer activeBuffer;
+ // This is the sample position in the active buffer
+ private int samplePosition;
+ // This is the total number of samples in the file
+ private int totalSamples;
+ // This is the total number of samples we have read
+ private int samplesRead;
+ // This is the buffer that the background filler thread may be filling
+ private SoundBuffer fillingBuffer;
+ // If we're playing the file, this is its input stream
+ private InputStream input;
+ // Keep around the file name
+ private File file;
+ // Whether we're playing this sound
+ private boolean playing;
+ // Whether we're looping this sound
+ private boolean looping;
+ // The position of this sound; defaults to being at the origin
+ private volatile Vec3f position = new Vec3f();
+
+ Track(File file) throws IOException {
+ if (!file.getName().endsWith(".rawsound")) {
+ throw new IOException("Unsupported file format (currently supports only raw sounds)");
+ }
+
+ this.file = file;
+ openInput();
+
+ // Allocate the buffers
+ activeBuffer = new SoundBuffer(BUFFER_SIZE, BYTES_PER_SAMPLE, NEEDS_BYTE_SWAP);
+ fillingBuffer = new SoundBuffer(BUFFER_SIZE, BYTES_PER_SAMPLE, NEEDS_BYTE_SWAP);
+
+ // Fill the first buffer immediately
+ fill();
+ swapBuffers();
+ }
+
+ private void openInput() throws IOException {
+ input = new BufferedInputStream(new FileInputStream(file));
+ totalSamples = (int) file.length() / BYTES_PER_SAMPLE;
+ }
+
+ public File getFile() {
+ return file;
+ }
+
+ public synchronized void play() {
+ if (input == null) {
+ try {
+ openInput();
+ // Fill it immediately
+ fill();
+ } catch (IOException e) {
+ e.printStackTrace();
+ return;
+ }
+ }
+
+ playing = true;
+ }
+
+ public synchronized boolean isPlaying() {
+ return playing;
+ }
+
+ public synchronized void setLooping(boolean looping) {
+ this.looping = looping;
+ }
+
+ public synchronized boolean isLooping() {
+ return looping;
+ }
+
+ public void setPosition(float x, float y, float z) {
+ position = new Vec3f(x, y, z);
+ }
+
+ synchronized void fill() throws IOException {
+ if (input == null) {
+ return;
+ }
+ SoundBuffer curBuffer = fillingBuffer;
+ if (!curBuffer.empty()) {
+ return;
+ }
+ curBuffer.fill(input);
+ if (curBuffer.empty()) {
+ // End of file
+ InputStream tmp = null;
+ synchronized(this) {
+ tmp = input;
+ input = null;
+ }
+ tmp.close();
+
+ // If looping, re-open
+ if (isLooping()) {
+ openInput();
+ // and fill
+ fill();
+ }
+ }
+ }
+
+ // These are only for use by the Mixer
+ private float leftGain;
+ private float rightGain;
+
+ void setLeftGain(float leftGain) {
+ this.leftGain = leftGain;
+ }
+
+ float getLeftGain() {
+ return leftGain;
+ }
+
+ void setRightGain(float rightGain) {
+ this.rightGain = rightGain;
+ }
+
+ float getRightGain() {
+ return rightGain;
+ }
+
+ Vec3f getPosition() {
+ return position;
+ }
+
+ // This is called by the mixer and must be extremely fast
+ // Note this assumes mono sounds (FIXME)
+ boolean hasNextSample() {
+ return (!activeBuffer.empty() && samplePosition < activeBuffer.numSamples());
+ }
+
+ // This is called by the mixer and must be extremely fast
+ float nextSample() {
+ float res = activeBuffer.getSample(samplePosition++);
+ ++samplesRead;
+ if (!hasNextSample()) {
+ swapBuffers();
+ samplePosition = 0;
+ if (done()) {
+ playing = false;
+ }
+ }
+ return res;
+ }
+
+ synchronized void swapBuffers() {
+ SoundBuffer tmp = activeBuffer;
+ activeBuffer = fillingBuffer;
+ fillingBuffer = tmp;
+ fillingBuffer.empty(true);
+ }
+
+ // This provides a more robust termination condition
+ boolean done() {
+ return (samplesRead == totalSamples) && !looping;
+ }
+}
diff --git a/src/classes/com/sun/javafx/audio/windows/waveout/Vec3f.java b/src/classes/com/sun/javafx/audio/windows/waveout/Vec3f.java
new file mode 100755
index 000000000..9a3038e35
--- /dev/null
+++ b/src/classes/com/sun/javafx/audio/windows/waveout/Vec3f.java
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.sun.javafx.audio.windows.waveout;
+
+/** 3-element single-precision vector */
+
+class Vec3f {
+ public static final Vec3f X_AXIS = new Vec3f( 1, 0, 0);
+ public static final Vec3f Y_AXIS = new Vec3f( 0, 1, 0);
+ public static final Vec3f Z_AXIS = new Vec3f( 0, 0, 1);
+ public static final Vec3f NEG_X_AXIS = new Vec3f(-1, 0, 0);
+ public static final Vec3f NEG_Y_AXIS = new Vec3f( 0, -1, 0);
+ public static final Vec3f NEG_Z_AXIS = new Vec3f( 0, 0, -1);
+
+ private float x;
+ private float y;
+ private float z;
+
+ public Vec3f() {}
+
+ public Vec3f(Vec3f arg) {
+ set(arg);
+ }
+
+ public Vec3f(float x, float y, float z) {
+ set(x, y, z);
+ }
+
+ public Vec3f copy() {
+ return new Vec3f(this);
+ }
+
+ public void set(Vec3f arg) {
+ set(arg.x, arg.y, arg.z);
+ }
+
+ public void set(float x, float y, float z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ /** Sets the ith component, 0 <= i < 3 */
+ public void set(int i, float val) {
+ switch (i) {
+ case 0: x = val; break;
+ case 1: y = val; break;
+ case 2: z = val; break;
+ default: throw new IndexOutOfBoundsException();
+ }
+ }
+
+ /** Gets the ith component, 0 <= i < 3 */
+ public float get(int i) {
+ switch (i) {
+ case 0: return x;
+ case 1: return y;
+ case 2: return z;
+ default: throw new IndexOutOfBoundsException();
+ }
+ }
+
+ public float x() { return x; }
+ public float y() { return y; }
+ public float z() { return z; }
+
+ public void setX(float x) { this.x = x; }
+ public void setY(float y) { this.y = y; }
+ public void setZ(float z) { this.z = z; }
+
+ public float dot(Vec3f arg) {
+ return x * arg.x + y * arg.y + z * arg.z;
+ }
+
+ public float length() {
+ return (float) Math.sqrt(lengthSquared());
+ }
+
+ public float lengthSquared() {
+ return this.dot(this);
+ }
+
+ public void normalize() {
+ float len = length();
+ if (len == 0.0f) return;
+ scale(1.0f / len);
+ }
+
+ /** Returns this * val; creates new vector */
+ public Vec3f times(float val) {
+ Vec3f tmp = new Vec3f(this);
+ tmp.scale(val);
+ return tmp;
+ }
+
+ /** this = this * val */
+ public void scale(float val) {
+ x *= val;
+ y *= val;
+ z *= val;
+ }
+
+ /** Returns this + arg; creates new vector */
+ public Vec3f plus(Vec3f arg) {
+ Vec3f tmp = new Vec3f();
+ tmp.add(this, arg);
+ return tmp;
+ }
+
+ /** this = this + b */
+ public void add(Vec3f b) {
+ add(this, b);
+ }
+
+ /** this = a + b */
+ public void add(Vec3f a, Vec3f b) {
+ x = a.x + b.x;
+ y = a.y + b.y;
+ z = a.z + b.z;
+ }
+
+ /** Returns this + s * arg; creates new vector */
+ public Vec3f addScaled(float s, Vec3f arg) {
+ Vec3f tmp = new Vec3f();
+ tmp.addScaled(this, s, arg);
+ return tmp;
+ }
+
+ /** this = a + s * b */
+ public void addScaled(Vec3f a, float s, Vec3f b) {
+ x = a.x + s * b.x;
+ y = a.y + s * b.y;
+ z = a.z + s * b.z;
+ }
+
+ /** Returns this - arg; creates new vector */
+ public Vec3f minus(Vec3f arg) {
+ Vec3f tmp = new Vec3f();
+ tmp.sub(this, arg);
+ return tmp;
+ }
+
+ /** this = this - b */
+ public void sub(Vec3f b) {
+ sub(this, b);
+ }
+
+ /** this = a - b */
+ public void sub(Vec3f a, Vec3f b) {
+ x = a.x - b.x;
+ y = a.y - b.y;
+ z = a.z - b.z;
+ }
+
+ /** Returns this cross arg; creates new vector */
+ public Vec3f cross(Vec3f arg) {
+ Vec3f tmp = new Vec3f();
+ tmp.cross(this, arg);
+ return tmp;
+ }
+
+ /** this = a cross b. NOTE: "this" must be a different vector than
+ both a and b. */
+ public void cross(Vec3f a, Vec3f b) {
+ x = a.y * b.z - a.z * b.y;
+ y = a.z * b.x - a.x * b.z;
+ z = a.x * b.y - a.y * b.x;
+ }
+
+ /** Sets each component of this vector to the product of the
+ component with the corresponding component of the argument
+ vector. */
+ public void componentMul(Vec3f arg) {
+ x *= arg.x;
+ y *= arg.y;
+ z *= arg.z;
+ }
+
+ public String toString() {
+ return "(" + x + ", " + y + ", " + z + ")";
+ }
+}
diff --git a/src/classes/com/sun/opengl/impl/FunctionAvailabilityCache.java b/src/classes/com/sun/opengl/impl/FunctionAvailabilityCache.java
index c2392baa9..4eb34b7f2 100644
--- a/src/classes/com/sun/opengl/impl/FunctionAvailabilityCache.java
+++ b/src/classes/com/sun/opengl/impl/FunctionAvailabilityCache.java
@@ -41,10 +41,8 @@ package com.sun.opengl.impl;
import javax.media.opengl.*;
import java.util.*;
-import java.util.regex.*;
-import java.awt.Canvas;
-import java.awt.Graphics;
-import java.awt.GraphicsConfiguration;
+// FIXME: refactor Java SE dependencies
+//import java.util.regex.*;
import java.lang.reflect.*;
/**
@@ -325,6 +323,7 @@ public final class FunctionAvailabilityCache {
major = Integer.valueOf(tok.nextToken()).intValue();
minor = Integer.valueOf(tok.nextToken()).intValue();
+ /*
// See if there's version-specific information which might
// imply a more recent OpenGL version
tok = new StringTokenizer(versionString, " ");
@@ -347,14 +346,22 @@ public final class FunctionAvailabilityCache {
}
}
}
+ */
}
}
catch (Exception e)
{
+ // FIXME: refactor desktop OpenGL dependencies and make this
+ // class work properly for OpenGL ES
+ e.printStackTrace();
+ major = 1;
+ minor = 0;
+ /*
throw (IllegalArgumentException)
new IllegalArgumentException(
"Illegally formatted version identifier: \"" + versionString + "\"")
.initCause(e);
+ */
}
}
diff --git a/src/classes/com/sun/opengl/impl/GLBufferSizeTracker.java b/src/classes/com/sun/opengl/impl/GLBufferSizeTracker.java
index 4538f8450..3cc756788 100755
--- a/src/classes/com/sun/opengl/impl/GLBufferSizeTracker.java
+++ b/src/classes/com/sun/opengl/impl/GLBufferSizeTracker.java
@@ -151,10 +151,10 @@ public class GLBufferSizeTracker {
if (sz == null) {
// For robustness, try to query this value from the GL as we used to
int[] tmp = new int[1];
- caller.glGetBufferParameterivARB(target, GL.GL_BUFFER_SIZE_ARB, tmp, 0);
+ caller.glGetBufferParameteriv(target, GL.GL_BUFFER_SIZE, tmp, 0);
if (tmp[0] == 0) {
// Assume something is wrong rather than silently going along
- throw new GLException("Error: buffer size returned by glGetBufferParameterivARB was zero; probably application error");
+ throw new GLException("Error: buffer size returned by glGetBufferParameteriv was zero; probably application error");
}
// Assume we just don't know what's happening
sz = new Integer(tmp[0]);
@@ -170,7 +170,7 @@ public class GLBufferSizeTracker {
}
// We don't know what's going on in this case; query the GL for an answer
int[] tmp = new int[1];
- caller.glGetBufferParameterivARB(target, GL.GL_BUFFER_SIZE_ARB, tmp, 0);
+ caller.glGetBufferParameteriv(target, GL.GL_BUFFER_SIZE, tmp, 0);
if (DEBUG) {
System.err.println("GLBufferSizeTracker.getBufferSize(): no cached buffer information");
}
diff --git a/src/classes/com/sun/opengl/impl/GLBufferStateTracker.java b/src/classes/com/sun/opengl/impl/GLBufferStateTracker.java
index 2c4a9963e..54acd8899 100755
--- a/src/classes/com/sun/opengl/impl/GLBufferStateTracker.java
+++ b/src/classes/com/sun/opengl/impl/GLBufferStateTracker.java
@@ -81,8 +81,9 @@ public class GLBufferStateTracker {
private static final Integer arrayBufferEnum = new Integer(GL.GL_ARRAY_BUFFER);
private static final Integer elementArrayBufferEnum = new Integer(GL.GL_ELEMENT_ARRAY_BUFFER);
- private static final Integer pixelPackBufferEnum = new Integer(GL.GL_PIXEL_PACK_BUFFER);
- private static final Integer pixelUnpackBufferEnum = new Integer(GL.GL_PIXEL_UNPACK_BUFFER);
+ // FIXME: refactor dependencies on desktop OpenGL
+ // private static final Integer pixelPackBufferEnum = new Integer(GL.GL_PIXEL_PACK_BUFFER);
+ // private static final Integer pixelUnpackBufferEnum = new Integer(GL.GL_PIXEL_UNPACK_BUFFER);
private static final Integer zero = new Integer(0);
// Maps binding targets to buffer objects. A null value indicates
@@ -96,8 +97,9 @@ public class GLBufferStateTracker {
// Start with known unbound targets for known keys
bindingMap.put(arrayBufferEnum, zero);
bindingMap.put(elementArrayBufferEnum, zero);
- bindingMap.put(pixelPackBufferEnum, zero);
- bindingMap.put(pixelUnpackBufferEnum, zero);
+ // FIXME: refactor dependencies on desktop OpenGL
+ // bindingMap.put(pixelPackBufferEnum, zero);
+ // bindingMap.put(pixelUnpackBufferEnum, zero);
}
public void setBoundBufferObject(int target, int buffer) {
@@ -121,8 +123,9 @@ public class GLBufferStateTracker {
switch (target) {
case GL.GL_ARRAY_BUFFER: queryTarget = GL.GL_ARRAY_BUFFER_BINDING; break;
case GL.GL_ELEMENT_ARRAY_BUFFER: queryTarget = GL.GL_ELEMENT_ARRAY_BUFFER_BINDING; break;
- case GL.GL_PIXEL_PACK_BUFFER: queryTarget = GL.GL_PIXEL_PACK_BUFFER_BINDING; break;
- case GL.GL_PIXEL_UNPACK_BUFFER: queryTarget = GL.GL_PIXEL_UNPACK_BUFFER_BINDING; break;
+ // FIXME: refactor dependencies on desktop OpenGL
+ // case GL.GL_PIXEL_PACK_BUFFER: queryTarget = GL.GL_PIXEL_PACK_BUFFER_BINDING; break;
+ // case GL.GL_PIXEL_UNPACK_BUFFER: queryTarget = GL.GL_PIXEL_UNPACK_BUFFER_BINDING; break;
default: gotQueryTarget = false; break;
}
if (gotQueryTarget) {
@@ -165,8 +168,9 @@ public class GLBufferStateTracker {
case 0: return zero;
case GL.GL_ARRAY_BUFFER: return arrayBufferEnum;
case GL.GL_ELEMENT_ARRAY_BUFFER: return elementArrayBufferEnum;
- case GL.GL_PIXEL_PACK_BUFFER: return pixelPackBufferEnum;
- case GL.GL_PIXEL_UNPACK_BUFFER: return pixelUnpackBufferEnum;
+ // FIXME: refactor dependencies on desktop OpenGL
+ // case GL.GL_PIXEL_PACK_BUFFER: return pixelPackBufferEnum;
+ // case GL.GL_PIXEL_UNPACK_BUFFER: return pixelUnpackBufferEnum;
default: return new Integer(key);
}
}
diff --git a/src/classes/com/sun/opengl/impl/GLContextImpl.java b/src/classes/com/sun/opengl/impl/GLContextImpl.java
index 21e6d6598..55ed1cc52 100644
--- a/src/classes/com/sun/opengl/impl/GLContextImpl.java
+++ b/src/classes/com/sun/opengl/impl/GLContextImpl.java
@@ -39,7 +39,8 @@
package com.sun.opengl.impl;
-import java.awt.Component;
+// FIXME: refactor
+// import java.awt.Component;
import java.nio.*;
import javax.media.opengl.*;
@@ -72,6 +73,8 @@ public abstract class GLContextImpl extends GLContext {
// repeated glGet calls upon glMapBuffer operations
private GLBufferSizeTracker bufferSizeTracker;
+ /* FIXME: needed only by the Java 2D / JOGL bridge; refactor
+
// Tracks creation and deletion of server-side OpenGL objects when
// the Java2D/OpenGL pipeline is active and using FBOs to render
private GLObjectTracker tracker;
@@ -79,11 +82,16 @@ public abstract class GLContextImpl extends GLContext {
// current which can support immediate deletion of them
private GLObjectTracker deletedObjectTracker;
+ */
+
protected GL gl;
+
+ /* FIXME: refactor these dependencies on the Java 2D / JOGL bridge
+
public GLContextImpl(GLContext shareWith) {
this(shareWith, false);
}
-
+
public GLContextImpl(GLContext shareWith, boolean dontShareWithJava2D) {
functionAvailability = new FunctionAvailabilityCache(this);
GLContext shareContext = shareWith;
@@ -104,6 +112,18 @@ public abstract class GLContextImpl extends GLContext {
setGL(createGL());
}
+ */
+
+ public GLContextImpl(GLContext shareWith) {
+ functionAvailability = new FunctionAvailabilityCache(this);
+ if (shareWith != null) {
+ GLContextShareSet.registerSharing(this, shareWith);
+ }
+ // This must occur after the above calls into the
+ // GLContextShareSet, which set up state needed by the GL object
+ setGL(createGL());
+ }
+
public int makeCurrent() throws GLException {
// Support calls to makeCurrent() over and over again with
// different contexts without releasing them
@@ -132,11 +152,13 @@ public abstract class GLContextImpl extends GLContext {
int res = 0;
try {
res = makeCurrentImpl();
+ /* FIXME: refactor dependence on Java 2D / JOGL bridge
if ((tracker != null) &&
(res == CONTEXT_CURRENT_NEW)) {
// Increase reference count of GLObjectTracker
tracker.ref();
}
+ */
} catch (GLException e) {
lock.unlock();
throw(e);
@@ -146,11 +168,14 @@ public abstract class GLContextImpl extends GLContext {
} else {
setCurrent(this);
+ /* FIXME: refactor dependence on Java 2D / JOGL bridge
+
// Try cleaning up any stale server-side OpenGL objects
// FIXME: not sure what to do here if this throws
if (deletedObjectTracker != null) {
deletedObjectTracker.clean(getGL());
}
+ */
}
return res;
}
@@ -176,6 +201,7 @@ public abstract class GLContextImpl extends GLContext {
throw new GLException("Can not destroy context while it is current");
}
+ /* FIXME: refactor dependence on Java 2D / JOGL bridge
if (tracker != null) {
// Don't need to do anything for contexts that haven't been
// created yet
@@ -190,6 +216,7 @@ public abstract class GLContextImpl extends GLContext {
tracker.unref(deletedObjectTracker);
}
}
+ */
// Because we don't know how many other contexts we might be
// sharing with (and it seems too complicated to implement the
@@ -239,9 +266,11 @@ public abstract class GLContextImpl extends GLContext {
/** Create the GL for this context. */
protected GL createGL() {
GLImpl gl = new GLImpl(this);
+ /* FIXME: refactor dependence on Java 2D / JOGL bridge
if (tracker != null) {
gl.setObjectTracker(tracker);
}
+ */
return gl;
}
@@ -386,6 +415,8 @@ public abstract class GLContextImpl extends GLContext {
return bufferSizeTracker;
}
+ /* FIXME: refactor dependence on Java 2D / JOGL bridge
+
//---------------------------------------------------------------------------
// Helpers for integration with Java2D/OpenGL pipeline when FBOs are
// being used
@@ -407,6 +438,8 @@ public abstract class GLContextImpl extends GLContext {
return deletedObjectTracker;
}
+ */
+
//---------------------------------------------------------------------------
// Helpers for context optimization where the last context is left
// current on the OpenGL worker thread
diff --git a/src/classes/com/sun/opengl/impl/GLContextShareSet.java b/src/classes/com/sun/opengl/impl/GLContextShareSet.java
index e02ef1fb5..a3614633d 100644
--- a/src/classes/com/sun/opengl/impl/GLContextShareSet.java
+++ b/src/classes/com/sun/opengl/impl/GLContextShareSet.java
@@ -39,9 +39,10 @@
package com.sun.opengl.impl;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
-import java.awt.GraphicsEnvironment;
+// FIXME: refactor Java SE dependencies
+// import java.awt.GraphicsConfiguration;
+// import java.awt.GraphicsDevice;
+// import java.awt.GraphicsEnvironment;
import java.lang.ref.*;
import java.util.*;
import javax.media.opengl.*;
@@ -51,7 +52,8 @@ import javax.media.opengl.*;
context creation as is inherent in the AWT and Swing. */
public class GLContextShareSet {
- private static boolean forceTracking = Debug.isPropertyDefined("jogl.glcontext.forcetracking");
+ // FIXME: refactor Java SE dependencies
+ // private static boolean forceTracking = Debug.isPropertyDefined("jogl.glcontext.forcetracking");
private static final boolean DEBUG = Debug.debug("GLContextShareSet");
// This class is implemented with a WeakHashMap that goes from the
@@ -148,122 +150,123 @@ public class GLContextShareSet {
}
}
- /** Indicates that the two supplied contexts (which must be able to
- share textures and display lists) should be in the same
- namespace for tracking of server-side object creation and
- deletion. Because the sharing necessary behind the scenes is
- different than that requested at the user level, the two notions
- are different. This must be called immediately after the
- creation of the new context (which is the second argument)
- before any server-side OpenGL objects have been created in that
- context. */
- public static void registerForObjectTracking(GLContext olderContextOrNull,
- GLContext newContext,
- GLContext realShareContext) {
- if (isObjectTrackingEnabled() || isObjectTrackingDebuggingEnabled()) {
- GLContextImpl impl1 = null;
- GLContextImpl impl2 = null;
- GLObjectTracker tracker = null;
-
- synchronized (GLContextShareSet.class) {
- if (olderContextOrNull != null &&
- newContext != null) {
- if (entryFor(olderContextOrNull) != entryFor(newContext)) {
- throw new IllegalArgumentException("old and new contexts must be able to share textures and display lists");
- }
- }
-
- // FIXME: downcast to GLContextImpl undesirable
- impl1 = (GLContextImpl) olderContextOrNull;
- impl2 = (GLContextImpl) newContext;
-
- GLObjectTracker deletedObjectTracker = null;
- GLContextImpl shareImpl = (GLContextImpl) realShareContext;
- // Before we zap the "user-level" object trackers, make sure
- // that all contexts in the share set share the destroyed object
- // tracker
- if (shareImpl != null) {
- deletedObjectTracker = shareImpl.getDeletedObjectTracker();
- }
- if (deletedObjectTracker == null) {
- // Must create one and possibly set it up in the older context
- deletedObjectTracker = new GLObjectTracker();
- if (DEBUG) {
- System.err.println("Created deletedObjectTracker " + deletedObjectTracker + " because " +
- ((shareImpl == null) ? "shareImpl was null" : "shareImpl's (" + shareImpl + ") deletedObjectTracker was null"));
- }
-
- if (shareImpl != null) {
- // FIXME: think should really assert in this case
- shareImpl.setDeletedObjectTracker(deletedObjectTracker);
- if (DEBUG) {
- System.err.println("Set deletedObjectTracker " + deletedObjectTracker + " in shareImpl context " + shareImpl);
- }
- }
- }
- impl2.setDeletedObjectTracker(deletedObjectTracker);
- if (DEBUG) {
- System.err.println("Set deletedObjectTracker " + deletedObjectTracker + " in impl2 context " + impl2);
- }
- }
-
- // Must not hold lock around this operation
- // Don't share object trackers with the primordial share context from Java2D
- if (Java2D.isOGLPipelineActive()) {
- // FIXME: probably need to do something different here
- // Need to be able to figure out the GraphicsDevice for the
- // older context if it's on-screen
- GraphicsConfiguration gc = GraphicsEnvironment.
- getLocalGraphicsEnvironment().
- getDefaultScreenDevice().
- getDefaultConfiguration();
- GLContext j2dShareContext = Java2D.getShareContext(gc);
- if (impl1 != null && impl1 == j2dShareContext) {
- impl1 = null;
- }
- }
-
- synchronized (GLContextShareSet.class) {
- if (impl1 != null) {
- tracker = impl1.getObjectTracker();
- assert (tracker != null)
- : "registerForObjectTracking was not called properly for the older context";
- }
- if (tracker == null) {
- tracker = new GLObjectTracker();
- }
- // Note that we don't assert that the tracker is non-null for
- // impl2 because the way we use this functionality we actually
- // overwrite the initially-set object tracker in the new context
- impl2.setObjectTracker(tracker);
- }
- }
- }
-
- /** In order to avoid glGet calls for buffer object checks related
- to glVertexPointer, etc. calls as well as glMapBuffer calls, we
- need to share the same GLBufferSizeTracker object between
- contexts sharing textures and display lists. For now we keep
- this mechanism orthogonal to the GLObjectTracker to hopefully
- keep things easier to understand. (The GLObjectTracker is
- currently only needed in a fairly esoteric case, when the
- Java2D/JOGL bridge is active, but the GLBufferSizeTracker
- mechanism is now always required.) */
- public static void registerForBufferObjectSharing(GLContext olderContextOrNull, GLContext newContext) {
- // FIXME: downcasts to GLContextImpl undesirable
- GLContextImpl older = (GLContextImpl) olderContextOrNull;
- GLContextImpl newer = (GLContextImpl) newContext;
- GLBufferSizeTracker tracker = null;
- if (older != null) {
- tracker = older.getBufferSizeTracker();
- assert (tracker != null)
- : "registerForBufferObjectSharing was not called properly for the older context, or has a bug in it";
- }
- if (tracker == null) {
- tracker = new GLBufferSizeTracker();
- }
- newer.setBufferSizeTracker(tracker);
- }
+ // FIXME: refactor Java SE dependencies
+ // /** Indicates that the two supplied contexts (which must be able to
+ // share textures and display lists) should be in the same
+ // namespace for tracking of server-side object creation and
+ // deletion. Because the sharing necessary behind the scenes is
+ // different than that requested at the user level, the two notions
+ // are different. This must be called immediately after the
+ // creation of the new context (which is the second argument)
+ // before any server-side OpenGL objects have been created in that
+ // context. */
+ // public static void registerForObjectTracking(GLContext olderContextOrNull,
+ // GLContext newContext,
+ // GLContext realShareContext) {
+ // if (isObjectTrackingEnabled() || isObjectTrackingDebuggingEnabled()) {
+ // GLContextImpl impl1 = null;
+ // GLContextImpl impl2 = null;
+ // GLObjectTracker tracker = null;
+ //
+ // synchronized (GLContextShareSet.class) {
+ // if (olderContextOrNull != null &&
+ // newContext != null) {
+ // if (entryFor(olderContextOrNull) != entryFor(newContext)) {
+ // throw new IllegalArgumentException("old and new contexts must be able to share textures and display lists");
+ // }
+ // }
+ //
+ // // FIXME: downcast to GLContextImpl undesirable
+ // impl1 = (GLContextImpl) olderContextOrNull;
+ // impl2 = (GLContextImpl) newContext;
+ //
+ // GLObjectTracker deletedObjectTracker = null;
+ // GLContextImpl shareImpl = (GLContextImpl) realShareContext;
+ // // Before we zap the "user-level" object trackers, make sure
+ // // that all contexts in the share set share the destroyed object
+ // // tracker
+ // if (shareImpl != null) {
+ // deletedObjectTracker = shareImpl.getDeletedObjectTracker();
+ // }
+ // if (deletedObjectTracker == null) {
+ // // Must create one and possibly set it up in the older context
+ // deletedObjectTracker = new GLObjectTracker();
+ // if (DEBUG) {
+ // System.err.println("Created deletedObjectTracker " + deletedObjectTracker + " because " +
+ // ((shareImpl == null) ? "shareImpl was null" : "shareImpl's (" + shareImpl + ") deletedObjectTracker was null"));
+ // }
+ //
+ // if (shareImpl != null) {
+ // // FIXME: think should really assert in this case
+ // shareImpl.setDeletedObjectTracker(deletedObjectTracker);
+ // if (DEBUG) {
+ // System.err.println("Set deletedObjectTracker " + deletedObjectTracker + " in shareImpl context " + shareImpl);
+ // }
+ // }
+ // }
+ // impl2.setDeletedObjectTracker(deletedObjectTracker);
+ // if (DEBUG) {
+ // System.err.println("Set deletedObjectTracker " + deletedObjectTracker + " in impl2 context " + impl2);
+ // }
+ // }
+ //
+ // // Must not hold lock around this operation
+ // // Don't share object trackers with the primordial share context from Java2D
+ // if (Java2D.isOGLPipelineActive()) {
+ // // FIXME: probably need to do something different here
+ // // Need to be able to figure out the GraphicsDevice for the
+ // // older context if it's on-screen
+ // GraphicsConfiguration gc = GraphicsEnvironment.
+ // getLocalGraphicsEnvironment().
+ // getDefaultScreenDevice().
+ // getDefaultConfiguration();
+ // GLContext j2dShareContext = Java2D.getShareContext(gc);
+ // if (impl1 != null && impl1 == j2dShareContext) {
+ // impl1 = null;
+ // }
+ // }
+ //
+ // synchronized (GLContextShareSet.class) {
+ // if (impl1 != null) {
+ // tracker = impl1.getObjectTracker();
+ // assert (tracker != null)
+ // : "registerForObjectTracking was not called properly for the older context";
+ // }
+ // if (tracker == null) {
+ // tracker = new GLObjectTracker();
+ // }
+ // // Note that we don't assert that the tracker is non-null for
+ // // impl2 because the way we use this functionality we actually
+ // // overwrite the initially-set object tracker in the new context
+ // impl2.setObjectTracker(tracker);
+ // }
+ // }
+ // }
+ //
+ // /** In order to avoid glGet calls for buffer object checks related
+ // to glVertexPointer, etc. calls as well as glMapBuffer calls, we
+ // need to share the same GLBufferSizeTracker object between
+ // contexts sharing textures and display lists. For now we keep
+ // this mechanism orthogonal to the GLObjectTracker to hopefully
+ // keep things easier to understand. (The GLObjectTracker is
+ // currently only needed in a fairly esoteric case, when the
+ // Java2D/JOGL bridge is active, but the GLBufferSizeTracker
+ // mechanism is now always required.) */
+ // public static void registerForBufferObjectSharing(GLContext olderContextOrNull, GLContext newContext) {
+ // // FIXME: downcasts to GLContextImpl undesirable
+ // GLContextImpl older = (GLContextImpl) olderContextOrNull;
+ // GLContextImpl newer = (GLContextImpl) newContext;
+ // GLBufferSizeTracker tracker = null;
+ // if (older != null) {
+ // tracker = older.getBufferSizeTracker();
+ // assert (tracker != null)
+ // : "registerForBufferObjectSharing was not called properly for the older context, or has a bug in it";
+ // }
+ // if (tracker == null) {
+ // tracker = new GLBufferSizeTracker();
+ // }
+ // newer.setBufferSizeTracker(tracker);
+ // }
//----------------------------------------------------------------------
// Internals only below this point
@@ -279,12 +282,13 @@ public class GLContextShareSet {
}
}
- private static boolean isObjectTrackingEnabled() {
- return ((Java2D.isOGLPipelineActive() && Java2D.isFBOEnabled()) ||
- isObjectTrackingDebuggingEnabled());
- }
-
- private static boolean isObjectTrackingDebuggingEnabled() {
- return forceTracking;
- }
+ // FIXME: refactor Java SE dependencies
+ // private static boolean isObjectTrackingEnabled() {
+ // return ((Java2D.isOGLPipelineActive() && Java2D.isFBOEnabled()) ||
+ // isObjectTrackingDebuggingEnabled());
+ // }
+ //
+ // private static boolean isObjectTrackingDebuggingEnabled() {
+ // return forceTracking;
+ // }
}
diff --git a/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java b/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java
index d5b14c099..7f0718c44 100644
--- a/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java
+++ b/src/classes/com/sun/opengl/impl/GLDrawableFactoryImpl.java
@@ -39,10 +39,6 @@
package com.sun.opengl.impl;
-import java.awt.Component;
-import java.awt.Graphics;
-import java.awt.GraphicsConfiguration;
-import java.awt.GraphicsDevice;
import java.nio.*;
import javax.media.opengl.*;
import com.sun.gluegen.runtime.*;
@@ -87,10 +83,12 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory implements
// implement this functionality on all other platforms
//
+ /* FIXME: refactor dependencies on Java SE
public abstract boolean canCreateContextOnJava2DSurface();
public abstract GLContext createContextOnJava2DSurface(Graphics g, GLContext shareWith)
throws GLException;
+ */
//----------------------------------------------------------------------
// Gamma adjustment support
diff --git a/src/classes/com/sun/opengl/impl/NativeLibLoader.java b/src/classes/com/sun/opengl/impl/NativeLibLoader.java
index 522b81a03..ffe8df3e2 100644
--- a/src/classes/com/sun/opengl/impl/NativeLibLoader.java
+++ b/src/classes/com/sun/opengl/impl/NativeLibLoader.java
@@ -39,7 +39,8 @@
package com.sun.opengl.impl;
-import java.awt.Toolkit;
+// FIXME: refactor Java SE dependencies
+//import java.awt.Toolkit;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.AccessController;
@@ -114,6 +115,7 @@ public class NativeLibLoader {
});
}
+ /* FIXME: refactor Java SE dependencies
public static void loadAWTImpl() {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
@@ -134,6 +136,7 @@ public class NativeLibLoader {
}
});
}
+ */
public static void loadCgImpl() {
AccessController.doPrivileged(new PrivilegedAction() {
@@ -186,6 +189,8 @@ public class NativeLibLoader {
throw (UnsatisfiedLinkError) new UnsatisfiedLinkError().initCause(e);
}
} else {
+ // FIXME: remove
+ // System.out.println("sun.boot.library.path=" + System.getProperty("sun.boot.library.path"));
System.loadLibrary(libraryName);
}
}
diff --git a/src/classes/com/sun/opengl/impl/ProjectES1.java b/src/classes/com/sun/opengl/impl/ProjectES1.java
new file mode 100755
index 000000000..68b478641
--- /dev/null
+++ b/src/classes/com/sun/opengl/impl/ProjectES1.java
@@ -0,0 +1,1033 @@
+/*
+** License Applicability. Except to the extent portions of this file are
+** made subject to an alternative license as permitted in the SGI Free
+** Software License B, Version 1.1 (the "License"), the contents of this
+** file are subject only to the provisions of the License. You may not use
+** this file except in compliance with the License. You may obtain a copy
+** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
+** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
+**
+** http://oss.sgi.com/projects/FreeB
+**
+** Note that, as provided in the License, the Software is distributed on an
+** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
+** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
+** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
+** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
+**
+** NOTE: The Original Code (as defined below) has been licensed to Sun
+** Microsystems, Inc. ("Sun") under the SGI Free Software License B
+** (Version 1.1), shown above ("SGI License"). Pursuant to Section
+** 3.2(3) of the SGI License, Sun is distributing the Covered Code to
+** you under an alternative license ("Alternative License"). This
+** Alternative License includes all of the provisions of the SGI License
+** except that Section 2.2 and 11 are omitted. Any differences between
+** the Alternative License and the SGI License are offered solely by Sun
+** and not by SGI.
+**
+** Original Code. The Original Code is: OpenGL Sample Implementation,
+** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
+** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
+** Copyright in any portions created by third parties is as indicated
+** elsewhere herein. All Rights Reserved.
+**
+** Additional Notice Provisions: The application programming interfaces
+** established by SGI in conjunction with the Original Code are The
+** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
+** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
+** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
+** Window System(R) (Version 1.3), released October 19, 1998. This software
+** was created using the OpenGL(R) version 1.2.1 Sample Implementation
+** published by SGI, but has not been independently verified as being
+** compliant with the OpenGL(R) version 1.2.1 Specification.
+**
+** $Date$ $Revision$
+** $Header$
+*/
+
+/*
+ * Copyright (c) 2002-2004 LWJGL Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of 'LWJGL' nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * You acknowledge that this software is not designed or intended for use
+ * in the design, construction, operation or maintenance of any nuclear
+ * facility.
+ */
+package com.sun.opengl.impl;
+
+import java.nio.*;
+
+import javax.media.opengl.*;
+import com.sun.opengl.util.*;
+
+/**
+ * ProjectES1.java
+ * <p/>
+ * <p/>
+ * Created 11-jan-2004
+ *
+ * @author Erik Duijs
+ * @author Kenneth Russell
+ */
+public class ProjectES1 {
+ private static final float[] IDENTITY_MATRIX =
+ new float[] {
+ 1.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 0.0f, 1.0f };
+
+ // Note that we have cloned parts of the implementation in order to
+ // support incoming Buffers. The reason for this is to avoid loading
+ // non-direct buffer subclasses unnecessarily, because doing so can
+ // cause performance decreases on direct buffer operations, at least
+ // on the current HotSpot JVM. It would be nicer (and make the code
+ // simpler) to simply have the array-based entry points delegate to
+ // the versions taking Buffers by wrapping the arrays.
+
+ // Array-based implementation
+ private final float[] matrix = new float[16];
+
+ private final float[][] tempMatrix = new float[4][4];
+ private final float[] in = new float[4];
+ private final float[] out = new float[4];
+
+ private final float[] forward = new float[3];
+ private final float[] side = new float[3];
+ private final float[] up = new float[3];
+
+ // Buffer-based implementation
+ private final FloatBuffer matrixBuf;
+
+ private final FloatBuffer tempMatrixBuf;
+ private final FloatBuffer inBuf;
+ private final FloatBuffer outBuf;
+
+ private final FloatBuffer forwardBuf;
+ private final FloatBuffer sideBuf;
+ private final FloatBuffer upBuf;
+
+ public ProjectES1() {
+ // Use direct buffers to avoid loading indirect buffer
+ // implementations for applications trying to avoid doing so.
+ // Slice up one big buffer because some NIO implementations
+ // allocate a huge amount of memory to back even the smallest of
+ // buffers.
+ FloatBuffer buf = BufferUtil.newFloatBuffer(128);
+ int pos = 0;
+ int sz = 16;
+ matrixBuf = slice(buf, pos, sz);
+ pos += sz;
+ tempMatrixBuf = slice(buf, pos, sz);
+ pos += sz;
+ sz = 4;
+ inBuf = slice(buf, pos, sz);
+ pos += sz;
+ outBuf = slice(buf, pos, sz);
+ pos += sz;
+ sz = 3;
+ forwardBuf = slice(buf, pos, sz);
+ pos += sz;
+ sideBuf = slice(buf, pos, sz);
+ pos += sz;
+ upBuf = slice(buf, pos, sz);
+ }
+
+ private static FloatBuffer slice(FloatBuffer buf, int pos, int len) {
+ buf.position(pos);
+ buf.limit(pos + len);
+ return buf.slice();
+ }
+
+ /**
+ * Make matrix an identity matrix
+ */
+ private void __gluMakeIdentityf(FloatBuffer m) {
+ int oldPos = m.position();
+ m.put(IDENTITY_MATRIX);
+ m.position(oldPos);
+ }
+
+ /**
+ * Make matrix an identity matrix
+ */
+ private void __gluMakeIdentityf(float[] m) {
+ for (int i = 0; i < 16; i++) {
+ m[i] = IDENTITY_MATRIX[i];
+ }
+ }
+
+ /**
+ * Method __gluMultMatrixVecf
+ *
+ * @param matrix
+ * @param in
+ * @param out
+ */
+ private void __gluMultMatrixVecf(float[] matrix, int matrix_offset, float[] in, float[] out) {
+ for (int i = 0; i < 4; i++) {
+ out[i] =
+ in[0] * matrix[0*4+i+matrix_offset] +
+ in[1] * matrix[1*4+i+matrix_offset] +
+ in[2] * matrix[2*4+i+matrix_offset] +
+ in[3] * matrix[3*4+i+matrix_offset];
+ }
+ }
+
+ /**
+ * Method __gluMultMatrixVecf
+ *
+ * @param matrix
+ * @param in
+ * @param out
+ */
+ private void __gluMultMatrixVecf(FloatBuffer matrix, FloatBuffer in, FloatBuffer out) {
+ int inPos = in.position();
+ int outPos = out.position();
+ int matrixPos = matrix.position();
+ for (int i = 0; i < 4; i++) {
+ out.put(i + outPos,
+ in.get(0+inPos) * matrix.get(0*4+i+matrixPos) +
+ in.get(1+inPos) * matrix.get(1*4+i+matrixPos) +
+ in.get(2+inPos) * matrix.get(2*4+i+matrixPos) +
+ in.get(3+inPos) * matrix.get(3*4+i+matrixPos));
+ }
+ }
+
+ /**
+ * @param src
+ * @param inverse
+ *
+ * @return
+ */
+ private boolean __gluInvertMatrixf(float[] src, float[] inverse) {
+ int i, j, k, swap;
+ float t;
+ float[][] temp = tempMatrix;
+
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 4; j++) {
+ temp[i][j] = src[i*4+j];
+ }
+ }
+ __gluMakeIdentityf(inverse);
+
+ for (i = 0; i < 4; i++) {
+ //
+ // Look for largest element in column
+ //
+ swap = i;
+ for (j = i + 1; j < 4; j++) {
+ if (Math.abs(temp[j][i]) > Math.abs(temp[i][i])) {
+ swap = j;
+ }
+ }
+
+ if (swap != i) {
+ //
+ // Swap rows.
+ //
+ for (k = 0; k < 4; k++) {
+ t = temp[i][k];
+ temp[i][k] = temp[swap][k];
+ temp[swap][k] = t;
+
+ t = inverse[i*4+k];
+ inverse[i*4+k] = inverse[swap*4+k];
+ inverse[swap*4+k] = t;
+ }
+ }
+
+ if (temp[i][i] == 0) {
+ //
+ // No non-zero pivot. The matrix is singular, which shouldn't
+ // happen. This means the user gave us a bad matrix.
+ //
+ return false;
+ }
+
+ t = temp[i][i];
+ for (k = 0; k < 4; k++) {
+ temp[i][k] /= t;
+ inverse[i*4+k] /= t;
+ }
+ for (j = 0; j < 4; j++) {
+ if (j != i) {
+ t = temp[j][i];
+ for (k = 0; k < 4; k++) {
+ temp[j][k] -= temp[i][k] * t;
+ inverse[j*4+k] -= inverse[i*4+k]*t;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @param src
+ * @param inverse
+ *
+ * @return
+ */
+ private boolean __gluInvertMatrixf(FloatBuffer src, FloatBuffer inverse) {
+ int i, j, k, swap;
+ float t;
+
+ int srcPos = src.position();
+ int invPos = inverse.position();
+
+ FloatBuffer temp = tempMatrixBuf;
+
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 4; j++) {
+ temp.put(i*4+j, src.get(i*4+j + srcPos));
+ }
+ }
+ __gluMakeIdentityf(inverse);
+
+ for (i = 0; i < 4; i++) {
+ //
+ // Look for largest element in column
+ //
+ swap = i;
+ for (j = i + 1; j < 4; j++) {
+ if (Math.abs(temp.get(j*4+i)) > Math.abs(temp.get(i*4+i))) {
+ swap = j;
+ }
+ }
+
+ if (swap != i) {
+ //
+ // Swap rows.
+ //
+ for (k = 0; k < 4; k++) {
+ t = temp.get(i*4+k);
+ temp.put(i*4+k, temp.get(swap*4+k));
+ temp.put(swap*4+k, t);
+
+ t = inverse.get(i*4+k + invPos);
+ inverse.put(i*4+k + invPos, inverse.get(swap*4+k + invPos));
+ inverse.put(swap*4+k + invPos, t);
+ }
+ }
+
+ if (temp.get(i*4+i) == 0) {
+ //
+ // No non-zero pivot. The matrix is singular, which shouldn't
+ // happen. This means the user gave us a bad matrix.
+ //
+ return false;
+ }
+
+ t = temp.get(i*4+i);
+ for (k = 0; k < 4; k++) {
+ temp.put(i*4+k, temp.get(i*4+k) / t);
+ inverse.put(i*4+k + invPos, inverse.get(i*4+k + invPos) / t);
+ }
+ for (j = 0; j < 4; j++) {
+ if (j != i) {
+ t = temp.get(j*4+i);
+ for (k = 0; k < 4; k++) {
+ temp.put(j*4+k, temp.get(j*4+k) - temp.get(i*4+k) * t);
+ inverse.put(j*4+k + invPos, inverse.get(j*4+k + invPos) - inverse.get(i*4+k + invPos) * t);
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+
+ /**
+ * @param a
+ * @param b
+ * @param r
+ */
+ private void __gluMultMatricesf(float[] a, int a_offset, float[] b, int b_offset, float[] r) {
+ for (int i = 0; i < 4; i++) {
+ for (int j = 0; j < 4; j++) {
+ r[i*4+j] =
+ a[i*4+0+a_offset]*b[0*4+j+b_offset] +
+ a[i*4+1+a_offset]*b[1*4+j+b_offset] +
+ a[i*4+2+a_offset]*b[2*4+j+b_offset] +
+ a[i*4+3+a_offset]*b[3*4+j+b_offset];
+ }
+ }
+ }
+
+
+ /**
+ * @param a
+ * @param b
+ * @param r
+ */
+ private void __gluMultMatricesf(FloatBuffer a, FloatBuffer b, FloatBuffer r) {
+ int aPos = a.position();
+ int bPos = b.position();
+ int rPos = r.position();
+
+ for (int i = 0; i < 4; i++) {
+ for (int j = 0; j < 4; j++) {
+ r.put(i*4+j + rPos,
+ a.get(i*4+0+aPos)*b.get(0*4+j+bPos) +
+ a.get(i*4+1+aPos)*b.get(1*4+j+bPos) +
+ a.get(i*4+2+aPos)*b.get(2*4+j+bPos) +
+ a.get(i*4+3+aPos)*b.get(3*4+j+bPos));
+ }
+ }
+ }
+
+ /**
+ * Normalize vector
+ *
+ * @param v
+ */
+ private static void normalize(float[] v) {
+ float r;
+
+ r = (float) Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
+ if ( r == 0.0 )
+ return;
+
+ r = 1.0f / r;
+
+ v[0] *= r;
+ v[1] *= r;
+ v[2] *= r;
+
+ return;
+ }
+
+ /**
+ * Normalize vector
+ *
+ * @param v
+ */
+ private static void normalize(FloatBuffer v) {
+ float r;
+
+ int vPos = v.position();
+
+ r = (float) Math.sqrt(v.get(0+vPos) * v.get(0+vPos) +
+ v.get(1+vPos) * v.get(1+vPos) +
+ v.get(2+vPos) * v.get(2+vPos));
+ if ( r == 0.0 )
+ return;
+
+ r = 1.0f / r;
+
+ v.put(0+vPos, v.get(0+vPos) * r);
+ v.put(1+vPos, v.get(1+vPos) * r);
+ v.put(2+vPos, v.get(2+vPos) * r);
+
+ return;
+ }
+
+
+ /**
+ * Calculate cross-product
+ *
+ * @param v1
+ * @param v2
+ * @param result
+ */
+ private static void cross(float[] v1, float[] v2, float[] result) {
+ result[0] = v1[1] * v2[2] - v1[2] * v2[1];
+ result[1] = v1[2] * v2[0] - v1[0] * v2[2];
+ result[2] = v1[0] * v2[1] - v1[1] * v2[0];
+ }
+
+ /**
+ * Calculate cross-product
+ *
+ * @param v1
+ * @param v2
+ * @param result
+ */
+ private static void cross(FloatBuffer v1, FloatBuffer v2, FloatBuffer result) {
+ int v1Pos = v1.position();
+ int v2Pos = v2.position();
+ int rPos = result.position();
+
+ result.put(0+rPos, v1.get(1+v1Pos) * v2.get(2+v2Pos) - v1.get(2+v1Pos) * v2.get(1+v2Pos));
+ result.put(1+rPos, v1.get(2+v1Pos) * v2.get(0+v2Pos) - v1.get(0+v1Pos) * v2.get(2+v2Pos));
+ result.put(2+rPos, v1.get(0+v1Pos) * v2.get(1+v2Pos) - v1.get(1+v1Pos) * v2.get(0+v2Pos));
+ }
+
+ /**
+ * Method gluOrtho2D.
+ *
+ * @param left
+ * @param right
+ * @param bottom
+ * @param top
+ */
+ public void gluOrtho2D(GL gl, float left, float right, float bottom, float top) {
+ gl.glOrthof(left, right, bottom, top, -1, 1);
+ }
+
+ /**
+ * Method gluPerspective.
+ *
+ * @param fovy
+ * @param aspect
+ * @param zNear
+ * @param zFar
+ */
+ public void gluPerspective(GL gl, float fovy, float aspect, float zNear, float zFar) {
+ float sine, cotangent, deltaZ;
+ float radians = fovy / 2 * (float) Math.PI / 180;
+
+ deltaZ = zFar - zNear;
+ sine = (float) Math.sin(radians);
+
+ if ((deltaZ == 0) || (sine == 0) || (aspect == 0)) {
+ return;
+ }
+
+ cotangent = (float) Math.cos(radians) / sine;
+
+ __gluMakeIdentityf(matrixBuf);
+
+ matrixBuf.put(0 * 4 + 0, cotangent / aspect);
+ matrixBuf.put(1 * 4 + 1, cotangent);
+ matrixBuf.put(2 * 4 + 2, - (zFar + zNear) / deltaZ);
+ matrixBuf.put(2 * 4 + 3, -1);
+ matrixBuf.put(3 * 4 + 2, -2 * zNear * zFar / deltaZ);
+ matrixBuf.put(3 * 4 + 3, 0);
+
+ gl.glMultMatrixf(matrixBuf);
+ }
+
+ /**
+ * Method gluLookAt
+ *
+ * @param eyex
+ * @param eyey
+ * @param eyez
+ * @param centerx
+ * @param centery
+ * @param centerz
+ * @param upx
+ * @param upy
+ * @param upz
+ */
+ public void gluLookAt(GL gl,
+ float eyex,
+ float eyey,
+ float eyez,
+ float centerx,
+ float centery,
+ float centerz,
+ float upx,
+ float upy,
+ float upz) {
+ FloatBuffer forward = this.forwardBuf;
+ FloatBuffer side = this.sideBuf;
+ FloatBuffer up = this.upBuf;
+
+ forward.put(0, centerx - eyex);
+ forward.put(1, centery - eyey);
+ forward.put(2, centerz - eyez);
+
+ up.put(0, upx);
+ up.put(1, upy);
+ up.put(2, upz);
+
+ normalize(forward);
+
+ /* Side = forward x up */
+ cross(forward, up, side);
+ normalize(side);
+
+ /* Recompute up as: up = side x forward */
+ cross(side, forward, up);
+
+ __gluMakeIdentityf(matrixBuf);
+ matrixBuf.put(0 * 4 + 0, side.get(0));
+ matrixBuf.put(1 * 4 + 0, side.get(1));
+ matrixBuf.put(2 * 4 + 0, side.get(2));
+
+ matrixBuf.put(0 * 4 + 1, up.get(0));
+ matrixBuf.put(1 * 4 + 1, up.get(1));
+ matrixBuf.put(2 * 4 + 1, up.get(2));
+
+ matrixBuf.put(0 * 4 + 2, -forward.get(0));
+ matrixBuf.put(1 * 4 + 2, -forward.get(1));
+ matrixBuf.put(2 * 4 + 2, -forward.get(2));
+
+ gl.glMultMatrixf(matrixBuf);
+ gl.glTranslatef(-eyex, -eyey, -eyez);
+ }
+
+ /**
+ * Method gluProject
+ *
+ * @param objx
+ * @param objy
+ * @param objz
+ * @param modelMatrix
+ * @param projMatrix
+ * @param viewport
+ * @param win_pos
+ *
+ * @return
+ */
+ public boolean gluProject(float objx,
+ float objy,
+ float objz,
+ float[] modelMatrix,
+ int modelMatrix_offset,
+ float[] projMatrix,
+ int projMatrix_offset,
+ int[] viewport,
+ int viewport_offset,
+ float[] win_pos,
+ int win_pos_offset ) {
+
+ float[] in = this.in;
+ float[] out = this.out;
+
+ in[0] = objx;
+ in[1] = objy;
+ in[2] = objz;
+ in[3] = 1.0f;
+
+ __gluMultMatrixVecf(modelMatrix, modelMatrix_offset, in, out);
+ __gluMultMatrixVecf(projMatrix, projMatrix_offset, out, in);
+
+ if (in[3] == 0.0f)
+ return false;
+
+ in[3] = (1.0f / in[3]) * 0.5f;
+
+ // Map x, y and z to range 0-1
+ in[0] = in[0] * in[3] + 0.5f;
+ in[1] = in[1] * in[3] + 0.5f;
+ in[2] = in[2] * in[3] + 0.5f;
+
+ // Map x,y to viewport
+ win_pos[0+win_pos_offset] = in[0] * viewport[2+viewport_offset] + viewport[0+viewport_offset];
+ win_pos[1+win_pos_offset] = in[1] * viewport[3+viewport_offset] + viewport[1+viewport_offset];
+ win_pos[2+win_pos_offset] = in[2];
+
+ return true;
+ }
+
+ /**
+ * Method gluProject
+ *
+ * @param objx
+ * @param objy
+ * @param objz
+ * @param modelMatrix
+ * @param projMatrix
+ * @param viewport
+ * @param win_pos
+ *
+ * @return
+ */
+ public boolean gluProject(float objx,
+ float objy,
+ float objz,
+ FloatBuffer modelMatrix,
+ FloatBuffer projMatrix,
+ IntBuffer viewport,
+ FloatBuffer win_pos) {
+
+ FloatBuffer in = this.inBuf;
+ FloatBuffer out = this.outBuf;
+
+ in.put(0, objx);
+ in.put(1, objy);
+ in.put(2, objz);
+ in.put(3, 1.0f);
+
+ __gluMultMatrixVecf(modelMatrix, in, out);
+ __gluMultMatrixVecf(projMatrix, out, in);
+
+ if (in.get(3) == 0.0f)
+ return false;
+
+ in.put(3, (1.0f / in.get(3)) * 0.5f);
+
+ // Map x, y and z to range 0-1
+ in.put(0, in.get(0) * in.get(3) + 0.5f);
+ in.put(1, in.get(1) * in.get(3) + 0.5f);
+ in.put(2, in.get(2) * in.get(3) + 0.5f);
+
+ // Map x,y to viewport
+ int vPos = viewport.position();
+ int wPos = win_pos.position();
+ win_pos.put(0+wPos, in.get(0) * viewport.get(2+vPos) + viewport.get(0+vPos));
+ win_pos.put(1+wPos, in.get(1) * viewport.get(3+vPos) + viewport.get(1+vPos));
+ win_pos.put(2+wPos, in.get(2));
+
+ return true;
+ }
+
+
+ /**
+ * Method gluUnproject
+ *
+ * @param winx
+ * @param winy
+ * @param winz
+ * @param modelMatrix
+ * @param projMatrix
+ * @param viewport
+ * @param obj_pos
+ *
+ * @return
+ */
+ public boolean gluUnProject(float winx,
+ float winy,
+ float winz,
+ float[] modelMatrix,
+ int modelMatrix_offset,
+ float[] projMatrix,
+ int projMatrix_offset,
+ int[] viewport,
+ int viewport_offset,
+ float[] obj_pos,
+ int obj_pos_offset) {
+ float[] in = this.in;
+ float[] out = this.out;
+
+ __gluMultMatricesf(modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, matrix);
+
+ if (!__gluInvertMatrixf(matrix, matrix))
+ return false;
+
+ in[0] = winx;
+ in[1] = winy;
+ in[2] = winz;
+ in[3] = 1.0f;
+
+ // Map x and y from window coordinates
+ in[0] = (in[0] - viewport[0+viewport_offset]) / viewport[2+viewport_offset];
+ in[1] = (in[1] - viewport[1+viewport_offset]) / viewport[3+viewport_offset];
+
+ // Map to range -1 to 1
+ in[0] = in[0] * 2 - 1;
+ in[1] = in[1] * 2 - 1;
+ in[2] = in[2] * 2 - 1;
+
+ __gluMultMatrixVecf(matrix, 0, in, out);
+
+ if (out[3] == 0.0)
+ return false;
+
+ out[3] = 1.0f / out[3];
+
+ obj_pos[0+obj_pos_offset] = out[0] * out[3];
+ obj_pos[1+obj_pos_offset] = out[1] * out[3];
+ obj_pos[2+obj_pos_offset] = out[2] * out[3];
+
+ return true;
+ }
+
+
+ /**
+ * Method gluUnproject
+ *
+ * @param winx
+ * @param winy
+ * @param winz
+ * @param modelMatrix
+ * @param projMatrix
+ * @param viewport
+ * @param obj_pos
+ *
+ * @return
+ */
+ public boolean gluUnProject(float winx,
+ float winy,
+ float winz,
+ FloatBuffer modelMatrix,
+ FloatBuffer projMatrix,
+ IntBuffer viewport,
+ FloatBuffer obj_pos) {
+ FloatBuffer in = this.inBuf;
+ FloatBuffer out = this.outBuf;
+
+ __gluMultMatricesf(modelMatrix, projMatrix, matrixBuf);
+
+ if (!__gluInvertMatrixf(matrixBuf, matrixBuf))
+ return false;
+
+ in.put(0, winx);
+ in.put(1, winy);
+ in.put(2, winz);
+ in.put(3, 1.0f);
+
+ // Map x and y from window coordinates
+ int vPos = viewport.position();
+ int oPos = obj_pos.position();
+ in.put(0, (in.get(0) - viewport.get(0+vPos)) / viewport.get(2+vPos));
+ in.put(1, (in.get(1) - viewport.get(1+vPos)) / viewport.get(3+vPos));
+
+ // Map to range -1 to 1
+ in.put(0, in.get(0) * 2 - 1);
+ in.put(1, in.get(1) * 2 - 1);
+ in.put(2, in.get(2) * 2 - 1);
+
+ __gluMultMatrixVecf(matrixBuf, in, out);
+
+ if (out.get(3) == 0.0f)
+ return false;
+
+ out.put(3, 1.0f / out.get(3));
+
+ obj_pos.put(0+oPos, out.get(0) * out.get(3));
+ obj_pos.put(1+oPos, out.get(1) * out.get(3));
+ obj_pos.put(2+oPos, out.get(2) * out.get(3));
+
+ return true;
+ }
+
+
+ /**
+ * Method gluUnproject4
+ *
+ * @param winx
+ * @param winy
+ * @param winz
+ * @param clipw
+ * @param modelMatrix
+ * @param projMatrix
+ * @param viewport
+ * @param near
+ * @param far
+ * @param obj_pos
+ *
+ * @return
+ */
+ public boolean gluUnProject4(float winx,
+ float winy,
+ float winz,
+ float clipw,
+ float[] modelMatrix,
+ int modelMatrix_offset,
+ float[] projMatrix,
+ int projMatrix_offset,
+ int[] viewport,
+ int viewport_offset,
+ float near,
+ float far,
+ float[] obj_pos,
+ int obj_pos_offset ) {
+ float[] in = this.in;
+ float[] out = this.out;
+
+ __gluMultMatricesf(modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, matrix);
+
+ if (!__gluInvertMatrixf(matrix, matrix))
+ return false;
+
+ in[0] = winx;
+ in[1] = winy;
+ in[2] = winz;
+ in[3] = clipw;
+
+ // Map x and y from window coordinates
+ in[0] = (in[0] - viewport[0+viewport_offset]) / viewport[2+viewport_offset];
+ in[1] = (in[1] - viewport[1+viewport_offset]) / viewport[3+viewport_offset];
+ in[2] = (in[2] - near) / (far - near);
+
+ // Map to range -1 to 1
+ in[0] = in[0] * 2 - 1;
+ in[1] = in[1] * 2 - 1;
+ in[2] = in[2] * 2 - 1;
+
+ __gluMultMatrixVecf(matrix, 0, in, out);
+
+ if (out[3] == 0.0f)
+ return false;
+
+ obj_pos[0+obj_pos_offset] = out[0];
+ obj_pos[1+obj_pos_offset] = out[1];
+ obj_pos[2+obj_pos_offset] = out[2];
+ obj_pos[3+obj_pos_offset] = out[3];
+ return true;
+ }
+
+ /**
+ * Method gluUnproject4
+ *
+ * @param winx
+ * @param winy
+ * @param winz
+ * @param clipw
+ * @param modelMatrix
+ * @param projMatrix
+ * @param viewport
+ * @param near
+ * @param far
+ * @param obj_pos
+ *
+ * @return
+ */
+ public boolean gluUnProject4(float winx,
+ float winy,
+ float winz,
+ float clipw,
+ FloatBuffer modelMatrix,
+ FloatBuffer projMatrix,
+ IntBuffer viewport,
+ float near,
+ float far,
+ FloatBuffer obj_pos) {
+ FloatBuffer in = this.inBuf;
+ FloatBuffer out = this.outBuf;
+
+ __gluMultMatricesf(modelMatrix, projMatrix, matrixBuf);
+
+ if (!__gluInvertMatrixf(matrixBuf, matrixBuf))
+ return false;
+
+ in.put(0, winx);
+ in.put(1, winy);
+ in.put(2, winz);
+ in.put(3, clipw);
+
+ // Map x and y from window coordinates
+ int vPos = viewport.position();
+ in.put(0, (in.get(0) - viewport.get(0+vPos)) / viewport.get(2+vPos));
+ in.put(1, (in.get(1) - viewport.get(1+vPos)) / viewport.get(3+vPos));
+ in.put(2, (in.get(2) - near) / (far - near));
+
+ // Map to range -1 to 1
+ in.put(0, in.get(0) * 2 - 1);
+ in.put(1, in.get(1) * 2 - 1);
+ in.put(2, in.get(2) * 2 - 1);
+
+ __gluMultMatrixVecf(matrixBuf, in, out);
+
+ if (out.get(3) == 0.0f)
+ return false;
+
+ int oPos = obj_pos.position();
+ obj_pos.put(0+oPos, out.get(0));
+ obj_pos.put(1+oPos, out.get(1));
+ obj_pos.put(2+oPos, out.get(2));
+ obj_pos.put(3+oPos, out.get(3));
+ return true;
+ }
+
+
+ /**
+ * Method gluPickMatrix
+ *
+ * @param x
+ * @param y
+ * @param deltaX
+ * @param deltaY
+ * @param viewport
+ */
+ public void gluPickMatrix(GL gl,
+ float x,
+ float y,
+ float deltaX,
+ float deltaY,
+ IntBuffer viewport) {
+ if (deltaX <= 0 || deltaY <= 0) {
+ return;
+ }
+
+ /* Translate and scale the picked region to the entire window */
+ int vPos = viewport.position();
+ gl.glTranslatef((viewport.get(2+vPos) - 2 * (x - viewport.get(0+vPos))) / deltaX,
+ (viewport.get(3+vPos) - 2 * (y - viewport.get(1+vPos))) / deltaY,
+ 0);
+ gl.glScalef(viewport.get(2) / deltaX, viewport.get(3) / deltaY, 1.0f);
+ }
+
+ /**
+ * Method gluPickMatrix
+ *
+ * @param x
+ * @param y
+ * @param deltaX
+ * @param deltaY
+ * @param viewport
+ * @param viewport_offset
+ */
+ public void gluPickMatrix(GL gl,
+ float x,
+ float y,
+ float deltaX,
+ float deltaY,
+ int[] viewport,
+ int viewport_offset) {
+ if (deltaX <= 0 || deltaY <= 0) {
+ return;
+ }
+
+ /* Translate and scale the picked region to the entire window */
+ gl.glTranslatef((viewport[2+viewport_offset] - 2 * (x - viewport[0+viewport_offset])) / deltaX,
+ (viewport[3+viewport_offset] - 2 * (y - viewport[1+viewport_offset])) / deltaY,
+ 0);
+ gl.glScalef(viewport[2+viewport_offset] / deltaX, viewport[3+viewport_offset] / deltaY, 1.0f);
+ }
+}
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLContext.java b/src/classes/com/sun/opengl/impl/egl/EGLContext.java
new file mode 100755
index 000000000..f1aa9172b
--- /dev/null
+++ b/src/classes/com/sun/opengl/impl/egl/EGLContext.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.sun.opengl.impl.egl;
+
+import javax.media.opengl.*;
+import com.sun.opengl.impl.*;
+import java.nio.*;
+
+public abstract class EGLContext extends GLContextImpl {
+ public EGLContext(EGLDrawable drawable, GLContext shareWith) {
+ super(shareWith);
+ }
+
+ public Object getPlatformGLExtensions() {
+ return null;
+ }
+
+ public GLDrawable getGLDrawable() {
+ return null;
+ }
+
+ public void copy(GLContext source, int mask) throws GLException {
+ throw new GLException("Not yet implemented");
+ }
+
+ public void bindPbufferToTexture() {
+ throw new GLException("Should not call this");
+ }
+
+ public void releasePbufferFromTexture() {
+ throw new GLException("Should not call this");
+ }
+
+ public ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, float arg3) {
+ throw new GLException("Should not call this");
+ }
+
+ protected String mapToRealGLFunctionName(String glFunctionName) {
+ return glFunctionName;
+ }
+
+ protected String mapToRealGLExtensionName(String glExtensionName) {
+ return glExtensionName;
+ }
+
+ public String getPlatformExtensionsString() {
+ return "";
+ }
+
+ public boolean offscreenImageNeedsVerticalFlip() {
+ throw new GLException("Should not call this");
+ }
+
+ public int getOffscreenContextPixelDataType() {
+ throw new GLException("Should not call this");
+ }
+}
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java
new file mode 100755
index 000000000..2f0903a2b
--- /dev/null
+++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawable.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.sun.opengl.impl.egl;
+
+public class EGLDrawable {
+}
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
new file mode 100755
index 000000000..06ba5b640
--- /dev/null
+++ b/src/classes/com/sun/opengl/impl/egl/EGLDrawableFactory.java
@@ -0,0 +1,259 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.sun.opengl.impl.egl;
+
+import javax.media.opengl.*;
+import com.sun.opengl.impl.*;
+
+public class EGLDrawableFactory extends GLDrawableFactoryImpl {
+ static {
+ NativeLibLoader.loadCore();
+ }
+
+ public AbstractGraphicsConfiguration chooseGraphicsConfiguration(GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser,
+ AbstractGraphicsDevice device) {
+ return null;
+ }
+
+ public GLDrawable getGLDrawable(Object target,
+ GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser) {
+ throw new GLException("Not yet implemented");
+ }
+
+ public GLDrawableImpl createOffscreenDrawable(GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser) {
+ throw new GLException("Not yet implemented");
+ }
+
+ public boolean canCreateGLPbuffer() {
+ // Not supported on OpenGL ES
+ return false;
+ }
+ public GLPbuffer createGLPbuffer(final GLCapabilities capabilities,
+ final GLCapabilitiesChooser chooser,
+ final int initialWidth,
+ final int initialHeight,
+ final GLContext shareWith) {
+ throw new GLException("Pbuffer support not available on OpenGL ES");
+ }
+
+ public GLContext createExternalGLContext() {
+ return new EGLExternalContext();
+ }
+
+ public boolean canCreateExternalGLDrawable() {
+ return false;
+ }
+
+ public GLDrawable createExternalGLDrawable() {
+ throw new GLException("Not yet implemented");
+ }
+
+ public void loadGLULibrary() {
+ }
+
+ public long dynamicLookupFunction(String glFuncName) {
+ return 0;
+ /*
+ long res = WGL.wglGetProcAddress(glFuncName);
+ if (res == 0) {
+ // GLU routines aren't known to the OpenGL function lookup
+ if (hglu32 != 0) {
+ res = WGL.GetProcAddress(hglu32, glFuncName);
+ }
+ }
+ return res;
+ */
+ }
+
+ public void lockAWTForJava2D() {
+ }
+
+ public void unlockAWTForJava2D() {
+ }
+
+ public boolean canCreateContextOnJava2DSurface() {
+ return false;
+ }
+
+ // FIXME: this is the OpenGL ES 2 initialization order
+
+ // Initialize everything
+ public void initialize() throws GLException {
+ System.out.println("EGLDrawableFactory.initEGL()");
+ if (!initEGL()) {
+ throw new GLException("EGL init failed");
+ }
+ System.out.println("EGLDrawableFactory.chooseConfig()");
+ if (!chooseConfig()) {
+ throw new GLException("EGL choose config failed");
+ }
+ System.out.println("EGLDrawableFactory.checkDisplay()");
+ if (!checkDisplay()) {
+ throw new GLException("EGL check display failed");
+ }
+ System.out.println("EGLDrawableFactory.checkConfig()");
+ if (!checkConfig()) {
+ throw new GLException("EGL check config failed");
+ }
+ System.out.println("EGLDrawableFactory.createWindow()");
+ if (!createWindow()) {
+ throw new GLException("KD window init failed");
+ }
+ System.out.println("EGLDrawableFactory.setWindowVisible()");
+ setWindowVisible();
+ System.out.println("EGLDrawableFactory.setWindowFullscreen()");
+ setWindowFullscreen();
+ System.out.println("EGLDrawableFactory.realizeWindow()");
+ if (!realizeWindow()) {
+ throw new GLException("EGL/GLES window realize failed");
+ }
+ System.out.println("EGLDrawableFactory.createSurface()");
+ if (!createSurface()) {
+ throw new GLException("EGL create window surface failed");
+ }
+ System.out.println("EGLDrawableFactory.createContext()");
+ if (!createContext()) {
+ throw new GLException("EGL create context failed");
+ }
+ System.out.println("EGLDrawableFactory.makeCurrent()");
+ if (!makeCurrent()) {
+ throw new GLException("EGL make current failed");
+ }
+ System.out.println("EGLDrawableFactory.updateWindowSize()");
+ updateWindowSize();
+ }
+
+ /*
+
+ // FIXME: this is the OpenGL ES 1 initialization order
+
+ // Initialize everything
+ public void initialize() throws GLException {
+ System.out.println("EGLDrawableFactory.initEGL()");
+ if (!initEGL()) {
+ throw new GLException("EGL init failed");
+ }
+ System.out.println("EGLDrawableFactory.chooseConfig()");
+ if (!chooseConfig()) {
+ throw new GLException("EGL choose config failed");
+ }
+ System.out.println("EGLDrawableFactory.checkDisplay()");
+ if (!checkDisplay()) {
+ throw new GLException("EGL check display failed");
+ }
+ System.out.println("EGLDrawableFactory.checkConfig()");
+ if (!checkConfig()) {
+ throw new GLException("EGL check config failed");
+ }
+ System.out.println("EGLDrawableFactory.createContext()");
+ if (!createContext()) {
+ throw new GLException("EGL create context failed");
+ }
+ //
+ // OpenKODE Core window system initialisation.
+ //
+ System.out.println("EGLDrawableFactory.createWindow()");
+ if (!createWindow()) {
+ throw new GLException("KD window init failed");
+ }
+ // System.out.println("EGLDrawableFactory.setWindowVisible()");
+ // setWindowVisible();
+ System.out.println("EGLDrawableFactory.setWindowFullscreen()");
+ setWindowFullscreen();
+ System.out.println("EGLDrawableFactory.realizeWindow()");
+ if (!realizeWindow()) {
+ throw new GLException("EGL/GLES window realize failed");
+ }
+ System.out.println("EGLDrawableFactory.createSurface()");
+ if (!createSurface()) {
+ throw new GLException("EGL create window surface failed");
+ }
+ System.out.println("EGLDrawableFactory.makeCurrent()");
+ if (!makeCurrent()) {
+ throw new GLException("EGL make current failed");
+ }
+ System.out.println("EGLDrawableFactory.updateWindowSize()");
+ updateWindowSize();
+ }
+
+ */
+
+ // Process incoming events -- must be called every frame
+ public void processEvents() {
+ if (shouldExit()) {
+ shutdown();
+ }
+ }
+
+ public void swapBuffers() {
+ swapBuffers0();
+ }
+
+ private native boolean initEGL();
+ private native boolean chooseConfig();
+ private native boolean checkDisplay();
+ private native boolean checkConfig();
+ private native boolean createWindow();
+ private native void setWindowVisible();
+ private native void setWindowFullscreen();
+ private native boolean realizeWindow();
+ private native boolean createSurface();
+ private native boolean createContext();
+ private native boolean makeCurrent();
+ private native void updateWindowSize();
+ private native void swapBuffers0();
+
+ // Runs the native message loop one step and checks to see if we should exit
+ private native boolean shouldExit();
+ public native void shutdown();
+
+ public void testGetDirectBufferAddress() {
+ java.nio.FloatBuffer buf = com.sun.opengl.util.BufferUtil.newFloatBuffer(12);
+ int addr = getDirectBufferAddress(buf);
+ System.out.println("Direct FloatBuffer's address: 0x" + Integer.toHexString(addr));
+ }
+ public native int getDirectBufferAddress(java.nio.Buffer buf);
+
+ /*
+ public GLContext createContextOnJava2DSurface(Graphics g, GLContext shareWith)
+ throws GLException {
+ throw new GLException("Unimplemented on this platform");
+ }
+ */
+}
diff --git a/src/classes/com/sun/opengl/impl/egl/EGLExternalContext.java b/src/classes/com/sun/opengl/impl/egl/EGLExternalContext.java
new file mode 100755
index 000000000..6466c767d
--- /dev/null
+++ b/src/classes/com/sun/opengl/impl/egl/EGLExternalContext.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * Neither the name of Sun Microsystems, Inc. or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ *
+ * Sun gratefully acknowledges that this software was originally authored
+ * and developed by Kenneth Bradley Russell and Christopher John Kline.
+ */
+
+package com.sun.opengl.impl.egl;
+
+import javax.media.opengl.*;
+import com.sun.opengl.impl.*;
+
+public class EGLExternalContext extends EGLContext {
+ private boolean firstMakeCurrent = true;
+ private boolean created = true;
+ private GLContext lastContext;
+
+ public EGLExternalContext() {
+ super(null, null);
+ GLContextShareSet.contextCreated(this);
+ resetGLFunctionAvailability();
+ }
+
+ public int makeCurrent() throws GLException {
+ // Save last context if necessary to allow external GLContexts to
+ // talk to other GLContexts created by this library
+ GLContext cur = getCurrent();
+ if (cur != null && cur != this) {
+ lastContext = cur;
+ setCurrent(null);
+ }
+ return super.makeCurrent();
+ }
+
+ public void release() throws GLException {
+ super.release();
+ setCurrent(lastContext);
+ lastContext = null;
+ }
+
+ protected int makeCurrentImpl() throws GLException {
+ if (firstMakeCurrent) {
+ firstMakeCurrent = false;
+ return CONTEXT_CURRENT_NEW;
+ }
+ return CONTEXT_CURRENT;
+ }
+
+ protected void releaseImpl() throws GLException {
+ }
+
+ protected void destroyImpl() throws GLException {
+ created = false;
+ GLContextShareSet.contextDestroyed(this);
+ }
+
+ public boolean isCreated() {
+ return created;
+ }
+}
diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsDummyGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/WindowsDummyGLDrawable.java
index a307493d7..c52cf4067 100644
--- a/src/classes/com/sun/opengl/impl/windows/WindowsDummyGLDrawable.java
+++ b/src/classes/com/sun/opengl/impl/windows/WindowsDummyGLDrawable.java
@@ -80,7 +80,8 @@ public class WindowsDummyGLDrawable extends WindowsGLDrawable {
// Construction failed
return null;
}
- return new WindowsGLContext(this, shareWith, true);
+ // FIXME: figure out how to hook back in the Java 2D / JOGL bridge
+ return new WindowsGLContext(this, shareWith);
}
public void destroy() {
diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java b/src/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java
index a73cc7ac4..36aba5011 100755
--- a/src/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java
+++ b/src/classes/com/sun/opengl/impl/windows/WindowsExternalGLContext.java
@@ -50,7 +50,8 @@ public class WindowsExternalGLContext extends WindowsGLContext {
private GLContext lastContext;
public WindowsExternalGLContext() {
- super(null, null, true);
+ // FIXME: figure out how to hook back in the Java 2D / JOGL bridge
+ super(null, null);
hglrc = WGL.wglGetCurrentContext();
if (hglrc == 0) {
throw new GLException("Error: attempted to make an external GLContext without a drawable/context current");
diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsGLContext.java b/src/classes/com/sun/opengl/impl/windows/WindowsGLContext.java
index 1276aea92..2681d42f4 100644
--- a/src/classes/com/sun/opengl/impl/windows/WindowsGLContext.java
+++ b/src/classes/com/sun/opengl/impl/windows/WindowsGLContext.java
@@ -66,18 +66,12 @@ public class WindowsGLContext extends GLContextImpl {
extensionNameMap.put("GL_ARB_pixel_format", "WGL_ARB_pixel_format");
}
+ // FIXME: figure out how to hook back in the Java 2D / JOGL bridge
public WindowsGLContext(WindowsGLDrawable drawable,
GLContext shareWith) {
- this(drawable, shareWith, false);
+ super(shareWith);
}
- public WindowsGLContext(WindowsGLDrawable drawable,
- GLContext shareWith,
- boolean dontShareWithJava2D) {
- super(shareWith, dontShareWithJava2D);
- this.drawable = drawable;
- }
-
public Object getPlatformGLExtensions() {
return getWGLExt();
}
diff --git a/src/classes/com/sun/opengl/util/BufferUtil.java b/src/classes/com/sun/opengl/util/BufferUtil.java
index e16c5685d..756f568b4 100755
--- a/src/classes/com/sun/opengl/util/BufferUtil.java
+++ b/src/classes/com/sun/opengl/util/BufferUtil.java
@@ -49,8 +49,9 @@ public class BufferUtil {
public static final int SIZEOF_SHORT = 2;
public static final int SIZEOF_INT = 4;
public static final int SIZEOF_FLOAT = 4;
- public static final int SIZEOF_LONG = 8;
- public static final int SIZEOF_DOUBLE = 8;
+ // FIXME: refactor dependencies on Java SE buffer classes
+ // public static final int SIZEOF_LONG = 8;
+ // public static final int SIZEOF_DOUBLE = 8;
private BufferUtil() {}
@@ -58,22 +59,42 @@ public class BufferUtil {
// Allocation routines
//
+
+ // FIXME: these are only for testing purposes
+ // public static ByteBuffer newByteBuffer(int numElements) {
+ // return ByteBuffer.wrap(new byte[numElements]);
+ // }
+ //
+ // public static FloatBuffer newFloatBuffer(int numElements) {
+ // return FloatBuffer.wrap(new float[numElements]);
+ // }
+ //
+ // public static IntBuffer newIntBuffer(int numElements) {
+ // return IntBuffer.wrap(new int[numElements]);
+ // }
+ //
+ // public static ShortBuffer newShortBuffer(int numElements) {
+ // return ShortBuffer.wrap(new short[numElements]);
+ // }
+
/** Allocates a new direct ByteBuffer with the specified number of
elements. The returned buffer will have its byte order set to
the host platform's native byte order. */
public static ByteBuffer newByteBuffer(int numElements) {
ByteBuffer bb = ByteBuffer.allocateDirect(numElements);
- bb.order(ByteOrder.nativeOrder());
+ // FIXME: refactor dependencies on Java SE buffer classes
+ // bb.order(ByteOrder.nativeOrder());
return bb;
}
-
- /** Allocates a new direct DoubleBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static DoubleBuffer newDoubleBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_DOUBLE);
- return bb.asDoubleBuffer();
- }
+
+ // FIXME: refactor dependencies on Java SE buffer classes
+ // /** Allocates a new direct DoubleBuffer with the specified number of
+ // elements. The returned buffer will have its byte order set to
+ // the host platform's native byte order. */
+ // public static DoubleBuffer newDoubleBuffer(int numElements) {
+ // ByteBuffer bb = newByteBuffer(numElements * SIZEOF_DOUBLE);
+ // return bb.asDoubleBuffer();
+ // }
/** Allocates a new direct FloatBuffer with the specified number of
elements. The returned buffer will have its byte order set to
@@ -82,7 +103,7 @@ public class BufferUtil {
ByteBuffer bb = newByteBuffer(numElements * SIZEOF_FLOAT);
return bb.asFloatBuffer();
}
-
+
/** Allocates a new direct IntBuffer with the specified number of
elements. The returned buffer will have its byte order set to
the host platform's native byte order. */
@@ -90,14 +111,15 @@ public class BufferUtil {
ByteBuffer bb = newByteBuffer(numElements * SIZEOF_INT);
return bb.asIntBuffer();
}
-
- /** Allocates a new direct LongBuffer with the specified number of
- elements. The returned buffer will have its byte order set to
- the host platform's native byte order. */
- public static LongBuffer newLongBuffer(int numElements) {
- ByteBuffer bb = newByteBuffer(numElements * SIZEOF_LONG);
- return bb.asLongBuffer();
- }
+
+ // FIXME: refactor dependencies on Java SE buffer classes
+ // /** Allocates a new direct LongBuffer with the specified number of
+ // elements. The returned buffer will have its byte order set to
+ // the host platform's native byte order. */
+ // public static LongBuffer newLongBuffer(int numElements) {
+ // ByteBuffer bb = newByteBuffer(numElements * SIZEOF_LONG);
+ // return bb.asLongBuffer();
+ // }
/** Allocates a new direct ShortBuffer with the specified number of
elements. The returned buffer will have its byte order set to
@@ -107,162 +129,103 @@ public class BufferUtil {
return bb.asShortBuffer();
}
- //----------------------------------------------------------------------
- // Copy routines (type-to-type)
+ // FIXME: refactor dependencies on Java SE buffer classes
+ // These are only used by the GLU implementation anyway, which
+ // mostly disappears in the embedded OpenGL case
+ // //----------------------------------------------------------------------
+ // // Copy routines (type-to-type)
+ // //
//
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ByteBuffer into
- a newly-allocated direct ByteBuffer. The returned buffer will
- have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyByteBuffer(ByteBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining());
- orig.mark();
- dest.put(orig);
- orig.reset();
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed DoubleBuffer
- into a newly-allocated direct DoubleBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static DoubleBuffer copyDoubleBuffer(DoubleBuffer orig) {
- return copyDoubleBufferAsByteBuffer(orig).asDoubleBuffer();
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed FloatBuffer
- into a newly-allocated direct FloatBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static FloatBuffer copyFloatBuffer(FloatBuffer orig) {
- return copyFloatBufferAsByteBuffer(orig).asFloatBuffer();
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed IntBuffer
- into a newly-allocated direct IntBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static IntBuffer copyIntBuffer(IntBuffer orig) {
- return copyIntBufferAsByteBuffer(orig).asIntBuffer();
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed LongBuffer
- into a newly-allocated direct LongBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static LongBuffer copyLongBuffer(LongBuffer orig) {
- return copyLongBufferAsByteBuffer(orig).asLongBuffer();
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ShortBuffer
- into a newly-allocated direct ShortBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ShortBuffer copyShortBuffer(ShortBuffer orig) {
- return copyShortBufferAsByteBuffer(orig).asShortBuffer();
- }
-
- //----------------------------------------------------------------------
- // Copy routines (type-to-ByteBuffer)
+ // /** Copies the <i>remaining</i> elements (as defined by
+ // <code>limit() - position()</code>) in the passed ByteBuffer into
+ // a newly-allocated direct ByteBuffer. The returned buffer will
+ // have its byte order set to the host platform's native byte
+ // order. The position of the newly-allocated buffer will be zero,
+ // and the position of the passed buffer is unchanged (though its
+ // mark is changed). */
+ // public static ByteBuffer copyByteBuffer(ByteBuffer orig) {
+ // ByteBuffer dest = newByteBuffer(orig.remaining());
+ // dest.put(orig);
+ // dest.rewind();
+ // return dest;
+ // }
//
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed DoubleBuffer
- into a newly-allocated direct ByteBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyDoubleBufferAsByteBuffer(DoubleBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_DOUBLE);
- orig.mark();
- dest.asDoubleBuffer().put(orig);
- orig.reset();
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed FloatBuffer
- into a newly-allocated direct ByteBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyFloatBufferAsByteBuffer(FloatBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_FLOAT);
- orig.mark();
- dest.asFloatBuffer().put(orig);
- orig.reset();
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed IntBuffer into
- a newly-allocated direct ByteBuffer. The returned buffer will
- have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyIntBufferAsByteBuffer(IntBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_INT);
- orig.mark();
- dest.asIntBuffer().put(orig);
- orig.reset();
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed LongBuffer into
- a newly-allocated direct ByteBuffer. The returned buffer will
- have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyLongBufferAsByteBuffer(LongBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_LONG);
- orig.mark();
- dest.asLongBuffer().put(orig);
- orig.reset();
- dest.rewind();
- return dest;
- }
-
- /** Copies the <i>remaining</i> elements (as defined by
- <code>limit() - position()</code>) in the passed ShortBuffer
- into a newly-allocated direct ByteBuffer. The returned buffer
- will have its byte order set to the host platform's native byte
- order. The position of the newly-allocated buffer will be zero,
- and the position of the passed buffer is unchanged (though its
- mark is changed). */
- public static ByteBuffer copyShortBufferAsByteBuffer(ShortBuffer orig) {
- ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_SHORT);
- orig.mark();
- dest.asShortBuffer().put(orig);
- orig.reset();
- dest.rewind();
- return dest;
- }
+ // /** Copies the <i>remaining</i> elements (as defined by
+ // <code>limit() - position()</code>) in the passed FloatBuffer
+ // into a newly-allocated direct FloatBuffer. The returned buffer
+ // will have its byte order set to the host platform's native byte
+ // order. The position of the newly-allocated buffer will be zero,
+ // and the position of the passed buffer is unchanged (though its
+ // mark is changed). */
+ // public static FloatBuffer copyFloatBuffer(FloatBuffer orig) {
+ // return copyFloatBufferAsByteBuffer(orig).asFloatBuffer();
+ // }
+ //
+ // /** Copies the <i>remaining</i> elements (as defined by
+ // <code>limit() - position()</code>) in the passed IntBuffer
+ // into a newly-allocated direct IntBuffer. The returned buffer
+ // will have its byte order set to the host platform's native byte
+ // order. The position of the newly-allocated buffer will be zero,
+ // and the position of the passed buffer is unchanged (though its
+ // mark is changed). */
+ // public static IntBuffer copyIntBuffer(IntBuffer orig) {
+ // return copyIntBufferAsByteBuffer(orig).asIntBuffer();
+ // }
+ //
+ // /** Copies the <i>remaining</i> elements (as defined by
+ // <code>limit() - position()</code>) in the passed ShortBuffer
+ // into a newly-allocated direct ShortBuffer. The returned buffer
+ // will have its byte order set to the host platform's native byte
+ // order. The position of the newly-allocated buffer will be zero,
+ // and the position of the passed buffer is unchanged (though its
+ // mark is changed). */
+ // public static ShortBuffer copyShortBuffer(ShortBuffer orig) {
+ // return copyShortBufferAsByteBuffer(orig).asShortBuffer();
+ // }
+ //
+ // //----------------------------------------------------------------------
+ // // Copy routines (type-to-ByteBuffer)
+ // //
+ //
+ // /** Copies the <i>remaining</i> elements (as defined by
+ // <code>limit() - position()</code>) in the passed FloatBuffer
+ // into a newly-allocated direct ByteBuffer. The returned buffer
+ // will have its byte order set to the host platform's native byte
+ // order. The position of the newly-allocated buffer will be zero,
+ // and the position of the passed buffer is unchanged (though its
+ // mark is changed). */
+ // public static ByteBuffer copyFloatBufferAsByteBuffer(FloatBuffer orig) {
+ // ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_FLOAT);
+ // dest.asFloatBuffer().put(orig);
+ // dest.rewind();
+ // return dest;
+ // }
+ //
+ // /** Copies the <i>remaining</i> elements (as defined by
+ // <code>limit() - position()</code>) in the passed IntBuffer into
+ // a newly-allocated direct ByteBuffer. The returned buffer will
+ // have its byte order set to the host platform's native byte
+ // order. The position of the newly-allocated buffer will be zero,
+ // and the position of the passed buffer is unchanged (though its
+ // mark is changed). */
+ // public static ByteBuffer copyIntBufferAsByteBuffer(IntBuffer orig) {
+ // ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_INT);
+ // dest.asIntBuffer().put(orig);
+ // dest.rewind();
+ // return dest;
+ // }
+ //
+ // /** Copies the <i>remaining</i> elements (as defined by
+ // <code>limit() - position()</code>) in the passed ShortBuffer
+ // into a newly-allocated direct ByteBuffer. The returned buffer
+ // will have its byte order set to the host platform's native byte
+ // order. The position of the newly-allocated buffer will be zero,
+ // and the position of the passed buffer is unchanged (though its
+ // mark is changed). */
+ // public static ByteBuffer copyShortBufferAsByteBuffer(ShortBuffer orig) {
+ // ByteBuffer dest = newByteBuffer(orig.remaining() * SIZEOF_SHORT);
+ // dest.asShortBuffer().put(orig);
+ // dest.rewind();
+ // return dest;
+ // }
}
diff --git a/src/classes/javax/media/opengl/GLAutoDrawable.java b/src/classes/javax/media/opengl/GLAutoDrawable.java
index 5f3115da8..40e2603c6 100644
--- a/src/classes/javax/media/opengl/GLAutoDrawable.java
+++ b/src/classes/javax/media/opengl/GLAutoDrawable.java
@@ -52,7 +52,7 @@ import javax.media.opengl.glu.*;
GLContext for the GLAutoDrawable to be used both by the event
based rendering mechanism as well by end users directly. */
-public interface GLAutoDrawable extends GLDrawable, ComponentEvents {
+public interface GLAutoDrawable extends GLDrawable /*, FIXME: ComponentEvents */ {
/**
* Returns the context associated with this drawable. The returned
* context will be synchronized.
diff --git a/src/classes/javax/media/opengl/GLDrawableFactory.java b/src/classes/javax/media/opengl/GLDrawableFactory.java
index fd934195c..3945f42fc 100644
--- a/src/classes/javax/media/opengl/GLDrawableFactory.java
+++ b/src/classes/javax/media/opengl/GLDrawableFactory.java
@@ -83,6 +83,12 @@ public abstract class GLDrawableFactory {
/** Returns the sole GLDrawableFactory instance. */
public static GLDrawableFactory getFactory() {
if (factory == null) {
+
+ // FIXME: hook this in to the normal reflective mechanism
+ factory = new com.sun.opengl.impl.egl.EGLDrawableFactory();
+
+ /*
+
try {
String factoryClassName =
(String) AccessController.doPrivileged(new PrivilegedAction() {
@@ -119,6 +125,8 @@ public abstract class GLDrawableFactory {
} catch (Exception e) {
throw new GLException(e);
}
+
+ */
}
return factory;
diff --git a/src/classes/javax/media/opengl/Threading.java b/src/classes/javax/media/opengl/Threading.java
index d3712c4c5..f14912a3c 100755
--- a/src/classes/javax/media/opengl/Threading.java
+++ b/src/classes/javax/media/opengl/Threading.java
@@ -39,7 +39,8 @@
package javax.media.opengl;
-import java.awt.EventQueue;
+// FIXME: refactor Java SE dependencies
+//import java.awt.EventQueue;
import java.lang.reflect.InvocationTargetException;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -125,14 +126,17 @@ public class Threading {
private static final int AWT = 1;
private static final int WORKER = 2;
private static int mode;
+ /* FIXME: refactor Java SE dependencies
// We need to know whether we're running on X11 platforms to change
// our behavior when the Java2D/JOGL bridge is active
private static boolean isX11;
+ */
static {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
String workaround = System.getProperty("opengl.1thread");
+ /* FIXME: refactor Java SE dependencies
// Default to using the AWT thread on all platforms except
// Windows. On OS X there is instability apparently due to
// using the JAWT on non-AWT threads. On X11 platforms there
@@ -144,6 +148,7 @@ public class Threading {
String osName = System.getProperty("os.name");
boolean isWindows = osName.startsWith("Windows");
isX11 = !(isWindows || osName.startsWith("Mac OS"));
+ */
// int defaultMode = (isWindows ? WORKER : AWT);
int defaultMode = AWT;
mode = defaultMode;
@@ -208,6 +213,7 @@ public class Threading {
switch (mode) {
case AWT:
+ /* FIXME: refactor Java SE dependencies
if (Java2D.isOGLPipelineActive()) {
// FIXME: ideally only the QFT would be considered to be the
// "OpenGL thread", but we can not currently run all of
@@ -218,7 +224,10 @@ public class Threading {
} else {
return EventQueue.isDispatchThread();
}
+ */
+ return true;
case WORKER:
+ /* FIXME: refactor Java SE dependencies
if (Java2D.isOGLPipelineActive()) {
// FIXME: ideally only the QFT would be considered to be the
// "OpenGL thread", but we can not currently run all of
@@ -229,6 +238,8 @@ public class Threading {
} else {
return GLWorkerThread.isWorkerThread();
}
+ */
+ return GLWorkerThread.isWorkerThread();
default:
throw new InternalError("Illegal single-threading mode " + mode);
}
@@ -254,6 +265,7 @@ public class Threading {
switch (mode) {
case AWT:
+ /* FIXME: refactor Java SE dependencies
// FIXME: ideally should run all OpenGL work on the Java2D QFT
// thread when it's enabled, but unfortunately there are
// deadlock issues on X11 platforms when making our
@@ -272,7 +284,9 @@ public class Threading {
} catch (InterruptedException e) {
throw new GLException(e);
}
- }
+ }
+ */
+ r.run();
break;
case WORKER:
diff --git a/src/native/jogl/EGLDrawableFactory.c b/src/native/jogl/EGLDrawableFactory.c
new file mode 100755
index 000000000..41e0f67e1
--- /dev/null
+++ b/src/native/jogl/EGLDrawableFactory.c
@@ -0,0 +1,319 @@
+#include <EGL/egl.h>
+#include <KD/kd.h>
+#include <KD/NV_extwindowprops.h>
+#include "com_sun_opengl_impl_egl_EGLDrawableFactory.h"
+
+// FIXME: move the glViewport call up to Java
+#include <GLES/gl.h>
+
+static EGLDisplay display = NULL;
+static EGLSurface surface = NULL;
+static EGLContext context = NULL;
+static EGLConfig config = NULL;
+static KDWindow* window = NULL;
+static EGLNativeWindowType nativewin = NULL;
+static EGLint lastWidth = 0;
+static EGLint lastHeight = 0;
+
+// FIXME: need to move this up to Java to conditionalize between ES 1 and ES 2
+//static KDint nv_egl_renderable_flags = EGL_OPENGL_ES2_BIT;
+static KDint nv_egl_renderable_flags = EGL_OPENGL_ES_BIT;
+static KDint nv_egl_surface_flags = EGL_WINDOW_BIT;
+static KDust jogPressUST = 0;
+
+typedef struct
+{
+ KDint index;
+ KDboolean wasPressed;
+ KDust pressTime;
+} DeviceButtonState;
+#define NVM_BTNS_MAX 5
+typedef enum
+{
+ NVM_BTN_JOGDIAL,
+ NVM_BTN_WIDGET,
+ NVM_BTN_BACK,
+ NVM_BTN_CAMHALF,
+ NVM_BTN_CAMFULL,
+};
+DeviceButtonState conButtons[NVM_BTNS_MAX] =
+{
+ {KD_INPUT_JOGDIAL_SELECT, 0, 0},
+ {KD_INPUT_BUTTONS_0+0, 0, 0},
+ {KD_INPUT_BUTTONS_0+1, 0, 0},
+ {KD_INPUT_BUTTONS_0+2, 0, 0},
+ {KD_INPUT_BUTTONS_0+3, 0, 0},
+};
+
+JNIEXPORT jboolean JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_initEGL
+ (JNIEnv *env, jobject unused)
+{
+ display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ if (display == EGL_NO_DISPLAY) {
+ kdLogMessage("Error - EGL get display failed\n");
+ return JNI_FALSE;
+ }
+ if (!eglInitialize(display, 0, 0)) {
+ kdLogMessage("Error - EGL init failed\n");
+ return JNI_FALSE;
+ }
+ return JNI_TRUE;
+}
+
+JNIEXPORT jboolean JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_chooseConfig
+ (JNIEnv *env, jobject unused)
+{
+ #define MAX_CONFIGS 64
+ EGLConfig confs[MAX_CONFIGS];
+ EGLint numConfigs;
+ EGLint fbAttrs[] =
+ {
+/*
+ // FIXME
+ // OpenGL ES 2 settings
+ EGL_RENDERABLE_TYPE, nv_egl_renderable_flags,
+ EGL_DEPTH_SIZE, 16,
+ EGL_SURFACE_TYPE, nv_egl_surface_flags,
+ EGL_RED_SIZE, 5,
+ EGL_GREEN_SIZE, 6,
+ EGL_BLUE_SIZE, 5,
+ EGL_ALPHA_SIZE, 0,
+ EGL_NONE
+*/
+
+/*
+ // FIXME
+ // OpenGL ES 1 settings
+ EGL_RED_SIZE, 1,
+ EGL_GREEN_SIZE, 1,
+ EGL_BLUE_SIZE, 1,
+ EGL_ALPHA_SIZE, EGL_DONT_CARE,
+ EGL_DEPTH_SIZE, 1,
+ EGL_STENCIL_SIZE, EGL_DONT_CARE,
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
+ EGL_NONE
+*/
+
+ // FIXME
+ // OpenGL ES 1 settings
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
+ EGL_DEPTH_SIZE, 16,
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+ EGL_RED_SIZE, 5,
+ EGL_GREEN_SIZE, 6,
+ EGL_BLUE_SIZE, 5,
+ EGL_ALPHA_SIZE, 0,
+ EGL_NONE
+ };
+
+ if (!(eglChooseConfig(display, fbAttrs, confs, MAX_CONFIGS, &numConfigs) && numConfigs)) {
+ kdLogMessage("Error - EGL choose config failed\n");
+ return JNI_FALSE;
+ }
+ /* Use the first */
+ config = confs[0];
+ return JNI_TRUE;
+}
+
+JNIEXPORT jboolean JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_checkDisplay
+ (JNIEnv *env, jobject unused)
+{
+ if (display == NULL) {
+ kdLogMessage("Error - EGL get display returned null\n");
+ return JNI_FALSE;
+ }
+ return JNI_TRUE;
+}
+
+JNIEXPORT jboolean JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_checkConfig
+ (JNIEnv *env, jobject unused)
+{
+ if (config == NULL) {
+ kdLogMessage("Error - EGL choose config returned null\n");
+ return JNI_FALSE;
+ }
+ return JNI_TRUE;
+}
+
+JNIEXPORT jboolean JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_createWindow
+ (JNIEnv *env, jobject unused)
+{
+ window = kdCreateWindow(display, config, KD_NULL);
+ if (!window) {
+ return JNI_FALSE;
+ }
+ return JNI_TRUE;
+}
+
+JNIEXPORT void JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_setWindowVisible
+ (JNIEnv *env, jobject unused)
+{
+ KDboolean visible = KD_TRUE;
+ kdSetWindowPropertybv(window,
+ KD_WINDOWPROPERTY_VISIBILITY, &visible);
+}
+
+JNIEXPORT void JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_setWindowFullscreen
+ (JNIEnv *env, jobject unused)
+{
+ KDboolean fullscreen = KD_TRUE;
+ kdSetWindowPropertybv(window,
+ KD_WINDOWPROPERTY_FULLSCREEN_NV, &fullscreen);
+}
+
+JNIEXPORT jboolean JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_realizeWindow
+ (JNIEnv *env, jobject unused)
+{
+ if (kdRealizeWindow(window, &nativewin) != 0) {
+ return JNI_FALSE;
+ }
+ return JNI_TRUE;
+}
+
+JNIEXPORT jboolean JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_createSurface
+ (JNIEnv *env, jobject unused)
+{
+ surface = eglCreateWindowSurface(display,
+ config, nativewin, 0);
+ if (!surface)
+ {
+ kdLogMessage("Error - EGL create window surface failed\n");
+ return JNI_FALSE;
+ }
+ return JNI_TRUE;
+}
+
+JNIEXPORT jboolean JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_createContext
+ (JNIEnv *env, jobject unused)
+{
+ /*a
+ static EGLint contextAttrs[] =
+ {
+ // FIXME
+ // OpenGL ES 2 settings
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+ */
+
+ const EGLint contextAttrs[] =
+ {
+ // FIXME
+ // OpenGL ES 1 settings
+ EGL_CONTEXT_CLIENT_VERSION, 1,
+ EGL_NONE
+ };
+
+ context = eglCreateContext(display,
+ config, 0, contextAttrs);
+ if (!context)
+ {
+ kdLogMessage("Error - EGL create context failed\n");
+ return JNI_FALSE;
+ }
+ return JNI_TRUE;
+}
+
+JNIEXPORT jboolean JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_makeCurrent
+ (JNIEnv *env, jobject unused)
+{
+ if (!eglMakeCurrent(display, surface, surface, context))
+ {
+ kdLogMessage("Error - EGL make current failed\n");
+ return JNI_FALSE;
+ }
+ return JNI_TRUE;
+}
+
+JNIEXPORT void JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_updateWindowSize
+ (JNIEnv *env, jobject unused)
+{
+ EGLint drawWidth;
+ EGLint drawHeight;
+
+ eglQuerySurface(display, surface, EGL_WIDTH, &drawWidth);
+ eglQuerySurface(display, surface, EGL_HEIGHT, &drawHeight);
+ if ((lastWidth != drawWidth) || (lastHeight != drawHeight))
+ {
+ glViewport(0, 0, drawWidth, drawHeight);
+ lastWidth = drawWidth;
+ lastHeight = drawHeight;
+ }
+}
+
+JNIEXPORT void JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_swapBuffers0
+ (JNIEnv *env, jobject unused)
+{
+ eglSwapBuffers(display, surface);
+}
+
+JNIEXPORT jboolean JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_shouldExit
+ (JNIEnv *env, jobject unused)
+{
+ const KDEvent* ev = NULL;
+ do {
+ ev = kdWaitEvent(0);
+ if (ev != 0) {
+ switch (ev->type) {
+ case KD_EVENT_WINDOW_CLOSE:
+ case KD_EVENT_QUIT:
+ return JNI_TRUE;
+ default:
+ break;
+ /*
+ case KD_EVENT_INPUT:
+ {
+ if (!s_runningInLauncher)
+ {
+ int btn;
+ for (btn=0; btn<NVM_BTNS_MAX; btn++)
+ {
+ if (InputDown(ev, conButtons[btn].index))
+ {
+ if (!conButtons[btn].wasPressed)
+ {
+ conButtons[btn].pressTime = ev->timestamp;
+ conButtons[btn].wasPressed = KD_TRUE;
+ }
+ }
+ else
+ {
+ conButtons[btn].wasPressed = KD_FALSE;
+ }
+ }
+ }
+ break;
+ }
+ */
+ }
+ }
+ } while (ev != 0);
+ return JNI_FALSE;
+}
+
+JNIEXPORT void JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_shutdown
+ (JNIEnv *env, jobject unused)
+{
+ if (context) {
+ eglMakeCurrent(display,
+ EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
+ eglDestroyContext(display, context);
+ context = EGL_NO_CONTEXT;
+ }
+ if (surface) {
+ eglDestroySurface(display, surface);
+ surface = EGL_NO_SURFACE;
+ }
+ kdDestroyWindow(window);
+ if (display) {
+ eglTerminate(display);
+ display = EGL_NO_DISPLAY;
+ }
+}
+
+JNIEXPORT jint JNICALL Java_com_sun_opengl_impl_egl_EGLDrawableFactory_getDirectBufferAddress
+ (JNIEnv *env, jobject unused, jobject buffer)
+{
+ return (jint) (*env)->GetDirectBufferAddress(env, buffer);
+}
diff --git a/src/native/jogl/Mixer.cpp b/src/native/jogl/Mixer.cpp
new file mode 100755
index 000000000..8843c00ec
--- /dev/null
+++ b/src/native/jogl/Mixer.cpp
@@ -0,0 +1,199 @@
+#include <windows.h>
+#include <stdlib.h>
+#include <mmsystem.h>
+#include <mmreg.h>
+#include "com_sun_javafx_audio_windows_waveout_Mixer.h"
+
+static HANDLE event = NULL;
+static HWAVEOUT output = NULL;
+// We use only two buffers to keep latency down
+#define NUM_BUFFERS 2
+//#define NUM_BUFFERS 4
+// This is about 20 ms of data for WAVE_FORMAT_PCM:
+// (44100 samples / sec) * (20 ms / 1000 ms) * (2 bytes / sample) * (2 channels)
+//#define BUFFER_SIZE 3528
+
+// This is about 50 ms of data for WAVE_FORMAT_PCM:
+// (44100 samples / sec) * (50 ms / 1000 ms) * (2 bytes / sample) * (1 channel)
+//#define BUFFER_SIZE 4410
+
+// This is about 200 ms of data for WAVE_FORMAT_PCM:
+// (44100 samples / sec) * (200 ms / 1000 ms) * (2 bytes / sample) * (1 channel)
+//#define BUFFER_SIZE 17640
+
+// This is about 200 ms of data for WAVE_FORMAT_PCM:
+// (44100 samples / sec) * (200 ms / 1000 ms) * (2 bytes / sample) * (2 channel)
+//#define BUFFER_SIZE 35280
+
+// This is about 1000 ms of data for WAVE_FORMAT_PCM:
+// (44100 samples / sec) * (1000 ms / 1000 ms) * (2 bytes / sample) * (1 channel)
+//#define BUFFER_SIZE 88200
+
+// This is about 50 ms of data for WAVE_FORMAT_PCM:
+// (44100 samples / sec) * (50 ms / 1000 ms) * (2 bytes / sample) * (2 channels)
+//#define BUFFER_SIZE 8820
+
+// This is about 50 ms of data for WAVE_FORMAT_IEEE_FLOAT:
+// (44100 samples / sec) * (50 ms / 1000 ms) * (4 bytes / sample) * (2 channels)
+//#define BUFFER_SIZE 17640
+
+// This is about 200 ms of data for WAVE_FORMAT_PCM:
+// (11025 samples / sec) * (200 ms / 1000 ms) * (2 bytes / sample) * (2 channel)
+#define BUFFER_SIZE 8820
+
+//#define BUFFER_SIZE 8192
+static WAVEHDR** buffers = NULL;
+
+void CALLBACK playbackCallback(HWAVEOUT output,
+ UINT msg,
+ DWORD_PTR userData,
+ DWORD_PTR param1,
+ DWORD_PTR param2)
+{
+ if (msg == WOM_DONE) {
+ WAVEHDR* hdr = (WAVEHDR*) param1;
+ hdr->dwFlags |= WHDR_DONE;
+ SetEvent(event);
+ }
+}
+
+JNIEXPORT jboolean JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_initializeWaveOut
+ (JNIEnv *env, jclass unused, jlong eventObject)
+{
+ event = (HANDLE) eventObject;
+
+ // Note the hard requirements on the RawSoundConverter's output format
+ WAVEFORMATEX format;
+ format.wFormatTag = WAVE_FORMAT_PCM;
+ // format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
+ format.nChannels = 2;
+ // format.nChannels = 1;
+ // format.nSamplesPerSec = 44100;
+ format.nSamplesPerSec = 11025;
+ format.wBitsPerSample = 16;
+ // format.wBitsPerSample = 32;
+ format.nBlockAlign = format.nChannels * format.wBitsPerSample / 8;
+ format.nAvgBytesPerSec = format.nBlockAlign * format.nSamplesPerSec;
+ format.cbSize = 0;
+ MMRESULT res = waveOutOpen(&output,
+ WAVE_MAPPER,
+ &format,
+ /* NULL, */ (DWORD_PTR) &playbackCallback,
+ NULL, // No user data right now
+ /* CALLBACK_NULL */ CALLBACK_FUNCTION);
+ if (res != MMSYSERR_NOERROR) {
+ return JNI_FALSE;
+ }
+
+ buffers = (WAVEHDR**) calloc(NUM_BUFFERS, sizeof(WAVEHDR));
+ for (int i = 0; i < NUM_BUFFERS; i++) {
+ char* data = (char*) calloc(BUFFER_SIZE, 1);
+ WAVEHDR* hdr = (WAVEHDR*) calloc(1, sizeof(WAVEHDR));
+ hdr->lpData = data;
+ hdr->dwBufferLength = BUFFER_SIZE;
+ hdr->dwFlags |= WHDR_DONE;
+ buffers[i] = hdr;
+ }
+
+ return JNI_TRUE;
+}
+
+JNIEXPORT void JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_shutdownWaveOut
+ (JNIEnv *env, jclass unused)
+{
+ // writeString("Pausing\n");
+ waveOutPause(output);
+ // writeString("Resetting\n");
+ waveOutReset(output);
+ // writeString("Closing output\n");
+ waveOutClose(output);
+}
+
+JNIEXPORT jlong JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_getNextMixerBuffer
+ (JNIEnv *env, jclass unused)
+{
+ WAVEHDR* hdr = NULL;
+ for (int i = 0; i < NUM_BUFFERS; i++) {
+ if (buffers[i] != NULL && ((buffers[i]->dwFlags & WHDR_DONE) != 0)) {
+ hdr = buffers[i];
+ hdr->dwFlags &= ~WHDR_DONE;
+ break;
+ }
+ }
+ return (jlong) hdr;
+}
+
+JNIEXPORT jobject JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_getMixerBufferData
+ (JNIEnv *env, jclass unused, jlong mixerBuffer)
+{
+ WAVEHDR* hdr = (WAVEHDR*) mixerBuffer;
+ return env->NewDirectByteBuffer(hdr->lpData, hdr->dwBufferLength);
+}
+
+JNIEXPORT jlong JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_getMixerBufferDataAddress
+ (JNIEnv *env, jclass unused, jlong mixerBuffer)
+{
+ WAVEHDR* hdr = (WAVEHDR*) mixerBuffer;
+ return (jlong) hdr->lpData;
+}
+
+JNIEXPORT jint JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_getMixerBufferDataCapacity
+ (JNIEnv *env, jclass unused, jlong mixerBuffer)
+{
+ WAVEHDR* hdr = (WAVEHDR*) mixerBuffer;
+ return (jint) hdr->dwBufferLength;
+}
+
+JNIEXPORT jboolean JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_prepareMixerBuffer
+ (JNIEnv *env, jclass unused, jlong mixerBuffer)
+{
+ MMRESULT res = waveOutPrepareHeader(output,
+ (WAVEHDR*) mixerBuffer,
+ sizeof(WAVEHDR));
+ if (res == MMSYSERR_NOERROR) {
+ return JNI_TRUE;
+ }
+ return JNI_FALSE;
+}
+
+JNIEXPORT jboolean JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_writeMixerBuffer
+ (JNIEnv *env, jclass unused, jlong mixerBuffer)
+{
+ MMRESULT res = waveOutWrite(output,
+ (WAVEHDR*) mixerBuffer,
+ sizeof(WAVEHDR));
+ if (res == MMSYSERR_NOERROR) {
+ waveOutRestart(output);
+
+ return JNI_TRUE;
+ }
+ return JNI_FALSE;
+}
+
+JNIEXPORT jlong JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_CreateEvent
+ (JNIEnv *env, jclass unused)
+{
+ return (jlong) CreateEvent(NULL, FALSE, TRUE, NULL);
+}
+
+JNIEXPORT jboolean JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_WaitForSingleObject
+ (JNIEnv *env, jclass unused, jlong eventObject)
+{
+ DWORD res = WaitForSingleObject((HANDLE) eventObject, INFINITE);
+ if (res == WAIT_OBJECT_0) {
+ return JNI_TRUE;
+ }
+ return JNI_FALSE;
+}
+
+JNIEXPORT void JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_SetEvent
+ (JNIEnv *env, jclass unused, jlong eventObject)
+{
+ SetEvent((HANDLE) eventObject);
+}
+
+JNIEXPORT void JNICALL Java_com_sun_javafx_audio_windows_waveout_Mixer_CloseHandle
+ (JNIEnv *env, jclass unused, jlong eventObject)
+{
+ CloseHandle((HANDLE) eventObject);
+}