updateGL(); and only if your objects are animated. In your static example you do not need any timer.
Qt should redraw (ie, call updateGL automatically) every time you move a window over your program.
I don't see any mistake on your code. Maybe you do not set up a view properly.
Try clearing also Z-Buffer
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
And double buffer is activated by default, so remove that code, is useless.
Another suggestion, glViewport modifies your proyection matrix, try to write this:
glViewport (0, 0, (GLint)w, (GLint)h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
glOrtho or perspective
And do not forget to load default identy matrix every time you draw something:
glClear (GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f (1,0,0);
...
Bookmarks