Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Animating with QGLWidget OpenGL
Qt 6.11 is out! See what's new in the release blog

Animating with QGLWidget OpenGL

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JerichoJosh
    wrote on last edited by
    #1

    Hi,

    I'm a beginner with graphics programming, but I do want to program quite low-level (it must be fast, for a project).
    I would like to know how to use the drawing methods in the "Hello-OpenGL"-example for animation.

    "Hello-OpenGL-example (from http://qt-project.org/wiki/developer-guides)":http://download.qt-project.org/learning/developerguides/qtopengltutorial/opengl_src.zip

    I've already used these drawing methods (initalizeGL(), resizeGL() and painGL() ) to draw a few things.

    My question is: how do I make this white triangle translate and rotate an x-amount per second?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      john_god
      wrote on last edited by
      #2

      Hi
      You have to declare a QTimer event in your widget. Then on your TimerEvent you update your translation and rotation matrices.
      Check this example http://qt-project.org/doc/qt-5.0/qtgui/openglwindow.html
      right now I'm not sure but I think it's animated.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JerichoJosh
        wrote on last edited by
        #3

        Thanks, I'll have a look at it and come back to you later..

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JerichoJosh
          wrote on last edited by
          #4

          The example link you gave is an animation.
          However, it doesn't use QTimer at all.
          Could you explain with code what exactly you mean with:
          "Then on your TimerEvent you update your translation and rotation matrices."
          ?

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JerichoJosh
            wrote on last edited by
            #5

            This does not answer my question, could somebody please help?

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved