Re: Offscreen rendering of 3D display images

Hello,

Leah Heiss wrote:

Jim

Thanks for the advice.  Putting the image capturing into it's own thread
has helped alot.  And the offscreen rendering is working...mostly.

I'm still not getting all the info on my plots before the capture.
I'm missing a couple IsoContour maps and my axis labels.  Also, my
RGB colors are way off.  The background is a bright green (my code is
setting it to blue) and the color gradation is backwards (blue indicates
high values, red low -- should be blue = low values, red = high values).

One other interesting tidbit...  I can open the created jpg's with Gimp,
but Mozilla won't open them saying "File ... cannot be displayed, because
it contains errors".  So, Gimp likes the files but Mozilla doesn't.
Strange.
Just a note:

I've seen that happen under Windows 2000, JDK 1.3 and Java3D 1.2. Actually, I had a lot of problems with off-screen rendering and took some time (for Bill ;-) to get it working. Later, checking the generated images I noticed that some programs could read the images, though they had this color anomaly you described.

Unfortunately I can't help you. But my guess is that the problem may be with other system components, and not necessarily with VisAD.

So that's my suggestion. Try with other versions of JDK, and Java3D.

Cheers,

Ugo

Any more suggestions?

Leah


On Wed, 30 Jul 2003, Jim Koutsovasilis wrote:

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.
thread.start();

/**
* 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.
---
Jim Koutsovasilis
Bureau of Meteorology
jimk@xxxxxxxxxx


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?

Leah


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?


Thanks

Leah









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