From 7e0554bf65b9be61f3b73625d762a5043ad2af0f Mon Sep 17 00:00:00 2001 From: ccolin Date: Sun, 3 Jan 2021 13:27:01 +0100 Subject: collision sphere previsualization --- src/opengl_mesh.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/opengl_mesh.cc') 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 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(); } -- cgit v1.2.3-70-g09d2