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

Neha Bhende bhenden at vmware.com
Wed May 3 21:13:11 UTC 2017


Looks good to me. For the series,


Reviewed-by: Neha Bhende<bhenden at vmware.com>


Regards,

Neha

________________________________
From: Brian Paul <brianp at vmware.com>
Sent: Wednesday, May 3, 2017 12:49:40 PM
To: mesa-dev at lists.freedesktop.org
Cc: Charmaine Lee; Neha Bhende
Subject: [PATCH 2/2] wglgears: fix up wglChoosePixelFormatARB() attribute list

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170503/30921618/attachment.html>


More information about the mesa-dev mailing list