Try
 

     public static void main(String argv[]) {

       Devicetest dd =3D new Devicetest();

>>>    System.exit(0);

     }

 

That should stop all the threads and exit your app. You may also try to see what happens if you invoke Canvas3D.stopRenderer(). If you are lucky, that will stop all the background threads and close the app. If you're not, then use System.exit(0).

 

Cheers,

 

Florin

-----Urspr�ngliche Nachricht-----
Von: Weisheng [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 11. Juni 2003 15:29
An: [EMAIL PROTECTED]
Betreff: [JAVA3D] Off screen rendering hangs, though the rendering result is perfect.

 

Hi,

I am trying to rendering the 3d view into the image file without any GUI. If I do not extend the program from an AWT or Swing component, the program will not exit after processing (so, holds the memory. The rendering result is perfect). =20 Does any one know how to deal with this?

 

Here is the sample code (if you run it in command line, you will see that it will hangs there forever):

 

public class Devicetest{

   =20

    /** Creates a new instance of Devicetest */

    public Devicetest() {

         GraphicsConfigTemplate3D template =3D new GraphicsConfigTemplate3D();

      =20

        GraphicsEnvironment env =3D GraphicsEnvironment.getLocalGraphicsEnvironment();

        GraphicsDevice dev =3D env.getDefaultScreenDevice();

        GraphicsConfiguration gc =3D dev.getBestConfiguration(template);

         //...

        System.out.println(gc + " " + "End");

        =20

    }

     public static void main(String argv[]) {

       Devicetest dd =3D new Devicetest();

     }

}

 

However, the following works (but extends from Applet):

 

public class Devicetest extends Applet{

   =20

    /** Creates a new instance of Devicetest */

    public Devicetest() {

         GraphicsConfigTemplate3D template =3D new GraphicsConfigTemplate3D();

      =20

        GraphicsEnvironment env =3D GraphicsEnvironment.getLocalGraphicsEnvironment();

        GraphicsDevice dev =3D env.getDefaultScreenDevice();

        GraphicsConfiguration gc =3D dev.getBestConfiguration(template);

        Canvas3D canvas =3D new Canvas3D(gc, true);

       //...

        System.out.println(gc + " " + "End");

        =20

    }

     public static void main(String argv[]) {

       Frame frame =3D new MainFrame(new Devicetest(), 256, 256);

     }

}

 

 

Weisheng

 

Reply via email to