Congratulations to our 2022 Qt Champions!

Recommended way of using OpenGL with Qt5

  • I'm very soon going to be using OpenGL and Qt in my project at university. I have previously experimented with using the Qt3D external library but I have heard from some that it's somewhat outdated/obsolete, though I'm not aware of whether there is any equivalent library I can use. I'll need to use QGLWidgets (specifically not windows, as I need to embed and arrange the OpenGL viewports in the same way as any other widget) and performance-enhancing features of modern OpenGL (vertex buffers etc.) would be preferred. The convenience of the Qt3D library in terms of building and rendering geometry would also be a plus, even if it were not Qt3D specifically, as I'd rather not have to write a load of classes to handle this myself.

    What would be my best option in these circumstances?


  • Moderators

    Qt3D will be part of Qt 5.5 or 5.6: it is actively maintained and developed, but not ready for casual use just yet.

    In Qt 5.4, QOpenGLWidget becomes fully operational and QGLWidget is deprecated. So you should use QOpenGLWidget in your code. Also, since Qt 5.3, there are a lot of new helper classes and functions to make OpenGL development easier and faster.

    So, the answer is: Qt3D is coming, and for now you can use QOpenGLWidget, just make sure to use the newest available version of Qt.

  • Cool, that's great. Will I be able to use the manually-compiled Qt3D until it's integrated? Things like QGLCamera were quite useful.

  • Moderators

    I guess you could, but that codebase is rather old, as far as I know.

  • The Qt3D rewrite is happening in the wip/newapi branch.

Log in to reply