4 GLMesh::GLMesh(const Mesh* const mesh)
5 : vertices(QGLBuffer::VertexBuffer), indices(QGLBuffer::IndexBuffer)
7 initializeGLFunctions();
12 vertices.setUsagePattern(QGLBuffer::StaticDraw);
13 indices.setUsagePattern(QGLBuffer::StaticDraw);
16 vertices.allocate(mesh->vertices.data(),
17 mesh->vertices.size() * sizeof(float));
21 indices.allocate(mesh->indices.data(),
22 mesh->indices.size() * sizeof(uint32_t));
26 void GLMesh::draw(GLuint vp)
31 glVertexAttribPointer(vp, 3, GL_FLOAT, false, 3*sizeof(float), NULL);
32 glDrawElements(GL_TRIANGLES, indices.size() / sizeof(uint32_t),
33 GL_UNSIGNED_INT, NULL);