diff options
author | Sven Gothel <[email protected]> | 2011-01-31 17:04:41 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-01-31 17:04:41 +0100 |
commit | 8e5c4d5e23696ce46d4d4fd7ff28d987d7da20a4 (patch) | |
tree | fd8cad41d9a1362e995a887e36f94df6c44492eb | |
parent | e35038cc3c01b6ad8beb559986102c68fde614b6 (diff) |
Adapt CapabilitiesChooser.chooseCapabilities() changes of JOGL 8adc04788a6d9dd44de5a4636b46d14dbb70b799
-rwxr-xr-x | src/demos/misc/GLCapsTableDemo.java | 12 | ||||
-rwxr-xr-x | src/demos/multisample/Multisample.java | 12 |
2 files changed, 13 insertions, 11 deletions
diff --git a/src/demos/misc/GLCapsTableDemo.java b/src/demos/misc/GLCapsTableDemo.java index abfef88..afa85fa 100755 --- a/src/demos/misc/GLCapsTableDemo.java +++ b/src/demos/misc/GLCapsTableDemo.java @@ -12,6 +12,7 @@ import java.awt.GraphicsEnvironment; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.List; import java.util.ArrayList; import javax.media.nativewindow.Capabilities; import javax.media.opengl.DefaultGLCapabilitiesChooser; @@ -71,14 +72,13 @@ public class GLCapsTableDemo new DefaultGLCapabilitiesChooser() { public int chooseCapabilities(CapabilitiesImmutable _desired, - CapabilitiesImmutable[] _available, + List/*<CapabilitiesImmutable>*/ available, int windowSystemRecommendedChoice) { GLCapabilitiesImmutable desired = (GLCapabilitiesImmutable) _desired; - GLCapabilitiesImmutable[] available = (GLCapabilitiesImmutable[]) _available; - if ( available != null ) - for (int i = 0; i < available.length; i++) { - GLCapabilitiesImmutable c = available[i]; + if ( available != null && available.size()>0 ) + for (int i = 0; i < available.size(); i++) { + GLCapabilitiesImmutable c = (GLCapabilitiesImmutable) available.get(i); if (c != null) { GLCapsTableDemo.this.available.add((GLCapabilities) c.cloneMutable()); GLCapsTableDemo.this.indices.add(new Integer(i)); @@ -133,7 +133,7 @@ public class GLCapsTableDemo * javax.media.nativewindow.Capabilities[], int) */ public int chooseCapabilities(CapabilitiesImmutable desired, - CapabilitiesImmutable[] available, + List/*<CapabilitiesImmutable>*/ available, int windowSystemRecommendedChoice) { int row = capsTable.getSelectedRow(); diff --git a/src/demos/multisample/Multisample.java b/src/demos/multisample/Multisample.java index 9c95b97..5b5d6b2 100755 --- a/src/demos/multisample/Multisample.java +++ b/src/demos/multisample/Multisample.java @@ -39,6 +39,7 @@ package demos.multisample; +import java.util.List; import java.awt.*; import java.awt.event.*; import javax.media.opengl.*; @@ -50,11 +51,11 @@ public class Multisample { // Simple class to warn if results are not going to be as expected static class MultisampleChooser extends DefaultGLCapabilitiesChooser { public int chooseCapabilities(GLCapabilities desired, - GLCapabilities[] available, + List/*<GLCapabilitiesImmutable>*/ available, int windowSystemRecommendedChoice) { boolean anyHaveSampleBuffers = false; - for (int i = 0; i < available.length; i++) { - GLCapabilities caps = available[i]; + for (int i = 0; i < available.size(); i++) { + GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) available.get(i); if (caps != null && caps.getSampleBuffers()) { anyHaveSampleBuffers = true; break; @@ -63,8 +64,9 @@ public class Multisample { int selection = super.chooseCapabilities(desired, available, windowSystemRecommendedChoice); if (!anyHaveSampleBuffers) { System.err.println("WARNING: antialiasing will be disabled because none of the available pixel formats had it to offer"); - } else { - if (!available[selection].getSampleBuffers()) { + } else if(selection>=0) { + GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) available.get(selection); + if (!caps.getSampleBuffers()) { System.err.println("WARNING: antialiasing will be disabled because the DefaultGLCapabilitiesChooser didn't supply it"); } } |