setParent help

Started by Lotho, July 10, 2014, 12:42:52

Previous topic - Next topic

Lotho

I'm working on a tool and have just finished the 3D environment and started with the GUI. I'm using Display.setParent(canvas) to fit my 3D environment inside a AWT gui but as soon as i trigger any actionlistener the controls stops working for both the display and the gui. I've understood that lightweight and heavyweight applications doesn't work well together but then what's the purpose of .setParent? Am I missing something? Is there any good way to have an opengl application inside a AWT/swing gui?

Cornix


Lotho

Quote from: Cornix on July 10, 2014, 13:07:18
Maybe this can help you:
http://lwjgl.org/forum/index.php/topic,5345.msg28779.html#msg28779

I managed to get it to work recently.

Thanks for the example!

First of all: your program worked fine as it was with overlapping menus and everything (Windows 7 x64).

But: When I tried to simply remove your openGL display and use setParent(canvas) on my display (which uses shaders and vbos) the buttons disappeared and the only thing visible was my display:



In addition the mouse and keyboard inputs are still screwed up when rendering inside the window. I might be able to fix it, but I'm not really sure where to start. I'm not making a new thread to render, might be that.

Cornix

You MUST make a new thread for rendering.
You should NEVER do anything in the EDT that is not Swing-related.

Lotho

Quote from: Cornix on July 11, 2014, 06:45:30
You MUST make a new thread for rendering.
You should NEVER do anything in the EDT that is not Swing-related.

Sweet, that did the trick! I should probably read up a bit on threading :)