PDA

View Full Version : SwapBuffers or wglSwapBuffers?



MalcolmB
11-21-2005, 04:51 PM
This is a question I've been wondering for a while. Which of these functions is the correct one to use? The OpenGL FAQ says use SwapBuffers, but gDebugger by Graphics Remedy only allows you to use wglSwapBuffers as a frame terminator. Anyone know the difference?

11-21-2005, 05:02 PM
It's mentioned in the FAQ:
http://www.opengl.org/resources/faq/technical/mswindows.htm

The wgl flavors are mainly for dynamic linking of the OpenGL procs, where there would otherwise be an ambiguity between GDI and OpenGL ICD procs with the same names. I imagine this factors into how that gDebuger does its stuff, but I don't know for sure. :)

MalcolmB
11-21-2005, 05:15 PM
I guess thats the next question, I'm having trouble finding a on-point answer about what an ICD vs. a GDI is. I know it stands for 'installable client driver' and they were used when OpenGL was first getting started. But are the drivers we install nowadays with our video cards ICDs?

I did find those answers in the FAQ but the article they link to at the bottom which is supposed to explain this in more detail is a dead link (http://www.hardwidge.org.uk/).
I was worried the FAQ question was also out of date..

Thanks

11-21-2005, 05:26 PM
Maybe you're thinking about MCDs (mini client drivers) used in the days of Quake1 and all that, that basically provided a minimal implementation of accelerated OpenGL. I don't hardly remember the details of it all, as it all sounded perfectly sinister at the time. But yes, ICDs are what we have today. GDI (graphics device interface) is just Windows way of doing drawing (pens, brushes, bitmaps, etc), and there is cooperation between GDI and the ICD, obviously, but the implementations are totally independent.

11-21-2005, 08:00 PM
To clarify that last point, the ICD can implement the 2D GDI, but GDI itself is a device interface provided by Windows. So since GDI and the ICD share function names like SwapBuffers, a wglSwapBuffers is needed to avoid ambiguity when loading the proc dynamically.

And the MCD wasn't really sinister at all, but Microsoft sure thought so :)

To be sure, I'm not really certain of the details, and in all likelihood they're all due to change in future operating systems and driver models. What about GDI+? Alas, who knows, and perhaps more importantly, who really cares? I keep meaning to grab a DDK, to get an inside look at this stuff, but I can never seem to drum up enough interest. :)

Sorry I don't have a more definitive answer for you :)