View Full Version : Drawing sphere, circle in OpenGL?

Dear all,

Hi, i'm trying to draw a circle and sphere with OpenGL. But i don't know how. Could anyone drop me some hints plase~ thanks.

I looked at some of the sites that talke about opengl, but most of them only talk about cubes and triangles, but not spheres... (~_~) Even the book that i have, they use GLUT instead...

If any of you can drop me some hits, that would be great, once again, Thanks~~

(by the way, i need it in a kinda of hurry, for a project, thanks~~~ )

nexusone

06-04-2002, 04:09 AM

There are two sphere rutines that you can call.

Under the glu library (glu.h):

gluSphere, gluDisk (Circle)

Under the glut library (glut.h):

glutSolidSphere, glutWireSphere.

Another option for drawing a circle is the use the math function for a circle using sin/cos.

Originally posted by [aNewbie]:

Dear all,

Hi, i'm trying to draw a circle and sphere with OpenGL. But i don't know how. Could anyone drop me some hints plase~ thanks.

I looked at some of the sites that talke about opengl, but most of them only talk about cubes and triangles, but not spheres... (~_~) Even the book that i have, they use GLUT instead...

If any of you can drop me some hits, that would be great, once again, Thanks~~

(by the way, i need it in a kinda of hurry, for a project, thanks~~~ )

Thanks~~ (^_^)

This save me big time~~ Thanks (^_^)

(do they do support for cube too? or this one have to go to GLUT? coz the code isn't for me, is for my friend. If i can do it with cubes..etc too, then the code wouldn't look so mess, he would be easier to follow...

^_^ )

Once agin, Thanks~~~~ ^_^

Originally posted by nexusone:

There are two sphere rutines that you can call.

Under the glu library (glu.h):

gluSphere, gluDisk (Circle)

Under the glut library (glut.h):

glutSolidSphere, glutWireSphere.

Another option for drawing a circle is the use the math function for a circle using sin/cos.

nexusone

06-05-2002, 04:16 AM

First you should get your friend on this web site to help him learn.

glut is good for simple quick objects, but has some limitation.

some of the other shapes: Cube, Cone, Torus, Dodecahedron, Teapot.

glutSolid"shape" or glutWire"shape"

http://www.opengl.org/discussion_boards/ubb/smile.gif

Originally posted by [aNewbie]:

Thanks~~ (^_^)

This save me big time~~ Thanks (^_^)

(do they do support for cube too? or this one have to go to GLUT? coz the code isn't for me, is for my friend. If i can do it with cubes..etc too, then the code wouldn't look so mess, he would be easier to follow...

^_^ )

Once agin, Thanks~~~~ ^_^

Gavin

06-05-2002, 05:47 AM

Fair enough possibly with the sphere, But surely you can see that a cube can easily be constructed from squares, and each square can be made of 2 triangles.....

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.