I've got some code which I would like to translate into Opengl ES. I'm not experienced with it however, so here it goes. The original code does a loop like this:
glBegin(GL_TRIANGLES);
for(i=0; i<num_triangles; i++) {
glN开发者_Go百科ormal(...);
glTexCoord2f(...);
glVerted3fv(...);
glTexCoord2f(...);
glVerted3fv(...);
glTexCoord2f(...);
glVerted3fv(...);
}
glEnd();
So that's ok - I can change the vertex handling for each triangle in the loop, into the standard:
glEnableClientState (GL_VERTEX_ARRAY);
glVertexPointer (3, GL_SOMETHING, 0, verts);
glDrawArrays (GL_TRIANGLES, 0, 3);
But how do I add the texcoord setting into this example?
Ok - the answer was obvious after all. glTexCoordPointer and glNormalPointer can be used to fill the rest of the data.
精彩评论