Hello all,
This is a question regarding the implementation of a method to prevent unnecessary rerendering in Java3D. The idea is to read the frame from the frame buffer after each rendering in order to minimize expensive rerendering when the window is exposed. Since offscreen rendering can be significantly slower, we use mixed-mode rendering and GraphicsContext3D.readRaster(Raster) to read the frame after it was rendered and swapped. However, if Canvas3D is overlapped by some other windows, the contents of those windows are read by readRaster method, which leads to an incorrect display after overlapping windows are repositioned.
There are two solutions here. First is to read full rendered frame from a back buffer. As, far as I understand, readRaster method does not allow that. Also, it is possible that the obscured part of the canvas is not even rendered in the back buffer. Second solution is to know when canvas visibility changes, so that the scene could be re-rendered (even though, that is not the best solution from the performance standpoint). Unfortunately, we have not found a way to determine the change of visibility. PaintEvent only tells you when visibility is increased, but there is no message when visibility is strictly decreased because of the movement of some overlapping windows.
Documentation on java.awt.Graphics2D tells about "device clip" that is combined with "user clip" to obtain final "composite clip" that is used to determine rendering region. It seems that Java3D also uses them in rendering. However, we have not found any public method that would allow access to "device clip" or "composite clip".
Does anybody know how to obtain those clipping coordinates? Any other idea about these problems is also welcome.
-Yuri
