JOGL applet

I’m trying to get a JOGL applet to work (not for Imperii) but is having some problems.

I am having the exact same problem as mastershadow described in this thread: 

http://www.jmonkeyengine.com/jmeforum/index.php?topic=9697.0

I get things rendered to the screen, but no updates, unless I force the window to be repainted (resize or move).



Has anyone successfully got a JOGL applet to work? What did you do? (LWJGL works fine)



I only changed these lines in the SimpleJMEApplet.jar file:


### Eclipse Workspace Patch 1.0
#P jME2
Index: src/com/jmex/awt/applet/SimpleJMEApplet.java
===================================================================
--- src/com/jmex/awt/applet/SimpleJMEApplet.java   (revision 4287)
+++ src/com/jmex/awt/applet/SimpleJMEApplet.java   (working copy)
@@ -67,8 +67,10 @@
 import com.jme.scene.state.LightState;
 import com.jme.scene.state.WireframeState;
 import com.jme.system.DisplaySystem;
+import com.jme.system.SystemProvider;
 import com.jme.system.canvas.JMECanvas;
 import com.jme.system.canvas.SimpleCanvasImpl;
+import com.jme.system.jogl.JOGLSystemProvider;
 import com.jme.util.Debug;
 import com.jme.util.GameTaskQueue;
 import com.jme.util.GameTaskQueueManager;
@@ -81,6 +83,7 @@
 import com.jme.util.stat.graph.TabledLabelGrapher;
 import com.jmex.awt.input.AWTKeyInput;
 import com.jmex.awt.input.AWTMouseInput;
+import com.jmex.awt.jogl.JOGLAWTCanvasConstructor;
 import com.jmex.awt.lwjgl.LWJGLAWTCanvasConstructor;
 
 public class SimpleJMEApplet extends Applet {
@@ -132,14 +135,15 @@
 
             TextureManager.clearCache();
             Text.resetFontTexture();
-            DisplaySystem display = DisplaySystem.getDisplaySystem();
-            display.registerCanvasConstructor("AWT", LWJGLAWTCanvasConstructor.class);
+//            DisplaySystem display = DisplaySystem.getDisplaySystem();
+//            display.registerCanvasConstructor("AWT", LWJGLAWTCanvasConstructor.class);
+            DisplaySystem display = DisplaySystem.getDisplaySystem(JOGLSystemProvider.SYSTEM_IDENTIFIER);
+            display.registerCanvasConstructor("AWT", JOGLAWTCanvasConstructor.class);
             display.setMinDepthBits( depthBits );
             display.setMinStencilBits( stencilBits );

             /**



After that change, the applet demos in jmetest.awt.applet do no longer update. (as with my applet)

OK, I got the update working but the mouse input does not work. I added the following in the init method in JOGLAWTCanvas.java:


Animator anim = new Animator(this);
anim.start();



So, I still wonder if anyone has walked this path before and know what to do to get it working properly?
Haladria said:

OK, I got the update working but the mouse input does not work. I added the following in the init method in JOGLAWTCanvas.java:

Animator anim = new Animator(this);
anim.start();



So, I still wonder if anyone has walked this path before and know what to do to get it working properly?

I don't use applets but I use JME 2 with JOGL. Using an animator is already done in JMEAppletTest:
animator = new Animator((GLAutoDrawable) jmeCanvas);

The JOGL renderer has not been refactored, I need an animator too even in a standalone application. Maybe it would be fine to put it in JOGLAWTCanvas.

The AWT input handling in JME 2 is very buggy especially under Windows, I have paid someone to fix it (as I don't have time to do it myself), we should have a fix before June.

It is nice to see that some other people are interested in using JOGL with JME, I'm not alone  :D

Edit.: you were right, watch JMEJOGLAWTTest:
// FIXME Encapsulate this within the canvas in some fashion?
Animator animator = new Animator((GLAutoDrawable) jmeCanvas);

Would you like me to submit such a modification or can you do it by yourself?

Thanks for responding, I was just gonna give up.



I have missed that test, I only looked in the jmetest.awt.applet folder.



I'm interested in JOGL since I want to avoid this security dialog box (or at least show one from sun). I read that it should be possible with JOGL, am I correct? Unfortunately I will probably need jme-physics as well and that requires additional dll's which might need the jar's too be signed anyway…



Will you contribute to jme the changes to the input system when it's done?

Haladria said:

Thanks for responding, I was just gonna give up.

Don't give up. I don't even give up when nobody answers my questions here and it happens sometimes :(

Haladria said:

I have missed that test, I only looked in the jmetest.awt.applet folder.

I'm interested in JOGL since I want to avoid this security dialog box (or at least show one from sun). I read that it should be possible with JOGL, am I correct? Unfortunately I will probably need jme-physics as well and that requires additional dll's which might need the jar's too be signed anyway...

Will you contribute to jme the changes to the input system when it's done?

I use directly the extension of JOGL signed by Sun by pointing directing to Sun's site :D Then JOGL is signed with Sun's certification. You can sign the JAR of JME 2, JME-Physics, etc... with the same certificate (and you should do it). Of course, I will submit the changes of the AWT input system when it is done.

Please don't think only about deploying DLL, think about non-Windows users, it is not difficult to deploy some .so and .jnilib files.
Please don't think only about deploying DLL, think about non-Windows users, it is not difficult to deploy some .so and .jnilib files.


Since I only have a Windows computer, I cannot test on other platforms and that forces me to first develop for Windows and then later on maybe add support for the others.

I at least got the LWJGL applet to work now so I will use it until summer.

Haladria said:

Please don't think only about deploying DLL, think about non-Windows users, it is not difficult to deploy some .so and .jnilib files.


Since I only have a Windows computer, I cannot test on other platforms and that forces me to first develop for Windows and then later on maybe add support for the others.

I at least got the LWJGL applet to work now so I will use it until summer.



I'm only under Linux and my game works fine under Mac OS (>10.5), Solaris and Windows too. It is not difficult to add some lines in a JNLP file to load the proper native libraries even though you cannot test it by yourself.