From ae1ca3f2cae849f5e5a44538284082e861a98de1 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 23 Nov 2010 05:07:51 +0100 Subject: Adapt to JOGL 7262641429b542929efc699e392f410f1dee2187 --- src/demos/GLInfo.java | 2 +- src/demos/GLNewtRun.java | 1 - src/demos/applets/JOGLNewtApplet1Run.java | 2 +- src/demos/applets/JOGLNewtAppletBase.java | 4 ++-- src/demos/context/DualContext.java | 3 ++- src/demos/es1/RedSquare.java | 4 ++-- src/demos/es2/RedSquare.java | 4 ++-- src/demos/misc/GLCapsTableDemo.java | 18 ++++++++++-------- src/demos/proceduralTexturePhysics/Water.java | 3 ++- 9 files changed, 22 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/demos/GLInfo.java b/src/demos/GLInfo.java index 9cd055d..c49a578 100755 --- a/src/demos/GLInfo.java +++ b/src/demos/GLInfo.java @@ -82,7 +82,7 @@ public class GLInfo extends Thread implements GLEventListener { window.display(); // Shut things down cooperatively - window.destroy(true); + window.destroy(); System.out.println(glp+" GLInfo shut down cleanly."); } catch (Throwable t) { t.printStackTrace(); diff --git a/src/demos/GLNewtRun.java b/src/demos/GLNewtRun.java index 40e5e1a..5310a93 100755 --- a/src/demos/GLNewtRun.java +++ b/src/demos/GLNewtRun.java @@ -217,7 +217,6 @@ public class GLNewtRun extends WindowAdapter implements KeyListener, MouseListen } } nWindow.setUndecorated(undecorated); - nWindow.getScreen().setDestroyWhenUnused(true); window = GLWindow.create(nWindow); if(!setField(demo, "window", window)) { diff --git a/src/demos/applets/JOGLNewtApplet1Run.java b/src/demos/applets/JOGLNewtApplet1Run.java index 936e7b9..0a5311b 100755 --- a/src/demos/applets/JOGLNewtApplet1Run.java +++ b/src/demos/applets/JOGLNewtApplet1Run.java @@ -86,7 +86,7 @@ public class JOGLNewtApplet1Run extends Applet { glWindow.setVisible(false); // hide 1st glWindow.reparentWindow(null); // get out of newtCanvasAWT this.remove(newtCanvasAWT); // remove newtCanvasAWT - base.destroy(true); // destroy glWindow unrecoverable + base.destroy(); // destroy glWindow unrecoverable base=null; } } diff --git a/src/demos/applets/JOGLNewtAppletBase.java b/src/demos/applets/JOGLNewtAppletBase.java index da8565c..9fa1bdc 100755 --- a/src/demos/applets/JOGLNewtAppletBase.java +++ b/src/demos/applets/JOGLNewtAppletBase.java @@ -152,7 +152,7 @@ public class JOGLNewtAppletBase extends WindowAdapter implements KeyListener, Mo } } - public void destroy(boolean unrecoverable) { + public void destroy() { isValid = false; if(null!=glAnimator) { glAnimator.stop(); @@ -160,7 +160,7 @@ public class JOGLNewtAppletBase extends WindowAdapter implements KeyListener, Mo glAnimator=null; } if(null!=glWindow) { - glWindow.destroy(unrecoverable); + glWindow.destroy(); glWindow=null; } } diff --git a/src/demos/context/DualContext.java b/src/demos/context/DualContext.java index d77c49a..562b1fd 100755 --- a/src/demos/context/DualContext.java +++ b/src/demos/context/DualContext.java @@ -145,8 +145,9 @@ public class DualContext extends Canvas { GLProfile glp = GLProfile.getDefault(); // warm up .. AWTGraphicsScreen screen = (AWTGraphicsScreen)AWTGraphicsScreen.createDefault(); + GLCapabilities caps = new GLCapabilities(glp); AWTGraphicsConfiguration config = (AWTGraphicsConfiguration) - GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(new GLCapabilities(glp), null, screen); + GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(caps, caps, null, screen); final DualContext dc = new DualContext(config); frame.getContentPane().add(dc, BorderLayout.CENTER); diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java index 4c3d299..a0faf9b 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -173,10 +173,10 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo try { System.out.println("SHUTDOWN "+Thread.currentThread()+" START"); // Shut things down cooperatively - window.destroy(true); + window.destroy(); window = null; if(null!=nWindow) { - nWindow.destroy(true); + nWindow.destroy(); nWindow=null; } System.out.println("SHUTDOWN "+Thread.currentThread()+" FIN"); diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java index ec126db..54c44eb 100755 --- a/src/demos/es2/RedSquare.java +++ b/src/demos/es2/RedSquare.java @@ -146,10 +146,10 @@ public class RedSquare extends Thread implements WindowListener, KeyListener, Mo public void shutdown() { try { // Shut things down cooperatively - window.destroy(true); + window.destroy(); window = null; if(null!=nWindow) { - nWindow.destroy(true); + nWindow.destroy(); nWindow=null; } System.out.println("SHUTDOWN "+Thread.currentThread()+" cleanly"); diff --git a/src/demos/misc/GLCapsTableDemo.java b/src/demos/misc/GLCapsTableDemo.java index 701712c..abfef88 100755 --- a/src/demos/misc/GLCapsTableDemo.java +++ b/src/demos/misc/GLCapsTableDemo.java @@ -20,6 +20,8 @@ import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLCapabilitiesChooser; import javax.media.opengl.awt.GLCanvas; import com.jogamp.opengl.util.FPSAnimator; +import javax.media.nativewindow.CapabilitiesImmutable; +import javax.media.opengl.GLCapabilitiesImmutable; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JFrame; @@ -68,17 +70,17 @@ public class GLCapsTableDemo private DefaultGLCapabilitiesChooser choiceExaminer = // new DefaultGLCapabilitiesChooser() { - public int chooseCapabilities(Capabilities _desired, - Capabilities[] _available, + public int chooseCapabilities(CapabilitiesImmutable _desired, + CapabilitiesImmutable[] _available, int windowSystemRecommendedChoice) { - GLCapabilities desired = (GLCapabilities) _desired; - GLCapabilities[] available = (GLCapabilities[]) _available; + GLCapabilitiesImmutable desired = (GLCapabilitiesImmutable) _desired; + GLCapabilitiesImmutable[] available = (GLCapabilitiesImmutable[]) _available; if ( available != null ) for (int i = 0; i < available.length; i++) { - GLCapabilities c = available[i]; + GLCapabilitiesImmutable c = available[i]; if (c != null) { - GLCapsTableDemo.this.available.add((GLCapabilities) c.clone()); + GLCapsTableDemo.this.available.add((GLCapabilities) c.cloneMutable()); GLCapsTableDemo.this.indices.add(new Integer(i)); } } @@ -130,8 +132,8 @@ public class GLCapsTableDemo * @see javax.media.opengl.GLCapabilitiesChooser#chooseCapabilities(javax.media.nativewindow.Capabilities, * javax.media.nativewindow.Capabilities[], int) */ - public int chooseCapabilities(Capabilities desired, - Capabilities[] available, + public int chooseCapabilities(CapabilitiesImmutable desired, + CapabilitiesImmutable[] available, int windowSystemRecommendedChoice) { int row = capsTable.getSelectedRow(); diff --git a/src/demos/proceduralTexturePhysics/Water.java b/src/demos/proceduralTexturePhysics/Water.java index 593c2f0..1710ef4 100644 --- a/src/demos/proceduralTexturePhysics/Water.java +++ b/src/demos/proceduralTexturePhysics/Water.java @@ -49,6 +49,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.GLCapabilitiesImmutable; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLException; @@ -203,7 +204,7 @@ public class Water { String cubeMapFilenamePrefix, String cubeMapFilenameSuffix, GLAutoDrawable parentWindow) { - GLCapabilities caps = parentWindow.getChosenGLCapabilities(); + GLCapabilities caps = (GLCapabilities) parentWindow.getChosenGLCapabilities().cloneMutable(); loadInitialTexture(caps.getGLProfile(), initialMapFilename); tmpSpinFilename = spinFilename; -- cgit v1.2.3