aboutsummaryrefslogtreecommitdiff
path: root/src/opengl_mesh.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl_mesh.cc')
-rw-r--r--src/opengl_mesh.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/opengl_mesh.cc b/src/opengl_mesh.cc
index a1f5a23..f77a70a 100644
--- a/src/opengl_mesh.cc
+++ b/src/opengl_mesh.cc
@@ -21,8 +21,6 @@ OpenGLMesh::OpenGLMesh(QVector<float> verts, QOpenGLTexture *tex, QOpenGLShaderP
glf->glEnableVertexAttribArray(1);
glf->glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof (float), (void *) (6 * sizeof (float)));
glf->glEnableVertexAttribArray(2);
- tex->bind();
- glf->glBindVertexArray(0);
OpenGLWidget::instance->doneCurrent();
}
@@ -31,7 +29,7 @@ void OpenGLMesh::draw(QOpenGLExtraFunctions *f, const QMatrix4x4 &mat) const {
program->bind();
program->setUniformValue("model", mat);
f->glBindVertexArray(vao);
- tex->bind();
+ if (tex) tex->bind();
f->glDrawArrays(GL_TRIANGLES, 0, nverts);
- tex->release();
+ if (tex) tex->release();
}