aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/com/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-01-30 11:43:40 +0100
committerSven Gothel <[email protected]>2014-01-30 11:43:40 +0100
commitac55c5bfa469537c755730d3be9617d97f82950d (patch)
treeb820c04f9a170da2a90c94642e800b9a300f8ac6 /src/newt/classes/com/jogamp
parent6b37c1c3d109d3ae83d19ac84b50c7b3249af95a (diff)
NEWT: Add Support for AWT-Less Applet3
- Adding 'plugin3-public' jar and sources for Applet3 support, copied from icedtea-web3 - Added com.jogamp.newt.util.applet.JOGLNewtApplet3Run capable to run Applet3
Diffstat (limited to 'src/newt/classes/com/jogamp')
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java1
-rw-r--r--src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java342
-rw-r--r--src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java (renamed from src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java)16
-rw-r--r--src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java212
4 files changed, 563 insertions, 8 deletions
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
index 74d4d833a..9cecca9c5 100644
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
+++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
@@ -48,6 +48,7 @@ import jogamp.nativewindow.jawt.JAWTUtil;
import com.jogamp.common.util.awt.AWTEDTExecutor;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.util.applet.JOGLNewtAppletBase;
/**
* Simple GLEventListener deployment as an applet using JOGL. This demo must be
diff --git a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java
new file mode 100644
index 000000000..465ee4df5
--- /dev/null
+++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java
@@ -0,0 +1,342 @@
+/**
+ * Copyright 2011 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.newt.util.applet;
+
+import java.util.Locale;
+
+import com.jogamp.plugin.applet.Applet3;
+import com.jogamp.plugin.applet.Applet3Context;
+import com.jogamp.plugin.ui.NativeWindowDownstream;
+import com.jogamp.plugin.ui.NativeWindowUpstream;
+
+import javax.media.nativewindow.AbstractGraphicsDevice;
+import javax.media.nativewindow.AbstractGraphicsScreen;
+import javax.media.nativewindow.NativeWindow;
+import javax.media.nativewindow.NativeWindowFactory;
+import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
+import javax.media.opengl.FPSCounter;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
+
+import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize;
+import com.jogamp.newt.NewtFactory;
+import com.jogamp.newt.Window;
+import com.jogamp.newt.opengl.GLWindow;
+
+/**
+ * Simple GLEventListener deployment as an applet using JOGL. This demo must be
+ * referenced from a web page via an &lt;applet&gt; tag.
+ *
+ * <p>
+ * Example of an applet tag using GearsES2 within the applet area (normal case):
+ * <pre>
+ &lt;applet width=100 height=100&gt;
+ &lt;param name="java_arguments" value="-Dsun.java2d.noddraw=true"&gt;
+ &lt;param name="gl_event_listener_class" value="com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2"&gt;
+ &lt;param name="gl_profile" value="GL2"&gt;
+ &lt;param name="gl_swap_interval" value="1"&gt;
+ &lt;param name="gl_debug" value="false"&gt;
+ &lt;param name="gl_trace" value="false"&gt;
+ &lt;param name="jnlp_href" value="jogl-newt-applet-runner.jnlp"&gt;
+ &lt;/applet&gt;Hello Gears !
+ * </pre>
+ * </p>
+ *
+ * <p>
+ * Example of an applet tag using GearsES2 in an undecorated, translucent, closeable and always-on-top window:
+ * <pre>
+ &lt;applet width=1 height=1&gt;
+ &lt;param name="java_arguments" value="-Dsun.java2d.noddraw=true"&gt;
+ &lt;param name="gl_event_listener_class" value="com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2"&gt;
+ &lt;param name="gl_profile" value="GL2"&gt;
+ &lt;param name="gl_swap_interval" value="1"&gt;
+ &lt;param name="gl_undecorated" value="true"&gt;
+ &lt;param name="gl_alwaysontop" value="true"&gt;
+ &lt;param name="gl_closeable" value="true"&gt;
+ &lt;param name="gl_alpha" value="1"&gt;
+ &lt;param name="gl_multisamplebuffer" value="0"&gt;
+ &lt;param name="gl_opaque" value="false"&gt;
+ &lt;param name="gl_dx" value="10"&gt;
+ &lt;param name="gl_dy" value="0"&gt;
+ &lt;param name="gl_width" value="100"&gt;
+ &lt;param name="gl_height" value="100"&gt;
+ &lt;param name="gl_nodefaultkeyListener" value="true"&gt;
+ &lt;param name="gl_debug" value="false"&gt;
+ &lt;param name="gl_trace" value="false"&gt;
+ &lt;param name="jnlp_href" value="jogl-newt-applet-runner.jnlp"&gt;
+ &lt;/applet&gt;Hello Gears !
+ * </pre>
+ * </p>
+ */
+public class JOGLNewtApplet3Run implements Applet3 {
+ public static final boolean DEBUG = JOGLNewtAppletBase.DEBUG;
+
+ GLWindow glWindow = null;
+ JOGLNewtAppletBase base = null;
+ /** if valid glStandalone:=true (own window) ! */
+ int glXd=Integer.MAX_VALUE, glYd=Integer.MAX_VALUE, glWidth=Integer.MAX_VALUE, glHeight=Integer.MAX_VALUE;
+ Applet3Context ctx;
+ boolean glStandalone = false;
+
+ final String getParameter(String name) {
+ return ctx.getParameter(name);
+ }
+
+ @Override
+ public NativeWindowDownstream createNativeWindow(final Applet3Context ctx, final NativeWindowUpstream upstreamWin) {
+ this.ctx = ctx;
+
+ String glProfileName=null;
+ boolean glOpaque=true;
+ int glAlphaBits=0;
+ int glNumMultisampleBuffer=0;
+ boolean glUndecorated=false;
+ boolean glAlwaysOnTop=false;
+ try {
+ glProfileName = getParameter("gl_profile");
+ glOpaque = JOGLNewtAppletBase.str2Bool(getParameter("gl_opaque"), glOpaque);
+ glAlphaBits = JOGLNewtAppletBase.str2Int(getParameter("gl_alpha"), glAlphaBits);
+ glNumMultisampleBuffer = JOGLNewtAppletBase.str2Int(getParameter("gl_multisamplebuffer"), glNumMultisampleBuffer);
+ glXd = JOGLNewtAppletBase.str2Int(getParameter("gl_dx"), glXd);
+ glYd = JOGLNewtAppletBase.str2Int(getParameter("gl_dy"), glYd);
+ glWidth = JOGLNewtAppletBase.str2Int(getParameter("gl_width"), glWidth);
+ glHeight = JOGLNewtAppletBase.str2Int(getParameter("gl_height"), glHeight);
+ glUndecorated = JOGLNewtAppletBase.str2Bool(getParameter("gl_undecorated"), glUndecorated);
+ glAlwaysOnTop = JOGLNewtAppletBase.str2Bool(getParameter("gl_alwaysontop"), glAlwaysOnTop);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ glStandalone = Integer.MAX_VALUE>glXd && Integer.MAX_VALUE>glYd && Integer.MAX_VALUE>glWidth && Integer.MAX_VALUE>glHeight;
+ if(DEBUG) {
+ System.err.println("JOGLNewtApplet1Run Configuration:");
+ System.err.println("glStandalone: "+glStandalone);
+ if(glStandalone) {
+ System.err.println("pos-size: "+glXd+"/"+glYd+" "+glWidth+"x"+glHeight);
+ }
+ System.err.println("glProfileName: "+glProfileName);
+ System.err.println("glOpaque: "+glOpaque);
+ System.err.println("glAlphaBits: "+glAlphaBits);
+ System.err.println("glNumMultisampleBuffer: "+glNumMultisampleBuffer);
+ System.err.println("glUndecorated: "+glUndecorated);
+ System.err.println("glAlwaysOnTop: "+glAlwaysOnTop);
+ }
+ final GLCapabilities caps = new GLCapabilities(GLProfile.get(glProfileName));
+ caps.setAlphaBits(glAlphaBits);
+ if(0<glNumMultisampleBuffer) {
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(glNumMultisampleBuffer);
+ }
+ caps.setBackgroundOpaque(glOpaque);
+
+ final AbstractGraphicsDevice aDevice = NativeWindowFactory.createDevice(upstreamWin.getDisplayConnection(), false /* own */); // don't open - dummy
+ final AbstractGraphicsScreen aScreen = NativeWindowFactory.createScreen(aDevice, upstreamWin.getScreenIndex());
+ final UpstreamSurfaceHookMutableSize upstreamSizeHook = new UpstreamSurfaceHookMutableSize(upstreamWin.getWidth(), upstreamWin.getHeight());
+ final NativeWindow parentWin = NativeWindowFactory.createWrappedWindow(aScreen,
+ 0 /* surfaceHandle */, upstreamWin.getWindowHandle(),
+ upstreamSizeHook);
+ final Window w = NewtFactory.createWindow(parentWin, caps);
+ glWindow = GLWindow.create(w);
+ glWindow.setUndecorated(glUndecorated);
+ glWindow.setAlwaysOnTop(glAlwaysOnTop);
+ glWindow.setSize(parentWin.getWidth(), parentWin.getHeight());
+
+ return new NativeWindowDownstream() {
+ @Override
+ public void setVisible(boolean v) {
+ if( null != glWindow ) {
+ glWindow.setVisible(v);
+ }
+ }
+
+ @Override
+ public void setSize(int width, int height) {
+ if( null != glWindow ) {
+ upstreamSizeHook.setSize(width, height);
+ glWindow.setSize(width, height);
+ }
+ }
+
+ @Override
+ public void requestFocus() {
+ if( null != glWindow ) {
+ glWindow.requestFocus();
+ }
+ }
+
+ @Override
+ public void destroy() {
+ if( null != glWindow ) {
+ glWindow.destroy();
+ }
+ }
+
+ @Override
+ public NativeWindowUpstream getParent() {
+ return upstreamWin;
+ }
+
+ @Override
+ public long getWindowHandle() {
+ if( null != glWindow ) {
+ return glWindow.getWindowHandle();
+ } else {
+ return 0;
+ }
+ }
+
+ @Override
+ public void display() {
+ if( null != glWindow ) {
+ glWindow.display();
+ }
+ }
+ };
+ }
+
+ @Override
+ public void init(Applet3Context ctx) {
+ if(DEBUG) {
+ System.err.println("JOGLNewtApplet1Run.init() START - "+currentThreadName());
+ }
+ this.ctx = ctx;
+ String glEventListenerClazzName=null;
+ int glSwapInterval=0;
+ boolean glDebug=false;
+ boolean glTrace=false;
+ boolean glNoDefaultKeyListener = false;
+ boolean glCloseable=false;
+
+ try {
+ glEventListenerClazzName = getParameter("gl_event_listener_class");
+ glSwapInterval = JOGLNewtAppletBase.str2Int(getParameter("gl_swap_interval"), glSwapInterval);
+ glDebug = JOGLNewtAppletBase.str2Bool(getParameter("gl_debug"), glDebug);
+ glTrace = JOGLNewtAppletBase.str2Bool(getParameter("gl_trace"), glTrace);
+ glNoDefaultKeyListener = JOGLNewtAppletBase.str2Bool(getParameter("gl_nodefaultkeyListener"), glNoDefaultKeyListener);
+ glCloseable = JOGLNewtAppletBase.str2Bool(getParameter("gl_closeable"), glCloseable);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if(null==glEventListenerClazzName) {
+ throw new RuntimeException("No applet parameter 'gl_event_listener_class'");
+ }
+ glStandalone = Integer.MAX_VALUE>glXd && Integer.MAX_VALUE>glYd && Integer.MAX_VALUE>glWidth && Integer.MAX_VALUE>glHeight;
+ if(DEBUG) {
+ System.err.println("JOGLNewtApplet1Run Configuration:");
+ System.err.println("glEventListenerClazzName: "+glEventListenerClazzName);
+ System.err.println("glSwapInterval: "+glSwapInterval);
+ System.err.println("glDebug: "+glDebug);
+ System.err.println("glTrace: "+glTrace);
+ System.err.println("glNoDefaultKeyListener: "+glNoDefaultKeyListener);
+ System.err.println("glCloseable: "+glCloseable);
+ }
+
+ base = new JOGLNewtAppletBase(glEventListenerClazzName,
+ glSwapInterval,
+ glNoDefaultKeyListener,
+ glCloseable,
+ glDebug,
+ glTrace);
+
+ try {
+ glWindow.setUpdateFPSFrames(FPSCounter.DEFAULT_FRAMES_PER_INTERVAL, System.err);
+ glWindow.setDefaultCloseOperation(glCloseable ? WindowClosingMode.DISPOSE_ON_CLOSE : WindowClosingMode.DO_NOTHING_ON_CLOSE);
+ base.init(glWindow);
+ } catch (Throwable t) {
+ throw new RuntimeException(t);
+ }
+ if(DEBUG) {
+ System.err.println("JOGLNewtApplet1Run.init() END - "+currentThreadName());
+ }
+ }
+
+ private static String currentThreadName() { return "["+Thread.currentThread().getName()+"]"; }
+
+ @Override
+ public void start() {
+ if(DEBUG) {
+ System.err.println("JOGLNewtApplet1Run.start() START (isVisible "+glWindow.isVisible()+") - "+currentThreadName());
+ }
+ if( glStandalone ) {
+ glWindow.setSize(glWidth, glHeight);
+ glWindow.setPosition(glXd, glYd);
+ glWindow.setVisible(true);
+ glWindow.requestFocus();
+ }
+ if(DEBUG) {
+ System.err.println("JOGLNewtApplet1Run start:");
+ System.err.println("GLWindow Pos: "+glWindow.getX()+"/"+glWindow.getY()+" rel, "+glWindow.getLocationOnScreen(null)+" screen");
+ System.err.println("GLWindow: "+glWindow);
+ }
+ base.start();
+ if(DEBUG) {
+ System.err.println("JOGLNewtApplet1Run.start() END - "+currentThreadName());
+ }
+ }
+
+ @Override
+ public void stop() {
+ if(DEBUG) {
+ System.err.println("JOGLNewtApplet1Run.stop() START - "+currentThreadName());
+ }
+ base.stop();
+ if(DEBUG) {
+ System.err.println("JOGLNewtApplet1Run.stop() END - "+currentThreadName());
+ }
+ }
+
+ @Override
+ public void destroy() {
+ if(DEBUG) {
+ System.err.println("JOGLNewtApplet1Run.destroy() START - "+currentThreadName());
+ }
+ glWindow.setVisible(false); // hide 1st
+ base.destroy(); // destroy glWindow unrecoverable
+ base=null;
+ glWindow=null;
+ if(DEBUG) {
+ System.err.println("JOGLNewtApplet1Run.destroy() END - "+currentThreadName());
+ }
+ }
+
+ @Override
+ public String getAppletInfo() {
+ return null;
+ }
+
+ @Override
+ public Locale getLocale() {
+ return null;
+ }
+
+ @Override
+ public String[][] getParameterInfo() {
+ return null;
+ }
+
+}
+
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java
index 2afa97327..bbe6b8527 100644
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtAppletBase.java
+++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java
@@ -25,7 +25,7 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-package com.jogamp.newt.awt.applet;
+package com.jogamp.newt.util.applet;
import java.lang.reflect.Field;
import java.security.AccessController;
@@ -74,7 +74,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
GLWindow glWindow = null;
Animator glAnimator=null;
boolean isValid = false;
- NativeWindow awtParent;
+ NativeWindow parentWin;
public JOGLNewtAppletBase(String glEventListenerClazzName,
int glSwapInterval,
@@ -216,14 +216,14 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
@Override
public void windowDestroyNotify(WindowEvent e) {
if( isValid() && WindowClosingMode.DO_NOTHING_ON_CLOSE == glWindow.getDefaultCloseOperation() &&
- null == glWindow.getParent() && null != awtParent && 0 != awtParent.getWindowHandle() )
+ null == glWindow.getParent() && null != parentWin && 0 != parentWin.getWindowHandle() )
{
// we may be called directly by the native EDT
new Thread(new Runnable() {
@Override
public void run() {
- if( glWindow.isNativeValid() && null != awtParent && 0 != awtParent.getWindowHandle() ) {
- glWindow.reparentWindow(awtParent, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE);
+ if( glWindow.isNativeValid() && null != parentWin && 0 != parentWin.getWindowHandle() ) {
+ glWindow.reparentWindow(parentWin, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE);
}
}
}).start();
@@ -244,7 +244,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
}
}
glAnimator.start();
- awtParent = glWindow.getParent();
+ parentWin = glWindow.getParent();
glWindow.addWindowListener(reparentHomeListener);
}
}
@@ -329,11 +329,11 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
public void run() {
glWindow.setAlwaysOnTop(!glWindow.isAlwaysOnTop());
} }.start();
- } else if(e.getKeyChar()=='r' && null!=awtParent) {
+ } else if(e.getKeyChar()=='r' && null!=parentWin) {
new Thread() {
public void run() {
if(null == glWindow.getParent()) {
- glWindow.reparentWindow(awtParent, -1, -1, 0 /* hints */);
+ glWindow.reparentWindow(parentWin, -1, -1, 0 /* hints */);
} else {
final InsetsImmutable insets = glWindow.getInsets();
final int x, y;
diff --git a/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java b/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java
new file mode 100644
index 000000000..90c8c3572
--- /dev/null
+++ b/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java
@@ -0,0 +1,212 @@
+package com.jogamp.newt.util.applet;
+
+import com.jogamp.plugin.applet.Applet3;
+import com.jogamp.plugin.applet.Applet3Context;
+import com.jogamp.plugin.ui.NativeWindowDownstream;
+import com.jogamp.plugin.ui.NativeWindowUpstream;
+
+import java.util.List;
+import java.util.Locale;
+
+import javax.media.opengl.GLProfile;
+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.util.VersionUtil;
+import com.jogamp.newt.NewtFactory;
+import com.jogamp.newt.Window;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.JoglVersion;
+
+public class VersionApplet3 implements Applet3 {
+
+ public static void main(String[] args) {
+ VersionApplet3 va = new VersionApplet3();
+
+ final NativeWindowDownstream nwc = va.createNativeWindow(null, new NativeWindowUpstream() {
+ @Override
+ public long getWindowHandle() {
+ return 0;
+ }
+ @Override
+ public int getWidth() {
+ return 64;
+ }
+ @Override
+ public int getHeight() {
+ return 64;
+ }
+ @Override
+ public String getDisplayConnection() {
+ return null; // default
+ }
+ @Override
+ public int getScreenIndex() {
+ return 0; // default
+ }
+ @Override
+ public void notifySurfaceUpdated(NativeWindowDownstream swappedWin) {
+ // NOP
+ }
+
+ });
+ va.init(null);
+ va.start();
+ va.stop();
+ va.destroy();
+ nwc.destroy();
+ }
+
+ GLWindow canvas;
+
+ @Override
+ public NativeWindowDownstream createNativeWindow(final Applet3Context ctx, final NativeWindowUpstream parentWin) {
+ final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ final Window w = NewtFactory.createWindow(parentWin.getDisplayConnection(), parentWin.getScreenIndex(), parentWin.getWindowHandle(), caps);
+ canvas = GLWindow.create(w);
+ canvas.setSize(parentWin.getWidth(), parentWin.getHeight());
+
+ return new NativeWindowDownstream() {
+ @Override
+ public void setVisible(boolean v) {
+ if( null != canvas ) {
+ canvas.setVisible(v);
+ }
+ }
+
+ @Override
+ public void setSize(int width, int height) {
+ if( null != canvas ) {
+ canvas.setSize(width, height);
+ }
+ }
+
+ @Override
+ public void requestFocus() {
+ if( null != canvas ) {
+ canvas.requestFocus();
+ }
+ }
+
+ @Override
+ public void destroy() {
+ if( null != canvas ) {
+ canvas.destroy();
+ }
+ }
+
+ @Override
+ public NativeWindowUpstream getParent() {
+ return parentWin;
+ }
+
+ @Override
+ public long getWindowHandle() {
+ if( null != canvas ) {
+ return canvas.getWindowHandle();
+ } else {
+ return 0;
+ }
+ }
+
+ @Override
+ public void display() {
+ if( null != canvas ) {
+ canvas.display();
+ }
+ }
+ };
+ }
+
+ @Override
+ public void init(Applet3Context ctx) {
+ System.err.println("VersionApplet: init() - begin");
+ canvas.addGLEventListener(new GLInfo());
+ System.err.println("VersionApplet: init() - end");
+ }
+
+ @Override
+ public void start() {
+ System.err.println("VersionApplet: start() - begin");
+
+ String s;
+
+ s = VersionUtil.getPlatformInfo().toString();
+ System.err.println(s);
+
+ s = GlueGenVersion.getInstance().toString();
+ System.err.println(s);
+
+ /*
+ s = NativeWindowVersion.getInstance().toString();
+ System.err.println(s);
+ */
+
+ s = JoglVersion.getInstance().toString();
+ System.err.println(s);
+
+ GLDrawableFactory factory = GLDrawableFactory.getFactory(canvas.getGLProfile());
+ List<GLCapabilitiesImmutable> availCaps = factory.getAvailableCapabilities(null);
+ for(int i=0; i<availCaps.size(); i++) {
+ s = availCaps.get(i).toString();
+ System.err.println(s);
+ }
+ canvas.display();
+ System.err.println("VersionApplet: start() - end");
+ }
+
+ @Override
+ public void stop() {
+ System.err.println("VersionApplet: stop() - begin");
+ canvas.setVisible(false);
+ System.err.println("VersionApplet: stop() - end");
+ }
+
+ @Override
+ public void destroy() {
+ System.err.println("VersionApplet: destroy() - start");
+ if(null!=canvas) {
+ canvas.destroy();
+ canvas = null;
+ }
+ System.err.println("VersionApplet: destroy() - end");
+ }
+
+ @Override
+ public String getAppletInfo() {
+ return null;
+ }
+
+ @Override
+ public Locale getLocale() {
+ return null;
+ }
+
+ @Override
+ public String[][] getParameterInfo() {
+ return null;
+ }
+
+ class GLInfo implements GLEventListener {
+ @Override
+ public void init(GLAutoDrawable drawable) {
+ GL gl = drawable.getGL();
+ String s = JoglVersion.getGLInfo(gl, null).toString();
+ System.err.println(s);
+ }
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ }
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ }
+ @Override
+ public void dispose(GLAutoDrawable drawable) {
+ }
+ }
+}