Excuse me Charles,
Peter came up with this the first so we'll do it the FIFO style.
@Peter:
No Peter, this is not correct and you're misleading people who might be reading this thread in the future.
1. Charles uses a PFD_DOUBLEBUFFER format for his OpenGL context which means the OpenGL scene is first drawn into the memory backbuffer and it is blitted and becomes visible on the screen
only after a call to Gdi32's SwapBuffers() and that's what Charles' OpenglSceneFrame.inc uses, or OpenGL's wglSwapBuffers(). In other words, you will not see any effect whatsoever from either glFlush() or glFinish() simply because they are drawing to the invisible backbuffer.
2. The immediate effect of glFlush() and glFinish() may be seen only if OpenGL is supposed to draw directly onto the window's canvas, in which case pfd.dwFlags should not have the PFD_DOUBLEBUFFER flag but rather PFD_DRAW_TO_WINDOW and PFD_SUPPORT_OPENGL only. But such drawing is very flickery similar to unbuffered CS_HREDRAW+CS_VREDRAW window resize.
3. glFlush()
does not wait until the drawing operations are completed! It exits immediately on notifying OpenGL that completion is requested in a finite period of time which in plain English means not later than
the next frame. Contrary to that, glFinish() pulls OpenGL down to ensure that all draw calls are completed
before the current frame is swapped onto the window. In other words, this pair of functions complement each other similar to SendMessage()/PostMessage() or GetMessage()/PeekMessage().
4. I repeat again, you
do not have to use either of these functions with a PFD_DOUBLEBUFFER pixel format except for a couple of rare and very special cases because you
will not see any visible effect no matter what you do!
@Charles:
Now the two very rare and special cases that might occur for an extremely inquisitive OpenGL coder are:
1. glGetPixels() in order to make a copy of the backbuffer contents, e.g. to save a screenshot; and
2. take a measurement related to draw calls in a frame, in which case a successful tester should use a call to
glFinish() due to the reasons I stated above.
3. I was talking about MSAA for tens of thousands of textured polies where each extra draw pass is a heavy strain. The difference between 4x and 8x MSAA will not be that significant in a poorly populated scene.
Gentlemen, I am very serious now and I know what I'm talking about. Just google for "glFlush glFinish" and you will find a ton of proof to what I'm telling you here.
Thanks for your attention.
P.S. Charles, will you please inform us of your MSAA timings with glFinish() instead of glFlush()? And please don't use either of them for ordinary rendering. You'll be wasting your time even typing them to say nothing of waiting for the actual calls to take any visible effect.