void example_DrawElements()
{
GLfloat vertices[] = {
0,0,0,1,
0,0,0,1,
0,0,0,1
};
GLfloat colors[] = {
0,0,0,1,
0,0,0,1,
0,0,0,1
};
GLfloat texcoords[] = {
0,0,0,1,
0,0,0,1,
0,0,0,1
};
GLfloat vertex_normals[] = {
0,0,0,
0,0,0,
0,0,0
};
GLushort faces[] = {
0,1,2
};
int triangles = 1;
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(4, GL_FLOAT, 0, vertices); // x,y,z,w
glColorPointer(4, GL_FLOAT, 0, colors); // r,g,b,a
glTexCoordPointer(4, GL_FLOAT, 0, texcoords); // t,s,r,q
glNormalPointer(GL_FLOAT, 0, vertex_normals); // x,y,z
glDrawElements(GL_TRIANGLES, triangles * 3, GL_UNSIGNED_SHORT, faces);
}