I'm new to JOGL, and, for some reason, I have to begin with SWT. Here is a piece:
public Trangles(GLCapabilities capabilities) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Composite composite = new Composite(shell, SWT.BORDER); GLWindow window = GLWindow.create(capabilities); NewtCanvasSWT canvas = new NewtCanvasSWT(composite, SWT.NO_BACKGROUND, window); window.addGLEventListener(new Event()); shell.setSize(300, 200); shell.open(); canvas.setVisible(true); //Here I meet the problem. //window.setVisible(true); while (!display.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } When I add the line "window.setVisible(true);", the whole shader works well, and I get a red triangle in a new dialog window with the shell still blank. I fail to mix there two window no matter I arrange the NewtCanvasSWT. Is there any method dealing with it? Trangles.java |
Administrator
|
On 04/21/2013 08:21 AM, Fafnir [via jogamp] wrote:
> I'm new to JOGL, and, for some reason, I have to begin with SWT. Here is a piece: > > public Trangles(GLCapabilities capabilities) > { > Display display = new Display(); > Shell shell = new Shell(display); > shell.setLayout(new FillLayout()); > Composite composite = new Composite(shell, SWT.BORDER); > GLWindow window = GLWindow.create(capabilities); > NewtCanvasSWT canvas = new NewtCanvasSWT(composite, > SWT.NO_BACKGROUND, > window); > window.addGLEventListener(new Event()); > > shell.setSize(300, 200); > shell.open(); > canvas.setVisible(true); > > //Here I meet the problem. > //window.setVisible(true); > > while (!display.isDisposed()) > { > if (!display.readAndDispatch()) > display.sleep(); > } > display.dispose(); > } > > When I add the line "window.setVisible(true);", the whole shader works well, > and I get a red triangle in a new dialog window with the shell still blank. I > fail to mix there two window no matter I arrange the NewtCanvasSWT. is there > any method dealing with it? > > Trangles.java <http://forum.jogamp.org/file/n4028988/Trangles.java> 'com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT' Maybe it's related to the fact that you don't issue your SWT calls on the SWT thread ? Pls test and check our test code and check difference w/ yours. Thx. ~Sven signature.asc (911 bytes) Download Attachment |
Hi, Sven. In "com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT", an Animator is built and the GLWindow is added to it. I'm so confused now because other basic initilizations look the same. The Eclipse report that my NewtCanvasSWT is not in used
|
Free forum by Nabble | Edit this page |