#include "opengl_mesh.hh" #include "opengl_widget.hh" OpenGLMesh::OpenGLMesh(QVector verts) { OpenGLWidget::instance->makeCurrent(); QOpenGLFunctions_4_4_Core *glf = OpenGLWidget::instance; nverts = verts.size() / 3; glf->glGenVertexArrays(1, &vao); glf->glGenBuffers(1, &vbo); glf->glBindVertexArray(vao); glf->glBindBuffer(GL_ARRAY_BUFFER, vbo); glf->glBufferData(GL_ARRAY_BUFFER, nverts * 3 * sizeof (GLfloat), verts.data(), GL_STATIC_DRAW); glf->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0); glf->glEnableVertexAttribArray(0); glf->glBindVertexArray(0); OpenGLWidget::instance->doneCurrent(); }