PDA

View Full Version : update problem



rimie23
13th May 2012, 20:45
Hi
i use qt+ogre
and i make animation to my object
it work good
but i have problem in update
when i clic on the window or i clic on dockwidget
it stop animation, but it start when i move the mouse only
(if i stop the moving of mouse the animation stop too)
that's my code


void OgreWidget::paintEvent(QPaintEvent *e)
{

ogreRoot->_fireFrameStarted();

ogreRoot->_fireFrameRenderingQueued();

ogreRenderWindow->update();
ogreRoot->_fireFrameEnded();
number_frame=number_frame+10;

if(number_frame<framme.size())
animation1();
ogreRenderWindow->update();
animation2();
ogreRenderWindow->update();

e->accept();
ogreRenderWindow->update();
//update();
}

if i do not delete "update()" it show/delete/show/delete.....(paint and repaint ) the scene

amleto
13th May 2012, 21:30
animation should not be 'hard coded' in paint event because you do not know how often pain event will be called.


try these instead
http://qt-project.org/doc/qt-4.8/qtimeline.html
http://doc.trolltech.com/solutions/4/qtanimationframework/animation.html

rimie23
13th May 2012, 21:41
thanks for repling
i do not use timer to animate
it's not traditionnal animation
her i have the number of frame and the position of the objects in each frame,
i tried to put it an void out the paint and call it it dos not work

amleto
13th May 2012, 21:54
and thats why you should look at
http://qt-project.org/doc/qt-4.8/qtimeline.html

you shouldnt be updating frame number in paint event