#### Archived

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

# Generating a 3D sphere

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

## Recommended Posts

I need an algorithm for generating vertices for a 3D sphere, which has N segments and consists of triangular faces. I was able to generate some vertices that form a sphere of points, but I can''t figure out how to connect them to each other to create those triangles. Please, help me! I''m out of brainpower. rk

##### Share on other sites

Click on "view" (revision 1.9). The function gluSphere is the one you''re looking for.

##### Share on other sites
Thanks for the link, it''s great... except that the function uses the method GL_QUADSTRIP for rendering. And what I am looking for is more like triangle strip. You might think "but hey, he knows how to do it with quad strip, why couldn''t he just convert that to triangle strip?" It''s because I don''t find it a trivial task at all.

So in other words, I need more help!

rk

##### Share on other sites
You may want to look for a "geodesic" sphere generation routine. Try keywords in a search engine: geodesic, dome, sphere, tesselation, algorithm. A sphere tesselated using the geodesic style will be made of triangles of a uniform size and shape (actually, equilateral triangles) which can look much better (when rendered with textures/lighting----due to view-angle-independent symmetry) than a sphere tesselated into quads using the latitude/longitude style (as in the gluSphere approach).

If a tesselation gives triangles, but not tristrips, then you can send the triangles to a postprocessor such as nVidia''s NvTriStrip utility (see NVSDK on developer pages at www.nvidia.com) to generate tristrips.

Try doing a search on the GDAlgorithms list archives here:

http://www.geocrawler.com/lists/3/SourceForge/4856/0/"

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

##### Share on other sites
I finally solved the problem! Thanks everyone (both of you) for help!

Now I have a class for creating neat looking textured spheres of any radius and precision that I desire!

Here is the link that helped me the most:
http://astronomy.swin.edu.au/pbourke/opengl/sphere/

rk

Edited by - rk on December 26, 2001 4:09:11 PM

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
633710
• Total Posts
3013486
×