I've been trying to make off screen rendering to work, using Java3D 1.5.2. In my source code I've been trying to attach an extended Canvas3D
that will do off-screen rendering to SimpleUniverse
, but doing so will break the render:
62. // FOR SOME REASON THIS BREAKS RENDERING
63. universe.getViewer().getView().addCanvas3D(canvas);
The full source code is a bit too large to paste on StackOverflow so I made it available via Pastie over here.
Line 63 has been commented out and has the ordinary Canvas3D do on-screen rendering. It will render a cube and display this in a JFrame
. However if you remove the comment the off-screen render will cause the on-screen one from not rendering. Also the off-screen rendering will return a "big black nothing" BufferedImage
.
I'd like to know how to make the off screen rendering work, i.e. render the scene of a rotated cube to a buffered image. I've been looking at the Java3D provided example code for off-screen rendering and they do it as this as well (with the exception that they use the Raster
object to render the off screen buffer back to an on-screen window).