I think you want to change your attribute pointers, specifically the offsets you have listed. &vertices[0].position
should be 0
, &vertices[0].uvnormal
should be 2412
, &vertices[0].normaluv
should be 1224
and, and so on.
Since getting the address of a struct member gives you the absolute address instead of the address relative to the beginning of the struct. glVertexAttribPointer
is looking for the offset into your interleaved set.
struct Vertex { //previousfloats * sizeof(float) = offset
glm::vec3 position; //0*4 =0 * 4 = 0
glm::vec3 normal; // 3 * 4 = 12
glm::vec2 uv; // 6 * 4 = 24
glm::vec3 tangent; // 8 * 4 = 32
glm::vec3 bitangent; // 11 * 4 = 44
};
See the documentation for the glVertexAttribPointer
here. The big hint being:
pointer
Specifies a pointer to the first component of the first generic vertex attribute in the array. The initial value is 0.