summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorTrond Kjernaasen <trond@trolltech.com>2010-01-14 10:07:25 (GMT)
committerTrond Kjernaasen <trond@trolltech.com>2010-01-14 10:07:25 (GMT)
commit9baeb2fc297a7a30bb467ea0d1986c7fecea2e58 (patch)
tree29737acfac2176f737793f8f5da05c38bff2329d /src/opengl
parentd8cadc2c9333f5b797fab87c1aa9fc9952603935 (diff)
downloadQt-9baeb2fc297a7a30bb467ea0d1986c7fecea2e58.zip
Qt-9baeb2fc297a7a30bb467ea0d1986c7fecea2e58.tar.gz
Qt-9baeb2fc297a7a30bb467ea0d1986c7fecea2e58.tar.bz2
Fix QGLWidget::renderPixmap() on Windows.
Using renderPixmap() with scenes that contained textures might not work due to the wrong texture format being used under certain circumstances. Task-number: QTBUG-7213 Reviewed-by: Gunnar
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 09ecfd1..3f32cf3 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -2195,7 +2195,10 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
GLuint pixel_type;
if (QGLExtensions::glExtensions() & QGLExtensions::BGRATextureFormat) {
externalFormat = GL_BGRA;
- pixel_type = GL_UNSIGNED_INT_8_8_8_8_REV;
+ if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2)
+ pixel_type = GL_UNSIGNED_INT_8_8_8_8_REV;
+ else
+ pixel_type = GL_UNSIGNED_BYTE;
} else {
externalFormat = GL_RGBA;
pixel_type = GL_UNSIGNED_BYTE;
@@ -2274,12 +2277,9 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G
qgl_byteSwapImage(img, pixel_type);
}
#ifdef QT_OPENGL_ES
- // OpenGL/ES requires that the internal and external formats be identical.
- // This is typically used to convert GL_RGBA into GL_BGRA.
- // Also, we need to use GL_UNSIGNED_BYTE when the format is GL_BGRA.
+ // OpenGL/ES requires that the internal and external formats be
+ // identical.
internalFormat = externalFormat;
- if (pixel_type == GL_UNSIGNED_INT_8_8_8_8_REV)
- pixel_type = GL_UNSIGNED_BYTE;
#endif
#ifdef QGL_BIND_TEXTURE_DEBUG
printf(" - uploading, image.format=%d, externalFormat=0x%x, internalFormat=0x%x, pixel_type=0x%x\n",