开发者

Opengl ES and texcoord

开发者 https://www.devze.com 2022-12-27 11:57 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消