25 lines
858 B
C++
25 lines
858 B
C++
#include "standardmesh.h"
|
|
#include "glassert.h"
|
|
|
|
void StandardMesh::addVertex(const TexturedVertex& v)
|
|
{
|
|
if(!locked)
|
|
vertices.push_back(v);
|
|
}
|
|
|
|
void StandardMesh::setAttribPointer()
|
|
{
|
|
glAssert(glBindVertexArray(vao));
|
|
glAssert(glBindBuffer(GL_ARRAY_BUFFER, vbo[VERTEX_BUFFER]));
|
|
|
|
// position attribute
|
|
glAssert(glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(TexturedVertex), BUFFER_OFFSET(0)));
|
|
glAssert(glEnableVertexAttribArray(0));
|
|
// normal attribute
|
|
glAssert(glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(TexturedVertex), BUFFER_OFFSET(sizeof(glm::vec3))));
|
|
glAssert(glEnableVertexAttribArray(1));
|
|
// texCoord attribute
|
|
glAssert(glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(TexturedVertex), BUFFER_OFFSET(2*sizeof(glm::vec3))));
|
|
glAssert(glEnableVertexAttribArray(2));
|
|
}
|