Bug 450

Summary: GLJPanel - missing areas on resize
Product: [JogAmp] Jogl Reporter: Wade Walker <wwalker3>
Component: openglAssignee: Sven Gothel <sgothel>
Status: VERIFIED FIXED    
Severity: normal CC: cdefranoux, sylvestre
Priority: ---    
Version: 2   
Hardware: pc_x86_64   
OS: linux   
Type: --- SCM Refs:
aac2ba89a38d47fc24db10254e4b295717557b23
Workaround: ---
Attachments: Code to duplicate the bug
Log of test
Unit test for bug.

Description Wade Walker 2010-12-30 15:27:16 CET
(from ariekenb's forum post)

I modified the Gears demo slightly so that it uses GLJPanel instead of GLCanvas: gears-gljpanel.zip

I find if I resize the JFrame so that the width in pixels is larger than the height in pixels, the side of the GLJPanel does not paint anything.  For example: gears.png

This does not happen with JOGL 1.1.1. 

I wonder if this is due to the fact that GLDrawableFactoryImpl.createGLPbuffer ignores the width parameter and passes height for both width and height to createOffscreenSurfaceImpl: 

142   public GLPbuffer createGLPbuffer(AbstractGraphicsDevice deviceReq, 
143                                    GLCapabilitiesImmutable capsRequested, 
144                                    GLCapabilitiesChooser chooser, 
145                                    int width, 
146                                    int height, 
147                                    GLContext shareWith) { 


178         drawable = (GLDrawableImpl) createGLDrawable( createOffscreenSurfaceImpl(device, capsChosen, capsRequested, chooser, height, height) ); 


Here is my test.log: test.log
Comment 1 Wade Walker 2010-12-30 15:28:06 CET
Created attachment 210 [details]
Code to duplicate the bug
Comment 2 Wade Walker 2010-12-30 15:31:12 CET
Created attachment 211 [details]
Log of test
Comment 3 Wade Walker 2010-12-30 15:51:52 CET
Duplicated this error by resizing com.jogamp.opengl.test.junit.jogl.demos.gl2.gears.TestGearsGLJPanelAWT to be wider than it is tall. The right side of the window (the part with x > max height) doesn't render.
Comment 4 Wade Walker 2010-12-30 18:03:28 CET
Created attachment 212 [details]
Unit test for bug.

Created a unit test that fails on this bug. The test reads a pixel in the erroneously black part of the frame during the gears rendering.

I'll submit a pull request for this after I try to fix the bug.
Comment 5 Wade Walker 2010-12-30 18:18:39 CET
Changing line 178 of GLDrawableFactoryImpl.java from this:

drawable = (GLDrawableImpl) createGLDrawable( createOffscreenSurfaceImpl(device, capsChosen, capsRequested, chooser, height, height) );

to this:

drawable = (GLDrawableImpl) createGLDrawable( createOffscreenSurfaceImpl(device, capsChosen, capsRequested, chooser, width, height) );

fixes the problem, just as user ariekenb speculated. I'll push this to my repository and submit you a pull request.
Comment 6 Wade Walker 2010-12-30 21:10:19 CET
Submitted pull request.
Comment 7 Wade Walker 2010-12-31 15:10:37 CET
*** Bug 404 has been marked as a duplicate of this bug. ***
Comment 8 Sylvestre Ledru 2011-01-18 16:53:44 CET
I have also this problem.
Comment 9 Wade Walker 2011-01-19 03:53:05 CET
Hopefully this one should be in soon -- I think Sven is starting his review of these patches now.
Comment 10 Sven Gothel 2011-02-02 06:15:11 CET
commit aac2ba89a38d47fc24db10254e4b295717557b23
Author: wwalker <wwalker@u001042-lin.austin.arm.com>
Date:   Thu Dec 30 14:01:04 2010 -0600

    Fixed bug 450 (unrendered right side of GLJPanel in Gears)
    
    This bug caused the right sides of GLJPanels not to render if the
    panel is wider than its height (all pixels with x > height would
    be black). Wrote a unit test to sense the problem by reading
    an unrendered pixel back out of the frame, then fixed the typo
    in GLDrawableFactoryImpl.java that caused the error.