summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsglcontext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsglcontext.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index c45c34ae4d..e7e4028079 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -387,7 +387,12 @@ static int choosePixelFormat(HDC hdc,
iAttributes[i++] = WGL_DRAW_TO_WINDOW_ARB;
iAttributes[i++] = TRUE;
iAttributes[i++] = WGL_COLOR_BITS_ARB;
- iAttributes[i++] = 24;
+
+ iAttributes[i++] = (format.redBufferSize() > 0)
+ && (format.greenBufferSize() > 0)
+ && (format.blueBufferSize() > 0) ?
+ format.redBufferSize() + format.greenBufferSize() + format.blueBufferSize() :
+ 24;
switch (format.swapBehavior()) {
case QSurfaceFormat::SingleBuffer:
iAttributes[i++] = WGL_DOUBLE_BUFFER_ARB;