add normal to VertexData

This commit is contained in:
Anakin
2017-01-08 14:41:53 +01:00
parent 5c2f5503fc
commit 948578f506
4 changed files with 34 additions and 11 deletions

View File

@@ -196,6 +196,14 @@ void GeometryEngine::drawGeometry(QOpenGLShaderProgram *program)
program->enableAttributeArray(texcoordLocation);
program->setAttributeBuffer(texcoordLocation, GL_FLOAT, offset, 2, sizeof(VertexData));
//Offset for normal
offset += sizeof(QVector2D);
// Tell OpenGL programmable pipeline how to locate vertex normal data
int normLocation = program->attributeLocation("a_normal");
program->enableAttributeArray(normLocation);
program->setAttributeBuffer(normLocation, GL_FLOAT, offset, 3, sizeof(VertexData));
// Paint
for (auto& it : m_drawList)