aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-01-31 07:42:43 +0100
committerSven Gothel <[email protected]>2011-01-31 07:42:43 +0100
commit8adc04788a6d9dd44de5a4636b46d14dbb70b799 (patch)
tree50f63e6d9b7a22d6bb122f34e59a22e546261309 /src/newt
parent02d5240ccac8875144e5f37c2a4d09375338adc2 (diff)
GLCapabilities enhancements: Choosing, All-Available, Data Handling (X11, WGL and EGL)
- GLDrawableFactory exposes: public final List/*GLCapabilitiesImmutable*/ getAvailableCapabilities(AbstractGraphicsDevice device) - GLCapabilities platform specialization containing native ids (XVisual/FBConfig, PFD, EGLConfig, ..) - GLCapabilities setPbuffer(true) disables onscreen - Capabilities setOnscreen(true) disables pbuffer - Capabilities implements Comparable - *Capabilities: enhanced 'toString(..)' - CapabilitiesChooser.chooseCapabilities: 'CapabilitiesImmutable[] available' -> 'List /*<CapabilitiesImmutable>*/ available' - VersionApplet, GLCanvas.main, GLWindow.main, GLProfile/debug: dumps all available GLCaps - WGLGLCapabilities: proper non-displayeble (pbuffer) pfdid handling TODO: ES/EGL test with emulation
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/awt/opengl/VersionApplet.java62
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java15
2 files changed, 58 insertions, 19 deletions
diff --git a/src/newt/classes/com/jogamp/newt/impl/awt/opengl/VersionApplet.java b/src/newt/classes/com/jogamp/newt/impl/awt/opengl/VersionApplet.java
index 7fb3268f9..f31d1bc0f 100644
--- a/src/newt/classes/com/jogamp/newt/impl/awt/opengl/VersionApplet.java
+++ b/src/newt/classes/com/jogamp/newt/impl/awt/opengl/VersionApplet.java
@@ -1,27 +1,38 @@
package com.jogamp.newt.impl.awt.opengl;
-import com.jogamp.common.GlueGenVersion;
-import com.jogamp.common.util.VersionUtil;
-import com.jogamp.nativewindow.NativeWindowVersion;
-import com.jogamp.newt.NewtVersion;
-import com.jogamp.opengl.JoglVersion;
import java.applet.Applet;
import java.awt.BorderLayout;
+import java.awt.Container;
import java.awt.Frame;
+import java.awt.GridLayout;
import java.awt.TextArea;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+
+import java.util.List;
+
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.GL;
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 com.jogamp.common.GlueGenVersion;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.VersionUtil;
+import com.jogamp.nativewindow.NativeWindowVersion;
+import com.jogamp.newt.NewtVersion;
+import com.jogamp.opengl.JoglVersion;
+
public class VersionApplet extends Applet {
static {
GLProfile.initSingleton(false);
}
- TextArea tarea;
+ TextArea tareaVersion;
+ TextArea tareaCaps;
GLCanvas canvas;
public static void main(String[] args) {
@@ -60,33 +71,50 @@ public class VersionApplet extends Applet {
private synchronized void my_init() {
if(null != canvas) { return; }
+ GLProfile glp = GLProfile.getDefault();
+ GLCapabilities glcaps = new GLCapabilities(glp);
+
setLayout(new BorderLayout());
String s;
- tarea = new TextArea(120, 80);
+ tareaVersion = new TextArea(120, 60);
s = VersionUtil.getPlatformInfo().toString();
System.err.println(s);
- tarea.append(s);
+ tareaVersion.append(s);
s = GlueGenVersion.getInstance().toString();
System.err.println(s);
- tarea.append(s);
+ tareaVersion.append(s);
s = NativeWindowVersion.getInstance().toString();
System.err.println(s);
- tarea.append(NativeWindowVersion.getInstance().toString());
+ tareaVersion.append(NativeWindowVersion.getInstance().toString());
s = JoglVersion.getInstance().toString();
System.err.println(s);
- tarea.append(s);
+ tareaVersion.append(s);
s = NewtVersion.getInstance().toString();
System.err.println(s);
- tarea.append(s);
+ tareaVersion.append(s);
+
+ tareaCaps = new TextArea(120, 20);
+ GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
+ List/*<GLCapabilitiesImmutable>*/ availCaps = factory.getAvailableCapabilities(null);
+ for(int i=0; i<availCaps.size(); i++) {
+ s = ((GLCapabilitiesImmutable) availCaps.get(i)).toString();
+ System.err.println(s);
+ tareaCaps.append(s);
+ tareaCaps.append(Platform.getNewline());
+ }
- add(tarea, BorderLayout.CENTER);
+ Container grid = new Container();
+ grid.setLayout(new GridLayout(2, 1));
+ grid.add(tareaVersion);
+ grid.add(tareaCaps);
+ add(grid, BorderLayout.CENTER);
- canvas = new GLCanvas();
+ canvas = new GLCanvas(glcaps);
canvas.addGLEventListener(new GLInfo());
canvas.setSize(10, 10);
add(canvas, BorderLayout.SOUTH);
@@ -98,8 +126,8 @@ public class VersionApplet extends Applet {
remove(canvas);
canvas.destroy();
canvas = null;
- remove(tarea);
- tarea=null;
+ remove(tareaVersion);
+ tareaVersion=null;
}
}
@@ -130,7 +158,7 @@ public class VersionApplet extends Applet {
GL gl = drawable.getGL();
String s = JoglVersion.getInstance().getGLInfo(gl, null).toString();
System.err.println(s);
- tarea.append(s);
+ tareaVersion.append(s);
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 4a1855d05..6886fc71b 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -34,18 +34,22 @@
package com.jogamp.newt.opengl;
+import java.util.List;
+
import com.jogamp.common.GlueGenVersion;
import com.jogamp.common.util.VersionUtil;
import com.jogamp.nativewindow.NativeWindowVersion;
import com.jogamp.newt.*;
import com.jogamp.newt.event.*;
import com.jogamp.newt.impl.WindowImpl;
+
import javax.media.nativewindow.*;
import javax.media.nativewindow.util.Point;
+import javax.media.nativewindow.util.Insets;
import javax.media.opengl.*;
+
import com.jogamp.opengl.impl.GLDrawableHelper;
import com.jogamp.opengl.JoglVersion;
-import javax.media.nativewindow.util.Insets;
/**
* An implementation of {@link javax.media.opengl.GLAutoDrawable} interface,
@@ -895,7 +899,14 @@ public class GLWindow implements GLAutoDrawable, Window, NEWTEventConsumer {
System.err.println(NativeWindowVersion.getInstance());
System.err.println(JoglVersion.getInstance());
System.err.println(NewtVersion.getInstance());
- GLCapabilitiesImmutable caps = new GLCapabilities( GLProfile.getDefault() );
+
+ GLProfile glp = GLProfile.getDefault();
+ GLDrawableFactory factory = GLDrawableFactory.getFactory(glp);
+ List/*<GLCapabilitiesImmutable>*/ availCaps = factory.getAvailableCapabilities(null);
+ for(int i=0; i<availCaps.size(); i++) {
+ System.err.println(availCaps.get(i));
+ }
+ GLCapabilitiesImmutable caps = new GLCapabilities( glp );
GLWindow glWindow = GLWindow.create(caps);
glWindow.setSize(128, 128);