Repeating a texture map on each quad of a glyCylinder.

Texture mapping an image over an entire gluCylinder is easy, all I do is something like this :

// Bind the texture
m_Texture.setup();

// Draw the cylinder
gluQuadricDrawStyle(p_Quadric,GLU_FILL);
gluQuadricTexture(p_Quadric,GL_TRUE);
glPushMatrix();
glScalef(m_BaseRadius,m_BaseRadius,m_Height);
glTranslatef(0.0f,0.0f,-0.5);
gluCylinder(
p_Quadric,
1.0f,
m_TopRadius/m_BaseRadius,
1.0f,
m_NumSlices,
m_NumStacks
);
glPopMatrix();

BUT!!! That is not what I need right now. What I need to do is to repeat the texture around the cylinder. That is, each quad on the cylinder will have a copy of the image painted onto it.

Can anyone tell me how to do this?

Thanks!

[This message has been edited by pleopard (edited 02-22-2001).]

How about scaling the texture matrix?

Originally posted by DFrey:
How about scaling the texture matrix?

How would I go about that? Maybe like this …??

glMatrixMode(GL_TEXTURE)
glPushMatrix();
glScale3d(0.1, 0.1, 0.1);
MyCylinder.render();
glPopMatrix();

??
Thanks

Correct, though the third component of the scale can be 0 since your texture is 2D. And the scale itself would need to be adjusted to get the scale you requested earlier. For example, if I make a cylinder, and I want the texture to repeat 5 times around it, and along its length, I’d use glScalef(5,5,0).