itun
itun

Reputation: 3521

OpenGL: Set several texture coordinates

How to set several texture coordinates for one vertex?

Upvotes: 1

Views: 770

Answers (1)

datenwolf
datenwolf

Reputation: 162164

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.

Upvotes: 5

Related Questions