• Advertisement

Archived

This topic is now archived and is closed to further replies.

draw a torus?

This topic is 5899 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how i can draw with opengl (glut) a torus or has somebody an example of this? thx for answer

Share this post


Link to post
Share on other sites
Advertisement
I know this can be done with glaux. If you have that you can use auxSolidTorus I think it is...

If not, then I don''t know, sorry.

- Mike

Share this post


Link to post
Share on other sites
You can use these functions:
glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);

glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
a torus is simply circle swept in a circle around a center point. Psudeo code:

1. create a ring of vertices
2. offset ring to desired radius
3. rotate ring of vertices around the center (creating new vertices at each rotation)
4. connect the vertices to create the polygons (you can optimize this portion using indexed vertices or by stripping the triangles, maybe even use quads)
5. texture, light, render your newly made torus

learning to draw the torus may be a good idea if you are into math and dont want to start sing outside libs like glaux.

Share this post


Link to post
Share on other sites

  • Advertisement