OpenGL: drawing during vertical retrace

Hi all,

After a lot of research, I turn here for help, since what I’ve found via Google isn’t working for me.

In short, I’m trying to get my SDL+OpenGL game to 1) only flip buffers during the vertical retrace, to avoid tearing, and 2) get the program to pause after drawing its quads until the buffer flip happens, so as to match the frame rate to the refresh rate.

Before calling SDL_SetVideoMode(), I have both these lines:


The second one should make it so it only swaps buffers during vertical retrace, right?

I also found the glFinish() function, which looked very promising. My understanding is that this is supposed to pause execution until the previous OGL operation finishes. However, my computer seems to ignore this entirely, as I get upwards of 130 frames a second with a 60 Hz monitor. Am I putting it in the wrong place in my rendering function, here?

curSprite->draw(); // draws a quad
glFinish(); // would like it to pause here!

I’m using Win XP, if that matters. Thanks for any advice you can give!