PDA

View Full Version : How to draw a cylinder



Ginger
03-30-2010, 06:32 AM
hello
i am a total beginner in opengl

i have a code to draw a cylinder:

gl.glColor3d(1.0, 0.0, 0.0);
glu.gluCylinder(gluQuadric, 1, 1, 3, 20, 20);

how can i indicate the start and end (x, y, z) coordinates of the cylinder?

any help is greatly appreciated
thanks in advance
:D

V-man
03-30-2010, 08:24 AM
If you want to use gluCylinder, this function creates a cylinder along the positive z axis. It starts from z=0.0 and up to your height value, which is 3.

To position it however, you want use the modelview matrix (glTranslatef)