wglChoosePixelFormatARB returns ERROR_INVALID_DATA

On a certain low-end PC, wglChoosePixelFormatARB returns FALSE and GetLastError() is ERROR_INVALID_DATA (0xC007000D). The call looks like


UINT	numFormats = -1;
int	theFormat = 0;

int	atts[] =
{
	WGL_SAMPLES_ARB, 4,
	WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
	WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
	WGL_SAMPLE_BUFFERS_ARB, 1,
	WGL_STENCIL_BITS_ARB, 8,
	0, 0
};

if (wglChoosePixelFormatARB( hdc, atts, NULL, 1, &theFormat,
					&numFormats ))

This machine doesn’t have any multisample formats, so I would have expected wglChoosePixelFormatARB to return a result of TRUE but set numFormats to 0. Is this just the way it works, or am I likely to be doing something wrong? On a different PC I do get a pixel format.

WGL_SAMPLES_ARB is defined by the WGL_ARB_multisample extension. If that extension isn’t supported, you cannot use that enum.

Oh, I forgot to say… even though this driver does not have any multisample pixel formats, it claims to support OpenGL 1.3, which in theory should mean that multisampling is supported. So I didn’t think I had to check for WGL_ARB_multisample. Is it possible for GL_ARB_multisample to be supported but not WGL_ARB_multisample?

Well, we talk about driver writers here :slight_smile: I don’t know if the specification requires WGL_ARB_multisample support (although I woudl be surprised if it would – this is a OS-dependent extension), but the safest way is to double-check everything.

OK, thanks.

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