JOGL Applet invokeAndWait Exception

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

JOGL Applet invokeAndWait Exception

William Bittle
I'm trying to test the deployment of my TestBed application as an applet and I get the following exception in the Console (I'm using Google Chrome, java 1.6.0_23 if this makes any difference):

Exception in thread "AWT-EventQueue-2" java.lang.Error: Cannot call invokeAndWait from the event dispatcher thread
        at java.awt.EventQueue.invokeAndWait(Unknown Source)
        at com.jogamp.nativewindow.impl.jawt.JAWTUtil.<clinit>(JAWTUtil.java:121)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.jogamp.common.util.ReflectionUtil.callMethod(ReflectionUtil.java:267)
        at javax.media.nativewindow.NativeWindowFactory.initSingleton(NativeWindowFactory.java:199)
        at javax.media.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1090)
        at javax.media.opengl.GLProfile.access$000(GLProfile.java:66)
        at javax.media.opengl.GLProfile$1.run(GLProfile.java:111)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:109)
        at javax.media.opengl.GLProfile.validateInitialization(GLProfile.java:1338)
        at javax.media.opengl.GLProfile.getProfileMap(GLProfile.java:1489)
        at javax.media.opengl.GLProfile.get(GLProfile.java:548)
        at javax.media.opengl.GLProfile.get(GLProfile.java:555)
        at org.dyn4j.game2d.testbed.AppletDriver.start(AppletDriver.java:72)
        at org.jdesktop.applet.util.JNLPAppletLauncher.startSubApplet(JNLPAppletLauncher.java:1991)
        at org.jdesktop.applet.util.JNLPAppletLauncher.access$200(JNLPAppletLauncher.java:661)
        at org.jdesktop.applet.util.JNLPAppletLauncher$5.run(JNLPAppletLauncher.java:1324)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

I'm using the following html file (the commented portion is such so I can test deployment for those who dont currently support the Applet JNLP):
<applet code="org.jdesktop.applet.util.JNLPAppletLauncher"
      width="800"
      height="600"
      archive="http://jogamp.org/deployment/util/applet-launcher.jar,
               http://jogamp.org/deployment/webstart/nativewindow.all.jar,
               http://jogamp.org/deployment/webstart/jogl.all.jar,
               http://jogamp.org/deployment/webstart/gluegen-rt.jar,
               http://jogamp.org/deployment/webstart/newt.all.jar,
               http://www.dyn4j.org/TestBed/latest/dyn4j.jar,
            http://www.dyn4j.org/TestBed/latest/dyn4j-TestBed.jar">
   
   
   
   
   
   
   
   
   
</applet>

With the last two parameters uncommented everything works great (I'm assuming because its ignoring everything but the last two parameters).

Code that might be relevant (AppletDriver class, removed comments for brevity):
public class AppletDriver extends JApplet {
        @Override
        public void start() {
                super.start();

                this.setFocusable(true);
                Dimension size = new Dimension(800, 600);
               
                GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2));
                caps.setDoubleBuffered(true);
                caps.setHardwareAccelerated(true);
               
                // this extends GLCanvas
                TestBed testbed = new TestBed(caps, this, size, TestBed.Mode.APPLET);
               
                this.add(testbed);
               
                if (this.isVisible()) {
                        this.requestFocus();
                }

                // starts the Animator
                testbed.start();
        }
}

You can test this at http://www.dyn4j.org/TestBed/latest/dyn4j-TestBed.html

Surely I'm doing something wrong here?
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Applet invokeAndWait Exception

William Bittle
Looks like the forum stripped the HTML code.  Just go to the link above and view the source.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Applet invokeAndWait Exception

William Bittle
I took a look at the Gears demo and moved my code to the init method to see if that would help.  It still does not work.  In addition, I attempted to run the Gears demo (applet loader only version http://jogamp.org/jogl-demos/www/applettest.html  ) and I get the same results.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Applet invokeAndWait Exception

Michael Bien
  Hi William,

maybe its a bug in the applet launcher. Have you tried to use a jnlp for
the applet instead of the loader?

btw your engine looks great!

regards,
michael

On 02/04/2011 09:16 PM, William Bittle [via jogamp] wrote:

> I took a look at the Gears demo and moved my code to the init method to see
> if that would help.  It still does not work.  In addition, I attempted to
> run the Gears demo (applet loader only version
> http://jogamp.org/jogl-demos/www/applettest.html  ) and I get the same
> results.
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://jogamp.762907.n3.nabble.com/JOGL-Applet-invokeAndWait-Exception-tp2425308p2426944.html
> To start a new topic under jogamp, email [hidden email]
> To unsubscribe from jogamp, visit
http://michael-bien.com/

Reply | Threaded
Open this post in threaded view
|

Re: JOGL Applet invokeAndWait Exception

Sven Gothel
Administrator
In reply to this post by William Bittle
On Friday, February 04, 2011 17:22:35 William Bittle [via jogamp] wrote:
>
> I'm trying to test the deployment of my TestBed application as an applet and
> I get the following exception in the Console (I'm using Google Chrome, java
> 1.6.0_23 if this makes any difference):

I have just run a simple 6u23 test with ff3/4 and got failures as well.

After some other bugfixes, I will definetly have a look at it,
thanks a lot for the heads up.

Will post an update soon (this weekend), since RC4 is on the way
and shall run applets for sure.


>
> You can test this at http://www.dyn4j.org/TestBed/latest/dyn4j-TestBed.html
>
> Surely I'm doing something wrong here?
>

Awesome, now we have 2 physics engines, the jbullet stuff (example in jogl-demos)
and yours. I haven't seen all the details (yet) - but great stuff, kudos.

JOCL impl. for those (physics engines) anybody ?

Cheers, Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Applet invokeAndWait Exception

Michael Bien
  On 02/05/2011 03:35 AM, Sven Gothel [via jogamp] wrote:
> JOCL impl. for those (physics engines) anybody ?
indeed. William, if you would like to give it a try and need any help
please let me know.

-michael

> Cheers, Sven
>
>
> _______________________________________________
> If you reply to this email, your message will be added to the discussion below:
> http://jogamp.762907.n3.nabble.com/JOGL-Applet-invokeAndWait-Exception-tp2425308p2428958.html
> To start a new topic under jogamp, email [hidden email]
> To unsubscribe from jogamp, visit
http://michael-bien.com/

Reply | Threaded
Open this post in threaded view
|

Re: JOGL Applet invokeAndWait Exception

William Bittle
Thanks for the reply.  Yeah the new JNLP applet configuration works great, I just wanted to test the fallback option.  I'll just go ahead and use the new method in the meantime.

Thank you very much for the comments.  The project isn't very visible right now but I hope that changes.  You are more the than welcome to reference the project.  I'm not really doing anything stellar with JOGL but I did use an FBO to render to texture and then both a Vertex/Fragment shader in GLSL for the blur effect on the "HUD".

As far as JOCL, I am interested to see if it can improve performance.  Bottlenecks are collision detection, continuous collision detection, and collision resolution.  I have played with some simple Java multithreading with inconclusive benefits.  Did you have anything specific in mind (Vector operations, Matrix solving, etc.)?

Reply | Threaded
Open this post in threaded view
|

Re: JOGL/JOCL in dyn4j

Michael Bien
  Hi William,

optimizing bottlenecks would be a start. The most difficult part however
is to find a way to parallelize them. For a proof of concept i would
recommend to pick the easiest tasks first :)

I didn't run many benchmarks yet but one of the first things i did with
jocl was to try to find out when the additional copy to GPU mem and back
pays of. E.g for simple sorting its already after about 30k elements
(http://jogamp.org/jocl/www/gpusort.png). The chances are high that you
may indeed be able to kill some bottlenecks with jocl.

In best case there would be no copy at all and the physics engine would
pass all the data directly to GL... but thats hard.

The nice thing about physics is that you always find a way to put more
particles into the scene :)

btw we just deployed a few webstart demos http://jogamp.org/jocl-demos/www/

-michael

On 02/05/2011 05:25 PM, William Bittle [via jogamp] wrote:

> Thanks for the reply.  Yeah the new JNLP applet configuration works great, I
> just wanted to test the fallback option.  I'll just go ahead and use the new
> method in the meantime.
>
> Thank you very much for the comments.  The project isn't very visible right
> now but I hope that changes.  You are more the than welcome to reference the
> project.  I'm not really doing anything stellar with JOGL but I did use an
> FBO to render to texture and then both a Vertex/Fragment shader in GLSL for
> the blur effect on the "HUD".
>
> As far as JOCL, I am interested to see if it can improve performance.
> Bottlenecks are collision detection, continuous collision detection, and
> collision resolution.  I have played with some simple Java multithreading
> with inconclusive benefits.  Did you have anything specific in mind (Vector
> operations, Matrix solving, etc.)?
>
--
http://michael-bien.com/

Reply | Threaded
Open this post in threaded view
|

Re: JOGL Applet invokeAndWait Exception

Michael Bien
In reply to this post by William Bittle
  On 02/05/2011 05:25 PM, William Bittle [via jogamp] wrote:
> Thanks for the reply.  Yeah the new JNLP applet configuration works great, I
> just wanted to test the fallback option.  I'll just go ahead and use the new
> method in the meantime.
>
> Thank you very much for the comments.  The project isn't very visible right
> now but I hope that changes.  You are more the than welcome to reference the
> project.
I added your news feed to our blog aggregator:
http://jogamp.org/blog/

regards,
michael

--
http://michael-bien.com/

Reply | Threaded
Open this post in threaded view
|

Re: JOGL Applet invokeAndWait Exception

William Bittle
Wow man, thanks a lot! I added the respective links to jogamp as well on the dyn4j project page, my blog and google code repository.  Those JOCL demos look awesome.  When I was converting from Java2D to JOGL I noticed that there was a JOCL binding and was really interested.  I'll see if I can get some time to create some small apps (or maybe just examine the sorting app) with it then move to integration with dyn4j.
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Applet invokeAndWait Exception

Sven Gothel
Administrator
On Saturday, February 05, 2011 21:07:41 William Bittle [via jogamp] wrote:
>
> Wow man, thanks a lot! I added the respective links to jogamp as well on the
> dyn4j project page, my blog and google code repository.  Those JOCL demos
> look awesome.  When I was converting from Java2D to JOGL I noticed that
> there was a JOCL binding and was really interested.  I'll see if I can get
> some time to create some small apps (or maybe just examine the sorting app)
> with it then move to integration with dyn4j.

It would be awesome if you could keep
the data flow in mind, ie where you utilize JOCL for data processing
and where the result could be a VBO for example, all within GPU memory.

The benefit of not swapping the buffers through hosts are obvious,
eg OpenMax provides the same for video decoding -> GL texture
without any copy operation via host memory.

Great stuff, thank you.

Cheers, Sven
Reply | Threaded
Open this post in threaded view
|

Re: JOGL Applet invokeAndWait Exception

Michael Bien
In reply to this post by William Bittle
  no problem William :) thanks for dyn4j,

HelloJOCL* and the gamma correction example from the jocl-demos
repository are a good entry point. If you don't know OpenCL yet i
recommend reading chapter 3 of the opencl spec first. (there are also a
few other resources linked from the jocl page, including videos)

* http://michael-bien.com/mbien/entry/java_binding_for_the_opencl

-michael

On 02/05/2011 09:07 PM, William Bittle [via jogamp] wrote:
> Wow man, thanks a lot! I added the respective links to jogamp as well on the
> dyn4j project page, my blog and google code repository.  Those JOCL demos
> look awesome.  When I was converting from Java2D to JOGL I noticed that
> there was a JOCL binding and was really interested.  I'll see if I can get
> some time to create some small apps (or maybe just examine the sorting app)
> with it then move to integration with dyn4j.

--
http://michael-bien.com/