Before creating an OpenGL context on Windows, we need to call SetPixelFormat
for the Window's device context. Its function prototype is as follows:
BOOL WINAPI SetPixelFormat(
HDC hdc,
int iPixelFormat,
const PIXELFORMATDESCRIPTOR *ppfd);
When creating a fixed function context, we get a supported pixel format index by calling ChoosePixelFormat
with our desired pixel format, so the value that really matters is the value passed as the iPixelFormat
argument. And when creating a modern GL context, we still need to call SetPixelFormat
according to the docs
"Once you have a pixel format number, you can set it just like any pixel format with
SetPixelFormat
."
This is even though the PIXELFORMATDESCRIPTOR
structure is not really relevant. In this case, I've just been passing NULL
.
Does it matter what I pass as the third parameter to SetPixelFormat
? If so, when?