Re: Render problems for custom context menu in OpenGL / SWT
Posted by alexsb on Jan 14, 2011; 2:57pm
URL: https://forum.jogamp.org/Render-problems-for-custom-context-menu-in-OpenGL-SWT-tp2255271p2255893.html
Hi,
thanks guys for trying to help!
Here's the code I use to create the menu:
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
manager.getParentGLCanvas().getParentComposite()
.notifyListeners(SWT.MouseDown, new Event());
Menu menu = new Menu(manager.getParentGLCanvas()
.getParentComposite().getShell(), SWT.POP_UP);
Point point = manager.getParentGLCanvas().getParentComposite()
.toDisplay(0, 0);
System.out.println(point);
menu.setLocation(point.x + pick.getPickedPoint().x, point.y
+ pick.getPickedPoint().y);
MenuItem item = new MenuItem(menu, SWT.PUSH);
item.setText("Popup");
item = new MenuItem(menu, SWT.PUSH);
item.setText("Popup1");
item = new MenuItem(menu, SWT.PUSH);
item.setText("Popup2");
item = new MenuItem(menu, SWT.PUSH);
item.setText("Popup3");
item = new MenuItem(menu, SWT.PUSH);
item.setText("Popup4");
item = new MenuItem(menu, SWT.PUSH);
item.setText("Popup5");
// manager.getParentGLCanvas().getParentComposite().setMenu(menu);
menu.setVisible(true);
}
});
SWT is not really mandatory, however, we are using Eclipse RCP - so it would be natural to do so. In the long run (as soon as the GLCanvas of SWT ever becomes reliable for all Platforms) we want to get completely rid of AWT.
We're using the latest jogl2 beta with GL2.