Exposing normals to example framework.

This commit is contained in:
David Williams
2014-05-24 09:38:01 +02:00
parent f65edddd81
commit aace1f2e36
3 changed files with 19 additions and 6 deletions

View File

@ -86,7 +86,10 @@ public:
//We need to tell OpenGL how to understand the format of the vertex data
glEnableVertexAttribArray(0); //We're talking about shader attribute '0'
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(MeshType::VertexType), 0); //take the first 3 floats from every sizeof(decltype(vecVertices)::value_type)
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(MeshType::VertexType), (GLvoid*)(offsetof(MeshType::VertexType, position))); //take the first 3 floats from every sizeof(decltype(vecVertices)::value_type)
glEnableVertexAttribArray(1); //We're talking about shader attribute '1'
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(MeshType::VertexType), (GLvoid*)(offsetof(MeshType::VertexType, normal)));
glBindVertexArray(0);