summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglframebufferobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl/qglframebufferobject.cpp')
-rw-r--r--src/opengl/qglframebufferobject.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 3e54b35..8fc95cf 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -451,6 +451,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz,
QT_CHECK_GLERROR();
valid = checkFramebufferStatus();
+ glBindTexture(target, 0);
color_buffer = 0;
} else {
@@ -819,7 +820,8 @@ QGLFramebufferObject::~QGLFramebufferObject()
if (isValid() && ctx) {
QGLShareContextScope scope(ctx);
- glDeleteTextures(1, &d->texture);
+ if (d->texture)
+ glDeleteTextures(1, &d->texture);
if (d->color_buffer)
glDeleteRenderbuffers(1, &d->color_buffer);
if (d->depth_stencil_buffer)
@@ -988,7 +990,7 @@ QImage QGLFramebufferObject::toImage() const
bool wasBound = isBound();
if (!wasBound)
const_cast<QGLFramebufferObject *>(this)->bind();
- QImage image = qt_gl_read_framebuffer(d->size, format().textureTarget() != GL_RGB, true);
+ QImage image = qt_gl_read_framebuffer(d->size, format().internalTextureFormat() != GL_RGB, true);
if (!wasBound)
const_cast<QGLFramebufferObject *>(this)->release();