summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/VersionInfo.java2
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java55
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java32
3 files changed, 89 insertions, 0 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/VersionInfo.java b/src/jogl/classes/com/jogamp/opengl/util/VersionInfo.java
index 0359ef492..b7e6b5194 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/VersionInfo.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/VersionInfo.java
@@ -78,6 +78,8 @@ public class VersionInfo {
sb = new StringBuffer();
}
+ sb.append(prefix+" "+GLProfile.glAvailabilityToString());
+ sb.append(Platform.getNewline());
sb.append(prefix+" Swap Interval " + gl.getSwapInterval());
sb.append(Platform.getNewline());
sb.append(prefix+" GL Profile " + gl.getGLProfile());
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index d2a20f467..22b25740c 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -45,12 +45,14 @@ import javax.media.nativewindow.*;
import javax.media.nativewindow.awt.*;
import com.jogamp.opengl.impl.*;
+import com.jogamp.opengl.util.VersionInfo;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Component;
import java.awt.EventQueue;
import java.awt.FontMetrics;
+import java.awt.Frame;
import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
@@ -787,4 +789,57 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
return config;
}
+
+ /**
+ * A most simple JOGL AWT test entry
+ */
+ public static void main(String args[]) {
+ GLCapabilities caps = new GLCapabilities( GLProfile.getDefault() );
+ Frame frame = new Frame("JOGL AWT Test");
+
+ GLCanvas glCanvas = new GLCanvas(caps);
+ frame.add(glCanvas);
+ frame.setSize(128, 128);
+
+ glCanvas.addGLEventListener(new GLEventListener() {
+ public void init(GLAutoDrawable drawable) {
+ GL gl = drawable.getGL();
+ String prefix = "JOGL AWT Test " + Thread.currentThread().getName();
+ System.err.println(VersionInfo.getInfo(null, prefix, gl).toString());
+ }
+
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ }
+
+ public void display(GLAutoDrawable drawable) {
+ }
+
+ public void dispose(GLAutoDrawable drawable) {
+ }
+ });
+
+ final Frame _frame = frame;
+ final GLCanvas _glCanvas = glCanvas;
+
+ try {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ _frame.setVisible(true);
+ }});
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ glCanvas.display();
+ try {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ _frame.setVisible(false);
+ _frame.remove(_glCanvas);
+ _frame.dispose();
+ }});
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
}
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 36302c55a..b1ad2fd26 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -41,6 +41,7 @@ import javax.media.nativewindow.*;
import javax.media.nativewindow.util.Point;
import javax.media.opengl.*;
import com.jogamp.opengl.impl.GLDrawableHelper;
+import com.jogamp.opengl.util.VersionInfo;
import javax.media.nativewindow.util.Insets;
/**
@@ -840,4 +841,35 @@ public class GLWindow implements GLAutoDrawable, Window {
public final void surfaceUpdated(Object updater, NativeSurface ns, long when) {
window.surfaceUpdated(updater, ns, when);
}
+
+ /**
+ * A most simple JOGL AWT test entry
+ */
+ public static void main(String args[]) {
+ GLCapabilities caps = new GLCapabilities( GLProfile.getDefault() );
+
+ GLWindow glWindow = GLWindow.create(caps);
+ glWindow.setSize(128, 128);
+
+ glWindow.addGLEventListener(new GLEventListener() {
+ public void init(GLAutoDrawable drawable) {
+ GL gl = drawable.getGL();
+ String prefix = "JOGL NEWT Test " + Thread.currentThread().getName();
+ System.err.println(VersionInfo.getInfo(null, prefix, gl).toString());
+ }
+
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ }
+
+ public void display(GLAutoDrawable drawable) {
+ }
+
+ public void dispose(GLAutoDrawable drawable) {
+ }
+ });
+
+ glWindow.setVisible(true);
+ glWindow.destroy(true);
+ }
+
}