[Mesa-dev] [PATCH 2/2] wglgears: fix up wglChoosePixelFormatARB() attribute list

Brian Paul brianp at vmware.com
Wed May 3 19:49:40 UTC 2017


Specify WGL_DRAW_TO_WINDOW_ARB and WGL_COLOR_BITS_ARB.
Improve some comments, per Charmaine.
---
 src/wgl/wglgears.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/wgl/wglgears.c b/src/wgl/wglgears.c
index 7d43822..d673143 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,
-- 
1.9.1



More information about the mesa-dev mailing list