Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void GeometryEngine::drawCubeGeometry(QOpenGLShaderProgram *program) {
- // Bind array buffer
- arrayBuf.bind();
- // Set position of vertices
- int posLocation = program->attributeLocation("a_position");
- program->enableAttributeArray(posLocation);
- program->setAttributeBuffer(posLocation, GL_FLOAT, 0, 3, sizeof(VertexData));
- // Set color of vertices
- int colorLocation = program->attributeLocation("a_color");
- program->enableAttributeArray(colorLocation);
- program->setAttributeBuffer(colorLocation, GL_FLOAT, sizeof(QVector3D), 3, sizeof(VertexData));
- // Bind index buffer
- indexBuf.bind();
- // Draw triangles
- glDrawElements(GL_TRIANGLES, indices, GL_UNSIGNED_INT, 0);
- // Release index buffer
- indexBuf.release();
- // Now I want to draw the contours of the same triangles, but this time as black lines ... ?
- // An attempt:
- QColor color;
- color.setRgb(0,0,0);
- program->setAttributeValue(colorLocation, color);
- indexBuf.bind();
- glDrawElements(GL_LINES, indices, GL_UNSIGNED_INT, 0);
- indexBuf.release();
- arrayBuf.release();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement