# How to draw a ball?

I’m still new with Open GL, and I want to draw a ball.
Can anyone help me how to draw it? I can’t even draw a circle using glVertex2f. Do i really have to make a loop to generate points of a circle and join them together?

Help…

Perhaps this will help…
http://nehe.gamedev.net/tutorials/lesson.asp?l=18

Also, Gametutorials.com has a quadrics tutorial. http://www.gametutorials.com/Tutorials/OpenGL/OpenGL_Pg2.htm

thanks for the link
I just remembered that I cannot draw a ball using auxsphere… the code must be made from scratch sob

Its not that hard really, look into using quadric objects - they are really easy to understand

Can you use the function gluSphere or glutSolidSphere?

The only other way that is from scratch would be to build it from vertex’s, if you do a search the code is here on this forum.
It has been asked in the past on building a sphere from scratch using sin/cos.

Originally posted by mushu:
thanks for the link
I just remembered that I cannot draw a ball using auxsphere… the code must be made from scratch sob

[This message has been edited by nexusone (edited 05-06-2002).]

Thank you soo much I’ll try to do what you say. and no, I can not use any built in method to draw the sphere… it’s for an assignment… the teacher is really mean

just another question…
i found a site that has a code on how to draw a sphere… if anyone can help me, can you tell me what is PID2 ? Looks like a constant, but I can’t find it in math.h

btw, here’s the address http://astronomy.swin.edu.au/~pbourke/opengl/sphere/

Thanks beforehand

can you tell me what is PID2 ?

sounds like PI divided by 2

``````PI / 2 = 1.5707963
``````

b