summaryrefslogtreecommitdiffstats
path: root/src/demos
diff options
context:
space:
mode:
Diffstat (limited to 'src/demos')
-rwxr-xr-xsrc/demos/misc/GLCapsTableDemo.java12
-rwxr-xr-xsrc/demos/multisample/Multisample.java12
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");
}
}