As of version 0113 all of this is redundant, as processing now exports multiple jar files itself, and created the correct .html file, so all you need to do is upload the directory as before.
| versions | 0111+ |
|---|---|
| contributors | johng |
| started on | 2006-03-28 22:15 |
Up until now, it has been almost impossible to use OpenGL in an applet on a website. Thankfully that has all changed recently, thanks to the fine work of the people who maintain JOGL and Sun, with their JSR-231 release.
With this new release, Sun have signed the OpenGL files, so that your Java plug-in will tell you that an applet using the OpenGL files is trustworthy, and can do nothing malicious.
This needs processing-0111 or later, this is essential as all previous versions would require extra self-signing steps.
Create your OpenGL sketch as usual, including the opengl library from the processing menus. Once you are happy with it, export the sketch as normal.
Now comes the manual parts.
You need to edit the index.html file which processing created. The directory with the files should have automaticly opened when you exported.
Open the index.html file with a text editor, or your HTML editor of choice.
You now need to change the following lines:
<applet code="MySketch" archive="MySketch.jar"
width="800" height="600" mayscript="true">
<param name="image" value="loading.gif">
<param name="boxmessage" value="Loading Processing software...">
<param name="boxbgcolor" value="#FFFFFF">
<!-- This is the message that shows up when people don't have
Java installed in their browser. Any HTML can go here
(i.e. if you wanted to include an image other links,
or an anti-Microsoft diatribe. -->
To view this content, you need to install Java from <A HREF="http://java.com">java.com</A>
</applet>
You only need to change the <applet…>line, and add 2 more lines.
<!-- This is the new <applet...> part -->
<applet code="com.sun.opengl.util.JOGLAppletLauncher"
archive="jogl.jar,MySketch.jar"
width="800" height="600" mayscript="true">
<!-- and now the 2 extra lines -->
<param name="subapplet.classname" VALUE="MySketch">
<param name="subapplet.displayname" VALUE="My Sketch called Foo">
<param name="image" value="loading.gif">
<param name="boxmessage" value="Loading Processing software...">
<param name="boxbgcolor" value="#FFFFFF">
<!-- This is the message that shows up when people don't have
Java installed in their browser. Any HTML can go here
(i.e. if you wanted to include an image other links,
or an anti-Microsoft diatribe. -->
To view this content, you need to install Java from <A HREF="http://java.com">java.com</A>
</applet>
The first change enables the special Applet Launcher code, that enables the applet to use OpenGL with the trusted jar files. The two other lines just tell the magic code what your sketchname is, so that it can run it once it's loaded and set up the OpenGL stuff.
Now, to publish the applet you only need a few of the files in the applet folder, and some processing ones. I suggest creating a new subdirectory in the applet directory, to marshall the files before uploading them.
In this new directory you need these files from the applet directory:
You'll also need to go to the processing-0111 directory, then look in libraries/opengl/library directory and copy the following files to the directory you created:
Once you have all these files together, you can upload them all together to your website, and it should work just fine.