With this code, the problem is more evident.
int main (...) {
// ...
GLTest * gl_test = new GLTest ();
gl_test -> resize (300,300);
gl_test -> show ();
QTimer :: singleShot (1000, gl_test,
SLOT(update
()) );
}
int main (...) {
// ...
GLTest * gl_test = new GLTest ();
gl_test -> resize (300,300);
gl_test -> show ();
QTimer :: singleShot (1000, gl_test, SLOT(update()) );
}
To copy to clipboard, switch view to plain text mode
After a second, the window is painted correctly. However as soon as anything disturbs it, another window passing in front for example, the image is destroyed.
The problem with using a timer to trigger a refresh is that in between refreshes the image can be destroyed. If the update is happening at 0.2 frames per second the window SHOULD be able to repaint itself without updating in-between frames.
Forced updates are a hack, not a solution, and this isn't OpenGL-specific -- ordinary windows do not have to perform a full-depth repaint every time the mouse passes over them!
What have I got wrong?
Bookmarks