Skip to main content

Offscreen Canvas3D postRender call results in missing image

No replies
sstevenson638
Offline
Joined: 2011-06-03
Points: 0

Hello,

I'm using the postRender method to draw a local coordinate system display on top of my 3D image. I'm using an offscreen canvas3D to capture screen shots and do the same postRender drawing in the offscreen canvas. Everything works great as long as the 3D canvas is the active window on the screen. If the 3D canvas is hidden or not active then I get an image with the correct background color and postRender drawing, however the 3D renderable content is missing. I discovered through random attempts that if I avoid calling the graphic2D.flush(true) method I can get the 3D renderable content, but not my 2D drawing done in the postRender method.

Can anyone help?

Canvas3D postRender method:

Interface Actor is anything that draws on the Canvas3D in the postRender method.

If I comment out the getGraphics2D().flush(true) line then I get the 3D content but not my 2D drawing for non-visible offscreen Canvases.

If I leave it in, I get the 2D content, but not the 3D content.

What gives?

public void postRender() {
super.postRender();
if(actors.isEmpty()) return;
for (Java2DActor actor : actors) {
actor.draw(this);
}
this.getGraphics2D().flush(true);
}