NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Surekha, Can you call getImage() and print using your original on-screen DisplayImplJ3D? If so, that would be the easiest way to work around this problem. We've known about problems with getImage() from offscreen DisplayImplJ3Ds for quite a while, but despite some intensive effort haven't been able to fix them. The fact that you see problems with contour lines but not with surfaces is a sign that this is a problem in Java3D or even OpenGL, since the VisAD code for getImage() doesn't know anything about lines versus surfaces. There is a VisAD standard test (that we run before every release) for getImage() from an offscreen DisplayImplJ3D, in the main() method of visad/java3d/VisADCanvasJ3D.java. This repeatedly calls getImage() from an offscreen DisplayImplJ3D and then displays the returned BufferedImage in a JPanel via a call to drawImage(). The test in the main() method of VisADCanvasJ3D renders a simple texture map, but I was able to change it to render contour lines by appending: display.addMap(new ScalarMap(vis_radiance, Display.IsoContour)); to the string of addMap() calls in the main() method. When I did this, the JPanel didn't display the contour lines until the second call to drawImage(). This suggests a possible work-around for your problem: replicate the logic of main() calling getImage() twice (or more if necessary) with calls to Thread.sleep(1000) between successive calls to getImage(). Kind of a hack, but it might work. Good luck, Bill On Thu, 1 Dec 2005, Surekha Chandran wrote: > Hi all, > > I am trying to print out an DisplayImplJ3D image by > doing the following steps: > 1. I create an new off screen DisplayImplJ3D > "offscreenDisplay" > 2. I clone the ScalarMaps from the original visible > display and add it to the "offscreenDisplay" > 3. I add the DataReferenceImpl from the original > visible display to the offscreenDisplay. > > Everything seems to work. Except when I do the next > step of actually printing out the image. The .jpg file > is empty! > > This only happens with contour lines. I am able to > print surfaces but not contours. > > Can anyone help? I am at a complete loss. > > There are times that I seem to be hanging on the > statement : > java.awt.image.BufferedImage buffImage > offscreenDisplay.getImage(true); > I don't know why that happens. > > I will settle for being able to see the contours in my > output files from the offscreenDisplay. > > Thanks > Surekha > > > > > > __________________________________________ > Yahoo! DSL – Something to write home about. > Just $16.99/mo. or less. > dsl.yahoo.com > >
visad
archives: