3d applet gets stuck

T

Thorsten Kiefer

Hi,
my applet runs nicely as stand alone application,
but when I start it in a browser, the VM gets stuck
consuming 100% CPU. Here is the code :

-----------------------------------------------------------------------
<html>
<head>
</head>
<body>
<applet code="org.jdesktop.applet.util.JNLPAppletLauncher"
width=640
height=480
archive="test3d2.jar,
http://download.java.net/media/applet-launcher/applet-launcher.jar,
http://download.java.net/media/java3d/webstart/release/j3d/latest/j3dcore.jar,
http://download.java.net/media/java3d/webstart/release/j3d/latest/j3dutils.jar,
http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/
jogl.jar,
http://download.java.net/media/gluegen/webstart/gluegen-rt.jar,
http://download.java.net/media/java3d/webstart/release/vecmath/latest/
vecmath.jar">
<param name="codebase_lookup" value="false">
<param name="subapplet.classname"
value="test3d2.MainApplet">
<param name="subapplet.displayname"
value="My Java 3D Applet">
<param name="jnlpNumExtensions" value="1">
<param name="jnlpExtension1"
value="http://download.java.net/media/java3d/webstart/release/
java3d-latest.jnlp">
<param name="progressbar" value="true">
<param name="noddraw.check" value="true">
</applet>
</body>
</html>
--------------------------------------------------------------------------

package test3d2;

import com.sun.j3d.utils.geometry.ColorCube;
import com.sun.j3d.utils.universe.SimpleUniverse;
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.GraphicsConfiguration;
import javax.media.j3d.Alpha;
import javax.media.j3d.BoundingSphere;
import javax.media.j3d.BranchGroup;
import javax.media.j3d.Canvas3D;
import javax.media.j3d.Node;
import javax.media.j3d.RotationInterpolator;
import javax.media.j3d.Transform3D;
import javax.media.j3d.TransformGroup;


/**
*
* @author thorsten
*/
public class MainApplet extends Applet {

public void init() {
GraphicsConfiguration graphicsConfig =
SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(graphicsConfig);
setLayout(new BorderLayout());
add(canvas,BorderLayout.CENTER);

BranchGroup scene = createSceneGraph();
scene.compile();

SimpleUniverse su = new SimpleUniverse(canvas);
su.getViewingPlatform().setNominalViewingTransform();
su.addBranchGraph(scene);
}

public void start() {

}

public void stop() {

}

public void destroy() {

}

public BranchGroup createSceneGraph(){
Transform3D tr = new Transform3D();
tr.rotX(Math.PI/4.0);

BranchGroup root = new BranchGroup();
TransformGroup tg1 = new TransformGroup(tr);
TransformGroup tg2 = new TransformGroup();
tg2.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);

Node n = new ColorCube(0.4);
Alpha rotAlpha = new Alpha(-1,4000);
RotationInterpolator rotator = new
RotationInterpolator(rotAlpha,tg2);
BoundingSphere bounds = new BoundingSphere();

rotator.setSchedulingBounds(bounds);


tg1.addChild(tg2);
tg2.addChild(n);
tg2.addChild(rotator);
root.addChild(tg1);
return root;
}
}

Best regards
Thorsten
 
A

Andrew Thompson

my applet runs nicely as stand alone application,

That is an odd comment, since applets usually are
embedded in web pages (IE, not a 'stand-alone' app.),
or launched using web start (which is ..in some respects
a 'stand-alone' application).
but when I start it in a browser, the VM gets stuck
consuming 100% CPU. Here is the code :

U-turns are not permitted, on the Path to Enlightenment.

You seem to be on your way to a webstart based solution,
yet are still trying to embed this 3D rendering in a web
page.

Webstart applications and applets DO NOT GET EMBEDDED
IN A WEB PAGE. I believe I have expressed that to you
before, but perhaps if I say it louder this time, you
might hear me.
 
K

Kevin McMurtrie

It's working in my browser:
OmniWeb 5.7b1
MacOS 10.5.2
Java 1.5.0_13-119

It did ask for manual digital certificate verification. I know that
deadlocks a lot of browsers.
 
T

Thorsten Kiefer

Kevin said:
It's working in my browser:
OmniWeb 5.7b1
MacOS 10.5.2
Java 1.5.0_13-119

It did ask for manual digital certificate verification. I know that
deadlocks a lot of browsers.

Now it works in my browser, too.
I just removed all certificates.

Thanks !!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top