
Originally Posted by
wysota

Originally Posted by
artoonie
I'm using a QTimer...QUOTE]
Show us the code.
It's been established that timers are not the way to go, but I'll paste what I have:
Flickerer
::Flickerer(int timerInterval,
QWidget *parent
) { connect( m_timer, SIGNAL(timeout()), this, SLOT(timeOutSlot()) );
m_timer->start( timerInterval );
}
void Flickerer::timeOutSlot()
{
showingG1 = !showingG1;
updateGL();
}
void Flickerer::paintGL()
{
if(showingG1) /* paints gradient 1 */ else /* paints gradient 2 */
}
Flickerer::Flickerer(int timerInterval, QWidget *parent) {
m_timer = new QTimer( this );
connect( m_timer, SIGNAL(timeout()), this, SLOT(timeOutSlot()) );
m_timer->start( timerInterval );
}
void Flickerer::timeOutSlot()
{
showingG1 = !showingG1;
updateGL();
}
void Flickerer::paintGL()
{
if(showingG1) /* paints gradient 1 */ else /* paints gradient 2 */
}
To copy to clipboard, switch view to plain text mode
QTimer can be set in whole milliseconds only. Approximating a 1/60 seconds rate with 16 msecs will lead a whole frame difference in time after 24 or 25 frames even if the timer events were perfectly spaced. A 17 msec approximation will extend the sync out to around 48-50 frames. QTimer events are processed when the program returns to the event loop after the time has expired. Depending on what else the program is doing, like rendering your gradient, this might be a significant delay. The combination of the two will lead to a mismatch that is variable with activity.
MythTV can use timers to maintain video refresh sync, but I believe it also has extensive frame counting over relatively long periods to determine the average frame rate and drops/duplicates frames to realign things periodically. The preferred method in MythTV is to use the OpenGL vsync. I don't know how this can be accessed.
I agree- I need to use OpenGL vsync but I don't know how to get a signal from the display so I'd know when to update.
Thanks you.
Bookmarks