Reshape Problem Using NewtCanvasSWT

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Reshape Problem Using NewtCanvasSWT

rhatcher
Fedora 12
JRE/JDK 7u7
GeForce 9800 GT + NVIDIA driver 304.37
JOGAMP/JOGL custom build from 10/02/2012 repos (RC11 in progress)

This topic is an offshoot of some suggestions Sven made in http://forum.jogamp.org/The-Current-State-Of-JOGL-SWT-Integration-tp4026329.html.

I'm trying out NewtCanvasSWT embedded in a "part" (i.e. stuffed under a tab) in an Eclipse4 workbench window, and it sort of works.

The GLEventListener initially draws what I expect, but it doesn't reshape properly.  It gets a few reshape() calls when the program opens, but after that only display() gets called if the size of the part is changed.  FWIW the "updateSizeCheck" protected method in NewtCanvasSWT is getting called.

Also, window exposure does not trigger display() calls.

I wasn't sure how to use NewtCanvasSWT so I could easily have something set up wrong.  This is the relevant code:

    private NewtCanvasSWT _canvas ;
    ...
    @PostConstruct
    public void postConstruct( Composite parent )
    {
        GLWindow glWindow = GLWindow.create( new GLCapabilities( null ) ) ;
        _canvas = NewtCanvasSWT.create( parent, SWT.NO_BACKGROUND, glWindow ) ;

        glWindow.addGLEventListener( new TestGLEventListener() ) ;        
        glWindow.addKeyListener( new TestKeyListener() ) ;
        glWindow.addMouseListener( new TestMouseListener() ) ;
    }
    ...
    @Focus
    public void setFocus()
    {
        // I wasn't sure what should get focus here, but the canvas seemed logical.
        _canvas.setFocus() ;
    }

Should that "just work"?

I'm also not getting mouse or keyboard events.  Should I be, provided the _canvas is getting focus?  I verified that the setFocus method is getting called, but I wasn't sure if I should be passing this on to the canvas or something else.  Or... should I be setting up the mouse and key listeners differently?
Reply | Threaded
Open this post in threaded view
|

Re: Reshape Problem Using NewtCanvasSWT

Sven Gothel
Administrator
On 10/04/2012 09:27 PM, rhatcher [via jogamp] wrote:

> Fedora 12
> JRE/JDK 7u7
> GeForce 9800 GT + NVIDIA driver 304.37
> JOGAMP/JOGL custom build from 10/02/2012 repos (RC11 in progress)
>
> This topic is an offshoot of some suggestions Sven made in
> http://forum.jogamp.org/The-Current-State-Of-JOGL-SWT-Integration-tp4026329.html.
>
> I'm trying out NewtCanvasSWT embedded in a "part" (i.e. stuffed under a tab)
> in an Eclipse4 workbench window, and it sort of works.
>
> The GLEventListener initially draws what I expect, but it doesn't reshape
> properly.  It gets a few reshape() calls when the program opens, but after
> that only display() gets called if the size of the part is changed.  FWIW the
> "updateSizeCheck" protected method in NewtCanvasSWT /is/ getting called.
>
> Also, window exposure does not trigger display() calls.
>
> I wasn't sure how to use NewtCanvasSWT so I could easily have something set up
> wrong.  This is the relevant code:
>
>     private NewtCanvasSWT _canvas ;
>     ...
>     @PostConstruct
>     public void postConstruct( Composite parent )
>     {
>         GLWindow glWindow = GLWindow.create( new GLCapabilities( null ) ) ;
>         _canvas = NewtCanvasSWT.create( parent, SWT.NO_BACKGROUND, glWindow ) ;
>
>         glWindow.addGLEventListener( new TestGLEventListener() ) ;        
>         glWindow.addKeyListener( new TestKeyListener() ) ;
>         glWindow.addMouseListener( new TestMouseListener() ) ;
>     }
>     ...
>     @Focus
>     public void setFocus()
>     {
>         // I wasn't sure what should get focus here, but the canvas seemed
> logical.
>         _canvas.setFocus() ;
>     }
>
> Should that "just work"?
Yes, that's how it should work in general - simple API.

See unit tests just using the proper SWT thread for critical SWT initialization,
which might be required for some OS.

<http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java;hb=HEAD#l60>
<http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aSWT.java;hb=HEAD#l57>
<http://jogamp.org/git/?p=jogl.git;a=blob;f=src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java;hb=HEAD#l59>

Just checked the unit test demo manual
  - uncomment the following test line in jogl/make/script/tests.sh (and comment out the active one)
    testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTGLn $*

  - run: jogl/make> script/tests-x64.sh -time 10000

Yes, we have a regression, sorry. Resize and Key/Mouse input isn't
covered by a unit test yet.

Will look into it now.

>
> I'm also not getting mouse or keyboard events.  Should I be, provided the
> _canvas is getting focus?  I verified that the setFocus method is getting
> called, but I wasn't sure if I should be passing this on to the canvas or
> something else.  Or... should I be setting up the mouse and key listeners
> differently?

No, should work - see above.

~Sven



signature.asc (907 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Reshape Problem Using NewtCanvasSWT

Sven Gothel
Administrator
In reply to this post by rhatcher
On 10/05/2012 01:28 AM, Sven Gothel wrote:
>
> Will look into it now.

jogl commit 84632ca22d112da45b807299d2b1f5e4f4107695

<http://jogamp.org/git/?p=jogl.git;a=commit;h=84632ca22d112da45b807299d2b1f5e4f4107695>

Fix starts SWTEDTUtil .. now it delivers all events.

Pls check this forum/ML for next aggregated test build later on,
or compile yourself.

~Sven



signature.asc (907 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Reshape Problem Using NewtCanvasSWT

rhatcher
I did a build this morning and gave this a try.  The trend is in the right direction:

- Reshape calls are being made for both window resizing and part-sash dragging;
- Display calls are being made for window exposures;
- Mouse and keyboard events are showing up.

Two Chuck Norris thumbs up.

However, at least one problem remains:

If I grab-and-hold the corner of the window and drag it around randomly stimulating piles of window resizes then after just a few seconds the overall window refresh will stall and something like this will pop out:

Exception in thread "main-SWTDisplay-.x11_:0.0-1-EDT-1" java.lang.RuntimeException: Waited 5000ms for: <14e5b0e, 13c0223>[count 1, qsz 0, owner <main>] - <main-SWTDisplay-.x11_:0.0-1-EDT-1>
        at jogamp.common.util.locks.RecursiveLockImpl01Unfairish.lock(RecursiveLockImpl01Unfairish.java:197)
        at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:539)
        at jogamp.opengl.GLAutoDrawableBase.defaultWindowResizedOp(GLAutoDrawableBase.java:128)
        at com.jogamp.newt.opengl.GLWindow.access$100(GLWindow.java:94)
        at com.jogamp.newt.opengl.GLWindow$1.windowResized(GLWindow.java:112)
        at jogamp.newt.WindowImpl.consumeWindowEvent(WindowImpl.java:2344)
        at jogamp.newt.WindowImpl.sendWindowEvent(WindowImpl.java:2287)
        at jogamp.newt.WindowImpl.sizeChanged(WindowImpl.java:2431)
        at jogamp.newt.driver.x11.DisplayDriver.DispatchMessages0(Native Method)
        at jogamp.newt.driver.x11.DisplayDriver.dispatchMessagesNative(DisplayDriver.java:106)
        at jogamp.newt.DisplayImpl.dispatchMessages(DisplayImpl.java:442)
        at com.jogamp.newt.swt.SWTEDTUtil$1.run(SWTEDTUtil.java:57)
        at com.jogamp.newt.swt.SWTEDTUtil$NewtEventDispatchThread.run(SWTEDTUtil.java:239)

So... we are very close on this.  I'm not sure I'm smart enough to fix this problem, but I will at least think about it.
Reply | Threaded
Open this post in threaded view
|

Re: Reshape Problem Using NewtCanvasSWT

rhatcher
In reply to this post by Sven Gothel
Sven, should I post a Bugzilla entry on this one?
Reply | Threaded
Open this post in threaded view
|

Re: Reshape Problem Using NewtCanvasSWT

Sven Gothel
Administrator
On 10/09/2012 11:36 PM, rhatcher [via jogamp] wrote:
> Sven, should I post a Bugzilla entry on this one?
>

please.

if you find a way how to reproduce it programmatic,
pls attach it.

~Sven



signature.asc (907 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Reshape Problem Using NewtCanvasSWT

rhatcher
Reply | Threaded
Open this post in threaded view
|

Re: Reshape Problem Using NewtCanvasSWT

Sven Gothel
Administrator
On 10/11/2012 07:43 PM, rhatcher [via jogamp] wrote:
> https://jogamp.org/bugzilla/show_bug.cgi?id=628
>

Fixed: https://jogamp.org/bugzilla/show_bug.cgi?id=628#c7

(builds in progress ..)

~Sven



signature.asc (909 bytes) Download Attachment