The problem is rather basic, but i tried hard and found no spec, presentation, tutorial or code example that would carify this.
BOOL SetPixelFormat(HDC hdc, iPixelFormat, CONST PIXELFORMATDESCRIPTOR * ppfd)
My question: What value should be passed in the ppfd parameter, in situation where the iPixelFormat was obtained with WGL_ARB_pixel_format ?
When you use plain WGL, according to MSDN code example, may pass here the PIXELFORMATDESCRIPTOR struct you filled when obtaining iPixelFormat with ChoosePixelFormat.
But when you use WGL_ARB_pixel_format, there is problem, because wglChoosePixelFormat doesn’t use PIXELFORMATDESCRIPTOR, so you don’t have any struct ready to use.
I tried 2 ways:
-
pass NULL here
MSDN in some fuzzy (to me) way suggests the ppfd is somewhat useless, but it says nothing about passing NULL -
use DescribePixelFormat on the iPixelFormat to fill the struct, and pass it here
But is it safe to call DescribePixelFormat on format which cant be described by the PIXELFORMATDESCRIPTOR?
I tested both ways, and both seems to work But i’d like to know, what is the right and safe way, way that works on any HW, driver or Windows version…