So this may be a newbie question but I’m having a little trouble with JOGL Applets and deployment. I’ve read over a bunch of other posts and some seem dated and I just don’t get others. If someone is willing to help and answer my dumb questions I’d appreciate it.
To start I’m able to get JOGL applets to work in eclipse. Here is a basic class that I’m trying to deploy.
import java.applet.Applet;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.FPSAnimator;
public class AppletLauncherJogl extends Applet implements GLEventListener {
/**
*
*/
private static final long serialVersionUID = -5349107458641586294L;
public void init() {
GLProfile glp = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glp);
GLCanvas canvas = new GLCanvas(caps);
canvas.setSize(400, 400);
canvas.setVisible(true);
add(canvas);
canvas.addGLEventListener(new AppletLauncherJogl());
this.start();
Animator animator = new FPSAnimator(canvas, 60);
animator.add(canvas);
animator.start();
}
@Override
public void display(GLAutoDrawable drawable) {
update();
render(drawable);
}
@Override
public void dispose(GLAutoDrawable drawable) {
}
@Override
public void init(GLAutoDrawable drawable) {
}
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
}
private void update() {
}
private void render(GLAutoDrawable drawable) {
GL2 gl = drawable.getGL().getGL2();
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glBegin(GL.GL_TRIANGLES);
gl.glColor3f(1, 0, 0);
gl.glVertex3d(0, 0, 0);
gl.glVertex3d(0, 0.5, 0);
gl.glVertex3d(0.5, 0, 0);
gl.glEnd();
}
}
As far as deployment I’ll start by saying I’ve been trying a lot.
This works
https://jogl-demos.dev.java.net/applettest-jnlp.html
This doesn’t work
https://jogl-demos.dev.java.net/applettest.html
From what I gather the best way to do this is to use the JNLPAppletLauncher
https://applet-launcher.dev.java.net/
So I exported the project from Eclipse to get a jar (File->export: Java->Jar File)
And they tried to use this html
<applet code="org.jdesktop.applet.util.JNLPAppletLauncher"
width=600
height=400
archive="http://download.java.net/media/applet-launcher/applet-launcher.jar,
http://download.java.net/media/jogl/jsr-231-2.x-webstart/nativewindow.all.jar,
http://download.java.net/media/jogl/jsr-231-2.x-webstart/jogl.all.jar,
http://download.java.net/media/gluegen/webstart-2.x/gluegen-rt.jar,
MyURL/AppletLauncherJogl.jar">
<param name="codebase_lookup" value="false">
<param name="subapplet.classname" value="AppletLauncherJogl">
<param name="subapplet.displayname" value="AppletLauncherJogl">
<param name="noddraw.check" value="true">
<param name="progressbar" value="true">
<param name="jnlpNumExtensions" value="1">
<param name="jnlpExtension1"
value="http://download.java.net/media/jogl/jsr-231-2.x-webstart/jogl-core.jnlp">
<param name="java_arguments" value="-Dsun.java2d.noddraw=true">
<param name="jnlp_href" value="MyURL/AppletLauncherJogl.jnlp">
</applet>
With this JNLP file
<jnlp href="MyURL/AppletLauncherJogl.jnlp">
m<?xml version="1.0" encoding="utf-8"?>
<information>
<title>Title Stuff</title>
<vendor>Made by Me</vendor>
<homepage href="MyURL/"/>
<description>AppletLauncherJogl</description>
<description kind="short">It Does stuff</description>
<offline-allowed/>
</information>
<resources>
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.6+"/>
<property name="sun.java2d.noddraw" value="true"/>
<jar href="MyURL/AppletLauncherJogl.jar" main="true"/>
<extension name="jogl-all-awt" href="http://download.java.net/media/jogl/jsr-231-2.x-webstart/jogl-all-awt.jnlp" />
</resources>
<applet-desc
name="AppletLauncherJogl"
main-class="AppletLauncherJogl"
width="600"
height="400">
</applet-desc>
</jnlp>
When this runs I just get a blank window. I have my .jar and .jnlp file in the main directory of my webpage. I’ve tired many browsers WinExplore/Chrome/Firefox on in Win7.
If anyone sees any errors or can help me out I’d really appreciate it. I normally do OpenGL games in c++ but I made some neat learning tools that I’d like to share online. Thanks.