summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorJani Hautakangas <jani.hautakangas@nokia.com>2011-12-09 12:40:29 (GMT)
committerJani Hautakangas <jani.hautakangas@nokia.com>2011-12-09 15:13:59 (GMT)
commit54613aec3bdac668d198923814873a9e622ad675 (patch)
tree0ea1e26e8199900e6f314242653ceb0bb4ec63a6 /src/opengl
parent5fbd3e1aacf789cc46fef57d8726333ee8a00e03 (diff)
downloadQt-54613aec3bdac668d198923814873a9e622ad675.zip
Qt-54613aec3bdac668d198923814873a9e622ad675.tar.gz
Qt-54613aec3bdac668d198923814873a9e622ad675.tar.bz2
Fix window surface config on OpenGL graphics system.
QtOpenGL uses 16-bit configs by default but on Symbian it should use 32-bit config. Task-number: QTBUG-23082 Task-number: ou1cimx1#951223 Reviewed-by: Murray Read
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl_egl.cpp20
-rw-r--r--src/opengl/qgl_symbian.cpp21
2 files changed, 33 insertions, 8 deletions
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index 0b96350..21047d7 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -64,6 +64,25 @@ void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLForma
int stencilSize = glFormat.stencilBufferSize();
int sampleCount = glFormat.samples();
+#ifdef Q_OS_SYMBIAN
+ // on Symbian we prefer 32-bit configs
+ if (glFormat.alpha() && alphaSize <= 0)
+ alphaSize = 8;
+ if (glFormat.depth() && depthSize <= 0)
+ depthSize = 24;
+ if (glFormat.stencil() && stencilSize <= 0)
+ stencilSize = 8;
+ if (glFormat.sampleBuffers() && sampleCount <= 0)
+ sampleCount = 1;
+
+ redSize = redSize > 0 ? redSize : 8;
+ greenSize = greenSize > 0 ? greenSize : 8;
+ blueSize = blueSize > 0 ? blueSize : 8;
+ alphaSize = alphaSize > 0 ? alphaSize : 8;
+ depthSize = depthSize > 0 ? depthSize : 24;
+ stencilSize = stencilSize > 0 ? stencilSize : 8;
+ sampleCount = sampleCount > 0 ? sampleCount : 4;
+#else
// QGLFormat uses a magic value of -1 to indicate "don't care", even when a buffer of that
// type has been requested. So we must check QGLFormat's booleans too if size is -1:
if (glFormat.alpha() && alphaSize <= 0)
@@ -101,6 +120,7 @@ void qt_eglproperties_set_glformat(QEglProperties& eglProperties, const QGLForma
depthSize = depthSize > 0 ? depthSize : 0;
stencilSize = stencilSize > 0 ? stencilSize : 0;
sampleCount = sampleCount > 0 ? sampleCount : 0;
+#endif
eglProperties.setValue(EGL_RED_SIZE, redSize);
eglProperties.setValue(EGL_GREEN_SIZE, greenSize);
diff --git a/src/opengl/qgl_symbian.cpp b/src/opengl/qgl_symbian.cpp
index 0148304..7d343f6 100644
--- a/src/opengl/qgl_symbian.cpp
+++ b/src/opengl/qgl_symbian.cpp
@@ -181,14 +181,19 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) // almost same as
d->ownsEglContext = true;
d->eglContext->setApi(QEgl::OpenGL);
- // Allow apps to override ability to use multisampling by setting an environment variable. Eg:
- // qputenv("QT_SYMBIAN_DISABLE_GL_MULTISAMPLE", "1");
- // Added to allow camera app to start with limited memory.
- if (!QSymbianGraphicsSystemEx::hasBCM2727() && !qgetenv("QT_SYMBIAN_DISABLE_GL_MULTISAMPLE").toInt()) {
- // Most likely we have hw support for multisampling
- // so let's enable it.
- d->glFormat.setSampleBuffers(1);
- d->glFormat.setSamples(4);
+ if (d->glFormat.samples() == EGL_DONT_CARE) {
+ // Allow apps to override ability to use multisampling by setting an environment variable. Eg:
+ // qputenv("QT_SYMBIAN_DISABLE_GL_MULTISAMPLE", "1");
+ // Added to allow camera app to start with limited memory.
+ if (!QSymbianGraphicsSystemEx::hasBCM2727() && !qgetenv("QT_SYMBIAN_DISABLE_GL_MULTISAMPLE").toInt()) {
+ // Most likely we have hw support for multisampling
+ // so let's enable it.
+ d->glFormat.setSampleBuffers(1);
+ d->glFormat.setSamples(4);
+ } else {
+ d->glFormat.setSampleBuffers(0);
+ d->glFormat.setSamples(1);
+ }
}
// If the device is a widget with WA_TranslucentBackground set, make sure the glFormat