Bug 1310 - Removing and re-adding a GLJPanel results in small image being rendered
Summary: Removing and re-adding a GLJPanel results in small image being rendered
Status: RESOLVED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: awt (show other bugs)
Version: 2.5.0
Hardware: All windows
: P4 normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2016-06-01 16:13 CEST by willemv
Modified: 2023-08-18 14:22 CEST (History)
1 user (show)

See Also:
Type: DEFECT
SCM Refs:
5be77843127a785bcdfc4dbc041fcf42c6971592 d17d807a76ba9cb940542264fcad9cf71c7ec585 70f62ca5d121e5e71548246d468b5e7baa5faf25
Workaround: ---


Attachments
Sample program that shows the problem. (3.21 KB, text/x-java)
2016-06-01 16:13 CEST, willemv
Details

Note You need to log in before you can comment on or make changes to this bug.
Description willemv 2016-06-01 16:13:51 CEST
Created attachment 788 [details]
Sample program that shows the problem.

If you remove and then re-add a GLJPanel from its parent, a small version (about 50px * 50px it appears) of the content is rendered.
Comment 1 willemv 2016-06-01 16:18:34 CEST
Resizing the window restores the GLJPanel to its normal behavior.
Comment 2 willemv 2016-06-01 16:29:46 CEST
Setting 'sendReshape' to true in the 'addNotify' implementation of GLJPanel fixes the issue. Not sure if that's the right fix though.
Comment 3 Julien Gouesse 2016-07-06 08:49:24 CEST
Hi

Thanks you for providing a sample program and a tip to work around this bug. Can you confirm that you use JOGL 2.3.2?
Comment 4 willemv 2016-07-06 08:55:10 CEST
I use JOGL 2.3.2 indeed
Comment 5 Sven Gothel 2019-03-30 05:07:34 CET
putting this on version 2.5.0 for now
Comment 6 Sven Gothel 2023-08-07 13:33:03 CEST
commit 5be77843127a785bcdfc4dbc041fcf42c6971592

Test Bug1310: Remove and re-add a GLJPanel from its Swing parent (working)
Also tested with Sofr-HiDPI on Linux using GDK_SCALE=2
Comment 7 Sven Gothel 2023-08-18 14:21:49 CEST
commit d17d807a76ba9cb940542264fcad9cf71c7ec585

    Bug 1310: Detect missing glViewport(..) on Windows before GLEventListener.reshape(..) when re-adding GLJPanel
    
    When re-adding GLJPanel on Windows glViewport()
    is not called through
      - GLJPanel.Updater.display()
      - GLDrawableHelper.reshape()
      - GLDrawableHelper.setViewportAndClear()
    
    Instead the following sequence is called due to sendReshape == false:
      - GLJPanel.Updater.display()
      - GLDrawableHelper.display() ** missing glViewport(..) **
    
    This bug is not visible on X11 or MacOS since the glViewport
    is only set to a different user value on Windows ...
Comment 8 Sven Gothel 2023-08-18 14:22:26 CEST
commit 70f62ca5d121e5e71548246d468b5e7baa5faf25 

    Bug 1310: Reset GLJPanel states @ dispose(..) and always reshapeImpl(..) @ addNotify(), leading to proper initialization sequence when re-adding panel.
    
    The proper initialization sequence subsequently also leads to proper glViewport initialization,
    see commit d17d807a76ba9cb940542264fcad9cf71c7ec585
    
    No side-effects expected, just ensuring same code-path compared to initial addNotify().