# how to generate 1000 3D points to form a sphere, cone, cylinder, pyramid, cube

can anybody give me some source code on how to generate 1000 3D points to form/ produce a sphere, cone, cylinder, pyramid, cube using opengl.

hm… maybe you should buy a book about OGL programming??? or 'bout math?

check this one: Francis S.Hill “Computer Graphics Using OpenGL SE” (good for beginners)

OpenGL is for displaying things, not generating them.

You give it the 1000 points, and it draws something. It won’t generate the points for you.

Don’t have any source code, but for a detailed description look up math books about analytic geometry. These are from the top of my head:

sphere at point P:
(x-Px)^2 + (y-Py)^2 + (z-Pz)^2 = r^2

cylinder=extruded circle=>
(x-Px)^2 + (y-Py)^2 = r^2

cone=cylinder where r decreses by dr/dz

Originally posted by roffe:
[b]Don’t have any source code, but for a detailed description look up math books about analytic geometry. These are from the top of my head:

sphere at point P:
(x-Px)^2 + (y-Py)^2 + (z-Pz)^2 = r^2

cylinder=extruded circle=>
(x-Px)^2 + (y-Py)^2 = r^2

cone=cylinder where r decreses by dr/dz

[/b]