Wglswapbuffers takes 4 frames or more to swap

I am using WinXP with an NVIDIA card.

I have an app which uses double buffering.

The Monitor refresh rate is 75Hz.

However wglswapbuffers seems to be taking ~47ms (and occasionally a lot longer) to swap. My drawing code is less then 1ms.

I had expected upto a frame to two frames delay, but not a four frame delay.

CPU usage is less then 10%.

Any suggestions as to what may be going wrong?

Thanks Damian

The GL commands you send are not processed syncronously. The card can render stuff whenever it wants.
To guarantee all GL commands have been actually processed, call glFinish();.

So to benchmark, you should only measure time between glFinish pairs.

EDIT: but of course this comes at the price of loosing some parallelism between GPU and CPU. glFlush(); tells the GPU to process commands but returns immediately.

Thanks for the tip.

I found that the problem was with my use of glEnable(GL_TEXTURE_2D) and glDisable(GL_TEXTURE_2D).

It appears that I need to disable the texture as soon as I have finished with it.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.