LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: i-make-robots on April 07, 2014, 00:14:58

Title: LWJGL + Swing for my robots?
Post by: i-make-robots on April 07, 2014, 00:14:58
Hi!

I'm working on a program to simulate the movment of my robots in OpenGL so that they can be programmed offline.  

(http://i.imgur.com/WXmkTnx.png)

https://www.youtube.com/watch?v=ObzyILAJFGQ

http://www.marginallyclever.com/shop/robot-arms/palletizing-robot-1

I've got the visuals and the inputs all working fine.  Now I want to connect through to the real robot with RXTX and I've hit a bit of a snag.  I need menus, and that means I need a GUI beyond OpenGL.

It seems I can choose between swing (which kills LWJGL Mouse), add a GUI library like TWL (which I tried and gave up on) or roll my own (not enough time).

Is there a way to get LWJGL and swing to play nicely together?  I only want mouse movement and buttons to be "heard" when the cursor is on top of the Display/canvas.

Maybe LWJGL is the wrong direction to go?  If so I'd love some advice on the right way to set up an opengl window.  I'd like to extend this system later to support my other robots, as well.

Thanks!
Title: Re: LWJGL + Swing for my robots?
Post by: quew8 on April 07, 2014, 20:05:18
It is very possible but I've always found it to be error prone and extremely annoying to program. My advise would be to have two different windows running in the same application. One LWJGL, one Swing (or JavaFX, awt, whatever you want to use). You can have one of them running on a different thread and queue events between them. That's how have done it in the past and I've found it to be much easier than worrying about all the windowing and GUI problems.
Title: Re: LWJGL + Swing for my robots?
Post by: Oebele on April 07, 2014, 21:33:36
Maybe Nifty GUI is an option?
http://nifty-gui.lessvoid.com/