This post was updated on .
Dear all,
I am an amatuer with JOGL and SWT. I got a problem while try show some SWT Widgets over the GLCanvas using AbsoluteLayout. composite = new Composite(parent, SWT.NONE); composite.setLayout(null); Button button = new Button(composite, SWT.NONE); button.setText("New Button"); button.setBounds(172, 145, 94, 28); glcanvas = GLCanvas.create(composite, SWT.NO_BACKGROUND, null, null, null); I thought that the button should be on top of GLCanvas but it is always behind the GLCanvas. Am i doing something wrong ? Please help me, thank you very much. |
Administrator
|
Hi
This has nothing to do with JOGL, just use the SWT canvas as a parent of the button and it should work: http://jexp.ru/index.php/Java_Tutorial/SWT/Canvas
Julien Gouesse | Personal blog | Website
|
Thank you very much for your link, that's helpful. I have a question, is there any problem if we use org.eclipse.swt.widgets.Canvas. I read somewhere telling that this widget is not well maintained. Currently, I am using com.jogamp.opengl.swt.GLCanvas. If possible, please share me some tutorial about using com.jogamp.opengl.swt.GLCanvas!
|
Administrator
|
This post was updated on .
You can and you should use com.jogamp.opengl.swt.GLCanvas if you need JOGL/OpenGL support. You can use org.eclipse.swt.widgets.Canvas if you don't need OpenGL support.
The official SWT OpenGL canvas of the Eclipse Platform hasn't been maintained since 2006 and is called org.eclipse.swt.opengl.GLCanvas. Look at Wade's blog to find some more examples using JOGL with SWT.
Julien Gouesse | Personal blog | Website
|
Yes, i followed the tutorial on wade walker blog but the layout manager (Absolute layout) didn't work, i mean the canvas still cover the button , no matter how i changed the order of button and canvas in the layout.
|
Administrator
|
On 07/04/2013 01:22 PM, Tuan Anh Nguyen [via jogamp] wrote:
> Yes, i followed the tutorial on wade walker blog but the layout manager > (Absolute layout) didn't work, i mean the canvas still cover the button , no > matter how i changed the order of button and canvas in the layout. Don't know how much Wade is using 'com.jogamp.opengl.swt.GLCanvas' or our NewtCanvasSWT class, if at all. However, we do overlay ourselves a native window on top of the SWT Canvas one, actually similar to what the SWT own GLCanvas implementation does. Yes, the SWT implementation has outstanding bugs and issues like yours (layout z-stacking etc) are quite possible not be covered. See our bug list for SWT here: <https://jogamp.org/bugzilla/buglist.cgi?list_id=1296&short_desc=SWT&resolution=---&query_format=advanced&bug_status=UNCONFIRMED&bug_status=CONFIRMED&bug_status=IN_PROGRESS&short_desc_type=allwordssubstr> Everybody is welcome to tackle these bugs! I may only find time for those later this year, since they are of low-priority at least for me and our projects right now. Cheers, Sven signature.asc (911 bytes) Download Attachment |
Thank you very much Sven Gothel! Sorry if i bothered you so much.
In the Wade's tutorial, he uses SWT GLCanvas. But i have changed to com.jogamp.opengl.swt.GLCanvas. For other layout manager i used for composite, everything is ok. For example, i used FillLayout() , the button and the GLCanvas appear side by side. But if i use the AbsoluteLayout the GLCanvas will cover the Button, despite the button order is higher. |
Administrator
|
On 07/04/2013 04:10 PM, Tuan Anh Nguyen [via jogamp] wrote:
> Thank you very much Sven Gothel! Sorry if i bothered you so much. > In the Wade's tutorial, he uses SWT GLCanvas. But i have changed to > /com.jogamp.opengl.swt.GLCanvas/. For other layout manager i used for > composite, everything is ok. For example, i used FillLayout() , the button and > the GLCanvas appear side by side. > FillLayout with GLCanvas > But if i use the AbsoluteLayout the GLCanvas will cover the Button, despite > the button order is higher. > If this bug you have discovered is not yet covered by our SWT related bugs, pls be so kind and create a new BUG entry. Add all the information available (not just a forum link, since forum info is transient). Pls see Wiki/JOGL-FAQ/Bugreport. Thank you! ~Sven signature.asc (911 bytes) Download Attachment |
Thank Sven Gothel very much! I will collect the file and report the bug soon. The problem doesn't happen in window ( i have tested under windows 8 x64), it seem to be it only happen under mac osx
|
Administrator
|
Hi Tuan,
As I mentioned on my blog, I haven't tried floating a button over a GL canvas (either Eclipse's canvas or JogAmp's canvas) so I can't say whether it works properly or not. Supposedly later children are higher in the z order, so you might try just putting the button in after the GL canvas instead of before. Or you could put code in your GL canvas repaint that dirties the button, so it'll get painted afterwards. |
Dear Wade Walker,
Thanks for paying attention for this problem. I have tried to changed the order of the button but it didn't work. I have read your response on your blog but i don't know how to put code in to the GLCanvas repaint as you suggest (actually i don't really understand your solution). Would you like to post a snippet as a suggestion. By the way, this problem happens on MacOS, i tested the app under windows it work, the button is not overlayed by the GLCanvas. Here is the result tested under windows 8 x64 |
Free forum by Nabble | Edit this page |