Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

3d applet gets stuck

Thread view: 
Thorsten Kiefer - 23 Mar 2008 22:33 GMT
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
Andrew Thompson - 24 Mar 2008 04:00 GMT
...
> 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 :
>
> -----------------------------------------------------------------------
> <html>
...
>         <applet code="org.jdesktop.applet.util.JNLPAppletLauncher"

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.

--
Andrew T.
PhySci.org
Kevin McMurtrie - 24 Mar 2008 04:40 GMT
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.

Signature

I don't read Google's spam.  Reply with another service.

Thorsten Kiefer - 24 Mar 2008 10:03 GMT
> It's working in my browser:
>  OmniWeb 5.7b1
[quoted text clipped - 3 lines]
> 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 !!


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.