Re: Problem with off-screen render

Hi Lak,

On Fri, 27 Aug 2004, Valliappa Lakshmanan wrote:

> Thanks, Ugo. I was not aware that you could specify a headless
> environment that way.
> I think this is the right way to go, because ultimately, I want to
> create images
> using VisAD within a servlet, and servlets are headless.
>
> I added -Djava.awt.headless=true to the invocation of the java VM
> when I ran my test program.
> I now get a InitializerException thrown from DisplayImplJ3D.initialize()
> because
> VisADConfig.makeConfig calls getDefaultScreenDevice() which throws
> a java.awt.HeadlessException.
> I'm thinking that:
>     (a) if I'm creating an offscreen DisplayImplJ3D, it should not be
> asking for a default screen device.
> or (b) DisplayImplJ3D.initialize() should gracefully handle a headless case.

Good idea. However, the VisADCanvasJ3D constructor needs a
non-null GraphicsConfiguration to pass as an argument to
the super() constructor for its parent Canvas3D class. I
took a quick look at the GraphicsConfiguration, GraphicsDevice
and GraphicsEnvironment JavaDocs but couldn't see an obvious
way to construct a GraphicsConfiguration without a GraphicsDevice.
If you or someone else can suggest a way, we can catch the
java.awt.HeadlessException in VisADCanvasJ3D.makeConfig() and
use your alternative. There is hopefully an easy way to do this
that my quick look missed.

Thanks,
Bill