summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2012-02-15 12:45:08 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-15 17:06:49 +0100
commite452923f1effdfd015ca32b8830b9ddfda696570 (patch)
treeb0cd15a6d60e56ceb4803a5b37b8e9ea44573831 /src
parentb8342ad6fd1ab3363baf3468173aa9bcdf0616eb (diff)
Corrected the size of mipmaps in framebuffer objects.
Change-Id: Ia3c0daefc6537b12be7f9072e7defc0631794690 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp4
-rw-r--r--src/opengl/qglframebufferobject.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index aac6ea0558..0eb264b2d9 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -414,8 +414,8 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi
int height = size.height();
int level = 0;
while (width > 1 || height > 1) {
- width = (width + 1) >> 1;
- height = (height + 1) >> 1;
+ width = qMax(1, width >> 1);
+ height = qMax(1, height >> 1);
++level;
glTexImage2D(target, level, internal_format, width, height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 96479e189e..21b3abfdd8 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -459,8 +459,8 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz,
int height = size.height();
int level = 0;
while (width > 1 || height > 1) {
- width = (width + 1) >> 1;
- height = (height + 1) >> 1;
+ width = qMax(1, width >> 1);
+ height = qMax(1, height >> 1);
++level;
glTexImage2D(target, level, internal_format, width, height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);