From 6f2bdbacf131b05937925fbfe32ac0b603ccbcc6 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sun, 17 Jul 2005 06:13:30 +0000 Subject: Further context-related changes for the JSR-231 API. The GLContext implementations on all platforms have been split into orthogonal GLDrawable and GLContext concepts. It is now possible to create more than one GLContet per GLDrawable (though this has not been tested yet). GLCanvas has been reimplemented in terms of GLDrawableFactory.getGLDrawable(). More functionality has been moved from GLDrawable to GLAutoDrawable. Reimplemented lazy sending of reshape GLEventListener events in GLCanvas and GLJPanel and deleted notion of deferred reshapes from GLDrawableHelper and elsewhere. Sharing of textures and display lists is now expressed in terms of GLContexts instead of GLDrawables. Still need to move pbuffer creation into GLDrawableFactory from the onscreen GLContext implementations. Added option to gleem ExaminerViewer to disable automatic redraws upon mouse events and respecified more of gleem to work on GLAutoDrawables rather than GLDrawables. Updated all JOGL demos to work with new APIs and slightly different initialization sequences (in particular, for pbuffers -- this will change with the addition of GLDrawableFactory.createGLPbuffer()). git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JSR-231@103 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4 --- src/demos/hdr/HDR.java | 13 ++++++++++--- src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java | 10 ++++++---- src/demos/jrefract/JRefract.java | 1 + .../proceduralTexturePhysics/ProceduralTexturePhysics.java | 12 +++++++----- src/demos/proceduralTexturePhysics/Water.java | 2 +- src/demos/testContextSharing/TestContextSharing.java | 2 +- src/demos/vertexProgRefract/VertexProgRefract.java | 1 + src/demos/vertexProgWarp/VertexProgWarp.java | 1 + 8 files changed, 28 insertions(+), 14 deletions(-) (limited to 'src/demos') diff --git a/src/demos/hdr/HDR.java b/src/demos/hdr/HDR.java index db79bd6..3bf1b49 100755 --- a/src/demos/hdr/HDR.java +++ b/src/demos/hdr/HDR.java @@ -282,6 +282,7 @@ public class HDR { manager.registerWindow(drawable); viewer = new ExaminerViewer(MouseButtonHelper.numMouseButtons()); + viewer.setAutoRedrawMode(false); viewer.setNoAltKeyMode(true); viewer.attach(drawable, new BSphereProvider() { public BSphere getBoundingSphere() { @@ -324,6 +325,12 @@ public class HDR { pbuffer.display(); + // FIXME: because of changes in lazy pbuffer instantiation + // behavior the pbuffer might not have been run just now + if (pipeline == null) { + return; + } + // blur pass if (b['g']) { // shrink image @@ -502,7 +509,7 @@ public class HDR { class PbufferListener implements GLEventListener { public void init(GLAutoDrawable drawable) { - // printThreadName("init for PbufferListener"); + printThreadName("init for PbufferListener"); // drawable.setGL(new DebugGL(drawable.getGL())); @@ -693,7 +700,7 @@ public class HDR { class BlurPbufferListener implements GLEventListener { public void init(GLAutoDrawable drawable) { - // printThreadName("init for BlurPbufferListener"); + printThreadName("init for BlurPbufferListener"); // drawable.setGL(new DebugGL(drawable.getGL())); @@ -726,7 +733,7 @@ public class HDR { class Blur2PbufferListener implements GLEventListener { public void init(GLAutoDrawable drawable) { - // printThreadName("init for Blur2PbufferListener"); + printThreadName("init for Blur2PbufferListener"); // drawable.setGL(new DebugGL(drawable.getGL())); diff --git a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java index 74f4355..cd70062 100644 --- a/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java +++ b/src/demos/hwShadowmapsSimple/HWShadowmapsSimple.java @@ -303,6 +303,8 @@ public class HWShadowmapsSimple { } if (!fullyInitialized) { + // Repaint again later once everything is set up + canvas.repaint(); return; } @@ -564,7 +566,7 @@ public class HWShadowmapsSimple { gl.glMatrixMode(GL.GL_MODELVIEW); } - private void render_scene(GL gl, Mat4f view, GLDrawable drawable, CameraParameters params) { + private void render_scene(GL gl, Mat4f view, GLAutoDrawable drawable, CameraParameters params) { gl.glColor3f(1,1,1); gl.glPushMatrix(); Mat4f inverseView = new Mat4f(view); @@ -585,7 +587,7 @@ public class HWShadowmapsSimple { gl.glPopMatrix(); } - private void render_manipulators(GL gl, Mat4f view, GLDrawable drawable, CameraParameters params) { + private void render_manipulators(GL gl, Mat4f view, GLAutoDrawable drawable, CameraParameters params) { gl.glColor3f(1,1,1); gl.glPushMatrix(); Mat4f inverseView = new Mat4f(view); @@ -600,7 +602,7 @@ public class HWShadowmapsSimple { gl.glPopMatrix(); } - private void render_scene_from_camera_view(GL gl, GLU glu, GLDrawable drawable, CameraParameters params) { + private void render_scene_from_camera_view(GL gl, GLU glu, GLAutoDrawable drawable, CameraParameters params) { // place light gl.glPushMatrix(); gl.glLoadIdentity(); @@ -647,7 +649,7 @@ public class HWShadowmapsSimple { render_light_frustum(gl); } - private void render_scene_from_camera_view_shadowed(GL gl, GLU glu, GLDrawable drawable, CameraParameters params) { + private void render_scene_from_camera_view_shadowed(GL gl, GLU glu, GLAutoDrawable drawable, CameraParameters params) { // place light gl.glPushMatrix(); gl.glLoadIdentity(); diff --git a/src/demos/jrefract/JRefract.java b/src/demos/jrefract/JRefract.java index 7947a90..09b5095 100755 --- a/src/demos/jrefract/JRefract.java +++ b/src/demos/jrefract/JRefract.java @@ -442,6 +442,7 @@ public class JRefract { viewer = new ExaminerViewer(MouseButtonHelper.numMouseButtons()); viewer.setNoAltKeyMode(true); + viewer.setAutoRedrawMode(false); viewer.attach(drawable, new BSphereProvider() { public BSphere getBoundingSphere() { return new BSphere(new Vec3f(0, 0, 0), 1.0f); diff --git a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java index 7f8d67b..9713b6b 100644 --- a/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java +++ b/src/demos/proceduralTexturePhysics/ProceduralTexturePhysics.java @@ -83,11 +83,6 @@ public class ProceduralTexturePhysics { canvas = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities()); canvas.addGLEventListener(new Listener()); water = new Water(); - water.initialize("demos/data/images/nvfixed.tga", - "demos/data/images/nvspin.tga", - "demos/data/images/droplet.tga", - "demos/data/cubemaps/CloudyHills_{0}.tga", - canvas); animator = new Animator(canvas); @@ -126,6 +121,12 @@ public class ProceduralTexturePhysics { private float frequencyIncrement = 0.1f; public void init(GLAutoDrawable drawable) { + water.initialize("demos/data/images/nvfixed.tga", + "demos/data/images/nvspin.tga", + "demos/data/images/droplet.tga", + "demos/data/cubemaps/CloudyHills_{0}.tga", + drawable); + GL gl = drawable.getGL(); gl.setSwapInterval(1); @@ -150,6 +151,7 @@ public class ProceduralTexturePhysics { manager.registerWindow(drawable); viewer = new ExaminerViewer(MouseButtonHelper.numMouseButtons()); + viewer.setAutoRedrawMode(false); viewer.attach(drawable, new BSphereProvider() { public BSphere getBoundingSphere() { return new BSphere(new Vec3f(0, 0, 0), 1.2f); diff --git a/src/demos/proceduralTexturePhysics/Water.java b/src/demos/proceduralTexturePhysics/Water.java index 295da6c..46d199a 100644 --- a/src/demos/proceduralTexturePhysics/Water.java +++ b/src/demos/proceduralTexturePhysics/Water.java @@ -186,7 +186,7 @@ public class Water { String spinFilename, String dropletFilename, String cubeMapFilenamePattern, - GLDrawable parentWindow) { + GLAutoDrawable parentWindow) { loadInitialTexture(initialMapFilename); tmpSpinFilename = spinFilename; tmpDropletFilename = dropletFilename; diff --git a/src/demos/testContextSharing/TestContextSharing.java b/src/demos/testContextSharing/TestContextSharing.java index 93801a6..9d23f12 100644 --- a/src/demos/testContextSharing/TestContextSharing.java +++ b/src/demos/testContextSharing/TestContextSharing.java @@ -62,7 +62,7 @@ public class TestContextSharing { frame1.setLayout(new BorderLayout()); frame1.add(canvas1, BorderLayout.CENTER); - GLCanvas canvas2 = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities(), null, canvas1, null); + GLCanvas canvas2 = GLDrawableFactory.getFactory().createGLCanvas(new GLCapabilities(), null, canvas1.getContext(), null); canvas2.addGLEventListener(new Listener()); canvas2.setSize(256, 256); Frame frame2 = new Frame("Canvas 2"); diff --git a/src/demos/vertexProgRefract/VertexProgRefract.java b/src/demos/vertexProgRefract/VertexProgRefract.java index 1e3a5e1..7bc223f 100644 --- a/src/demos/vertexProgRefract/VertexProgRefract.java +++ b/src/demos/vertexProgRefract/VertexProgRefract.java @@ -315,6 +315,7 @@ public class VertexProgRefract { viewer = new ExaminerViewer(MouseButtonHelper.numMouseButtons()); viewer.setNoAltKeyMode(true); + viewer.setAutoRedrawMode(false); viewer.attach(drawable, new BSphereProvider() { public BSphere getBoundingSphere() { return new BSphere(new Vec3f(0, 0, 0), 1.0f); diff --git a/src/demos/vertexProgWarp/VertexProgWarp.java b/src/demos/vertexProgWarp/VertexProgWarp.java index a95f149..4fbb345 100644 --- a/src/demos/vertexProgWarp/VertexProgWarp.java +++ b/src/demos/vertexProgWarp/VertexProgWarp.java @@ -192,6 +192,7 @@ public class VertexProgWarp { viewer = new ExaminerViewer(MouseButtonHelper.numMouseButtons()); viewer.setNoAltKeyMode(true); + viewer.setAutoRedrawMode(false); viewer.attach(drawable, new BSphereProvider() { public BSphere getBoundingSphere() { return new BSphere(new Vec3f(0, 0, 0), 1.0f); -- cgit v1.2.3