mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 03:25:10 +00:00
WGL: Fix count of displayable pixel formats
We only care about displayable pixel formats (as defined in WGL_ARB_pixel_format) for window context creation. This changes pixel format enumeration to ignore non-displayable formats, which are specified to be listed after displayable ones, by always using the return value of DescribePixelFormat as the pixel format count.
This commit is contained in:
parent
ef6c9d8b4f
commit
2c0f34b60f
@ -72,18 +72,13 @@ static int choosePixelFormatWGL(_GLFWwindow* window,
|
|||||||
int attribs[40];
|
int attribs[40];
|
||||||
int values[sizeof(attribs) / sizeof(attribs[0])];
|
int values[sizeof(attribs) / sizeof(attribs[0])];
|
||||||
|
|
||||||
|
nativeCount = DescribePixelFormat(window->context.wgl.dc,
|
||||||
|
1,
|
||||||
|
sizeof(PIXELFORMATDESCRIPTOR),
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (_glfw.wgl.ARB_pixel_format)
|
if (_glfw.wgl.ARB_pixel_format)
|
||||||
{
|
{
|
||||||
const int attrib = WGL_NUMBER_PIXEL_FORMATS_ARB;
|
|
||||||
|
|
||||||
if (!wglGetPixelFormatAttribivARB(window->context.wgl.dc,
|
|
||||||
1, 0, 1, &attrib, &nativeCount))
|
|
||||||
{
|
|
||||||
_glfwInputErrorWin32(GLFW_PLATFORM_ERROR,
|
|
||||||
"WGL: Failed to retrieve pixel format attribute");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ADD_ATTRIB(WGL_SUPPORT_OPENGL_ARB);
|
ADD_ATTRIB(WGL_SUPPORT_OPENGL_ARB);
|
||||||
ADD_ATTRIB(WGL_DRAW_TO_WINDOW_ARB);
|
ADD_ATTRIB(WGL_DRAW_TO_WINDOW_ARB);
|
||||||
ADD_ATTRIB(WGL_PIXEL_TYPE_ARB);
|
ADD_ATTRIB(WGL_PIXEL_TYPE_ARB);
|
||||||
@ -121,13 +116,6 @@ static int choosePixelFormatWGL(_GLFWwindow* window,
|
|||||||
ADD_ATTRIB(WGL_COLORSPACE_EXT);
|
ADD_ATTRIB(WGL_COLORSPACE_EXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
nativeCount = DescribePixelFormat(window->context.wgl.dc,
|
|
||||||
1,
|
|
||||||
sizeof(PIXELFORMATDESCRIPTOR),
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
|
usableConfigs = _glfw_calloc(nativeCount, sizeof(_GLFWfbconfig));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user