System.exit(0) works, but it will exit
from all system.� So it is not the choice if I want to continue with other app.
Canvas3D.stopRenderer() will throw
exception as “Illegal operation in off-screen mode”
If I changed the line
GraphicsConfiguration gc =3D dev.getBestConfiguration(template);
To
GraphicsConfiguration gc =3D dev.defaultConfiguration();
The program will exit.
So, I guess it is something that relates
to the implementation GraphicsConfigTemplate3D’s getBestConfiguration.
Where can we find the source code for
java3D?
However, any suggestion to solve this
problem?
Weisheng
-----Original Message-----
From: Florin Herinean
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, June
11, 2003 8:46 AM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] AW: [JAVA3D] Off
screen rendering hangs, though the rendering res ult is perfect.
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