summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-03-05 01:25:12 +0000
committerSven Gothel <[email protected]>2009-03-05 01:25:12 +0000
commite03aaaf1b14cc40cb2c8f2158acf02390c4fafe6 (patch)
treecf7eacef23ee86b7e1dfddd69800eaa303ce399b
parent612955ad82326024f5cb99d9fe4175dce78caa27 (diff)
- Fixed rootrel.build usage, this works properly through gluegen, jogl-demos and this build.
You can say -Drootrel.build=build-x86_64 for example. - Fixed jogl-demos in regard to this changeset - Gluegen - Fixed gluegen BuildComposablePipeline's 'getGL*' methods. Now they return 'this', otherwise the pipeline would be broken/removed. - Add BuildComposablePipeline CustomPipeline, which allows customized class composition with an interface (to be wrapped), prolog class and the downstream class. - Add GlueGen (incl. ant task) 'outputRootDir' to be able to set a top output root dir via ant / commandline. - GL fixed function - Package 'javax.media.opengl.sub.fixed.*' defines some fixed function interfaces. This allows partitioning of custom implementation. - Using gluegen's new CustomPipeline to compose a GLFixedFuncIf implementation, using a GL downstream and a GLFixedFuncHookIf prolog. The latter implements the fixed functionality. Example is the GLFixedFuncImpl. gl.getContext().setGL( new GLFixedFuncImpl(gl, new FixedFuncHook(gl.getGL2ES2())) ) ; or gl.getContext().setGL( new GLFixedFuncImpl(gl, gl.getGL2ES1()) ) ; - The example GLFixedFuncHookIf impl FixedFuncPipeline/ can be instantiated with custom shader code. - ES2 and all other interfaces only contain the original functionality, besides minor convenient data access methods. - Fix: GL2ES2 createCompileShader() and createLoadShader() is moved to ShaderCode util class. - Updated PMVMatrix - Add: GLAutoDrawable.setContext() .. and all it's implementations Necessary to set a new GLContext. - Add: GLContext getAttachedObject(int) and putAttachedObject(int, Object), to allow the user to attach application specific and TLS sensitive objects to the GLContext. - git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@316 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
-rw-r--r--make/build.xml55
-rw-r--r--src/demos/cg/runtime_ogl/cgGL_vertex_example.java14
-rw-r--r--src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java4
-rwxr-xr-xsrc/demos/context/DualContext.java8
-rwxr-xr-xsrc/demos/cubefbo/CubeObject.java37
-rwxr-xr-xsrc/demos/cubefbo/FBCubes.java1
-rwxr-xr-xsrc/demos/cubefbo/FBObject.java1
-rwxr-xr-xsrc/demos/es1/RedSquare.java39
-rwxr-xr-xsrc/demos/es1/angeles/AngelesES1.java2
-rwxr-xr-xsrc/demos/es1/angeles/AngelesGL.java107
-rwxr-xr-xsrc/demos/es1/angeles/AngelesGLil.java118
-rw-r--r--src/demos/es1/cube/Cube.java46
-rw-r--r--src/demos/es1/cube/CubeImmModeSink.java56
-rwxr-xr-xsrc/demos/es1/cubefbo/FBCubes.java25
-rwxr-xr-xsrc/demos/es2/RedSquare.java15
-rw-r--r--src/demos/es2/openmax/Cube.java49
-rwxr-xr-xsrc/demos/es2/openmax/MovieCube.java24
-rwxr-xr-xsrc/demos/es2/openmax/MovieSimple.java16
-rwxr-xr-xsrc/demos/es2/perftst/Perftst.java14
-rw-r--r--src/demos/gears/Gears.java1
-rwxr-xr-xsrc/demos/hdr/ARBFPPipeline.java1
-rwxr-xr-xsrc/demos/hdr/HDR.java1
-rwxr-xr-xsrc/demos/hdr/Pipeline.java1
-rw-r--r--src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java15
-rw-r--r--src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java5
-rwxr-xr-xsrc/demos/j2d/CustomText.java7
-rwxr-xr-xsrc/demos/j2d/FlyingText.java1
-rwxr-xr-xsrc/demos/j2d/TextCube.java5
-rwxr-xr-xsrc/demos/misc/Picking.java8
-rwxr-xr-xsrc/demos/misc/TiledRendering.java17
-rwxr-xr-xsrc/demos/multisample/Multisample.java4
-rwxr-xr-xsrc/demos/nurbs/curveapp/GLListener.java4
-rwxr-xr-xsrc/demos/nurbs/surfaceapp/GLListener.java1
-rwxr-xr-xsrc/demos/particles/engine/GLComponent.java10
-rw-r--r--src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java3
-rw-r--r--src/demos/proceduralTexturePhysics/Water.java1
-rw-r--r--src/demos/tess/Tess.java1
-rwxr-xr-xsrc/demos/testContextDestruction/TestContextDestruction.java1
-rw-r--r--src/demos/testContextSharing/TestContextSharing.java1
-rwxr-xr-xsrc/demos/texture/TestSubImage.java7
-rwxr-xr-xsrc/demos/texture/TestTexture.java9
-rw-r--r--src/demos/util/Triceratops.java1
-rw-r--r--src/demos/vertexArrayRange/VertexArrayRange.java37
-rw-r--r--src/demos/vertexBufferObject/VertexBufferObject.java33
-rw-r--r--src/demos/vertexProgRefract/VertexProgRefract.java10
-rw-r--r--src/demos/vertexProgWarp/VertexProgWarp.java7
-rwxr-xr-xsrc/demos/xtrans/XTBasicTransition.java1
-rwxr-xr-xsrc/demos/xtrans/XTDesktopManager.java1
-rwxr-xr-xsrc/demos/xtrans/XTDesktopPane.java13
-rw-r--r--src/gleem/ExaminerViewer.java14
-rw-r--r--src/gleem/ManipPartLineSeg.java6
-rw-r--r--src/gleem/ManipPartTriBased.java8
-rw-r--r--src/gleem/TestExaminerViewer.java17
-rw-r--r--src/gleem/TestHandleBox.java23
-rw-r--r--src/gleem/TestMultiWin.java17
-rw-r--r--src/gleem/TestTranslate1.java23
-rw-r--r--src/gleem/TestTranslate2.java23
57 files changed, 552 insertions, 417 deletions
diff --git a/make/build.xml b/make/build.xml
index 7349706..e9aba45 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -11,6 +11,13 @@
- built into its build directory.
-->
<project name="JOGL.demos" default="all">
+
+ <condition property="rootrel.build" value="build">
+ <not>
+ <isset property="rootrel.build"/>
+ </not>
+ </condition>
+
<!--
- Make sure that jogl-demos.jar is not on the CLASSPATH; this can
- cause builds to fail since if this Java process has the jar file
@@ -48,32 +55,32 @@
</target>
<target name="init" depends="java.class.path.validate,setup.gles,setup.cg.excludes,skip.cg.excludes">
- <property name="jogl.core.jar" value="../../jogl/build/jogl.core.jar" />
- <property name="jogl.oswin.jar" value="../../jogl/build/jogl.oswin.jar" />
- <property name="jogl.gles12.jar" value="../../jogl/build/jogl.gles12.jar" />
- <property name="jogl.gles12.dbg.jar" value="../../jogl/build/jogl.gles12.dbg.jar" />
- <property name="jogl.gles2.jar" value="../../jogl/build/jogl.gles2.jar" />
- <property name="jogl.gles2.dbg.jar" value="../../jogl/build/jogl.gles2.dbg.jar" />
- <property name="jogl.egl.jar" value="../../jogl/build/jogl.egl.jar" />
- <property name="jogl.gl2.jar" value="../../jogl/build/jogl.gl2.jar" />
- <property name="jogl.gl2.dbg.jar" value="../../jogl/build/jogl.gl2.dbg.jar" />
- <property name="jogl.awt.jar" value="../../jogl/build/jogl.awt.jar" />
- <property name="jogl.util.jar" value="../../jogl/build/jogl.util.jar" />
- <property name="jogl.util.awt.jar" value="../../jogl/build/jogl.util.awt.jar" />
- <property name="jogl.util.gl2.jar" value="../../jogl/build/jogl.util.gl2.jar" />
- <property name="newt.jar" value="../../jogl/build/newt.jar" />
+ <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="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" />
- <property name="classes" value="../build/classes" />
+ <property name="classes" value="../${rootrel.build}/classes" />
<property name="src" value="../src" />
<property name="javadoc" value="../javadoc" />
<property name="javadoc.link" value="http://java.sun.com/j2se/1.4.2/docs/api/" />
<property name="javadoc.link.jogl" value="../../jogl/javadoc-public/" />
- <property name="jogl.demos.jar" value="../build/jogl-demos.jar" />
- <property name="jogl.demos.util.jar" value="../build/jogl-demos-util.jar" />
- <property name="jogl.demos.data.jar" value="../build/jogl-demos-data.jar" />
- <property name="jogl.demos.src.zip" value="../build/jogl-demos-src.zip" />
+ <property name="jogl.demos.jar" value="../${rootrel.build}/jogl-demos.jar" />
+ <property name="jogl.demos.util.jar" value="../${rootrel.build}/jogl-demos-util.jar" />
+ <property name="jogl.demos.data.jar" value="../${rootrel.build}/jogl-demos-data.jar" />
+ <property name="jogl.demos.src.zip" value="../${rootrel.build}/jogl-demos-src.zip" />
</target>
<target name="nurbs" if="jogl.nurbs">
@@ -83,15 +90,15 @@
<classpath refid="jogl-demos.classpath" />
</javac>
<!-- Copy icons to output dir -->
- <copy todir="../build">
+ <copy todir="../${rootrel.build}">
<fileset dir="${src}">
<include name="demos/nurbs/icons/*.png" />
</fileset>
</copy>
<!-- Copy dependent libraries to output dir -->
- <copy file="../lib/simple-xml-1.1.1.jar" todir="../build" />
- <copy file="../lib/stax-api-1.0.1.jar" todir="../build" />
- <copy file="../lib/stax-1.2.0.jar" todir="../build" />
+ <copy file="../lib/simple-xml-1.1.1.jar" todir="../${rootrel.build}" />
+ <copy file="../lib/stax-api-1.0.1.jar" todir="../${rootrel.build}" />
+ <copy file="../lib/stax-1.2.0.jar" todir="../${rootrel.build}" />
</target>
<target name="all-desktop" unless="isGLES">
@@ -211,7 +218,7 @@
<target name="clean" depends="init">
<delete includeEmptyDirs="true" quiet="true">
- <fileset dir="../build" />
+ <fileset dir="../${rootrel.build}" />
<fileset dir="../javadoc" />
</delete>
</target>
diff --git a/src/demos/cg/runtime_ogl/cgGL_vertex_example.java b/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
index 2324e0e..d35bd6f 100644
--- a/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
+++ b/src/demos/cg/runtime_ogl/cgGL_vertex_example.java
@@ -229,24 +229,24 @@ public class cgGL_vertex_example implements GLEventListener
InitializeCube(CubeVertices);
/* Enable a single OpenGL light. */
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, LightDiffuse, 0);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, LightPosition, 0);
- gl.glEnable(GL.GL_LIGHT0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_DIFFUSE, LightDiffuse, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, LightPosition, 0);
+ gl.glEnable(GL2ES1.GL_LIGHT0);
if (false) { // #if 0
- gl.glEnable(GL.GL_LIGHTING);
+ gl.glEnable(GL2ES1.GL_LIGHTING);
} else { // #else
- gl.glDisable(GL.GL_LIGHTING);
+ gl.glDisable(GL2ES1.GL_LIGHTING);
} // #endif
/* Use depth buffering for hidden surface elimination. */
gl.glEnable(GL.GL_DEPTH_TEST);
/* Setup the view of the cube. */
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
glu.gluPerspective( /* field of view in degree */ 40.0f,
/* aspect ratio */ 1.0f,
/* Z near */ 1.0f, /* Z far */ 10.0f);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
glu.gluLookAt(0.0f, 0.0f, 5.0f, /* eye is at (0,0,5) */
0.0f, 0.0f, 0.0f, /* center is at (0,0,0) */
0.0f, 1.0f, 0.); /* up is in positive Y direction */
diff --git a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
index da23072..1239bf9 100644
--- a/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
+++ b/src/demos/cg/runtime_ogl_vertex_fragment/runtime_ogl_vertex_fragment.java
@@ -137,11 +137,11 @@ public class runtime_ogl_vertex_fragment implements GLEventListener
gl.glClearColor(.25f, .25f, .25f, 1.0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(30.0f, 1.0f, .1f, 100);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
glu.gluLookAt(4, 4, -4, 0, 0, 0, 0, 1, 0);
diff --git a/src/demos/context/DualContext.java b/src/demos/context/DualContext.java
index 8c801a6..3a24579 100755
--- a/src/demos/context/DualContext.java
+++ b/src/demos/context/DualContext.java
@@ -98,7 +98,7 @@ public class DualContext extends Canvas {
String str = "" + (++repaintNum);
int res = context1.makeCurrent();
if (res != GLContext.CONTEXT_NOT_CURRENT) {
- clearAndDraw(context1.getGL(),
+ clearAndDraw(context1.getGL().getGL2(),
1, 0, 0,
0, 0, mid, height, str);
context1.release();
@@ -106,7 +106,7 @@ public class DualContext extends Canvas {
res = context2.makeCurrent();
if (res != GLContext.CONTEXT_NOT_CURRENT) {
- clearAndDraw(context2.getGL(),
+ clearAndDraw(context2.getGL().getGL2(),
0, 0, 1,
mid, 0, width - mid, height, str);
context2.release();
@@ -115,7 +115,7 @@ public class DualContext extends Canvas {
drawable.swapBuffers();
}
- private void clearAndDraw(GL gl,
+ private void clearAndDraw(GL2 gl,
float br,
float bg,
float bb,
@@ -130,7 +130,7 @@ public class DualContext extends Canvas {
gl.glClearColor(br, bg, bb, 1);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
float length = glut.glutStrokeLengthf(GLUT.STROKE_ROMAN, str);
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluOrtho2D(x, x + width, y, y + height);
gl.glTranslatef(x + (width - length) / 2, y + height / 2, 0);
diff --git a/src/demos/cubefbo/CubeObject.java b/src/demos/cubefbo/CubeObject.java
index ffef04d..e192554 100755
--- a/src/demos/cubefbo/CubeObject.java
+++ b/src/demos/cubefbo/CubeObject.java
@@ -36,6 +36,7 @@ package demos.cubefbo;
import java.nio.ByteBuffer;
import java.nio.ShortBuffer;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.util.BufferUtil;
@@ -91,38 +92,38 @@ class CubeObject {
gl.glViewport(0, 0, width, height);
gl.glScissor(0, 0, width, height);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, light_position, 0);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, light_ambient, 0);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, light_diffuse, 0);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_SPECULAR, zero_vec4, 0);
- gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, material_spec, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, light_position, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_AMBIENT, light_ambient, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_DIFFUSE, light_diffuse, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_SPECULAR, zero_vec4, 0);
+ gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2ES1.GL_SPECULAR, material_spec, 0);
- gl.glEnable(GL.GL_NORMALIZE);
- gl.glEnable(GL.GL_LIGHTING);
- gl.glEnable(GL.GL_LIGHT0);
- gl.glEnable(GL.GL_COLOR_MATERIAL);
+ gl.glEnable(GL2ES1.GL_NORMALIZE);
+ gl.glEnable(GL2ES1.GL_LIGHTING);
+ gl.glEnable(GL2ES1.GL_LIGHT0);
+ gl.glEnable(GL2ES1.GL_COLOR_MATERIAL);
gl.glEnable(GL.GL_CULL_FACE);
gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_FASTEST);
- gl.glShadeModel(GL.GL_SMOOTH);
+ gl.glShadeModel(GL2ES1.GL_SMOOTH);
gl.glDisable(GL.GL_DITHER);
gl.glClearColor(0.0f, 0.1f, 0.0f, 1.0f);
- gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
- gl.glEnableClientState(GL.GL_NORMAL_ARRAY);
- gl.glEnableClientState(GL.GL_COLOR_ARRAY);
+ gl.glEnableClientState(GL2ES1.GL_VERTEX_ARRAY);
+ gl.glEnableClientState(GL2ES1.GL_NORMAL_ARRAY);
+ gl.glEnableClientState(GL2ES1.GL_COLOR_ARRAY);
if (cubeTexCoords != null) {
- gl.glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY);
+ gl.glEnableClientState(GL2ES1.GL_TEXTURE_COORD_ARRAY);
} else {
- gl.glDisableClientState(GL.GL_TEXTURE_COORD_ARRAY);
+ gl.glDisableClientState(GL2ES1.GL_TEXTURE_COORD_ARRAY);
}
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
perspective(gl, 55.f, aspect, 0.1f, 100.f);
@@ -137,7 +138,7 @@ class CubeObject {
//g.setColor(0, 255, 0);
//g.fillRect(20, 20, width - 40, height - 40);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glTranslatef(0.f, 0.f, -30.f);
diff --git a/src/demos/cubefbo/FBCubes.java b/src/demos/cubefbo/FBCubes.java
index e588cc6..78233e2 100755
--- a/src/demos/cubefbo/FBCubes.java
+++ b/src/demos/cubefbo/FBCubes.java
@@ -38,6 +38,7 @@ import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import javax.media.opengl.DebugGL2;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
diff --git a/src/demos/cubefbo/FBObject.java b/src/demos/cubefbo/FBObject.java
index 76e0ed9..0873888 100755
--- a/src/demos/cubefbo/FBObject.java
+++ b/src/demos/cubefbo/FBObject.java
@@ -33,6 +33,7 @@
package demos.cubefbo;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java
index f0aa540..04ea334 100755
--- a/src/demos/es1/RedSquare.java
+++ b/src/demos/es1/RedSquare.java
@@ -2,8 +2,11 @@ package demos.es1;
import java.nio.*;
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.*;
@@ -93,8 +96,21 @@ public class RedSquare implements MouseListener, GLEventListener {
private FloatBuffer vertices;
public void init(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
- glu = GLU.createGLU();
+ 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);
+ }
+ }
+
System.err.println("Entering initialization");
System.err.println("GL Profile: "+GLProfile.getProfile());
System.err.println("GL:" + gl);
@@ -102,10 +118,7 @@ public class RedSquare implements MouseListener, GLEventListener {
System.err.println("GL_EXTENSIONS:");
System.err.println(" " + gl.glGetString(gl.GL_EXTENSIONS));
- if(gl.isGLES2()) {
- gl.getGLES2().enableFixedFunctionEmulationMode(GLES2.FIXED_EMULATION_VERTEXCOLORTEXTURE);
- System.err.println("RedSquare Fixed emu: FIXED_EMULATION_VERTEXCOLORTEXTURE");
- }
+ glu = GLU.createGLU();
// Allocate vertex arrays
colors = BufferUtil.newFloatBuffer(16);
@@ -122,16 +135,16 @@ public class RedSquare implements MouseListener, GLEventListener {
gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
gl.glEnableClientState(gl.GL_COLOR_ARRAY);
- gl.glVertexPointer(3, gl.GL_FLOAT, 0, vertices);
- gl.glColorPointer(4, gl.GL_FLOAT, 0, colors);
+ gl.glVertexPointer(3, GL.GL_FLOAT, 0, vertices);
+ gl.glColorPointer(4, GL.GL_FLOAT, 0, colors);
// OpenGL Render Settings
gl.glClearColor(0, 0, 0, 1);
- gl.glEnable(gl.GL_DEPTH_TEST);
+ gl.glEnable(GL.GL_DEPTH_TEST);
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
- GL gl = drawable.getGL();
+ GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
// Set location in front of camera
gl.glMatrixMode(gl.GL_PROJECTION);
gl.glLoadIdentity();
@@ -141,8 +154,8 @@ public class RedSquare implements MouseListener, GLEventListener {
}
public void display(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
- gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
+ GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
// One rotation every four seconds
gl.glMatrixMode(gl.GL_MODELVIEW);
@@ -154,7 +167,7 @@ public class RedSquare implements MouseListener, GLEventListener {
// Draw a square
- gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4);
+ gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
}
public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
diff --git a/src/demos/es1/angeles/AngelesES1.java b/src/demos/es1/angeles/AngelesES1.java
index 8638317..28369e2 100755
--- a/src/demos/es1/angeles/AngelesES1.java
+++ b/src/demos/es1/angeles/AngelesES1.java
@@ -125,7 +125,7 @@ public class AngelesES1 implements GLEventListener {
gl.glHint(gl.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_FASTEST);
- //gl.glShadeModel(GL.GL_SMOOTH);
+ //gl.glShadeModel(GL2ES1.GL_SMOOTH);
gl.glShadeModel(gl.GL_FLAT);
gl.glDisable(gl.GL_DITHER);
diff --git a/src/demos/es1/angeles/AngelesGL.java b/src/demos/es1/angeles/AngelesGL.java
index bb2aecd..7df2526 100755
--- a/src/demos/es1/angeles/AngelesGL.java
+++ b/src/demos/es1/angeles/AngelesGL.java
@@ -25,8 +25,12 @@
package demos.es1.angeles;
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.opengl.util.glsl.fixed.*;
+import com.sun.opengl.impl.fixed.GLFixedFuncImpl;
import java.nio.*;
public class AngelesGL implements GLEventListener {
@@ -79,17 +83,26 @@ public class AngelesGL implements GLEventListener {
public void init(GLAutoDrawable drawable) {
// FIXME: gl.setSwapInterval(1);
- this.gl = drawable.getGL();
- this.glu = GLU.createGLU();
- if(gl.isGLES2()) {
- gl.getGLES2().enableFixedFunctionEmulationMode(GLES2.FIXED_EMULATION_VERTEXCOLORTEXTURE);
- System.err.println("AngelesGL Fixed emu: FIXED_EMULATION_VERTEXCOLORTEXTURE");
+ {
+ 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);
}
+ this.glu = GLU.createGLU();
cComps = gl.isGLES1() ? 4: 3;
gl.glEnable(GL2ES1.GL_NORMALIZE);
- gl.glEnable(gl.GL_DEPTH_TEST);
- gl.glDisable(gl.GL_CULL_FACE);
+ gl.glEnable(GL.GL_DEPTH_TEST);
+ gl.glDisable(GL.GL_CULL_FACE);
gl.glCullFace(GL.GL_BACK);
gl.glShadeModel(gl.GL_FLAT);
@@ -135,7 +148,7 @@ public class AngelesGL implements GLEventListener {
this.x = x;
this.y = y;
- this.gl = drawable.getGL();
+ this.gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
gl.glMatrixMode(gl.GL_MODELVIEW);
gl.glLoadIdentity();
@@ -144,9 +157,9 @@ public class AngelesGL implements GLEventListener {
// JAU gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_FASTEST);
- //gl.glShadeModel(GL.GL_SMOOTH);
+ //gl.glShadeModel(gl.GL_SMOOTH);
gl.glShadeModel(gl.GL_FLAT);
- gl.glDisable(gl.GL_DITHER);
+ gl.glDisable(GL.GL_DITHER);
//gl.glMatrixMode(gl.GL_PROJECTION);
//gl.glLoadIdentity();
@@ -161,7 +174,7 @@ public class AngelesGL implements GLEventListener {
if (gAppAlive==0)
return;
- this.gl = drawable.getGL();
+ this.gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
// Actual tick value is "blurred" a little bit.
sTick = (sTick + tick - sStartTick) >> 1;
@@ -173,7 +186,7 @@ public class AngelesGL implements GLEventListener {
return;
}
- gl.glClear(gl.GL_DEPTH_BUFFER_BIT | gl.GL_COLOR_BUFFER_BIT);
+ gl.glClear(GL.GL_DEPTH_BUFFER_BIT | GL.GL_COLOR_BUFFER_BIT);
gl.glMatrixMode(gl.GL_PROJECTION);
gl.glLoadIdentity();
@@ -186,7 +199,7 @@ public class AngelesGL implements GLEventListener {
configureLightAndMaterial();
if(blendingEnabled) {
- gl.glEnable(gl.GL_CULL_FACE);
+ gl.glEnable(GL.GL_CULL_FACE);
// Draw the reflection by drawing models with negated Z-axis.
gl.glPushMatrix();
drawModels(-1);
@@ -197,7 +210,7 @@ public class AngelesGL implements GLEventListener {
drawGroundPlane();
if(blendingEnabled) {
- gl.glDisable(gl.GL_CULL_FACE);
+ gl.glDisable(GL.GL_CULL_FACE);
}
// Draw all the models normally.
@@ -216,7 +229,7 @@ public class AngelesGL implements GLEventListener {
}
private boolean blendingEnabled = true;
- private GL gl;
+ private GLFixedFuncIf gl; // temp cache
private GLU glu;
// Total run length is 20 * camera track base unit length (see cams.h).
@@ -239,16 +252,16 @@ int randomUInt()
private int cComps;
// Definition of one GL object in this demo.
-public class GLObject {
+public class GLSpatial {
/* Vertex array and color array are enabled for all objects, so their
* pointers must always be valid and non-null. Normal array is not
* used by the ground plane, so when its pointer is null then normal
* array usage is disabled.
*
- * Vertex array is supposed to use gl.GL_FLOAT datatype and stride 0
+ * Vertex array is supposed to use GL.GL_FLOAT datatype and stride 0
* (i.e. tightly packed array). Color array is supposed to have 4
- * components per color with gl.GL_UNSIGNED_BYTE datatype and stride 0.
- * Normal array is supposed to use gl.GL_FLOAT datatype and stride 0.
+ * components per color with GL.GL_UNSIGNED_BYTE datatype and stride 0.
+ * Normal array is supposed to use GL.GL_FLOAT datatype and stride 0.
*/
private int vboName, count;
private int vComps, nComps;
@@ -258,7 +271,7 @@ public class GLObject {
private FloatBuffer normalArray=null;
protected GLArrayDataWrapper vArrayData, cArrayData, nArrayData=null;
- public GLObject(int vertices, int vertexComponents,
+ public GLSpatial(int vertices, int vertexComponents,
boolean useNormalArray) {
count = vertices;
vComps= vertexComponents;
@@ -292,12 +305,12 @@ public class GLObject {
gl.glGenBuffers(1, tmp, 0);
vboName = tmp[0];
- vArrayData = GLArrayDataWrapper.createFixed(GL.GL_VERTEX_ARRAY, vComps, GL.GL_FLOAT, false,
+ vArrayData = GLArrayDataWrapper.createFixed(gl.GL_VERTEX_ARRAY, vComps, GL.GL_FLOAT, false,
0, pBuffer, vboName, vOffset);
- cArrayData = GLArrayDataWrapper.createFixed(GL.GL_COLOR_ARRAY, cComps, GL.GL_FLOAT, false,
+ cArrayData = GLArrayDataWrapper.createFixed(gl.GL_COLOR_ARRAY, cComps, GL.GL_FLOAT, false,
0, pBuffer, vboName, cOffset);
if(useNormalArray) {
- nArrayData = GLArrayDataWrapper.createFixed(GL.GL_NORMAL_ARRAY, nComps, GL.GL_FLOAT, false,
+ nArrayData = GLArrayDataWrapper.createFixed(gl.GL_NORMAL_ARRAY, nComps, GL.GL_FLOAT, false,
0, pBuffer, vboName, nOffset);
}
}
@@ -354,7 +367,7 @@ public class GLObject {
}
- gl.glDrawArrays(gl.GL_TRIANGLES, 0, count);
+ gl.glDrawArrays(GL.GL_TRIANGLES, 0, count);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
@@ -371,8 +384,8 @@ int sCurrentCamTrack = 0;
long sCurrentCamTrackStartTick = 0;
long sNextCamTrackStartTick = 0x7fffffff;
-GLObject sSuperShapeObjects[] = new GLObject[SuperShape.COUNT];
-GLObject sGroundPlane;
+GLSpatial sSuperShapeObjects[] = new GLSpatial[SuperShape.COUNT];
+GLSpatial sGroundPlane;
public class VECTOR3 {
@@ -422,7 +435,7 @@ float ssFunc(final float t, final float p[], int pOff)
// Creates and returns a supershape object.
// Based on Paul Bourke's POV-Ray implementation.
// http://astronomy.swin.edu.au/~pbourke/povray/supershape/
-GLObject createSuperShape(final float params[])
+GLSpatial createSuperShape(final float params[])
{
final int resol1 = (int)params[SuperShape.PARAMS - 3];
final int resol2 = (int)params[SuperShape.PARAMS - 2];
@@ -434,12 +447,12 @@ GLObject createSuperShape(final float params[])
final int latitudeCount = latitudeEnd - latitudeBegin;
final int triangleCount = longitudeCount * latitudeCount * 2;
final int vertices = triangleCount * 3;
- GLObject result;
+ GLSpatial result;
float baseColor[] = new float[3];
int a, longitude, latitude;
int currentVertex, currentQuad;
- result = new GLObject(vertices, 3, true);
+ result = new GLSpatial(vertices, 3, true);
if (result == null)
return null;
@@ -499,7 +512,7 @@ GLObject createSuperShape(final float params[])
/* Pre-normalization of the normals is disabled here because
* they will be normalized anyway later due to automatic
- * normalization (gl.GL_NORMALIZE). It is enabled because the
+ * normalization (GL2ES1.GL_NORMALIZE). It is enabled because the
* objects are scaled with glScale.
*/
/*
@@ -576,19 +589,19 @@ GLObject createSuperShape(final float params[])
}
-GLObject createGroundPlane()
+GLSpatial createGroundPlane()
{
final int scale = 4;
final int yBegin = -15, yEnd = 15; // ends are non-inclusive
final int xBegin = -15, xEnd = 15;
final int triangleCount = (yEnd - yBegin) * (xEnd - xBegin) * 2;
final int vertices = triangleCount * 3;
- GLObject result;
+ GLSpatial result;
int x, y;
int currentVertex, currentQuad;
final int vcomps = 2;
- result = new GLObject(vertices, vcomps, false);
+ result = new GLSpatial(vertices, vcomps, false);
if (result == null)
return null;
@@ -638,18 +651,18 @@ GLObject createGroundPlane()
void drawGroundPlane()
{
gl.glDisable(gl.GL_LIGHTING);
- gl.glDisable(gl.GL_DEPTH_TEST);
+ gl.glDisable(GL.GL_DEPTH_TEST);
if(blendingEnabled) {
- gl.glEnable(gl.GL_BLEND);
- gl.glBlendFunc(gl.GL_ZERO, gl.GL_SRC_COLOR);
+ gl.glEnable(GL.GL_BLEND);
+ gl.glBlendFunc(GL.GL_ZERO, GL.GL_SRC_COLOR);
}
sGroundPlane.draw();
if(blendingEnabled) {
- gl.glDisable(gl.GL_BLEND);
+ gl.glDisable(GL.GL_BLEND);
}
- gl.glEnable(gl.GL_DEPTH_TEST);
+ gl.glEnable(GL.GL_DEPTH_TEST);
gl.glEnable(gl.GL_LIGHTING);
}
@@ -664,9 +677,9 @@ void drawFadeQuad()
final float fadeColor = FixedPoint.toFloat(minFade << 7);
gl.glColor4f(fadeColor, fadeColor, fadeColor, 0f);
- gl.glDisable(gl.GL_DEPTH_TEST);
- gl.glEnable(gl.GL_BLEND);
- gl.glBlendFunc(gl.GL_ZERO, gl.GL_SRC_COLOR);
+ gl.glDisable(GL.GL_DEPTH_TEST);
+ gl.glEnable(GL.GL_BLEND);
+ gl.glBlendFunc(GL.GL_ZERO, GL.GL_SRC_COLOR);
gl.glDisable(gl.GL_LIGHTING);
gl.glMatrixMode(gl.GL_MODELVIEW);
@@ -679,15 +692,15 @@ void drawFadeQuad()
gl.glDisableClientState(gl.GL_COLOR_ARRAY);
gl.glDisableClientState(gl.GL_NORMAL_ARRAY);
gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
- gl.glVertexPointer(2, gl.GL_FLOAT, 0, quadVertices);
- gl.glDrawArrays(gl.GL_TRIANGLES, 0, 6);
+ gl.glVertexPointer(2, GL.GL_FLOAT, 0, quadVertices);
+ gl.glDrawArrays(GL.GL_TRIANGLES, 0, 6);
gl.glEnableClientState(gl.GL_COLOR_ARRAY);
gl.glMatrixMode(gl.GL_MODELVIEW);
gl.glEnable(gl.GL_LIGHTING);
- gl.glDisable(gl.GL_BLEND);
- gl.glEnable(gl.GL_DEPTH_TEST);
+ gl.glDisable(GL.GL_BLEND);
+ gl.glEnable(GL.GL_DEPTH_TEST);
}
}
@@ -708,9 +721,9 @@ void configureLightAndMaterial()
gl.glLightfv(gl.GL_LIGHT1, gl.GL_DIFFUSE, light1Diffuse);
gl.glLightfv(gl.GL_LIGHT2, gl.GL_POSITION, light2Position);
gl.glLightfv(gl.GL_LIGHT2, gl.GL_DIFFUSE, light2Diffuse);
- gl.glMaterialfv(gl.GL_FRONT_AND_BACK, gl.GL_SPECULAR, materialSpecular);
+ gl.glMaterialfv(GL.GL_FRONT_AND_BACK, gl.GL_SPECULAR, materialSpecular);
- gl.glMaterialf(gl.GL_FRONT_AND_BACK, gl.GL_SHININESS, 60.0f);
+ gl.glMaterialf(GL.GL_FRONT_AND_BACK, gl.GL_SHININESS, 60.0f);
gl.glEnable(gl.GL_COLOR_MATERIAL);
}
diff --git a/src/demos/es1/angeles/AngelesGLil.java b/src/demos/es1/angeles/AngelesGLil.java
index ace1a4f..8e71840 100755
--- a/src/demos/es1/angeles/AngelesGLil.java
+++ b/src/demos/es1/angeles/AngelesGLil.java
@@ -25,8 +25,12 @@
package demos.es1.angeles;
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.opengl.util.glsl.fixed.*;
+import com.sun.opengl.impl.fixed.GLFixedFuncImpl;
import java.nio.*;
public class AngelesGLil implements GLEventListener {
@@ -79,25 +83,33 @@ public class AngelesGLil implements GLEventListener {
public void init(GLAutoDrawable drawable) {
// FIXME: gl.setSwapInterval(1);
- this.gl = drawable.getGL();
- this.glu = GLU.createGLU();
- if(gl.isGLES2()) {
- gl.getGLES2().enableFixedFunctionEmulationMode(GLES2.FIXED_EMULATION_VERTEXCOLORTEXTURE);
- System.err.println("AngelesGLil Fixed emu: FIXED_EMULATION_VERTEXCOLORTEXTURE");
+ {
+ 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);
}
-
+ this.glu = GLU.createGLU();
cComps = gl.isGLES1() ? 4: 3;
gl.glEnable(GL2ES1.GL_NORMALIZE);
- gl.glEnable(gl.GL_DEPTH_TEST);
- gl.glDisable(gl.GL_CULL_FACE);
+ gl.glEnable(GL.GL_DEPTH_TEST);
+ gl.glDisable(GL.GL_CULL_FACE);
gl.glCullFace(GL.GL_BACK);
gl.glShadeModel(gl.GL_FLAT);
gl.glEnable(gl.GL_LIGHTING);
gl.glEnable(gl.GL_LIGHT0);
gl.glEnable(gl.GL_LIGHT1);
- gl.glEnable(gl.GL_LIGHT2);
+ gl.glEnable(gl.GL_LIGHT2);
gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
gl.glEnableClientState(gl.GL_COLOR_ARRAY);
@@ -139,7 +151,7 @@ public class AngelesGLil implements GLEventListener {
TraceGL2 gltrace = new TraceGL2(gl2, System.err);
gl2.getContext().setGL(gltrace);
gl2 = gltrace;
- }*/
+ } */
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
@@ -148,7 +160,7 @@ public class AngelesGLil implements GLEventListener {
this.x = x;
this.y = y;
- this.gl = drawable.getGL();
+ this.gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
gl.glMatrixMode(gl.GL_MODELVIEW);
gl.glLoadIdentity();
@@ -157,9 +169,9 @@ public class AngelesGLil implements GLEventListener {
// JAU gl.glHint(GL2ES1.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_FASTEST);
- //gl.glShadeModel(GL.GL_SMOOTH);
+ //gl.glShadeModel(gl.GL_SMOOTH);
gl.glShadeModel(gl.GL_FLAT);
- gl.glDisable(gl.GL_DITHER);
+ gl.glDisable(GL.GL_DITHER);
//gl.glMatrixMode(gl.GL_PROJECTION);
//gl.glLoadIdentity();
@@ -174,7 +186,7 @@ public class AngelesGLil implements GLEventListener {
if (gAppAlive==0)
return;
- this.gl = drawable.getGL();
+ this.gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
// Actual tick value is "blurred" a little bit.
sTick = (sTick + tick - sStartTick) >> 1;
@@ -186,7 +198,7 @@ public class AngelesGLil implements GLEventListener {
return;
}
- gl.glClear(gl.GL_DEPTH_BUFFER_BIT | gl.GL_COLOR_BUFFER_BIT);
+ gl.glClear(GL.GL_DEPTH_BUFFER_BIT | GL.GL_COLOR_BUFFER_BIT);
gl.glMatrixMode(gl.GL_PROJECTION);
gl.glLoadIdentity();
@@ -199,7 +211,7 @@ public class AngelesGLil implements GLEventListener {
configureLightAndMaterial();
if(blendingEnabled) {
- gl.glEnable(gl.GL_CULL_FACE);
+ gl.glEnable(GL.GL_CULL_FACE);
// Draw the reflection by drawing models with negated Z-axis.
gl.glPushMatrix();
drawModels(-1);
@@ -210,7 +222,7 @@ public class AngelesGLil implements GLEventListener {
drawGroundPlane();
if(blendingEnabled) {
- gl.glDisable(gl.GL_CULL_FACE);
+ gl.glDisable(GL.GL_CULL_FACE);
}
// Draw all the models normally.
@@ -229,7 +241,7 @@ public class AngelesGLil implements GLEventListener {
}
private boolean blendingEnabled = true;
- private GL gl;
+ private GLFixedFuncIf gl; // temp cache
private GLU glu;
// Total run length is 20 * camera track base unit length (see cams.h).
@@ -249,20 +261,19 @@ int randomUInt()
return Math.abs((int) (sRandomSeed >> 16));
}
-
private int cComps;
// Definition of one GL object in this demo.
-public class GLObject {
+public class GLSpatial {
/* Vertex array and color array are enabled for all objects, so their
* pointers must always be valid and non-null. Normal array is not
* used by the ground plane, so when its pointer is null then normal
* array usage is disabled.
*
- * Vertex array is supposed to use gl.GL_FLOAT datatype and stride 0
+ * Vertex array is supposed to use GL.GL_FLOAT datatype and stride 0
* (i.e. tightly packed array). Color array is supposed to have 4
- * components per color with gl.GL_UNSIGNED_BYTE datatype and stride 0.
- * Normal array is supposed to use gl.GL_FLOAT datatype and stride 0.
+ * components per color with GL.GL_UNSIGNED_BYTE datatype and stride 0.
+ * Normal array is supposed to use GL.GL_FLOAT datatype and stride 0.
*/
protected int vboName, count;
protected int vComps, nComps;
@@ -270,7 +281,7 @@ public class GLObject {
protected FloatBuffer interlArray;
protected GLArrayDataWrapper vArrayData, cArrayData, nArrayData=null;
- public GLObject(int vertices, int vertexComponents,
+ public GLSpatial(int vertices, int vertexComponents,
boolean useNormalArray) {
count = vertices;
vComps= vertexComponents;
@@ -297,12 +308,12 @@ public class GLObject {
interlArray.position(count*(vComps+cComps+nComps));
interlArray.flip();
- vArrayData = GLArrayDataWrapper.createFixed(GL.GL_VERTEX_ARRAY, vComps, GL.GL_FLOAT, false,
+ vArrayData = GLArrayDataWrapper.createFixed(gl.GL_VERTEX_ARRAY, vComps, GL.GL_FLOAT, false,
bStride, pBuffer, vboName, vOffset);
- cArrayData = GLArrayDataWrapper.createFixed(GL.GL_COLOR_ARRAY, cComps, GL.GL_FLOAT, false,
+ cArrayData = GLArrayDataWrapper.createFixed(gl.GL_COLOR_ARRAY, cComps, GL.GL_FLOAT, false,
bStride, pBuffer, vboName, cOffset);
if(useNormalArray) {
- nArrayData = GLArrayDataWrapper.createFixed(GL.GL_NORMAL_ARRAY, nComps, GL.GL_FLOAT, false,
+ nArrayData = GLArrayDataWrapper.createFixed(gl.GL_NORMAL_ARRAY, nComps, GL.GL_FLOAT, false,
bStride, pBuffer, vboName, nOffset);
}
}
@@ -342,7 +353,8 @@ public class GLObject {
gl.glNormalPointer(nArrayData);
}
- gl.glDrawArrays(gl.GL_TRIANGLES, 0, count);
+
+ gl.glDrawArrays(GL.GL_TRIANGLES, 0, count);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
@@ -359,8 +371,8 @@ int sCurrentCamTrack = 0;
long sCurrentCamTrackStartTick = 0;
long sNextCamTrackStartTick = 0x7fffffff;
-GLObject sSuperShapeObjects[] = new GLObject[SuperShape.COUNT];
-GLObject sGroundPlane;
+GLSpatial sSuperShapeObjects[] = new GLSpatial[SuperShape.COUNT];
+GLSpatial sGroundPlane;
public class VECTOR3 {
@@ -410,7 +422,7 @@ float ssFunc(final float t, final float p[], int pOff)
// Creates and returns a supershape object.
// Based on Paul Bourke's POV-Ray implementation.
// http://astronomy.swin.edu.au/~pbourke/povray/supershape/
-GLObject createSuperShape(final float params[])
+GLSpatial createSuperShape(final float params[])
{
final int resol1 = (int)params[SuperShape.PARAMS - 3];
final int resol2 = (int)params[SuperShape.PARAMS - 2];
@@ -422,19 +434,18 @@ GLObject createSuperShape(final float params[])
final int latitudeCount = latitudeEnd - latitudeBegin;
final int triangleCount = longitudeCount * latitudeCount * 2;
final int vertices = triangleCount * 3;
- GLObject result;
+ GLSpatial result;
float baseColor[] = new float[3];
float color[] = new float[3];
int a, longitude, latitude;
int currentIndex, currentQuad;
- result = new GLObject(vertices, 3, true);
+ result = new GLSpatial(vertices, 3, true);
if (result == null)
return null;
- for (a = 0; a < 3; ++a) {
+ for (a = 0; a < 3; ++a)
baseColor[a] = ((randomUInt() % 155) + 100) / 255.f;
- }
currentQuad = 0;
currentIndex = 0;
@@ -489,7 +500,7 @@ GLObject createSuperShape(final float params[])
/* Pre-normalization of the normals is disabled here because
* they will be normalized anyway later due to automatic
- * normalization (gl.GL_NORMALIZE). It is enabled because the
+ * normalization (GL2ES1.GL_NORMALIZE). It is enabled because the
* objects are scaled with glScale.
*/
/*
@@ -607,19 +618,20 @@ GLObject createSuperShape(final float params[])
return result;
}
-GLObject createGroundPlane()
+
+GLSpatial createGroundPlane()
{
final int scale = 4;
final int yBegin = -15, yEnd = 15; // ends are non-inclusive
final int xBegin = -15, xEnd = 15;
final int triangleCount = (yEnd - yBegin) * (xEnd - xBegin) * 2;
final int vertices = triangleCount * 3;
- GLObject result;
+ GLSpatial result;
int x, y;
int currentIndex, currentQuad;
final int vcomps = 2;
- result = new GLObject(vertices, vcomps, false);
+ result = new GLSpatial(vertices, vcomps, false);
if (result == null)
return null;
@@ -665,18 +677,18 @@ GLObject createGroundPlane()
void drawGroundPlane()
{
gl.glDisable(gl.GL_LIGHTING);
- gl.glDisable(gl.GL_DEPTH_TEST);
+ gl.glDisable(GL.GL_DEPTH_TEST);
if(blendingEnabled) {
- gl.glEnable(gl.GL_BLEND);
- gl.glBlendFunc(gl.GL_ZERO, gl.GL_SRC_COLOR);
+ gl.glEnable(GL.GL_BLEND);
+ gl.glBlendFunc(GL.GL_ZERO, GL.GL_SRC_COLOR);
}
sGroundPlane.draw();
if(blendingEnabled) {
- gl.glDisable(gl.GL_BLEND);
+ gl.glDisable(GL.GL_BLEND);
}
- gl.glEnable(gl.GL_DEPTH_TEST);
+ gl.glEnable(GL.GL_DEPTH_TEST);
gl.glEnable(gl.GL_LIGHTING);
}
@@ -691,9 +703,9 @@ void drawFadeQuad()
final float fadeColor = FixedPoint.toFloat(minFade << 7);
gl.glColor4f(fadeColor, fadeColor, fadeColor, 0f);
- gl.glDisable(gl.GL_DEPTH_TEST);
- gl.glEnable(gl.GL_BLEND);
- gl.glBlendFunc(gl.GL_ZERO, gl.GL_SRC_COLOR);
+ gl.glDisable(GL.GL_DEPTH_TEST);
+ gl.glEnable(GL.GL_BLEND);
+ gl.glBlendFunc(GL.GL_ZERO, GL.GL_SRC_COLOR);
gl.glDisable(gl.GL_LIGHTING);
gl.glMatrixMode(gl.GL_MODELVIEW);
@@ -706,15 +718,15 @@ void drawFadeQuad()
gl.glDisableClientState(gl.GL_COLOR_ARRAY);
gl.glDisableClientState(gl.GL_NORMAL_ARRAY);
gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
- gl.glVertexPointer(2, gl.GL_FLOAT, 0, quadVertices);
- gl.glDrawArrays(gl.GL_TRIANGLES, 0, 6);
+ gl.glVertexPointer(2, GL.GL_FLOAT, 0, quadVertices);
+ gl.glDrawArrays(GL.GL_TRIANGLES, 0, 6);
gl.glEnableClientState(gl.GL_COLOR_ARRAY);
gl.glMatrixMode(gl.GL_MODELVIEW);
gl.glEnable(gl.GL_LIGHTING);
- gl.glDisable(gl.GL_BLEND);
- gl.glEnable(gl.GL_DEPTH_TEST);
+ gl.glDisable(GL.GL_BLEND);
+ gl.glEnable(GL.GL_DEPTH_TEST);
}
}
@@ -735,9 +747,9 @@ void configureLightAndMaterial()
gl.glLightfv(gl.GL_LIGHT1, gl.GL_DIFFUSE, light1Diffuse);
gl.glLightfv(gl.GL_LIGHT2, gl.GL_POSITION, light2Position);
gl.glLightfv(gl.GL_LIGHT2, gl.GL_DIFFUSE, light2Diffuse);
- gl.glMaterialfv(gl.GL_FRONT_AND_BACK, gl.GL_SPECULAR, materialSpecular);
+ gl.glMaterialfv(GL.GL_FRONT_AND_BACK, gl.GL_SPECULAR, materialSpecular);
- gl.glMaterialf(gl.GL_FRONT_AND_BACK, gl.GL_SHININESS, 60.0f);
+ gl.glMaterialf(GL.GL_FRONT_AND_BACK, gl.GL_SHININESS, 60.0f);
gl.glEnable(gl.GL_COLOR_MATERIAL);
}
diff --git a/src/demos/es1/cube/Cube.java b/src/demos/es1/cube/Cube.java
index b77c4e9..63bea14 100644
--- a/src/demos/es1/cube/Cube.java
+++ b/src/demos/es1/cube/Cube.java
@@ -31,10 +31,13 @@
*/
package demos.es1.cube;
+import java.nio.*;
import javax.media.opengl.*;
+import javax.media.opengl.sub.fixed.*;
import javax.media.opengl.util.*;
import javax.media.opengl.glu.*;
-import java.nio.*;
+import com.sun.opengl.util.glsl.fixed.*;
+import com.sun.opengl.impl.fixed.GLFixedFuncImpl;
import com.sun.javafx.newt.*;
@@ -71,13 +74,23 @@ public class Cube implements GLEventListener {
}
public void init(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
- glu = GLU.createGLU();
- if(gl.isGLES2()) {
- gl.getGLES2().enableFixedFunctionEmulationMode(GLES2.FIXED_EMULATION_VERTEXCOLORTEXTURE);
- System.err.println("Cubes Fixed emu: FIXED_EMULATION_VERTEXCOLORTEXTURE");
+ 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);
+ }
}
+ glu = GLU.createGLU();
+
gl.glGenBuffers(4, vboNames, 0);
if(!innerCube) {
@@ -87,16 +100,17 @@ public class Cube implements GLEventListener {
System.err.println("GL_VERSION=" + gl.glGetString(gl.GL_VERSION));
System.err.println("GL_EXTENSIONS:");
System.err.println(" " + gl.glGetString(gl.GL_EXTENSIONS));
+ System.err.println("GLF:" + gl);
}
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
float aspect = (height != 0) ? ((float)width / (float)height) : 1.0f;
- GL gl = drawable.getGL();
- GL2ES1 glF=null;
+ GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
+ GL2ES1 gl2es1=null;
if(gl.isGL2ES1()) {
- glF = drawable.getGL().getGL2ES1();
+ gl2es1 = drawable.getGL().getGL2ES1();
}
gl.glViewport(0, 0, width, height);
@@ -128,11 +142,11 @@ public class Cube implements GLEventListener {
gl.glDisable(gl.GL_LIGHT0);
}
gl.glEnable(gl.GL_CULL_FACE);
- if(null!=glF) {
+ if(null!=gl2es1) {
gl.glEnable(gl.GL_NORMALIZE);
gl.glShadeModel(gl.GL_SMOOTH);
- gl.glDisable(gl.GL_DITHER);
+ gl.glDisable(GL.GL_DITHER);
}
gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
@@ -155,16 +169,16 @@ 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!=glF) {
- glF.glTexEnvi(glF.GL_TEXTURE_ENV, glF.GL_TEXTURE_ENV_MODE, glF.GL_INCR);
+ if(null!=gl2es1) {
+ gl2es1.glTexEnvi(gl2es1.GL_TEXTURE_ENV, gl2es1.GL_TEXTURE_ENV_MODE, gl2es1.GL_INCR);
}
} else {
gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY);
}
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
- if(null!=glF) {
- glF.glHint(glF.GL_PERSPECTIVE_CORRECTION_HINT, glF.GL_FASTEST);
+ if(null!=gl2es1) {
+ gl2es1.glHint(gl2es1.GL_PERSPECTIVE_CORRECTION_HINT, gl2es1.GL_FASTEST);
}
gl.glMatrixMode(gl.GL_PROJECTION);
@@ -179,7 +193,7 @@ public class Cube implements GLEventListener {
}
public void display(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
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 a3f1570..c85fed0 100644
--- a/src/demos/es1/cube/CubeImmModeSink.java
+++ b/src/demos/es1/cube/CubeImmModeSink.java
@@ -32,8 +32,11 @@
package demos.es1.cube;
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.*;
@@ -47,7 +50,7 @@ public class CubeImmModeSink implements GLEventListener {
ByteBuffer cubeIndices=null;
ImmModeSink vboCubeF = null;
- public void drawCube(GL gl, float extent) {
+ public void drawCube(GLFixedFuncIf gl, float extent) {
if(cubeIndices==null) {
cubeIndices = BufferUtil.newByteBuffer(s_cubeIndices);
}
@@ -83,7 +86,7 @@ public class CubeImmModeSink implements GLEventListener {
private GLUquadric sphere=null;
private ImmModeSink vboSphere=null;
- public void drawSphere(GL gl, float radius, int slices, int stacks) {
+ public void drawSphere(GLFixedFuncIf gl, float radius, int slices, int stacks) {
if(sphere==null) {
sphere = glu.gluNewQuadric();
sphere.enableImmModeSink(true);
@@ -108,7 +111,7 @@ public class CubeImmModeSink implements GLEventListener {
private GLUquadric cylinder=null;
private ImmModeSink vboCylinder=null;
- public void drawCylinder(GL gl, float radius, float halfHeight, int upAxis) {
+ public void drawCylinder(GLFixedFuncIf gl, float radius, float halfHeight, int upAxis) {
if(cylinder==null) {
cylinder = glu.gluNewQuadric();
cylinder.enableImmModeSink(true);
@@ -161,13 +164,23 @@ public class CubeImmModeSink implements GLEventListener {
}
public void init(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ 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);
+ }
+ }
glu = GLU.createGLU();
- if(gl.isGLES2()) {
- gl.getGLES2().enableFixedFunctionEmulationMode(GLES2.FIXED_EMULATION_VERTEXCOLORTEXTURE);
- System.err.println("CubeImmModeSink Fixed emu: FIXED_EMULATION_VERTEXCOLORTEXTURE");
- }
+
if(!innerCube) {
System.err.println("Entering initialization");
System.err.println("GL Profile: "+GLProfile.getProfile());
@@ -175,6 +188,7 @@ public class CubeImmModeSink implements GLEventListener {
System.err.println("GL_VERSION=" + gl.glGetString(gl.GL_VERSION));
System.err.println("GL_EXTENSIONS:");
System.err.println(" " + gl.glGetString(gl.GL_EXTENSIONS));
+ System.err.println("GLF:" + gl);
}
gl.glGetError(); // flush error ..
@@ -191,10 +205,10 @@ 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;
- GL gl = drawable.getGL();
- GL2ES1 glF=null;
+ GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
+ GL2ES1 gl2es1=null;
if(gl.isGL2ES1()) {
- glF = drawable.getGL().getGL2ES1();
+ gl2es1 = drawable.getGL().getGL2ES1();
}
gl.glViewport(0, 0, width, height);
@@ -215,19 +229,19 @@ public class CubeImmModeSink implements GLEventListener {
gl.glLightfv(gl.GL_LIGHT0, gl.GL_AMBIENT, light_ambient, 0);
gl.glLightfv(gl.GL_LIGHT0, gl.GL_DIFFUSE, light_diffuse, 0);
gl.glLightfv(gl.GL_LIGHT0, gl.GL_SPECULAR, zero_vec4, 0);
- gl.glMaterialfv(glF.GL_FRONT_AND_BACK, glF.GL_SPECULAR, material_spec, 0);
- gl.glEnable(glF.GL_NORMALIZE);
+ gl.glMaterialfv(GL.GL_FRONT_AND_BACK, gl.GL_SPECULAR, material_spec, 0);
+ gl.glEnable(gl.GL_NORMALIZE);
gl.glEnable(gl.GL_LIGHTING);
gl.glEnable(gl.GL_LIGHT0);
gl.glEnable(gl.GL_COLOR_MATERIAL);
- gl.glEnable(gl.GL_CULL_FACE);
+ gl.glEnable(GL.GL_CULL_FACE);
gl.glShadeModel(gl.GL_SMOOTH);
gl.glDisable(gl.GL_DITHER);
- if(null!=glF) {
- glF.glHint(glF.GL_PERSPECTIVE_CORRECTION_HINT, glF.GL_FASTEST);
+ if(null!=gl2es1) {
+ gl2es1.glHint(gl2es1.GL_PERSPECTIVE_CORRECTION_HINT, gl2es1.GL_FASTEST);
}
gl.glMatrixMode(gl.GL_PROJECTION);
@@ -242,10 +256,10 @@ public class CubeImmModeSink implements GLEventListener {
}
public void display(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
- GL2ES1 glF=null;
+ GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
+ GL2ES1 gl2es1=null;
if(gl.isGL2ES1()) {
- glF = drawable.getGL().getGL2ES1();
+ gl2es1 = drawable.getGL().getGL2ES1();
}
gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
@@ -265,13 +279,13 @@ public class CubeImmModeSink implements GLEventListener {
}
if(true) {
- gl.glDisable(GL.GL_LIGHTING);
+ gl.glDisable(gl.GL_LIGHTING);
gl.glColor4f(0f, 1f, 0f, 1f);
gl.glPushMatrix();
gl.glTranslatef(15.0f, 0.0f, 0.0f);
drawSphere(gl, 5.0f, 10, 10);
gl.glPopMatrix();
- gl.glEnable(GL.GL_LIGHTING);
+ gl.glEnable(gl.GL_LIGHTING);
}
if(true) {
diff --git a/src/demos/es1/cubefbo/FBCubes.java b/src/demos/es1/cubefbo/FBCubes.java
index a97ee1c..f5f98f1 100755
--- a/src/demos/es1/cubefbo/FBCubes.java
+++ b/src/demos/es1/cubefbo/FBCubes.java
@@ -35,7 +35,11 @@ package demos.es1.cubefbo;
import demos.es1.cube.Cube;
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 {
@@ -52,12 +56,21 @@ class FBCubes implements GLEventListener {
}
public void init(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
-
- if(gl.isGLES2()) {
- gl.getGLES2().enableFixedFunctionEmulationMode(GLES2.FIXED_EMULATION_VERTEXCOLORTEXTURE);
- System.err.println("FBCubes Fixed emu: FIXED_EMULATION_VERTEXCOLORTEXTURE");
+ 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);
+ }
}
+ System.out.println(gl);
gl.glGetError(); // flush error ..
/*
@@ -98,7 +111,7 @@ class FBCubes implements GLEventListener {
}
public void display(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
fbo1.bind(gl);
cubeInner.reshape(drawable, 0, 0, FBO_SIZE, FBO_SIZE);
diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java
index db48591..2cda004 100755
--- a/src/demos/es2/RedSquare.java
+++ b/src/demos/es2/RedSquare.java
@@ -2,6 +2,7 @@ package demos.es2;
import java.nio.*;
import javax.media.opengl.*;
+import javax.media.opengl.sub.fixed.*;
import javax.media.opengl.util.*;
import javax.media.opengl.glu.*;
@@ -119,20 +120,16 @@ public class RedSquare implements MouseListener, GLEventListener {
System.err.println("GL_EXTENSIONS:");
System.err.println(" " + gl.glGetString(gl.GL_EXTENSIONS));
- if(gl.isGLES2()) {
- pmvMatrix = gl.getGLES2().getPMVMatrix();
- } else {
- pmvMatrix = new PMVMatrix();
- }
+ pmvMatrix = new PMVMatrix();
initShader(gl);
// Push the 1st uniform down the path
st.glUseProgram(gl, true);
- pmvMatrix.glMatrixMode(gl.GL_PROJECTION);
+ pmvMatrix.glMatrixMode(pmvMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.glMatrixMode(gl.GL_MODELVIEW);
+ pmvMatrix.glMatrixMode(pmvMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()))) {
@@ -177,7 +174,7 @@ public class RedSquare implements MouseListener, GLEventListener {
st.glUseProgram(gl, true);
// Set location in front of camera
- pmvMatrix.glMatrixMode(GL2ES2.GL_PROJECTION);
+ pmvMatrix.glMatrixMode(pmvMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.gluPerspective(45.0f, (float)width / (float)height, 1.0f, 100.0f);
//pmvMatrix.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f);
@@ -199,7 +196,7 @@ public class RedSquare implements MouseListener, GLEventListener {
gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT);
// One rotation every four seconds
- pmvMatrix.glMatrixMode(gl.GL_MODELVIEW);
+ pmvMatrix.glMatrixMode(pmvMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
float ang = ((float) (curTime - startTime) * 360.0f) / 4000.0f;
diff --git a/src/demos/es2/openmax/Cube.java b/src/demos/es2/openmax/Cube.java
index 1430978..52b347c 100644
--- a/src/demos/es2/openmax/Cube.java
+++ b/src/demos/es2/openmax/Cube.java
@@ -32,8 +32,11 @@
package demos.es2.openmax;
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.*;
@@ -87,13 +90,23 @@ public class Cube implements GLEventListener {
}
public void init(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
- glu = GLU.createGLU();
- if(gl.isGLES2()) {
- gl.getGLES2().enableFixedFunctionEmulationMode(GLES2.FIXED_EMULATION_VERTEXCOLORTEXTURE);
- System.err.println("Cubes Fixed emu: FIXED_EMULATION_VERTEXCOLORTEXTURE");
+ 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);
+ }
}
+ glu = GLU.createGLU();
+
gl.glGenBuffers(4, vboNames, 0);
if(!innerCube) {
@@ -103,16 +116,17 @@ public class Cube implements GLEventListener {
System.err.println("GL_VERSION=" + gl.glGetString(gl.GL_VERSION));
System.err.println("GL_EXTENSIONS:");
System.err.println(" " + gl.glGetString(gl.GL_EXTENSIONS));
+ System.err.println("GLF:" + gl);
}
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
float aspect = (height != 0) ? ((float)width / (float)height) : 1.0f;
- GL gl = drawable.getGL();
- GL2ES1 glF=null;
+ GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
+ GL2ES1 gl2es1=null;
if(gl.isGL2ES1()) {
- glF = drawable.getGL().getGL2ES1();
+ gl2es1 = drawable.getGL().getGL2ES1();
}
gl.glViewport(0, 0, width, height);
@@ -144,11 +158,11 @@ public class Cube implements GLEventListener {
gl.glDisable(gl.GL_LIGHT0);
}
gl.glEnable(gl.GL_CULL_FACE);
- if(null!=glF) {
+ if(null!=gl2es1) {
gl.glEnable(gl.GL_NORMALIZE);
gl.glShadeModel(gl.GL_SMOOTH);
- gl.glDisable(gl.GL_DITHER);
+ gl.glDisable(GL.GL_DITHER);
}
gl.glEnableClientState(gl.GL_VERTEX_ARRAY);
@@ -161,6 +175,7 @@ public class Cube implements GLEventListener {
gl.glBufferData(GL.GL_ARRAY_BUFFER, cubeNormals.limit() * BufferUtil.SIZEOF_BYTE, cubeNormals, GL.GL_STATIC_DRAW);
gl.glNormalPointer(gl.GL_BYTE, 0, 0);
+ gl.glEnableClientState(gl.GL_COLOR_ARRAY);
if (cubeColors != null) {
gl.glEnableClientState(gl.GL_COLOR_ARRAY);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboNames[2]);
@@ -171,18 +186,18 @@ public class Cube implements GLEventListener {
if (cubeTexCoords != null) {
gl.glEnableClientState(gl.GL_TEXTURE_COORD_ARRAY);
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vboNames[3]);
- gl.glBufferData(GL.GL_ARRAY_BUFFER, cubeTexCoords.limit() * BufferUtil.SIZEOF_FLOAT, cubeTexCoords, GL.GL_STATIC_DRAW);
- gl.glTexCoordPointer(2, gl.GL_FLOAT, 0, 0);
- if(null!=glF) {
- glF.glTexEnvi(glF.GL_TEXTURE_ENV, glF.GL_TEXTURE_ENV_MODE, glF.GL_INCR);
+ 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);
}
} else {
gl.glDisableClientState(gl.GL_TEXTURE_COORD_ARRAY);
}
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0);
- if(null!=glF) {
- glF.glHint(glF.GL_PERSPECTIVE_CORRECTION_HINT, glF.GL_FASTEST);
+ if(null!=gl2es1) {
+ gl2es1.glHint(gl2es1.GL_PERSPECTIVE_CORRECTION_HINT, gl2es1.GL_FASTEST);
}
gl.glMatrixMode(gl.GL_PROJECTION);
@@ -197,7 +212,7 @@ public class Cube implements GLEventListener {
}
public void display(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
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 5af3081..e52783f 100755
--- a/src/demos/es2/openmax/MovieCube.java
+++ b/src/demos/es2/openmax/MovieCube.java
@@ -37,6 +37,9 @@ package demos.es2.openmax;
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.*;
@@ -121,12 +124,21 @@ public class MovieCube implements MouseListener, GLEventListener, OMXEventListen
}
public void init(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
-
- if(gl.isGLES2()) {
- gl.getGLES2().enableFixedFunctionEmulationMode(GLES2.FIXED_EMULATION_VERTEXCOLORTEXTURE);
- System.err.println("MovieCube Fixed emu: FIXED_EMULATION_VERTEXCOLORTEXTURE");
+ 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);
+ }
}
+ System.out.println(gl);
gl.glGetError(); // flush error ..
@@ -171,7 +183,7 @@ public class MovieCube implements MouseListener, GLEventListener, OMXEventListen
}
public void display(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GLFixedFuncIf gl = GLFixedFuncUtil.getGLFixedFuncIf(drawable.getGL());
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 d0d3d32..b93d325 100755
--- a/src/demos/es2/openmax/MovieSimple.java
+++ b/src/demos/es2/openmax/MovieSimple.java
@@ -163,20 +163,16 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList
System.err.println("GL_EXTENSIONS:");
System.err.println(" " + gl.glGetString(gl.GL_EXTENSIONS));
- if(gl.isGLES2()) {
- pmvMatrix = gl.getGLES2().getPMVMatrix();
- } else {
- pmvMatrix = new PMVMatrix();
- }
+ pmvMatrix = new PMVMatrix();
initShader(gl);
// Push the 1st uniform down the path
st.glUseProgram(gl, true);
- pmvMatrix.glMatrixMode(gl.GL_PROJECTION);
+ pmvMatrix.glMatrixMode(pmvMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.glMatrixMode(gl.GL_MODELVIEW);
+ pmvMatrix.glMatrixMode(pmvMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()))) {
@@ -263,12 +259,12 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList
st.glUseProgram(gl, true);
// Set location in front of camera
- pmvMatrix.glMatrixMode(GL2ES2.GL_PROJECTION);
+ pmvMatrix.glMatrixMode(pmvMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.gluPerspective(45.0f, (float)width / (float)height, 1.0f, 100.0f);
//pmvMatrix.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f);
- pmvMatrix.glMatrixMode(gl.GL_MODELVIEW);
+ pmvMatrix.glMatrixMode(pmvMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, zoom);
@@ -294,7 +290,7 @@ public class MovieSimple implements MouseListener, GLEventListener, OMXEventList
}
if(rotate || zoom!=0f) {
- pmvMatrix.glMatrixMode(gl.GL_MODELVIEW);
+ pmvMatrix.glMatrixMode(pmvMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, zoom);
pmvMatrix.glRotatef(ang, 0, 0, 1);
diff --git a/src/demos/es2/perftst/Perftst.java b/src/demos/es2/perftst/Perftst.java
index a1d9412..ee1924e 100755
--- a/src/demos/es2/perftst/Perftst.java
+++ b/src/demos/es2/perftst/Perftst.java
@@ -88,11 +88,7 @@ public class Perftst implements MouseListener, GLEventListener {
System.err.println("GL_EXTENSIONS:");
System.err.println(" " + gl.glGetString(gl.GL_EXTENSIONS));
- if(gl.isGLES2()) {
- pmvMatrix = gl.getGLES2().getPMVMatrix();
- } else {
- pmvMatrix = new PMVMatrix();
- }
+ pmvMatrix = new PMVMatrix();
pmod.initShaderState(gl);
st = ShaderState.getCurrent();
@@ -100,9 +96,9 @@ public class Perftst implements MouseListener, GLEventListener {
// Push the 1st uniform down the path
st.glUseProgram(gl, true);
- pmvMatrix.glMatrixMode(gl.GL_PROJECTION);
+ pmvMatrix.glMatrixMode(pmvMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
- pmvMatrix.glMatrixMode(gl.GL_MODELVIEW);
+ pmvMatrix.glMatrixMode(pmvMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
if(!st.glUniform(gl, new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()))) {
@@ -125,11 +121,11 @@ public class Perftst implements MouseListener, GLEventListener {
st.glUseProgram(gl, true);
// Set location in front of camera
- pmvMatrix.glMatrixMode(GL2ES2.GL_PROJECTION);
+ pmvMatrix.glMatrixMode(pmvMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.glOrthof(0f, 1.0f, 0.0f, 1.0f, 1.0f, 100.0f);
- pmvMatrix.glMatrixMode(gl.GL_MODELVIEW);
+ pmvMatrix.glMatrixMode(pmvMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -10);
diff --git a/src/demos/gears/Gears.java b/src/demos/gears/Gears.java
index c508fef..feef5a5 100644
--- a/src/demos/gears/Gears.java
+++ b/src/demos/gears/Gears.java
@@ -8,6 +8,7 @@ import java.awt.event.MouseMotionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
diff --git a/src/demos/hdr/ARBFPPipeline.java b/src/demos/hdr/ARBFPPipeline.java
index 6b1e28f..be98982 100755
--- a/src/demos/hdr/ARBFPPipeline.java
+++ b/src/demos/hdr/ARBFPPipeline.java
@@ -4,6 +4,7 @@ import demos.util.FileUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLException;
diff --git a/src/demos/hdr/HDR.java b/src/demos/hdr/HDR.java
index fe08304..d86b2ff 100755
--- a/src/demos/hdr/HDR.java
+++ b/src/demos/hdr/HDR.java
@@ -27,6 +27,7 @@ import java.io.InputStream;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
diff --git a/src/demos/hdr/Pipeline.java b/src/demos/hdr/Pipeline.java
index 8a3c742..5307f3c 100755
--- a/src/demos/hdr/Pipeline.java
+++ b/src/demos/hdr/Pipeline.java
@@ -1,6 +1,7 @@
package demos.hdr;
import java.io.IOException;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
diff --git a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
index 5f34c15..71dd982 100644
--- a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
+++ b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
@@ -57,6 +57,7 @@ import java.awt.event.WindowEvent;
import java.io.IOException;
import java.util.ArrayList;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
@@ -202,7 +203,7 @@ public class HWShadowmapsSimple extends Demo {
public void init(GLAutoDrawable drawable) {
// Use debug pipeline
- // drawable.setGL(new DebugGL(drawable.getGL()));
+ // drawable.setGL(new DebugGL(drawable.getGL().getGL2()));
GL2 gl = drawable.getGL().getGL2();
glu = new GLU();
@@ -381,7 +382,7 @@ public class HWShadowmapsSimple extends Demo {
}
public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {}
- private void checkExtension(GL gl, String extensionName) {
+ private void checkExtension(GL2 gl, String extensionName) {
if (!gl.isExtensionAvailable(extensionName)) {
String message = "Unable to initialize " + extensionName + " OpenGL extension";
unavailableExtension(message);
@@ -465,7 +466,7 @@ public class HWShadowmapsSimple extends Demo {
public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {}
}
- private void set_light_view_texture_parameters(GL gl) {
+ private void set_light_view_texture_parameters(GL2 gl) {
gl.glBindTexture(GL2.GL_TEXTURE_2D, light_view_depth);
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR);
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR);
@@ -475,7 +476,7 @@ public class HWShadowmapsSimple extends Demo {
gl.glTexParameteri(GL2.GL_TEXTURE_2D, GL2.GL_TEXTURE_COMPARE_FUNC, GL2.GL_LEQUAL);
}
- private int genTexture(GL gl) {
+ private int genTexture(GL2 gl) {
int[] tmp = new int[1];
gl.glGenTextures(1, tmp, 0);
return tmp[0];
@@ -512,7 +513,7 @@ public class HWShadowmapsSimple extends Demo {
}
}
- private void texgen(GL gl, boolean enable) {
+ private void texgen(GL2 gl, boolean enable) {
if(enable) {
gl.glEnable(GL2.GL_TEXTURE_GEN_S);
gl.glEnable(GL2.GL_TEXTURE_GEN_T);
@@ -715,7 +716,7 @@ public class HWShadowmapsSimple extends Demo {
render_light_frustum(gl);
}
- private void largest_square_power_of_two_viewport(GL gl, GLAutoDrawable drawable, int viewportX, int viewportY) {
+ private void largest_square_power_of_two_viewport(GL2 gl, GLAutoDrawable drawable, int viewportX, int viewportY) {
float min = Math.min(drawable.getWidth(), drawable.getHeight());
float log2min = (float) Math.log(min) / (float) Math.log(2.0);
float pow2 = (float) Math.floor(log2min);
@@ -772,7 +773,7 @@ public class HWShadowmapsSimple extends Demo {
out[3] = m.get(row, 3);
}
- private static void applyTransform(GL gl, Mat4f xform) {
+ private static void applyTransform(GL2 gl, Mat4f xform) {
float[] data = new float[16];
xform.getColumnMajorData(data);
gl.glMultMatrixf(data, 0);
diff --git a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
index 39fb6cb..b2a2284 100644
--- a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
+++ b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
@@ -57,6 +57,7 @@ import java.awt.event.WindowEvent;
import java.io.IOException;
import java.nio.FloatBuffer;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
@@ -1264,13 +1265,13 @@ public class InfiniteShadowVolumes extends Demo {
return infiniteFrustumInverse(-x, x, -y, y, zNear);
}
- private void applyInfinitePerspective(GL gl, ExaminerViewer v) {
+ private void applyInfinitePerspective(GL2 gl, ExaminerViewer v) {
CameraParameters parms = v.getCameraParameters();
float aspect = parms.getImagePlaneAspectRatio();
gl.glMultMatrixf(getData(infinitePerspective(parms.getVertFOV(), aspect, v.getZNear())), 0);
}
- private void applyInfinitePerspectiveInverse(GL gl, ExaminerViewer v) {
+ private void applyInfinitePerspectiveInverse(GL2 gl, ExaminerViewer v) {
CameraParameters parms = v.getCameraParameters();
float aspect = parms.getImagePlaneAspectRatio();
gl.glMultMatrixf(getData(infinitePerspectiveInverse(parms.getVertFOV(), aspect, v.getZNear())), 0);
diff --git a/src/demos/j2d/CustomText.java b/src/demos/j2d/CustomText.java
index d8111ac..5072579 100755
--- a/src/demos/j2d/CustomText.java
+++ b/src/demos/j2d/CustomText.java
@@ -70,6 +70,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Random;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.awt.GLCanvas;
@@ -279,10 +280,10 @@ public class CustomText extends Demo {
GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluOrtho2D(0, drawable.getWidth(), 0, drawable.getHeight());
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
// Draw the background texture
@@ -313,7 +314,7 @@ public class CustomText extends Demo {
// We tell the text renderer to render the text at the origin, and
// manipulate the modelview matrix to put the text where we want.
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
for (Iterator iter = textInfo.iterator(); iter.hasNext(); ) {
TextInfo info = (TextInfo) iter.next();
diff --git a/src/demos/j2d/FlyingText.java b/src/demos/j2d/FlyingText.java
index 2bc77dd..82ae950 100755
--- a/src/demos/j2d/FlyingText.java
+++ b/src/demos/j2d/FlyingText.java
@@ -66,6 +66,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Random;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.awt.GLCanvas;
diff --git a/src/demos/j2d/TextCube.java b/src/demos/j2d/TextCube.java
index 3ed8efd..27d2541 100755
--- a/src/demos/j2d/TextCube.java
+++ b/src/demos/j2d/TextCube.java
@@ -51,6 +51,7 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.geom.Rectangle2D;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLProfile;
@@ -103,7 +104,7 @@ public class TextCube extends Demo {
public void init(GLAutoDrawable drawable) {
renderer = new TextRenderer(new Font("SansSerif", Font.PLAIN, 72));
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
gl.glEnable(GL2.GL_DEPTH_TEST);
// Compute the scale factor of the largest string which will make
@@ -166,7 +167,7 @@ public class TextCube extends Demo {
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(15, (float) width / (float) height, 5, 15);
diff --git a/src/demos/misc/Picking.java b/src/demos/misc/Picking.java
index 7415524..1fd3963 100755
--- a/src/demos/misc/Picking.java
+++ b/src/demos/misc/Picking.java
@@ -63,7 +63,7 @@ public class Picking
public void init(GLAutoDrawable drawable)
{
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
this.gldrawable = drawable;
gl.glEnable(GL2.GL_CULL_FACE);
gl.glEnable(GL2.GL_DEPTH_TEST);
@@ -73,7 +73,7 @@ public class Picking
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height)
{
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
float h = (float) height / (float) width;
gl.glViewport(0, 0, width, height);
gl.glMatrixMode(GL2.GL_PROJECTION);
@@ -148,14 +148,14 @@ public class Picking
System.out.println("---------------------------------");
}
- public int viewPortWidth(GL gl)
+ public int viewPortWidth(GL2 gl)
{
int[] viewPort = new int[4];
gl.glGetIntegerv(GL2.GL_VIEWPORT, viewPort, 0);
return viewPort[2];
}
- public int viewPortHeight(GL gl)
+ public int viewPortHeight(GL2 gl)
{
int[] viewPort = new int[4];
gl.glGetIntegerv(GL2.GL_VIEWPORT, viewPort, 0);
diff --git a/src/demos/misc/TiledRendering.java b/src/demos/misc/TiledRendering.java
index 7b3c41b..b218b01 100755
--- a/src/demos/misc/TiledRendering.java
+++ b/src/demos/misc/TiledRendering.java
@@ -13,6 +13,7 @@ import java.nio.Buffer;
import java.nio.ByteBuffer;
import javax.imageio.ImageIO;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLContext;
@@ -86,7 +87,7 @@ public class TiledRendering {
}
GL2 gl = pbuffer.getGL().getGL2();
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glTranslatef(0.0f, 0.0f, -40.0f);
// Tile renderer will set up projection matrix
@@ -119,12 +120,12 @@ public class TiledRendering {
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, pos, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, pos, 0);
gl.glEnable(GL.GL_CULL_FACE);
- gl.glEnable(GL.GL_LIGHTING);
- gl.glEnable(GL.GL_LIGHT0);
+ gl.glEnable(GL2ES1.GL_LIGHTING);
+ gl.glEnable(GL2ES1.GL_LIGHT0);
gl.glEnable(GL.GL_DEPTH_TEST);
- gl.glEnable(GL.GL_NORMALIZE);
+ gl.glEnable(GL2ES1.GL_NORMALIZE);
gl.glPushMatrix();
gl.glRotatef(view_rotx, 1.0f, 0.0f, 0.0f);
@@ -134,21 +135,21 @@ public class TiledRendering {
gl.glPushMatrix();
gl.glTranslatef(-3.0f, -2.0f, 0.0f);
gl.glRotatef(angle, 0.0f, 0.0f, 1.0f);
- gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, red, 0);
+ gl.glMaterialfv(GL.GL_FRONT, GL2ES1.GL_AMBIENT_AND_DIFFUSE, red, 0);
Gears.gear(gl, 1.0f, 4.0f, 1.0f, 20, 0.7f);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslatef(3.1f, -2.0f, 0.0f);
gl.glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f);
- gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, green, 0);
+ gl.glMaterialfv(GL.GL_FRONT, GL2ES1.GL_AMBIENT_AND_DIFFUSE, green, 0);
Gears.gear(gl, 0.5f, 2.0f, 2.0f, 10, 0.7f);
gl.glPopMatrix();
gl.glPushMatrix();
gl.glTranslatef(-3.1f, 4.2f, 0.0f);
gl.glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f);
- gl.glMaterialfv(GL.GL_FRONT, GL.GL_AMBIENT_AND_DIFFUSE, blue, 0);
+ gl.glMaterialfv(GL.GL_FRONT, GL2ES1.GL_AMBIENT_AND_DIFFUSE, blue, 0);
Gears.gear(gl, 1.3f, 2.0f, 0.5f, 10, 0.7f);
gl.glPopMatrix();
diff --git a/src/demos/multisample/Multisample.java b/src/demos/multisample/Multisample.java
index c3c9a01..ed72d00 100755
--- a/src/demos/multisample/Multisample.java
+++ b/src/demos/multisample/Multisample.java
@@ -129,9 +129,9 @@ public class Multisample {
// gl.glEnable(GL.GL_DEPTH_TEST);
// gl.glDepthFunc(GL.GL_LESS);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(-1, 1, -1, 1, -1, 1);
}
diff --git a/src/demos/nurbs/curveapp/GLListener.java b/src/demos/nurbs/curveapp/GLListener.java
index 18bf36f..27d8f5f 100755
--- a/src/demos/nurbs/curveapp/GLListener.java
+++ b/src/demos/nurbs/curveapp/GLListener.java
@@ -59,7 +59,7 @@ public class GLListener implements GLEventListener {
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
float[] knots = Curve.getInstance().getKnots();
@@ -125,7 +125,7 @@ public class GLListener implements GLEventListener {
*/
public void reshape(GLAutoDrawable drawable, int x, int y, int width,
int height) {
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(0, drawable.getWidth(), 0, drawable.getHeight(), -1, 1);
gl.glScalef(1, -1, 1);
diff --git a/src/demos/nurbs/surfaceapp/GLListener.java b/src/demos/nurbs/surfaceapp/GLListener.java
index d83f28e..ca266f0 100755
--- a/src/demos/nurbs/surfaceapp/GLListener.java
+++ b/src/demos/nurbs/surfaceapp/GLListener.java
@@ -6,6 +6,7 @@ import javax.media.opengl.GLEventListener;
import javax.media.opengl.glu.*;
import com.sun.opengl.util.glut.gl2.GLUTgl2;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
/**
diff --git a/src/demos/particles/engine/GLComponent.java b/src/demos/particles/engine/GLComponent.java
index cc54da0..b28fcf2 100755
--- a/src/demos/particles/engine/GLComponent.java
+++ b/src/demos/particles/engine/GLComponent.java
@@ -81,9 +81,9 @@ public class GLComponent extends GLCanvas implements GLEventListener {
}
public void init(GLAutoDrawable drawable) {
- final GL gl = drawable.getGL();
+ final GL2 gl = drawable.getGL().getGL2();
- gl.glShadeModel(GL.GL_SMOOTH);
+ gl.glShadeModel(GL2ES1.GL_SMOOTH);
// Set the background / clear color.
gl.glClearColor(background.r, background.g, background.b, background.a);
// Clear the depth
@@ -107,12 +107,12 @@ public class GLComponent extends GLCanvas implements GLEventListener {
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
// the size of openGL
gl.glViewport(0,0, width, height);
// perspective view (smaller for further behind)
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
// perspective
@@ -121,7 +121,7 @@ public class GLComponent extends GLCanvas implements GLEventListener {
glu.gluPerspective(45.0, ratio, 0.0, 1.0);
// draw into the model matrix now
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
}
diff --git a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
index 9511bbc..4514238 100644
--- a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
+++ b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
@@ -52,6 +52,7 @@ import java.awt.event.MouseMotionAdapter;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLException;
@@ -188,7 +189,7 @@ public class ProceduralTexturePhysics extends Demo {
}
gl.glClearColor(0, 0.2f, 0.5f, 0);
- gl.glDisable(GL.GL_LIGHTING);
+ gl.glDisable(GL2ES1.GL_LIGHTING);
gl.glDisable(GL.GL_DEPTH_TEST);
gl.glDisable(GL.GL_CULL_FACE);
diff --git a/src/demos/proceduralTexturePhysics/Water.java b/src/demos/proceduralTexturePhysics/Water.java
index 42fb785..5495e44 100644
--- a/src/demos/proceduralTexturePhysics/Water.java
+++ b/src/demos/proceduralTexturePhysics/Water.java
@@ -46,6 +46,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
diff --git a/src/demos/tess/Tess.java b/src/demos/tess/Tess.java
index 9709de7..c7bde54 100644
--- a/src/demos/tess/Tess.java
+++ b/src/demos/tess/Tess.java
@@ -46,6 +46,7 @@ import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.DebugGL2;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
diff --git a/src/demos/testContextDestruction/TestContextDestruction.java b/src/demos/testContextDestruction/TestContextDestruction.java
index de15e4b..64cc4a7 100755
--- a/src/demos/testContextDestruction/TestContextDestruction.java
+++ b/src/demos/testContextDestruction/TestContextDestruction.java
@@ -52,6 +52,7 @@ import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.media.opengl.DebugGL2;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
diff --git a/src/demos/testContextSharing/TestContextSharing.java b/src/demos/testContextSharing/TestContextSharing.java
index d83dced..ac1a0ff 100644
--- a/src/demos/testContextSharing/TestContextSharing.java
+++ b/src/demos/testContextSharing/TestContextSharing.java
@@ -43,6 +43,7 @@ import java.awt.BorderLayout;
import java.awt.Frame;
import java.util.Random;
import javax.media.opengl.DebugGL2;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
diff --git a/src/demos/texture/TestSubImage.java b/src/demos/texture/TestSubImage.java
index 98fafae..3ff20d1 100755
--- a/src/demos/texture/TestSubImage.java
+++ b/src/demos/texture/TestSubImage.java
@@ -61,6 +61,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
@@ -100,11 +101,11 @@ public class TestSubImage {
public void init(GLAutoDrawable drawable) {}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
- GL gl = drawable.getGL();
- gl.glMatrixMode(GL.GL_PROJECTION);
+ GL2 gl = drawable.getGL().getGL2();
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluOrtho2D(0, 1, 0, 1);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
}
diff --git a/src/demos/texture/TestTexture.java b/src/demos/texture/TestTexture.java
index c32fc8c..85876a3 100755
--- a/src/demos/texture/TestTexture.java
+++ b/src/demos/texture/TestTexture.java
@@ -52,6 +52,7 @@ import java.io.IOException;
import java.io.PrintStream;
import javax.media.opengl.DebugGL2;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
@@ -149,7 +150,7 @@ public class TestTexture implements GLEventListener {
public void init(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
drawable.setGL(new DebugGL2(gl.getGL2()));
gl.glClearColor(0, 0, 0, 0);
@@ -157,11 +158,11 @@ public class TestTexture implements GLEventListener {
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
- GL gl = drawable.getGL();
- gl.glMatrixMode(GL.GL_PROJECTION);
+ GL2 gl = drawable.getGL().getGL2();
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluOrtho2D(0, 1, 0, 1);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
}
diff --git a/src/demos/util/Triceratops.java b/src/demos/util/Triceratops.java
index 55857f0..ca0221d 100644
--- a/src/demos/util/Triceratops.java
+++ b/src/demos/util/Triceratops.java
@@ -45,6 +45,7 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StreamTokenizer;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
diff --git a/src/demos/vertexArrayRange/VertexArrayRange.java b/src/demos/vertexArrayRange/VertexArrayRange.java
index a91cb10..cffe305 100644
--- a/src/demos/vertexArrayRange/VertexArrayRange.java
+++ b/src/demos/vertexArrayRange/VertexArrayRange.java
@@ -46,6 +46,7 @@ import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.awt.GLCanvas;
@@ -303,23 +304,23 @@ public class VertexArrayRange extends Demo {
gl.glClearColor(0, 0, 0, 0);
- gl.glEnable(GL.GL_LIGHT0);
- gl.glEnable(GL.GL_LIGHTING);
- gl.glEnable(GL.GL_NORMALIZE);
- gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, new float[] {.1f, .1f, 0, 1}, 0);
- gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, new float[] {.6f, .6f, .1f, 1}, 0);
- gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, new float[] { 1, 1, .75f, 1}, 0);
- gl.glMaterialf(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, 128.f);
+ gl.glEnable(GL2ES1.GL_LIGHT0);
+ gl.glEnable(GL2ES1.GL_LIGHTING);
+ gl.glEnable(GL2ES1.GL_NORMALIZE);
+ gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2ES1.GL_AMBIENT, new float[] {.1f, .1f, 0, 1}, 0);
+ gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2ES1.GL_DIFFUSE, new float[] {.6f, .6f, .1f, 1}, 0);
+ gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2ES1.GL_SPECULAR, new float[] { 1, 1, .75f, 1}, 0);
+ gl.glMaterialf(GL.GL_FRONT_AND_BACK, GL2ES1.GL_SHININESS, 128.f);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] { .5f, 0, .5f, 0}, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, new float[] { .5f, 0, .5f, 0}, 0);
gl.glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, 0);
// NOTE: it looks like GLUT (or something else) sets up the
// projection matrix in the C version of this demo.
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(60, 1.0, 0.1, 100);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
allocateBigArray(gl, true);
allocateBuffersAndFences(gl);
@@ -341,8 +342,8 @@ public class VertexArrayRange extends Demo {
bigArray = bigArraySystem;
}
setupBuffers();
- gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
- gl.glEnableClientState(GL.GL_NORMAL_ARRAY);
+ gl.glEnableClientState(GL2ES1.GL_VERTEX_ARRAY);
+ gl.glEnableClientState(GL2ES1.GL_NORMAL_ARRAY);
computeElements();
@@ -485,11 +486,11 @@ public class VertexArrayRange extends Demo {
if (toggleVAR) {
if (getFlag('v')) {
- gl.glEnableClientState(GL.GL_VERTEX_ARRAY_RANGE_NV);
+ gl.glEnableClientState(GL2ES1.GL_VERTEX_ARRAY_RANGE_NV);
gl.glVertexArrayRangeNV(bufferSize, bigArrayVar);
bigArray = bigArrayVar;
} else {
- gl.glDisableClientState(GL.GL_VERTEX_ARRAY_RANGE_NV);
+ gl.glDisableClientState(GL2ES1.GL_VERTEX_ARRAY_RANGE_NV);
bigArray = bigArraySystem;
}
toggleVAR = false;
@@ -498,9 +499,9 @@ public class VertexArrayRange extends Demo {
if (toggleLighting) {
if (getFlag('d')) {
- gl.glDisable(GL.GL_LIGHTING);
+ gl.glDisable(GL2ES1.GL_LIGHTING);
} else {
- gl.glEnable(GL.GL_LIGHTING);
+ gl.glEnable(GL2ES1.GL_LIGHTING);
}
toggleLighting = false;
}
@@ -508,10 +509,10 @@ public class VertexArrayRange extends Demo {
if (toggleLightingModel) {
if(getFlag('i')) {
// infinite light
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] { .5f, 0, .5f, 0 }, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, new float[] { .5f, 0, .5f, 0 }, 0);
gl.glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, 0);
} else {
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] { .5f, 0, -.5f, 1 }, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, new float[] { .5f, 0, -.5f, 1 }, 0);
gl.glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
}
toggleLightingModel = false;
diff --git a/src/demos/vertexBufferObject/VertexBufferObject.java b/src/demos/vertexBufferObject/VertexBufferObject.java
index 3825752..27ab5e8 100644
--- a/src/demos/vertexBufferObject/VertexBufferObject.java
+++ b/src/demos/vertexBufferObject/VertexBufferObject.java
@@ -47,6 +47,7 @@ import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLProfile;
@@ -305,23 +306,23 @@ public class VertexBufferObject extends Demo {
gl.glClearColor(0, 0, 0, 0);
- gl.glEnable(GL.GL_LIGHT0);
- gl.glEnable(GL.GL_LIGHTING);
- gl.glEnable(GL.GL_NORMALIZE);
- gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, new float[] {.1f, .1f, 0, 1}, 0);
- gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, new float[] {.6f, .6f, .1f, 1}, 0);
- gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, new float[] { 1, 1, .75f, 1}, 0);
- gl.glMaterialf(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, 128.f);
+ gl.glEnable(GL2ES1.GL_LIGHT0);
+ gl.glEnable(GL2ES1.GL_LIGHTING);
+ gl.glEnable(GL2ES1.GL_NORMALIZE);
+ gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2ES1.GL_AMBIENT, new float[] {.1f, .1f, 0, 1}, 0);
+ gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2ES1.GL_DIFFUSE, new float[] {.6f, .6f, .1f, 1}, 0);
+ gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL2ES1.GL_SPECULAR, new float[] { 1, 1, .75f, 1}, 0);
+ gl.glMaterialf(GL.GL_FRONT_AND_BACK, GL2ES1.GL_SHININESS, 128.f);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] { .5f, 0, .5f, 0}, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, new float[] { .5f, 0, .5f, 0}, 0);
gl.glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, 0);
// NOTE: it looks like GLUT (or something else) sets up the
// projection matrix in the C version of this demo.
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(60, 1.0, 0.1, 100);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
allocateBigArray(gl);
allocateBuffers(gl);
@@ -341,8 +342,8 @@ public class VertexBufferObject extends Demo {
bigArray = bigArraySystem;
}
setupBuffers();
- gl.glEnableClientState(GL.GL_VERTEX_ARRAY);
- gl.glEnableClientState(GL.GL_NORMAL_ARRAY);
+ gl.glEnableClientState(GL2ES1.GL_VERTEX_ARRAY);
+ gl.glEnableClientState(GL2ES1.GL_NORMAL_ARRAY);
computeElements(gl);
@@ -501,9 +502,9 @@ public class VertexBufferObject extends Demo {
if (toggleLighting) {
if (getFlag('d')) {
- gl.glDisable(GL.GL_LIGHTING);
+ gl.glDisable(GL2ES1.GL_LIGHTING);
} else {
- gl.glEnable(GL.GL_LIGHTING);
+ gl.glEnable(GL2ES1.GL_LIGHTING);
}
toggleLighting = false;
}
@@ -511,10 +512,10 @@ public class VertexBufferObject extends Demo {
if (toggleLightingModel) {
if(getFlag('i')) {
// infinite light
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] { .5f, 0, .5f, 0 }, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, new float[] { .5f, 0, .5f, 0 }, 0);
gl.glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, 0);
} else {
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] { .5f, 0, -.5f,1 }, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, new float[] { .5f, 0, -.5f,1 }, 0);
gl.glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, 1);
}
toggleLightingModel = false;
diff --git a/src/demos/vertexProgRefract/VertexProgRefract.java b/src/demos/vertexProgRefract/VertexProgRefract.java
index ce1c975..408ec53 100644
--- a/src/demos/vertexProgRefract/VertexProgRefract.java
+++ b/src/demos/vertexProgRefract/VertexProgRefract.java
@@ -453,7 +453,7 @@ public class VertexProgRefract extends Demo {
// }
gl.glDisable(GL2.GL_VERTEX_PROGRAM);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glPopMatrix();
}
@@ -602,7 +602,7 @@ public class VertexProgRefract extends Demo {
private void drawSkyBox(GL2 gl) {
// Compensates for ExaminerViewer's modification of modelview matrix
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
gl.glActiveTexture(GL.GL_TEXTURE1);
@@ -616,7 +616,7 @@ public class VertexProgRefract extends Demo {
// normals are not being sent down to the hardware in
// GL_NORMAL_MAP texgen mode. Temporarily enabling lighting
// causes the normals to be sent down. Thanks to Ken Dyke.
- gl.glEnable(GL.GL_LIGHTING);
+ gl.glEnable(GL2ES1.GL_LIGHTING);
gl.glTexGeni(GL2.GL_S, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_NORMAL_MAP);
gl.glTexGeni(GL2.GL_T, GL2.GL_TEXTURE_GEN_MODE, GL2.GL_NORMAL_MAP);
@@ -635,10 +635,10 @@ public class VertexProgRefract extends Demo {
glut.glutSolidSphere(5.0, 40, 20);
- gl.glDisable(GL.GL_LIGHTING);
+ gl.glDisable(GL2ES1.GL_LIGHTING);
gl.glPopMatrix();
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glDisable(GL2.GL_TEXTURE_GEN_S);
gl.glDisable(GL2.GL_TEXTURE_GEN_T);
diff --git a/src/demos/vertexProgWarp/VertexProgWarp.java b/src/demos/vertexProgWarp/VertexProgWarp.java
index 43a7183..1e51beb 100644
--- a/src/demos/vertexProgWarp/VertexProgWarp.java
+++ b/src/demos/vertexProgWarp/VertexProgWarp.java
@@ -53,6 +53,7 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.IOException;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.awt.AWTGLAutoDrawable;
@@ -324,7 +325,7 @@ public class VertexProgWarp extends Demo {
super.shutdownDemo();
}
- private void initExtension(GL gl, String glExtensionName) {
+ private void initExtension(GL2 gl, String glExtensionName) {
if (!gl.isExtensionAvailable(glExtensionName)) {
final String message = "OpenGL extension \"" + glExtensionName + "\" not available";
new Thread(new Runnable() {
@@ -630,7 +631,7 @@ public class VertexProgWarp extends Demo {
}
}
- private void drawCylinder(GL gl) {
+ private void drawCylinder(GL2 gl) {
GLUquadric quad;
quad = glu.gluNewQuadric();
@@ -639,7 +640,7 @@ public class VertexProgWarp extends Demo {
glu.gluQuadricNormals (quad, GLU.GLU_SMOOTH);
glu.gluQuadricTexture (quad, true);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glPushMatrix();
gl.glTranslatef(-1.0f, 0.0f, 0.0f);
gl.glRotatef (90.0f, 0.0f, 1.0f, 0.0f);
diff --git a/src/demos/xtrans/XTBasicTransition.java b/src/demos/xtrans/XTBasicTransition.java
index d9d37f1..0239b26 100755
--- a/src/demos/xtrans/XTBasicTransition.java
+++ b/src/demos/xtrans/XTBasicTransition.java
@@ -41,6 +41,7 @@ package demos.xtrans;
import gleem.linalg.Vec3f;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
diff --git a/src/demos/xtrans/XTDesktopManager.java b/src/demos/xtrans/XTDesktopManager.java
index a184ea6..446b6ee 100755
--- a/src/demos/xtrans/XTDesktopManager.java
+++ b/src/demos/xtrans/XTDesktopManager.java
@@ -47,6 +47,7 @@ import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import javax.media.opengl.DebugGL2;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
diff --git a/src/demos/xtrans/XTDesktopPane.java b/src/demos/xtrans/XTDesktopPane.java
index 5940172..7294376 100755
--- a/src/demos/xtrans/XTDesktopPane.java
+++ b/src/demos/xtrans/XTDesktopPane.java
@@ -49,6 +49,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import javax.media.opengl.DebugGL2;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawableFactory;
@@ -217,14 +218,14 @@ public class XTDesktopPane extends OffscreenDesktopPane {
double near = d - (h / 2);
double far = d + (h / 2);
gl.glViewport(oglRect.x, oglRect.y, oglRect.width, oglRect.height);
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glPushMatrix();
gl.glLoadIdentity();
glu.gluPerspective(fovy, (w / h), near, far);
gl.glMatrixMode(GL.GL_TEXTURE);
gl.glPushMatrix();
gl.glLoadIdentity();
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glPushMatrix();
gl.glLoadIdentity();
double eyeX = w / 2;
@@ -250,7 +251,7 @@ public class XTDesktopPane extends OffscreenDesktopPane {
// Orthographic projection for debugging
gl.glViewport(oglRect.x, oglRect.y, oglRect.width, oglRect.height);
// Set up coordinate system for easy access
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
// System.err.println("oglRect x = " + oglRect.getX());
// System.err.println("oglRect y = " + oglRect.getY());
// System.err.println("oglRect w = " + oglRect.getWidth());
@@ -264,7 +265,7 @@ public class XTDesktopPane extends OffscreenDesktopPane {
gl.glMatrixMode(GL.GL_TEXTURE);
gl.glPushMatrix();
gl.glLoadIdentity();
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glPushMatrix();
gl.glLoadIdentity();
@@ -363,11 +364,11 @@ public class XTDesktopPane extends OffscreenDesktopPane {
gl.glDisable(GL.GL_BLEND);
gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_MODULATE);
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glPopMatrix();
gl.glMatrixMode(GL.GL_TEXTURE);
gl.glPopMatrix();
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glPopMatrix();
gl.glFinish();
} finally {
diff --git a/src/gleem/ExaminerViewer.java b/src/gleem/ExaminerViewer.java
index 2b66b73..e22eb5f 100644
--- a/src/gleem/ExaminerViewer.java
+++ b/src/gleem/ExaminerViewer.java
@@ -170,7 +170,7 @@ public class ExaminerViewer {
/** Call this at the end of your display() method to cause the
Modelview matrix to be recomputed for the next frame. */
- public void update(GL gl) {
+ public void update(GL2 gl) {
recalc(gl);
}
@@ -178,7 +178,7 @@ public class ExaminerViewer {
the current matrix. This is useful for drawing a skybox. Does
not update which OpenGL matrix is currently being modified or
the ExaminerViewer's camera parameters. */
- public void updateInverseRotation(GL gl) {
+ public void updateInverseRotation(GL2 gl) {
recalcInverseRotation(gl);
}
@@ -192,7 +192,7 @@ public class ExaminerViewer {
ExaminerViewer to recompute its position based on the visible
geometry. A BSphereProvider must have already been set or this
method has no effect. */
- public void viewAll(GL gl) {
+ public void viewAll(GL2 gl) {
if (provider == null) {
return;
}
@@ -592,20 +592,20 @@ public class ExaminerViewer {
**********************/
}
- private void recalc(GL gl) {
+ private void recalc(GL2 gl) {
recalc();
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
float[] data = new float[16];
params.getModelviewMatrix().getColumnMajorData(data);
gl.glLoadMatrixf(data, 0);
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
params.getProjectionMatrix().getColumnMajorData(data);
gl.glLoadMatrixf(data, 0);
}
- private void recalcInverseRotation(GL gl) {
+ private void recalcInverseRotation(GL2 gl) {
Rotf oriInv = orientation.inverse();
Vec3f tmp = new Vec3f();
float ang = orientation.get(tmp);
diff --git a/src/gleem/ManipPartLineSeg.java b/src/gleem/ManipPartLineSeg.java
index 682c5c0..e243c62 100644
--- a/src/gleem/ManipPartLineSeg.java
+++ b/src/gleem/ManipPartLineSeg.java
@@ -127,8 +127,8 @@ public class ManipPartLineSeg extends ManipPart {
if (!visible)
return;
// FIXME: probably too slow
- boolean reenable = gl.glIsEnabled(GL.GL_LIGHTING);
- gl.glDisable(GL.GL_LIGHTING);
+ boolean reenable = gl.glIsEnabled(GL2ES1.GL_LIGHTING);
+ gl.glDisable(GL2ES1.GL_LIGHTING);
gl.glBegin(GL.GL_LINES);
if (highlighted)
gl.glColor3f(highlightColor.x(), highlightColor.y(), highlightColor.z());
@@ -140,7 +140,7 @@ public class ManipPartLineSeg extends ManipPart {
}
gl.glEnd();
if (reenable)
- gl.glEnable(GL.GL_LIGHTING);
+ gl.glEnable(GL2ES1.GL_LIGHTING);
}
//----------------------------------------------------------------------
diff --git a/src/gleem/ManipPartTriBased.java b/src/gleem/ManipPartTriBased.java
index ea75079..195f613 100644
--- a/src/gleem/ManipPartTriBased.java
+++ b/src/gleem/ManipPartTriBased.java
@@ -170,12 +170,12 @@ public class ManipPartTriBased extends ManipPart {
return;
boolean lightingOn = true;
// FIXME: this is too expensive; figure out another way
- // if (glIsEnabled(GL.GL_LIGHTING))
+ // if (glIsEnabled(GL2ES1.GL_LIGHTING))
// lightingOn = true;
if (lightingOn) {
- gl.glEnable(GL.GL_COLOR_MATERIAL);
- gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE);
+ gl.glEnable(GL2ES1.GL_COLOR_MATERIAL);
+ gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL2ES1.GL_AMBIENT_AND_DIFFUSE);
}
gl.glBegin(GL.GL_TRIANGLES);
if (highlighted)
@@ -204,7 +204,7 @@ public class ManipPartTriBased extends ManipPart {
}
gl.glEnd();
if (lightingOn)
- gl.glDisable(GL.GL_COLOR_MATERIAL);
+ gl.glDisable(GL2ES1.GL_COLOR_MATERIAL);
}
//----------------------------------------------------------------------
diff --git a/src/gleem/TestExaminerViewer.java b/src/gleem/TestExaminerViewer.java
index c13da4e..804c578 100644
--- a/src/gleem/TestExaminerViewer.java
+++ b/src/gleem/TestExaminerViewer.java
@@ -45,6 +45,7 @@ import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
@@ -88,18 +89,18 @@ public class TestExaminerViewer {
private ExaminerViewer viewer;
public void init(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
gl.glClearColor(0, 0, 0, 0);
float[] lightPosition = new float[] {1, 1, 1, 0};
float[] ambient = new float[] { 0.0f, 0.0f, 0.0f, 1.0f };
float[] diffuse = new float[] { 1.0f, 1.0f, 1.0f, 1.0f };
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, ambient, 0);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, diffuse, 0);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, lightPosition, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_AMBIENT, ambient, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_DIFFUSE, diffuse, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, lightPosition, 0);
- gl.glEnable(GL.GL_LIGHTING);
- gl.glEnable(GL.GL_LIGHT0);
+ gl.glEnable(GL2ES1.GL_LIGHTING);
+ gl.glEnable(GL2ES1.GL_LIGHT0);
gl.glEnable(GL.GL_DEPTH_TEST);
params.setPosition(new Vec3f(0, 0, 0));
@@ -110,10 +111,10 @@ public class TestExaminerViewer {
params.xSize = X_SIZE;
params.ySize = Y_SIZE;
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(45, 1, 1, 100);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
// Register the window with the ManipManager
diff --git a/src/gleem/TestHandleBox.java b/src/gleem/TestHandleBox.java
index 9b1438d..fd8fe31 100644
--- a/src/gleem/TestHandleBox.java
+++ b/src/gleem/TestHandleBox.java
@@ -45,6 +45,7 @@ import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
@@ -65,18 +66,18 @@ public class TestHandleBox {
private CameraParameters params = new CameraParameters();
public void init(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
gl.glClearColor(0, 0, 0, 0);
float[] lightPosition = new float[] {1, 1, 1, 0};
float[] ambient = new float[] { 0.0f, 0.0f, 0.0f, 1.0f };
float[] diffuse = new float[] { 1.0f, 1.0f, 1.0f, 1.0f };
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, ambient, 0);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, diffuse, 0);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, lightPosition, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_AMBIENT, ambient, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_DIFFUSE, diffuse, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, lightPosition, 0);
- gl.glEnable(GL.GL_LIGHTING);
- gl.glEnable(GL.GL_LIGHT0);
+ gl.glEnable(GL2ES1.GL_LIGHTING);
+ gl.glEnable(GL2ES1.GL_LIGHT0);
gl.glEnable(GL.GL_DEPTH_TEST);
params.setPosition(new Vec3f(0, 0, 0));
@@ -87,10 +88,10 @@ public class TestHandleBox {
params.xSize = X_SIZE;
params.ySize = Y_SIZE;
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(45, 1, 1, 100);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
// Register the window with the ManipManager
@@ -111,7 +112,7 @@ public class TestHandleBox {
}
public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
float aspect, theta;
aspect = (float) w / (float) h;
if (w >= h)
@@ -122,10 +123,10 @@ public class TestHandleBox {
params.setImagePlaneAspectRatio(aspect);
params.setXSize(w);
params.setYSize(h);
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(theta, aspect, 1, 100);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
}
diff --git a/src/gleem/TestMultiWin.java b/src/gleem/TestMultiWin.java
index d143721..d398299 100644
--- a/src/gleem/TestMultiWin.java
+++ b/src/gleem/TestMultiWin.java
@@ -46,6 +46,7 @@ import java.awt.Point;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
@@ -90,18 +91,18 @@ public class TestMultiWin {
private ExaminerViewer viewer;
public void init(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
gl.glClearColor(0, 0, 0, 0);
float[] lightPosition = new float[] {1, 1, 1, 0};
float[] ambient = new float[] { 0.0f, 0.0f, 0.0f, 1.0f };
float[] diffuse = new float[] { 1.0f, 1.0f, 1.0f, 1.0f };
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, ambient, 0);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, diffuse, 0);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, lightPosition, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_AMBIENT, ambient, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_DIFFUSE, diffuse, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, lightPosition, 0);
- gl.glEnable(GL.GL_LIGHTING);
- gl.glEnable(GL.GL_LIGHT0);
+ gl.glEnable(GL2ES1.GL_LIGHTING);
+ gl.glEnable(GL2ES1.GL_LIGHT0);
gl.glEnable(GL.GL_DEPTH_TEST);
params.setPosition(new Vec3f(0, 0, 0));
@@ -112,10 +113,10 @@ public class TestMultiWin {
params.xSize = X_SIZE;
params.ySize = Y_SIZE;
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(45, 1, 1, 100);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
// Register the window with the ManipManager
diff --git a/src/gleem/TestTranslate1.java b/src/gleem/TestTranslate1.java
index fccc5f9..8708074 100644
--- a/src/gleem/TestTranslate1.java
+++ b/src/gleem/TestTranslate1.java
@@ -45,6 +45,7 @@ import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
@@ -65,18 +66,18 @@ public class TestTranslate1 {
private CameraParameters params = new CameraParameters();
public void init(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
gl.glClearColor(0, 0, 0, 0);
float[] lightPosition = new float[] {1, 1, 1, 0};
float[] ambient = new float[] { 0.0f, 0.0f, 0.0f, 1.0f };
float[] diffuse = new float[] { 1.0f, 1.0f, 1.0f, 1.0f };
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, ambient, 0);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, diffuse, 0);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, lightPosition, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_AMBIENT, ambient, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_DIFFUSE, diffuse, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, lightPosition, 0);
- gl.glEnable(GL.GL_LIGHTING);
- gl.glEnable(GL.GL_LIGHT0);
+ gl.glEnable(GL2ES1.GL_LIGHTING);
+ gl.glEnable(GL2ES1.GL_LIGHT0);
gl.glEnable(GL.GL_DEPTH_TEST);
params.setPosition(new Vec3f(0, 0, 0));
@@ -87,10 +88,10 @@ public class TestTranslate1 {
params.xSize = X_SIZE;
params.ySize = Y_SIZE;
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(45, 1, 1, 100);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
// Register the window with the ManipManager
@@ -112,7 +113,7 @@ public class TestTranslate1 {
}
public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
float aspect, theta;
aspect = (float) w / (float) h;
if (w >= h)
@@ -123,10 +124,10 @@ public class TestTranslate1 {
params.setImagePlaneAspectRatio(aspect);
params.setXSize(w);
params.setYSize(h);
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(theta, aspect, 1, 100);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
}
diff --git a/src/gleem/TestTranslate2.java b/src/gleem/TestTranslate2.java
index af64bbc..9255a7f 100644
--- a/src/gleem/TestTranslate2.java
+++ b/src/gleem/TestTranslate2.java
@@ -45,6 +45,7 @@ import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
@@ -65,18 +66,18 @@ public class TestTranslate2 {
private CameraParameters params = new CameraParameters();
public void init(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
gl.glClearColor(0, 0, 0, 0);
float[] lightPosition = new float[] {1, 1, 1, 0};
float[] ambient = new float[] { 0.0f, 0.0f, 0.0f, 1.0f };
float[] diffuse = new float[] { 1.0f, 1.0f, 1.0f, 1.0f };
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, ambient, 0);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, diffuse, 0);
- gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, lightPosition, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_AMBIENT, ambient, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_DIFFUSE, diffuse, 0);
+ gl.glLightfv(GL2ES1.GL_LIGHT0, GL2ES1.GL_POSITION, lightPosition, 0);
- gl.glEnable(GL.GL_LIGHTING);
- gl.glEnable(GL.GL_LIGHT0);
+ gl.glEnable(GL2ES1.GL_LIGHTING);
+ gl.glEnable(GL2ES1.GL_LIGHT0);
gl.glEnable(GL.GL_DEPTH_TEST);
params.setPosition(new Vec3f(0, 0, 0));
@@ -87,10 +88,10 @@ public class TestTranslate2 {
params.xSize = X_SIZE;
params.ySize = Y_SIZE;
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(45, 1, 1, 100);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
// Register the window with the ManipManager
@@ -112,7 +113,7 @@ public class TestTranslate2 {
}
public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
float aspect, theta;
aspect = (float) w / (float) h;
if (w >= h)
@@ -123,10 +124,10 @@ public class TestTranslate2 {
params.setImagePlaneAspectRatio(aspect);
params.setXSize(w);
params.setYSize(h);
- gl.glMatrixMode(GL.GL_PROJECTION);
+ gl.glMatrixMode(GL2ES1.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(theta, aspect, 1, 100);
- gl.glMatrixMode(GL.GL_MODELVIEW);
+ gl.glMatrixMode(GL2ES1.GL_MODELVIEW);
gl.glLoadIdentity();
}