PDA

View Full Version : How do you draw Objects? (Spheres, Cones, etc)



x0skelet0n
11-15-2000, 08:35 AM
Ok whats the fastest way to draw spheres or cones in Opengl? I know you can use a model but what if i wanted to just draw it like DrawCone or something. Is there something like that in Opengl? And how fast would it be?

Deiussum
11-15-2000, 09:19 AM
If you're using Glut, glutSolidSphere for spheres. Not sure if there is a glutSolidCone or not, though. My crappy work system appears to be about to crash and won't open much right now so I can't check the glut headers for it. http://www.opengl.org/discussion_boards/ubb/smile.gif

ipo
11-15-2000, 04:18 PM
There's gluSphere() and gluCylinder(). The latter will generate a cone if its top face is set to a radius of 0.0

[This message has been edited by ipo (edited 11-15-2000).]

Michael Steinberg
11-16-2000, 09:08 AM
But when you set the upper radius to 0, will it really generate a clean cone? Or will it make many vertices in 1 point? I think a cone is best made out of 2 triangle fans.

bsimser
11-16-2000, 10:36 AM
Originally posted by Michael Steinberg:
But when you set the upper radius to 0, will it really generate a clean cone? Or will it make many vertices in 1 point? I think a cone is best made out of 2 triangle fans.

Yes, it's not really the most efficient cone. Triangle strips or fans would work much better but the original poster wanted a fast way to draw it. The performance isn't that bad unless you have thousands of them in the scene.

liB

Michael Steinberg
11-16-2000, 11:41 AM
Oh, my english.
I thought he would need FAST routines for that stuff... Well, it can only get better. http://www.opengl.org/discussion_boards/ubb/smile.gif