Re: Offscreen rendering of 3D display images

Hello Leah,

I'm not sure if your question has been aswered, so I'll try to answer it now.

In order to call DisplayImpl.getImage(), you will have to call it from a
separate thread.

For example:

// Create the thread that will capture the image.
Thread thread = new Thread(new CaptureImageThread());

// Run the thread.

* This thread will capture the visad image.
public class CaptureImageThread implements Runnable
 public void run()
     // Capture image.
     boolean wait = true;
BufferedImage image = display.getImage(wait); }

PS. Your email mentioned offscreen rendering.  I have not been
able to get this to work with offscreen rendering on my machine,
but have seen it work on another machine...  I tried it again now,
and as you have experienced, my machine seems to lock up.  I am
also running Linux, but managed to kill the java program with
a "Ctrl-Z" to put it in the background, and then a "kill -9 %1"
command to kill the process.  This could be a threading problem...

Hope this helps,
Jim Koutsovasilis
Bureau of Meteorology

Leah Heiss wrote:

Ok.  I gave up on the capture of my DisplayImplJ3D and am now calling
getImage() on a DisplayImplJ2D.  The image capture is working, but the
image isn't "complete" when getImage() is called.  The code hasn't added
the RGB map or a couple of my IsoContour maps.

I tried calling display.waitForTasks() to allow the display time to catch
up before calling display.getImage( true ).  No Dice.

I also tried waiting for all my TRANSFORM_DONE DisplayEvents to complete
before calling getImage(), but that isn't working either.  One suggestion
given in the mailing list is to call display.disableAction() before
mucking around with the display and then calling display.enableAction().
The mailing list entry indicated that this would then cause just ONE
TRANSFORM_DONE DisplayEvent to be triggered.  That doesn't seem to be true.

Any suggestions?


On Mon, 28 Jul 2003, Leah Heiss wrote:

Hello visad-list

I'm having problems grabbing an offscreen rendering from a
DisplayImplJ3D using the getImage() method.  Every time I call getImage(),
I'm logged out of my Linux box.

This is annoying, frustrating and greatly slowing down my development process.
Has anyone else had this problem?  I'm not sure if the problem is related to
the code I'm using/writing or my window manager or something else.  Do any of
you any suggestions for me?



  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: