How to place texture on the surface of the cylinde

Hi Sir,

i am newbie to openGL, i created cylinder using openGL function gluCylinder(myQuad, 0.5, 0.5, 3.0, 24, 8);

but i am not getting how to place multiple textures on the surface of the cylinder.

please guide me… any answer is valuable…


Everything will be much easier if you create a cylinder on your own and define texture coordinates during vertex-definition.

Other, much harder way is automatic texture-coordinate generation.
Reference: OpenGL Programming Guide 6th Edition, pg.434-443 (Automatic Texture-Coordinate generation), and pg.443-449 (Multitexturing).

Thank You Sir.

let you know after reading OpenGL Programming Guide.

Hi Sir,

I followed NeHe tutorial for creating Cylinder.
and i tried to place images as texture on the surface of the cylinder, but i am unable to do that.

Please help me, any valuable answer is appreciated.


Which tutorial? What’s wrong?
Give us some more details.
And take a look at NeHe’s Lesson 23
Sphere Mapping Quadrics In OpenGL.

Hi Sir,

Thanks for your reply.
I downloaded the program which is there in NeHe’s lesson 23(Game Glut code), but i am getting an error as below :

Error :

user@lxdevenv:~/Temp/sample/lesson23/lesson23$ g++ lesson23.cpp -o lesson23 -I/usr/x11R6/include/ -L/usr/lib -lX11 -lXmu -lglut -lGL -lGLU
lesson23.cpp:55: error: expected constructor, destructor, or type conversion before ‘*’ token.

What exactly it means ?

and is it necessary to learn Adobe’s Photoshop program to create Sphere in lesson-23, because i think, in this lesson they use photoshop program.

please Help me Sir. waiting for your reply.


This kind of compile error may be due to missing includes, are you sure they are present in /usr/x11R6/include/ ?

Instead of photoshop, you may use The Gimp, the Glass effect / apply lens is close to the spherize tool used in the tutorial.

Hi Sir,

Thanks for your reply.

how to place images on the surface of the cylinder using libjpeg libraries ?

i am not getting how to place images on the object, requesting you to help me out from this problem.
I goggled it, but i dint get the correct information about it.

waiting for your reply Sir.

Thanking You.