diff options
author | ccolin | 2021-01-03 13:27:01 +0100 |
---|---|---|
committer | ccolin | 2021-01-03 13:27:20 +0100 |
commit | 7e0554bf65b9be61f3b73625d762a5043ad2af0f (patch) | |
tree | 09d8f976d428aa3676f7a9574da2689e30477361 /src/opengl_mesh.cc | |
parent | 928d45c3fbfb6b00d8e0b79b63934ebd080b9456 (diff) |
collision sphere previsualization
Diffstat (limited to 'src/opengl_mesh.cc')
-rw-r--r-- | src/opengl_mesh.cc | 6 |
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(); } |