You the man Kelvin! Basically the format in BufferedImage and ImageComponent2D was set to handle Alpha.
Can't do this with the jpeg encoder apparently. Took that out, and there's my image. Thanks. I noticed the size of the canvas was set to fullscreen (desktop settings). Why is this? At first I was expecting to set my offscreen canvas the size of my canvas in my panel, but then I saw the examples in the demos using the size of the onscreen canvas( which happens to be fullscreen ). Just curious, -DaveS > -----Original Message----- > From: Kelvin Chung [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 18, 2003 4:27 PM > To: [EMAIL PROTECTED] > Subject: Re: [JAVA3D] renderOffScreenBuffer & NullPointerException > > > Smith, David wrote: > > >>Don't use Behavior callback, try running on > >>user thread. A simple test case would be [EMAIL PROTECTED] for > >>us to see what's wrong. > >> > >> > >> > > > >I am in the user thread. It's a callback from > >a menu selection. However my app is fairly large, > >so I extracted out the necessary into two files attached. > > > >If you get a picture, then it might be a platform > >specific issue. On my system it comes up as the background > >color. I basically combined TestOrbit with PrintFromButton. > > > >But I also might be missing something. > > > >Thanks for taking the time to look. > >-DaveS > > > > > > Java3D generate image correctly if you output the pixels of image: > > > BufferedImage bImageRet = offscreencanvas. > getOffScreenBuffer(). > getImage(); > > > > System.out.println("width " + bImageRet.getWidth() + " > height " + > bImageRet.getHeight()); > int a, r, g, b, rgb; > for (int i=0; i < bImageRet.getHeight(); i++) { > for (int j=0; j < bImageRet.getWidth(); j++) { > rgb = bImageRet.getRGB(j, i); > a = (rgb >> 24) & 0xff; > r = (rgb >> 16) & 0xff; > g = (rgb >> 8) & 0xff; > b = rgb & 0xff; > System.out.print("(" + r + " " + g + " " + b + " " > + a + " " + > ")"); > } > System.out.println(""); > } > > > > It is the ImageIO that have problem to save it. > (besides a missing file close to flush output) > Please check with ImageIO API. > > - Kelvin > ------------ > Java 3D Team > Sun Microsystems Inc. > > ============================================================== > ============= > 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". > ==========================================================================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".
