struct TexVertex {
Vertex vertex;
Vertex normal;
float s, t;
Vertex sVec; // Tangent
float ws;
Vertex tVec; // Binormal
float wt;
};
...
<snip>
...
if (GL_ATI_vertex_array_object && GL_ATI_vertex_attrib_array_object){
glArrayObjectATI(GL_VERTEX_ARRAY, 3, GL_FLOAT, sizeof(TexVertex), vaoBuffer, 0);
glArrayObjectATI(GL_NORMAL_ARRAY, 3, GL_FLOAT, sizeof(TexVertex), vaoBuffer, sizeof(Vertex));
glArrayObjectATI(GL_TEXTURE_COORD_ARRAY, 2, GL_FLOAT, sizeof(TexVertex), vaoBuffer, 2 * sizeof(Vertex));
glVertexAttribArrayObjectATI(9, 4, GL_FLOAT, GL_FALSE, sizeof(TexVertex), vaoBuffer, 2 * sizeof(Vertex) + 2 * sizeof(float));
glVertexAttribArrayObjectATI(10, 4, GL_FLOAT, GL_FALSE, sizeof(TexVertex), vaoBuffer, 3 * sizeof(Vertex) + 3 * sizeof(float));
} else {
glVertexPointer(3, GL_FLOAT, sizeof(TexVertex), vertices);
glNormalPointer( GL_FLOAT, sizeof(TexVertex), ((char *) vertices) + sizeof(Vertex));
glTexCoordPointer(2, GL_FLOAT, sizeof(TexVertex), ((char *) vertices) + 2 * sizeof(Vertex));
glVertexAttribPointerARB(9, 4, GL_FLOAT, GL_FALSE, sizeof(TexVertex), ((char *) vertices) + 2 * sizeof(Vertex) + 2 * sizeof(float));
glVertexAttribPointerARB(10, 4, GL_FLOAT, GL_FALSE, sizeof(TexVertex), ((char *) vertices) + 3 * sizeof(Vertex) + 3 * sizeof(float));
}
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableVertexAttribArrayARB(9);
glEnableVertexAttribArrayARB(10);