RE: off-screen rendering

Luke,
   thanks. This might appear strange, but might help. The same code as given
below ran to completion (except it hangs at the end, but I don't mind it at
the moment). Something has changed in the last few days. But I am not sure if
it should make a difference. Yesterday I installed Java3D from Blackdown. That
is the only change that I made. My PC runs Linux RH 7.3. I think the Java3D
version is 1.3.0. 
sincerely,
Ramesh

-----Original Message-----
From: Luke Matthews [mailto:l.matthews@xxxxxxxxxx]
Sent: Thursday, September 25, 2003 5:12 PM
To: Mantri, Mr. Ramesh; rsm0001@xxxxxxxxxxxx
Subject: Re: off-screen rendering


Hi Ramesh,

I have also tested your program and it works on my machine. I haven't had
any experience with offscreen rendering with java2d, so my best
recommendation for fixing the problem (or letting me help you) is to switch
over to java3d. I would recommend you to go over to Java3D displays as they
perform faster than Java2D.

If you do decide to change to java3D. The first test for offscreen rendering
is to run

java visad.java3d.VisADCanvasJ3D

If this works (a coloured field is displayed in the window) offscreen
rendering should work on your system. If it doesn't work, there are a couple
of quick questions to see if I can isolate your problem.
- What operating system are you using?
- What version of Java3D do you have installed?
- Which graphics card do you have?

Also, regarding the image.
- When you say it isn't complete how incomplete is it?

There are a few tricks to image capturing in VisAD, the main one is to make
sure that the display isn't covered by another dialog or window.


> Hi Ramesh,
>
> I ran your program and it produced a good visadImage.png file
> on my Sparc Solaris machine. It is possible that your difficulty
> is related to the problem with offscreen rendering on Linux that
> Luke Matthews is working on. When he reports the reults of his
> work that may also solve your problem.
>
> Cheers,
> Bill
>
> On Mon, 22 Sep 2003, Mantri, Mr. Ramesh wrote:
>
> > I am a newbie to VisAD. I am trying out one of the first examples with a
slight
> > modification. I am trying to render the image off-scrren, that is write
out the
> > image to a file. I tried a bunch of things but could not get it to work
completely.
> > The image is written to file, but apparently it isn't complete. Please
find the code
> > below. Appreciate any help. (Also, please CC your reply to
rsm0001@xxxxxxxxxxxx).
> > sincerely,
> > Ramesh Mantri
> >
> > import visad.*;
> > import visad.java2d.DisplayImplJ2D;
> > import java.rmi.RemoteException;
> > import java.awt.*;
> > import javax.swing.*;
> >
> > import com.sun.image.codec.jpeg.*;
> > import java.io.*;
> > import javax.imageio.ImageIO;
> > import java.awt.image.BufferedImage;
> >
> > public class WriteImage {
> >    private RealType time, height;
> >    private FunctionType func_time_height;
> >
> >    private Set time_set;
> >    private FlatField vals_ff;
> >    private DataReferenceImpl data_ref;
> >
> >    private DisplayImpl display;
> >    private ScalarMap timeMap, heightMap;
> >
> > public WriteImage(String[] args) throws RemoteException, VisADException
{
> >       time = new RealType("time");
> >       height = new RealType("height");
> >
> >       func_time_height = new FunctionType(time, height);
> >       time_set = new Integer1DSet(time, 5);
> >
> >       float[][] h_vals = new float[][] {{0.0f, 13.75f, 45.0f, 33.75f,
0.0f,}};
> >
> >       vals_ff = new FlatField(func_time_height, time_set);
> >       vals_ff.setSamples(h_vals);
> >
> >       //display = new DisplayImplJ2D("display1");
> >       display = new DisplayImplJ2D("display1", 450, 450);
> >
> >       timeMap = new ScalarMap(time, Display.XAxis);
> >       heightMap = new ScalarMap(height, Display.YAxis);
> >
> >       display.addMap(timeMap);
> >       display.addMap(heightMap);
> >
> >       data_ref = new DataReferenceImpl("data_ref");
> >       data_ref.setData(vals_ff);
> >
> >       display.addReference(data_ref);
> >    }
> >
> >    public void writeToFile() throws IOException {
> >       BufferedImage image = display.getImage(true);
> >       File file = new File("visadImage.png");
> >       ImageIO.write(image, "PNG", file);
> >    }
> >
> >    public static void main(String[] args) {
> >       try {
> >          WriteImage imgObj = new WriteImage(args);
> >          imgObj.writeToFile();
> >          //System.exit(0);
> >       } catch (Exception e) {
> >          e.printStackTrace();
> >       }
> >    }
> > }
> >
> >
>
>


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