PDA

View Full Version : Question about gluCylinder(..)



anuchka
07-11-2004, 06:48 AM
Hi
I have some problem with cylinder:
As we know gluCylinder function draws a cylinder oriented along the z axis,so I got cylinder who
is "lying".How to do the rotating to get the cylinder in "standing" position ?

It must be 45 degrees in some direction,I tried this but it was not working.

glTranslatef(scrx0,scrh0,scry0);
glRotatef(45.0,0.0,0.0,1.0);
gluCylinder(quadratic,cyBase,0.0,cyHeight,32,32);

ZbuffeR
07-11-2004, 11:17 AM
It is 90 degrees actually !

You may want to take some tutorial on math geometry and matrices to get confident in 3D graphics.
You can start with http://mathworld.wolfram.com/topics/Geometry.html .

-NiCo-
07-11-2004, 02:27 PM
If it's oriented along the z-direction,like you said, then rotating along the Z-axis won't make much difference, will it?

Try


glTranslatef(scrx0,scrh0,scry0);
glRotatef(45.0,0.0,1.0,0.0);
gluCylinder(quadratic,cyBase,0.0,cyHeight,32,32); or


glTranslatef(scrx0,scrh0,scry0);
glRotatef(45.0,1.0,0.0,0.0);
gluCylinder(quadratic,cyBase,0.0,cyHeight,32,32); Nico