Animating with QGLWidget OpenGL
-
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?
-
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. -
Thanks, I'll have a look at it and come back to you later..
-
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."
? -
This does not answer my question, could somebody please help?