Hi,
I’m using a GLJPanel to render 3d content in our Swing application, but I’ve hit a snag that hopefully someone can shed some light on.
When we attempt to resize a GLJPanel that has been initialized with setSampleBuffers(true), there is a notable pause (3-4 seconds) in which the application freezes & the cpu usage increases dramatically. This behavior can be reproduced in any of the jogl demos.
My guess is that the underlying rendering buffers are being reallocated based on the size of the panel.
Using a GLCanvas resolves the resizing problem (since it doesn’t need to reinitialize the buffers), but it experiences other strange behavior probably related to the heavyweight component issues (incorrect Z-Order, layout).
So, the question becomes: Is there an optimal configuration that supports quick resizing and antialiasing, without the heavyweight issues of GLCanvas?
Some possible workarounds seem to be:
[1] disable setSampleBuffers() & implement antialiasing. Some techniques that might do the trick:
a. Enable GL_POLYGON_SMOOTH and render faces front-to-back to avoid the visible interior triangle edges
(tho’ this would prevent alpha-blended transparency)
b. Perform multiple render passes while offsetting the camera & accumulating the results
c. Render the image at a higher resolution & resample to fit the viewing area (is this what the setSampleBuffers() feature is doing?)
[2] workaround the GLCanvas issues
[3] is it possible to allocate the GLJPanel’s underlying pbuffer only once, and then just re-adjust the viewport when resize events occur?
for example, allocate a 1920x1200 buffer, and if the viewing area is only 800x600, then pass that information to the renderer so that it can display content in the appropriate region
Thanks
Matt