summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2008-11-21 01:09:31 +0000
committerKenneth Russel <[email protected]>2008-11-21 01:09:31 +0000
commit985276e9c7eea8b85936435eff35e10ed113840b (patch)
treea4fdc33ee42a49cc834ace4171c7a21e0ffa2882
parentf25bdef3b6bc423a08390ab17e86897c85b71282 (diff)
Changed gleem to explicitly declare AWT dependencies. Updated all
demos. All demos now build cleanly. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@291 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
-rw-r--r--make/build.xml4
-rwxr-xr-xsrc/demos/applets/GearsJOALApplet.java4
-rwxr-xr-xsrc/demos/context/DualContext.java11
-rw-r--r--src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java15
-rw-r--r--src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java15
-rwxr-xr-xsrc/demos/j2d/CustomText.java3
-rwxr-xr-xsrc/demos/j2d/FlyingText.java3
-rw-r--r--src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java11
-rwxr-xr-xsrc/demos/texture/TestSubImage.java3
-rw-r--r--src/demos/vertexProgRefract/VertexProgRefract.java17
-rw-r--r--src/demos/vertexProgWarp/VertexProgWarp.java15
-rw-r--r--src/gleem/ExaminerViewer.java5
-rw-r--r--src/gleem/ManipManager.java39
-rw-r--r--src/gleem/TestExaminerViewer.java14
-rw-r--r--src/gleem/TestHandleBox.java12
-rw-r--r--src/gleem/TestMultiWin.java14
-rw-r--r--src/gleem/TestTranslate1.java12
-rw-r--r--src/gleem/TestTranslate2.java12
-rw-r--r--src/gleem/WindowUpdateListener.java4
19 files changed, 118 insertions, 95 deletions
diff --git a/make/build.xml b/make/build.xml
index 74cfa95..51efac2 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -115,7 +115,9 @@
<pathelement location="${joal-demos.jar}" />
<pathelement location="${simple-xml.jar}" />
</path>
- <javac destdir="${classes}" excludes="${jogl.cg.excludes},demos/nurbs/**,jbullet/**" source="1.4" target="1.4" debug="true" debuglevel="source,lines">
+ <!-- For the time being we exclude the VertexArrayRange and HDR demos, which rely on NVIDIA-specific extensions,
+ as well as the JRefract demo, which pulls in all of the others -->
+ <javac destdir="${classes}" excludes="${jogl.cg.excludes},demos/nurbs/**,jbullet/**,demos/hdr/**,demos/vertexArrayRange/**,demos/jrefract/**" source="1.4" target="1.4" debug="true" debuglevel="source,lines">
<src path="${src}" />
<classpath refid="jogl-demos.classpath" />
</javac>
diff --git a/src/demos/applets/GearsJOALApplet.java b/src/demos/applets/GearsJOALApplet.java
index 9a1db8a..759c49a 100755
--- a/src/demos/applets/GearsJOALApplet.java
+++ b/src/demos/applets/GearsJOALApplet.java
@@ -8,8 +8,8 @@ import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.util.Animator;
import javax.media.opengl.util.FPSAnimator;
import javax.swing.JPanel;
-
-
+import net.java.games.joal.util.ALut;
+import demos.devmaster.lesson1.SingleStaticSource;
/** Shows how to deploy an applet using both JOGL and JOAL. This demo
must be referenced from a web page via an &lt;applet&gt; tag. */
diff --git a/src/demos/context/DualContext.java b/src/demos/context/DualContext.java
index 397b10b..34b635b 100755
--- a/src/demos/context/DualContext.java
+++ b/src/demos/context/DualContext.java
@@ -46,12 +46,8 @@ import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.awt.AWTGraphicsConfiguration;
+import javax.media.opengl.*;
+import javax.media.opengl.awt.*;
import javax.media.opengl.glu.GLU;
import javax.swing.JButton;
import javax.swing.JFrame;
@@ -76,7 +72,8 @@ public class DualContext extends Canvas {
public DualContext(GLCapabilities capabilities) {
super(unwrap((AWTGraphicsConfiguration)
GLDrawableFactory.getFactory().chooseGraphicsConfiguration(capabilities, null, null)));
- drawable = GLDrawableFactory.getFactory().createGLDrawable(this, capabilities, null);
+ NativeWindow win = NativeWindowFactory.getNativeWindow(this);
+ drawable = GLDrawableFactory.getFactory().createGLDrawable(win, capabilities, null);
context1 = drawable.createContext(null);
context2 = drawable.createContext(null);
glu = new GLU();
diff --git a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
index 72bed96..0d647f3 100644
--- a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
+++ b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java
@@ -64,6 +64,7 @@ import javax.media.opengl.GLDrawableFactory;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLException;
import javax.media.opengl.GLPbuffer;
+import javax.media.opengl.awt.AWTGLAutoDrawable;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
import javax.swing.JOptionPane;
@@ -120,7 +121,7 @@ public class HWShadowmapsSimple extends Demo {
//
public void shutdownDemo() {
- ManipManager.getManipManager().unregisterWindow(drawable);
+ ManipManager.getManipManager().unregisterWindow((AWTGLAutoDrawable) drawable);
drawable.removeGLEventListener(this);
super.shutdownDemo();
}
@@ -285,22 +286,22 @@ public class HWShadowmapsSimple extends Demo {
// Register the window with the ManipManager
ManipManager manager = ManipManager.getManipManager();
- manager.registerWindow(drawable);
+ manager.registerWindow((AWTGLAutoDrawable) drawable);
this.drawable = drawable;
object = new HandleBoxManip();
object.setTranslation(new Vec3f(0, 0.7f, 1.8f));
object.setGeometryScale(new Vec3f(0.7f, 0.7f, 0.7f));
- manager.showManipInWindow(object, drawable);
+ manager.showManipInWindow(object, (AWTGLAutoDrawable) drawable);
spotlight = new HandleBoxManip();
spotlight.setScale(new Vec3f(0.5f, 0.5f, 0.5f));
spotlight.setTranslation(new Vec3f(-0.25f, 2.35f, 5.0f));
spotlight.setRotation(new Rotf(Vec3f.X_AXIS, (float) Math.toRadians(-30.0f)));
- manager.showManipInWindow(spotlight, drawable);
+ manager.showManipInWindow(spotlight, (AWTGLAutoDrawable) drawable);
viewer = new ExaminerViewer(MouseButtonHelper.numMouseButtons());
- viewer.attach(drawable, new BSphereProvider() {
+ viewer.attach((AWTGLAutoDrawable) drawable, new BSphereProvider() {
public BSphere getBoundingSphere() {
return new BSphere(object.getTranslation(), 2.0f);
}
@@ -589,8 +590,8 @@ public class HWShadowmapsSimple extends Demo {
applyTransform(gl, inverseView);
if (params != null) {
- ManipManager.getManipManager().updateCameraParameters(drawable, params);
- ManipManager.getManipManager().render(drawable, gl);
+ ManipManager.getManipManager().updateCameraParameters((AWTGLAutoDrawable) drawable, params);
+ ManipManager.getManipManager().render((AWTGLAutoDrawable) drawable, gl);
}
gl.glPopMatrix();
diff --git a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
index 4bcef94..699f9de 100644
--- a/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
+++ b/src/demos/infiniteShadowVolumes/InfiniteShadowVolumes.java
@@ -60,6 +60,7 @@ import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.awt.AWTGLAutoDrawable;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
@@ -119,7 +120,7 @@ public class InfiniteShadowVolumes extends Demo {
//
public void shutdownDemo() {
- ManipManager.getManipManager().unregisterWindow(drawable);
+ ManipManager.getManipManager().unregisterWindow((AWTGLAutoDrawable) drawable);
drawable.removeGLEventListener(this);
super.shutdownDemo();
}
@@ -245,21 +246,21 @@ public class InfiniteShadowVolumes extends Demo {
// Register the window with the ManipManager
ManipManager manager = ManipManager.getManipManager();
- manager.registerWindow(drawable);
+ manager.registerWindow((AWTGLAutoDrawable) drawable);
this.drawable = drawable;
objectManip = new HandleBoxManip();
- manager.showManipInWindow(objectManip, drawable);
+ manager.showManipInWindow(objectManip, (AWTGLAutoDrawable) drawable);
objectManip.setTranslation(new Vec3f(0, 0, -2));
objectManip.setRotation(new Rotf(new Vec3f(1, 0, 0), (float) Math.toRadians(-90)));
lightManip = new HandleBoxManip();
- manager.showManipInWindow(lightManip, drawable);
+ manager.showManipInWindow(lightManip, (AWTGLAutoDrawable) drawable);
lightManip.setTranslation(new Vec3f(0.5f, 0.5f, -1));
lightManip.setGeometryScale(new Vec3f(0.1f, 0.1f, 0.1f));
viewer = new ExaminerViewer(MouseButtonHelper.numMouseButtons());
- viewer.attach(drawable, new BSphereProvider() {
+ viewer.attach((AWTGLAutoDrawable) drawable, new BSphereProvider() {
public BSphere getBoundingSphere() {
return new BSphere(objectManip.getTranslation(), 1.0f);
}
@@ -478,8 +479,8 @@ public class InfiniteShadowVolumes extends Demo {
gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT | GL2.GL_STENCIL_BUFFER_BIT);
- ManipManager.getManipManager().updateCameraParameters(drawable, viewer.getCameraParameters());
- ManipManager.getManipManager().render(drawable, gl);
+ ManipManager.getManipManager().updateCameraParameters((AWTGLAutoDrawable) drawable, viewer.getCameraParameters());
+ ManipManager.getManipManager().render((AWTGLAutoDrawable) drawable, gl);
if (!b['R']) {
drawRoom(gl, false);
diff --git a/src/demos/j2d/CustomText.java b/src/demos/j2d/CustomText.java
index ccb940b..1b47d84 100755
--- a/src/demos/j2d/CustomText.java
+++ b/src/demos/j2d/CustomText.java
@@ -43,6 +43,7 @@ import com.sun.opengl.util.awt.gl2.GL2TextRenderer;
import com.sun.opengl.util.texture.Texture;
import com.sun.opengl.util.texture.TextureCoords;
import com.sun.opengl.util.texture.TextureIO;
+import com.sun.opengl.util.texture.awt.AWTTextureIO;
import demos.common.Demo;
import demos.util.FPSCounter;
import demos.util.SystemTime;
@@ -197,7 +198,7 @@ public class CustomText extends Demo {
g.fillRect(0, 0, 1, 1);
g.fillRect(1, 1, 1, 1);
g.dispose();
- backgroundTexture = TextureIO.newTexture(bgImage, false);
+ backgroundTexture = AWTTextureIO.newTexture(bgImage, false);
backgroundTexture.bind();
backgroundTexture.setTexParameteri(GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
backgroundTexture.setTexParameteri(GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST);
diff --git a/src/demos/j2d/FlyingText.java b/src/demos/j2d/FlyingText.java
index a8682a1..24ca1da 100755
--- a/src/demos/j2d/FlyingText.java
+++ b/src/demos/j2d/FlyingText.java
@@ -43,6 +43,7 @@ import com.sun.opengl.util.awt.gl2.GL2TextRenderer;
import com.sun.opengl.util.texture.Texture;
import com.sun.opengl.util.texture.TextureCoords;
import com.sun.opengl.util.texture.TextureIO;
+import com.sun.opengl.util.texture.awt.AWTTextureIO;
import demos.common.Demo;
import demos.util.FPSCounter;
import demos.util.SystemTime;
@@ -238,7 +239,7 @@ public class FlyingText extends Demo {
g.fillRect(0, 0, 1, 1);
g.fillRect(1, 1, 1, 1);
g.dispose();
- backgroundTexture = TextureIO.newTexture(bgImage, false);
+ backgroundTexture = AWTTextureIO.newTexture(bgImage, false);
backgroundTexture.bind();
backgroundTexture.setTexParameteri(GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST);
backgroundTexture.setTexParameteri(GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_NEAREST);
diff --git a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
index c5059b5..b0bdfb7 100644
--- a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
+++ b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java
@@ -55,6 +55,7 @@ import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLException;
+import javax.media.opengl.awt.AWTGLAutoDrawable;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.util.Animator;
import javax.swing.JOptionPane;
@@ -142,7 +143,7 @@ public class ProceduralTexturePhysics extends Demo {
public void shutdownDemo() {
viewer.detach();
- ManipManager.getManipManager().unregisterWindow(drawable);
+ ManipManager.getManipManager().unregisterWindow((AWTGLAutoDrawable) drawable);
drawable.removeGLEventListener(this);
super.shutdownDemo();
}
@@ -198,12 +199,12 @@ public class ProceduralTexturePhysics extends Demo {
// Register the window with the ManipManager
ManipManager manager = ManipManager.getManipManager();
- manager.registerWindow(drawable);
+ manager.registerWindow((AWTGLAutoDrawable) drawable);
this.drawable = drawable;
viewer = new ExaminerViewer(MouseButtonHelper.numMouseButtons());
viewer.setAutoRedrawMode(false);
- viewer.attach(drawable, new BSphereProvider() {
+ viewer.attach((AWTGLAutoDrawable) drawable, new BSphereProvider() {
public BSphere getBoundingSphere() {
return new BSphere(new Vec3f(0, 0, 0), 1.2f);
@@ -236,8 +237,8 @@ public class ProceduralTexturePhysics extends Demo {
}
viewer.update(gl);
- ManipManager.getManipManager().updateCameraParameters(drawable, viewer.getCameraParameters());
- ManipManager.getManipManager().render(drawable, gl);
+ ManipManager.getManipManager().updateCameraParameters((AWTGLAutoDrawable) drawable, viewer.getCameraParameters());
+ ManipManager.getManipManager().render((AWTGLAutoDrawable) drawable, gl);
if (drawing) {
int w = drawable.getWidth();
diff --git a/src/demos/texture/TestSubImage.java b/src/demos/texture/TestSubImage.java
index f7ddde4..98fafae 100755
--- a/src/demos/texture/TestSubImage.java
+++ b/src/demos/texture/TestSubImage.java
@@ -43,6 +43,7 @@ import com.sun.opengl.util.texture.Texture;
import com.sun.opengl.util.texture.TextureCoords;
import com.sun.opengl.util.texture.TextureData;
import com.sun.opengl.util.texture.TextureIO;
+import com.sun.opengl.util.texture.awt.AWTTextureIO;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.GradientPaint;
@@ -134,7 +135,7 @@ public class TestSubImage {
g.dispose();
// Create a TextureData and Texture from it
- textureData = TextureIO.newTextureData(convertedImage, false);
+ textureData = AWTTextureIO.newTextureData(convertedImage, false);
texture = TextureIO.newTexture(textureData);
}
diff --git a/src/demos/vertexProgRefract/VertexProgRefract.java b/src/demos/vertexProgRefract/VertexProgRefract.java
index 943bd7a..5274aba 100644
--- a/src/demos/vertexProgRefract/VertexProgRefract.java
+++ b/src/demos/vertexProgRefract/VertexProgRefract.java
@@ -58,9 +58,11 @@ import java.io.IOException;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.awt.AWTGLAutoDrawable;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
import javax.media.opengl.util.Animator;
+import javax.media.opengl.util.BufferUtil;
import javax.swing.JOptionPane;
@@ -283,7 +285,8 @@ public class VertexProgRefract extends Demo {
gl.glGenPrograms(1, vtxProgTmp, 0);
vtxProg = vtxProgTmp[0];
gl.glBindProgram(GL2.GL_VERTEX_PROGRAM, vtxProg);
- gl.glProgramString(GL2.GL_VERTEX_PROGRAM, GL2.GL_PROGRAM_FORMAT_ASCII, transformRefract.length(), transformRefract);
+ gl.glProgramString(GL2.GL_VERTEX_PROGRAM, GL2.GL_PROGRAM_FORMAT_ASCII, transformRefract.length(),
+ BufferUtil.newByteBuffer(transformRefract.getBytes()));
gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 0, 0.0f, 0.0f, 0.0f, 1.0f); // eye position
@@ -327,13 +330,13 @@ public class VertexProgRefract extends Demo {
// Register the window with the ManipManager
ManipManager manager = ManipManager.getManipManager();
- manager.registerWindow(drawable);
+ manager.registerWindow((AWTGLAutoDrawable) drawable);
this.drawable = drawable;
viewer = new ExaminerViewer(MouseButtonHelper.numMouseButtons());
viewer.setNoAltKeyMode(true);
viewer.setAutoRedrawMode(false);
- viewer.attach(drawable, new BSphereProvider() {
+ viewer.attach((AWTGLAutoDrawable) drawable, new BSphereProvider() {
public BSphere getBoundingSphere() {
return new BSphere(new Vec3f(0, 0, 0), 1.0f);
}
@@ -383,8 +386,8 @@ public class VertexProgRefract extends Demo {
gl.glPushMatrix();
viewer.update(gl);
- ManipManager.getManipManager().updateCameraParameters(drawable, viewer.getCameraParameters());
- ManipManager.getManipManager().render(drawable, gl);
+ ManipManager.getManipManager().updateCameraParameters((AWTGLAutoDrawable) drawable, viewer.getCameraParameters());
+ ManipManager.getManipManager().render((AWTGLAutoDrawable) drawable, gl);
gl.glBindProgram(GL2.GL_VERTEX_PROGRAM, vtxProg);
@@ -465,7 +468,7 @@ public class VertexProgRefract extends Demo {
public void shutdownDemo() {
if (drawable != null) {
viewer.detach();
- ManipManager.getManipManager().unregisterWindow(drawable);
+ ManipManager.getManipManager().unregisterWindow((AWTGLAutoDrawable) drawable);
drawable.removeGLEventListener(this);
}
super.shutdownDemo();
@@ -578,7 +581,7 @@ public class VertexProgRefract extends Demo {
gl.glBindProgram(GL2.GL_FRAGMENT_PROGRAM, fragProg);
gl.glProgramString(GL2.GL_FRAGMENT_PROGRAM, GL2.GL_PROGRAM_FORMAT_ASCII,
- combineFragProg.length(), combineFragProg);
+ combineFragProg.length(), BufferUtil.newByteBuffer(combineFragProg.getBytes()));
int[] errPos = new int[1];
gl.glGetIntegerv(GL2.GL_PROGRAM_ERROR_POSITION, errPos, 0);
if (errPos[0] >= 0) {
diff --git a/src/demos/vertexProgWarp/VertexProgWarp.java b/src/demos/vertexProgWarp/VertexProgWarp.java
index 76c43d5..fca8bcf 100644
--- a/src/demos/vertexProgWarp/VertexProgWarp.java
+++ b/src/demos/vertexProgWarp/VertexProgWarp.java
@@ -55,10 +55,12 @@ import java.io.IOException;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.awt.AWTGLAutoDrawable;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
import javax.media.opengl.glu.GLUquadric;
import javax.media.opengl.util.Animator;
+import javax.media.opengl.util.BufferUtil;
import javax.swing.JOptionPane;
@@ -193,7 +195,8 @@ public class VertexProgWarp extends Demo {
gl.glGenPrograms(1, vtxProgTmp, 0);
programs[i] = vtxProgTmp[0];
gl.glBindProgram(GL2.GL_VERTEX_PROGRAM, programs[i]);
- gl.glProgramString(GL2.GL_VERTEX_PROGRAM, GL2.GL_PROGRAM_FORMAT_ASCII, programTexts[i].length(), programTexts[i]);
+ gl.glProgramString(GL2.GL_VERTEX_PROGRAM, GL2.GL_PROGRAM_FORMAT_ASCII, programTexts[i].length(),
+ BufferUtil.newByteBuffer(programTexts[i].getBytes()));
}
gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 0, 0.0f, 0.0f, 1.0f, 0.0f); // light position/direction
@@ -224,13 +227,13 @@ public class VertexProgWarp extends Demo {
// Register the window with the ManipManager
ManipManager manager = ManipManager.getManipManager();
- manager.registerWindow(drawable);
+ manager.registerWindow((AWTGLAutoDrawable) drawable);
this.drawable = drawable;
viewer = new ExaminerViewer(MouseButtonHelper.numMouseButtons());
viewer.setNoAltKeyMode(true);
viewer.setAutoRedrawMode(false);
- viewer.attach(drawable, new BSphereProvider() {
+ viewer.attach((AWTGLAutoDrawable) drawable, new BSphereProvider() {
public BSphere getBoundingSphere() {
return new BSphere(new Vec3f(0, 0, 0), 1.0f);
}
@@ -286,8 +289,8 @@ public class VertexProgWarp extends Demo {
}
viewer.update(gl);
- ManipManager.getManipManager().updateCameraParameters(drawable, viewer.getCameraParameters());
- ManipManager.getManipManager().render(drawable, gl);
+ ManipManager.getManipManager().updateCameraParameters((AWTGLAutoDrawable) drawable, viewer.getCameraParameters());
+ ManipManager.getManipManager().render((AWTGLAutoDrawable) drawable, gl);
gl.glBindProgram(GL2.GL_VERTEX_PROGRAM, programs[program]);
gl.glProgramEnvParameter4f(GL2.GL_VERTEX_PROGRAM, 7, anim, 0.0f, 0.0f, 0.0f);
@@ -316,7 +319,7 @@ public class VertexProgWarp extends Demo {
// Internals only below this point
//
public void shutdownDemo() {
- ManipManager.getManipManager().unregisterWindow(drawable);
+ ManipManager.getManipManager().unregisterWindow((AWTGLAutoDrawable) drawable);
drawable.removeGLEventListener(this);
super.shutdownDemo();
}
diff --git a/src/gleem/ExaminerViewer.java b/src/gleem/ExaminerViewer.java
index a7f3d64..2b66b73 100644
--- a/src/gleem/ExaminerViewer.java
+++ b/src/gleem/ExaminerViewer.java
@@ -45,6 +45,7 @@ import java.util.*;
import gleem.linalg.*;
import javax.media.opengl.*;
+import javax.media.opengl.awt.*;
/** <P> This is an application-level class, not part of the
manipulator hierarchy. It is an example of how you might integrate
@@ -71,7 +72,7 @@ import javax.media.opengl.*;
button. </P> */
public class ExaminerViewer {
- private GLAutoDrawable window;
+ private AWTGLAutoDrawable window;
/** Simple state machine for figuring out whether we are grabbing
events */
private boolean interactionUnderway;
@@ -151,7 +152,7 @@ public class ExaminerViewer {
<P> In order for the viewer to do anything useful, you need to
provide a BSphereProvider to it to allow "view all"
functionality. </P> */
- public void attach(GLAutoDrawable window, BSphereProvider provider) {
+ public void attach(AWTGLAutoDrawable window, BSphereProvider provider) {
this.window = window;
this.provider = provider;
init();
diff --git a/src/gleem/ManipManager.java b/src/gleem/ManipManager.java
index e793348..2fabd1e 100644
--- a/src/gleem/ManipManager.java
+++ b/src/gleem/ManipManager.java
@@ -45,6 +45,7 @@ import java.util.*;
import gleem.linalg.*;
import javax.media.opengl.*;
+import javax.media.opengl.awt.*;
/** The ManipManager handles making manipulators visible in a
window. */
@@ -55,7 +56,7 @@ public class ManipManager {
private static ManipManager soleInstance;
// Maps GLDrawables to WindowInfos
private Map windowToInfoMap = new HashMap();
- // Maps Manips to Set<GLAutoDrawable>
+ // Maps Manips to Set<AWTGLAutoDrawable>
private Map manipToWindowMap = new HashMap();
// MouseAdapter for this
@@ -78,7 +79,7 @@ public class ManipManager {
}
};
private WindowUpdateListener defaultWindowListener = new WindowUpdateListener() {
- public void update(GLAutoDrawable window) {
+ public void update(AWTGLAutoDrawable window) {
window.repaint();
}
};
@@ -108,14 +109,14 @@ public class ManipManager {
/** Make the ManipManager aware of the existence of a given
window. This causes mouse and mouse motion listeners to be
installed on this window; see setupMouseListeners, below. */
- public synchronized void registerWindow(GLAutoDrawable window) {
+ public synchronized void registerWindow(AWTGLAutoDrawable window) {
windowToInfoMap.put(window, new WindowInfo());
setupMouseListeners(window);
}
/** Remove all references to a given window, including removing all
manipulators from it. */
- public synchronized void unregisterWindow(GLAutoDrawable window) {
+ public synchronized void unregisterWindow(AWTGLAutoDrawable window) {
if (window == null) {
return;
}
@@ -132,7 +133,7 @@ public class ManipManager {
/** Make a given manipulator visible and active in a given
window. The window must be registered. */
- public synchronized void showManipInWindow(Manip manip, GLAutoDrawable window) {
+ public synchronized void showManipInWindow(Manip manip, AWTGLAutoDrawable window) {
WindowInfo info = (WindowInfo) windowToInfoMap.get(window);
if (info == null) {
throw new RuntimeException("Window not registered");
@@ -148,7 +149,7 @@ public class ManipManager {
/** Remove a given manipulator from a given window. The window must
be registered. */
- public synchronized void removeManipFromWindow(Manip manip, GLAutoDrawable window) {
+ public synchronized void removeManipFromWindow(Manip manip, AWTGLAutoDrawable window) {
WindowInfo info = (WindowInfo) windowToInfoMap.get(window);
if (info == null) {
throw new RuntimeException("Window not registered");
@@ -163,7 +164,7 @@ public class ManipManager {
/** This must be called for a registered window every time the
camera parameters of the window change. */
- public synchronized void updateCameraParameters(GLAutoDrawable window, CameraParameters params) {
+ public synchronized void updateCameraParameters(AWTGLAutoDrawable window, CameraParameters params) {
WindowInfo info = (WindowInfo) windowToInfoMap.get(window);
if (info == null) {
throw new RuntimeException("Window not registered");
@@ -186,7 +187,7 @@ public class ManipManager {
repainting of windows in which manipulators have moved. The
default implementation, which can be restored by passing a null
listener argument to this method, calls repaint() on the
- GLAutoDrawable if it is not a GLRunnable instance (i.e., a
+ AWTGLAutoDrawable if it is not a GLRunnable instance (i.e., a
GLAnimCanvas or GLAnimJPanel, which redraw themselves
automatically). */
public synchronized void setWindowUpdateListener(WindowUpdateListener listener) {
@@ -201,7 +202,7 @@ public class ManipManager {
drawing occurs immediately; this routine must be called when an
OpenGL context is valid, i.e., from within the display() method
of a GLEventListener. */
- public synchronized void render(GLAutoDrawable window, GL2 gl) {
+ public synchronized void render(AWTGLAutoDrawable window, GL2 gl) {
WindowInfo info = (WindowInfo) windowToInfoMap.get(window);
if (info == null) {
throw new RuntimeException("Window not registered");
@@ -218,7 +219,7 @@ public class ManipManager {
listeners for the canvas (see the ExaminerViewer class), the
setupMouseListeners and removeMouseListeners routines, as well
as the appropriate delegate routines, are made public here. */
- public synchronized void setupMouseListeners(GLAutoDrawable window) {
+ public synchronized void setupMouseListeners(AWTGLAutoDrawable window) {
window.addMouseMotionListener(mouseMotionListener);
window.addMouseListener(mouseListener);
}
@@ -226,7 +227,7 @@ public class ManipManager {
/** Removes the automatically-installed mouse listeners for the
given window. This allows application code to determine the
policy for intercepting mouse events. */
- public synchronized void removeMouseListeners(GLAutoDrawable window) {
+ public synchronized void removeMouseListeners(AWTGLAutoDrawable window) {
window.removeMouseMotionListener(mouseMotionListener);
window.removeMouseListener(mouseListener);
}
@@ -236,7 +237,7 @@ public class ManipManager {
are exposed so application-level code can intercept events when
certain modifier keys are depressed. */
public synchronized void mouseMoved(MouseEvent e) {
- passiveMotionMethod((GLAutoDrawable) e.getComponent(), e.getX(), e.getY());
+ passiveMotionMethod((AWTGLAutoDrawable) e.getComponent(), e.getX(), e.getY());
}
/** The ManipManager watches for the following events: mouseMoved,
@@ -244,7 +245,7 @@ public class ManipManager {
are exposed so application-level code can intercept events when
certain modifier keys are depressed. */
public synchronized void mouseDragged(MouseEvent e) {
- motionMethod((GLAutoDrawable) e.getComponent(), e.getX(), e.getY());
+ motionMethod((AWTGLAutoDrawable) e.getComponent(), e.getX(), e.getY());
}
/** The ManipManager watches for the following events: mouseMoved,
@@ -252,7 +253,7 @@ public class ManipManager {
are exposed so application-level code can intercept events when
certain modifier keys are depressed. */
public synchronized void mousePressed(MouseEvent e) {
- mouseMethod((GLAutoDrawable) e.getComponent(), e.getModifiers(),
+ mouseMethod((AWTGLAutoDrawable) e.getComponent(), e.getModifiers(),
true, e.getX(), e.getY());
}
@@ -261,7 +262,7 @@ public class ManipManager {
are exposed so application-level code can intercept events when
certain modifier keys are depressed. */
public synchronized void mouseReleased(MouseEvent e) {
- mouseMethod((GLAutoDrawable) e.getComponent(), e.getModifiers(),
+ mouseMethod((AWTGLAutoDrawable) e.getComponent(), e.getModifiers(),
false, e.getX(), e.getY());
}
@@ -274,7 +275,7 @@ public class ManipManager {
setWindowUpdateListener(null);
}
- private void motionMethod(GLAutoDrawable window, int x, int y) {
+ private void motionMethod(AWTGLAutoDrawable window, int x, int y) {
WindowInfo info = (WindowInfo) windowToInfoMap.get(window);
if (info.dragging) {
// Compute ray in 3D
@@ -286,7 +287,7 @@ public class ManipManager {
}
}
- private void passiveMotionMethod(GLAutoDrawable window, int x, int y) {
+ private void passiveMotionMethod(AWTGLAutoDrawable window, int x, int y) {
WindowInfo info = (WindowInfo) windowToInfoMap.get(window);
// Compute ray in 3D
Vec3f rayStart = new Vec3f();
@@ -326,7 +327,7 @@ public class ManipManager {
}
}
- private void mouseMethod(GLAutoDrawable window, int modifiers,
+ private void mouseMethod(AWTGLAutoDrawable window, int modifiers,
boolean isPress, int x, int y) {
if ((modifiers & InputEvent.BUTTON1_MASK) != 0) {
WindowInfo info = (WindowInfo) windowToInfoMap.get(window);
@@ -402,7 +403,7 @@ public class ManipManager {
Set windows = (Set) manipToWindowMap.get(manip);
assert windows != null;
for (Iterator iter = windows.iterator(); iter.hasNext(); ) {
- windowListener.update((GLAutoDrawable) iter.next());
+ windowListener.update((AWTGLAutoDrawable) iter.next());
}
}
}
diff --git a/src/gleem/TestExaminerViewer.java b/src/gleem/TestExaminerViewer.java
index ee73c9b..c13da4e 100644
--- a/src/gleem/TestExaminerViewer.java
+++ b/src/gleem/TestExaminerViewer.java
@@ -45,8 +45,10 @@ import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
+import javax.media.opengl.awt.AWTGLAutoDrawable;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
@@ -116,25 +118,25 @@ public class TestExaminerViewer {
// Register the window with the ManipManager
ManipManager manager = ManipManager.getManipManager();
- manager.registerWindow(drawable);
+ manager.registerWindow((AWTGLAutoDrawable) drawable);
// Instantiate a HandleBoxManip
HandleBoxManip manip = new HandleBoxManip();
manip.setTranslation(new Vec3f(0, 0, -10));
- manager.showManipInWindow(manip, drawable);
+ manager.showManipInWindow(manip, (AWTGLAutoDrawable) drawable);
// Instantiate ExaminerViewer
viewer = new ExaminerViewer(MouseButtonHelper.numMouseButtons());
- viewer.attach(drawable, new HandleBoxManipBSphereProvider(manip));
+ viewer.attach((AWTGLAutoDrawable) drawable, new HandleBoxManipBSphereProvider(manip));
viewer.viewAll(gl);
}
public void display(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
viewer.update(gl);
- ManipManager.getManipManager().updateCameraParameters(drawable, viewer.getCameraParameters());
- ManipManager.getManipManager().render(drawable, gl);
+ ManipManager.getManipManager().updateCameraParameters((AWTGLAutoDrawable) drawable, viewer.getCameraParameters());
+ ManipManager.getManipManager().render((AWTGLAutoDrawable) drawable, gl);
}
// Unused routines
diff --git a/src/gleem/TestHandleBox.java b/src/gleem/TestHandleBox.java
index f911d46..9b1438d 100644
--- a/src/gleem/TestHandleBox.java
+++ b/src/gleem/TestHandleBox.java
@@ -45,8 +45,10 @@ import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
+import javax.media.opengl.awt.AWTGLAutoDrawable;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
@@ -93,19 +95,19 @@ public class TestHandleBox {
// Register the window with the ManipManager
ManipManager manager = ManipManager.getManipManager();
- manager.registerWindow(drawable);
+ manager.registerWindow((AWTGLAutoDrawable) drawable);
// Instantiate a HandleBoxManip
HandleBoxManip manip = new HandleBoxManip();
manip.setTranslation(new Vec3f(0, 0, -10));
- manager.showManipInWindow(manip, drawable);
+ manager.showManipInWindow(manip, (AWTGLAutoDrawable) drawable);
}
public void display(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
- ManipManager.getManipManager().updateCameraParameters(drawable, params);
- ManipManager.getManipManager().render(drawable, gl);
+ ManipManager.getManipManager().updateCameraParameters((AWTGLAutoDrawable) drawable, params);
+ ManipManager.getManipManager().render((AWTGLAutoDrawable) drawable, gl);
}
public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
diff --git a/src/gleem/TestMultiWin.java b/src/gleem/TestMultiWin.java
index dbf624c..d143721 100644
--- a/src/gleem/TestMultiWin.java
+++ b/src/gleem/TestMultiWin.java
@@ -46,8 +46,10 @@ import java.awt.Point;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
+import javax.media.opengl.awt.AWTGLAutoDrawable;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
@@ -118,22 +120,22 @@ public class TestMultiWin {
// Register the window with the ManipManager
ManipManager manager = ManipManager.getManipManager();
- manager.registerWindow(drawable);
+ manager.registerWindow((AWTGLAutoDrawable) drawable);
- manager.showManipInWindow(manip, drawable);
+ manager.showManipInWindow(manip, (AWTGLAutoDrawable) drawable);
// Instantiate ExaminerViewer
viewer = new ExaminerViewer(MouseButtonHelper.numMouseButtons());
- viewer.attach(drawable, new HandleBoxManipBSphereProvider(manip));
+ viewer.attach((AWTGLAutoDrawable) drawable, new HandleBoxManipBSphereProvider(manip));
viewer.viewAll(gl);
}
public void display(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
viewer.update(gl);
- ManipManager.getManipManager().updateCameraParameters(drawable, viewer.getCameraParameters());
- ManipManager.getManipManager().render(drawable, gl);
+ ManipManager.getManipManager().updateCameraParameters((AWTGLAutoDrawable) drawable, viewer.getCameraParameters());
+ ManipManager.getManipManager().render((AWTGLAutoDrawable) drawable, gl);
}
// Unused routines
diff --git a/src/gleem/TestTranslate1.java b/src/gleem/TestTranslate1.java
index 83a2a00..fccc5f9 100644
--- a/src/gleem/TestTranslate1.java
+++ b/src/gleem/TestTranslate1.java
@@ -45,8 +45,10 @@ import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
+import javax.media.opengl.awt.AWTGLAutoDrawable;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
@@ -93,20 +95,20 @@ public class TestTranslate1 {
// Register the window with the ManipManager
ManipManager manager = ManipManager.getManipManager();
- manager.registerWindow(drawable);
+ manager.registerWindow((AWTGLAutoDrawable) drawable);
// Instantiate a Translate1Manip
Translate1Manip manip = new Translate1Manip();
manip.setTranslation(new Vec3f(0, 0, -5));
manip.setAxis(new Vec3f(-1, 0.5f, 1));
- manager.showManipInWindow(manip, drawable);
+ manager.showManipInWindow(manip, (AWTGLAutoDrawable) drawable);
}
public void display(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
- ManipManager.getManipManager().updateCameraParameters(drawable, params);
- ManipManager.getManipManager().render(drawable, gl);
+ ManipManager.getManipManager().updateCameraParameters((AWTGLAutoDrawable) drawable, params);
+ ManipManager.getManipManager().render((AWTGLAutoDrawable) drawable, gl);
}
public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
diff --git a/src/gleem/TestTranslate2.java b/src/gleem/TestTranslate2.java
index cebe32e..af64bbc 100644
--- a/src/gleem/TestTranslate2.java
+++ b/src/gleem/TestTranslate2.java
@@ -45,8 +45,10 @@ import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GL;
+import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
+import javax.media.opengl.awt.AWTGLAutoDrawable;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
@@ -93,20 +95,20 @@ public class TestTranslate2 {
// Register the window with the ManipManager
ManipManager manager = ManipManager.getManipManager();
- manager.registerWindow(drawable);
+ manager.registerWindow((AWTGLAutoDrawable) drawable);
// Instantiate a Translate2Manip
Translate2Manip manip = new Translate2Manip();
manip.setTranslation(new Vec3f(0, 0, -5));
manip.setNormal(new Vec3f(-1, 1, 1));
- manager.showManipInWindow(manip, drawable);
+ manager.showManipInWindow(manip, (AWTGLAutoDrawable) drawable);
}
public void display(GLAutoDrawable drawable) {
- GL gl = drawable.getGL();
+ GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
- ManipManager.getManipManager().updateCameraParameters(drawable, params);
- ManipManager.getManipManager().render(drawable, gl);
+ ManipManager.getManipManager().updateCameraParameters((AWTGLAutoDrawable) drawable, params);
+ ManipManager.getManipManager().render((AWTGLAutoDrawable) drawable, gl);
}
public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
diff --git a/src/gleem/WindowUpdateListener.java b/src/gleem/WindowUpdateListener.java
index 193d801..8eff015 100644
--- a/src/gleem/WindowUpdateListener.java
+++ b/src/gleem/WindowUpdateListener.java
@@ -39,7 +39,7 @@
package gleem;
-import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.awt.AWTGLAutoDrawable;
/** A WindowUpdateListener is used by the ManipManager to transmit
@@ -48,5 +48,5 @@ import javax.media.opengl.GLAutoDrawable;
GLAutoDrawables in which that Manip is shown. */
public interface WindowUpdateListener {
- public void update(GLAutoDrawable window);
+ public void update(AWTGLAutoDrawable window);
}