SwapBuffers! On Windows

I’ve been tuning my program and it turned out
the function “SwapBuffers()” was taking most of the time.

One of my books says “Most systems have a limited amount of memory to hold buffers for OpenGL. Under Windows, if you pick a combination of buffers that cannot be supported by the graphics cadr, the Microsoft generic(software) OpenGL implementation takes over,
eliminating hardware acceleration. To help prevent this from happening, you should only select the buffers that you really need.”

I’am using NVIDIA FX1400 which has 256M and I checked the buffer selection of my program and found nothing unusual.

I get the performance curve (#of polygons vs time) for hardware drawing. It’s shape was a step not linear. I ran my application on linux which is using same hardware and the shape was linear.

Any advice will be very much appreciated.


'the function “SwapBuffers()” was taking most of the time. ’
usually cards drivers will buffer things up and then draw them all at once. ie when u call glDrawElements(…) etc it doesnt draw instantly

Should have explained more detail!

I tested with several millions of polygons on the
(1)SUN UNIX Solaris10-with SVR1200 Graphics card(30mil-tri/sec-benchmark) and got the same order of performance.
(2)On HP desktop (xw4100) with NVIDIA FX1400.
(2-a) Linux Enterprise:
Got reasonable performance
(2-b) XP:
After profiling, found swap buffer took most
of the time for the XP though I spent a lot
of time to use display list
and vertex arrays which have little effect
on the performance due to the bottle neck
of swapbuffers.
Unlike on the other platforms,
the performance curve was not linear
but step-wise.

For examles, it took 
   the same 34 sec for the 100K-1M polys
   and 2M-4M 79sec 
   and 5M-7M 110sec etc.

So, glXSwapBuffer for the SUN and Linux worked.
But SwapBuffers() for the widnow did not work properly cause it wasn’t linear. Why is it?


Hmmm, are you sure, that you have ‘Wait Retrace’ switched off in your driver? Otherwise it would wait with the swapping until the next retrace.
If you have 60Hz screen refresh you would only get framerates of 60fps (frames per second), 30fps, 20fps … for more and more polygons to be displayed.
This would give a step-like function. If you switch it off, it should be linear.