How to set several texture coordin开发者_开发百科ates for one vertex?
In Immediate Mode you use glMultiTexCoord
for this: http://www.opengl.org/sdk/docs/man/xhtml/glMultiTexCoord.xml
Code example
glBegin(GL_TRIANGLES);
glMultiTexCoord2f(GL_TEXTURE0, s0, t0);
glMultiTexCoord2f(GL_TEXTURE1, s1, t1);
glMultiTexCoord2f(GL_TEXTURE2, s2, t2);
glVertex3f(...);
/* ... */
glEnd();
Using Vertex Arrays you use glClientActiveTexture
to select the texture unit the following calls to glTexCoordPointer
are related to.
If you're using shaders you may as well assign multiple texture coordinates to a set of vertex attributes.
精彩评论