Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] QGL vs QOpenGL



  • Hi everyone!

    I recently switched to Qt for developing OpenGL applications.

    Can someone tell me what the difference between QGL and QOpenGL is? Regarding the API QOpenGL seems to be more the OpenGL I am familiar with.

    I am writing desktop applications in which I process huge amounts of data.

    I searched the web before but didn't find a satisfying answer.

    Cheers, Fiete


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    QGLXXX are the old classes started in Qt 4. The QOpenGLXXX are the new one that you should use for new code. Also internally the QGL class uses QOpenGL.

    Happy coding !



  • Dear SGaist,

    thank you very much for your reply and saying welcome :)

    As a following questions:

    Are QGLWidgets then also outdated? I understood it in a way that once one wants to use widget features one would still use them, but if one wants to save memory and is not in need of widget functionality, one would go for QQuick 2+, right?

    Happy coding, too!


  • Lifetime Qt Champion

    No they are not, internally they use the QOpenGL classes.

    It all depends on your needs. You can use QWindow for pure OpenGL application.

    See this "article":http://www.kdab.com/opengl-in-qt-5-1-part-1/ and the followings from Sean Harmer



  • Dear SGaist,

    thanks for the clarification. I watched both of the OpenGL takls of Dr. Sean Harmer at the QtDD12 but apparently misunderstood that detail.

    For all the others who stumble over this post: in case you are interested in OpenGL in Qt, the videos mentioned above are awesome.

    http://www.youtube.com/watch?v=VxsS7u-vgc8

    http://www.youtube.com/watch?v=GYa5DLV6ADQ


  • Lifetime Qt Champion

    You're welcome !

    He knows his way around OpenGL like no other :)

    If this answers your question, please also update the thread title prepending [solved] so other forums users may know :)


Log in to reply