diff options
author | Sven Gothel <[email protected]> | 2010-11-09 20:07:21 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-11-09 20:07:21 +0100 |
commit | 597d10f5a5f743a51cfe56f3c381fd80e941a394 (patch) | |
tree | f28d0fcfaab03fc0534c0308a577ca0c0cc93d4f /src/jogl/classes/javax/media/opengl/awt | |
parent | 7dce462b56f1e77e3cc2b68cb72c27a549c53f91 (diff) |
Adding simple static main test entry to provide standalone autobuild verification
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/awt')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/awt/GLCanvas.java | 55 |
1 files changed, 55 insertions, 0 deletions
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(); + } + } + } |