Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Performance in Collecting one buffered Image of the canvas 3d

843799Oct 1 2003 — edited Oct 2 2003
Hi,

I have rewrited the postswap() of a canvas 3d to collect a bufferedImage of the scenario and then sent it to another aplication.

The program is working but im having a problem with the performance:
I discovered that the method readRaster(Raster r) from graphicsContext3d takes 200ms in Suse Linux 1,8Ghz to retrieve the raster image and that is to slow for the application.

I would like to know if someone knows why these method is so slow, if i can make it faster or if someone knows a better and fast way to get a bufferedImage of one canvas 3d?

this is the code :

public void postSwap()
{
GraphicsContext3D ctx = getGraphicsContext3D();

Rectangle rect = this.getBounds();

BufferedImage img = new BufferedImage(rect.width,rect.height,
BufferedImage.TYPE_INT_RGB);

ImageComponent2D comp =
new ImageComponent2D(ImageComponent.FORMAT_RGB, img, true, false);

Raster ras = new Raster(new Point3f(-1.0f,-1.0f,-1.0f),
Raster.RASTER_COLOR,
0,
0,
rect.width,
rect.height,
comp,
null);


ctx.readRaster(ras);

// Now strip out the image info

BufferedImage output_img = ras.getImage().getImage();

SendImage(output_img);

}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 30 2003
Added on Oct 1 2003
1 comment
82 views