PDA

View Full Version : How to draw a ball?



mushu
05-05-2002, 05:58 PM
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... http://www.opengl.org/discussion_boards/ubb/frown.gif

yakuza
05-05-2002, 06:19 PM
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

mushu
05-05-2002, 08:28 PM
thanks for the link http://www.opengl.org/discussion_boards/ubb/smile.gif
I just remembered that I cannot draw a ball using auxsphere... the code must be made from scratch http://www.opengl.org/discussion_boards/ubb/frown.gif sob

endo
05-06-2002, 05:33 AM
Its not that hard really, look into using quadric objects - they are really easy to understand

nexusone
05-06-2002, 06:30 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif
I just remembered that I cannot draw a ball using auxsphere... the code must be made from scratch http://www.opengl.org/discussion_boards/ubb/frown.gif sob



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

mushu
05-06-2002, 11:28 PM
Thank you soo much http://www.opengl.org/discussion_boards/ubb/smile.gif 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 http://www.opengl.org/discussion_boards/ubb/frown.gif

mushu
05-07-2002, 12:00 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

coredump
05-07-2002, 02:42 AM
can you tell me what is PID2 ?
sounds like PI divided by 2


PI / 2 = 1.5707963

b