Nominate our 2022 Qt Champions!

Using Qt to render world space UI in a 3D application

  • Hi!

    We are working on a VR application using a custom OpenGL renderer. Currently, we are using our own UI system to display an interface to the user in VR. We are considering upgrading this UI to use Qt if we can get it running. The UI is a flat plane in 3D that the user can interact with using the motion tracked controller as a laser pointer). Similar to the menu in SteamVR:

    alt text

    Basically, what we need is a way to render a Qt UI into an OpenGL framebuffer, so that we can display it on a world space quad. And we need to be able to simulate mouse events manually by raycasting from the motion controllers through the UI.

    Searching for this topic, I mostly found guides on how to embed OpenGL rendering inside a 2D Qt GUI. Unfortunately, we need the exact opposite of that, i.e. embedding a 2D Qt GUI in a 3D OpenGL rendering.

    Is this advisable (or even possible) to achieve or should we look for a different solution? Thank you!

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Here's the Qt WS 2017 talk about using Qt with VR.

  • @SGaist Thanks. The example they show uses the QtQuickRenderControl class to render the UI into a texture. Is it possible to do the same for QtWidget based UI?

  • Lifetime Qt Champion

    I can't tell for sure however I doubt it. Widgets are not rendered through OpenGL. However, you can create a widget like UI using QtQuick.Controls 2 which is likely a better option if you want to have a nicely animated UI in your virtual world.

  • @SGaist Okay, I will check it out. Thank you.

Log in to reply