QOpenGLContext: Use color depth information from QSurfaceFormat
When a new QOpenGLContext is requested, the color depth information is now also taken into account on OS X and WGL. Task-number: QTBUG-37411 Change-Id: I69d04989a20de3ace041b009fbbdc03fa02cfdf8 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
parent
379238496d
commit
3ff15f1e98
@ -522,6 +522,10 @@ int QSurfaceFormat::alphaBufferSize() const
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Set the desired \a size in bits of the red channel of the color buffer.
|
Set the desired \a size in bits of the red channel of the color buffer.
|
||||||
|
|
||||||
|
\note On Mac OSX, be sure to set the buffer size of all color channels,
|
||||||
|
otherwise this setting will have no effect. If one of the buffer sizes is not set,
|
||||||
|
the current bit-depth of the screen is used.
|
||||||
*/
|
*/
|
||||||
void QSurfaceFormat::setRedBufferSize(int size)
|
void QSurfaceFormat::setRedBufferSize(int size)
|
||||||
{
|
{
|
||||||
@ -533,6 +537,10 @@ void QSurfaceFormat::setRedBufferSize(int size)
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Set the desired \a size in bits of the green channel of the color buffer.
|
Set the desired \a size in bits of the green channel of the color buffer.
|
||||||
|
|
||||||
|
\note On Mac OSX, be sure to set the buffer size of all color channels,
|
||||||
|
otherwise this setting will have no effect. If one of the buffer sizes is not set,
|
||||||
|
the current bit-depth of the screen is used.
|
||||||
*/
|
*/
|
||||||
void QSurfaceFormat::setGreenBufferSize(int size)
|
void QSurfaceFormat::setGreenBufferSize(int size)
|
||||||
{
|
{
|
||||||
@ -544,6 +552,10 @@ void QSurfaceFormat::setGreenBufferSize(int size)
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Set the desired \a size in bits of the blue channel of the color buffer.
|
Set the desired \a size in bits of the blue channel of the color buffer.
|
||||||
|
|
||||||
|
\note On Mac OSX, be sure to set the buffer size of all color channels,
|
||||||
|
otherwise this setting will have no effect. If one of the buffer sizes is not set,
|
||||||
|
the current bit-depth of the screen is used.
|
||||||
*/
|
*/
|
||||||
void QSurfaceFormat::setBlueBufferSize(int size)
|
void QSurfaceFormat::setBlueBufferSize(int size)
|
||||||
{
|
{
|
||||||
|
@ -114,6 +114,14 @@ void *qcgl_createNSOpenGLPixelFormat(const QSurfaceFormat &format)
|
|||||||
attrs << NSOpenGLPFAStencilSize << format.stencilBufferSize();
|
attrs << NSOpenGLPFAStencilSize << format.stencilBufferSize();
|
||||||
if (format.alphaBufferSize() > 0)
|
if (format.alphaBufferSize() > 0)
|
||||||
attrs << NSOpenGLPFAAlphaSize << format.alphaBufferSize();
|
attrs << NSOpenGLPFAAlphaSize << format.alphaBufferSize();
|
||||||
|
if ((format.redBufferSize() > 0) &&
|
||||||
|
(format.greenBufferSize() > 0) &&
|
||||||
|
(format.blueBufferSize() > 0)) {
|
||||||
|
const int colorSize = format.redBufferSize() +
|
||||||
|
format.greenBufferSize() +
|
||||||
|
format.blueBufferSize();
|
||||||
|
attrs << NSOpenGLPFAColorSize << colorSize << NSOpenGLPFAMinimumPolicy;
|
||||||
|
}
|
||||||
|
|
||||||
if (format.samples() > 0) {
|
if (format.samples() > 0) {
|
||||||
attrs << NSOpenGLPFAMultisample
|
attrs << NSOpenGLPFAMultisample
|
||||||
|
@ -387,7 +387,12 @@ static int choosePixelFormat(HDC hdc,
|
|||||||
iAttributes[i++] = WGL_DRAW_TO_WINDOW_ARB;
|
iAttributes[i++] = WGL_DRAW_TO_WINDOW_ARB;
|
||||||
iAttributes[i++] = TRUE;
|
iAttributes[i++] = TRUE;
|
||||||
iAttributes[i++] = WGL_COLOR_BITS_ARB;
|
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()) {
|
switch (format.swapBehavior()) {
|
||||||
case QSurfaceFormat::SingleBuffer:
|
case QSurfaceFormat::SingleBuffer:
|
||||||
iAttributes[i++] = WGL_DOUBLE_BUFFER_ARB;
|
iAttributes[i++] = WGL_DOUBLE_BUFFER_ARB;
|
||||||
|
Loading…
Reference in New Issue
Block a user