Corrected the size of mipmaps in framebuffer objects.
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>
Wed, 15 Feb 2012 11:45:08 +0000 (12:45 +0100)
committerQt by Nokia <qt-info@nokia.com>
Wed, 15 Feb 2012 16:06:49 +0000 (17:06 +0100)
Change-Id: Ia3c0daefc6537b12be7f9072e7defc0631794690
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/gui/opengl/qopenglframebufferobject.cpp
src/opengl/qglframebufferobject.cpp

index aac6ea0..0eb264b 100644 (file)
@@ -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);
index 96479e1..21b3abf 100644 (file)
@@ -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);