summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopengltextureblitter.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <[email protected]>2014-08-22 18:41:29 +0200
committerLaszlo Agocs <[email protected]>2014-08-25 17:40:28 +0200
commitf9de7efe60f0e6fdec25bb1b59ee59f8ce757490 (patch)
tree38f6522068c048b099767352baa04c84b71aa22f /src/gui/opengl/qopengltextureblitter.cpp
parenta4f50269f82695fbd0dd344f87b4b355feff4333 (diff)
QOpenGLTextureBlitter: Do not call vao functions if it failed to create
Follow the good practice of checking for isCreated() before calling VAO functions like bind(). Use also the vao binder where applicable. Change-Id: Ib827f3bce838396bf2e08f9480fa63801d4d3a50 Reviewed-by: Jørgen Lind <[email protected]>
Diffstat (limited to 'src/gui/opengl/qopengltextureblitter.cpp')
-rw-r--r--src/gui/opengl/qopengltextureblitter.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gui/opengl/qopengltextureblitter.cpp b/src/gui/opengl/qopengltextureblitter.cpp
index ef548188c89..ebe04292906 100644
--- a/src/gui/opengl/qopengltextureblitter.cpp
+++ b/src/gui/opengl/qopengltextureblitter.cpp
@@ -248,9 +248,6 @@ bool QOpenGLTextureBlitter::create()
Q_D(QOpenGLTextureBlitter);
- d->vao->create();
- d->vao->bind();
-
if (d->program)
return true;
@@ -273,6 +270,9 @@ bool QOpenGLTextureBlitter::create()
d->program->bind();
+ // Create and bind the VAO, if supported.
+ QOpenGLVertexArrayObject::Binder vaoBinder(d->vao.data());
+
d->vertexBuffer.create();
d->vertexBuffer.bind();
d->vertexBuffer.allocate(vertex_buffer_data, sizeof(vertex_buffer_data));
@@ -292,8 +292,6 @@ bool QOpenGLTextureBlitter::create()
d->program->setUniformValue(d->swizzleUniformPos,false);
- d->vao->release();
-
return true;
}
@@ -316,7 +314,8 @@ void QOpenGLTextureBlitter::bind()
{
Q_D(QOpenGLTextureBlitter);
- d->vao->bind();
+ if (d->vao->isCreated())
+ d->vao->bind();
d->program->bind();
@@ -335,7 +334,8 @@ void QOpenGLTextureBlitter::release()
{
Q_D(QOpenGLTextureBlitter);
d->program->release();
- d->vao->release();
+ if (d->vao->isCreated())
+ d->vao->release();
}
void QOpenGLTextureBlitter::setSwizzleRB(bool swizzle)