summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2017-05-03 13:48:10 -0600
committerBrian Paul <brianp@vmware.com>2017-05-03 21:34:10 -0600
commitc53456d19a79aa6165f10ba9057e8bf7ab42952d (patch)
treee301ae11ab731dd16275cdbe685f590a2336b25e
parentd752f909e36d4c5a1908a8df88da3e139e4df5cb (diff)
wglgears: fix up wglChoosePixelFormatARB() attribute list
Specify WGL_DRAW_TO_WINDOW_ARB and WGL_COLOR_BITS_ARB. Improve some comments, per Charmaine. Reviewed-by: Charmaine Lee <charmainel@vmware.com> Reviewed-by: Neha Bhende<bhenden@vmware.com>
-rw-r--r--src/wgl/wglgears.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/wgl/wglgears.c b/src/wgl/wglgears.c
index 7d43822a..16035b6e 100644
--- a/src/wgl/wglgears.c
+++ b/src/wgl/wglgears.c
@@ -421,11 +421,12 @@ make_window(const char *name, int x, int y, int width, int height)
}
if (use_srgb) {
- /* For sRGB we need to use the wglChoosePixelFormatARB() function,
- * and then create a new context, window, etc.
+ /* We can't query/use extension functions until after we've
+ * created and bound a rendering context (done above).
*
- * Note: we can't query/use extension functions until after we've
- * creatend and bound a rendering context.
+ * We can only set the pixel format of the window once, so we need to
+ * create a new device context in order to use the pixel format returned
+ * from wglChoosePixelFormatARB, and then create a new window.
*/
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB_func =
(PFNWGLCHOOSEPIXELFORMATARBPROC)
@@ -434,8 +435,8 @@ make_window(const char *name, int x, int y, int width, int height)
static const int int_attribs[] = {
WGL_SUPPORT_OPENGL_ARB, TRUE,
- //WGL_COLOR_BITS_ARB, 24,
- //WGL_ALPHA_BITS_ARB, 8,
+ WGL_DRAW_TO_WINDOW_ARB, TRUE,
+ WGL_COLOR_BITS_ARB, 24, // at least 24-bits of RGB
WGL_DEPTH_BITS_ARB, 24,
WGL_DOUBLE_BUFFER_ARB, TRUE,
WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, TRUE,
@@ -452,6 +453,7 @@ make_window(const char *name, int x, int y, int width, int height)
}
assert(numFormats > 0);
printf("Chose sRGB pixel format %d (0x%x)\n", pixelFormat, pixelFormat);
+ fflush(stdout);
PIXELFORMATDESCRIPTOR newPfd;
DescribePixelFormat(hDC, pixelFormat, sizeof(pfd), &newPfd);