Created attachment 460 [details]
Source Code to Demonstrate Bug
When using a CardLayout LayoutManager to switch between a
swing component and a GLCanvas, once the GLCanvas has been
displayed it remains visible after being switched out.
Edge artifacts of the red square while resizing the frame
when switched out shows that the GLCanvas bitmap is being
rescaled and redrawn rather than it's display method
This was not a problem with JOGL 1.1.1.
Steps to Reproduce: (See attachment for code sample)
1) Create a JPanel using a CardLayout. Add two cards, a JLabel and a GLCanvas.
2) Switch from the JLabel card to the GLCanvas card and back to the JLabel card.
The GLCanvas does not disappear after switching back to the JLabel.
The GLCaanvas should dissappear and the JLabel should reappear.
Build Date and Platform:
JOGL2 rc11, confirmed to still exist in:
Implementation Version: 2.0.2-rc-20130426
Platform: Mac OS X 10.8.3
Additional Builds and Platforms:
Have only tested JOGL 2 on Mac but problem did not occur in JOGL 1.x on Mac or Windows.
Thank you for your detailed bug report, incl. the test case!
Just for your info - this is _not_ a regression!
JOGL1 had not code path to work w/ OSX >= 10.8.
Mentioned code path is new and completely different in JOGL2,
since it utilizes the new CALayer impl. which is the only supported path for Java7/OSX.
Further more, Java7's AWT itself is new.
Lightweight/Heavyweight mixing .. and 'complicated' AWT/Java2D UIs are especially
difficult to achieve w/o bugs on OSX/Java7.
You may try to use GLJPanel as a last resort.
However, I will validate your test case - ofc - and see what is possible.
You might want to try GLJPanel .. ? Will check on this at a later time.
for me it would be crucial to get this bug fixed somehow... I am using Nasa World Wind, and all my MacOS clients are now waiting for some months to get the newest upgrade... recently my old version is not running anymore due to MacOS changes... so it would be great if you cold sove this.
Anyway: GREAT JOB GUYS!!
A once visible CALayer (GLCanvas) must be able to become invisible w/o destruction,
e.g. as required by CardLayout's switching cards.
See unit test for Bug 532: 'TestAWTCardLayoutAnimatorStartStopBug532'
Out native 'fixCALayerLayout(..)' takes the visible state as tracked by JAWTWindow's ComponentListener
and sets our CALayer (root and sub) hidden state accordingly.
Now MacOSXJAWTWindow's layoutSurfaceLayerImpl(..) always calls down to 'fixCALayerLayout(..)'
due to update the visibility state.
OSX CALayer invisible needs to have opacity 0 to not show hidden component.
Completes commit 3b02a219b1b9e446e87df1beb7da4266f74824fa
See unit test: TestBug816OSXCALayerPos03AWT