We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Processing's OpenGL dependencies using JNLP
Page Index Toggle Pages: 1
Processing's OpenGL dependencies using JNLP (Read 1540 times)
Processing's OpenGL dependencies using JNLP
Apr 7th, 2010, 5:48am
 
Hi,
I'm using Processing in a stand-alone application, based on Firefox.
I'm doing all my GUI in HTML/CSS/JavaScript, and the visualization using Processing. Thus as a developer I have full control over the html/browser/java version and configuration in the client app (I took example on processing to bundle the JRE with my app Wink )

I'm using JNLP to embed the applet in the html page.

Actually, it works great with P2D! (no dependency issue, no error when talking with javascript, no performance issue, it runs smooth, fullscreen, reactive etc..)

But I still have problems with OpenGL, which I would like to use for performance reasons (I did various benchmarks with Netbeans IDE, which is great to develop with Processing, and primitive drawing time seems to takes a lot)

This happens when I substitute P2D with OPENGL in the screen(...) method.

Quote:
basic: JNLP2ClassLoader.getPermissions() X
basic: JNLP2ClassLoader.findClass: javax.media.opengl.glu.GLU: try again ..
java.lang.NoClassDefFoundError: javax/media/opengl/glu/GLU
     at processing.opengl.PGraphicsOpenGL.<init>(Unknown Source)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorI
mpl.java:39)
     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorA
ccessorImpl.java:27)
     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
     at processing.core.PApplet.makeGraphics(Unknown Source)
     at processing.core.PApplet.size(Unknown Source)
     at processing.core.PApplet.size(Unknown Source)
     at myapp.Main.setup(Main.java:216)
     at processing.core.PApplet.handleDraw(Unknown Source)
     at processing.core.PApplet.run(Unknown Source)
     at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.glu.GLU
     at sun.plugin2.applet.Plugin2ClassLoader$2.run(Plugin2ClassLoader.java:679)
     at java.security.AccessController.doPrivileged(Native Method)
     at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Plugin2ClassLoader.java:63
3)
     at sun.plugin2.applet.JNLP2ClassLoader.findClass(JNLP2ClassLoader.java:242)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
     ... 12 more
Exception in thread "Animation Thread" java.lang.RuntimeException: javax/media/opengl/glu/GLU
     at processing.core.PApplet.makeGraphics(Unknown Source)
     at processing.core.PApplet.size(Unknown Source)
     at processing.core.PApplet.size(Unknown Source)
     at myapp.Main.setup(Main.java:216)
     at processing.core.PApplet.handleDraw(Unknown Source)
     at processing.core.PApplet.run(Unknown Source)
     at java.lang.Thread.run(Thread.java:619)


Here is how I declare the Processing applet in my HTML code :
Quote:
<applet id="myapp" name="myapp" code="Ignored" width="1024" height="768">
   <param name="jnlp_href" value="myapp.jnlp">
</applet>

And here is the content of the myapp.jnlp, to cover the full dependencies:

Quote:
<?xml version="1.0" encoding="utf-8"?>
<jnlp>
 <information>
   <title>myapp Applet</title>
   <vendor></vendor>
   <description kind="short">A simple applet.</description>
   <offline-allowed/>
   <shortcut online="false">
     <desktop />
   </shortcut>
   <!--<icon href="loading/2.jpg"/>-->
   <icon kind="splash" href="loading.gif"/>
 </information>
 <resources>
   <j2se version="1.6+" initial-heap-size="128m" max-heap-size="512m" />
   <jar href="myapp.jar" main="true" />
   <extension name="opengl" href="opengl.jnlp" />
   <extension name="jogl" href="jogl.jnlp" />
   <extension name="core" href="core.jnlp" />
   <extension name="pdf" href="pdf.jnlp" />
   <extension name="itext" href="itext.jnlp" />
 </resources>
 <applet-desc name="myapp" main-class="myapp.Main" width="1024" height="768">
    <param name="jogl.silent.noddraw.check" value="true"/>
 </applet-desc>
</jnlp>

I had to put each jar in it's own jnlp to resolve some deployment bugs (mix of signed and unsigned jars).

jogl.jnlp is a little special : I downloaded all the jars and jnlp from the official sun websites, and edited this jnlp to replace absolute url's by relative one (so it use my own local files, since I'm packaging an offline application, after all), and only once it was done, the applet could be loaded, so it looks like it "should" works (but still, only in P2D mode. if I put OPENGL flag, it raise the exception).

But maybe there is something I missed? Huh
I'm using the Java Console in full debug mode, to trace every single step of the applet initialization, jar loading and so on, but couldn't find a clue. I wonder if I should post it here too ? (it's a big log file)

Julian
Page Index Toggle Pages: 1