diff options
author | Sven Gothel <[email protected]> | 2009-03-16 15:33:10 +0000 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2009-03-16 15:33:10 +0000 |
commit | aefbc0323da190835bc146709bf560b3e3181b39 (patch) | |
tree | 0c025c00504372eb64ef0092b17186103d82bb58 | |
parent | b2c27c8edc2e9516a5341332a3480485d72eb6af (diff) |
sync with JOGL changes
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@322 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
24 files changed, 163 insertions, 217 deletions
diff --git a/make/build.xml b/make/build.xml index e9aba45..5b5794e 100644 --- a/make/build.xml +++ b/make/build.xml @@ -55,20 +55,24 @@ </target> <target name="init" depends="java.class.path.validate,setup.gles,setup.cg.excludes,skip.cg.excludes"> - <property name="jogl.core.jar" value="../../jogl/${rootrel.build}/jogl.core.jar" /> - <property name="jogl.oswin.jar" value="../../jogl/${rootrel.build}/jogl.oswin.jar" /> - <property name="jogl.gles12.jar" value="../../jogl/${rootrel.build}/jogl.gles12.jar" /> - <property name="jogl.gles12.dbg.jar" value="../../jogl/${rootrel.build}/jogl.gles12.dbg.jar" /> - <property name="jogl.gles2.jar" value="../../jogl/${rootrel.build}/jogl.gles2.jar" /> - <property name="jogl.gles2.dbg.jar" value="../../jogl/${rootrel.build}/jogl.gles2.dbg.jar" /> - <property name="jogl.egl.jar" value="../../jogl/${rootrel.build}/jogl.egl.jar" /> - <property name="jogl.gl2.jar" value="../../jogl/${rootrel.build}/jogl.gl2.jar" /> - <property name="jogl.gl2.dbg.jar" value="../../jogl/${rootrel.build}/jogl.gl2.dbg.jar" /> - <property name="jogl.awt.jar" value="../../jogl/${rootrel.build}/jogl.awt.jar" /> - <property name="jogl.util.jar" value="../../jogl/${rootrel.build}/jogl.util.jar" /> - <property name="jogl.util.awt.jar" value="../../jogl/${rootrel.build}/jogl.util.awt.jar" /> - <property name="jogl.util.gl2.jar" value="../../jogl/${rootrel.build}/jogl.util.gl2.jar" /> - <property name="newt.jar" value="../../jogl/${rootrel.build}/newt.jar" /> + <property name="jogl.core.jar" value="../../jogl/${rootrel.build}-jogl/jogl.core.jar" /> + <property name="jogl.gles12.jar" value="../../jogl/${rootrel.build}-jogl/jogl.gles12.jar" /> + <property name="jogl.gles12.dbg.jar" value="../../jogl/${rootrel.build}-jogl/jogl.gles12.dbg.jar" /> + <property name="jogl.gles1.jar" value="../../jogl/${rootrel.build}-jogl/jogl.gles1.jar" /> + <property name="jogl.gles1.dbg.jar" value="../../jogl/${rootrel.build}-jogl/jogl.gles1.dbg.jar" /> + <property name="jogl.gles2.jar" value="../../jogl/${rootrel.build}-jogl/jogl.gles2.jar" /> + <property name="jogl.gles2.dbg.jar" value="../../jogl/${rootrel.build}-jogl/jogl.gles2.dbg.jar" /> + <property name="jogl.egl.jar" value="../../jogl/${rootrel.build}-jogl/jogl.egl.jar" /> + <property name="jogl.gl2.jar" value="../../jogl/${rootrel.build}-jogl/jogl.gl2.jar" /> + <property name="jogl.gl2.dbg.jar" value="../../jogl/${rootrel.build}-jogl/jogl.gl2.dbg.jar" /> + <property name="jogl.awt.jar" value="../../jogl/${rootrel.build}-jogl/jogl.awt.jar" /> + <property name="jogl.util.jar" value="../../jogl/${rootrel.build}-jogl/jogl.util.jar" /> + <property name="jogl.util.awt.jar" value="../../jogl/${rootrel.build}-jogl/jogl.util.awt.jar" /> + <property name="jogl.util.gl2.jar" value="../../jogl/${rootrel.build}-jogl/jogl.util.gl2.jar" /> + <property name="nwi.core.jar" value="../../jogl/${rootrel.build}-nwi/nwi.core.jar" /> + <property name="nwi.x11.jar" value="../../jogl/${rootrel.build}-nwi/nwi.x11.jar" /> + <property name="nwi.awt.jar" value="../../jogl/${rootrel.build}-nwi/nwi.awt.jar" /> + <property name="newt.all.jar" value="../../jogl/${rootrel.build}-newt/newt.all.jar" /> <property name="joal.jar" value="../lib/joal.jar" /> <property name="joal-demos.jar" value="../lib/joal-demos.jar" /> <property name="simple-xml.jar" value="../lib/simple-xml-1.1.1.jar" /> @@ -104,8 +108,10 @@ <target name="all-desktop" unless="isGLES"> <mkdir dir="${classes}" /> <path id="jogl-demos.classpath"> + <pathelement location="${nwi.core.jar}" /> + <pathelement location="${nwi.x11.jar}" /> + <pathelement location="${nwi.awt.jar}" /> <pathelement location="${jogl.core.jar}" /> - <pathelement location="${jogl.oswin.jar}" /> <pathelement location="${jogl.gles1.jar}" /> <pathelement location="${jogl.gles1.dbg.jar}" /> <pathelement location="${jogl.gles2.jar}" /> @@ -117,7 +123,7 @@ <pathelement location="${jogl.util.jar}" /> <pathelement location="${jogl.util.awt.jar}" /> <pathelement location="${jogl.util.gl2.jar}" /> - <pathelement location="${newt.jar}" /> + <pathelement location="${newt.all.jar}" /> <pathelement location="${joal.jar}" /> <pathelement location="${joal-demos.jar}" /> <pathelement location="${simple-xml.jar}" /> @@ -176,11 +182,15 @@ <echo message="classes destdir ${classes}" /> <mkdir dir="${classes}" /> <path id="jogl-demos.classpath"> + <pathelement location="${nwi.core.jar}" /> <pathelement location="${jogl.core.jar}" /> + <pathelement location="${jogl.gles1.jar}" /> + <pathelement location="${jogl.gles1.dbg.jar}" /> <pathelement location="${jogl.gles2.jar}" /> + <pathelement location="${jogl.gles2.dbg.jar}" /> <pathelement location="${jogl.egl.jar}" /> <pathelement location="${jogl.util.jar}" /> - <pathelement location="${newt.jar}" /> + <pathelement location="${newt.all.jar}" /> </path> <javac destdir="${classes}" includes="demos/GLInfo*,demos/es1/**,demos/es2/**" source="1.4" target="1.4" debug="true" debuglevel="source,lines" bootclasspath="../../gluegen/make/lib/cdc_fp.jar"> diff --git a/make/make.jogl.all.macosx.sh b/make/make.jogl.all.macosx.sh new file mode 100644 index 0000000..e7a5ee3 --- /dev/null +++ b/make/make.jogl.all.macosx.sh @@ -0,0 +1,9 @@ +#! /bin/sh + +. /devtools/etc/profile.ant + +# -Dc.compiler.debug=true + +ant -v \ + -Drootrel.build=build-macosx \ + $* 2>&1 | tee make.jogl.all.macosx.log diff --git a/setenv-jogl.macosx.sh b/setenv-jogl.macosx.sh new file mode 100644 index 0000000..cf85217 --- /dev/null +++ b/setenv-jogl.macosx.sh @@ -0,0 +1,49 @@ +#! /bin/sh + +if [ -z "$1" ] ; then + echo "Usage: $0 {JOGL_ALL|JOGL_ES1_MIN|JOGL_ES1_MAX|JOGL_ES2_MIN|JOGL_ES2_MAX|JOGL_GL2ES12_MIN|JOGL_GL2ES12_MAX|JOGL_GL2_MIN|JOGL_GL2_MAX}" +else + +JOGL_PROFILE=$1 +shift + +echo JOGL PROFILE: $JOGL_PROFILE + +CVSROOT=":pserver:[email protected]:/cvs" +THISDIR=`pwd` +export CVSROOT THISDIR + +if [ -x /devtools/etc/profile.ant ] ; then + . /devtools/etc/profile.ant +fi + +J2RE_HOME=$(which java) +JAVA_HOME=$(which javac) +CP_SEP=: + +export LIBXCB_ALLOW_SLOPPY_LOCK=1 + +. $THISDIR/../jogl/etc/profile.jogl $THISDIR/../jogl/build-macosx $JOGL_PROFILE + +GLUEGEN_JAR=$THISDIR/../gluegen/build-macosx/gluegen-rt.jar +GLUEGEN_OS=$THISDIR/../gluegen/build-macosx/obj + +LIB=$THISDIR/lib + +# CLASSPATH=$JAVA_HOME/jre/lib/rt.jar:.:build-macosx/classes +CLASSPATH=.:$THISDIR/build-macosx/jogl-demos.jar:$GLUEGEN_JAR:$JOGL_CLASSPATH +for i in $LIB/*jar ; do + CLASSPATH=$CLASSPATH:$i +done +export CLASSPATH +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GLUEGEN_OS:$JOGL_LIB_DIR +export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GLUEGEN_OS:$JOGL_LIB_DIR + +echo JOGL_CLASSPATH: $JOGL_CLASSPATH + +PATH=$J2RE_HOME/bin:$JAVA_HOME/bin:$PATH +export PATH + +fi + + diff --git a/setenv-jogl.x86.sh b/setenv-jogl.x86.sh index 1ff5fd2..cc735af 100644 --- a/setenv-jogl.x86.sh +++ b/setenv-jogl.x86.sh @@ -23,7 +23,7 @@ CP_SEP=: export LIBXCB_ALLOW_SLOPPY_LOCK=1 -. $THISDIR/../jogl/etc/profile.jogl $THISDIR/../jogl/build-x86 $THISDIR/../jogl/build-x86/obj $JOGL_PROFILE +. $THISDIR/../jogl/etc/profile.jogl $THISDIR/../jogl/build-x86 $JOGL_PROFILE GLUEGEN_JAR=$THISDIR/../gluegen/build-x86/gluegen-rt.jar GLUEGEN_OS=$THISDIR/../gluegen/build-x86/obj @@ -36,7 +36,7 @@ for i in $LIB/*jar ; do CLASSPATH=$CLASSPATH:$i done export CLASSPATH -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GLUEGEN_OS:$THISDIR/../jogl/build-x86/obj +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GLUEGEN_OS:$JOGL_LIB_DIR echo JOGL_CLASSPATH: $JOGL_CLASSPATH diff --git a/setenv-jogl.x86_64.sh b/setenv-jogl.x86_64.sh index a31f5de..ed5c2e3 100644 --- a/setenv-jogl.x86_64.sh +++ b/setenv-jogl.x86_64.sh @@ -23,7 +23,7 @@ CP_SEP=: export LIBXCB_ALLOW_SLOPPY_LOCK=1 -. $THISDIR/../jogl/etc/profile.jogl $THISDIR/../jogl/build-x86_64 $THISDIR/../jogl/build-x86_64/obj $JOGL_PROFILE +. $THISDIR/../jogl/etc/profile.jogl $THISDIR/../jogl/build-x86_64 $JOGL_PROFILE GLUEGEN_JAR=$THISDIR/../gluegen/build-x86_64/gluegen-rt.jar GLUEGEN_OS=$THISDIR/../gluegen/build-x86_64/obj @@ -36,7 +36,7 @@ for i in $LIB/*jar ; do CLASSPATH=$CLASSPATH:$i done export CLASSPATH -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GLUEGEN_OS:$THISDIR/../jogl/build-x86_64/obj +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GLUEGEN_OS:$JOGL_LIB_DIR echo JOGL_CLASSPATH: $JOGL_CLASSPATH diff --git a/src/demos/GLInfo.java b/src/demos/GLInfo.java index be4732e..f2c9d2c 100755 --- a/src/demos/GLInfo.java +++ b/src/demos/GLInfo.java @@ -7,6 +7,7 @@ import javax.media.opengl.util.*; import javax.media.opengl.glu.*; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class GLInfo implements GLEventListener { diff --git a/src/demos/context/DualContext.java b/src/demos/context/DualContext.java index b75e289..c30c851 100755 --- a/src/demos/context/DualContext.java +++ b/src/demos/context/DualContext.java @@ -47,6 +47,7 @@ import java.awt.GraphicsConfiguration; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.media.nwi.*; +import javax.media.nwi.awt.*; import javax.media.opengl.*; import javax.media.opengl.awt.*; import javax.media.opengl.glu.GLU; diff --git a/src/demos/es1/Info.java b/src/demos/es1/Info.java index 8a3c061..13cf038 100755 --- a/src/demos/es1/Info.java +++ b/src/demos/es1/Info.java @@ -7,6 +7,7 @@ import javax.media.opengl.util.*; import javax.media.opengl.glu.*; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class Info implements GLEventListener { diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java index 7865f15..1de39c6 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -6,10 +6,9 @@ import javax.media.opengl.*; import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.*; import javax.media.opengl.glu.*; -import com.sun.opengl.util.glsl.fixed.*; -import com.sun.opengl.impl.fixed.GLFixedFuncImpl; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class RedSquare implements WindowListener, KeyListener, MouseListener, GLEventListener { @@ -119,20 +118,7 @@ public class RedSquare implements WindowListener, KeyListener, MouseListener, GL private FloatBuffer vertices; public void init(GLAutoDrawable drawable) { - GLFixedFuncIf gl; - { - GL _gl = drawable.getGL(); - if(!GLFixedFuncUtil.isGLFixedFuncIf(_gl)) { - if(_gl.isGLES2()) { - gl = new GLFixedFuncImpl(_gl, new FixedFuncHook(_gl.getGL2ES2())); - } else { - gl = new GLFixedFuncImpl(_gl, _gl.getGL2ES1()); - } - _gl.getContext().setGL(gl); - } else { - gl = GLFixedFuncUtil.getGLFixedFuncIf(_gl); - } - } + GL2ES1 gl = GLFixedFuncUtil.getFixedFuncImpl(drawable.getGL()); System.err.println("Entering initialization"); System.err.println("GL Profile: "+GLProfile.getProfile()); @@ -167,7 +153,7 @@ public class RedSquare implements WindowListener, KeyListener, MouseListener, GL } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); + GL2ES1 gl = drawable.getGL().getGL2ES1(); // Set location in front of camera gl.glMatrixMode(gl.GL_PROJECTION); gl.glLoadIdentity(); @@ -177,7 +163,7 @@ public class RedSquare implements WindowListener, KeyListener, MouseListener, GL } public void display(GLAutoDrawable drawable) { - GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); + GL2ES1 gl = drawable.getGL().getGL2ES1(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // One rotation every four seconds @@ -194,7 +180,7 @@ public class RedSquare implements WindowListener, KeyListener, MouseListener, GL } public void dispose(GLAutoDrawable drawable) { - GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); + GL2ES1 gl = drawable.getGL().getGL2ES1(); System.out.println("Demo.dispose: "+gl.getContext()); gl.glDisableClientState(gl.GL_VERTEX_ARRAY); gl.glDisableClientState(gl.GL_COLOR_ARRAY); diff --git a/src/demos/es1/angeles/AngelesGL.java b/src/demos/es1/angeles/AngelesGL.java index 386d1db..b6317cc 100755 --- a/src/demos/es1/angeles/AngelesGL.java +++ b/src/demos/es1/angeles/AngelesGL.java @@ -29,8 +29,7 @@ import javax.media.opengl.sub.*; import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.*; import javax.media.opengl.glu.*; -import com.sun.opengl.util.glsl.fixed.*; -import com.sun.opengl.impl.fixed.GLFixedFuncImpl; +import com.sun.opengl.util.*; import java.nio.*; public class AngelesGL implements GLEventListener { @@ -83,22 +82,12 @@ public class AngelesGL implements GLEventListener { public void init(GLAutoDrawable drawable) { // FIXME: gl.setSwapInterval(1); - { - GL _gl = drawable.getGL(); - if(!GLFixedFuncUtil.isGLFixedFuncIf(_gl)) { - if(_gl.isGLES2()) { - this.gl = new GLFixedFuncImpl(_gl, new FixedFuncHook(_gl.getGL2ES2())); - } else { - this.gl = new GLFixedFuncImpl(_gl, _gl.getGL2ES1()); - } - _gl.getContext().setGL(this.gl); - } else { - this.gl = GLFixedFuncUtil.getGLFixedFuncIf(_gl); - } - System.err.println("AngelesGL: "+this.gl); - } + cComps = drawable.getGL().isGLES1() ? 4: 3; + + this.gl = GLFixedFuncUtil.getFixedFuncImpl(drawable.getGL()); + System.err.println("AngelesGL: "+this.gl); + this.glu = GLU.createGLU(); - cComps = gl.isGLES1() ? 4: 3; gl.glEnable(GL2ES1.GL_NORMALIZE); gl.glEnable(GL.GL_DEPTH_TEST); @@ -148,7 +137,7 @@ public class AngelesGL implements GLEventListener { this.x = x; this.y = y; - this.gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); + this.gl = drawable.getGL().getGL2ES1(); gl.glMatrixMode(gl.GL_MODELVIEW); gl.glLoadIdentity(); @@ -177,7 +166,7 @@ public class AngelesGL implements GLEventListener { if (gAppAlive==0) return; - this.gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); + this.gl = drawable.getGL().getGL2ES1(); // Actual tick value is "blurred" a little bit. sTick = (sTick + tick - sStartTick) >> 1; @@ -232,7 +221,7 @@ public class AngelesGL implements GLEventListener { } private boolean blendingEnabled = true; - private GLFixedFuncIf gl; // temp cache + private GL2ES1 gl; // temp cache private GLU glu; // Total run length is 20 * camera track base unit length (see cams.h). diff --git a/src/demos/es1/angeles/AngelesGLil.java b/src/demos/es1/angeles/AngelesGLil.java index 415008e..55694a3 100755 --- a/src/demos/es1/angeles/AngelesGLil.java +++ b/src/demos/es1/angeles/AngelesGLil.java @@ -29,8 +29,7 @@ import javax.media.opengl.sub.*; import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.*; import javax.media.opengl.glu.*; -import com.sun.opengl.util.glsl.fixed.*; -import com.sun.opengl.impl.fixed.GLFixedFuncImpl; +import com.sun.opengl.util.*; import java.nio.*; public class AngelesGLil implements GLEventListener { @@ -83,22 +82,12 @@ public class AngelesGLil implements GLEventListener { public void init(GLAutoDrawable drawable) { // FIXME: gl.setSwapInterval(1); - { - GL _gl = drawable.getGL(); - if(!GLFixedFuncUtil.isGLFixedFuncIf(_gl)) { - if(_gl.isGLES2()) { - this.gl = new GLFixedFuncImpl(_gl, new FixedFuncHook(_gl.getGL2ES2())); - } else { - this.gl = new GLFixedFuncImpl(_gl, _gl.getGL2ES1()); - } - _gl.getContext().setGL(this.gl); - } else { - this.gl = GLFixedFuncUtil.getGLFixedFuncIf(_gl); - } - System.err.println("AngelesGL: "+this.gl); - } + cComps = drawable.getGL().isGLES1() ? 4: 3; + + this.gl = GLFixedFuncUtil.getFixedFuncImpl(drawable.getGL()); + System.err.println("AngelesGL: "+this.gl); + this.glu = GLU.createGLU(); - cComps = gl.isGLES1() ? 4: 3; gl.glEnable(GL2ES1.GL_NORMALIZE); gl.glEnable(GL.GL_DEPTH_TEST); @@ -160,7 +149,7 @@ public class AngelesGLil implements GLEventListener { this.x = x; this.y = y; - this.gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); + this.gl = drawable.getGL().getGL2ES1(); gl.glMatrixMode(gl.GL_MODELVIEW); gl.glLoadIdentity(); @@ -189,7 +178,7 @@ public class AngelesGLil implements GLEventListener { if (gAppAlive==0) return; - this.gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); + this.gl = drawable.getGL().getGL2ES1(); // Actual tick value is "blurred" a little bit. sTick = (sTick + tick - sStartTick) >> 1; @@ -244,7 +233,7 @@ public class AngelesGLil implements GLEventListener { } private boolean blendingEnabled = true; - private GLFixedFuncIf gl; // temp cache + private GL2ES1 gl; // temp cache private GLU glu; // Total run length is 20 * camera track base unit length (see cams.h). diff --git a/src/demos/es1/angeles/Main.java b/src/demos/es1/angeles/Main.java index a4e345b..9a97305 100755 --- a/src/demos/es1/angeles/Main.java +++ b/src/demos/es1/angeles/Main.java @@ -4,6 +4,7 @@ import java.nio.*; import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class Main implements WindowListener, MouseListener { diff --git a/src/demos/es1/cube/Cube.java b/src/demos/es1/cube/Cube.java index cc2f8e8..e472af0 100644 --- a/src/demos/es1/cube/Cube.java +++ b/src/demos/es1/cube/Cube.java @@ -37,10 +37,9 @@ import javax.media.opengl.*; import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.*; import javax.media.opengl.glu.*; -import com.sun.opengl.util.glsl.fixed.*; -import com.sun.opengl.impl.fixed.GLFixedFuncImpl; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class Cube implements GLEventListener { boolean quit = false; @@ -77,20 +76,7 @@ public class Cube implements GLEventListener { } public void init(GLAutoDrawable drawable) { - GLFixedFuncIf gl; - { - GL _gl = drawable.getGL(); - if(!GLFixedFuncUtil.isGLFixedFuncIf(_gl)) { - if(_gl.isGLES2()) { - gl = new GLFixedFuncImpl(_gl, new FixedFuncHook(_gl.getGL2ES2())); - } else { - gl = new GLFixedFuncImpl(_gl, _gl.getGL2ES1()); - } - _gl.getContext().setGL(gl); - } else { - gl = GLFixedFuncUtil.getGLFixedFuncIf(_gl); - } - } + GL2ES1 gl = GLFixedFuncUtil.getFixedFuncImpl(drawable.getGL()); glu = GLU.createGLU(); @@ -110,11 +96,7 @@ public class Cube implements GLEventListener { public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { float aspect = (height != 0) ? ((float)width / (float)height) : 1.0f; - GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); - GL2ES1 gl2es1=null; - if(gl.isGL2ES1()) { - gl2es1 = drawable.getGL().getGL2ES1(); - } + GL2ES1 gl = drawable.getGL().getGL2ES1(); gl.glViewport(0, 0, width, height); @@ -145,12 +127,10 @@ public class Cube implements GLEventListener { gl.glDisable(gl.GL_LIGHT0); } gl.glEnable(gl.GL_CULL_FACE); - if(null!=gl2es1) { - gl.glEnable(gl.GL_NORMALIZE); + gl.glEnable(gl.GL_NORMALIZE); - gl.glShadeModel(gl.GL_SMOOTH); - gl.glDisable(GL.GL_DITHER); - } + gl.glShadeModel(gl.GL_SMOOTH); + gl.glDisable(GL.GL_DITHER); gl.glEnableClientState(gl.GL_VERTEX_ARRAY); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboNames[0]); @@ -173,17 +153,14 @@ public class Cube implements GLEventListener { gl.glBufferData(GL.GL_ARRAY_BUFFER, cubeTexCoords.limit() * BufferUtil.SIZEOF_SHORT, cubeTexCoords, GL.GL_STATIC_DRAW); gl.glTexCoordPointer(2, gl.GL_SHORT, 0, 0); /* issues an GL_INVALID_ENUM - if(null!=gl2es1) { - gl2es1.glTexEnvi(gl2es1.GL_TEXTURE_ENV, gl2es1.GL_TEXTURE_ENV_MODE, gl2es1.GL_INCR); + gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_INCR); } */ } else { gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY); } gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); - if(null!=gl2es1) { - gl2es1.glHint(gl2es1.GL_PERSPECTIVE_CORRECTION_HINT, gl2es1.GL_FASTEST); - } + gl.glHint(gl.GL_PERSPECTIVE_CORRECTION_HINT, gl.GL_FASTEST); gl.glMatrixMode(gl.GL_PROJECTION); gl.glLoadIdentity(); @@ -201,7 +178,7 @@ public class Cube implements GLEventListener { } public void display(GLAutoDrawable drawable) { - GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); + GL2ES1 gl = drawable.getGL().getGL2ES1(); gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT); diff --git a/src/demos/es1/cube/CubeImmModeSink.java b/src/demos/es1/cube/CubeImmModeSink.java index 235d376..9a9d7cf 100644 --- a/src/demos/es1/cube/CubeImmModeSink.java +++ b/src/demos/es1/cube/CubeImmModeSink.java @@ -36,11 +36,11 @@ import javax.media.opengl.*; import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.*; import javax.media.opengl.glu.*; -import com.sun.opengl.util.glsl.fixed.*; -import com.sun.opengl.impl.fixed.GLFixedFuncImpl; +import com.sun.opengl.util.*; import java.nio.*; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class CubeImmModeSink implements GLEventListener { boolean quit = false; @@ -53,7 +53,7 @@ public class CubeImmModeSink implements GLEventListener { ByteBuffer cubeIndices=null; ImmModeSink vboCubeF = null; - public void drawCube(GLFixedFuncIf gl, float extent) { + public void drawCube(GL2ES1 gl, float extent) { if(cubeIndices==null) { cubeIndices = BufferUtil.newByteBuffer(s_cubeIndices); } @@ -89,7 +89,7 @@ public class CubeImmModeSink implements GLEventListener { private GLUquadric sphere=null; private ImmModeSink vboSphere=null; - public void drawSphere(GLFixedFuncIf gl, float radius, int slices, int stacks) { + public void drawSphere(GL2ES1 gl, float radius, int slices, int stacks) { if(sphere==null) { sphere = glu.gluNewQuadric(); sphere.enableImmModeSink(true); @@ -114,7 +114,7 @@ public class CubeImmModeSink implements GLEventListener { private GLUquadric cylinder=null; private ImmModeSink vboCylinder=null; - public void drawCylinder(GLFixedFuncIf gl, float radius, float halfHeight, int upAxis) { + public void drawCylinder(GL2ES1 gl, float radius, float halfHeight, int upAxis) { if(cylinder==null) { cylinder = glu.gluNewQuadric(); cylinder.enableImmModeSink(true); @@ -167,20 +167,7 @@ public class CubeImmModeSink implements GLEventListener { } public void init(GLAutoDrawable drawable) { - GLFixedFuncIf gl; - { - GL _gl = drawable.getGL(); - if(!GLFixedFuncUtil.isGLFixedFuncIf(_gl)) { - if(_gl.isGLES2()) { - gl = new GLFixedFuncImpl(_gl, new FixedFuncHook(_gl.getGL2ES2())); - } else { - gl = new GLFixedFuncImpl(_gl, _gl.getGL2ES1()); - } - _gl.getContext().setGL(gl); - } else { - gl = GLFixedFuncUtil.getGLFixedFuncIf(_gl); - } - } + GL2ES1 gl = GLFixedFuncUtil.getFixedFuncImpl(drawable.getGL()); glu = GLU.createGLU(); @@ -208,11 +195,7 @@ public class CubeImmModeSink implements GLEventListener { public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { float aspect = (height != 0) ? ((float)width / (float)height) : 1.0f; - GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); - GL2ES1 gl2es1=null; - if(gl.isGL2ES1()) { - gl2es1 = drawable.getGL().getGL2ES1(); - } + GL2ES1 gl = drawable.getGL().getGL2ES1(); gl.glViewport(0, 0, width, height); @@ -243,9 +226,7 @@ public class CubeImmModeSink implements GLEventListener { gl.glShadeModel(gl.GL_SMOOTH); gl.glDisable(gl.GL_DITHER); - if(null!=gl2es1) { - gl2es1.glHint(gl2es1.GL_PERSPECTIVE_CORRECTION_HINT, gl2es1.GL_FASTEST); - } + gl.glHint(gl.GL_PERSPECTIVE_CORRECTION_HINT, gl.GL_FASTEST); gl.glMatrixMode(gl.GL_PROJECTION); gl.glLoadIdentity(); @@ -263,11 +244,7 @@ public class CubeImmModeSink implements GLEventListener { } public void display(GLAutoDrawable drawable) { - GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); - GL2ES1 gl2es1=null; - if(gl.isGL2ES1()) { - gl2es1 = drawable.getGL().getGL2ES1(); - } + GL2ES1 gl = drawable.getGL().getGL2ES1(); gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT); diff --git a/src/demos/es1/cubefbo/FBCubes.java b/src/demos/es1/cubefbo/FBCubes.java index 624bbc2..cd350d5 100755 --- a/src/demos/es1/cubefbo/FBCubes.java +++ b/src/demos/es1/cubefbo/FBCubes.java @@ -38,8 +38,6 @@ import javax.media.opengl.*; import javax.media.opengl.util.*; import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.FBObject; -import com.sun.opengl.util.glsl.fixed.*; -import com.sun.opengl.impl.fixed.GLFixedFuncImpl; import java.nio.*; class FBCubes implements GLEventListener { @@ -56,23 +54,7 @@ class FBCubes implements GLEventListener { } public void init(GLAutoDrawable drawable) { - GLFixedFuncIf gl; - { - GL _gl = drawable.getGL(); - // drawable.setGL(new DebugGL2(_gl.getGL2())); - // _gl = drawable.getGL(); - if(!GLFixedFuncUtil.isGLFixedFuncIf(_gl)) { - if(_gl.isGLES2()) { - gl = new GLFixedFuncImpl(_gl, new FixedFuncHook(_gl.getGL2ES2())); - } else { - gl = new GLFixedFuncImpl(_gl, _gl.getGL2ES1()); - } - _gl.getContext().setGL(gl); - } else { - gl = GLFixedFuncUtil.getGLFixedFuncIf(_gl); - } - } - + GL2ES1 gl = GLFixedFuncUtil.getFixedFuncImpl(drawable.getGL()); System.out.println(gl); gl.glGetError(); // flush error .. @@ -114,7 +96,7 @@ class FBCubes implements GLEventListener { } public void dispose(GLAutoDrawable drawable) { - GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); + GL2ES1 gl = drawable.getGL().getGL2ES1(); fbo1.destroy(gl); fbo1=null; cubeInner.dispose(drawable); @@ -124,7 +106,7 @@ class FBCubes implements GLEventListener { } public void display(GLAutoDrawable drawable) { - GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); + GL2ES1 gl = drawable.getGL().getGL2ES1(); fbo1.bind(gl); cubeInner.reshape(drawable, 0, 0, FBO_SIZE, FBO_SIZE); diff --git a/src/demos/es1/cubefbo/Main.java b/src/demos/es1/cubefbo/Main.java index 9d3df4e..5b46773 100755 --- a/src/demos/es1/cubefbo/Main.java +++ b/src/demos/es1/cubefbo/Main.java @@ -4,6 +4,7 @@ import java.nio.*; import javax.media.nwi.*; import javax.media.opengl.*; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class Main implements WindowListener, MouseListener { diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java index b224233..647434a 100755 --- a/src/demos/es2/RedSquare.java +++ b/src/demos/es2/RedSquare.java @@ -8,8 +8,10 @@ import javax.media.opengl.util.*; import javax.media.opengl.glu.*; import com.sun.opengl.util.glsl.*; +import com.sun.opengl.util.*; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class RedSquare implements MouseListener, GLEventListener { diff --git a/src/demos/es2/openmax/Cube.java b/src/demos/es2/openmax/Cube.java index d782bd3..44f607c 100644 --- a/src/demos/es2/openmax/Cube.java +++ b/src/demos/es2/openmax/Cube.java @@ -36,11 +36,10 @@ import javax.media.opengl.*; import javax.media.opengl.sub.fixed.*; import javax.media.opengl.util.*; import javax.media.opengl.glu.*; -import com.sun.opengl.util.glsl.fixed.*; -import com.sun.opengl.impl.fixed.GLFixedFuncImpl; import java.nio.*; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class Cube implements GLEventListener { boolean quit = false; @@ -93,20 +92,7 @@ public class Cube implements GLEventListener { } public void init(GLAutoDrawable drawable) { - GLFixedFuncIf gl; - { - GL _gl = drawable.getGL(); - if(!GLFixedFuncUtil.isGLFixedFuncIf(_gl)) { - if(_gl.isGLES2()) { - gl = new GLFixedFuncImpl(_gl, new FixedFuncHook(_gl.getGL2ES2())); - } else { - gl = new GLFixedFuncImpl(_gl, _gl.getGL2ES1()); - } - _gl.getContext().setGL(gl); - } else { - gl = GLFixedFuncUtil.getGLFixedFuncIf(_gl); - } - } + GL2ES1 gl = GLFixedFuncUtil.getFixedFuncImpl(drawable.getGL()); glu = GLU.createGLU(); @@ -126,11 +112,7 @@ public class Cube implements GLEventListener { public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { float aspect = (height != 0) ? ((float)width / (float)height) : 1.0f; - GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); - GL2ES1 gl2es1=null; - if(gl.isGL2ES1()) { - gl2es1 = drawable.getGL().getGL2ES1(); - } + GL2ES1 gl = drawable.getGL().getGL2ES1(); gl.glViewport(0, 0, width, height); @@ -161,12 +143,10 @@ public class Cube implements GLEventListener { gl.glDisable(gl.GL_LIGHT0); } gl.glEnable(gl.GL_CULL_FACE); - if(null!=gl2es1) { - gl.glEnable(gl.GL_NORMALIZE); + gl.glEnable(gl.GL_NORMALIZE); - gl.glShadeModel(gl.GL_SMOOTH); - gl.glDisable(GL.GL_DITHER); - } + gl.glShadeModel(gl.GL_SMOOTH); + gl.glDisable(GL.GL_DITHER); gl.glEnableClientState(gl.GL_VERTEX_ARRAY); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboNames[0]); @@ -191,17 +171,13 @@ public class Cube implements GLEventListener { gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboNames[3]); gl.glBufferData(GL.GL_ARRAY_BUFFER, cubeTexCoords.limit() * BufferUtil.SIZEOF_SHORT, cubeTexCoords, GL.GL_STATIC_DRAW); gl.glTexCoordPointer(2, gl.GL_SHORT, 0, 0); - if(null!=gl2es1) { - gl2es1.glTexEnvi(gl2es1.GL_TEXTURE_ENV, gl2es1.GL_TEXTURE_ENV_MODE, gl2es1.GL_INCR); - } + gl.glTexEnvi(gl.GL_TEXTURE_ENV, gl.GL_TEXTURE_ENV_MODE, gl.GL_INCR); } else { gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY); } gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); - if(null!=gl2es1) { - gl2es1.glHint(gl2es1.GL_PERSPECTIVE_CORRECTION_HINT, gl2es1.GL_FASTEST); - } + gl.glHint(gl.GL_PERSPECTIVE_CORRECTION_HINT, gl.GL_FASTEST); gl.glMatrixMode(gl.GL_PROJECTION); gl.glLoadIdentity(); @@ -219,7 +195,7 @@ public class Cube implements GLEventListener { } public void display(GLAutoDrawable drawable) { - GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); + GL2ES1 gl = drawable.getGL().getGL2ES1(); gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT); diff --git a/src/demos/es2/openmax/MovieCube.java b/src/demos/es2/openmax/MovieCube.java index 7e6c588..75fba14 100755 --- a/src/demos/es2/openmax/MovieCube.java +++ b/src/demos/es2/openmax/MovieCube.java @@ -39,8 +39,6 @@ import javax.media.nwi.*; import javax.media.opengl.*; import javax.media.opengl.util.*; import javax.media.opengl.sub.fixed.*; -import com.sun.opengl.util.glsl.fixed.*; -import com.sun.opengl.impl.fixed.GLFixedFuncImpl; import com.sun.openmax.*; @@ -48,6 +46,7 @@ import java.nio.*; import java.net.*; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class MovieCube implements MouseListener, GLEventListener, OMXEventListener { GLWindow window; @@ -125,20 +124,7 @@ public class MovieCube implements MouseListener, GLEventListener, OMXEventListen } public void init(GLAutoDrawable drawable) { - GLFixedFuncIf gl; - { - GL _gl = drawable.getGL(); - if(!GLFixedFuncUtil.isGLFixedFuncIf(_gl)) { - if(_gl.isGLES2()) { - gl = new GLFixedFuncImpl(_gl, new FixedFuncHook(_gl.getGL2ES2())); - } else { - gl = new GLFixedFuncImpl(_gl, _gl.getGL2ES1()); - } - _gl.getContext().setGL(gl); - } else { - gl = GLFixedFuncUtil.getGLFixedFuncIf(_gl); - } - } + GL2ES1 gl = GLFixedFuncUtil.getFixedFuncImpl(drawable.getGL()); System.out.println(gl); gl.glGetError(); // flush error .. @@ -194,7 +180,7 @@ public class MovieCube implements MouseListener, GLEventListener, OMXEventListen } public void display(GLAutoDrawable drawable) { - GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL()); + GL2ES1 gl = drawable.getGL().getGL2ES1(); com.sun.opengl.util.texture.Texture tex = null; if(null!=movie) { diff --git a/src/demos/es2/openmax/MovieSimple.java b/src/demos/es2/openmax/MovieSimple.java index c626bc2..376c576 100755 --- a/src/demos/es2/openmax/MovieSimple.java +++ b/src/demos/es2/openmax/MovieSimple.java @@ -39,6 +39,7 @@ import javax.media.opengl.*; import javax.media.opengl.util.*; import com.sun.opengl.util.glsl.*; +import com.sun.opengl.util.*; import com.sun.openmax.*; @@ -46,6 +47,7 @@ import java.nio.*; import java.net.*; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class MovieSimple implements MouseListener, GLEventListener, OMXEventListener { private GLWindow window; diff --git a/src/demos/es2/perftst/PerfTextLoad.java b/src/demos/es2/perftst/PerfTextLoad.java index 722ecc1..56073c1 100755 --- a/src/demos/es2/perftst/PerfTextLoad.java +++ b/src/demos/es2/perftst/PerfTextLoad.java @@ -7,8 +7,10 @@ import javax.media.opengl.*; import javax.media.opengl.util.*; import com.sun.opengl.impl.io.*; import com.sun.opengl.util.texture.*; +import com.sun.opengl.util.*; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class PerfTextLoad extends PerfModule { static final int MAX_TEXTURE_ENGINES = 8; diff --git a/src/demos/es2/perftst/PerfUniLoad.java b/src/demos/es2/perftst/PerfUniLoad.java index 9e4f347..4226f1c 100755 --- a/src/demos/es2/perftst/PerfUniLoad.java +++ b/src/demos/es2/perftst/PerfUniLoad.java @@ -3,8 +3,10 @@ package demos.es2.perftst; import java.nio.*; import javax.media.opengl.*; import javax.media.opengl.util.*; +import com.sun.opengl.util.*; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class PerfUniLoad extends PerfModule { static final int MAX_ARRAYS = 12; diff --git a/src/demos/es2/perftst/PerfVBOLoad.java b/src/demos/es2/perftst/PerfVBOLoad.java index b7070c3..c9d5dfc 100755 --- a/src/demos/es2/perftst/PerfVBOLoad.java +++ b/src/demos/es2/perftst/PerfVBOLoad.java @@ -3,8 +3,10 @@ package demos.es2.perftst; import java.nio.*; import javax.media.opengl.*; import javax.media.opengl.util.*; +import com.sun.opengl.util.*; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class PerfVBOLoad extends PerfModule { diff --git a/src/demos/es2/perftst/Perftst.java b/src/demos/es2/perftst/Perftst.java index d27ba9e..35edf82 100755 --- a/src/demos/es2/perftst/Perftst.java +++ b/src/demos/es2/perftst/Perftst.java @@ -7,9 +7,10 @@ import javax.media.opengl.util.*; import com.sun.opengl.util.glsl.*; -import com.sun.opengl.impl.GLReflection; +import com.sun.nwi.impl.NWReflection; import com.sun.javafx.newt.*; +import com.sun.javafx.newt.opengl.*; public class Perftst implements MouseListener, GLEventListener { @@ -173,7 +174,7 @@ public class Perftst implements MouseListener, GLEventListener { } } - PerfModule pmod = (PerfModule) GLReflection.createInstance(tstName); + PerfModule pmod = (PerfModule) NWReflection.createInstance(tstName); new Perftst().run(type, pmod); System.exit(0); } |