PDA

View Full Version : cylinder problem



asingh
02-15-2002, 12:58 PM
Hi

I am new to opengl .

I want to draw a cylinder between known points (x1,y1,z1) and (x2,y2,z2)with a known radius using opengl /glut/optimizer.

I am stuck up with this.

plz.help me out.

thanks
ashy

satan
02-15-2002, 01:53 PM
glu provides routines to render cylinders (glucylinder)
just look in the glu reference about the quadratics stuff

asingh
02-15-2002, 02:01 PM
Originally posted by satan:
glu provides routines to render cylinders (glucylinder)
just look in the glu reference about the quadratics stuff
---------------------------------------------
I looked at the glucylinder but there is no provision to make a cylinder between two points in space.here is what glucylinder looks like.
----------
void gluCylinder(
GLUquadricObj *qobj,
GLdouble baseRadius,
GLdouble topRadius,
GLdouble height,
GLint slices,
GLint stacks
);
-----------

plz help.

ashy

satan
02-15-2002, 11:54 PM
ah, now i got it
everything you need for glucylinder input you have, only problem is getting the right rotations for it
at the moment i do not really have any good ideas
perhaps transfering your line in one point to the origin, converting the second point to spherical coordinates (then you have two angles), calculating the rotations (which will be not so nice to do), and transfering it back to its starting point
looks to complicated to me, perhaps it helps if you tell what you wanne do (why a cylinder on a given line?)