Generating texture coordinates evenly

I’m trying to have OpenGL generate my s and t texture coordinates for me, but I’m having trouble getting it to look right on certain objects, mostly solid cylinders.

I can’t figure out good s and t vectors to use so that the texture is just mapped evenly around the whole object. There always seems to be some streaking on a pair of sides or something.

My main problem is that I just haven’t found a good reference for how the s and t coordinates actually work, but if anyone can help me out with the s and t vectors I’m looking for that would map evenly on all parts of an object, that would be great.

Thanks GLers,

This is a common problem when you try to draw an entire object with just one set of texture coordinates.

If you’re trying to wrap some kind of image around an object, you will generally need to duplicate some vertices and give them different texture coordinates.

Generally, texgen is better suited for algorithmic kinds of texture mapping than for mapping images on arbitrary objects. For example, texgen is great for projecting spotlight textures.

  • Matt

can anyone tell me a simple explanation of what is texture S & T, Q, R and what can be used with or to do what?

i know its used under env mapping, sphere mapping and all that in opengl, but how does it work for us?