I'm going to do an update to the FAQ soon, with a new version of this code.
I'll announce the update here when it has been completed.

Steve


Kovalan Muniandy wrote:

> Dear Reader,
>
> Steve Pietrowicz writes about capturing still images in JPEG format (Java 3D
> FAQ):
> http://tintoy.ncsa.uiuc.edu/~srp/java3d/howto.html#capture
>
> However, I get an exception when I do it. Could someone give me a hint?
> Thanks,
>
> Kovalan
> Ps. The exception:
>
> Exception occurred during Canvas3D callback:
> java.lang.NullPointerException
>         at
> javax.media.j3d.GraphicsContext3D.readRaster(GraphicsContext3D.java:1
> 068)
>         at TurnCamera$CapturingCanvas.postSwap(TurnCamera.java:128)
>         at javax.media.j3d.Renderer.run(Renderer.java:715)
>
> >> The code:
>
>     public class CapturingCanvas extends Canvas3D
>     {
>       public CapturingCanvas() {
>         super( null );
>       }
>       public void postSwap() {
>         GraphicsContext3D  ctx = getGraphicsContext3D();
>         Raster ras = new Raster();
>
>         ctx.readRaster(ras);
>
>         // Now strip out the image info
>         ImageComponent2D img_src = ras.getImage();
>         DepthComponent depth = ras.getDepthComponent();
>         java.awt.image.BufferedImage img = img_src.getImage();
>
>         // write that to disk....
>         System.out.println( "TODO: Insert write to file code." );
>       }
>     }

--
Steve Pietrowicz - [EMAIL PROTECTED]    Project Manager - NCSA Java 3D Group

NCSA Portfolio 1.3 beta 1:  http://havefun.ncsa.uiuc.edu/Java3D/portfolio/
   New Loaders, turn your Canvas3D into a JPEG, new InputDevices and more!
   Freely available for non-commercial use!

You Build It VR:     http://havefun.ncsa.uiuc.edu/Java3D/YouBuildItVR/
   Build your own multi-user virtual worlds with no programming experience!
The Java3D FAQ:      http://tintoy.ncsa.uiuc.edu/~srp/java3d/faq.html
Java News Network:   http://tintoy.ncsa.uiuc.edu/~srp/java/javanews.html

===========================================================================
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