aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/build.xml187
-rw-r--r--make/cg-common.cfg4
-rw-r--r--make/cgl-macosx.cfg4
-rwxr-xr-xmake/cglext.cfg4
-rwxr-xr-xmake/egl.cfg4
-rwxr-xr-xmake/eglext.cfg6
-rw-r--r--make/gl-common.cfg2
-rwxr-xr-xmake/gl-es1.cfg23
-rwxr-xr-xmake/gl-es2.cfg22
-rw-r--r--make/gl-gl2.cfg27
-rw-r--r--make/gl-gl2es12.cfg25
-rw-r--r--make/gl-if-CustomJavaCode-gl.java116
-rw-r--r--make/gl-if-CustomJavaCode-gles2.java125
-rwxr-xr-xmake/gl-if-gl.cfg7
-rwxr-xr-xmake/gl-if-gl2_es1.cfg16
-rwxr-xr-xmake/gl-if-gl2_es2.cfg14
-rw-r--r--make/gl-ignore-gl2_es12-special.cfg88
-rw-r--r--make/gl-impl-CustomJavaCode-common.java8
-rw-r--r--make/gl-impl-CustomJavaCode-gl2.java121
-rw-r--r--make/gl-impl-CustomJavaCode-gl2_es2.java61
-rw-r--r--make/gl-impl-CustomJavaCode-gl2es12.java137
-rwxr-xr-xmake/gl-impl-CustomJavaCode-gles1.java108
-rwxr-xr-xmake/gl-impl-CustomJavaCode-gles2.java473
-rwxr-xr-xmake/glu-CustomJavaCode-base.java36
-rw-r--r--make/glu-CustomJavaCode-gl2.java1
-rwxr-xr-xmake/glu-base.cfg4
-rw-r--r--make/glu-common.cfg2
-rwxr-xr-xmake/glu-gl2.cfg4
-rwxr-xr-xmake/glu-gl2es1.cfg4
-rw-r--r--make/glx-x11.cfg4
-rwxr-xr-xmake/glxext.cfg6
-rw-r--r--make/jawt-macosx.cfg4
-rw-r--r--make/jawt-win32.cfg4
-rw-r--r--make/jawt-x11.cfg4
-rw-r--r--make/make.jogl.all.linux-x86.sh3
-rw-r--r--make/wgl-win32.cfg4
-rw-r--r--make/wglext.cfg4
-rw-r--r--make/x11-lib.cfg4
-rw-r--r--src/classes/com/sun/javafx/newt/GLWindow.java14
-rw-r--r--src/classes/com/sun/opengl/impl/GLArrayHandler.java1
-rw-r--r--src/classes/com/sun/opengl/impl/GLContextImpl.java8
-rw-r--r--src/classes/com/sun/opengl/impl/GLFixedArrayHandler.java21
-rw-r--r--src/classes/com/sun/opengl/impl/GLPbufferImpl.java4
-rw-r--r--src/classes/com/sun/opengl/impl/GLReflection.java7
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/ProjectFloat.java11
-rw-r--r--src/classes/com/sun/opengl/impl/glsl/GLSLArrayHandler.java10
-rw-r--r--src/classes/com/sun/opengl/impl/glsl/fixed/FixedFuncPipeline.java103
-rw-r--r--src/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java17
-rw-r--r--src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java16
-rw-r--r--src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java10
-rw-r--r--src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java2
-rw-r--r--src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java12
-rw-r--r--src/classes/com/sun/opengl/util/glsl/ShaderCode.java69
-rwxr-xr-xsrc/classes/com/sun/opengl/util/glsl/fixed/FixedFuncHook.java333
-rw-r--r--src/classes/javax/media/opengl/GLAutoDrawable.java6
-rw-r--r--src/classes/javax/media/opengl/GLContext.java54
-rw-r--r--src/classes/javax/media/opengl/GLProfile.java17
-rw-r--r--src/classes/javax/media/opengl/NativeWindowFactory.java3
-rw-r--r--src/classes/javax/media/opengl/awt/GLCanvas.java4
-rw-r--r--src/classes/javax/media/opengl/awt/GLJPanel.java25
-rw-r--r--src/classes/javax/media/opengl/sub/GLObject.java75
-rw-r--r--src/classes/javax/media/opengl/sub/fixed/GLFixedFuncHookIf.java33
-rw-r--r--src/classes/javax/media/opengl/sub/fixed/GLFixedFuncIf.java18
-rw-r--r--src/classes/javax/media/opengl/sub/fixed/GLFixedFuncUtil.java50
-rw-r--r--src/classes/javax/media/opengl/sub/fixed/GLLightingIf.java50
-rw-r--r--src/classes/javax/media/opengl/sub/fixed/GLMatrixIf.java77
-rw-r--r--src/classes/javax/media/opengl/sub/fixed/GLPointerIf.java39
-rw-r--r--src/classes/javax/media/opengl/util/ImmModeSink.java57
-rwxr-xr-xsrc/classes/javax/media/opengl/util/PMVMatrix.java426
69 files changed, 1939 insertions, 1303 deletions
diff --git a/make/build.xml b/make/build.xml
index e8b2e8b8e..7a9a9f5f1 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -339,23 +339,20 @@
<property name="javacdebug" value="true" />
<property name="javacdebuglevel" value="source,lines" />
- <!-- GlueGen properties. -->
- <!-- NOTE that these require a checked-out GlueGen workspace as a -->
- <!-- sibling of the JOGL workspace. -->
- <property name="gluegen.make.dir" value="../../gluegen/make" />
- <property name="gluegen.build.xml" value="${gluegen.make.dir}/build.xml" />
- <property name="gluegen.jar" value="../../gluegen/build/gluegen.jar" />
- <property name="gluegen-rt.jar" value="../../gluegen/build/gluegen-rt.jar" />
-
<!-- Names of directories relative to the project root.
Some of these are used in FileMappers later for dependence information
and need exact string matching, which is why they use file.separator
instead of "/". -->
+ <condition property="rootrel.build" value="build">
+ <not>
+ <isset property="rootrel.build"/>
+ </not>
+ </condition>
<property name="rootrel.src.java" value="src/classes" />
<property name="rootrel.src.c.jogl" value="src/native/jogl" />
<property name="rootrel.src.c.newt" value="src/native/newt" />
<property name="rootrel.src.c.openmax" value="src/native/openmax" />
- <property name="rootrel.build" value="build" />
+
<property name="rootrel.src.generated" value="${rootrel.build}/gensrc" />
<property name="rootrel.generated.c.jogl" value="${rootrel.src.generated}/native/jogl" />
<property name="rootrel.generated.c.cg" value="${rootrel.src.generated}/native/jogl_cg" />
@@ -363,10 +360,19 @@
<property name="rootrel.obj.jogl" value="${rootrel.obj}/jogl" />
<property name="rootrel.obj.cg" value="${rootrel.obj}/jogl_cg" />
+ <!-- GlueGen properties. -->
+ <!-- NOTE that these require a checked-out GlueGen workspace as a -->
+ <!-- sibling of the JOGL workspace. -->
+ <property name="gluegen.make.dir" value="../../gluegen/make" />
+ <property name="gluegen.build.xml" value="${gluegen.make.dir}/build.xml" />
+ <property name="gluegen.jar" value="../../gluegen/${rootrel.build}/gluegen.jar" />
+ <property name="gluegen-rt.jar" value="../../gluegen/${rootrel.build}/gluegen-rt.jar" />
+
<!-- The source directories. -->
<property name="src.java" value="${project.root}/${rootrel.src.java}" />
<property name="src.c" value="${project.root}/${rootrel.src.c}" />
<property name="build" value="${project.root}/${rootrel.build}" />
+ <property name="tempdir" value="${project.root}/build-temp" />
<!-- The generated source directories. -->
<property name="src.generated" value="${build}/gensrc" />
@@ -610,9 +616,24 @@
<!--property name="java.generate.skip" value="true"/-->
</target>
+ <target name="java.generate.cleantemp">
+ <delete includeEmptyDirs="true" quiet="true">
+ <fileset dir="${tempdir}/gensrc" />
+ </delete>
+ </target>
+
+ <target name="java.generate.copy2temp">
+ <copy todir="${tempdir}">
+ <fileset dir="../${rootrel.build}"
+ includes="gensrc/classes/**" />
+ </copy>
+ </target>
+
<target name="java.generate.gl_if">
<echo message="Generating GL interface" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.common}/gles2.c"
+ outputRootDir="../${rootrel.build}"
config="${config}/gl-if-gl.cfg"
includeRefid="stub.includes.fileset.all.gl2"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -622,7 +643,9 @@
<target name="java.generate.gl2_es1_if">
<echo message="Generating GL2_ES1 interface" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.common}/gles1.c"
+ outputRootDir="../${rootrel.build}"
config="${config}/gl-if-gl2_es1.cfg"
includeRefid="stub.includes.fileset.all.gl2"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -632,7 +655,9 @@
<target name="java.generate.gl2_es2_if">
<echo message="Generating GL2_ES2 interface" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.common}/gles2.c"
+ outputRootDir="../${rootrel.build}"
config="${config}/gl-if-gl2_es2.cfg"
includeRefid="stub.includes.fileset.all.gl2"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -642,7 +667,9 @@
<target name="java.generate.gl2">
<echo message="Generating GL2 interface and implementation" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.common}/gl.c"
+ outputRootDir="../${rootrel.build}"
config="${config}/gl-gl2.cfg"
includeRefid="stub.includes.fileset.all.gl2"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -652,7 +679,9 @@
<target name="java.generate.gl2es12">
<echo message="Generating GL2ES12 interface and implementation" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.common}/gl.c"
+ outputRootDir="../${rootrel.build}"
config="${config}/gl-gl2es12.cfg"
includeRefid="stub.includes.fileset.all.gl2"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -662,7 +691,9 @@
<target name="java.generate.gles1">
<echo message="Generating GLES1 interface and implementation" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.common}/gles1.c"
+ outputRootDir="../${rootrel.build}"
config="${config}/gl-es1.cfg"
includeRefid="stub.includes.fileset.all.gl2"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -672,7 +703,9 @@
<target name="java.generate.gles2">
<echo message="Generating GLES2 interface and implementation" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.common}/gles2.c"
+ outputRootDir="../${rootrel.build}"
config="${config}/gl-es2.cfg"
includeRefid="stub.includes.fileset.all.gl2"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -694,7 +727,9 @@
<target name="java.generate.glu.base">
<echo message="Generating GLU class" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.common}/glu.c"
+ outputRootDir="../${rootrel.build}"
config="${config}/glu-base.cfg"
includeRefid="stub.includes.fileset.all.gl2"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -704,7 +739,9 @@
<target name="java.generate.glu.GL2ES1">
<echo message="Generating GLU class" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.common}/glu.c"
+ outputRootDir="../${rootrel.build}"
config="${config}/glu-gl2es1.cfg"
includeRefid="stub.includes.fileset.all.gl2"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -714,7 +751,9 @@
<target name="java.generate.glu.GL2" unless="jogl.nogl2">
<echo message="Generating GLU class" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.common}/glu.c"
+ outputRootDir="../${rootrel.build}"
config="${config}/glu-gl2.cfg"
includeRefid="stub.includes.fileset.all.gl2"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -724,7 +763,9 @@
<target name="java.generate.platform.glext" unless="jogl.nogl2">
<echo message="Generating platform-specific OpenGL extension class" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${glext.platform.header}"
+ outputRootDir="../${rootrel.build}"
config="${glext.platform.cfg}"
includeRefid="stub.includes.fileset.all.gl2"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -734,7 +775,9 @@
<target name="java.generate.window.lib" if="windowlib.os.cfg">
<echo message="Generating Windowing Lib implementation class" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.dir}/${window.os.system}/window-lib.c"
+ outputRootDir="../${rootrel.build}"
config="${windowlib.os.cfg}"
includeRefid="stub.includes.fileset.platform"
emitter="com.sun.gluegen.JavaEmitter">
@@ -744,8 +787,10 @@
<target name="java.generate.window.system.es" if="window.es.cfg" unless="jogl.noes">
<echo message="Generating EGL implementation class" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<dirset id="stub.includes.fileset.platform" dir="." includes="${stub.includes.dir}/${window.es.system}/** ${stub.includes.dir}/common/**" />
<gluegen src="${stub.includes.dir}/${window.es.system}/window-system.c"
+ outputRootDir="../${rootrel.build}"
config="${window.es.cfg}"
includeRefid="stub.includes.fileset.platform"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -755,8 +800,10 @@
<target name="java.generate.window.system.es.ext" if="window.es.ext.cfg" unless="jogl.noes">
<echo message="Generating EGLExt implementation class" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<dirset id="stub.includes.fileset.platform" dir="." includes="${stub.includes.dir}/${window.es.system}/** ${stub.includes.dir}/common/**" />
<gluegen src="${stub.includes.dir}/${window.es.system}/window-system-ext.c"
+ outputRootDir="../${rootrel.build}"
config="${window.es.ext.cfg}"
includeRefid="stub.includes.fileset.platform"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -766,7 +813,9 @@
<target name="java.generate.window.system.os" if="window.os.cfg" unless="jogl.nogl2">
<echo message="Generating WGL/GLX/CGL/EGL implementation class" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${stub.includes.dir}/${window.os.system}/window-system.c"
+ outputRootDir="../${rootrel.build}"
config="${window.os.cfg}"
includeRefid="stub.includes.fileset.platform"
emitter="com.sun.gluegen.opengl.GLEmitter">
@@ -780,7 +829,9 @@
- handle different drives in an effective manner. -->
<echo message="Generating JAWT interface class" />
<echo message="java.home.dir=${java.home.dir}" />
+ <antcall target="java.generate.copy2temp" inheritRefs="true" />
<gluegen src="${jawt.platform.header}"
+ outputRootDir="../${rootrel.build}"
config="${jawt.cfg}"
literalInclude="${stub.includes.dir}/jni"
includeRefid="stub.includes.fileset.platform"
@@ -790,44 +841,44 @@
</target>
<target name="java.generate.SystemUtil.javame_cdc_fp" if="jogl.cdcfp">
- <copy file="../src/classes/com/sun/opengl/impl/SystemUtil.java.javame_cdc_fp" tofile="../build/gensrc/classes/com/sun/opengl/impl/SystemUtil.java" />
+ <copy file="../src/classes/com/sun/opengl/impl/SystemUtil.java.javame_cdc_fp" tofile="../${rootrel.build}/gensrc/classes/com/sun/opengl/impl/SystemUtil.java" />
</target>
<target name="java.generate.SystemUtil.javase" unless="jogl.cdcfp">
- <copy file="../src/classes/com/sun/opengl/impl/SystemUtil.java.javase" tofile="../build/gensrc/classes/com/sun/opengl/impl/SystemUtil.java" />
+ <copy file="../src/classes/com/sun/opengl/impl/SystemUtil.java.javase" tofile="../${rootrel.build}/gensrc/classes/com/sun/opengl/impl/SystemUtil.java" />
</target>
<!-- Generate the SystemUtil class for this particular profile -->
<target name="java.generate.SystemUtil" depends="java.generate.SystemUtil.javase, java.generate.SystemUtil.javame_cdc_fp" />
<target name="java.generate.BufferUtil.javame_cdc_fp" if="jogl.cdcfp">
- <copy file="../src/classes/javax/media/opengl/util/BufferUtil.java.javame_cdc_fp" tofile="../build/gensrc/classes/javax/media/opengl/util/BufferUtil.java" />
+ <copy file="../src/classes/javax/media/opengl/util/BufferUtil.java.javame_cdc_fp" tofile="../${rootrel.build}/gensrc/classes/javax/media/opengl/util/BufferUtil.java" />
</target>
<target name="java.generate.BufferUtil.javase" unless="jogl.cdcfp">
- <copy file="../src/classes/javax/media/opengl/util/BufferUtil.java.javase" tofile="../build/gensrc/classes/javax/media/opengl/util/BufferUtil.java" />
+ <copy file="../src/classes/javax/media/opengl/util/BufferUtil.java.javase" tofile="../${rootrel.build}/gensrc/classes/javax/media/opengl/util/BufferUtil.java" />
</target>
<!-- Generate the BufferUtil class for this particular profile -->
<target name="java.generate.BufferUtil" depends="java.generate.BufferUtil.javase, java.generate.BufferUtil.javame_cdc_fp" />
<target name="java.generate.TextureIO.javame_cdc_fp" if="jogl.cdcfp">
- <copy file="../src/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp" tofile="../build/gensrc/classes/com/sun/opengl/util/texture/TextureIO.java" />
- <copy file="../src/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp" tofile="../build/gensrc/classes/com/sun/opengl/util/texture/spi/DDSImage.java" />
- <copy file="../src/classes/com/sun/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp" tofile="../build/gensrc/classes/com/sun/opengl/util/texture/spi/TGAImage.java" />
+ <copy file="../src/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp" tofile="../${rootrel.build}/gensrc/classes/com/sun/opengl/util/texture/TextureIO.java" />
+ <copy file="../src/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp" tofile="../${rootrel.build}/gensrc/classes/com/sun/opengl/util/texture/spi/DDSImage.java" />
+ <copy file="../src/classes/com/sun/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp" tofile="../${rootrel.build}/gensrc/classes/com/sun/opengl/util/texture/spi/TGAImage.java" />
</target>
<target name="java.generate.TextureIO.javase" unless="jogl.cdcfp">
<!-- For debugging -->
<!--
- <copy file="../src/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp" tofile="../build/gensrc/classes/com/sun/opengl/util/texture/TextureIO.java" />
- <copy file="../src/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp" tofile="../build/gensrc/classes/com/sun/opengl/util/texture/spi/DDSImage.java" />
- <copy file="../src/classes/com/sun/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp" tofile="../build/gensrc/classes/com/sun/opengl/util/texture/spi/TGAImage.java" />
+ <copy file="../src/classes/com/sun/opengl/util/texture/TextureIO.java.javame_cdc_fp" tofile="../${rootrel.build}/gensrc/classes/com/sun/opengl/util/texture/TextureIO.java" />
+ <copy file="../src/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javame_cdc_fp" tofile="../${rootrel.build}/gensrc/classes/com/sun/opengl/util/texture/spi/DDSImage.java" />
+ <copy file="../src/classes/com/sun/opengl/util/texture/spi/TGAImage.java.javame_cdc_fp" tofile="../${rootrel.build}/gensrc/classes/com/sun/opengl/util/texture/spi/TGAImage.java" />
-->
- <copy file="../src/classes/com/sun/opengl/util/texture/TextureIO.java.javase" tofile="../build/gensrc/classes/com/sun/opengl/util/texture/TextureIO.java" />
- <copy file="../src/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javase" tofile="../build/gensrc/classes/com/sun/opengl/util/texture/spi/DDSImage.java" />
- <copy file="../src/classes/com/sun/opengl/util/texture/spi/TGAImage.java.javase" tofile="../build/gensrc/classes/com/sun/opengl/util/texture/spi/TGAImage.java" />
+ <copy file="../src/classes/com/sun/opengl/util/texture/TextureIO.java.javase" tofile="../${rootrel.build}/gensrc/classes/com/sun/opengl/util/texture/TextureIO.java" />
+ <copy file="../src/classes/com/sun/opengl/util/texture/spi/DDSImage.java.javase" tofile="../${rootrel.build}/gensrc/classes/com/sun/opengl/util/texture/spi/DDSImage.java" />
+ <copy file="../src/classes/com/sun/opengl/util/texture/spi/TGAImage.java.javase" tofile="../${rootrel.build}/gensrc/classes/com/sun/opengl/util/texture/spi/TGAImage.java" />
</target>
@@ -941,6 +992,7 @@
<!-- Generate CgGL interface class -->
<gluegen src="${stub.includes.common}/cg.c"
+ outputRootDir="../${rootrel.build}"
config="cg-common.cfg"
includeRefid="stub.includes.cg.fileset.all"
emitter="com.sun.gluegen.JavaEmitter">
@@ -1060,6 +1112,35 @@
<target name="java.generate.composable.pipeline" depends="java.generate.composable.pipeline.check, java.generate.composable.pipeline.es1, java.generate.composable.pipeline.es2, java.generate.composable.pipeline.gl2">
</target>
+ <target name="java.generate.composable.pipeline.custom.check.glfixfunc">
+ <!-- Blow away the DebugGL*.java and TraceGL*.java sources if GL*.class has changed
+ (the uptodate element doesn't support arbitrary source and destination files) -->
+ <dependset>
+ <srcfilelist dir="${classes}/javax/media/opengl/sub/fixed" files="GLFixedFuncIf.class" />
+ <srcfilelist dir="${classes}/javax/media/opengl" files="GL2ES2.class" />
+ <targetfileset dir="${src.generated.java}/com/sun/opengl/impl/fixed"
+ includes="GLFixedFuncImpl.java" />
+ </dependset>
+
+ <!-- Now choose one of the two to test to see if we have to regenerate -->
+ <uptodate property="java.generate.composable.pipeline.custom.skip.glfixfunc"
+ srcfile="${classes}/javax/media/opengl/GL2ES2.class"
+ targetfile="${src.generated.java}/javax/media/opengl/impl/fixed/GLFixedFuncImpl.java" />
+ </target>
+ <target name="java.generate.composable.pipeline.custom.glfixfunc" depends="java.generate.composable.pipeline.custom.check.glfixfunc" unless="java.generate.composable.pipeline.custom.skip.glfixfunc">
+ <java classname="com.sun.gluegen.opengl.BuildComposablePipeline" fork="yes" failonerror="true">
+ <arg value="javax.media.opengl.sub.fixed.GLFixedFuncIf" />
+ <arg value="${src.generated.java}/com/sun/opengl/impl/fixed" />
+ <arg value="com.sun.opengl.impl.fixed.GLFixedFuncImpl" />
+ <arg value="javax.media.opengl.sub.fixed.GLFixedFuncHookIf" />
+ <arg value="javax.media.opengl.GL" />
+ <arg value="prolog_xor_downstream" />
+ <classpath refid="pipeline.classpath" />
+ </java>
+ </target>
+ <target name="java.generate.composable.pipeline.custom" depends="init, build.gluegen, java.generate.composable.pipeline.check, java.generate.composable.pipeline.custom.glfixfunc">
+ </target>
+
<!-- ================================================================== -->
<!--
- Compile the original and generated source. The composable pipelines
@@ -1070,7 +1151,7 @@
<!-- Perform the first pass Java compile. -->
<javac destdir="${classes}"
classpath="${gluegen-rt.jar}"
- includes="javax/media/opengl/GLDrawableFactory.java javax/media/opengl/GLDrawable.java javax/media/opengl/GLContext.java javax/media/opengl/GL.java javax/media/opengl/GL2ES1.java javax/media/opengl/GL2ES2.java javax/media/opengl/GL2.java javax/media/opengl/GLES1.java javax/media/opengl/GLES2.java"
+ includes="javax/media/opengl/sub/** javax/media/opengl/GLDrawableFactory.java javax/media/opengl/GLDrawable.java javax/media/opengl/GLContext.java javax/media/opengl/GL.java javax/media/opengl/GL2ES1.java javax/media/opengl/GL2ES2.java javax/media/opengl/GL2.java javax/media/opengl/GLES1.java javax/media/opengl/GLES2.java"
fork="yes"
memoryMaximumSize="128m"
source="1.4" debug="${javacdebug}" debuglevel="${javacdebuglevel}">
@@ -1110,7 +1191,36 @@
<target name="java.compile.secondpass" depends="java.generate.composable.pipeline,java.compile.secondpass.1,java.compile.secondpass.2" />
- <target name="java.compile" depends="java.compile.firstpass,java.compile.secondpass" />
+ <target name="java.compile.thirdpass.1" if="javac.bootclasspath.jar">
+ <!-- Perform the thirdpass pass Java compile; custom generated sources. -->
+ <javac destdir="${classes}"
+ excludes="${java.excludes.all}"
+ source="${jogl.sourcelevel}"
+ classpath="${gluegen-rt.jar}"
+ bootclasspath="${javac.bootclasspath.jar}"
+ fork="yes"
+ memoryMaximumSize="128m"
+ debug="${javacdebug}" debuglevel="${javacdebuglevel}">
+ <src path="${src.generated.java}" />
+ </javac>
+ </target>
+
+ <target name="java.compile.thirdpass.2" unless="javac.bootclasspath.jar">
+ <!-- Perform the thirdpass pass Java compile; custom generated sources. -->
+ <javac destdir="${classes}"
+ excludes="${java.excludes.all}"
+ source="${jogl.sourcelevel}"
+ classpath="${gluegen-rt.jar}"
+ fork="yes"
+ memoryMaximumSize="128m"
+ debug="${javacdebug}" debuglevel="${javacdebuglevel}">
+ <src path="${src.generated.java}" />
+ </javac>
+ </target>
+
+ <target name="java.compile.thirdpass" depends="java.generate.composable.pipeline.custom,java.compile.thirdpass.1,java.compile.thirdpass.2" />
+
+ <target name="java.compile" depends="java.compile.firstpass,java.compile.secondpass,java.compile.thirdpass" />
<!-- ================================================================== -->
<!--
@@ -1509,20 +1619,20 @@
<target name="c.build.newt.prepare">
<!-- FIXME: this is temporary until we move this to another workspace -->
- <javah destdir="../build/gensrc/native/newt/Windows" classpath="${jogl.all.jar}" class="com.sun.javafx.newt.windows.WindowsWindow" />
- <javah destdir="../build/gensrc/native/newt/MacOSX" classpath="${jogl.all.jar}" class="com.sun.javafx.newt.macosx.MacWindow" />
- <javah destdir="../build/gensrc/native/newt/X11" classpath="${jogl.all.jar}" class="com.sun.javafx.newt.x11.X11Window" />
- <javah destdir="../build/gensrc/native/newt/KD" classpath="${jogl.all.jar}" class="com.sun.javafx.newt.kd.KDWindow" />
+ <javah destdir="../${rootrel.build}/gensrc/native/newt/Windows" classpath="${jogl.all.jar}" class="com.sun.javafx.newt.windows.WindowsWindow" />
+ <javah destdir="../${rootrel.build}/gensrc/native/newt/MacOSX" classpath="${jogl.all.jar}" class="com.sun.javafx.newt.macosx.MacWindow" />
+ <javah destdir="../${rootrel.build}/gensrc/native/newt/X11" classpath="${jogl.all.jar}" class="com.sun.javafx.newt.x11.X11Window" />
+ <javah destdir="../${rootrel.build}/gensrc/native/newt/KD" classpath="${jogl.all.jar}" class="com.sun.javafx.newt.kd.KDWindow" />
</target>
<target name="c.build.jogl.prepare" depends="c.build.newt.prepare">
<!-- Generate the EGLDrawableFactory header -->
<!-- FIXME: this is temporary until we fully autogenerate the EGL interface -->
- <javah destdir="../build/gensrc/native/jogl" classpath="${jogl.all.jar}" class="com.sun.opengl.impl.egl.EGLDrawableFactory" />
+ <javah destdir="../${rootrel.build}/gensrc/native/jogl" classpath="${jogl.all.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.all.jar}" class="com.sun.javafx.audio.windows.waveout.Mixer" />
- <javah destdir="../build/gensrc/native/openmax" classpath="${jogl.all.jar}" class="com.sun.openmax.OMXInstance" />
+ <javah destdir="../${rootrel.build}/gensrc/native/jogl" classpath="${jogl.all.jar}" class="com.sun.javafx.audio.windows.waveout.Mixer" />
+ <javah destdir="../${rootrel.build}/gensrc/native/openmax" classpath="${jogl.all.jar}" class="com.sun.openmax.OMXInstance" />
</target>
<target name="c.build.jogl.awt">
@@ -2258,15 +2368,15 @@
<!-- First copy the generated files out of the Linux build results into the appropriate -->
<!-- directory of this source tree (so that they'll be blown away properly with an -->
<!-- "ant clean") -->
- <mkdir dir="../build/gensrc/classes/javax/media/opengl/glu" />
- <copy file="${jogl.dist.dir}/jogl-linux/DebugGL2.java" todir="../build/gensrc/classes/javax/media/opengl" />
- <copy file="${jogl.dist.dir}/jogl-linux/TraceGL2.java" todir="../build/gensrc/classes/javax/media/opengl" />
- <copy file="${jogl.dist.dir}/jogl-linux/GL.java" todir="../build/gensrc/classes/javax/media/opengl" />
- <copy file="${jogl.dist.dir}/jogl-linux/GLU.java" todir="../build/gensrc/classes/javax/media/opengl/glu" />
- <copy file="${jogl.dist.dir}/jogl-linux/GLUquadric.java" todir="../build/gensrc/classes/javax/media/opengl/glu" />
+ <mkdir dir="../${rootrel.build}/gensrc/classes/javax/media/opengl/glu" />
+ <copy file="${jogl.dist.dir}/jogl-linux/DebugGL2.java" todir="../${rootrel.build}/gensrc/classes/javax/media/opengl" />
+ <copy file="${jogl.dist.dir}/jogl-linux/TraceGL2.java" todir="../${rootrel.build}/gensrc/classes/javax/media/opengl" />
+ <copy file="${jogl.dist.dir}/jogl-linux/GL.java" todir="../${rootrel.build}/gensrc/classes/javax/media/opengl" />
+ <copy file="${jogl.dist.dir}/jogl-linux/GLU.java" todir="../${rootrel.build}/gensrc/classes/javax/media/opengl/glu" />
+ <copy file="${jogl.dist.dir}/jogl-linux/GLUquadric.java" todir="../${rootrel.build}/gensrc/classes/javax/media/opengl/glu" />
<zip destfile="${jogl.dist.dir}/jogl-${tmp.version}-src.zip"
basedir="../.."
- includes="gluegen/LICENSE.txt,gluegen/doc/**,gluegen/make/**,gluegen/src/**,jogl/*.txt,jogl/build/gensrc/classes/javax/media/opengl/**,jogl/doc/**,jogl/make/**,jogl/src/**"
+ includes="gluegen/LICENSE.txt,gluegen/doc/**,gluegen/make/**,gluegen/src/**,jogl/*.txt,jogl/${rootrel.build}/gensrc/classes/javax/media/opengl/**,jogl/doc/**,jogl/make/**,jogl/src/**"
excludes="**/*.class,**/*~"
/>
<!-- Create zip archives suitable for developers -->
@@ -2339,6 +2449,7 @@
-->
<target name="clean" description="Remove all build products" depends="declare.common">
<delete includeEmptyDirs="true" quiet="true">
+ <fileset dir="${tempdir}" />
<fileset dir="${build}" />
<fileset dir="${javadoc}" />
<fileset dir="${javadoc.spec}" />
diff --git a/make/cg-common.cfg b/make/cg-common.cfg
index d0ae8303c..9b8dba079 100644
--- a/make/cg-common.cfg
+++ b/make/cg-common.cfg
@@ -3,8 +3,8 @@
Package com.sun.opengl.cg
JavaClass CgGL
Style AllStatic
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl_cg
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl_cg
HierarchicalNativeOutput false
#
diff --git a/make/cgl-macosx.cfg b/make/cgl-macosx.cfg
index 2b32c6667..780afcf5b 100644
--- a/make/cgl-macosx.cfg
+++ b/make/cgl-macosx.cfg
@@ -1,7 +1,7 @@
# This .cfg file is used to generate the interface to the CGL routines
# used internally by the MacOSXGLContext implementation.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/MacOSX
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/MacOSX
Package com.sun.opengl.impl.macosx.cgl
JavaClass CGL
diff --git a/make/cglext.cfg b/make/cglext.cfg
index ae829c4af..534910bde 100755
--- a/make/cglext.cfg
+++ b/make/cglext.cfg
@@ -3,8 +3,8 @@
# Note that there are currently no such extensions exposed on Mac OS
# X, but if in the future there are, this structure will allow them to
# be easily exposed.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/MacOSX
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/MacOSX
Package com.sun.opengl.impl.macosx.cgl
Style InterfaceAndImpl
diff --git a/make/egl.cfg b/make/egl.cfg
index 223a4f2e7..8ddafc1fd 100755
--- a/make/egl.cfg
+++ b/make/egl.cfg
@@ -1,7 +1,7 @@
# This .cfg file is used to generate the interface to the EGL routines
# used internally by the EGLContext implementation.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/egl
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/egl
Package com.sun.opengl.impl.egl
JavaClass EGL
diff --git a/make/eglext.cfg b/make/eglext.cfg
index a4c85d8c4..54ac07a04 100755
--- a/make/eglext.cfg
+++ b/make/eglext.cfg
@@ -1,7 +1,7 @@
# This .cfg file is used to generate the interface to the EGL routines
# used internally by the EGLContext implementation.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/egl
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/egl
Package com.sun.opengl.impl.egl
Style InterfaceAndImpl
@@ -10,7 +10,7 @@ ImplPackage com.sun.opengl.impl.egl
ImplJavaClass EGLExtImpl
# Shouldn't matter which one of these we pick up
-ExtendedInterfaceSymbols ../build/gensrc/classes/com/sun/opengl/impl/egl/EGL.java
+ExtendedInterfaceSymbols ../build-temp/gensrc/classes/com/sun/opengl/impl/egl/EGL.java
HierarchicalNativeOutput false
Include gl-common.cfg
diff --git a/make/gl-common.cfg b/make/gl-common.cfg
index 8c308a3f7..e76eaba35 100644
--- a/make/gl-common.cfg
+++ b/make/gl-common.cfg
@@ -9,6 +9,8 @@ UnsupportedExceptionType GLUnsupportedException
Import java.nio.*
Import java.util.*
Import javax.media.opengl.*
+Import javax.media.opengl.sub.*
+Import javax.media.opengl.sub.fixed.*
Import com.sun.opengl.impl.*
#####################################################################
diff --git a/make/gl-es1.cfg b/make/gl-es1.cfg
index 047f7a133..89444619b 100755
--- a/make/gl-es1.cfg
+++ b/make/gl-es1.cfg
@@ -1,21 +1,36 @@
# This .cfg file is used to generate the GL interface and implementing class.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/es1
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/es1
-ExtendedInterfaceSymbols ../build/gensrc/classes/javax/media/opengl/GL.java
-ExtendedInterfaceSymbols ../build/gensrc/classes/javax/media/opengl/GL2ES1.java
+ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java
+ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/GLObject.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/fixed/GLMatrixIf.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/fixed/GLPointerIf.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/fixed/GLLightingIf.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/fixed/GLFixedFuncIf.java
# There are a few routines we don't handle yet
Ignore glGetBufferPointervOES
Package javax.media.opengl
Style InterfaceAndImpl
JavaClass GLES1
+Extends GLES1 GLObject
Extends GLES1 GL
Extends GLES1 GL2ES1
+Extends GLES1 GLMatrixIf
+Extends GLES1 GLPointerIf
+Extends GLES1 GLLightingIf
+Extends GLES1 GLFixedFuncIf
ImplPackage com.sun.opengl.impl.es1
ImplJavaClass GLES1Impl
+Implements GLES1Impl GLObject
Implements GLES1Impl GL
Implements GLES1Impl GL2ES1
+Implements GLES1Impl GLMatrixIf
+Implements GLES1Impl GLPointerIf
+Implements GLES1Impl GLLightingIf
+Implements GLES1Impl GLFixedFuncIf
HierarchicalNativeOutput false
Include gl-common.cfg
Include gl-common-extensions.cfg
diff --git a/make/gl-es2.cfg b/make/gl-es2.cfg
index 5ec642865..513d5a099 100755
--- a/make/gl-es2.cfg
+++ b/make/gl-es2.cfg
@@ -1,17 +1,20 @@
# This .cfg file is used to generate the GL interface and implementing class.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/es2
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/es2
-ExtendedInterfaceSymbols ../build/gensrc/classes/javax/media/opengl/GL.java
-ExtendedInterfaceSymbols ../build/gensrc/classes/javax/media/opengl/GL2ES2.java
+ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java
+ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/GLObject.java
Package javax.media.opengl
Style InterfaceAndImpl
JavaClass GLES2
+Extends GLES2 GLObject
Extends GLES2 GL
Extends GLES2 GL2ES2
ImplPackage com.sun.opengl.impl.es2
ImplJavaClass GLES2Impl
+Implements GLES2Impl GLObject
Implements GLES2Impl GL
Implements GLES2Impl GL2ES2
HierarchicalNativeOutput false
@@ -51,15 +54,6 @@ CustomCCode #include <GLES2/gl2ext.h>
CustomCCode #include <stdlib.h>
Include intptr.cfg
-JavaPrologue glEnable glEnablePrologue({0}, true);
-JavaPrologue glDisable glEnablePrologue({0}, false);
-JavaPrologue glDrawArrays glDrawArraysPrologue();
-JavaEpilogue glDrawArrays glDrawArraysEpilogue();
-JavaPrologue glDrawElements glDrawArraysPrologue();
-JavaEpilogue glDrawElements glDrawArraysEpilogue();
-JavaEpilogue glActiveTexture glActiveTextureEpilog({0});
-JavaPrologue glCullFace glCullFacePrologue({0});
-
IncludeAs CustomJavaCode GLES2Impl gl-impl-CustomJavaCode-common.java
IncludeAs CustomJavaCode GLES2Impl gl-impl-CustomJavaCode-gles2.java
IncludeAs CustomJavaCode GLES2Impl gl-impl-CustomJavaCode-gl2_es2.java
@@ -71,7 +65,5 @@ Import javax.media.opengl.GL2
Import javax.media.opengl.GLArrayData
Import javax.media.opengl.GLUniformData
Import javax.media.opengl.util.BufferUtil
-Import javax.media.opengl.util.PMVMatrix
-Import com.sun.opengl.impl.glsl.fixed.FixedFuncPipeline
Import java.io.PrintStream
diff --git a/make/gl-gl2.cfg b/make/gl-gl2.cfg
index de94736cb..14e7f6487 100644
--- a/make/gl-gl2.cfg
+++ b/make/gl-gl2.cfg
@@ -1,22 +1,37 @@
# This .cfg file is used to generate the GL interface and implementing class.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/gl2
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/gl2
-ExtendedInterfaceSymbols ../build/gensrc/classes/javax/media/opengl/GL.java
-ExtendedInterfaceSymbols ../build/gensrc/classes/javax/media/opengl/GL2ES1.java
-ExtendedInterfaceSymbols ../build/gensrc/classes/javax/media/opengl/GL2ES2.java
+ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java
+ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java
+ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/GLObject.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/fixed/GLMatrixIf.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/fixed/GLPointerIf.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/fixed/GLLightingIf.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/fixed/GLFixedFuncIf.java
Package javax.media.opengl
Style InterfaceAndImpl
JavaClass GL2
+Extends GL2 GLObject
Extends GL2 GL
Extends GL2 GL2ES1
Extends GL2 GL2ES2
+Extends GL2 GLMatrixIf
+Extends GL2 GLPointerIf
+Extends GL2 GLLightingIf
+Extends GL2 GLFixedFuncIf
ImplPackage com.sun.opengl.impl.gl2
ImplJavaClass GL2Impl
+Implements GL2Impl GLObject
Implements GL2Impl GL
Implements GL2Impl GL2ES1
Implements GL2Impl GL2ES2
+Implements GL2Impl GLMatrixIf
+Implements GL2Impl GLPointerIf
+Implements GL2Impl GLLightingIf
+Implements GL2Impl GLFixedFuncIf
Include gl-common-gl2.cfg
Include gl-common-extensions.cfg
Include gl-desktop.cfg
@@ -36,6 +51,8 @@ TagNativeBinding true
CustomJavaCode GL2 public static final int GL_STENCIL_INDEX16 = 0x8D49;
CustomJavaCode GL2 public static final int GL_RGBA_FLOAT32_APPLE = 0x8814;
CustomJavaCode GL2 public static final int GL_RGBA_FLOAT16_APPLE = 0x881A;
+CustomJavaCode GL2 public boolean glIsPBOPackEnabled();
+CustomJavaCode GL2 public boolean glIsPBOUnpackEnabled();
CustomJavaCode GL2Impl public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) {
CustomJavaCode GL2Impl glFrustum((double)left, (double)right, (double)bottom, (double)top, (double)zNear, (double)zFar); }
diff --git a/make/gl-gl2es12.cfg b/make/gl-gl2es12.cfg
index fb772b73b..7dcf9462f 100644
--- a/make/gl-gl2es12.cfg
+++ b/make/gl-gl2es12.cfg
@@ -1,10 +1,15 @@
# This .cfg file is used to generate the GL interface and implementing class.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/gl2es12
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/gl2es12
-ExtendedInterfaceSymbolsOnly ../build/gensrc/classes/javax/media/opengl/GL.java
-ExtendedInterfaceSymbolsOnly ../build/gensrc/classes/javax/media/opengl/GL2ES1.java
-ExtendedInterfaceSymbolsOnly ../build/gensrc/classes/javax/media/opengl/GL2ES2.java
+ExtendedInterfaceSymbolsOnly ../build-temp/gensrc/classes/javax/media/opengl/GL.java
+ExtendedInterfaceSymbolsOnly ../build-temp/gensrc/classes/javax/media/opengl/GL2ES1.java
+ExtendedInterfaceSymbolsOnly ../build-temp/gensrc/classes/javax/media/opengl/GL2ES2.java
+ExtendedInterfaceSymbolsOnly ../src/classes/javax/media/opengl/sub/GLObject.java
+ExtendedInterfaceSymbolsOnly ../src/classes/javax/media/opengl/sub/fixed/GLMatrixIf.java
+ExtendedInterfaceSymbolsOnly ../src/classes/javax/media/opengl/sub/fixed/GLPointerIf.java
+ExtendedInterfaceSymbolsOnly ../src/classes/javax/media/opengl/sub/fixed/GLLightingIf.java
+ExtendedInterfaceSymbolsOnly ../src/classes/javax/media/opengl/sub/fixed/GLFixedFuncIf.java
Package javax.media.opengl
Style InterfaceAndImpl
@@ -12,11 +17,21 @@ JavaClass GL2ES12
Extends GL2ES12 GL
Extends GL2ES12 GL2ES1
Extends GL2ES12 GL2ES2
+Extends GL2ES12 GLObject
+Extends GL2ES12 GLMatrixIf
+Extends GL2ES12 GLPointerIf
+Extends GL2ES12 GLLightingIf
+Extends GL2ES12 GLFixedFuncIf
ImplPackage com.sun.opengl.impl.gl2es12
ImplJavaClass GL2ES12Impl
Implements GL2ES12Impl GL
Implements GL2ES12Impl GL2ES1
Implements GL2ES12Impl GL2ES2
+Implements GL2ES12Impl GLObject
+Implements GL2ES12Impl GLMatrixIf
+Implements GL2ES12Impl GLPointerIf
+Implements GL2ES12Impl GLLightingIf
+Implements GL2ES12Impl GLFixedFuncIf
Include gl-common-gl2.cfg
Include gl-common-extensions.cfg
diff --git a/make/gl-if-CustomJavaCode-gl.java b/make/gl-if-CustomJavaCode-gl.java
index acb3f10f5..840c8f61f 100644
--- a/make/gl-if-CustomJavaCode-gl.java
+++ b/make/gl-if-CustomJavaCode-gl.java
@@ -1,124 +1,14 @@
- public static final int GL_LIGHT0 = 0x4000;
- public static final int GL_LIGHT1 = 0x4001;
- public static final int GL_LIGHT2 = 0x4002;
- public static final int GL_LIGHT3 = 0x4003;
- public static final int GL_LIGHT4 = 0x4004;
- public static final int GL_LIGHT5 = 0x4005;
- public static final int GL_LIGHT6 = 0x4006;
- public static final int GL_LIGHT7 = 0x4007;
- public static final int GL_LIGHTING = 0xB50;
- public static final int GL_AMBIENT = 0x1200;
- public static final int GL_DIFFUSE = 0x1201;
- public static final int GL_SPECULAR = 0x1202;
- public static final int GL_POSITION = 0x1203;
- public static final int GL_SPOT_DIRECTION = 0x1204;
- public static final int GL_SPOT_EXPONENT = 0x1205;
- public static final int GL_SPOT_CUTOFF = 0x1206;
- public static final int GL_CONSTANT_ATTENUATION = 0x1207;
- public static final int GL_LINEAR_ATTENUATION = 0x1208;
- public static final int GL_QUADRATIC_ATTENUATION = 0x1209;
- public static final int GL_EMISSION = 0x1600;
- public static final int GL_SHININESS = 0x1601;
- public static final int GL_AMBIENT_AND_DIFFUSE = 0x1602;
- public static final int GL_COLOR_MATERIAL = 0xB57;
- public static final int GL_NORMALIZE = 0xBA1;
-
- public static final int GL_FLAT = 0x1D00;
- public static final int GL_SMOOTH = 0x1D01;
-
- public static final int GL_MODELVIEW = 0x1700;
- public static final int GL_PROJECTION = 0x1701;
-
- public static final int GL_VERTEX_ARRAY = 0x8074;
- public static final int GL_NORMAL_ARRAY = 0x8075;
- public static final int GL_COLOR_ARRAY = 0x8076;
- public static final int GL_TEXTURE_COORD_ARRAY = 0x8078;
-
- public boolean isGL2();
-
- public boolean isGLES1();
-
- public boolean isGLES2();
-
- public boolean isGLES();
-
- public boolean isGL2ES1();
-
- public boolean isGL2ES2();
-
- public GL2 getGL2() throws GLException;
-
- public GLES1 getGLES1() throws GLException;
-
- public GLES2 getGLES2() throws GLException;
-
- public GL2ES1 getGL2ES1() throws GLException;
-
- public GL2ES2 getGL2ES2() throws GLException;
-
public boolean matchesProfile();
public boolean matchesProfile(String test_profile);
- public String toString();
-
- public GLContext getContext();
-
public void glClearDepth( double depth );
public void glDepthRange(double zNear, double zFar);
- public void glPopMatrix();
-
- public void glPushMatrix();
-
- public void glLoadIdentity() ;
-
- public void glLoadMatrixf(java.nio.FloatBuffer m) ;
- public void glLoadMatrixf(float[] m, int m_offset);
-
- public void glMatrixMode(int mode) ;
-
- public void glMultMatrixf(java.nio.FloatBuffer m) ;
- public void glMultMatrixf(float[] m, int m_offset);
-
- public void glTranslatef(float x, float y, float z) ;
-
- public void glRotatef(float angle, float x, float y, float z);
-
- public void glScalef(float x, float y, float z) ;
-
- public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) ;
-
- public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar);
-
- public void glEnableClientState(int arrayName);
- public void glDisableClientState(int arrayName);
-
- public void glVertexPointer(GLArrayData array);
- public void glVertexPointer(int size, int type, int stride, java.nio.Buffer pointer);
- public void glVertexPointer(int size, int type, int stride, long pointer_buffer_offset);
-
- public void glColorPointer(GLArrayData array);
- public void glColorPointer(int size, int type, int stride, java.nio.Buffer pointer);
- public void glColorPointer(int size, int type, int stride, long pointer_buffer_offset);
- public void glColor4f(float red, float green, float blue, float alpha);
-
- public void glNormalPointer(GLArrayData array);
- public void glNormalPointer(int type, int stride, java.nio.Buffer pointer);
- public void glNormalPointer(int type, int stride, long pointer_buffer_offset);
-
- public void glTexCoordPointer(GLArrayData array);
- public void glTexCoordPointer(int size, int type, int stride, java.nio.Buffer pointer);
- public void glTexCoordPointer(int size, int type, int stride, long pointer_buffer_offset);
-
- public void glLightfv(int light, int pname, java.nio.FloatBuffer params);
- public void glLightfv(int light, int pname, float[] params, int params_offset);
- public void glMaterialf(int face, int pname, float param);
- public void glMaterialfv(int face, int pname, java.nio.FloatBuffer params);
- public void glMaterialfv(int face, int pname, float[] params, int params_offset);
+ public int glGetBoundBuffer(int target);
- public void glShadeModel(int mode);
+ public boolean glIsVBOArrayEnabled();
+ public boolean glIsVBOElementEnabled();
- public int glGetBoundBuffer(int target);
diff --git a/make/gl-if-CustomJavaCode-gles2.java b/make/gl-if-CustomJavaCode-gles2.java
index 2b55b7a25..ea40f6329 100644
--- a/make/gl-if-CustomJavaCode-gles2.java
+++ b/make/gl-if-CustomJavaCode-gles2.java
@@ -1,128 +1,3 @@
public static final int GL_NVIDIA_PLATFORM_BINARY_NV = 0x890B;
- /**
- * Emulated FixedFunction matrix bit, enables PVM matrix functionality,
- * referenced below.
- *
- * <br>Enabled by default.
- *
- * @see #enableFixedFunctionEmulationMode
- * @see #disableFixedFunctionEmulationMode
- * @see #getEnabledFixedFunctionEmulationModes
- * @see #GL_MODELVIEW
- * @see #GL_PROJECTION
- * @see #glPopMatrix()
- * @see #glPushMatrix()
- * @see #glLoadIdentity()
- * @see #glLoadMatrixf(java.nio.FloatBuffer)
- * @see #glMatrixMode(int)
- * @see #glMultMatrixf(java.nio.FloatBuffer)
- * @see #glTranslatef(float, float, float)
- * @see #glRotatef(float, float, float, float)
- * @see #glScalef(float, float, float)
- * @see #glOrthof(float, float, float, float, float, float)
- * @see #glFrustumf(float, float, float, float, float, float)
- * @see #glPopMatrix()
- * @see #glPushMatrix()
- * @see #glLoadIdentity()
- * @see #glLoadMatrixf(java.nio.FloatBuffer)
- * @see #glMatrixMode(int)
- * @see #glMultMatrixf(java.nio.FloatBuffer)
- * @see #glTranslatef(float, float, float)
- * @see #glRotatef(float, float, float, float)
- * @see #glScalef(float, float, float)
- * @see #glOrthof(float, float, float, float, float, float)
- * @see #glFrustumf(float, float, float, float, float, float)
- */
- public static final int FIXED_EMULATION_MATRIX = (1 << 0) ;
-
- /**
- * Emulated FixedFunction vertex color bit, enables vertex|color arrays ,
- * referenced below.
- *
- * <br>Disabled by default.
- *
- * @see #enableFixedFunctionEmulationMode
- * @see #disableFixedFunctionEmulationMode
- * @see #getEnabledFixedFunctionEmulationModes
- * @see #GL_VERTEX_ARRAY
- * @see #GL_NORMAL_ARRAY
- * @see #GL_COLOR_ARRAY
- * @see #GL_TEXTURE_COORD_ARRAY
- * @see #glEnableClientState(int);
- * @see #glVertexPointer(int, int, int, Buffer);
- * @see #glVertexPointer(int, int, int, long);
- * @see #glColorPointer(int, int, int, Buffer);
- * @see #glColorPointer(int, int, int, long);
- * @see #glNormalPointer(int, int, int, Buffer);
- * @see #glNormalPointer(int, int, int, long);
- * @see #glTexCoordPointer(int, int, int, Buffer);
- * @see #glTexCoordPointer(int, int, int, long);
- * @see #glDrawArrays(int, int, int);
- */
- public static final int FIXED_EMULATION_VERTEXCOLORTEXTURE = (1 << 1) ;
-
- /**
- * Emulated FixedFunction implementation.
- * @see #disableFixedFunctionEmulationMode
- * @see #getEnabledFixedFunctionEmulationModes
- */
- public void enableFixedFunctionEmulationMode(int mode);
-
- /**
- * Emulated FixedFunction implementation.
- * @see #enableFixedFunctionEmulationMode
- * @see #getEnabledFixedFunctionEmulationModes
- */
- public void disableFixedFunctionEmulationMode(int mode);
-
- /**
- * Emulated FixedFunction matrix implementation.
- * @see #enableFixedFunctionEmulationMode
- */
- public int getEnabledFixedFunctionEmulationModes();
-
- /**
- * Emulated FixedFunction matrix implementation.
- *
- * Fetches the internal matrix of matrixName.
- * @param matrixName GL_MODELVIEW or GL_PROJECTION
- * @see #getEnabledFixedFunctionEmulationModes
- * @see #enableFixedFunctionEmulationMode
- * @see #disableFixedFunctionEmulationMode
- */
- public PMVMatrix getPMVMatrix();
-
- /**
- * Emulated FixedFunction matrix implementation.
- *
- * Fetches the internal matrix of matrixName.
- * @param matrixName GL_MODELVIEW or GL_PROJECTION
- * @see #enableFixedFunctionEmulationMode
- * @see #disableFixedFunctionEmulationMode
- * @see #getEnabledFixedFunctionEmulationModes
- */
- public FloatBuffer glGetMatrixf(int matrixName);
-
- /**
- * Emulated FixedFunction matrix implementation.
- *
- * Fetches the internal matrix of matrixName.
- * @param matrixName GL_MODELVIEW or GL_PROJECTION
- * @see #enableFixedFunctionEmulationMode
- * @see #disableFixedFunctionEmulationMode
- * @see #getEnabledFixedFunctionEmulationModes
- */
- public FloatBuffer glGetMatrixf();
-
- /**
- * Emulated FixedFunction matrix implementation.
- *
- * Fetches the internal matrix of matrixName.
- * @param matrixName GL_MODELVIEW or GL_PROJECTION
- * @see #enableFixedFunctionEmulationMode
- * @see #disableFixedFunctionEmulationMode
- * @see #getEnabledFixedFunctionEmulationModes
- */
- public int glGetMatrixMode();
diff --git a/make/gl-if-gl.cfg b/make/gl-if-gl.cfg
index 9696360d2..201ef32bb 100755
--- a/make/gl-if-gl.cfg
+++ b/make/gl-if-gl.cfg
@@ -2,14 +2,17 @@
Package javax.media.opengl
Style InterfaceOnly
JavaClass GL
+Extends GL GLObject
+
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/GLObject.java
HierarchicalNativeOutput false
Include gl-common.cfg
Include gl-common-extensions.cfg
Include gl-ignore-gl2_es12-special.cfg
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl
Import javax.media.opengl.GLES1
Import javax.media.opengl.GLES2
diff --git a/make/gl-if-gl2_es1.cfg b/make/gl-if-gl2_es1.cfg
index 0d477a275..d793038fd 100755
--- a/make/gl-if-gl2_es1.cfg
+++ b/make/gl-if-gl2_es1.cfg
@@ -2,16 +2,26 @@
Package javax.media.opengl
Style InterfaceOnly
JavaClass GL2ES1
+Extends GL2ES1 GLObject
Extends GL2ES1 GL
+Extends GL2ES1 GLMatrixIf
+Extends GL2ES1 GLPointerIf
+Extends GL2ES1 GLLightingIf
+Extends GL2ES1 GLFixedFuncIf
-ExtendedInterfaceSymbols ../build/gensrc/classes/javax/media/opengl/GL.java
+ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/GLObject.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/fixed/GLMatrixIf.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/fixed/GLPointerIf.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/fixed/GLLightingIf.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/fixed/GLFixedFuncIf.java
HierarchicalNativeOutput false
Include gl-common.cfg
Include gl-common-extensions.cfg
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl
# Ignore all ES 1.X only stuff to GL2
Ignore glPointSizePointer
diff --git a/make/gl-if-gl2_es2.cfg b/make/gl-if-gl2_es2.cfg
index b8fa3f8c6..31cadb56f 100755
--- a/make/gl-if-gl2_es2.cfg
+++ b/make/gl-if-gl2_es2.cfg
@@ -2,15 +2,17 @@
Package javax.media.opengl
Style InterfaceOnly
JavaClass GL2ES2
+Extends GL2ES2 GLObject
Extends GL2ES2 GL
-ExtendedInterfaceSymbols ../build/gensrc/classes/javax/media/opengl/GL.java
+ExtendedInterfaceSymbols ../build-temp/gensrc/classes/javax/media/opengl/GL.java
+ExtendedInterfaceSymbols ../src/classes/javax/media/opengl/sub/GLObject.java
HierarchicalNativeOutput false
Include gl-common.cfg
Include gl-common-extensions.cfg
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl
# Ignore all ES 2.X only stuff ..
# Ignore ^gl.*x(v)?(OES)?
@@ -51,12 +53,6 @@ CustomJavaCode GL2ES2 public Set glGetShaderBinaryFormats();
CustomJavaCode GL2ES2 public void glShaderBinary(IntBuffer shaders, int binFormat, java.nio.Buffer bin);
CustomJavaCode GL2ES2 public void glCreateShader(int type, IntBuffer shaders);
CustomJavaCode GL2ES2 public void glCompileShader(IntBuffer shaders);
-CustomJavaCode GL2ES2 public boolean glCreateLoadShader(IntBuffer shader, int shaderType,
-CustomJavaCode GL2ES2 int binFormat, java.nio.Buffer bin,
-CustomJavaCode GL2ES2 PrintStream verboseOut);
-CustomJavaCode GL2ES2 public boolean glCreateCompileShader(IntBuffer shader, int shaderType,
-CustomJavaCode GL2ES2 java.lang.String[][] sources,
-CustomJavaCode GL2ES2 PrintStream verboseOut);
CustomJavaCode GL2ES2 public void glAttachShader(int program, IntBuffer shaders);
CustomJavaCode GL2ES2 public void glDetachShader(int program, IntBuffer shaders);
CustomJavaCode GL2ES2 public void glDeleteShader(IntBuffer shaders);
diff --git a/make/gl-ignore-gl2_es12-special.cfg b/make/gl-ignore-gl2_es12-special.cfg
index f93aec14e..75eeb140b 100644
--- a/make/gl-ignore-gl2_es12-special.cfg
+++ b/make/gl-ignore-gl2_es12-special.cfg
@@ -12,8 +12,8 @@ Ignore GL_ALPHA_SCALE
Ignore GL_ALPHA_TEST
Ignore GL_ALPHA_TEST_FUNC
Ignore GL_ALPHA_TEST_REF
-#Ignore GL_AMBIENT
-#Ignore GL_AMBIENT_AND_DIFFUSE
+Ignore GL_AMBIENT
+Ignore GL_AMBIENT_AND_DIFFUSE
Ignore GL_AND
Ignore GL_AND_INVERTED
Ignore GL_AND_REVERSE
@@ -53,14 +53,14 @@ Ignore GL_COLOR_ARRAY_SIZE
Ignore GL_COLOR_ARRAY_STRIDE
Ignore GL_COLOR_ARRAY_TYPE
Ignore GL_COLOR_LOGIC_OP
-#Ignore GL_COLOR_MATERIAL
+Ignore GL_COLOR_MATERIAL
Ignore GL_COMBINE
Ignore GL_COMBINE_ALPHA
Ignore GL_COMBINE_RGB
Ignore GL_COMPILE_STATUS
Ignore GL_CONSTANT
Ignore GL_CONSTANT_ALPHA
-#Ignore GL_CONSTANT_ATTENUATION
+Ignore GL_CONSTANT_ATTENUATION
Ignore GL_CONSTANT_COLOR
Ignore GL_COORD_REPLACE_OES
Ignore GL_COPY
@@ -78,10 +78,10 @@ Ignore GL_DELETE_STATUS
Ignore GL_DEPTH_COMPONENT
Ignore GL_DEPTH_COMPONENT24_OES
Ignore GL_DEPTH_COMPONENT32_OES
-#Ignore GL_DIFFUSE
+Ignore GL_DIFFUSE
Ignore GL_DOT3_RGB
Ignore GL_DOT3_RGBA
-#Ignore GL_EMISSION
+Ignore GL_EMISSION
Ignore GL_EQUIV
Ignore GL_ES_VERSION_2_0
Ignore GL_ETC1_RGB8_OES
@@ -89,7 +89,7 @@ Ignore GL_EXP
Ignore GL_EXP2
#Ignore GL_FIXED_OES
#Ignore GL_FIXED
-#Ignore GL_FLAT
+Ignore GL_FLAT
Ignore GL_FLOAT_MAT2
Ignore GL_FLOAT_MAT3
Ignore GL_FLOAT_MAT4
@@ -127,18 +127,18 @@ Ignore GL_INTERPOLATE
Ignore GL_INT_VEC2
Ignore GL_INT_VEC3
Ignore GL_INT_VEC4
-#Ignore GL_LIGHT0
-#Ignore GL_LIGHT1
-#Ignore GL_LIGHT2
-#Ignore GL_LIGHT3
-#Ignore GL_LIGHT4
-#Ignore GL_LIGHT5
-#Ignore GL_LIGHT6
-#Ignore GL_LIGHT7
-#Ignore GL_LIGHTING
+Ignore GL_LIGHT0
+Ignore GL_LIGHT1
+Ignore GL_LIGHT2
+Ignore GL_LIGHT3
+Ignore GL_LIGHT4
+Ignore GL_LIGHT5
+Ignore GL_LIGHT6
+Ignore GL_LIGHT7
+Ignore GL_LIGHTING
Ignore GL_LIGHT_MODEL_AMBIENT
Ignore GL_LIGHT_MODEL_TWO_SIDE
-#Ignore GL_LINEAR_ATTENUATION
+Ignore GL_LINEAR_ATTENUATION
Ignore GL_LINE_SMOOTH
Ignore GL_LINE_SMOOTH_HINT
Ignore GL_LINK_STATUS
@@ -187,7 +187,7 @@ Ignore GL_NORMAL_ARRAY_BUFFER_BINDING
Ignore GL_NORMAL_ARRAY_POINTER
Ignore GL_NORMAL_ARRAY_STRIDE
Ignore GL_NORMAL_ARRAY_TYPE
-#Ignore GL_NORMALIZE
+Ignore GL_NORMALIZE
Ignore GL_NORMAL_MAP_OES
Ignore GL_NUM_SHADER_BINARY_FORMATS
Ignore GL_OES_blend_equation_separate
@@ -256,14 +256,14 @@ Ignore GL_POINT_SIZE_MIN
Ignore GL_POINT_SMOOTH
Ignore GL_POINT_SMOOTH_HINT
Ignore GL_POINT_SPRITE_OES
-#Ignore GL_POSITION
+Ignore GL_POSITION
Ignore GL_PREVIOUS
Ignore GL_PRIMARY_COLOR
Ignore GL_PROJECTION
Ignore GL_PROJECTION_MATRIX
Ignore GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES
Ignore GL_PROJECTION_STACK_DEPTH
-#Ignore GL_QUADRATIC_ATTENUATION
+Ignore GL_QUADRATIC_ATTENUATION
Ignore GL_R11F_G11F_B10F_EXT
Ignore GL_REFLECTION_MAP_OES
Ignore GL_RESCALE_NORMAL
@@ -280,14 +280,14 @@ Ignore GL_SHADER_COMPILER
Ignore GL_SHADER_SOURCE_LENGTH
Ignore GL_SHADER_TYPE
Ignore GL_SHADING_LANGUAGE_VERSION
-#Ignore GL_SHININESS
-#Ignore GL_SMOOTH
+Ignore GL_SHININESS
+Ignore GL_SMOOTH
Ignore GL_SMOOTH_LINE_WIDTH_RANGE
Ignore GL_SMOOTH_POINT_SIZE_RANGE
-#Ignore GL_SPECULAR
-#Ignore GL_SPOT_CUTOFF
-#Ignore GL_SPOT_DIRECTION
-#Ignore GL_SPOT_EXPONENT
+Ignore GL_SPECULAR
+Ignore GL_SPOT_CUTOFF
+Ignore GL_SPOT_DIRECTION
+Ignore GL_SPOT_EXPONENT
Ignore GL_SRC0_ALPHA
Ignore GL_SRC0_RGB
Ignore GL_SRC1_ALPHA
@@ -373,9 +373,9 @@ Ignore glClearDepthfOES
Ignore glClientActiveTexture
Ignore glClipPlanef
Ignore glClipPlanefOES
-#Ignore glColor4f
+Ignore glColor4f
Ignore glColor4ub
-#Ignore glColorPointer
+Ignore glColorPointer
Ignore glCompileShader
Ignore glCoverageMaskNV
Ignore glCoverageOperationNV
@@ -383,7 +383,7 @@ Ignore glDeleteProgram
Ignore glDeleteShader
Ignore glDepthRangefOES
Ignore glDetachShader
-#Ignore glDisableClientState
+Ignore glDisableClientState
Ignore glDisableVertexAttribArray
Ignore glDrawTexfOES
Ignore glDrawTexfvOES
@@ -392,7 +392,7 @@ Ignore glDrawTexivOES
Ignore glDrawTexsOES
Ignore glDrawTexsvOES
Ignore glDrawTexxvOES
-#Ignore glEnableClientState
+Ignore glEnableClientState
Ignore glEnableVertexAttribArray
Ignore glFogf
Ignore glFogfv
@@ -436,7 +436,7 @@ Ignore glGetUniformiv
Ignore glGetVertexAttribfv
Ignore glGetVertexAttribiv
Ignore glLightf
-#Ignore glLightfv
+Ignore glLightfv
Ignore glLightModelf
Ignore glLightModelfv
Ignore glLightModelxv
@@ -444,20 +444,20 @@ Ignore glLightModelxvOES
Ignore glLightxv
Ignore glLightxvOES
Ignore glLinkProgram
-#Ignore glLoadIdentity
-#Ignore glLoadMatrixf
+Ignore glLoadIdentity
+Ignore glLoadMatrixf
Ignore glLogicOp
-#Ignore glMaterialf
-#Ignore glMaterialfv
+Ignore glMaterialf
+Ignore glMaterialfv
Ignore glMaterialxv
Ignore glMaterialxvOES
Ignore glMatrixIndexPointerOES
-#Ignore glMatrixMode
+Ignore glMatrixMode
Ignore glMultiTexCoord4f
-#Ignore glMultMatrixf
+Ignore glMultMatrixf
Ignore glNormal3f
-#Ignore glNormalPointer
-#Ignore glOrthof
+Ignore glNormalPointer
+Ignore glOrthof
Ignore glOrthofOES
Ignore glPointParameterf
Ignore glPointParameterfv
@@ -467,14 +467,14 @@ Ignore glPointSize
Ignore glPointSizePointer
Ignore glReleaseShaderCompiler
Ignore glRotatef
-#Ignore glScalef
-#Ignore glShadeModel
+Ignore glScalef
+Ignore glShadeModel
Ignore glShaderBinary
Ignore glShaderSource
Ignore glStencilFuncSeparate
Ignore glStencilMaskSeparate
Ignore glStencilOpSeparate
-#Ignore glTexCoordPointer
+Ignore glTexCoordPointer
Ignore glTexEnvf
Ignore glTexEnvfv
Ignore glTexEnvi
@@ -488,7 +488,7 @@ Ignore glTexGenivOES
Ignore glTexGenxvOES
Ignore glTexParameterxv
Ignore glTexParameterxvOES
-#Ignore glTranslatef
+Ignore glTranslatef
Ignore glUniform1f
Ignore glUniform1fv
Ignore glUniform1i
@@ -519,5 +519,5 @@ Ignore glVertexAttrib3fv
Ignore glVertexAttrib4f
Ignore glVertexAttrib4fv
Ignore glVertexAttribPointer
-#Ignore glVertexPointer
+Ignore glVertexPointer
Ignore glWeightPointerOES
diff --git a/make/gl-impl-CustomJavaCode-common.java b/make/gl-impl-CustomJavaCode-common.java
index 930f976ce..70413a630 100644
--- a/make/gl-impl-CustomJavaCode-common.java
+++ b/make/gl-impl-CustomJavaCode-common.java
@@ -22,3 +22,11 @@
return bufferStateTracker.getBoundBufferObject(target, this);
}
+ public boolean glIsVBOArrayEnabled() {
+ return checkArrayVBOEnabled(false);
+ }
+
+ public boolean glIsVBOElementEnabled() {
+ return checkElementVBOEnabled(false);
+ }
+
diff --git a/make/gl-impl-CustomJavaCode-gl2.java b/make/gl-impl-CustomJavaCode-gl2.java
index d9111f6b1..0d2f6676a 100644
--- a/make/gl-impl-CustomJavaCode-gl2.java
+++ b/make/gl-impl-CustomJavaCode-gl2.java
@@ -20,6 +20,10 @@ public GL2Impl(GLContextImpl context) {
this.bufferSizeTracker = context.getBufferSizeTracker();
}
+public final boolean isGL() {
+ return true;
+}
+
public final boolean isGL2() {
return true;
}
@@ -44,6 +48,10 @@ public final boolean isGL2ES2() {
return true;
}
+public final GL getGL() throws GLException {
+ return this;
+}
+
public final GL2 getGL2() throws GLException {
return this;
}
@@ -219,111 +227,129 @@ private void initBufferObjectExtensionChecks() {
haveARBVertexBufferObject = isExtensionAvailable("GL_ARB_vertex_buffer_object");
}
-private void checkBufferObject(boolean extension1,
- boolean extension2,
- boolean extension3,
- boolean enabled,
- int state,
- String kind) {
+private boolean checkBufferObject(boolean extension1,
+ boolean extension2,
+ boolean extension3,
+ boolean enabled,
+ int state,
+ String kind, boolean throwException) {
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 GLUnsupportedException("Required extensions not available to call this function");
+ return true;
+ if(throwException) {
+ throw new GLUnsupportedException("Required extensions not available to call this function");
+ }
+ return false;
}
int buffer = bufferStateTracker.getBoundBufferObject(state, this);
if (enabled) {
if (buffer == 0) {
- throw new GLException(kind + " must be enabled to call this method");
+ if(throwException) {
+ throw new GLException(kind + " must be enabled to call this method");
+ }
+ return false;
}
} else {
if (buffer != 0) {
- throw new GLException(kind + " must be disabled to call this method");
+ if(throwException) {
+ throw new GLException(kind + " must be disabled to call this method");
+ }
+ return false;
}
}
+ return true;
}
-private void checkArrayVBODisabled() {
+private boolean checkArrayVBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveGL15,
+ return checkBufferObject(haveGL15,
haveARBVertexBufferObject,
false,
false,
GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object");
+ "array vertex_buffer_object", throwException);
}
-private void checkArrayVBOEnabled() {
+private boolean checkArrayVBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveGL15,
+ return checkBufferObject(haveGL15,
haveARBVertexBufferObject,
false,
true,
GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object");
+ "array vertex_buffer_object", throwException);
}
-private void checkElementVBODisabled() {
+private boolean checkElementVBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveGL15,
+ return checkBufferObject(haveGL15,
haveARBVertexBufferObject,
false,
false,
GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object");
+ "element vertex_buffer_object", throwException);
}
-private void checkElementVBOEnabled() {
+private boolean checkElementVBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveGL15,
+ return checkBufferObject(haveGL15,
haveARBVertexBufferObject,
false,
true,
GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object");
+ "element vertex_buffer_object", throwException);
}
-private void checkUnpackPBODisabled() {
+private boolean checkUnpackPBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveARBPixelBufferObject,
+ return checkBufferObject(haveARBPixelBufferObject,
haveEXTPixelBufferObject,
haveGL21,
false,
GL2.GL_PIXEL_UNPACK_BUFFER,
- "unpack pixel_buffer_object");
+ "unpack pixel_buffer_object", throwException);
}
-private void checkUnpackPBOEnabled() {
+private boolean checkUnpackPBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveARBPixelBufferObject,
+ return checkBufferObject(haveARBPixelBufferObject,
haveEXTPixelBufferObject,
haveGL21,
true,
GL2.GL_PIXEL_UNPACK_BUFFER,
- "unpack pixel_buffer_object");
+ "unpack pixel_buffer_object", throwException);
}
-private void checkPackPBODisabled() {
+private boolean checkPackPBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveARBPixelBufferObject,
+ return checkBufferObject(haveARBPixelBufferObject,
haveEXTPixelBufferObject,
haveGL21,
false,
GL2.GL_PIXEL_PACK_BUFFER,
- "pack pixel_buffer_object");
+ "pack pixel_buffer_object", throwException);
}
-private void checkPackPBOEnabled() {
+private boolean checkPackPBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveARBPixelBufferObject,
+ return checkBufferObject(haveARBPixelBufferObject,
haveEXTPixelBufferObject,
haveGL21,
true,
GL2.GL_PIXEL_PACK_BUFFER,
- "pack pixel_buffer_object");
+ "pack pixel_buffer_object", throwException);
+}
+
+public boolean glIsPBOPackEnabled() {
+ return checkPackPBOEnabled(false);
+}
+
+public boolean glIsPBOUnpackEnabled() {
+ return checkUnpackPBOEnabled(false);
}
// Attempt to return the same ByteBuffer object from glMapBuffer if
@@ -395,33 +421,6 @@ native private long dispatch_glMapBuffer(int target, int access, long glProcAddr
// nothing to do
}
- public final String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("GL: ");
- buf.append(getClass().getName());
- buf.append(" (GLSL compiler: ");
- buf.append(glShaderCompilerAvailable());
- Set bfs = glGetShaderBinaryFormats();
- buf.append(", binary formats ");
- buf.append(bfs.size());
- buf.append(":");
- for(Iterator iter=bfs.iterator(); iter.hasNext(); ) {
- buf.append(" ");
- buf.append(((Integer)(iter.next())).intValue());
- }
- buf.append(") (GLContext: ");
- GLContext context = getContext();
- buf.append(context.getClass().getName());
- buf.append(", GLDrawable: ");
- GLDrawable drawable = context.getGLDrawable();
- buf.append(drawable.getClass().getName());
- buf.append(", Factory: ");
- GLDrawableFactory factory = drawable.getFactory();
- buf.append(factory.getClass().getName());
- buf.append(")");
- return buf.toString();
- }
-
public void glVertexPointer(GLArrayData array) {
if(array.getComponentNumber()==0) return;
if(array.isVBO()) {
diff --git a/make/gl-impl-CustomJavaCode-gl2_es2.java b/make/gl-impl-CustomJavaCode-gl2_es2.java
index ff1360aeb..855d1577d 100644
--- a/make/gl-impl-CustomJavaCode-gl2_es2.java
+++ b/make/gl-impl-CustomJavaCode-gl2_es2.java
@@ -205,35 +205,6 @@
shaders.rewind();
}
- public boolean glCreateLoadShader(IntBuffer shader, int shaderType,
- int binFormat, java.nio.Buffer bin,
- PrintStream verboseOut)
- {
- glGetError(); // flush previous errors ..
-
- glCreateShader(shaderType, shader);
-
- glShaderBinary(shader, binFormat, bin);
-
- return glGetError() == GL.GL_NO_ERROR;
- }
-
- public boolean glCreateCompileShader(IntBuffer shader, int shaderType,
- java.lang.String[][] sources,
- PrintStream verboseOut)
- {
- glGetError(); // flush previous errors ..
-
- glCreateShader(shaderType, shader);
-
- glShaderSource(shader, sources);
-
- glCompileShader(shader);
-
- return glIsShaderStatusValid(shader, GL_COMPILE_STATUS, verboseOut) &&
- glGetError() == GL.GL_NO_ERROR;
- }
-
public void glAttachShader(int program, IntBuffer shaders)
{
shaders.rewind();
@@ -321,3 +292,35 @@
}
}
+ public final String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("GL: ");
+ buf.append(getClass().getName());
+ buf.append(" (GLSL compiler: ");
+ buf.append(glShaderCompilerAvailable());
+ Set bfs = glGetShaderBinaryFormats();
+ buf.append(", binary formats ");
+ buf.append(bfs.size());
+ buf.append(":");
+ for(Iterator iter=bfs.iterator(); iter.hasNext(); ) {
+ buf.append(" ");
+ buf.append(((Integer)(iter.next())).intValue());
+ }
+ buf.append(") (GLContext: ");
+ GLContext context = getContext();
+ buf.append(context.getClass().getName());
+ buf.append(", GLDrawable: ");
+ GLDrawable drawable = context.getGLDrawable();
+ if(null!=drawable) {
+ buf.append(drawable.getClass().getName());
+ buf.append(", Factory: ");
+ GLDrawableFactory factory = drawable.getFactory();
+ buf.append(factory.getClass().getName());
+ } else {
+ buf.append("n/a");
+ }
+ buf.append(")");
+ return buf.toString();
+ }
+
+
diff --git a/make/gl-impl-CustomJavaCode-gl2es12.java b/make/gl-impl-CustomJavaCode-gl2es12.java
index 0eff40f08..5ce76186e 100644
--- a/make/gl-impl-CustomJavaCode-gl2es12.java
+++ b/make/gl-impl-CustomJavaCode-gl2es12.java
@@ -20,6 +20,10 @@ public GL2ES12Impl(GLContextImpl context) {
this.bufferSizeTracker = context.getBufferSizeTracker();
}
+public final boolean isGL() {
+ return false;
+}
+
public final boolean isGL2() {
return false;
}
@@ -44,6 +48,10 @@ public final boolean isGL2ES2() {
return true;
}
+public final GL getGL() throws GLException {
+ return this;
+}
+
public final GL2 getGL2() throws GLException {
throw new GLException("Not a GL2 implementation");
}
@@ -174,8 +182,6 @@ private GLBufferStateTracker bufferStateTracker = new GLBufferStateTracker();
private GLBufferSizeTracker bufferSizeTracker;
private boolean bufferObjectExtensionsInitialized = false;
-private boolean haveARBPixelBufferObject;
-private boolean haveEXTPixelBufferObject;
private boolean haveGL15;
private boolean haveGL21;
private boolean haveARBVertexBufferObject;
@@ -184,118 +190,106 @@ 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) {
+private boolean checkBufferObject(boolean extension1,
+ boolean extension2,
+ boolean extension3,
+ boolean enabled,
+ int state,
+ String kind, boolean throwException) {
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 GLUnsupportedException("Required extensions not available to call this function");
+ return true;
+ if(throwException) {
+ throw new GLUnsupportedException("Required extensions not available to call this function");
+ }
+ return false;
}
int buffer = bufferStateTracker.getBoundBufferObject(state, this);
if (enabled) {
if (buffer == 0) {
- throw new GLException(kind + " must be enabled to call this method");
+ if(throwException) {
+ throw new GLException(kind + " must be enabled to call this method");
+ }
+ return false;
}
} else {
if (buffer != 0) {
- throw new GLException(kind + " must be disabled to call this method");
+ if(throwException) {
+ throw new GLException(kind + " must be disabled to call this method");
+ }
+ return false;
}
}
+ return true;
}
-private void checkArrayVBODisabled() {
+private boolean checkArrayVBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveGL15,
+ return checkBufferObject(haveGL15,
haveARBVertexBufferObject,
false,
false,
GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object");
+ "array vertex_buffer_object", throwException);
}
-private void checkArrayVBOEnabled() {
+private boolean checkArrayVBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveGL15,
+ return checkBufferObject(haveGL15,
haveARBVertexBufferObject,
false,
true,
GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object");
+ "array vertex_buffer_object", throwException);
}
-private void checkElementVBODisabled() {
+private boolean checkElementVBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveGL15,
+ return checkBufferObject(haveGL15,
haveARBVertexBufferObject,
false,
false,
GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object");
+ "element vertex_buffer_object", throwException);
}
-private void checkElementVBOEnabled() {
+private boolean checkElementVBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(haveGL15,
+ return checkBufferObject(haveGL15,
haveARBVertexBufferObject,
false,
true,
GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object");
+ "element vertex_buffer_object", throwException);
}
-private void checkUnpackPBODisabled() {
- initBufferObjectExtensionChecks();
- checkBufferObject(haveARBPixelBufferObject,
- haveEXTPixelBufferObject,
- haveGL21,
- false,
- GL2.GL_PIXEL_UNPACK_BUFFER,
- "unpack pixel_buffer_object");
+private boolean checkUnpackPBODisabled(boolean throwException) {
+ // PBO n/a for ES 1.1 or ES 2.0
+ return true;
}
-private void checkUnpackPBOEnabled() {
- initBufferObjectExtensionChecks();
- checkBufferObject(haveARBPixelBufferObject,
- haveEXTPixelBufferObject,
- haveGL21,
- true,
- GL2.GL_PIXEL_UNPACK_BUFFER,
- "unpack pixel_buffer_object");
+private boolean checkUnpackPBOEnabled(boolean throwException) {
+ // PBO n/a for ES 1.1 or ES 2.0
+ return false;
}
-private void checkPackPBODisabled() {
- initBufferObjectExtensionChecks();
- checkBufferObject(haveARBPixelBufferObject,
- haveEXTPixelBufferObject,
- haveGL21,
- false,
- GL2.GL_PIXEL_PACK_BUFFER,
- "pack pixel_buffer_object");
+private boolean checkPackPBODisabled(boolean throwException) {
+ // PBO n/a for ES 1.1 or ES 2.0
+ return true;
}
-private void checkPackPBOEnabled() {
- initBufferObjectExtensionChecks();
- checkBufferObject(haveARBPixelBufferObject,
- haveEXTPixelBufferObject,
- haveGL21,
- true,
- GL2.GL_PIXEL_PACK_BUFFER,
- "pack pixel_buffer_object");
+private boolean checkPackPBOEnabled(boolean throwException) {
+ // PBO n/a for ES 1.1 or ES 2.0
+ return false;
}
// Attempt to return the same ByteBuffer object from glMapBuffer if
@@ -367,33 +361,6 @@ native private long dispatch_glMapBuffer(int target, int access, long glProcAddr
// nothing to do
}
- public final String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("GL: ");
- buf.append(getClass().getName());
- buf.append(" (GLSL compiler: ");
- buf.append(glShaderCompilerAvailable());
- Set bfs = glGetShaderBinaryFormats();
- buf.append(", binary formats ");
- buf.append(bfs.size());
- buf.append(":");
- for(Iterator iter=bfs.iterator(); iter.hasNext(); ) {
- buf.append(" ");
- buf.append(((Integer)(iter.next())).intValue());
- }
- buf.append(") (GLContext: ");
- GLContext context = getContext();
- buf.append(context.getClass().getName());
- buf.append(", GLDrawable: ");
- GLDrawable drawable = context.getGLDrawable();
- buf.append(drawable.getClass().getName());
- buf.append(", Factory: ");
- GLDrawableFactory factory = drawable.getFactory();
- buf.append(factory.getClass().getName());
- buf.append(")");
- return buf.toString();
- }
-
public void glVertexPointer(GLArrayData array) {
if(array.getComponentNumber()==0) return;
if(array.isVBO()) {
diff --git a/make/gl-impl-CustomJavaCode-gles1.java b/make/gl-impl-CustomJavaCode-gles1.java
index b2c078518..8057262f9 100755
--- a/make/gl-impl-CustomJavaCode-gles1.java
+++ b/make/gl-impl-CustomJavaCode-gles1.java
@@ -3,6 +3,10 @@ public GLES1Impl(GLContextImpl context) {
this.bufferSizeTracker = context.getBufferSizeTracker();
}
+public final boolean isGL() {
+ return true;
+}
+
public final boolean isGL2() {
return false;
}
@@ -27,6 +31,10 @@ public final boolean isGL2ES2() {
return false;
}
+public final GL getGL() throws GLException {
+ return this;
+}
+
public final GL2 getGL2() throws GLException {
throw new GLException("Not a GL2 implementation");
}
@@ -148,99 +156,95 @@ private GLBufferSizeTracker bufferSizeTracker;
private boolean bufferObjectExtensionsInitialized = false;
private boolean haveOESFramebufferObject;
-private boolean haveOESPixelBufferObject;
private void initBufferObjectExtensionChecks() {
if (bufferObjectExtensionsInitialized)
return;
bufferObjectExtensionsInitialized = true;
haveOESFramebufferObject = isExtensionAvailable("GL_OES_framebuffer_object");
- haveOESPixelBufferObject = false; // FIXME: can't find it in ES 1.1 or ES 2.0 spec
}
-private void checkBufferObject(boolean avail,
- boolean enabled,
- int state,
- String kind) {
+private boolean checkBufferObject(boolean avail,
+ boolean enabled,
+ int state,
+ String kind, boolean throwException) {
if (!avail) {
if (!enabled)
- return;
- throw new GLUnsupportedException("Required extensions not available to call this function");
+ return true;
+ if(throwException) {
+ throw new GLUnsupportedException("Required extensions not available to call this function");
+ }
+ return false;
}
int buffer = bufferStateTracker.getBoundBufferObject(state, this);
if (enabled) {
if (buffer == 0) {
- throw new GLException(kind + " must be enabled to call this method");
+ if(throwException) {
+ throw new GLException(kind + " must be enabled to call this method");
+ }
+ return false;
}
} else {
if (buffer != 0) {
- throw new GLException(kind + " must be disabled to call this method");
+ if(throwException) {
+ throw new GLException(kind + " must be disabled to call this method");
+ }
+ return false;
}
}
+ return true;
}
-private void checkArrayVBODisabled() {
+private boolean checkArrayVBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(true,
+ return checkBufferObject(true,
false,
GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object");
+ "array vertex_buffer_object", throwException);
}
-private void checkArrayVBOEnabled() {
+private boolean checkArrayVBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(true,
+ return checkBufferObject(true,
true,
GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object");
+ "array vertex_buffer_object", throwException);
}
-private void checkElementVBODisabled() {
+private boolean checkElementVBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(true,
+ return checkBufferObject(true,
false,
GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object");
+ "element vertex_buffer_object", throwException);
}
-private void checkElementVBOEnabled() {
+private boolean checkElementVBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(true,
+ return checkBufferObject(true,
true,
GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object");
+ "element vertex_buffer_object", throwException);
}
-private void checkUnpackPBODisabled() {
- initBufferObjectExtensionChecks();
- checkBufferObject(haveOESPixelBufferObject,
- false,
- GL2.GL_PIXEL_UNPACK_BUFFER,
- "unpack pixel_buffer_object");
+private boolean checkUnpackPBODisabled(boolean throwException) {
+ // PBO n/a for ES 1.1 or ES 2.0
+ return true;
}
-private void checkUnpackPBOEnabled() {
- initBufferObjectExtensionChecks();
- checkBufferObject(haveOESPixelBufferObject,
- true,
- GL2.GL_PIXEL_UNPACK_BUFFER,
- "unpack pixel_buffer_object");
+private boolean checkUnpackPBOEnabled(boolean throwException) {
+ // PBO n/a for ES 1.1 or ES 2.0
+ return false;
}
-private void checkPackPBODisabled() {
- initBufferObjectExtensionChecks();
- checkBufferObject(haveOESPixelBufferObject,
- false,
- GL2.GL_PIXEL_PACK_BUFFER,
- "pack pixel_buffer_object");
+private boolean checkPackPBODisabled(boolean throwException) {
+ // PBO n/a for ES 1.1 or ES 2.0
+ return true;
}
-private void checkPackPBOEnabled() {
- initBufferObjectExtensionChecks();
- checkBufferObject(haveOESPixelBufferObject,
- true,
- GL2.GL_PIXEL_PACK_BUFFER,
- "pack pixel_buffer_object");
+private boolean checkPackPBOEnabled(boolean throwException) {
+ // PBO n/a for ES 1.1 or ES 2.0
+ return false;
}
// Attempt to return the same ByteBuffer object from glMapBufferARB if
@@ -307,10 +311,14 @@ native private long dispatch_glMapBuffer(int target, int access, long glProcAddr
buf.append(context.getClass().getName());
buf.append(", GLDrawable: ");
GLDrawable drawable = context.getGLDrawable();
- buf.append(drawable.getClass().getName());
- buf.append(", Factory: ");
- GLDrawableFactory factory = drawable.getFactory();
- buf.append(factory.getClass().getName());
+ if(null!=drawable) {
+ buf.append(drawable.getClass().getName());
+ buf.append(", Factory: ");
+ GLDrawableFactory factory = drawable.getFactory();
+ buf.append(factory.getClass().getName());
+ } else {
+ buf.append("n/a");
+ }
buf.append(")");
return buf.toString();
}
diff --git a/make/gl-impl-CustomJavaCode-gles2.java b/make/gl-impl-CustomJavaCode-gles2.java
index 33caa19b0..a5923bd3b 100755
--- a/make/gl-impl-CustomJavaCode-gles2.java
+++ b/make/gl-impl-CustomJavaCode-gles2.java
@@ -5,9 +5,12 @@ private boolean inBeginEndPair;
public GLES2Impl(GLContextImpl context) {
this._context = context;
this.bufferSizeTracker = context.getBufferSizeTracker();
- this.enableFixedFunctionEmulationMode(FIXED_EMULATION_MATRIX);
}
+public final boolean isGL() {
+ return true;
+}
+
public final boolean isGL2() {
return false;
}
@@ -32,6 +35,10 @@ public final boolean isGL2ES2() {
return true;
}
+public final GL getGL() throws GLException {
+ return this;
+}
+
public final GL2 getGL2() throws GLException {
throw new GLException("Not a GL2 implementation");
}
@@ -159,99 +166,95 @@ private GLBufferSizeTracker bufferSizeTracker;
private boolean bufferObjectExtensionsInitialized = false;
private boolean haveOESFramebufferObject;
-private boolean haveOESPixelBufferObject;
private void initBufferObjectExtensionChecks() {
if (bufferObjectExtensionsInitialized)
return;
bufferObjectExtensionsInitialized = true;
haveOESFramebufferObject = isExtensionAvailable("GL_OES_framebuffer_object");
- haveOESPixelBufferObject = false; // FIXME: can't find it in ES 1.1 or ES 2.0 spec
}
-private void checkBufferObject(boolean avail,
- boolean enabled,
- int state,
- String kind) {
+private boolean checkBufferObject(boolean avail,
+ boolean enabled,
+ int state,
+ String kind, boolean throwException) {
if (!avail) {
if (!enabled)
- return;
- throw new GLUnsupportedException("Required extensions not available to call this function");
+ return true;
+ if(throwException) {
+ throw new GLUnsupportedException("Required extensions not available to call this function");
+ }
+ return false;
}
int buffer = bufferStateTracker.getBoundBufferObject(state, this);
if (enabled) {
if (buffer == 0) {
- throw new GLException(kind + " must be enabled to call this method");
+ if(throwException) {
+ throw new GLException(kind + " must be enabled to call this method");
+ }
+ return false;
}
} else {
if (buffer != 0) {
- throw new GLException(kind + " must be disabled to call this method");
+ if(throwException) {
+ throw new GLException(kind + " must be disabled to call this method");
+ }
+ return false;
}
}
+ return true;
}
-private void checkArrayVBODisabled() {
+private boolean checkArrayVBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(true,
+ return checkBufferObject(true,
false,
GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object");
+ "array vertex_buffer_object", throwException);
}
-private void checkArrayVBOEnabled() {
+private boolean checkArrayVBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(true,
+ return checkBufferObject(true,
true,
GL.GL_ARRAY_BUFFER,
- "array vertex_buffer_object");
+ "array vertex_buffer_object", throwException);
}
-private void checkElementVBODisabled() {
+private boolean checkElementVBODisabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(true,
+ return checkBufferObject(true,
false,
GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object");
+ "element vertex_buffer_object", throwException);
}
-private void checkElementVBOEnabled() {
+private boolean checkElementVBOEnabled(boolean throwException) {
initBufferObjectExtensionChecks();
- checkBufferObject(true,
+ return checkBufferObject(true,
true,
GL.GL_ELEMENT_ARRAY_BUFFER,
- "element vertex_buffer_object");
+ "element vertex_buffer_object", throwException);
}
-private void checkUnpackPBODisabled() {
- initBufferObjectExtensionChecks();
- checkBufferObject(haveOESPixelBufferObject,
- false,
- GL2.GL_PIXEL_UNPACK_BUFFER,
- "unpack pixel_buffer_object");
+private boolean checkUnpackPBODisabled(boolean throwException) {
+ // PBO n/a for ES 1.1 or ES 2.0
+ return true;
}
-private void checkUnpackPBOEnabled() {
- initBufferObjectExtensionChecks();
- checkBufferObject(haveOESPixelBufferObject,
- true,
- GL2.GL_PIXEL_UNPACK_BUFFER,
- "unpack pixel_buffer_object");
+private boolean checkUnpackPBOEnabled(boolean throwException) {
+ // PBO n/a for ES 1.1 or ES 2.0
+ return false;
}
-private void checkPackPBODisabled() {
- initBufferObjectExtensionChecks();
- checkBufferObject(haveOESPixelBufferObject,
- false,
- GL2.GL_PIXEL_PACK_BUFFER,
- "pack pixel_buffer_object");
+private boolean checkPackPBODisabled(boolean throwException) {
+ // PBO n/a for ES 1.1 or ES 2.0
+ return true;
}
-private void checkPackPBOEnabled() {
- initBufferObjectExtensionChecks();
- checkBufferObject(haveOESPixelBufferObject,
- true,
- GL2.GL_PIXEL_PACK_BUFFER,
- "pack pixel_buffer_object");
+private boolean checkPackPBOEnabled(boolean throwException) {
+ // PBO n/a for ES 1.1 or ES 2.0
+ return false;
}
// Attempt to return the same ByteBuffer object from glMapBufferARB if
@@ -317,379 +320,3 @@ public void glDepthRange(double zNear, double zFar) {
glDepthRangef((float)zNear, (float)zFar);
}
-protected int fixedFunctionEmulationMode = 0;
-
-protected boolean fixedFunctionShaderActive=false;
-protected FixedFuncPipeline fixedFunction=null;
-
-protected boolean fixedFunctionMatrixEnabled=false;
-protected PMVMatrix pmvMatrix = null;
-
-public void enableFixedFunctionEmulationMode(int modes) {
- fixedFunctionEmulationMode|=modes;
-
- if( 0 != (modes & FIXED_EMULATION_MATRIX ) ) {
- if ( !fixedFunctionMatrixEnabled) {
- // setup ressources
- fixedFunctionMatrixEnabled=true;
-
- pmvMatrix = new PMVMatrix();
- }
- }
-
- if( 0 != (modes & FIXED_EMULATION_VERTEXCOLORTEXTURE ) ) {
- fixedFunctionShaderActive=true;
- if(null==fixedFunction) {
- fixedFunction = new FixedFuncPipeline(this, pmvMatrix);
- }
- }
-}
-
-public void disableFixedFunctionEmulationMode(int modes) {
- fixedFunctionEmulationMode&=~modes;
-
- if( 0 != (modes & FIXED_EMULATION_MATRIX ) ) {
- if ( fixedFunctionMatrixEnabled) {
- // release ressources
- fixedFunctionMatrixEnabled=false;
- pmvMatrix = null;
- }
- }
-
- // currently only for shader type: FIXED_EMULATION_VERTEXCOLORTEXTURE
- if( 0 != (modes & FIXED_EMULATION_VERTEXCOLORTEXTURE ) ) {
- if(null!=fixedFunction) {
- fixedFunction.release(this);
- }
- fixedFunctionShaderActive=false;
- }
-}
-
-public int getEnabledFixedFunctionEmulationModes() {
- return fixedFunctionEmulationMode;
-}
-
-public PMVMatrix getPMVMatrix() {
- return pmvMatrix;
-}
-
-public int glGetMatrixMode() {
- if(!fixedFunctionMatrixEnabled) {
- throw new GLUnsupportedException("not enabled");
- }
- return pmvMatrix.glGetMatrixMode();
-}
-public void glMatrixMode(int mode) {
- if(!fixedFunctionMatrixEnabled) {
- throw new GLUnsupportedException("not enabled");
- }
- pmvMatrix.glMatrixMode(mode);
-}
-public FloatBuffer glGetMatrixf(int matrixName) {
- if(!fixedFunctionMatrixEnabled) {
- throw new GLUnsupportedException("not enabled");
- }
- return pmvMatrix.glGetMatrixf(matrixName);
-}
-
-public FloatBuffer glGetMatrixf() {
- if(!fixedFunctionMatrixEnabled) {
- throw new GLUnsupportedException("not enabled");
- }
- return pmvMatrix.glGetMatrixf();
-}
-
-public void glLoadMatrixf(java.nio.FloatBuffer m) {
- if(!fixedFunctionMatrixEnabled) {
- throw new GLUnsupportedException("not enabled");
- }
- pmvMatrix.glLoadMatrixf(m);
-}
-public void glLoadMatrixf(float[] m, int m_offset) {
- glLoadMatrixf(BufferUtil.newFloatBuffer(m, m_offset));
-}
-public void glPopMatrix() {
- if(!fixedFunctionMatrixEnabled) {
- throw new GLUnsupportedException("not enabled");
- }
- pmvMatrix.glPopMatrix();
-}
-
-public void glPushMatrix() {
- if(!fixedFunctionMatrixEnabled) {
- throw new GLUnsupportedException("not enabled");
- }
- pmvMatrix.glPushMatrix();
-}
-
-public void glLoadIdentity() {
- if(!fixedFunctionMatrixEnabled) {
- throw new GLUnsupportedException("not enabled");
- }
- pmvMatrix.glLoadIdentity();
-}
-public void glMultMatrixf(java.nio.FloatBuffer m) {
- if(!fixedFunctionMatrixEnabled) {
- throw new GLUnsupportedException("not enabled");
- }
- pmvMatrix.glMultMatrixf(m);
-}
-public void glMultMatrixf(float[] m, int m_offset) {
- glMultMatrixf(BufferUtil.newFloatBuffer(m, m_offset));
-}
-public void glTranslatef(float x, float y, float z) {
- if(!fixedFunctionMatrixEnabled) {
- throw new GLUnsupportedException("not enabled");
- }
- pmvMatrix.glTranslatef(x, y, z);
-}
-public void glRotatef(float angdeg, float x, float y, float z) {
- if(!fixedFunctionMatrixEnabled) {
- throw new GLUnsupportedException("not enabled");
- }
- pmvMatrix.glRotatef(angdeg, x, y, z);
-}
-
-public void glScalef(float x, float y, float z) {
- if(!fixedFunctionMatrixEnabled) {
- throw new GLUnsupportedException("not enabled");
- }
- pmvMatrix.glScalef(x, y, z);
-}
-public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) {
- if(!fixedFunctionMatrixEnabled) {
- throw new GLUnsupportedException("not enabled");
- }
- pmvMatrix.glOrthof(left, right, bottom, top, zNear, zFar);
-}
-public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) {
- if(!fixedFunctionMatrixEnabled) {
- throw new GLUnsupportedException("not enabled");
- }
- pmvMatrix.glFrustumf(left, right, bottom, top, zNear, zFar);
-}
-
-public void glEnableClientState(int glArrayIndex) {
- if(!fixedFunctionShaderActive) {
- throw new GLUnsupportedException("not enabled");
- }
- fixedFunction.glEnableClientState(this, glArrayIndex);
-}
-public void glDisableClientState(int glArrayIndex) {
- if(!fixedFunctionShaderActive) {
- throw new GLUnsupportedException("not enabled");
- }
- fixedFunction.glDisableClientState(this, glArrayIndex);
-}
-public void glColor4f(float red, float green, float blue, float alpha) {
- if(!fixedFunctionShaderActive) {
- throw new GLUnsupportedException("not enabled");
- }
- fixedFunction.glColor4fv(this, BufferUtil.newFloatBuffer(new float[] { red, green, blue, alpha }));
-}
-
-private final void glDrawArraysPrologue() {
- if(fixedFunctionShaderActive) {
- fixedFunction.validate(this);
- }
-}
-private final void glDrawArraysEpilogue() {
- //if(fixedFunctionShaderActive) {
- // fixedFunction.getShaderState().glUseProgram(this, false);
- //}
-}
-private final void glActiveTextureEpilog(int texture) {
- if(fixedFunctionShaderActive) {
- fixedFunction.glActiveTexture(this, texture);
- }
-}
-private final void glEnablePrologue(int cap, boolean enable) {
- if(fixedFunctionShaderActive) {
- fixedFunction.glEnable(this, cap, enable);
- }
-}
-private final void glCullFacePrologue(int faceName) {
- if(fixedFunctionShaderActive) {
- fixedFunction.glCullFace(this, faceName);
- }
-}
-public void glLightfv(int light, int pname, java.nio.FloatBuffer params) {
- if(!fixedFunctionShaderActive) {
- throw new GLUnsupportedException("not enabled");
- }
- fixedFunction.glLightfv(this, light, pname, params);
-}
-public void glLightfv(int light, int pname, float[] params, int params_offset) {
- glLightfv(light, pname, BufferUtil.newFloatBuffer(params, params_offset));
-}
-public void glMaterialfv(int face, int pname, java.nio.FloatBuffer params) {
- if(!fixedFunctionShaderActive) {
- throw new GLUnsupportedException("not enabled");
- }
- fixedFunction.glMaterialfv(this, face, pname, params);
-}
-public void glMaterialfv(int face, int pname, float[] params, int params_offset) {
- glMaterialfv(face, pname, BufferUtil.newFloatBuffer(params, params_offset));
-}
-public void glMaterialf(int face, int pname, float param) {
- glMaterialfv(face, pname, BufferUtil.newFloatBuffer(new float[] { param }));
-}
-public void glShadeModel(int mode) {
- if(!fixedFunctionShaderActive) {
- throw new GLUnsupportedException("not enabled");
- }
- fixedFunction.glShadeModel(this, mode);
-}
-
-public final String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("GL: ");
- buf.append(getClass().getName());
- buf.append(" (GLSL compiler: ");
- buf.append(glShaderCompilerAvailable());
- Set bfs = glGetShaderBinaryFormats();
- buf.append(", binary formats ");
- buf.append(bfs.size());
- buf.append(":");
- for(Iterator iter=bfs.iterator(); iter.hasNext(); ) {
- buf.append(" ");
- buf.append(((Integer)(iter.next())).intValue());
- }
- buf.append(") (GLContext: ");
- GLContext context = getContext();
- buf.append(context.getClass().getName());
- buf.append(", GLDrawable: ");
- GLDrawable drawable = context.getGLDrawable();
- buf.append(drawable.getClass().getName());
- buf.append(", Factory: ");
- GLDrawableFactory factory = drawable.getFactory();
- buf.append(factory.getClass().getName());
- buf.append(", fixedEmul: [ ");
- if( 0 != (fixedFunctionEmulationMode & FIXED_EMULATION_MATRIX) ) {
- buf.append("FIXED_EMULATION_MATRIX ");
- }
- if( 0 != (fixedFunctionEmulationMode & FIXED_EMULATION_VERTEXCOLORTEXTURE) ) {
- buf.append("FIXED_EMULATION_VERTEXCOLORTEXTURE ");
- }
- buf.append("], matrixEnabled: "+fixedFunctionMatrixEnabled);
- buf.append(", shaderActive: "+fixedFunctionShaderActive);
- if(null!=pmvMatrix) {
- buf.append(", matrixDirty: "+pmvMatrix.isDirty());
- }
- buf.append("\n\t, FixedFunction: "+fixedFunction);
- buf.append(" )");
-
- return buf.toString();
-}
-
-public void glVertexPointer(GLArrayData array) {
- if(!fixedFunctionShaderActive) {
- throw new GLUnsupportedException("Fixed function not enabled");
- }
- if(array.isVBO()) {
- checkArrayVBOEnabled();
- } else {
- checkArrayVBODisabled();
- BufferFactory.rangeCheck(array.getBuffer(), 1);
- if (!BufferFactory.isDirect(array.getBuffer())) {
- throw new GLException("Argument \"pointer\" was not a direct buffer"); }
- }
- fixedFunction.glVertexPointer(this, array);
-}
-public void glVertexPointer(int size, int type, int stride, java.nio.Buffer pointer) {
- glVertexPointer(GLArrayDataWrapper.createFixed(GL.GL_VERTEX_ARRAY, size, type, false, stride, pointer, 0, 0));
-}
-public void glVertexPointer(int size, int type, int stride, long pointer_buffer_offset) {
- int vboName = bufferStateTracker.getBoundBufferObject(GL.GL_ARRAY_BUFFER, this);
- if(vboName==0) {
- throw new GLException("no GL_ARRAY_BUFFER VBO bound");
- }
- glVertexPointer(GLArrayDataWrapper.createFixed(GL.GL_VERTEX_ARRAY, size, type, false,
- stride, null, vboName, pointer_buffer_offset));
-}
-
-public void glColorPointer(GLArrayData array) {
- if(!fixedFunctionShaderActive) {
- throw new GLUnsupportedException("Fixed function not enabled");
- }
- if(array.isVBO()) {
- checkArrayVBOEnabled();
- } else {
- checkArrayVBODisabled();
- BufferFactory.rangeCheck(array.getBuffer(), 1);
- if (!BufferFactory.isDirect(array.getBuffer())) {
- throw new GLException("Argument \"pointer\" was not a direct buffer"); }
- }
- fixedFunction.glColorPointer(this, array);
-}
-public void glColorPointer(int size, int type, int stride, java.nio.Buffer pointer) {
- glColorPointer(GLArrayDataWrapper.createFixed(GL.GL_COLOR_ARRAY, size, type, false,
- stride, pointer, 0, 0));
-}
-public void glColorPointer(int size, int type, int stride, long pointer_buffer_offset) {
- int vboName = bufferStateTracker.getBoundBufferObject(GL.GL_ARRAY_BUFFER, this);
- if(vboName==0) {
- throw new GLException("no GL_ARRAY_BUFFER VBO bound");
- }
- glColorPointer(GLArrayDataWrapper.createFixed(GL.GL_COLOR_ARRAY, size, type, false,
- stride, null, vboName, pointer_buffer_offset));
-}
-
-public void glNormalPointer(GLArrayData array) {
- if(!fixedFunctionShaderActive) {
- throw new GLUnsupportedException("Fixed function not enabled");
- }
- if(array.getComponentNumber()!=3) {
- throw new GLException("Only 3 components per normal allowed");
- }
- if(array.isVBO()) {
- checkArrayVBOEnabled();
- } else {
- checkArrayVBODisabled();
- BufferFactory.rangeCheck(array.getBuffer(), 1);
- if (!BufferFactory.isDirect(array.getBuffer())) {
- throw new GLException("Argument \"pointer\" was not a direct buffer"); }
- }
- fixedFunction.glNormalPointer(this, array);
-}
-public void glNormalPointer(int type, int stride, java.nio.Buffer pointer) {
- glNormalPointer(GLArrayDataWrapper.createFixed(GL.GL_NORMAL_ARRAY, 3, type, false,
- stride, pointer, 0, 0));
-}
-public void glNormalPointer(int type, int stride, long pointer_buffer_offset) {
- int vboName = bufferStateTracker.getBoundBufferObject(GL.GL_ARRAY_BUFFER, this);
- if(vboName==0) {
- throw new GLException("no GL_ARRAY_BUFFER VBO bound");
- }
- glNormalPointer(GLArrayDataWrapper.createFixed(GL.GL_NORMAL_ARRAY, 3, type, false,
- stride, null, vboName, pointer_buffer_offset));
-}
-
-public void glTexCoordPointer(GLArrayData array) {
- if(!fixedFunctionShaderActive) {
- throw new GLUnsupportedException("Fixed function not enabled");
- }
- if(array.isVBO()) {
- checkArrayVBOEnabled();
- } else {
- checkArrayVBODisabled();
- BufferFactory.rangeCheck(array.getBuffer(), 1);
- if (!BufferFactory.isDirect(array.getBuffer())) {
- throw new GLException("Argument \"pointer\" was not a direct buffer"); }
- }
- fixedFunction.glTexCoordPointer(this, array);
-}
-public void glTexCoordPointer(int size, int type, int stride, java.nio.Buffer pointer) {
- glTexCoordPointer(
- GLArrayDataWrapper.createFixed(GL.GL_TEXTURE_COORD_ARRAY, size, type, false, stride, pointer, 0,0));
-}
-public void glTexCoordPointer(int size, int type, int stride, long pointer_buffer_offset) {
- int vboName = bufferStateTracker.getBoundBufferObject(GL.GL_ARRAY_BUFFER, this);
- if(vboName==0) {
- throw new GLException("no GL_ARRAY_BUFFER VBO bound");
- }
- glTexCoordPointer(
- GLArrayDataWrapper.createFixed(GL.GL_TEXTURE_COORD_ARRAY, size, type, false,
- stride, null, vboName, pointer_buffer_offset) );
-}
-
diff --git a/make/glu-CustomJavaCode-base.java b/make/glu-CustomJavaCode-base.java
index bd20c1b18..272377ece 100755
--- a/make/glu-CustomJavaCode-base.java
+++ b/make/glu-CustomJavaCode-base.java
@@ -76,10 +76,16 @@ public boolean isFunctionAvailable(String gluFunctionName)
// Utility routines
//
+/**
+ * Instantiates a GLU implementation object in respect to the current GL profile.
+ */
public static final GLU createGLU() throws GLException {
return createGLU(GLProfile.getProfile());
}
+/**
+ * Instantiates a GLU implementation object in respect to the given GL profile.
+ */
public static final GLU createGLU(String profile) throws GLUnsupportedException {
try {
if(GLProfile.GL2.equals(profile)) {
@@ -93,11 +99,11 @@ public static final GLU createGLU(String profile) throws GLUnsupportedException
} catch (GLUnsupportedException e) { e.printStackTrace(); }
// There is no specialized ES 2 GLU at this time
/*
- try {
- if(GLProfile.GL2ES12.equals(profile) || GLProfile.GL2.equals(profile) || GLProfile.GLES2.equals(profile)) {
- return (GLU) GLReflection.createInstance("javax.media.opengl.glu.gl2es2.GLUgl2es2");
- }
- } catch (GLUnsupportedException e) { e.printStackTrace(); }
+ try {
+ if(GLProfile.GL2ES12.equals(profile) || GLProfile.GL2.equals(profile) || GLProfile.GLES2.equals(profile)) {
+ return (GLU) GLReflection.createInstance("javax.media.opengl.glu.gl2es2.GLUgl2es2");
+ }
+ } catch (GLUnsupportedException e) { e.printStackTrace(); }
*/
return new GLU();
}
@@ -1273,15 +1279,15 @@ public final void gluSphere(GLUquadric quad, double radius, int slices, int stac
private ProjectFloat project;
public void gluOrtho2D(float left, float right, float bottom, float top) {
- project.gluOrtho2D(getCurrentGL(), left, right, bottom, top);
+ project.gluOrtho2D(GLFixedFuncUtil.getCurrentGLFixedFuncIf(), left, right, bottom, top);
}
public void gluPerspective(float fovy, float aspect, float zNear, float zFar) {
- project.gluPerspective(getCurrentGL(), fovy, aspect, zNear, zFar);
+ project.gluPerspective(GLFixedFuncUtil.getCurrentGLFixedFuncIf(), 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);
+ project.gluLookAt(GLFixedFuncUtil.getCurrentGLFixedFuncIf(), 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>
@@ -1327,23 +1333,23 @@ public boolean gluUnProject4(float winX, float winY, float winZ, float clipW, ja
}
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);
+ project.gluPickMatrix(GLFixedFuncUtil.getCurrentGLFixedFuncIf(), 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);
+ project.gluPickMatrix(GLFixedFuncUtil.getCurrentGLFixedFuncIf(), x, y, delX, delY, viewport);
}
public void gluOrtho2D(double left, double right, double bottom, double top) {
- project.gluOrtho2D(getCurrentGL(), (float)left, (float)right, (float)bottom, (float)top);
+ project.gluOrtho2D(GLFixedFuncUtil.getCurrentGLFixedFuncIf(), (float)left, (float)right, (float)bottom, (float)top);
}
public void gluPerspective(double fovy, double aspect, double zNear, double zFar) {
- project.gluPerspective(getCurrentGL(), (float)fovy, (float)aspect, (float)zNear, (float)zFar);
+ project.gluPerspective(GLFixedFuncUtil.getCurrentGLFixedFuncIf(), (float)fovy, (float)aspect, (float)zNear, (float)zFar);
}
public void gluLookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ) {
- project.gluLookAt(getCurrentGL(), (float)eyeX, (float)eyeY, (float)eyeZ, (float)centerX, (float)centerY, (float)centerZ, (float)upX, (float)upY, (float)upZ);
+ project.gluLookAt(GLFixedFuncUtil.getCurrentGLFixedFuncIf(), (float)eyeX, (float)eyeY, (float)eyeZ, (float)centerX, (float)centerY, (float)centerZ, (float)upX, (float)upY, (float)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>
@@ -1368,11 +1374,11 @@ public boolean gluUnProject4(double winX, double winY, double winZ, double clipW
}
public void gluPickMatrix(double x, double y, double delX, double delY, int[] viewport, int viewport_offset) {
- project.gluPickMatrix(getCurrentGL(), (float)x, (float)y, (float)delX, (float)delY, viewport, viewport_offset);
+ project.gluPickMatrix(GLFixedFuncUtil.getCurrentGLFixedFuncIf(), (float)x, (float)y, (float)delX, (float)delY, viewport, viewport_offset);
}
public void gluPickMatrix(double x, double y, double delX, double delY, IntBuffer viewport) {
- project.gluPickMatrix(getCurrentGL(), (float)x, (float)y, (float)delX, (float)delY, viewport);
+ project.gluPickMatrix(GLFixedFuncUtil.getCurrentGLFixedFuncIf(), (float)x, (float)y, (float)delX, (float)delY, viewport);
}
/**
diff --git a/make/glu-CustomJavaCode-gl2.java b/make/glu-CustomJavaCode-gl2.java
index b1d35532c..bb01871d7 100644
--- a/make/glu-CustomJavaCode-gl2.java
+++ b/make/glu-CustomJavaCode-gl2.java
@@ -34,6 +34,7 @@ public GLUgl2()
this.project = new ProjectDouble();
}
+
//----------------------------------------------------------------------
// Utility routines
//
diff --git a/make/glu-base.cfg b/make/glu-base.cfg
index 478803347..f67673a78 100755
--- a/make/glu-base.cfg
+++ b/make/glu-base.cfg
@@ -1,7 +1,7 @@
# This .cfg file is used to generate the GLU implementation for OpenGL ES 1.0,
# where it is pure Java.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl
Style ImplOnly
ImplPackage javax.media.opengl.glu
diff --git a/make/glu-common.cfg b/make/glu-common.cfg
index 988810b31..775655294 100644
--- a/make/glu-common.cfg
+++ b/make/glu-common.cfg
@@ -9,6 +9,8 @@ TagNativeBinding true
#
Import java.nio.*
Import javax.media.opengl.*
+Import javax.media.opengl.sub.*
+Import javax.media.opengl.sub.fixed.*
Import javax.media.opengl.glu.*
Import javax.media.opengl.util.*
Import com.sun.opengl.impl.*
diff --git a/make/glu-gl2.cfg b/make/glu-gl2.cfg
index 0ebf23258..699352145 100755
--- a/make/glu-gl2.cfg
+++ b/make/glu-gl2.cfg
@@ -1,7 +1,7 @@
# This .cfg file provides common options used among gl2 GLU glue code
# generated for Jogl on all platforms.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/gl2
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/gl2
Style ImplOnly
ImplPackage javax.media.opengl.glu.gl2
diff --git a/make/glu-gl2es1.cfg b/make/glu-gl2es1.cfg
index 4a73f66c8..8927f96b9 100755
--- a/make/glu-gl2es1.cfg
+++ b/make/glu-gl2es1.cfg
@@ -1,7 +1,7 @@
# This .cfg file is used to generate the GLU implementation for OpenGL ES 1.0,
# where it is pure Java.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/gl2es1
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/gl2es1
Style ImplOnly
ImplPackage javax.media.opengl.glu.gl2es1
diff --git a/make/glx-x11.cfg b/make/glx-x11.cfg
index 0b669805c..c668282cc 100644
--- a/make/glx-x11.cfg
+++ b/make/glx-x11.cfg
@@ -1,7 +1,7 @@
# This .cfg file is used to generate the interface to the GLX routines
# used internally by the X11GLContext implementation.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/X11
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/X11
Package com.sun.opengl.impl.x11.glx
JavaClass GLX
diff --git a/make/glxext.cfg b/make/glxext.cfg
index 1e8b7bb44..1d46c569f 100755
--- a/make/glxext.cfg
+++ b/make/glxext.cfg
@@ -1,7 +1,7 @@
# This .cfg file is used to generate the interface and implementing
# class for the GLX extensions.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/X11
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/X11
Package com.sun.opengl.impl.x11.glx
Style InterfaceAndImpl
@@ -9,7 +9,7 @@ JavaClass GLXExt
ImplPackage com.sun.opengl.impl.x11.glx
ImplJavaClass GLXExtImpl
-ExtendedInterfaceSymbols ../build/gensrc/classes/com/sun/opengl/impl/x11/glx/GLX.java
+ExtendedInterfaceSymbols ../build-temp/gensrc/classes/com/sun/opengl/impl/x11/glx/GLX.java
Include gl-common-gl2.cfg
Include gl-desktop.cfg
diff --git a/make/jawt-macosx.cfg b/make/jawt-macosx.cfg
index 5fe3a3cb8..a4495801c 100644
--- a/make/jawt-macosx.cfg
+++ b/make/jawt-macosx.cfg
@@ -3,8 +3,8 @@
Style AllStatic
Package com.sun.opengl.impl.jawt
JavaClass JAWTFactory
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/MacOSX
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/MacOSX
HierarchicalNativeOutput false
diff --git a/make/jawt-win32.cfg b/make/jawt-win32.cfg
index e3f4bb7eb..96b923a22 100644
--- a/make/jawt-win32.cfg
+++ b/make/jawt-win32.cfg
@@ -3,8 +3,8 @@
Style AllStatic
Package com.sun.opengl.impl.jawt
JavaClass JAWTFactory
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/Windows
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/Windows
HierarchicalNativeOutput false
diff --git a/make/jawt-x11.cfg b/make/jawt-x11.cfg
index 3f0d8a3ee..7f8a9d282 100644
--- a/make/jawt-x11.cfg
+++ b/make/jawt-x11.cfg
@@ -3,8 +3,8 @@
Style AllStatic
Package com.sun.opengl.impl.jawt
JavaClass JAWTFactory
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/X11
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/X11
HierarchicalNativeOutput false
diff --git a/make/make.jogl.all.linux-x86.sh b/make/make.jogl.all.linux-x86.sh
index d21d95886..cb0b44771 100644
--- a/make/make.jogl.all.linux-x86.sh
+++ b/make/make.jogl.all.linux-x86.sh
@@ -1,10 +1,11 @@
#! /bin/sh
-. ../../setenv-build-jogl.sh
+. ../../setenv-build-jogl-x86.sh
# -Dc.compiler.debug=true
ant -v \
+ -Drootrel.build=build-x86 \
-Dgluegen.cpptasks.detected.os=true \
-DisUnix=true \
-DisLinux=true \
diff --git a/make/wgl-win32.cfg b/make/wgl-win32.cfg
index d80963b71..d9035b3e6 100644
--- a/make/wgl-win32.cfg
+++ b/make/wgl-win32.cfg
@@ -1,7 +1,7 @@
# This .cfg file is used to generate the interface to the wgl routines
# used internally by the WindowsGLContext implementation.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/Windows
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/Windows
Package com.sun.opengl.impl.windows.wgl
JavaClass WGL
diff --git a/make/wglext.cfg b/make/wglext.cfg
index fa269d9b0..21ad0936d 100644
--- a/make/wglext.cfg
+++ b/make/wglext.cfg
@@ -1,7 +1,7 @@
# This .cfg file is used to generate the interface and implementing
# class for the WGL extensions.
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/Windows
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/Windows
Package com.sun.opengl.impl.windows.wgl
Style InterfaceAndImpl
diff --git a/make/x11-lib.cfg b/make/x11-lib.cfg
index 54f1bc1c4..8313051b3 100644
--- a/make/x11-lib.cfg
+++ b/make/x11-lib.cfg
@@ -6,8 +6,8 @@ Style allstatic
HierarchicalNativeOutput false
-JavaOutputDir ../build/gensrc/classes
-NativeOutputDir ../build/gensrc/native/jogl/X11
+JavaOutputDir gensrc/classes
+NativeOutputDir gensrc/native/jogl/X11
# Imports needed by all glue code
Import java.nio.*
diff --git a/src/classes/com/sun/javafx/newt/GLWindow.java b/src/classes/com/sun/javafx/newt/GLWindow.java
index c8c707e98..23f959799 100644
--- a/src/classes/com/sun/javafx/newt/GLWindow.java
+++ b/src/classes/com/sun/javafx/newt/GLWindow.java
@@ -338,22 +338,24 @@ public class GLWindow extends Window implements GLAutoDrawable {
return factory;
}
+ public void setContext(GLContext newCtx) {
+ context = newCtx;
+ }
+
public GLContext getContext() {
return context;
}
public GL getGL() {
- GLContext ctx = getContext();
- if (ctx == null) {
+ if (context == null) {
return null;
}
- return ctx.getGL();
+ return context.getGL();
}
public void setGL(GL gl) {
- GLContext ctx = getContext();
- if (ctx != null) {
- ctx.setGL(gl);
+ if (context != null) {
+ context.setGL(gl);
}
}
diff --git a/src/classes/com/sun/opengl/impl/GLArrayHandler.java b/src/classes/com/sun/opengl/impl/GLArrayHandler.java
index bba190835..d34e04b10 100644
--- a/src/classes/com/sun/opengl/impl/GLArrayHandler.java
+++ b/src/classes/com/sun/opengl/impl/GLArrayHandler.java
@@ -2,6 +2,7 @@
package com.sun.opengl.impl;
import javax.media.opengl.*;
+import javax.media.opengl.sub.*;
public interface GLArrayHandler {
diff --git a/src/classes/com/sun/opengl/impl/GLContextImpl.java b/src/classes/com/sun/opengl/impl/GLContextImpl.java
index 02cbd6581..d00afde4d 100644
--- a/src/classes/com/sun/opengl/impl/GLContextImpl.java
+++ b/src/classes/com/sun/opengl/impl/GLContextImpl.java
@@ -48,7 +48,7 @@ import com.sun.gluegen.runtime.opengl.*;
public abstract class GLContextImpl extends GLContext {
protected GLContextLock lock = new GLContextLock();
- protected static final boolean DEBUG = Debug.debug("GLContextImpl");
+ protected static final boolean DEBUG = Debug.debug("GLContext");
protected static final boolean VERBOSE = Debug.verbose();
protected static final boolean NO_FREE = Debug.isPropertyDefined("jogl.GLContext.nofree");
// NOTE: default sense of GLContext optimization disabled in JSR-231
@@ -223,6 +223,12 @@ public abstract class GLContextImpl extends GLContext {
}
public void setGL(GL gl) {
+ if(DEBUG) {
+ String sgl1 = (null!=this.gl)?this.gl.getClass().toString()+", "+this.gl.toString():new String("<null>");
+ String sgl2 = (null!=gl)?gl.getClass().toString()+", "+gl.toString():new String("<null>");
+ Exception e = new Exception("setGL: "+Thread.currentThread()+", "+sgl1+" -> "+sgl2);
+ e.printStackTrace();
+ }
this.gl = gl;
}
diff --git a/src/classes/com/sun/opengl/impl/GLFixedArrayHandler.java b/src/classes/com/sun/opengl/impl/GLFixedArrayHandler.java
index 868385447..b9e2ca613 100644
--- a/src/classes/com/sun/opengl/impl/GLFixedArrayHandler.java
+++ b/src/classes/com/sun/opengl/impl/GLFixedArrayHandler.java
@@ -2,6 +2,8 @@
package com.sun.opengl.impl;
import javax.media.opengl.*;
+import javax.media.opengl.sub.*;
+import javax.media.opengl.sub.fixed.*;
import java.nio.*;
public class GLFixedArrayHandler implements GLArrayHandler {
@@ -11,18 +13,18 @@ public class GLFixedArrayHandler implements GLArrayHandler {
this.ad = ad;
}
- protected final void passArrayPointer(GL gl) {
+ protected final void passArrayPointer(GLPointerIf gl) {
switch(ad.getIndex()) {
- case GL.GL_VERTEX_ARRAY:
+ case GLPointerIf.GL_VERTEX_ARRAY:
gl.glVertexPointer(ad);
break;
- case GL.GL_NORMAL_ARRAY:
+ case GLPointerIf.GL_NORMAL_ARRAY:
gl.glNormalPointer(ad);
break;
- case GL.GL_COLOR_ARRAY:
+ case GLPointerIf.GL_COLOR_ARRAY:
gl.glColorPointer(ad);
break;
- case GL.GL_TEXTURE_COORD_ARRAY:
+ case GLPointerIf.GL_TEXTURE_COORD_ARRAY:
gl.glTexCoordPointer(ad);
break;
default:
@@ -31,8 +33,9 @@ public class GLFixedArrayHandler implements GLArrayHandler {
}
public void enableBuffer(GL gl, boolean enable) {
+ GLPointerIf glp = GLFixedFuncUtil.getGLFixedFuncIf(gl);
if(enable) {
- gl.glEnableClientState(ad.getIndex());
+ glp.glEnableClientState(ad.getIndex());
Buffer buffer = ad.getBuffer();
@@ -46,16 +49,16 @@ public class GLFixedArrayHandler implements GLArrayHandler {
}
ad.setBufferWritten(true);
}
- passArrayPointer(gl);
+ passArrayPointer(glp);
} else if(null!=buffer) {
- passArrayPointer(gl);
+ passArrayPointer(glp);
ad.setBufferWritten(true);
}
} else {
if(ad.isVBO()) {
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
}
- gl.glDisableClientState(ad.getIndex());
+ glp.glDisableClientState(ad.getIndex());
}
}
}
diff --git a/src/classes/com/sun/opengl/impl/GLPbufferImpl.java b/src/classes/com/sun/opengl/impl/GLPbufferImpl.java
index 74fc0fe1a..14c218c45 100644
--- a/src/classes/com/sun/opengl/impl/GLPbufferImpl.java
+++ b/src/classes/com/sun/opengl/impl/GLPbufferImpl.java
@@ -112,6 +112,10 @@ public class GLPbufferImpl implements GLPbuffer {
drawableHelper.removeGLEventListener(listener);
}
+ public void setContext(GLContext ctx) {
+ context=(GLContextImpl)ctx;
+ }
+
public GLContext getContext() {
return context;
}
diff --git a/src/classes/com/sun/opengl/impl/GLReflection.java b/src/classes/com/sun/opengl/impl/GLReflection.java
index 256a9b9af..8c89c50dd 100644
--- a/src/classes/com/sun/opengl/impl/GLReflection.java
+++ b/src/classes/com/sun/opengl/impl/GLReflection.java
@@ -45,7 +45,7 @@ public final class GLReflection {
try {
Class clazz = Class.forName(clazzName);
return null!=clazz;
- } catch (Exception e) { }
+ } catch (Throwable e) { }
return false;
}
@@ -64,7 +64,10 @@ public final class GLReflection {
throw new GLUnsupportedException("Constructor: '" + clazzName + "("+cstrArgTypes+")' not found");
}
return factory;
- } catch (Exception e) {
+ } catch (Throwable e) {
+ if (Debug.debug("GLReflection")) {
+ e.printStackTrace();
+ }
throw new GLUnsupportedException(e);
}
}
diff --git a/src/classes/com/sun/opengl/impl/ProjectFloat.java b/src/classes/com/sun/opengl/impl/ProjectFloat.java
index 309a6bdaf..61c1bd8a1 100755
--- a/src/classes/com/sun/opengl/impl/ProjectFloat.java
+++ b/src/classes/com/sun/opengl/impl/ProjectFloat.java
@@ -118,6 +118,7 @@ import java.nio.*;
import javax.media.opengl.*;
import javax.media.opengl.util.*;
+import javax.media.opengl.sub.fixed.GLMatrixIf;
/**
* ProjectFloat.java
@@ -538,7 +539,7 @@ public class ProjectFloat {
* @param bottom
* @param top
*/
- public void gluOrtho2D(GL gl, float left, float right, float bottom, float top) {
+ public void gluOrtho2D(GLMatrixIf gl, float left, float right, float bottom, float top) {
gl.glOrthof(left, right, bottom, top, -1, 1);
}
@@ -550,7 +551,7 @@ public class ProjectFloat {
* @param zNear
* @param zFar
*/
- public void gluPerspective(GL gl, float fovy, float aspect, float zNear, float zFar) {
+ public void gluPerspective(GLMatrixIf gl, float fovy, float aspect, float zNear, float zFar) {
float sine, cotangent, deltaZ;
float radians = fovy / 2 * (float) Math.PI / 180;
@@ -588,7 +589,7 @@ public class ProjectFloat {
* @param upy
* @param upz
*/
- public void gluLookAt(GL gl,
+ public void gluLookAt(GLMatrixIf gl,
float eyex,
float eyey,
float eyez,
@@ -1001,7 +1002,7 @@ public class ProjectFloat {
* @param deltaY
* @param viewport
*/
- public void gluPickMatrix(GL gl,
+ public void gluPickMatrix(GLMatrixIf gl,
float x,
float y,
float deltaX,
@@ -1029,7 +1030,7 @@ public class ProjectFloat {
* @param viewport
* @param viewport_offset
*/
- public void gluPickMatrix(GL gl,
+ public void gluPickMatrix(GLMatrixIf gl,
float x,
float y,
float deltaX,
diff --git a/src/classes/com/sun/opengl/impl/glsl/GLSLArrayHandler.java b/src/classes/com/sun/opengl/impl/glsl/GLSLArrayHandler.java
index d74298a7c..3edfe43d5 100644
--- a/src/classes/com/sun/opengl/impl/glsl/GLSLArrayHandler.java
+++ b/src/classes/com/sun/opengl/impl/glsl/GLSLArrayHandler.java
@@ -4,6 +4,7 @@ package com.sun.opengl.impl.glsl;
import com.sun.opengl.impl.*;
import javax.media.opengl.*;
+import javax.media.opengl.sub.*;
import com.sun.opengl.util.glsl.ShaderState;
import java.nio.*;
@@ -19,6 +20,9 @@ public class GLSLArrayHandler implements GLArrayHandler {
}
public void enableBuffer(GL gl, boolean enable) {
+ if(!gl.isGL2ES2()) {
+ throw new GLException("GLSLArrayHandler expects a GL2ES2 implementation");
+ }
GL2ES2 glsl = gl.getGL2ES2();
ShaderState st = ShaderState.getCurrent();
if(null==st) {
@@ -33,10 +37,10 @@ public class GLSLArrayHandler implements GLArrayHandler {
if(ad.isVBO()) {
// always bind and refresh the VBO mgr,
// in case more than one gl*Pointer objects are in use
- gl.glBindBuffer(GL.GL_ARRAY_BUFFER, ad.getVBOName());
+ glsl.glBindBuffer(GL.GL_ARRAY_BUFFER, ad.getVBOName());
if(!ad.isBufferWritten()) {
if(null!=buffer) {
- gl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit() * ad.getComponentSize(), buffer, ad.getBufferUsage());
+ glsl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit() * ad.getComponentSize(), buffer, ad.getBufferUsage());
}
ad.setBufferWritten(true);
}
@@ -47,7 +51,7 @@ public class GLSLArrayHandler implements GLArrayHandler {
}
} else {
if(ad.isVBO()) {
- gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
+ glsl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
}
st.glDisableVertexAttribArray(glsl, ad.getName());
}
diff --git a/src/classes/com/sun/opengl/impl/glsl/fixed/FixedFuncPipeline.java b/src/classes/com/sun/opengl/impl/glsl/fixed/FixedFuncPipeline.java
index 7cd3d7bbb..c5b85924d 100644
--- a/src/classes/com/sun/opengl/impl/glsl/fixed/FixedFuncPipeline.java
+++ b/src/classes/com/sun/opengl/impl/glsl/fixed/FixedFuncPipeline.java
@@ -3,6 +3,7 @@ package com.sun.opengl.impl.glsl.fixed;
import javax.media.opengl.*;
import javax.media.opengl.util.*;
+import javax.media.opengl.sub.fixed.*;
import com.sun.opengl.util.glsl.*;
import java.nio.*;
@@ -11,7 +12,16 @@ public class FixedFuncPipeline {
public static final int MAX_LIGHTS = 8;
public FixedFuncPipeline(GL2ES2 gl, PMVMatrix pmvMatrix) {
- init(gl, pmvMatrix);
+ init(gl, pmvMatrix, FixedFuncPipeline.class, shaderSrcRootDef, shaderBinRootDef,
+ vertexColorFileDef, vertexColorLightFileDef, fragmentColorFileDef, fragmentColorTextureFileDef);
+ }
+ public FixedFuncPipeline(GL2ES2 gl, PMVMatrix pmvMatrix, Class shaderRootClass, String shaderSrcRoot, String shaderBinRoot,
+ String vertexColorFile,
+ String vertexColorLightFile,
+ String fragmentColorFile,
+ String fragmentColorTextureFile) {
+ init(gl, pmvMatrix, shaderRootClass, shaderSrcRoot, shaderBinRoot,
+ vertexColorFile, vertexColorLightFile, fragmentColorFile, fragmentColorTextureFile);
}
public boolean verbose() { return verbose; }
@@ -33,11 +43,11 @@ public class FixedFuncPipeline {
public String getArrayIndexName(int glArrayIndex) {
String name = GLContext.getPredefinedArrayIndexName(glArrayIndex);
switch(glArrayIndex) {
- case GL.GL_VERTEX_ARRAY:
- case GL.GL_NORMAL_ARRAY:
- case GL.GL_COLOR_ARRAY:
+ case GLPointerIf.GL_VERTEX_ARRAY:
+ case GLPointerIf.GL_NORMAL_ARRAY:
+ case GLPointerIf.GL_COLOR_ARRAY:
break;
- case GL.GL_TEXTURE_COORD_ARRAY:
+ case GLPointerIf.GL_TEXTURE_COORD_ARRAY:
name = name + activeTextureUnit;
}
return name;
@@ -105,38 +115,38 @@ public class FixedFuncPipeline {
public void glLightfv(GL2ES2 gl, int light, int pname, java.nio.FloatBuffer params) {
shaderState.glUseProgram(gl, true);
- light -=GL.GL_LIGHT0;
+ light -=GLLightingIf.GL_LIGHT0;
if(0 <= light && light < MAX_LIGHTS) {
GLUniformData ud = null;
switch(pname) {
- case GL.GL_AMBIENT:
+ case GLLightingIf.GL_AMBIENT:
ud = shaderState.getUniform(mgl_LightSource+"["+light+"].ambient");
break;
- case GL.GL_DIFFUSE:
+ case GLLightingIf.GL_DIFFUSE:
ud = shaderState.getUniform(mgl_LightSource+"["+light+"].diffuse");
break;
- case GL.GL_SPECULAR:
+ case GLLightingIf.GL_SPECULAR:
ud = shaderState.getUniform(mgl_LightSource+"["+light+"].specular");
break;
- case GL.GL_POSITION:
+ case GLLightingIf.GL_POSITION:
ud = shaderState.getUniform(mgl_LightSource+"["+light+"].position");
break;
- case GL.GL_SPOT_DIRECTION:
+ case GLLightingIf.GL_SPOT_DIRECTION:
ud = shaderState.getUniform(mgl_LightSource+"["+light+"].spotDirection");
break;
- case GL.GL_SPOT_EXPONENT:
+ case GLLightingIf.GL_SPOT_EXPONENT:
ud = shaderState.getUniform(mgl_LightSource+"["+light+"].spotExponent");
break;
- case GL.GL_SPOT_CUTOFF:
+ case GLLightingIf.GL_SPOT_CUTOFF:
ud = shaderState.getUniform(mgl_LightSource+"["+light+"].spotCutoff");
break;
- case GL.GL_CONSTANT_ATTENUATION:
+ case GLLightingIf.GL_CONSTANT_ATTENUATION:
ud = shaderState.getUniform(mgl_LightSource+"["+light+"].constantAttenuation");
break;
- case GL.GL_LINEAR_ATTENUATION:
+ case GLLightingIf.GL_LINEAR_ATTENUATION:
ud = shaderState.getUniform(mgl_LightSource+"["+light+"].linearAttenuation");
break;
- case GL.GL_QUADRATIC_ATTENUATION:
+ case GLLightingIf.GL_QUADRATIC_ATTENUATION:
ud = shaderState.getUniform(mgl_LightSource+"["+light+"].quadraticAttenuation");
break;
default:
@@ -171,22 +181,22 @@ public class FixedFuncPipeline {
GLUniformData ud = null;
switch(pname) {
- case GL.GL_AMBIENT:
+ case GLLightingIf.GL_AMBIENT:
ud = shaderState.getUniform(mgl_FrontMaterial+".ambient");
break;
- case GL.GL_AMBIENT_AND_DIFFUSE:
- glMaterialfv(gl, face, GL.GL_AMBIENT, params);
+ case GLLightingIf.GL_AMBIENT_AND_DIFFUSE:
+ glMaterialfv(gl, face, GLLightingIf.GL_AMBIENT, params);
// fall through intended ..
- case GL.GL_DIFFUSE:
+ case GLLightingIf.GL_DIFFUSE:
ud = shaderState.getUniform(mgl_FrontMaterial+".diffuse");
break;
- case GL.GL_SPECULAR:
+ case GLLightingIf.GL_SPECULAR:
ud = shaderState.getUniform(mgl_FrontMaterial+".specular");
break;
- case GL.GL_EMISSION:
+ case GLLightingIf.GL_EMISSION:
ud = shaderState.getUniform(mgl_FrontMaterial+".emission");
break;
- case GL.GL_SHININESS:
+ case GLLightingIf.GL_SHININESS:
ud = shaderState.getUniform(mgl_FrontMaterial+".shininess");
break;
default:
@@ -231,30 +241,36 @@ public class FixedFuncPipeline {
}
}
- public void glEnable(GL2ES2 gl, int cap, boolean enable) {
+ /**
+ * @return false if digested in regard to GL2ES2 spec,
+ * eg this call must not be passed to an underlying ES2 implementation.
+ * true if this call shall be passed to an underlying GL2ES2/ES2 implementation as well.
+ */
+ public boolean glEnable(GL2ES2 gl, int cap, boolean enable) {
switch(cap) {
case GL.GL_TEXTURE_2D:
textureEnabled=enable;
- return;
- case GL.GL_LIGHTING:
+ return true;
+ case GLLightingIf.GL_LIGHTING:
lightingEnabled=enable;
- return;
+ return false;
case GL.GL_CULL_FACE:
cullFace=Math.abs(cullFace);
if(!enable) {
cullFace*=-1;
}
- return;
+ return true;
}
- int light = cap - GL.GL_LIGHT0;
+ int light = cap - GLLightingIf.GL_LIGHT0;
if(0 <= light && light < MAX_LIGHTS) {
if ( (lightsEnabled.get(light)==1) != enable ) {
lightsEnabled.put(light, enable?1:0);
lightsEnabledDirty = true;
- return;
+ return false;
}
}
+ return true; // pass it on ..
}
public void glCullFace(GL2ES2 gl, int faceName) {
@@ -355,7 +371,12 @@ public class FixedFuncPipeline {
"]";
}
- protected void init(GL2ES2 gl, PMVMatrix pmvMatrix) {
+ protected void init(GL2ES2 gl, PMVMatrix pmvMatrix, Class shaderRootClass, String shaderSrcRoot, String shaderBinRoot,
+ String vertexColorFile,
+ String vertexColorLightFile,
+ String fragmentColorFile,
+ String fragmentColorTextureFile)
+ {
if(null==pmvMatrix) {
throw new GLException("PMVMatrix is null");
}
@@ -364,16 +385,16 @@ public class FixedFuncPipeline {
this.shaderState.setVerbose(verbose);
ShaderCode vertexColor, vertexColorLight, fragmentColor, fragmentColorTexture;
- vertexColor = ShaderCode.create( gl, gl.GL_VERTEX_SHADER, 1, FixedFuncPipeline.class,
+ vertexColor = ShaderCode.create( gl, gl.GL_VERTEX_SHADER, 1, shaderRootClass,
shaderSrcRoot, shaderBinRoot, vertexColorFile);
- vertexColorLight = ShaderCode.create( gl, gl.GL_VERTEX_SHADER, 1, FixedFuncPipeline.class,
+ vertexColorLight = ShaderCode.create( gl, gl.GL_VERTEX_SHADER, 1, shaderRootClass,
shaderSrcRoot, shaderBinRoot, vertexColorLightFile);
- fragmentColor = ShaderCode.create( gl, gl.GL_FRAGMENT_SHADER, 1, FixedFuncPipeline.class,
+ fragmentColor = ShaderCode.create( gl, gl.GL_FRAGMENT_SHADER, 1, shaderRootClass,
shaderSrcRoot, shaderBinRoot, fragmentColorFile);
- fragmentColorTexture = ShaderCode.create( gl, gl.GL_FRAGMENT_SHADER, 1, FixedFuncPipeline.class,
+ fragmentColorTexture = ShaderCode.create( gl, gl.GL_FRAGMENT_SHADER, 1, shaderRootClass,
shaderSrcRoot, shaderBinRoot, fragmentColorTextureFile);
shaderProgramColor = new ShaderProgram();
@@ -502,11 +523,11 @@ public class FixedFuncPipeline {
public static final FloatBuffer defMatEmission= BufferUtil.newFloatBuffer(new float[] { 0f, 0f, 0f, 1f});
public static final float defMatShininess = 0f;
- protected static final String vertexColorFile = "FixedFuncColor";
- protected static final String vertexColorLightFile = "FixedFuncColorLight";
- protected static final String fragmentColorFile = "FixedFuncColor";
- protected static final String fragmentColorTextureFile = "FixedFuncColorTexture";
- protected static final String shaderSrcRoot = "shader" ;
- protected static final String shaderBinRoot = "shader/bin" ;
+ protected static final String vertexColorFileDef = "FixedFuncColor";
+ protected static final String vertexColorLightFileDef = "FixedFuncColorLight";
+ protected static final String fragmentColorFileDef = "FixedFuncColor";
+ protected static final String fragmentColorTextureFileDef = "FixedFuncColorTexture";
+ protected static final String shaderSrcRootDef = "shader" ;
+ protected static final String shaderBinRootDef = "shader/bin" ;
}
diff --git a/src/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java b/src/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java
index e8d039d1e..218f904b3 100644
--- a/src/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java
+++ b/src/classes/com/sun/opengl/impl/glu/GLUquadricImpl.java
@@ -117,6 +117,7 @@ package com.sun.opengl.impl.glu;
import javax.media.opengl.util.ImmModeSink;
import javax.media.opengl.*;
+import javax.media.opengl.sub.*;
import javax.media.opengl.glu.*;
import java.nio.*;
@@ -1110,7 +1111,7 @@ public class GLUquadricImpl implements GLUquadric {
if(immModeSinkEnabled) {
immModeSink.glBegin(mode);
} else {
- ((GL2)gl).glBegin(mode);
+ gl.getGL2().glBegin(mode);
}
}
@@ -1118,7 +1119,7 @@ public class GLUquadricImpl implements GLUquadric {
if(immModeSinkEnabled) {
immModeSink.glEnd(gl, immModeSinkImmediate);
} else {
- ((GL2)gl).glEnd();
+ gl.getGL2().glEnd();
}
}
@@ -1126,7 +1127,7 @@ public class GLUquadricImpl implements GLUquadric {
if(immModeSinkEnabled) {
immModeSink.glVertex2f(x, y);
} else {
- ((GL2)gl).glVertex2f(x, y);
+ gl.getGL2().glVertex2f(x, y);
}
}
@@ -1134,7 +1135,7 @@ public class GLUquadricImpl implements GLUquadric {
if(immModeSinkEnabled) {
immModeSink.glVertex3f(x, y, z);
} else {
- ((GL2)gl).glVertex3f(x, y, z);
+ gl.getGL2().glVertex3f(x, y, z);
}
}
@@ -1145,7 +1146,7 @@ public class GLUquadricImpl implements GLUquadric {
if(immModeSinkEnabled) {
immModeSink.glNormal3s(a, b, c);
} else {
- ((GL2)gl).glNormal3s(a, b, c);
+ gl.getGL2().glNormal3s(a, b, c);
}
}
@@ -1156,7 +1157,7 @@ public class GLUquadricImpl implements GLUquadric {
if(immModeSinkEnabled) {
immModeSink.glNormal3b(a, b, c);
} else {
- ((GL2)gl).glNormal3b(a, b, c);
+ gl.getGL2().glNormal3b(a, b, c);
}
}
@@ -1166,7 +1167,7 @@ public class GLUquadricImpl implements GLUquadric {
if(immModeSinkEnabled) {
immModeSink.glNormal3f(x,y,z);
} else {
- ((GL2)gl).glNormal3f(x,y,z);
+ gl.getGL2().glNormal3f(x,y,z);
}
break;
case GL.GL_SHORT:
@@ -1182,7 +1183,7 @@ public class GLUquadricImpl implements GLUquadric {
if(immModeSinkEnabled) {
immModeSink.glTexCoord2f(x, y);
} else {
- ((GL2)gl).glTexCoord2f(x, y);
+ gl.getGL2().glTexCoord2f(x, y);
}
}
diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
index d99b237e5..9ee93793a 100644
--- a/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawableFactory.java
@@ -278,11 +278,11 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
int[] res = new int[MAX_ATTRIBS];
int idx = 0;
if (pbuffer) {
- res[idx++] = GLXExt.GLX_DRAWABLE_TYPE;
- res[idx++] = GLXExt.GLX_PBUFFER_BIT;
+ res[idx++] = GLX.GLX_DRAWABLE_TYPE;
+ res[idx++] = GLX.GLX_PBUFFER_BIT;
- res[idx++] = GLXExt.GLX_RENDER_TYPE;
- res[idx++] = GLXExt.GLX_RGBA_BIT;
+ res[idx++] = GLX.GLX_RENDER_TYPE;
+ res[idx++] = GLX.GLX_RGBA_BIT;
} else {
res[idx++] = GLX.GLX_RGBA;
}
@@ -334,9 +334,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
res[idx++] = caps.getAccumAlphaBits();
}
if (isMultisampleAvailable && caps.getSampleBuffers()) {
- res[idx++] = GLXExt.GLX_SAMPLE_BUFFERS;
+ res[idx++] = GLX.GLX_SAMPLE_BUFFERS;
res[idx++] = GL.GL_TRUE;
- res[idx++] = GLXExt.GLX_SAMPLES;
+ res[idx++] = GLX.GLX_SAMPLES;
res[idx++] = caps.getNumSamples();
}
if (pbuffer) {
@@ -411,11 +411,11 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
caps.setAccumAlphaBits(ivalues[i]);
break;
- case GLXExt.GLX_SAMPLE_BUFFERS:
+ case GLX.GLX_SAMPLE_BUFFERS:
caps.setSampleBuffers(ivalues[i] != GL.GL_FALSE);
break;
- case GLXExt.GLX_SAMPLES:
+ case GLX.GLX_SAMPLES:
caps.setNumSamples(ivalues[i]);
break;
diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java
index 23835f21b..ac228b68a 100644
--- a/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java
+++ b/src/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXDrawable.java
@@ -81,4 +81,14 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable {
protected void setChosenGLCapabilities(GLCapabilities caps) {
super.setChosenGLCapabilities(caps);
}
+
+ public void setRealized(boolean realized) {
+ if (realized) {
+ X11GLXDrawableFactory factory = (X11GLXDrawableFactory) getFactory();
+ NativeWindow window = getNativeWindow();
+ setChosenGLCapabilities(factory.lookupCapabilitiesByScreenAndVisualID(window.getScreenIndex(),
+ window.getVisualID()));
+ }
+ super.setRealized(realized);
+ }
}
diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java
index 377d92f98..a32ee99d7 100644
--- a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java
+++ b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXContext.java
@@ -83,7 +83,7 @@ public class X11PbufferGLXContext extends X11GLXContext {
}
}
context = GLX.glXCreateNewContext(drawable.getNativeWindow().getDisplayHandle(),
- drawable.getFBConfig(), GLXExt.GLX_RGBA_TYPE, share, true);
+ drawable.getFBConfig(), GLX.GLX_RGBA_TYPE, share, true);
if (context == 0) {
throw new GLException("pbuffer creation error: glXCreateNewContext() failed");
}
diff --git a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
index 390ca96a4..d720fe7e8 100644
--- a/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
+++ b/src/classes/com/sun/opengl/impl/x11/glx/X11PbufferGLXDrawable.java
@@ -149,9 +149,9 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
// Create the p-buffer.
int niattribs = 0;
- iattributes[niattribs++] = GLXExt.GLX_PBUFFER_WIDTH;
+ iattributes[niattribs++] = GLX.GLX_PBUFFER_WIDTH;
iattributes[niattribs++] = nw.getWidth();
- iattributes[niattribs++] = GLXExt.GLX_PBUFFER_HEIGHT;
+ iattributes[niattribs++] = GLX.GLX_PBUFFER_HEIGHT;
iattributes[niattribs++] = nw.getHeight();
iattributes[niattribs++] = 0;
@@ -167,8 +167,8 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
this.fbConfig = fbConfig;
// Pick innocent query values if multisampling or floating point buffers not available
- int sbAttrib = X11Util.isMultisampleAvailable() ? GLXExt.GLX_SAMPLE_BUFFERS: GLX.GLX_RED_SIZE;
- int samplesAttrib = X11Util.isMultisampleAvailable() ? GLXExt.GLX_SAMPLES: GLX.GLX_RED_SIZE;
+ int sbAttrib = X11Util.isMultisampleAvailable() ? GLX.GLX_SAMPLE_BUFFERS: GLX.GLX_RED_SIZE;
+ int samplesAttrib = X11Util.isMultisampleAvailable() ? GLX.GLX_SAMPLES: GLX.GLX_RED_SIZE;
int floatNV = capabilities.getPbufferFloatingPointBuffers() ? GLXExt.GLX_FLOAT_COMPONENTS_NV : GLX.GLX_RED_SIZE;
// Query the fbconfig to determine its GLCapabilities
@@ -196,9 +196,9 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable {
// Determine the actual width and height we were able to create.
int[] tmp = new int[1];
- GLX.glXQueryDrawable(display, drawable, GLXExt.GLX_WIDTH, tmp, 0);
+ GLX.glXQueryDrawable(display, drawable, GLX.GLX_WIDTH, tmp, 0);
int width = tmp[0];
- GLX.glXQueryDrawable(display, drawable, GLXExt.GLX_HEIGHT, tmp, 0);
+ GLX.glXQueryDrawable(display, drawable, GLX.GLX_HEIGHT, tmp, 0);
int height = tmp[0];
nw.setSize(width, height);
diff --git a/src/classes/com/sun/opengl/util/glsl/ShaderCode.java b/src/classes/com/sun/opengl/util/glsl/ShaderCode.java
index 8addf339c..288ef760b 100644
--- a/src/classes/com/sun/opengl/util/glsl/ShaderCode.java
+++ b/src/classes/com/sun/opengl/util/glsl/ShaderCode.java
@@ -51,7 +51,9 @@ public class ShaderCode {
id = getNextID();
}
- public static ShaderCode create(int type, int number, Class context, String[] sourceFiles) {
+ public static ShaderCode create(GL2ES2 gl, int type, int number, Class context, String[] sourceFiles) {
+ if(!gl.glShaderCompilerAvailable()) return null;
+
String[][] shaderSources = null;
if(null!=sourceFiles) {
shaderSources = new String[sourceFiles.length][1];
@@ -112,7 +114,7 @@ public class ShaderCode {
String srcPath[] = new String[1];
srcFileName = srcRoot + '/' + basename + "." + getFileSuffix(false, type);
srcPath[0] = srcFileName;
- res = create(type, number, context, srcPath);
+ res = create(gl, type, number, context, srcPath);
if(null!=res) {
return res;
}
@@ -134,6 +136,61 @@ public class ShaderCode {
return res;
}
+ public static boolean createAndLoadShader(GL2ES2 gl, IntBuffer shader, int shaderType,
+ int binFormat, java.nio.Buffer bin,
+ PrintStream verboseOut)
+ {
+ int err = gl.glGetError(); // flush previous errors ..
+ if(err!=GL.GL_NO_ERROR && null!=verboseOut) {
+ verboseOut.println("createAndLoadShader: Pre GL Error: 0x"+Integer.toHexString(err));
+ }
+
+ gl.glCreateShader(shaderType, shader);
+ err = gl.glGetError();
+ if(err!=GL.GL_NO_ERROR) {
+ throw new GLException("createAndLoadShader: CreateShader failed, GL Error: 0x"+Integer.toHexString(err));
+ }
+
+
+ gl.glShaderBinary(shader, binFormat, bin);
+
+ err = gl.glGetError();
+ if(err!=GL.GL_NO_ERROR && null!=verboseOut) {
+ verboseOut.println("createAndLoadShader: ShaderBinary failed, GL Error: 0x"+Integer.toHexString(err));
+ }
+ return err == GL.GL_NO_ERROR;
+ }
+
+ public static boolean createAndCompileShader(GL2ES2 gl, IntBuffer shader, int shaderType,
+ java.lang.String[][] sources,
+ PrintStream verboseOut)
+ {
+ int err = gl.glGetError(); // flush previous errors ..
+ if(err!=GL.GL_NO_ERROR && null!=verboseOut) {
+ verboseOut.println("createAndCompileShader: Pre GL Error: 0x"+Integer.toHexString(err));
+ }
+
+ gl.glCreateShader(shaderType, shader);
+ err = gl.glGetError();
+ if(err!=GL.GL_NO_ERROR) {
+ throw new GLException("createAndCompileShader: CreateShader failed, GL Error: 0x"+Integer.toHexString(err));
+ }
+
+ gl.glShaderSource(shader, sources);
+ err = gl.glGetError();
+ if(err!=GL.GL_NO_ERROR) {
+ throw new GLException("createAndCompileShader: ShaderSource failed, GL Error: 0x"+Integer.toHexString(err));
+ }
+
+ gl.glCompileShader(shader);
+ err = gl.glGetError();
+ if(err!=GL.GL_NO_ERROR && null!=verboseOut) {
+ verboseOut.println("createAndCompileShader: CompileShader failed, GL Error: 0x"+Integer.toHexString(err));
+ }
+
+ return gl.glIsShaderStatusValid(shader, gl.GL_COMPILE_STATUS, verboseOut) && err == GL.GL_NO_ERROR;
+ }
+
/**
* returns the uniq shader id as an integer
* @see #key()
@@ -176,11 +233,11 @@ public class ShaderCode {
// Create & Compile the vertex/fragment shader objects
if(null!=shaderSource) {
- valid=gl.glCreateCompileShader(shader, shaderType,
- shaderSource, verboseOut);
+ valid=createAndCompileShader(gl, shader, shaderType,
+ shaderSource, verboseOut);
} else if(null!=shaderBinary) {
- valid=gl.glCreateLoadShader(shader, shaderType,
- shaderBinaryFormat, shaderBinary, verboseOut);
+ valid=createAndLoadShader(gl, shader, shaderType,
+ shaderBinaryFormat, shaderBinary, verboseOut);
} else {
throw new GLException("no code (source or binary)");
}
diff --git a/src/classes/com/sun/opengl/util/glsl/fixed/FixedFuncHook.java b/src/classes/com/sun/opengl/util/glsl/fixed/FixedFuncHook.java
new file mode 100755
index 000000000..d4b3be046
--- /dev/null
+++ b/src/classes/com/sun/opengl/util/glsl/fixed/FixedFuncHook.java
@@ -0,0 +1,333 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
+package com.sun.opengl.util.glsl.fixed;
+
+import javax.media.opengl.*;
+import javax.media.opengl.sub.*;
+import javax.media.opengl.sub.fixed.*;
+import javax.media.opengl.util.*;
+import javax.media.opengl.glu.*;
+import com.sun.gluegen.runtime.BufferFactory;
+import com.sun.opengl.util.glsl.*;
+import com.sun.opengl.impl.glsl.fixed.*;
+import java.nio.*;
+
+public class FixedFuncHook implements GLFixedFuncHookIf {
+ public static final int MAX_TEXTURE_UNITS = 8;
+
+ protected FixedFuncPipeline fixedFunction=null;
+ protected PMVMatrix pmvMatrix=null;
+ protected GL2ES2 gl=null;
+
+ public FixedFuncHook (GL2ES2 gl) {
+ this(gl, null);
+ }
+
+ public FixedFuncHook (GL2ES2 gl, PMVMatrix matrix) {
+ this.gl = gl;
+ pmvMatrix = (null!=matrix)?matrix:new PMVMatrix();
+
+ fixedFunction = new FixedFuncPipeline(gl, pmvMatrix);
+ }
+
+ public FixedFuncHook(GL2ES2 gl, PMVMatrix matrix,
+ Class shaderRootClass, String shaderSrcRoot, String shaderBinRoot,
+ String vertexColorFile,
+ String vertexColorLightFile,
+ String fragmentColorFile,
+ String fragmentColorTextureFile) {
+ this.gl = gl;
+ pmvMatrix = matrix;
+
+ fixedFunction = new FixedFuncPipeline(gl, pmvMatrix,
+ shaderRootClass, shaderSrcRoot, shaderBinRoot,
+ vertexColorFile, vertexColorLightFile, fragmentColorFile, fragmentColorTextureFile);
+ }
+
+ public void dispose() {
+ fixedFunction.release(gl);
+ fixedFunction = null;
+ }
+
+ public PMVMatrix getMatrix() { return pmvMatrix; }
+
+ //
+ // FixedFuncHookIf - hooks
+ //
+ public void glDrawArrays(int mode, int first, int count) {
+ fixedFunction.validate(gl);
+ gl.glDrawArrays(mode, first, count);
+ }
+ public void glDrawElements(int mode, int count, int type, java.nio.Buffer indices) {
+ fixedFunction.validate(gl);
+ gl.glDrawElements(mode, count, type, indices);
+ }
+ public void glDrawElements(int mode, int count, int type, long indices_buffer_offset) {
+ fixedFunction.validate(gl);
+ gl.glDrawElements(mode, count, type, indices_buffer_offset);
+ }
+
+ public void glActiveTexture(int texture) {
+ fixedFunction.glActiveTexture(gl, texture);
+ gl.glActiveTexture(texture);
+ }
+ public void glEnable(int cap) {
+ if(fixedFunction.glEnable(gl, cap, true)) {
+ gl.glEnable(cap);
+ }
+ }
+ public void glDisable(int cap) {
+ if(fixedFunction.glEnable(gl, cap, false)) {
+ gl.glDisable(cap);
+ }
+ }
+ public void glCullFace(int faceName) {
+ fixedFunction.glCullFace(gl, faceName);
+ gl.glCullFace(faceName);
+ }
+
+ public void glGetFloatv(int pname, java.nio.FloatBuffer params) {
+ if(pmvMatrix.isMatrixGetName(pname)) {
+ pmvMatrix.glGetFloatv(pname, params);
+ return;
+ }
+ gl.glGetFloatv(pname, params);
+ }
+ public void glGetFloatv(int pname, float[] params, int params_offset) {
+ if(pmvMatrix.isMatrixGetName(pname)) {
+ pmvMatrix.glGetFloatv(pname, params, params_offset);
+ return;
+ }
+ gl.glGetFloatv(pname, params, params_offset);
+ }
+ public void glGetIntegerv(int pname, IntBuffer params) {
+ if(pmvMatrix.isMatrixGetName(pname)) {
+ pmvMatrix.glGetIntegerv(pname, params);
+ return;
+ }
+ gl.glGetIntegerv(pname, params);
+ }
+ public void glGetIntegerv(int pname, int[] params, int params_offset) {
+ if(pmvMatrix.isMatrixGetName(pname)) {
+ pmvMatrix.glGetIntegerv(pname, params, params_offset);
+ return;
+ }
+ gl.glGetIntegerv(pname, params, params_offset);
+ }
+
+ //
+ // MatrixIf
+ //
+ public int glGetMatrixMode() {
+ return pmvMatrix.glGetMatrixMode();
+ }
+ public void glMatrixMode(int mode) {
+ pmvMatrix.glMatrixMode(mode);
+ }
+ public void glLoadMatrixf(java.nio.FloatBuffer m) {
+ pmvMatrix.glLoadMatrixf(m);
+ }
+ public void glLoadMatrixf(float[] m, int m_offset) {
+ glLoadMatrixf(BufferUtil.newFloatBuffer(m, m_offset));
+ }
+ public void glPopMatrix() {
+ pmvMatrix.glPopMatrix();
+ }
+ public void glPushMatrix() {
+ pmvMatrix.glPushMatrix();
+ }
+ public void glLoadIdentity() {
+ pmvMatrix.glLoadIdentity();
+ }
+ public void glMultMatrixf(java.nio.FloatBuffer m) {
+ pmvMatrix.glMultMatrixf(m);
+ }
+ public void glMultMatrixf(float[] m, int m_offset) {
+ glMultMatrixf(BufferUtil.newFloatBuffer(m, m_offset));
+ }
+ public void glTranslatef(float x, float y, float z) {
+ pmvMatrix.glTranslatef(x, y, z);
+ }
+ public void glRotatef(float angdeg, float x, float y, float z) {
+ pmvMatrix.glRotatef(angdeg, x, y, z);
+ }
+ public void glScalef(float x, float y, float z) {
+ pmvMatrix.glScalef(x, y, z);
+ }
+ public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) {
+ pmvMatrix.glOrthof(left, right, bottom, top, zNear, zFar);
+ }
+ public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) {
+ pmvMatrix.glFrustumf(left, right, bottom, top, zNear, zFar);
+ }
+
+ //
+ // LightingIf
+ //
+ public void glColor4f(float red, float green, float blue, float alpha) {
+ fixedFunction.glColor4fv(gl, BufferUtil.newFloatBuffer(new float[] { red, green, blue, alpha }));
+ }
+
+ public void glLightfv(int light, int pname, java.nio.FloatBuffer params) {
+ fixedFunction.glLightfv(gl, light, pname, params);
+ }
+ public void glLightfv(int light, int pname, float[] params, int params_offset) {
+ glLightfv(light, pname, BufferUtil.newFloatBuffer(params, params_offset));
+ }
+ public void glMaterialfv(int face, int pname, java.nio.FloatBuffer params) {
+ fixedFunction.glMaterialfv(gl, face, pname, params);
+ }
+ public void glMaterialfv(int face, int pname, float[] params, int params_offset) {
+ glMaterialfv(face, pname, BufferUtil.newFloatBuffer(params, params_offset));
+ }
+ public void glMaterialf(int face, int pname, float param) {
+ glMaterialfv(face, pname, BufferUtil.newFloatBuffer(new float[] { param }));
+ }
+ public void glShadeModel(int mode) {
+ fixedFunction.glShadeModel(gl, mode);
+ }
+
+ //
+ // PointerIf
+ //
+ public void glEnableClientState(int glArrayIndex) {
+ fixedFunction.glEnableClientState(gl, glArrayIndex);
+ }
+ public void glDisableClientState(int glArrayIndex) {
+ fixedFunction.glDisableClientState(gl, glArrayIndex);
+ }
+
+ public void glVertexPointer(GLArrayData array) {
+ if(array.isVBO()) {
+ if(!gl.glIsVBOArrayEnabled()) {
+ throw new GLException("VBO array is not enabled: "+array);
+ }
+ } else {
+ if(gl.glIsVBOArrayEnabled()) {
+ throw new GLException("VBO array is not disabled: "+array);
+ }
+ BufferFactory.rangeCheck(array.getBuffer(), 1);
+ if (!BufferFactory.isDirect(array.getBuffer())) {
+ throw new GLException("Argument \"pointer\" was not a direct buffer"); }
+ }
+ fixedFunction.glVertexPointer(gl, array);
+ }
+
+ public void glVertexPointer(int size, int type, int stride, java.nio.Buffer pointer) {
+ glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, false, stride, pointer, 0, 0));
+ }
+ public void glVertexPointer(int size, int type, int stride, long pointer_buffer_offset) {
+ int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
+ if(vboName==0) {
+ throw new GLException("no GL_ARRAY_BUFFER VBO bound");
+ }
+ glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, false,
+ stride, null, vboName, pointer_buffer_offset));
+ }
+
+ public void glColorPointer(GLArrayData array) {
+ if(array.isVBO()) {
+ if(!gl.glIsVBOArrayEnabled()) {
+ throw new GLException("VBO array is not enabled: "+array);
+ }
+ } else {
+ if(gl.glIsVBOArrayEnabled()) {
+ throw new GLException("VBO array is not disabled: "+array);
+ }
+ BufferFactory.rangeCheck(array.getBuffer(), 1);
+ if (!BufferFactory.isDirect(array.getBuffer())) {
+ throw new GLException("Argument \"pointer\" was not a direct buffer"); }
+ }
+ fixedFunction.glColorPointer(gl, array);
+ }
+ public void glColorPointer(int size, int type, int stride, java.nio.Buffer pointer) {
+ glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, false,
+ stride, pointer, 0, 0));
+ }
+ public void glColorPointer(int size, int type, int stride, long pointer_buffer_offset) {
+ int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
+ if(vboName==0) {
+ throw new GLException("no GL_ARRAY_BUFFER VBO bound");
+ }
+ glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, false,
+ stride, null, vboName, pointer_buffer_offset));
+ }
+
+ public void glNormalPointer(GLArrayData array) {
+ if(array.getComponentNumber()!=3) {
+ throw new GLException("Only 3 components per normal allowed");
+ }
+ if(array.isVBO()) {
+ if(!gl.glIsVBOArrayEnabled()) {
+ throw new GLException("VBO array is not enabled: "+array);
+ }
+ } else {
+ if(gl.glIsVBOArrayEnabled()) {
+ throw new GLException("VBO array is not disabled: "+array);
+ }
+ BufferFactory.rangeCheck(array.getBuffer(), 1);
+ if (!BufferFactory.isDirect(array.getBuffer())) {
+ throw new GLException("Argument \"pointer\" was not a direct buffer"); }
+ }
+ fixedFunction.glNormalPointer(gl, array);
+ }
+ public void glNormalPointer(int type, int stride, java.nio.Buffer pointer) {
+ glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, false,
+ stride, pointer, 0, 0));
+ }
+ public void glNormalPointer(int type, int stride, long pointer_buffer_offset) {
+ int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
+ if(vboName==0) {
+ throw new GLException("no GL_ARRAY_BUFFER VBO bound");
+ }
+ glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, false,
+ stride, null, vboName, pointer_buffer_offset));
+ }
+
+ public void glTexCoordPointer(GLArrayData array) {
+ if(array.isVBO()) {
+ if(!gl.glIsVBOArrayEnabled()) {
+ throw new GLException("VBO array is not enabled: "+array);
+ }
+ } else {
+ if(gl.glIsVBOArrayEnabled()) {
+ throw new GLException("VBO array is not disabled: "+array);
+ }
+ BufferFactory.rangeCheck(array.getBuffer(), 1);
+ if (!BufferFactory.isDirect(array.getBuffer())) {
+ throw new GLException("Argument \"pointer\" was not a direct buffer"); }
+ }
+ fixedFunction.glTexCoordPointer(gl, array);
+ }
+ public void glTexCoordPointer(int size, int type, int stride, java.nio.Buffer pointer) {
+ glTexCoordPointer(
+ GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, false, stride, pointer, 0,0));
+ }
+ public void glTexCoordPointer(int size, int type, int stride, long pointer_buffer_offset) {
+ int vboName = gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER);
+ if(vboName==0) {
+ throw new GLException("no GL_ARRAY_BUFFER VBO bound");
+ }
+ glTexCoordPointer(
+ GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, false,
+ stride, null, vboName, pointer_buffer_offset) );
+ }
+
+ public final String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append(getClass().getName()+" (");
+ if(null!=pmvMatrix) {
+ buf.append(", matrixDirty: "+pmvMatrix.isDirty());
+ }
+ buf.append("\n\t, FixedFunction: "+fixedFunction);
+ buf.append(gl);
+ buf.append(" )");
+
+ return buf.toString();
+ }
+
+}
+
+
diff --git a/src/classes/javax/media/opengl/GLAutoDrawable.java b/src/classes/javax/media/opengl/GLAutoDrawable.java
index d4aff9107..743cbc143 100644
--- a/src/classes/javax/media/opengl/GLAutoDrawable.java
+++ b/src/classes/javax/media/opengl/GLAutoDrawable.java
@@ -56,9 +56,15 @@ public interface GLAutoDrawable extends GLDrawable {
/**
* Returns the context associated with this drawable. The returned
* context will be synchronized.
+ * Don't rely on it's identity, the context may change.
*/
public GLContext getContext();
+ /**
+ * Associate a new context to this drawable.
+ */
+ public void setContext(GLContext context);
+
/** Adds a {@link GLEventListener} to this drawable. If multiple
listeners are added to a given drawable, they are notified of
events in an arbitrary order. */
diff --git a/src/classes/javax/media/opengl/GLContext.java b/src/classes/javax/media/opengl/GLContext.java
index ae9c11786..57569af2a 100644
--- a/src/classes/javax/media/opengl/GLContext.java
+++ b/src/classes/javax/media/opengl/GLContext.java
@@ -39,6 +39,10 @@
package javax.media.opengl;
+import com.sun.opengl.impl.Debug;
+import javax.media.opengl.sub.fixed.*;
+import java.util.HashMap;
+
/** Abstraction for an OpenGL rendering context. In order to perform
OpenGL rendering, a context must be "made current" on the current
thread. OpenGL rendering semantics specify that only one context
@@ -53,6 +57,8 @@ package javax.media.opengl;
refer to a given context. */
public abstract class GLContext {
+ protected static final boolean DEBUG = Debug.debug("GLContext");
+
/** Indicates that the context was not made current during the last call to {@link #makeCurrent makeCurrent}. */
public static final int CONTEXT_NOT_CURRENT = 0;
/** Indicates that the context was made current during the last call to {@link #makeCurrent makeCurrent}. */
@@ -62,6 +68,8 @@ public abstract class GLContext {
private static ThreadLocal currentContext = new ThreadLocal();
+ private HashMap/*<int, Object>*/ attachedObjects = new HashMap();
+
/**
* Returns the GLDrawable to which this context may be used to
* draw.
@@ -158,6 +166,11 @@ public abstract class GLContext {
* new GLContext implementations; not for use by end users.
*/
protected static void setCurrent(GLContext cur) {
+ if(DEBUG) {
+ Exception e = new Exception("setCurrent: "+Thread.currentThread()+", "+currentContext.get()+" -> "+cur);
+ e.printStackTrace();
+ }
+
currentContext.set(cur);
}
@@ -188,6 +201,21 @@ public abstract class GLContext {
*/
public abstract void setGL(GL gl);
+ /**
+ * Returns the attached user object for the given name to this GLContext/GL.
+ */
+ public Object getAttachedObject(int name) {
+ return attachedObjects.get(new Integer(name));
+ }
+
+ /**
+ * Sets the attached user object for the given name to this GLContext/GL.
+ * Returns the previous set object or null.
+ */
+ public Object putAttachedObject(int name, Object obj) {
+ return attachedObjects.put(new Integer(name), obj);
+ }
+
public final String toString() {
return "GLContext: "+getClass().getName()+
"(GL: "+getGL().getClass().getName()+","+
@@ -207,28 +235,28 @@ public abstract class GLContext {
* Useful for uniq mapping of canonical array index names as listed.
*
* @see #mgl_Vertex
- * @see javax.media.opengl.GL#GL_VERTEX_ARRAY
+ * @see javax.media.opengl.sub.fixed.GLPointerIf#GL_VERTEX_ARRAY
* @see #mgl_Normal
- * @see javax.media.opengl.GL#GL_NORMAL_ARRAY
+ * @see javax.media.opengl.sub.fixed.GLPointerIf#GL_NORMAL_ARRAY
* @see #mgl_Color
- * @see javax.media.opengl.GL#GL_COLOR_ARRAY
+ * @see javax.media.opengl.sub.fixed.GLPointerIf#GL_COLOR_ARRAY
* @see #mgl_MultiTexCoord
- * @see javax.media.opengl.GL#GL_TEXTURE_COORD_ARRAY
- * @see javax.media.opengl.GL#glEnableClientState
- * @see javax.media.opengl.GL#glVertexPointer
- * @see javax.media.opengl.GL#glColorPointer
- * @see javax.media.opengl.GL#glNormalPointer
- * @see javax.media.opengl.GL#glTexCoordPointer
+ * @see javax.media.opengl.sub.fixed.GLPointerIf#GL_TEXTURE_COORD_ARRAY
+ * @see javax.media.opengl.sub.fixed.GLPointerIf#glEnableClientState
+ * @see javax.media.opengl.sub.fixed.GLPointerIf#glVertexPointer
+ * @see javax.media.opengl.sub.fixed.GLPointerIf#glColorPointer
+ * @see javax.media.opengl.sub.fixed.GLPointerIf#glNormalPointer
+ * @see javax.media.opengl.sub.fixed.GLPointerIf#glTexCoordPointer
*/
public static String getPredefinedArrayIndexName(int glArrayIndex) {
switch(glArrayIndex) {
- case GL.GL_VERTEX_ARRAY:
+ case GLPointerIf.GL_VERTEX_ARRAY:
return mgl_Vertex;
- case GL.GL_NORMAL_ARRAY:
+ case GLPointerIf.GL_NORMAL_ARRAY:
return mgl_Normal;
- case GL.GL_COLOR_ARRAY:
+ case GLPointerIf.GL_COLOR_ARRAY:
return mgl_Color;
- case GL.GL_TEXTURE_COORD_ARRAY:
+ case GLPointerIf.GL_TEXTURE_COORD_ARRAY:
return mgl_MultiTexCoord;
}
return null;
diff --git a/src/classes/javax/media/opengl/GLProfile.java b/src/classes/javax/media/opengl/GLProfile.java
index 0d1c73d07..a6a51862a 100644
--- a/src/classes/javax/media/opengl/GLProfile.java
+++ b/src/classes/javax/media/opengl/GLProfile.java
@@ -36,6 +36,7 @@
package javax.media.opengl;
+import javax.media.opengl.sub.fixed.*;
import java.lang.reflect.*;
import java.security.*;
import com.sun.opengl.impl.*;
@@ -299,8 +300,8 @@ public class GLProfile {
return false;
}
switch(index) {
- case GL.GL_VERTEX_ARRAY:
- case GL.GL_TEXTURE_COORD_ARRAY:
+ case GLPointerIf.GL_VERTEX_ARRAY:
+ case GLPointerIf.GL_TEXTURE_COORD_ARRAY:
switch(type) {
case GL.GL_BYTE:
case GL.GL_SHORT:
@@ -326,7 +327,7 @@ public class GLProfile {
return false;
}
break;
- case GL.GL_NORMAL_ARRAY:
+ case GLPointerIf.GL_NORMAL_ARRAY:
switch(type) {
case GL.GL_BYTE:
case GL.GL_SHORT:
@@ -350,7 +351,7 @@ public class GLProfile {
return false;
}
break;
- case GL.GL_COLOR_ARRAY:
+ case GLPointerIf.GL_COLOR_ARRAY:
switch(type) {
case GL.GL_UNSIGNED_BYTE:
case GL.GL_FIXED:
@@ -437,7 +438,7 @@ public class GLProfile {
}
} else {
switch(index) {
- case GL.GL_VERTEX_ARRAY:
+ case GLPointerIf.GL_VERTEX_ARRAY:
switch(type) {
case GL.GL_SHORT:
case GL.GL_FLOAT:
@@ -463,7 +464,7 @@ public class GLProfile {
return false;
}
break;
- case GL.GL_NORMAL_ARRAY:
+ case GLPointerIf.GL_NORMAL_ARRAY:
switch(type) {
case GL.GL_BYTE:
case GL.GL_SHORT:
@@ -488,7 +489,7 @@ public class GLProfile {
return false;
}
break;
- case GL.GL_COLOR_ARRAY:
+ case GLPointerIf.GL_COLOR_ARRAY:
switch(type) {
case GL.GL_UNSIGNED_BYTE:
case GL.GL_BYTE:
@@ -517,7 +518,7 @@ public class GLProfile {
return false;
}
break;
- case GL.GL_TEXTURE_COORD_ARRAY:
+ case GLPointerIf.GL_TEXTURE_COORD_ARRAY:
switch(type) {
case GL.GL_SHORT:
case GL.GL_FLOAT:
diff --git a/src/classes/javax/media/opengl/NativeWindowFactory.java b/src/classes/javax/media/opengl/NativeWindowFactory.java
index 18ce61974..b80e239ea 100644
--- a/src/classes/javax/media/opengl/NativeWindowFactory.java
+++ b/src/classes/javax/media/opengl/NativeWindowFactory.java
@@ -85,8 +85,7 @@ public abstract class NativeWindowFactory {
Constructor factoryConstructor =
GLReflection.getConstructor("com.sun.opengl.impl.x11.glx.awt.X11AWTGLXNativeWindowFactory", new Class[] {});
factory = (NativeWindowFactory) factoryConstructor.newInstance(null);
- } catch (Exception e) {
- }
+ } catch (Exception e) { }
}
registerFactory(componentClass, factory);
defaultFactory = factory;
diff --git a/src/classes/javax/media/opengl/awt/GLCanvas.java b/src/classes/javax/media/opengl/awt/GLCanvas.java
index bce58be0f..e0d997dc5 100644
--- a/src/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/classes/javax/media/opengl/awt/GLCanvas.java
@@ -373,6 +373,10 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
drawableHelper.removeGLEventListener(listener);
}
+ public void setContext(GLContext ctx) {
+ context=(GLContextImpl)ctx;
+ }
+
public GLContext getContext() {
return context;
}
diff --git a/src/classes/javax/media/opengl/awt/GLJPanel.java b/src/classes/javax/media/opengl/awt/GLJPanel.java
index d5f44ff21..37f1dfa7b 100644
--- a/src/classes/javax/media/opengl/awt/GLJPanel.java
+++ b/src/classes/javax/media/opengl/awt/GLJPanel.java
@@ -324,6 +324,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
public void setRealized(boolean realized) {
}
+ public void setContext(GLContext ctx) {
+ if (backend == null) {
+ return;
+ }
+ backend.setContext(ctx);
+ }
+
public GLContext getContext() {
if (backend == null) {
return null;
@@ -565,6 +572,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
// this GLJPanel
public GLContext createContext(GLContext shareWith);
+ // Called to set the current backend's GLContext
+ public void setContext(GLContext ctx);
+
// Called to get the current backend's GLContext
public GLContext getContext();
@@ -797,6 +807,10 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
return offscreenDrawable.createContext(shareWith);
}
+ public void setContext(GLContext ctx) {
+ offscreenContext=(GLContextImpl)ctx;
+ }
+
public GLContext getContext() {
return offscreenContext;
}
@@ -873,6 +887,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
return pbuffer.createContext(shareWith);
}
+ public void setContext(GLContext ctx) {
+ if (pbuffer == null && Beans.isDesignTime()) {
+ return;
+ }
+ pbuffer.setContext(ctx);
+ }
+
public GLContext getContext() {
// Workaround for crashes in NetBeans GUI builder
if (pbuffer == null && Beans.isDesignTime()) {
@@ -1040,6 +1061,10 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable {
throw new GLException("Not yet implemented");
}
+ public void setContext(GLContext ctx) {
+ joglContext=ctx;
+ }
+
public GLContext getContext() {
return joglContext;
}
diff --git a/src/classes/javax/media/opengl/sub/GLObject.java b/src/classes/javax/media/opengl/sub/GLObject.java
new file mode 100644
index 000000000..1426f75d1
--- /dev/null
+++ b/src/classes/javax/media/opengl/sub/GLObject.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
+package javax.media.opengl.sub;
+
+import java.nio.*;
+
+import javax.media.opengl.*;
+
+/**
+ * GLObject specifies the GL profile related implementations
+ * and it's composition with GLContext, which is a lifetime one.
+ */
+public interface GLObject {
+
+ public boolean isGL();
+
+ public boolean isGL2();
+
+ public boolean isGLES1();
+
+ public boolean isGLES2();
+
+ public boolean isGLES();
+
+ public boolean isGL2ES1();
+
+ public boolean isGL2ES2();
+
+ /**
+ * @return This object cast to GL
+ * @throws GLException is this GLObject is not a GL implementation
+ */
+ public GL getGL() throws GLException;
+
+ /**
+ * @return This object cast to GL2
+ * @throws GLException is this GLObject is not a GL2 implementation
+ */
+ public GL2 getGL2() throws GLException;
+
+ /**
+ * @return This object cast to GLES1
+ * @throws GLException is this GLObject is not a GLES1 implementation
+ */
+ public GLES1 getGLES1() throws GLException;
+
+ /**
+ * @return This object cast to GLES2
+ * @throws GLException is this GLObject is not a GLES2 implementation
+ */
+ public GLES2 getGLES2() throws GLException;
+
+ /**
+ * @return This object cast to GL2ES1
+ * @throws GLException is this GLObject is not a GL2ES1 implementation
+ */
+ public GL2ES1 getGL2ES1() throws GLException;
+
+ /**
+ * @return This object cast to GL2ES2
+ * @throws GLException is this GLObject is not a GL2ES2 implementation
+ */
+ public GL2ES2 getGL2ES2() throws GLException;
+
+ public String toString();
+
+ /**
+ * @return This GL object's bound GLContext
+ */
+ public GLContext getContext();
+
+}
+
diff --git a/src/classes/javax/media/opengl/sub/fixed/GLFixedFuncHookIf.java b/src/classes/javax/media/opengl/sub/fixed/GLFixedFuncHookIf.java
new file mode 100644
index 000000000..05e0f2ca7
--- /dev/null
+++ b/src/classes/javax/media/opengl/sub/fixed/GLFixedFuncHookIf.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
+package javax.media.opengl.sub.fixed;
+
+import java.nio.*;
+
+import javax.media.opengl.*;
+import javax.media.opengl.sub.*;
+
+/**
+ * Fixed function implementation hook interface<p>
+ *
+ * An implementation shall implement the below interface methods
+ * and pipeline the call to the underlying GL impl. if necessary. <p>
+ *
+ * An implementation must implement all extended interface methods. <p>
+ */
+public interface GLFixedFuncHookIf extends GLLightingIf, GLMatrixIf, GLPointerIf {
+ public void glDrawArrays(int mode, int first, int count) ;
+ public void glDrawElements(int mode, int count, int type, java.nio.Buffer indices) ;
+ public void glDrawElements(int mode, int count, int type, long indices_buffer_offset) ;
+ public void glActiveTexture(int texture) ;
+ public void glEnable(int cap) ;
+ public void glDisable(int cap) ;
+ public void glCullFace(int faceName) ;
+ public void glGetFloatv(int pname, java.nio.FloatBuffer params) ;
+ public void glGetFloatv(int pname, float[] params, int params_offset) ;
+ public void glGetIntegerv(int pname, IntBuffer params) ;
+ public void glGetIntegerv(int pname, int[] params, int params_offset) ;
+}
+
diff --git a/src/classes/javax/media/opengl/sub/fixed/GLFixedFuncIf.java b/src/classes/javax/media/opengl/sub/fixed/GLFixedFuncIf.java
new file mode 100644
index 000000000..cc3e299e8
--- /dev/null
+++ b/src/classes/javax/media/opengl/sub/fixed/GLFixedFuncIf.java
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
+package javax.media.opengl.sub.fixed;
+
+import java.nio.*;
+
+import javax.media.opengl.*;
+import javax.media.opengl.sub.*;
+
+/**
+ * GL Fixed function module interface
+ *
+ */
+public interface GLFixedFuncIf extends GL, GLFixedFuncHookIf, GLLightingIf, GLMatrixIf, GLPointerIf {
+}
+
diff --git a/src/classes/javax/media/opengl/sub/fixed/GLFixedFuncUtil.java b/src/classes/javax/media/opengl/sub/fixed/GLFixedFuncUtil.java
new file mode 100644
index 000000000..4c0d1b87f
--- /dev/null
+++ b/src/classes/javax/media/opengl/sub/fixed/GLFixedFuncUtil.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
+package javax.media.opengl.sub.fixed;
+
+import javax.media.opengl.*;
+import javax.media.opengl.sub.*;
+
+/**
+ * Contains values to handle the fixed implementation.
+ */
+public class GLFixedFuncUtil {
+
+ /**
+ * @return The current GLContext's GL object cast as GLFixedFuncIf
+ * @throws GLException is this GL Object is not a GLFixedFuncIf implementation,
+ * or no GLContext is current
+ */
+ public static final GLFixedFuncIf getCurrentGLFixedFuncIf() throws GLException {
+ GLContext curContext = GLContext.getCurrent();
+ if (curContext == null) {
+ throw new GLException("No OpenGL context current on this thread");
+ }
+ GL gl = curContext.getGL();
+ if(gl instanceof GLFixedFuncIf) {
+ return (GLFixedFuncIf) gl;
+ }
+ throw new GLException("Not a GLFixedFuncIf implementation");
+ }
+
+ /**
+ * @return true if GL object is a GLFixedFuncIf
+ */
+ public static final boolean isGLFixedFuncIf(GL gl) {
+ return (gl instanceof GLFixedFuncIf) ;
+ }
+
+ /**
+ * @return The object cast as GLFixedFuncIf
+ * @throws GLException is this GL Object is not a GLFixedFuncIf implementation
+ */
+ public static final GLFixedFuncIf getGLFixedFuncIf(GL gl) {
+ if(gl instanceof GLFixedFuncIf) {
+ return (GLFixedFuncIf) gl;
+ }
+ throw new GLException("Not a GLFixedFuncIf implementation");
+ }
+}
+
diff --git a/src/classes/javax/media/opengl/sub/fixed/GLLightingIf.java b/src/classes/javax/media/opengl/sub/fixed/GLLightingIf.java
new file mode 100644
index 000000000..1f3aa9ab7
--- /dev/null
+++ b/src/classes/javax/media/opengl/sub/fixed/GLLightingIf.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
+package javax.media.opengl.sub.fixed;
+
+import java.nio.*;
+
+import javax.media.opengl.*;
+import javax.media.opengl.sub.*;
+
+public interface GLLightingIf {
+ public static final int GL_LIGHT0 = 0x4000;
+ public static final int GL_LIGHT1 = 0x4001;
+ public static final int GL_LIGHT2 = 0x4002;
+ public static final int GL_LIGHT3 = 0x4003;
+ public static final int GL_LIGHT4 = 0x4004;
+ public static final int GL_LIGHT5 = 0x4005;
+ public static final int GL_LIGHT6 = 0x4006;
+ public static final int GL_LIGHT7 = 0x4007;
+ public static final int GL_LIGHTING = 0xB50;
+ public static final int GL_AMBIENT = 0x1200;
+ public static final int GL_DIFFUSE = 0x1201;
+ public static final int GL_SPECULAR = 0x1202;
+ public static final int GL_POSITION = 0x1203;
+ public static final int GL_SPOT_DIRECTION = 0x1204;
+ public static final int GL_SPOT_EXPONENT = 0x1205;
+ public static final int GL_SPOT_CUTOFF = 0x1206;
+ public static final int GL_CONSTANT_ATTENUATION = 0x1207;
+ public static final int GL_LINEAR_ATTENUATION = 0x1208;
+ public static final int GL_QUADRATIC_ATTENUATION = 0x1209;
+ public static final int GL_EMISSION = 0x1600;
+ public static final int GL_SHININESS = 0x1601;
+ public static final int GL_AMBIENT_AND_DIFFUSE = 0x1602;
+ public static final int GL_COLOR_MATERIAL = 0xB57;
+ public static final int GL_NORMALIZE = 0xBA1;
+
+ public static final int GL_FLAT = 0x1D00;
+ public static final int GL_SMOOTH = 0x1D01;
+
+ public void glLightfv(int light, int pname, java.nio.FloatBuffer params);
+ public void glLightfv(int light, int pname, float[] params, int params_offset);
+ public void glMaterialf(int face, int pname, float param);
+ public void glMaterialfv(int face, int pname, java.nio.FloatBuffer params);
+ public void glMaterialfv(int face, int pname, float[] params, int params_offset);
+ public void glColor4f(float red, float green, float blue, float alpha);
+ public void glShadeModel(int mode);
+
+}
+
diff --git a/src/classes/javax/media/opengl/sub/fixed/GLMatrixIf.java b/src/classes/javax/media/opengl/sub/fixed/GLMatrixIf.java
new file mode 100644
index 000000000..834731b98
--- /dev/null
+++ b/src/classes/javax/media/opengl/sub/fixed/GLMatrixIf.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
+package javax.media.opengl.sub.fixed;
+
+import java.nio.*;
+
+import javax.media.opengl.*;
+import javax.media.opengl.sub.*;
+
+public interface GLMatrixIf {
+
+ public static final int GL_MATRIX_MODE = 0x0BA0;
+ public static final int GL_MODELVIEW = 0x1700;
+ public static final int GL_PROJECTION = 0x1701;
+ // public static final int GL_TEXTURE = 0x1702; // Use GL.GL_TEXTURE due to ambiguous GL usage
+ public static final int GL_MODELVIEW_MATRIX = 0x0BA6;
+ public static final int GL_PROJECTION_MATRIX = 0x0BA7;
+ public static final int GL_TEXTURE_MATRIX = 0x0BA8;
+
+ /**
+ * glGetFloatv
+ * @param pname GL_MODELVIEW_MATRIX, GL_PROJECTION_MATRIX or GL_TEXTURE_MATRIX
+ * @param params the FloatBuffer's position remains unchanged,
+ * which is the same behavior than the native JOGL GL impl
+ */
+ public void glGetFloatv(int pname, java.nio.FloatBuffer params);
+ public void glGetFloatv(int pname, float[] params, int params_offset);
+ /**
+ * glGetIntegerv
+ * @param pname GL_MATRIX_MODE
+ * @param params the FloatBuffer's position remains unchanged
+ * which is the same behavior than the native JOGL GL impl
+ */
+ public void glGetIntegerv(int pname, IntBuffer params);
+ public void glGetIntegerv(int pname, int[] params, int params_offset);
+
+ /**
+ * sets the current matrix
+ * @param pname GL_MODELVIEW, GL_PROJECTION or GL.GL_TEXTURE
+ */
+ public void glMatrixMode(int mode) ;
+
+ public void glPushMatrix();
+ public void glPopMatrix();
+
+ public void glLoadIdentity() ;
+
+ /**
+ * glLoadMatrixf
+ * @param params the FloatBuffer's position remains unchanged,
+ * which is the same behavior than the native JOGL GL impl
+ */
+ public void glLoadMatrixf(java.nio.FloatBuffer m) ;
+ public void glLoadMatrixf(float[] m, int m_offset);
+
+ /**
+ * glMultMatrixf
+ * @param params the FloatBuffer's position remains unchanged,
+ * which is the same behavior than the native JOGL GL impl
+ */
+ public void glMultMatrixf(java.nio.FloatBuffer m) ;
+ public void glMultMatrixf(float[] m, int m_offset);
+
+ public void glTranslatef(float x, float y, float z) ;
+
+ public void glRotatef(float angle, float x, float y, float z);
+
+ public void glScalef(float x, float y, float z) ;
+
+ public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) ;
+
+ public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar);
+
+}
+
diff --git a/src/classes/javax/media/opengl/sub/fixed/GLPointerIf.java b/src/classes/javax/media/opengl/sub/fixed/GLPointerIf.java
new file mode 100644
index 000000000..2f4cda1aa
--- /dev/null
+++ b/src/classes/javax/media/opengl/sub/fixed/GLPointerIf.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ */
+
+package javax.media.opengl.sub.fixed;
+
+import java.nio.*;
+
+import javax.media.opengl.*;
+import javax.media.opengl.sub.*;
+
+public interface GLPointerIf {
+ public static final int GL_VERTEX_ARRAY = 0x8074;
+ public static final int GL_NORMAL_ARRAY = 0x8075;
+ public static final int GL_COLOR_ARRAY = 0x8076;
+ public static final int GL_TEXTURE_COORD_ARRAY = 0x8078;
+
+ public void glEnableClientState(int arrayName);
+ public void glDisableClientState(int arrayName);
+
+ public void glVertexPointer(GLArrayData array);
+ public void glVertexPointer(int size, int type, int stride, java.nio.Buffer pointer);
+ public void glVertexPointer(int size, int type, int stride, long pointer_buffer_offset);
+
+ public void glColorPointer(GLArrayData array);
+ public void glColorPointer(int size, int type, int stride, java.nio.Buffer pointer);
+ public void glColorPointer(int size, int type, int stride, long pointer_buffer_offset);
+ public void glColor4f(float red, float green, float blue, float alpha);
+
+ public void glNormalPointer(GLArrayData array);
+ public void glNormalPointer(int type, int stride, java.nio.Buffer pointer);
+ public void glNormalPointer(int type, int stride, long pointer_buffer_offset);
+
+ public void glTexCoordPointer(GLArrayData array);
+ public void glTexCoordPointer(int size, int type, int stride, java.nio.Buffer pointer);
+ public void glTexCoordPointer(int size, int type, int stride, long pointer_buffer_offset);
+
+}
+
diff --git a/src/classes/javax/media/opengl/util/ImmModeSink.java b/src/classes/javax/media/opengl/util/ImmModeSink.java
index 526f38dab..9ab899d69 100644
--- a/src/classes/javax/media/opengl/util/ImmModeSink.java
+++ b/src/classes/javax/media/opengl/util/ImmModeSink.java
@@ -2,6 +2,8 @@
package javax.media.opengl.util;
import javax.media.opengl.*;
+import javax.media.opengl.sub.*;
+import javax.media.opengl.sub.fixed.*;
import com.sun.opengl.impl.GLReflection;
import java.nio.*;
import java.util.Iterator;
@@ -332,8 +334,13 @@ public class ImmModeSink {
enableBuffer(gl, true);
if (buffer!=null) {
+ GLFixedFuncIf glf = GLFixedFuncUtil.getGLFixedFuncIf(gl);
+ if(null==glf) {
+ throw new GLException("ImmModeSink.draw: No GLFixedFuncIf available");
+ }
+
if(null==indices) {
- gl.glDrawArrays(mode, 0, count);
+ glf.glDrawArrays(mode, 0, count);
} else {
Class clazz = indices.getClass();
int type=-1;
@@ -345,7 +352,7 @@ public class ImmModeSink {
if(0>type) {
throw new GLException("Given Buffer Class not supported: "+clazz+", should be ubyte or ushort:\n\t"+this);
}
- gl.glDrawElements(mode, indices.remaining(), type, indices);
+ glf.glDrawElements(mode, indices.remaining(), type, indices);
// GL2: gl.glDrawRangeElements(mode, 0, indices.remaining()-1, indices.remaining(), type, indices);
}
}
@@ -643,11 +650,12 @@ public class ImmModeSink {
this.bufferWritten=false;
}
- public void seal(GL gl, boolean seal)
+ public void seal(GL glObj, boolean seal)
{
seal(seal);
if(sealedGL==seal) return;
sealedGL = seal;
+ GL gl = glObj.getGL();
if(seal) {
if(vboUsage && vboName==0) {
int[] tmp = new int[1];
@@ -695,6 +703,11 @@ public class ImmModeSink {
}
public void enableBufferFixed(GL gl, boolean enable) {
+ GLFixedFuncIf glf = GLFixedFuncUtil.getGLFixedFuncIf(gl);
+ if(null==glf) {
+ throw new GLException("ImmModeSink.enableBufferFixed: No GLFixedFuncIf available");
+ }
+
if(enable) {
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboName);
@@ -704,35 +717,35 @@ public class ImmModeSink {
}
if(vComps>0) {
- gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
- gl.glVertexPointer(vArrayData);
+ glf.glEnableClientState(glf.GL_VERTEX_ARRAY);
+ glf.glVertexPointer(vArrayData);
}
if(cComps>0) {
- gl.glEnableClientState(gl.GL_COLOR_ARRAY);
- gl.glColorPointer(cArrayData);
+ glf.glEnableClientState(glf.GL_COLOR_ARRAY);
+ glf.glColorPointer(cArrayData);
}
if(nComps>0) {
- gl.glEnableClientState(gl.GL_NORMAL_ARRAY);
- gl.glNormalPointer(nArrayData);
+ glf.glEnableClientState(glf.GL_NORMAL_ARRAY);
+ glf.glNormalPointer(nArrayData);
}
if(tComps>0) {
- gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY);
- gl.glTexCoordPointer(tArrayData);
+ glf.glEnableClientState(glf.GL_TEXTURE_COORD_ARRAY);
+ glf.glTexCoordPointer(tArrayData);
}
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
} else {
if(vComps>0) {
- gl.glDisableClientState(gl.GL_VERTEX_ARRAY);
+ glf.glDisableClientState(glf.GL_VERTEX_ARRAY);
}
if(cComps>0) {
- gl.glDisableClientState(gl.GL_COLOR_ARRAY);
+ glf.glDisableClientState(glf.GL_COLOR_ARRAY);
}
if(nComps>0) {
- gl.glDisableClientState(gl.GL_NORMAL_ARRAY);
+ glf.glDisableClientState(glf.GL_NORMAL_ARRAY);
}
if(tComps>0) {
- gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY);
+ glf.glDisableClientState(glf.GL_TEXTURE_COORD_ARRAY);
}
}
}
@@ -745,10 +758,10 @@ public class ImmModeSink {
}
if(enable) {
- gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboName);
+ glsl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboName);
if(!bufferWritten) {
- gl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit(), buffer, GL.GL_STATIC_DRAW);
+ glsl.glBufferData(GL.GL_ARRAY_BUFFER, buffer.limit(), buffer, GL.GL_STATIC_DRAW);
bufferWritten=true;
}
@@ -769,7 +782,7 @@ public class ImmModeSink {
st.glVertexAttribPointer(glsl, tArrayData);
}
- gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
+ glsl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
} else {
if(vComps>0) {
st.glDisableVertexAttribArray(glsl, vArrayData.getName());
@@ -853,25 +866,25 @@ public class ImmModeSink {
buffer.flip();
if(vComps>0) {
- vArrayData = GLArrayDataWrapper.createFixed(GL.GL_VERTEX_ARRAY, vComps, vDataType, false,
+ vArrayData = GLArrayDataWrapper.createFixed(GLPointerIf.GL_VERTEX_ARRAY, vComps, vDataType, false,
0, vertexArray, 0, vOffset);
} else {
vArrayData = null;
}
if(cComps>0) {
- cArrayData = GLArrayDataWrapper.createFixed(GL.GL_COLOR_ARRAY, cComps, cDataType, false,
+ cArrayData = GLArrayDataWrapper.createFixed(GLPointerIf.GL_COLOR_ARRAY, cComps, cDataType, false,
0, colorArray, 0, cOffset);
} else {
cArrayData = null;
}
if(nComps>0) {
- nArrayData = GLArrayDataWrapper.createFixed(GL.GL_NORMAL_ARRAY, nComps, nDataType, false,
+ nArrayData = GLArrayDataWrapper.createFixed(GLPointerIf.GL_NORMAL_ARRAY, nComps, nDataType, false,
0, normalArray, 0, nOffset);
} else {
nArrayData = null;
}
if(tComps>0) {
- tArrayData = GLArrayDataWrapper.createFixed(GL.GL_TEXTURE_COORD_ARRAY, tComps, tDataType, false,
+ tArrayData = GLArrayDataWrapper.createFixed(GLPointerIf.GL_TEXTURE_COORD_ARRAY, tComps, tDataType, false,
0, textCoordArray, 0, tOffset);
} else {
tArrayData = null;
diff --git a/src/classes/javax/media/opengl/util/PMVMatrix.java b/src/classes/javax/media/opengl/util/PMVMatrix.java
index 37472dfe6..5a69b920c 100755
--- a/src/classes/javax/media/opengl/util/PMVMatrix.java
+++ b/src/classes/javax/media/opengl/util/PMVMatrix.java
@@ -1,13 +1,19 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ */
-package javax.media.opengl.util;
+package javax.media.opengl.util;
+
+import com.sun.opengl.impl.ProjectFloat;
-import javax.media.opengl.*;
-import com.sun.opengl.impl.ProjectFloat;
import java.nio.*;
import java.util.ArrayList;
import java.util.List;
-public class PMVMatrix {
+import javax.media.opengl.*;
+import javax.media.opengl.sub.fixed.GLMatrixIf;
+
+public class PMVMatrix implements GLMatrixIf {
public PMVMatrix() {
projectFloat = new ProjectFloat();
@@ -16,14 +22,24 @@ public class PMVMatrix {
projectFloat.gluMakeIdentityf(matrixIdent);
matrixIdent.rewind();
- matrixPMvMviT = BufferUtil.newFloatBuffer(4*16); // grouping P + Mv + Mvi + MviT
- matrixPMvMvi = slice(matrixPMvMviT, 0*16, 3*16); // grouping P + Mv + Mvi
- matrixPMv = slice(matrixPMvMviT, 0*16, 2*16); // grouping P + Mv
- matrixP = slice(matrixPMvMviT, 0*16, 1*16);
- matrixMv = slice(matrixPMvMviT, 1*16, 1*16);
- matrixMvi = slice(matrixPMvMviT, 2*16, 1*16);
- matrixMvit = slice(matrixPMvMviT, 3*16, 1*16);
- matrixPMvMviT.rewind();
+ // T Texture
+ // P Projection
+ // Mv ModelView
+ // Mvi Modelview-Inverse
+ // Mvit Modelview-Inverse-Transpose
+ // Pmv P * Mv
+ matrixTPMvMvitPmv = BufferUtil.newFloatBuffer(6*16); // grouping T + P + Mv + Mvi + Mvit + Pmv
+ matrixPMvMvitPmv = slice(matrixTPMvMvitPmv, 1*16, 5*16); // grouping P + Mv + Mvi + Mvit + Pmv
+ matrixT = slice(matrixTPMvMvitPmv, 0*16, 1*16); // T
+ matrixPMvMvit = slice(matrixTPMvMvitPmv, 1*16, 4*16); // grouping P + Mv + Mvi + Mvit
+ matrixPMvMvi = slice(matrixTPMvMvitPmv, 1*16, 3*16); // grouping P + Mv + Mvi
+ matrixPMv = slice(matrixTPMvMvitPmv, 1*16, 2*16); // grouping P + Mv
+ matrixP = slice(matrixTPMvMvitPmv, 1*16, 1*16); // P
+ matrixMv = slice(matrixTPMvMvitPmv, 2*16, 1*16); // Mv
+ matrixMvi = slice(matrixTPMvMvitPmv, 3*16, 1*16); // Mvi
+ matrixMvit = slice(matrixTPMvMvitPmv, 4*16, 1*16); // Mvit
+ matrixPmv = slice(matrixTPMvMvitPmv, 5*16, 1*16); // Pmv
+ matrixTPMvMvitPmv.rewind();
matrixMvit3 = BufferUtil.newFloatBuffer(3*3);
@@ -52,11 +68,13 @@ public class PMVMatrix {
matrixMvStack= new ArrayList();
// default values and mode
- glMatrixMode(GL.GL_PROJECTION);
+ glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glMatrixMode(GL.GL_MODELVIEW);
+ glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- modified = true;
+ glMatrixMode(GL.GL_TEXTURE);
+ glLoadIdentity();
+ setDirty();
}
private static FloatBuffer slice(FloatBuffer buf, int pos, int len) {
@@ -65,36 +83,121 @@ public class PMVMatrix {
return buf.slice();
}
- public boolean isDirty() {
- return modified;
+ public static final boolean isMatrixModeName(final int matrixModeName) {
+ switch(matrixModeName) {
+ case GL_MODELVIEW_MATRIX:
+ case GL_PROJECTION_MATRIX:
+ case GL_TEXTURE_MATRIX:
+ return true;
+ }
+ return false;
}
- public boolean update() {
- boolean res = modified;
- if(res) {
- setMviMvit();
- modified=false;
+ public static final int matrixModeName2MatrixGetName(final int matrixModeName) {
+ switch(matrixModeName) {
+ case GL_MODELVIEW:
+ return GL_MODELVIEW_MATRIX;
+ case GL_PROJECTION:
+ return GL_PROJECTION_MATRIX;
+ case GL.GL_TEXTURE:
+ return GL_TEXTURE_MATRIX;
+ default:
+ throw new GLUnsupportedException("unsupported matrixName: "+matrixModeName);
}
- return res;
}
- public final int glGetMatrixMode() {
- return matrixMode;
+ public static final boolean isMatrixGetName(final int matrixGetName) {
+ switch(matrixGetName) {
+ case GL_MATRIX_MODE:
+ case GL_MODELVIEW_MATRIX:
+ case GL_PROJECTION_MATRIX:
+ case GL_TEXTURE_MATRIX:
+ return true;
+ }
+ return false;
+ }
+
+ public static final int matrixGetName2MatrixModeName(final int matrixGetName) {
+ switch(matrixGetName) {
+ case GL_MODELVIEW_MATRIX:
+ return GL_MODELVIEW;
+ case GL_PROJECTION_MATRIX:
+ return GL_PROJECTION;
+ case GL_TEXTURE_MATRIX:
+ return GL.GL_TEXTURE;
+ default:
+ throw new GLUnsupportedException("unsupported matrixGetName: "+matrixGetName);
+ }
+ }
+
+ public void setDirty() {
+ modified = DIRTY_MODELVIEW | DIRTY_PROJECTION | DIRTY_TEXTURE ;
+ matrixMode = GL_MODELVIEW;
+ }
+
+ public int getDirtyBits() {
+ return modified;
}
- public void glMatrixMode(int matrixName) {
+ public boolean isDirty(final int matrixName) {
+ boolean res;
switch(matrixName) {
- case GL.GL_MODELVIEW:
- case GL.GL_PROJECTION:
+ case GL_MODELVIEW:
+ res = (modified&DIRTY_MODELVIEW)!=0 ;
+ break;
+ case GL_PROJECTION:
+ res = (modified&DIRTY_PROJECTION)!=0 ;
+ break;
+ case GL.GL_TEXTURE:
+ res = (modified&DIRTY_TEXTURE)!=0 ;
break;
default:
throw new GLUnsupportedException("unsupported matrixName: "+matrixName);
}
- matrixMode = matrixName;
+ return res;
}
- public final FloatBuffer glGetPMvMviTMatrixf() {
- return matrixPMvMviT;
+ public boolean isDirty() {
+ return modified!=0;
+ }
+
+ public boolean update() {
+ // if(0==modified) return false;
+
+ // int res = modified;
+ int res = DIRTY_MODELVIEW | DIRTY_PROJECTION ;
+ if( (res&DIRTY_MODELVIEW)!=0 ) {
+ setMviMvit();
+ }
+ if( (res&DIRTY_MODELVIEW)!=0 || (res&DIRTY_PROJECTION)!=0 ) {
+ glMultMatrixf(matrixP, matrixMv, matrixPmv);
+ }
+ modified=0;
+ return res!=0;
+ }
+
+ public final int glGetMatrixMode() {
+ return matrixMode;
+ }
+
+ public final FloatBuffer glGetTMatrixf() {
+ return matrixT;
+ }
+
+ public final FloatBuffer glGetPMatrixf() {
+ return matrixP;
+ }
+
+ public final FloatBuffer glGetMvMatrixf() {
+ return matrixMv;
+ }
+
+ public final FloatBuffer glGetPMvMvitPmvMatrixf() {
+ return matrixPMvMvitPmv;
+ }
+
+ public final FloatBuffer glGetPMvMvitMatrixf() {
+ return matrixPMvMvit;
}
public final FloatBuffer glGetPMvMviMatrixf() {
@@ -109,118 +212,256 @@ public class PMVMatrix {
return matrixMvi;
}
+ public final FloatBuffer glGetPmvMatrixf() {
+ return matrixPmv;
+ }
+
public final FloatBuffer glGetNormalMatrixf() {
return matrixMvit3;
}
+ /*
+ * @return the current matrix
+ */
public final FloatBuffer glGetMatrixf() {
return glGetMatrixf(matrixMode);
}
- public final FloatBuffer glGetMatrixf(int matrixName) {
- if(matrixName==GL.GL_MODELVIEW) {
+ /**
+ * @param pname GL_MODELVIEW, GL_PROJECTION or GL.GL_TEXTURE
+ * @return the given matrix
+ */
+ public final FloatBuffer glGetMatrixf(final int matrixName) {
+ if(matrixName==GL_MODELVIEW) {
return matrixMv;
- } else if(matrixName==GL.GL_PROJECTION) {
+ } else if(matrixName==GL_PROJECTION) {
return matrixP;
+ } else if(matrixName==GL.GL_TEXTURE) {
+ return matrixT;
+ } else {
+ throw new GLUnsupportedException("unsupported matrixName: "+matrixName);
}
- return null;
}
- public void glLoadMatrixf(float[] values, int offset) {
+ public final void gluPerspective(final float fovy, final float aspect, final float zNear, final float zFar) {
+ float top=(float)Math.tan(fovy*((float)Math.PI)/360.0f)*zNear;
+ float bottom=-1.0f*top;
+ float left=aspect*bottom;
+ float right=aspect*top;
+ glFrustumf(left, right, bottom, top, zNear, zFar);
+ }
+
+ public static final void glMultMatrixf(final FloatBuffer a, final FloatBuffer b, FloatBuffer p) {
+ for (int i = 0; i < 4; i++) {
+ final float ai0=a.get(i+0*4), ai1=a.get(i+1*4), ai2=a.get(i+2*4), ai3=a.get(i+3*4);
+ p.put(i+0*4 , ai0 * b.get(0+0*4) + ai1 * b.get(1+0*4) + ai2 * b.get(2+0*4) + ai3 * b.get(3+0*4) );
+ p.put(i+1*4 , ai0 * b.get(0+1*4) + ai1 * b.get(1+1*4) + ai2 * b.get(2+1*4) + ai3 * b.get(3+1*4) );
+ p.put(i+2*4 , ai0 * b.get(0+2*4) + ai1 * b.get(1+2*4) + ai2 * b.get(2+2*4) + ai3 * b.get(3+2*4) );
+ p.put(i+3*4 , ai0 * b.get(0+3*4) + ai1 * b.get(1+3*4) + ai2 * b.get(2+3*4) + ai3 * b.get(3+3*4) );
+ }
+ }
+ public static final void glMultMatrixf(final FloatBuffer a, final float[] b, int b_off, FloatBuffer p) {
+ for (int i = 0; i < 4; i++) {
+ final float ai0=a.get(i+0*4), ai1=a.get(i+1*4), ai2=a.get(i+2*4), ai3=a.get(i+3*4);
+ p.put(i+0*4 , ai0 * b[b_off+0+0*4] + ai1 * b[b_off+1+0*4] + ai2 * b[b_off+2+0*4] + ai3 * b[b_off+3+0*4] );
+ p.put(i+1*4 , ai0 * b[b_off+0+1*4] + ai1 * b[b_off+1+1*4] + ai2 * b[b_off+2+1*4] + ai3 * b[b_off+3+1*4] );
+ p.put(i+2*4 , ai0 * b[b_off+0+2*4] + ai1 * b[b_off+1+2*4] + ai2 * b[b_off+2+2*4] + ai3 * b[b_off+3+2*4] );
+ p.put(i+3*4 , ai0 * b[b_off+0+3*4] + ai1 * b[b_off+1+3*4] + ai2 * b[b_off+2+3*4] + ai3 * b[b_off+3+3*4] );
+ }
+ }
+
+ //
+ // MatrixIf
+ //
+
+ public void glMatrixMode(final int matrixName) {
+ switch(matrixName) {
+ case GL_MODELVIEW:
+ case GL_PROJECTION:
+ case GL.GL_TEXTURE:
+ break;
+ default:
+ throw new GLUnsupportedException("unsupported matrixName: "+matrixName);
+ }
+ matrixMode = matrixName;
+ }
+
+ public void glGetFloatv(int matrixGetName, FloatBuffer params) {
+ int pos = params.position();
+ if(matrixGetName==GL_MATRIX_MODE) {
+ params.put((float)matrixMode);
+ } else {
+ FloatBuffer matrix = glGetMatrixf(matrixGetName2MatrixModeName(matrixGetName));
+ params.put(matrix);
+ matrix.rewind();
+ }
+ params.position(pos);
+ }
+ public void glGetFloatv(int matrixGetName, float[] params, int params_offset) {
+ if(matrixGetName==GL_MATRIX_MODE) {
+ params[params_offset]=(float)matrixMode;
+ } else {
+ FloatBuffer matrix = glGetMatrixf(matrixGetName2MatrixModeName(matrixGetName));
+ matrix.get(params, params_offset, 16);
+ matrix.rewind();
+ }
+ }
+ public void glGetIntegerv(int pname, IntBuffer params) {
+ int pos = params.position();
+ if(pname==GL_MATRIX_MODE) {
+ params.put(matrixMode);
+ } else {
+ throw new GLUnsupportedException("unsupported pname: "+pname);
+ }
+ params.position(pos);
+ }
+ public void glGetIntegerv(int pname, int[] params, int params_offset) {
+ if(pname==GL_MATRIX_MODE) {
+ params[params_offset]=matrixMode;
+ } else {
+ throw new GLUnsupportedException("unsupported pname: "+pname);
+ }
+ }
+
+ public final void glLoadMatrixf(final float[] values, final int offset) {
int len = values.length-offset;
- if(matrixMode==GL.GL_MODELVIEW) {
+ if(matrixMode==GL_MODELVIEW) {
matrixMv.clear();
matrixMv.put(values, offset, len);
matrixMv.rewind();
- } else if(matrixMode==GL.GL_PROJECTION) {
+ modified |= DIRTY_MODELVIEW ;
+ } else if(matrixMode==GL_PROJECTION) {
matrixP.clear();
matrixP.put(values, offset, len);
matrixP.rewind();
+ modified |= DIRTY_PROJECTION ;
+ } else if(matrixMode==GL.GL_TEXTURE) {
+ matrixT.clear();
+ matrixT.put(values, offset, len);
+ matrixT.rewind();
+ modified |= DIRTY_TEXTURE ;
}
- modified = true;
}
- public void glLoadMatrixf(java.nio.FloatBuffer m) {
+ public final void glLoadMatrixf(java.nio.FloatBuffer m) {
int spos = m.position();
- if(matrixMode==GL.GL_MODELVIEW) {
+ if(matrixMode==GL_MODELVIEW) {
matrixMv.clear();
matrixMv.put(m);
matrixMv.rewind();
- } else if(matrixMode==GL.GL_PROJECTION) {
+ modified |= DIRTY_MODELVIEW ;
+ } else if(matrixMode==GL_PROJECTION) {
matrixP.clear();
matrixP.put(m);
matrixP.rewind();
+ modified |= DIRTY_PROJECTION ;
+ } else if(matrixMode==GL.GL_TEXTURE) {
+ matrixT.clear();
+ matrixT.put(m);
+ matrixT.rewind();
+ modified |= DIRTY_TEXTURE ;
}
m.position(spos);
- modified = true;
}
- public void glPopMatrix() {
+ public final void glPopMatrix() {
float[] stackEntry=null;
- if(matrixMode==GL.GL_MODELVIEW) {
+ if(matrixMode==GL_MODELVIEW) {
stackEntry = (float[])matrixMvStack.remove(0);
- } else if(matrixMode==GL.GL_PROJECTION) {
+ } else if(matrixMode==GL_PROJECTION) {
stackEntry = (float[])matrixPStack.remove(0);
+ } else if(matrixMode==GL.GL_TEXTURE) {
+ stackEntry = (float[])matrixTStack.remove(0);
}
glLoadMatrixf(stackEntry, 0);
}
- public void glPushMatrix() {
+ public final void glPushMatrix() {
float[] stackEntry = new float[1*16];
- if(matrixMode==GL.GL_MODELVIEW) {
+ if(matrixMode==GL_MODELVIEW) {
matrixMv.get(stackEntry);
matrixMv.rewind();
matrixMvStack.add(0, stackEntry);
- } else if(matrixMode==GL.GL_PROJECTION) {
+ } else if(matrixMode==GL_PROJECTION) {
matrixP.get(stackEntry);
matrixP.rewind();
matrixPStack.add(0, stackEntry);
+ } else if(matrixMode==GL.GL_TEXTURE) {
+ matrixT.get(stackEntry);
+ matrixT.rewind();
+ matrixTStack.add(0, stackEntry);
}
}
- public void glLoadIdentity() {
- if(matrixMode==GL.GL_MODELVIEW) {
+ public final void glLoadIdentity() {
+ if(matrixMode==GL_MODELVIEW) {
matrixMv.clear();
matrixMv.put(matrixIdent);
matrixMv.rewind();
matrixIdent.rewind();
- } else if(matrixMode==GL.GL_PROJECTION) {
+ modified |= DIRTY_MODELVIEW ;
+ } else if(matrixMode==GL_PROJECTION) {
matrixP.clear();
matrixP.put(matrixIdent);
matrixP.rewind();
matrixIdent.rewind();
+ modified |= DIRTY_PROJECTION ;
+ } else if(matrixMode==GL.GL_TEXTURE) {
+ matrixT.clear();
+ matrixT.put(matrixIdent);
+ matrixT.rewind();
+ matrixIdent.rewind();
+ modified |= DIRTY_TEXTURE ;
}
- modified = true;
- }
-
- public void glMultMatrixf(FloatBuffer a, FloatBuffer b, FloatBuffer p) {
- for (int i = 0; i < 4; i++) {
- final float ai0=a.get(i+0*4), ai1=a.get(i+1*4), ai2=a.get(i+2*4), ai3=a.get(i+3*4);
- p.put(i+0*4 , ai0 * b.get(0+0*4) + ai1 * b.get(1+0*4) + ai2 * b.get(2+0*4) + ai3 * b.get(3+0*4) );
- p.put(i+1*4 , ai0 * b.get(0+1*4) + ai1 * b.get(1+1*4) + ai2 * b.get(2+1*4) + ai3 * b.get(3+1*4) );
- p.put(i+2*4 , ai0 * b.get(0+2*4) + ai1 * b.get(1+2*4) + ai2 * b.get(2+2*4) + ai3 * b.get(3+2*4) );
- p.put(i+3*4 , ai0 * b.get(0+3*4) + ai1 * b.get(1+3*4) + ai2 * b.get(2+3*4) + ai3 * b.get(3+3*4) );
- }
- // or .. projectFloat.gluMultMatricesf(b, a, p);
}
- public void glMultMatrixf(FloatBuffer m) {
- if(matrixMode==GL.GL_MODELVIEW) {
+ public final void glMultMatrixf(final FloatBuffer m) {
+ if(matrixMode==GL_MODELVIEW) {
glMultMatrixf(matrixMv, m, matrixMult);
matrixMv.clear();
matrixMv.put(matrixMult);
matrixMv.rewind();
- } else if(matrixMode==GL.GL_PROJECTION) {
+ modified |= DIRTY_MODELVIEW ;
+ } else if(matrixMode==GL_PROJECTION) {
glMultMatrixf(matrixP, m, matrixMult);
matrixP.clear();
matrixP.put(matrixMult);
matrixP.rewind();
+ modified |= DIRTY_PROJECTION ;
+ } else if(matrixMode==GL.GL_TEXTURE) {
+ glMultMatrixf(matrixT, m, matrixMult);
+ matrixT.clear();
+ matrixT.put(matrixMult);
+ matrixT.rewind();
+ modified |= DIRTY_TEXTURE ;
}
matrixMult.rewind();
- modified = true;
}
- public void glTranslatef(float x, float y, float z) {
+ public void glMultMatrixf(float[] m, int m_offset) {
+ if(matrixMode==GL_MODELVIEW) {
+ glMultMatrixf(matrixMv, m, m_offset, matrixMult);
+ matrixMv.clear();
+ matrixMv.put(matrixMult);
+ matrixMv.rewind();
+ modified |= DIRTY_MODELVIEW ;
+ } else if(matrixMode==GL_PROJECTION) {
+ glMultMatrixf(matrixP, m, m_offset, matrixMult);
+ matrixP.clear();
+ matrixP.put(matrixMult);
+ matrixP.rewind();
+ modified |= DIRTY_PROJECTION ;
+ } else if(matrixMode==GL.GL_TEXTURE) {
+ glMultMatrixf(matrixT, m, m_offset, matrixMult);
+ matrixT.clear();
+ matrixT.put(matrixMult);
+ matrixT.rewind();
+ modified |= DIRTY_TEXTURE ;
+ }
+ matrixMult.rewind();
+ }
+
+ public final void glTranslatef(final float x, final float y, final float z) {
// Translation matrix:
// 1 0 0 x
// 0 1 0 y
@@ -232,7 +473,7 @@ public class PMVMatrix {
glMultMatrixf(matrixTrans);
}
- public void glRotatef(float angdeg, float x, float y, float z) {
+ public final void glRotatef(final float angdeg, float x, float y, float z) {
float angrad = angdeg * (float) Math.PI / 180;
float c = (float)Math.cos(angrad);
float ic= 1.0f - c;
@@ -253,19 +494,6 @@ public class PMVMatrix {
float ys = y*s;
float yz = y*z;
float zs = z*s;
- if(false) {
- matrixRot.put(0+4*0, x*x*ic+c);
- matrixRot.put(0+4*1, xy*ic+zs);
- matrixRot.put(0+4*2, xz*ic-ys);
-
- matrixRot.put(1+4*0, xy*ic+zs);
- matrixRot.put(1+4*1, y*y*ic+c);
- matrixRot.put(1+4*2, yz*ic-xs);
-
- matrixRot.put(2+4*0, xz*ic-ys);
- matrixRot.put(2+4*1, yz*ic+xs);
- matrixRot.put(2+4*2, z*z*ic+c);
- } else {
matrixRot.put(0*4+0, x*x*ic+c);
matrixRot.put(0*4+1, xy*ic+zs);
matrixRot.put(0*4+2, xz*ic-ys);
@@ -277,12 +505,11 @@ public class PMVMatrix {
matrixRot.put(2*4+0, xz*ic+ys);
matrixRot.put(2*4+1, yz*ic-xs);
matrixRot.put(2*4+2, z*z*ic+c);
- }
glMultMatrixf(matrixRot);
}
- public void glScalef(float x, float y, float z) {
+ public final void glScalef(final float x, final float y, final float z) {
// Scale matrix:
// x 0 0 0
// 0 y 0 0
@@ -295,7 +522,7 @@ public class PMVMatrix {
glMultMatrixf(matrixScale);
}
- public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) {
+ public final void glOrthof(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) {
// Ortho matrix:
// 2/dx 0 0 tx
// 0 2/dy 0 ty
@@ -318,7 +545,7 @@ public class PMVMatrix {
glMultMatrixf(matrixOrtho);
}
- public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) {
+ public final void glFrustumf(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) {
if(zNear<=0.0f||zFar<0.0f) {
throw new GLException("GL_INVALID_VALUE: zNear and zFar must be positive, and zNear>0");
}
@@ -352,15 +579,11 @@ public class PMVMatrix {
glMultMatrixf(matrixFrustum);
}
- public void gluPerspective(float fovy, float aspect, float zNear, float zFar) {
- float top=(float)Math.tan(fovy*((float)Math.PI)/360.0f)*zNear;
- float bottom=-1.0f*top;
- float left=aspect*bottom;
- float right=aspect*top;
- glFrustumf(left, right, bottom, top, zNear, zFar);
- }
+ //
+ // private
+ //
- private void setMviMvit() {
+ private final void setMviMvit() {
if(!projectFloat.gluInvertMatrixf(matrixMv, matrixMvi)) {
throw new GLException("Invalid source Mv matrix, can't compute inverse");
}
@@ -381,15 +604,16 @@ public class PMVMatrix {
}
protected FloatBuffer matrixIdent;
- protected FloatBuffer matrixPMvMviT, matrixPMvMvi, matrixPMv, matrixP, matrixMv, matrixMvi, matrixMvit;
+ protected FloatBuffer matrixTPMvMvitPmv, matrixPMvMvit, matrixPMvMvitPmv, matrixPMvMvi, matrixPMv, matrixP, matrixT, matrixMv, matrixMvi, matrixMvit, matrixPmv;
protected FloatBuffer matrixMvit3;
protected FloatBuffer matrixMult, matrixTrans, matrixRot, matrixScale, matrixOrtho, matrixFrustum;
protected float[] vec3f;
- protected List/*FloatBuffer*/ matrixPStack, matrixMvStack;
- protected int matrixMode = GL.GL_MODELVIEW;
- protected boolean modified = false;
+ protected List/*FloatBuffer*/ matrixTStack, matrixPStack, matrixMvStack;
+ protected int matrixMode = GL_MODELVIEW;
+ protected int modified = 0;
protected ProjectFloat projectFloat;
+ public static final int DIRTY_MODELVIEW = 1 << 0;
+ public static final int DIRTY_PROJECTION = 1 << 1;
+ public static final int DIRTY_TEXTURE = 1 << 2;
}
-
-