PDA

View Full Version : Texturing the inside of cylinder



Neuron
01-11-2012, 04:24 AM
Hi all, I have 3 questions.
1- I want to map a texture only to the inside of a cylinder? how do I?
2- And I want to move and fix my camera to center of the cylinder both horizontally and vertically!(I have already rotated the cylinder -90 degrees so now it is standing:D)? how should I?

// attributes of the cylinder
gluLookAt(0.0, 0.0, 10.0, 0.0, 2.0, 0.0, 0.0, 1.0, 0.0);
glRotatef(-90.0, 1.0, 0.0, 0.0);
gluCylinder(pObj, 5.0, 5.0, 4.0, 128, 64);

3- What about stacks and slices of the cylinder, are they sufficient(I want to use big textures(resolution>8xx*2xx)?

dorbie
01-11-2012, 11:33 AM
Draw the cylinder twice and use face culling and winding to draw front then back. Enable texture when drawing the inside.

glCullFace
and
glEnable with the related token.

Your other questions are not well defined.

Neuron
01-12-2012, 03:18 AM
Thanks,
I'm totally new to OpenGL and do not understand what you mean, what do I want is a cylinder aligned to Y-axis(standing)[I think I've done it correctly]:

glRotatef(-90.0, 1.0, 0.0, 0.0); // make cylinder stand up
gluCylinder(pObj, 5.0, 5.0, 4.0, 128, 64);

Then I want to place my camera in the center of it. And look at the texture that has just been mapped to the inside of my cylinder.

In the 3rd question I want to know that is there any relation with the number of stacks and slices and the quality of mapped texture?