summaryrefslogtreecommitdiffstats
path: root/src/demos
diff options
context:
space:
mode:
Diffstat (limited to 'src/demos')
-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
10 files changed, 53 insertions, 44 deletions
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 <applet> 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();
}