Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 343331

Summary: [Mac] GLCanvas draws on top of fast views
Product: [Eclipse Project] Platform Reporter: Tom Crockett <Thomas.M.Crockett>
Component: SWTAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: carolynmacleod4, eclipse.felipe, lshanmug, Mark.Powell, Silenio_Quarti
Version: 4.1Flags: eclipse.felipe: review+
Target Milestone: 3.7.2   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
testcase plugin to reproduce the bug
none
LWJGL plugin required by testcase plugin none

Description Tom Crockett CLA 2011-04-19 22:04:42 EDT
Build Identifier: 20110218-0911

GLCanvas cannot be occluded by fast views, it just draws happily on top of them.

Reproducible: Always

Steps to Reproduce:
1) Launch the IDE product including the 2 attached plugins (org.lwjgl and testcase).
2) Show the "Bug View" from the "Bug Category". The canonical spinning torus example should appear in a view.
3) Minimize another view and then reveal it such that it overlaps the bug view... the GLCanvas of the bug view keeps drawing the torus on top of the fast view.
Comment 1 Tom Crockett CLA 2011-04-19 22:06:16 EDT
Created attachment 193638 [details]
testcase plugin to reproduce the bug
Comment 2 Tom Crockett CLA 2011-04-19 22:07:26 EDT
Created attachment 193639 [details]
LWJGL plugin required by testcase plugin
Comment 3 Silenio Quarti CLA 2011-05-02 09:41:48 EDT
Is this on carbon or cocoa?
Comment 4 Silenio Quarti CLA 2011-05-02 09:57:14 EDT
Tried carbon and it works. Fails on cocoa.

We have code in the carbon implementation to clip areas of the GLCanvas that are obscured. We achieve this by setting AGL_CLIP_REGION and AGL_BUFFER_RECT with a visible region we calculate ourselfs.  I am not sure this can be done on cocoa.
Comment 5 Silenio Quarti CLA 2011-05-02 15:02:14 EDT
I could not find any support equivalent to AGL_CLIP_REGION on cocoa.  I played with NSOpenGLCPSwapRectangle and glScissor() to at least have a rectangular clipping, but NSOpenGLCPSwapRectangle seems to be a noop and glScissor() does not work either.
Comment 6 Carolyn MacLeod CLA 2011-05-03 23:53:30 EDT
Do we need to open a radar against cocoa, or maybe cc a Mac guy?
Comment 7 Mark Powell CLA 2011-06-03 11:22:31 EDT
Are we making any more headway on this? Have you been able to identify a Mac person to work with you on the issue?
Comment 8 Silenio Quarti CLA 2011-09-07 14:11:00 EDT
After quite a bit of research I found the proper way to have cocoa views drawing over OpenGL views.

http://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSOpenGLContext_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSOpenGLCPSurfaceOrder

Please try the latest code and let me know if you find any issues.

Fixed

http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=4222a621d2928b548c2e30cc0978e442beedb1d5
Comment 9 Tom Crockett CLA 2011-09-07 14:20:51 EDT
Awesome work, Silenio! We owe you a beer or three next EclipseCon.
Comment 10 Silenio Quarti CLA 2011-09-15 09:56:16 EDT
Reopenning to back port to 3.7.2.