PDA

View Full Version : Creating objects using basic functions



Milan
11-05-2001, 12:58 AM
How can i create shapes of cylinder and sphere using OpenGL and GLUT by only using the low level functions. I know there are functions to create cylinder and sphere but i do not wish to use them.

Thank you

the_shadow
11-09-2001, 02:49 AM
a cylinder and a sphere are very easy to compute
the equation of a sphere is :
x = r*cosa*cosb
y = r*sina *cosb
z = r*sinb
you can discetize them into polygone very easily
for the cylinder it's
x = r*cos(a)
y = r*cos(b)
z = t for 0<t<height
i did it myself and it's increasing the speed significantly