Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
kiyu727's avatar
kiyu727
Honored Guest
10 years ago

OpenGL Gui

Greetings,

Im working with the DK2 and Leapmotion and got the base app done with Qt and QWindow.
(This took me longer than expected due to Nvidia Optimus, now I switched to non Optimus Laptop and all issues are gone 8-) )

Now Id like to add some GUI elements to enable the user for example to load meshes (file browser).
So my question is if anyone has a resource (book, webpage, lib, etc) regarding programming (virtual) GUIs in OpenGL.
Ive read the virtual GUI part on OculusRiftInAction and would be glad if anyone can point me to some more.

My current idea would be to render some text to simulate a filebrowser and track positions of the finger when the user does a click motion (with LeapMotion controller). That way I could distinguish which buttons a user clicks and update the text.
The reason I want to draw the filebrowser myself is that I believe that common filebrowsers are not made for virtual fingers to click. I would probably have to render those as a texture into my VR scene, so I might as well just make my own, more fingerfriendly one.

Maybe Im wrong, you may point that out if you see fit.

Thanks in advance for any input.

1 Reply

  • "kiyu727" wrote:
    Greetings,

    Im working with the DK2 and Leapmotion and got the base app done with Qt and QWindow.
    (This took me longer than expected due to Nvidia Optimus, now I switched to non Optimus Laptop and all issues are gone 8-) )

    Now Id like to add some GUI elements to enable the user for example to load meshes (file browser).
    So my question is if anyone has a resource (book, webpage, lib, etc) regarding programming (virtual) GUIs in OpenGL.
    Ive read the virtual GUI part on OculusRiftInAction and would be glad if anyone can point me to some more.


    More what exactly? If you're working with C++ / OpenGL (or D3D) and Qt, you've pretty much got the best OpenGL compatible UI available, QML. Qt 5.4 and higher supports rendering QML controls directly to an OpenGL texture, and passing keyboard and mouse input into those controls programatically. There are a very limited number of ways to do that.

    Aside from QML, there's 'Crazy Eddie's GUI' and libRocket, which both do the same thing, allow you to create control layouts, render them to OpenGL textures and feed them mouse and keyboard input. Unfortunately, neither CEGUI nor libRocket are anywhere near as feature rich and mature as QML. That said, QML does have it's drawbacks. The QQuickRenderControl that enables the offscreen rendering was only introduced in 5.4, so being a new feature it has the potential to have more bugs than you'd like (for instance, there are problems rendering to the QML surface if you're working with a Retina based mac, although there are workarounds).

    Additionally, not everything in QML works the way you'd want it to. QML was designed to create dialogs and windows, or more specifically, the contents of dialogs and windows. The actual frames and positioning on the desktop are normally assumed to be up to the WindowManager portion of the OS. So for instance if you use a Dialog element in your QML expecting it make a little UI with a border and a title bar and the ability to move stuff around, you'll be disappointed. Instead QML will create a new top level dialog window and nothing you put inside it will be rendered to the OpenGL surface. Similarly, if you use the QML file dialog, it will attempt to open a OS level file dialog, not put anything in OpenGL.

    So there's UI widgets like buttons and radio buttons and progress bars and list views, but there's still a lot you have to kind of build up for yourself.