diff options
author | Sven Gothel <[email protected]> | 2010-09-23 18:58:03 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-09-23 18:58:03 +0200 |
commit | 4bb9fed247d8151b317c32dd1f8d7bde03a1bcb6 (patch) | |
tree | dd097af09126ce7d7e7b3bf3ff0cd3132cbd80b9 /src/demos/applets/JOGLNewtApplet1Run.java | |
parent | 35da0bfcb126c8b296a64274dcf5b757daa723d3 (diff) |
Sync with JOGL: 1c02f0eeb539ff5de7259b822893ab63a9cc3ab0
Diffstat (limited to 'src/demos/applets/JOGLNewtApplet1Run.java')
-rwxr-xr-x | src/demos/applets/JOGLNewtApplet1Run.java | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/demos/applets/JOGLNewtApplet1Run.java b/src/demos/applets/JOGLNewtApplet1Run.java index 0490120..df42da6 100755 --- a/src/demos/applets/JOGLNewtApplet1Run.java +++ b/src/demos/applets/JOGLNewtApplet1Run.java @@ -7,15 +7,17 @@ import java.awt.event.MouseMotionListener; import java.awt.event.KeyListener; import javax.media.opengl.*; -import javax.media.nativewindow.*; -import com.jogamp.newt.*; +import com.jogamp.newt.awt.NewtCanvasAWT; +import com.jogamp.newt.opengl.GLWindow; +import java.awt.BorderLayout; /** Shows how to deploy an applet using JOGL. This demo must be referenced from a web page via an <applet> tag. */ public class JOGLNewtApplet1Run extends Applet { + GLWindow glWindow; + NewtCanvasAWT newtCanvasAWT; JOGLNewtAppletBase base; - Window nWindow = null; public void init() { if(!(this instanceof Container)) { @@ -48,15 +50,11 @@ public class JOGLNewtApplet1Run extends Applet { try { GLCapabilities caps = new GLCapabilities(GLProfile.get(glProfileName)); - Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display - Screen nScreen = NewtFactory.createScreen(NativeWindowFactory.TYPE_AWT, nDisplay, 0); // screen 0 - nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, new Object[] { container }, - nScreen, caps, true /* undecorated */); - // nWindow.setPosition(x, y); - // nWindow.setSize(container.getWidth(), container.getHeight()); - if(null!=nWindow) { - base.init(nWindow); - } + glWindow = GLWindow.create(caps); + newtCanvasAWT = new NewtCanvasAWT(glWindow); + container.setLayout(new BorderLayout()); + container.add(newtCanvasAWT, BorderLayout.CENTER); + base.init(glWindow); if(base.isValid()) { GLEventListener glEventListener = base.getGLEventListener(); @@ -84,12 +82,11 @@ public class JOGLNewtApplet1Run extends Applet { } public void destroy() { - base.destroy(false); // no dispose events + glWindow.setVisible(false); // hide 1st + glWindow.reparentWindow(null); // get out of newtCanvasAWT + this.remove(newtCanvasAWT); // remove newtCanvasAWT + base.destroy(true); // destroy glWindow unrecoverable base=null; - if(null!=nWindow) { - nWindow.destroy(); - nWindow=null; - } } } |