Hello,
(Geia sou sumpatriwtn)
I have never to take snapshots of my canvas3D.  However, I have seen and
heard of people doing such a thing using "RecordableCanvas".  I don't know
any of the details of it, but apparently it extends Cavas3D for exactly
this purpose.  Unfortunately, since I never needed it, I know nothing more
about it than what I already said.  But I suggest you search for it while
waiting for other (better) replies.
Paraskevas Orfanides

--- Petros Komodromos <[EMAIL PROTECTED]> wrote:
> Hi,
>
> [I am sorry if this is received more than once. I have submitted
> it several times but I aleways received e-mails bouncing it back
> saying that my earlier submissions have been denied because
> of an error during submission]
>
> I am subclassing the Canvas3D and overriding its postSwap() method
> to save the image that is rendered offscreen (as it was described
> in previous e-mails by other people). However, the JPEG files that
> I get are of very bad quality with different colors than the ones
> used in my simulation (black shows as something between green/blue).
>
> Does anyone knows what I may be doing wrong?
> Or, at least does anyone know where I can find more
> relevant information regarding the classes that I
> blindly use (based on the info from previous e-mails)
> such as JPEGCodec,JPEGImageEncoder,JPEGEncodeParam, etc
>
> In the constructor of OffScreenCanvas3D that extends
> Canvas3D I set the following:
>
> BufferedImage bufferedImage =
>                new BufferedImage(width,
> height,BufferedImage.TYPE_INT_ARGB);
>
> ImageComponent2D buffer =
>                   new ImageComponent2D(ImageComponent.FORMAT_RGBA,
> bufferedImage);
>
> buffer.setCapability(ImageComponent2D.ALLOW_IMAGE_READ);
>
> Raster raster = new Raster(new Point3f(0.0f,0.0f,0.0f),
>                         Raster.RASTER_COLOR, 0,0,
>                         width, height,
>                         buffer, null);
>
> raster.setCapability(Raster.ALLOW_IMAGE_WRITE);
>
> GraphicsContext3D graphicsContext3D = getGraphicsContext3D();
>
>  ---- and in the postSwap() method I do the following:
>
> graphicsContext3D.readRaster(raster);
>
> bufferedImage = raster.getImage().getImage();
>
> try
> {
> outputStream = new FileOutputStream(filename);
>
> JPEGImageEncoder imageEncoder =
>         JPEGCodec.createJPEGEncoder(outputStream);
>
> JPEGEncodeParam jpegEncodeParam =
>         imageEncoder.getDefaultJPEGEncodeParam(bufferedImage);
>
> jpegEncodeParam.setQuality(1.0f,false);
>
> imageEncoder.setJPEGEncodeParam(jpegEncodeParam);
>
> imageEncoder.encode(bufferedImage);
>
> snapshotJPEG = false;
>
> outputStream.close();
> }
>
> Thanks
> Petros Komodromos
>
>
> ===========================================================
> Petros Komodromos                             Home address:
> Office: 1-245                 540 Memorial Drive, Apt#1407
> Tel.: (617) 258-9468                  Cambridge, MA 02139
> [EMAIL PROTECTED]              Tel.: (617) 577 -9869 / -5830
> http://www.mit.edu/people/petros
> Intelligent Engineering Systems Laboratory (IESL)
> Massachusetts Institute of Technology
> ===========================================================
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff JAVA3D-INTEREST".  For general help, send email
> to
> [EMAIL PROTECTED] and include in the body of the message "help".


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail.
http://personal.mail.yahoo.com/?.refer=text

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to