mapping texture to gluCylinder

Hello everyone!

I am having issues trying to map a texture properly to gluCylinder(). I am trying to make a “cup” shape where the top diameter is different from the bottom diameter.

I don’t know if it’s possible to do this with gluCylinder()… I am trying to avoid creating my own Cylinder.

Is it possible to map this texture properly?

I don’t understand the problem; you seem to have the texture applied correctly.

I am trying to make a “cup” shape where the top diameter is different from the bottom diameter.

Then it’s not a cylinder anymore.

I am trying to avoid creating my own Cylinder.

Why not? Generating a cylinder mesh isn’t exactly the hardest thing in the world.

“Then it’s not a cylinder anymore.”

Well, technically it is since I am calling “gluCylinder” to create the cup.

“Why not? Generating a cylinder mesh isn’t exactly the hardest thing in the world.”

OK, so are you saying that it is not possible to map a cupped texture to a Cylinder created by “gluCylinder” ?

OK, so are you saying that it is not possible to map a cupped texture to a Cylinder created by “gluCylinder” ?

If you want a GLU quadric to have texture coordinates, call gluQuadricTexture on the quadric before calling gluCylinder on it.

I did that – you can see in the pictures above that I have the texture mapping on to the cylinder – I want it to map differently though

I did that – you can see in the pictures above that I have the texture mapping on to the cylinder – I want it to map differently though

Then you’ll have to make a mesh and build your texture coordinates to achieve the mapping you want.

Super helpful… Thanks.

Maybe I’m misunderstanding, but it seems like you’re making this problem harder than it really is. Why are the letters and white area in your source image arced? I think you’d get what you want if your source image was simply a white rectangle with horizontal lettering.

For example, if you take a McDonalds cup and unroll it, you will see that the text/pictures are skewed/warped to make up for the uneven radii on each end of the cylinder. I am trying to accomplish the same thing here.

… and it also gives you that nice rainbow-like shape

Maybe I am not giving OpenGL enough credit here? Do you think it will do the warping for me if I just do a straight rectangle and wrap it without warping the text?

I will give it a shot

Not sure what you mean by ‘warping’. If you like the way your letters appear on the cup now, then you could always insert the arced white image you are starting with into a slightly larger white rectangle, leaving the letters untouched. Then map the rectangle to the cup. That should give you pretty close to what you have now without the black areas on the cup.

OK – that did it. I was way over-thinking this.

OpenGL automatically wraps it correctly without me having to warp/skew the text or the rectangle.

Sometimes it just takes another brain and set of eyes to slap me around a bit.

THANKS.