Skip to main content

Offscreen Canvas3D postRender call results in missing image

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2011-06-03


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() {
if(actors.isEmpty()) return;
for (Java2DActor actor : actors) {