OpenGL using Qt 5.2.1

  • Hi, I would like to use Qt for a course on OpenGL I'll be supervising early next year. The thing is, the version of Qt installed on the machines that we can use is 5.2.1. What would be the recommended workflow here, using a QWindow with QOpenGLContext? In 5.4+ I'd use a QOpenGLWindow or QOpenGLWidget.

  • Qt Champions 2017

    Updating to 5.4+ is not an option?
    Lesson 1:
    Using the qt maintenance tool. :)

  • Well, I don't have the rights to update those machines (all running Ubuntu 14.04 LTS). It looks like I'll have to rely on using 5.2.1

  • Qt Champions 2017

    @Ailurus said:
    ok. it's a shame as QOpenGLWindow is somewhat more modern or
    at least it felt so.
    How many machines are there?
    Huge work I assume and the admins will run away screaming if you ask
    for upgrade?

  • Lifetime Qt Champion


    One alternative that you can propose to your IT service is use the online installer, no need for root rights to use that version of Qt and you'll have a modern setup to teach OpenGL.

  • Thanks both. There are 20-30 computers. Requesting updates that require packages from the standard Ubuntu 14.04 repositories is usually not a problem. It gets a bit trickier when a manual approach has to be used though :).

    Judging by your replies there doesn't seem to be a straightforward approach to use OpenGL with Qt 5.2.1 (without falling back on QGL* libraries)?

  • Lifetime Qt Champion

    OpenGL and Qt dates back way before Qt 5. It's just that "modern OpenGL" is a bit more recent and Qt 5.2.1 doesn't have yet everything it has now.

  • Qt Champions 2017

    You could read these 5 articles
    They give good info on what is available in my opinion.

  • Very nice example using the various shader stages! However, it seems to come down to either using something like QGLWidget or updating to 5.4+. Correct?

  • Moderators

    Although QOpenGLWindow and QOpenGLWidget are nice Qt5.4 convenience classes, you can still use a vanilla QWindow to render OpenGL. It is available starting with Qt5.0.
    It's a little more code to start but after that it's straightforward. The OpenGL Window Example shows how to use it.

    Still, updating to more recent Qt version is a preferred thing to do. There's no reason to teach people things that are outdated from the get go. The unnecessary boilerplate code will obscure the topic.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.