Snow Spider

12-28-2011, 06:33 PM

Hi,

I'm trying to render a geodesic sphere and make it look like the Earth by applying a single piece of texture on it.

I'm familiar with Java, C++, gmax and gimp. But I'm new to OpenGL. I went whrough www.videotutorialsrock.com (http://www.videotutorialsrock.com) so I can do some basic stuff. Also I have downloaded some codes from Bullet Physics to make my life easier and play with vectors.

Here's what I have accomplished so far:

1. Draw 20 triangles to form an icosahedron

2. Apply the texture on each triangle by assigning texture coordinates to each vertex. I simply used the top-middle, bottom-left and botton-right positions on the 256-by-256 bitmap file.

3. Subdivide each triangle into 4 little triangles and pull the new vertices out so they are separated from the center just as far as the old vertices. Draw triangles all over again, with texture.

4. Perform such subdivision k times until it reaches the desired shape, where k = 0, 1, 2, 3...

5. Make the "planet" rotate

Goal:

Instead of painting a picture on individual triangles, I want the picture to cover the entire planet. Also, it should work with any number of subdivisions.

A Wikipedia article on Dymaxion map provides some clue, but it doesn't explain the math behind it.

There are many ways to unfold the polygon for Dymaxion map, but I prefer the way discussed in

http://freeciv.wikia.com/wiki/Talk:Sphere

It will fit into a rectangular texture file. Also, the equator will look straight, which is a good thing.

I'll probably have to subdivide the picture and assign coorninates to each vertex. I'm unable to devise an algorithm that does that. The vertices in my sphere are not indexed in any way.

Any suggestion?

I'm trying to render a geodesic sphere and make it look like the Earth by applying a single piece of texture on it.

I'm familiar with Java, C++, gmax and gimp. But I'm new to OpenGL. I went whrough www.videotutorialsrock.com (http://www.videotutorialsrock.com) so I can do some basic stuff. Also I have downloaded some codes from Bullet Physics to make my life easier and play with vectors.

Here's what I have accomplished so far:

1. Draw 20 triangles to form an icosahedron

2. Apply the texture on each triangle by assigning texture coordinates to each vertex. I simply used the top-middle, bottom-left and botton-right positions on the 256-by-256 bitmap file.

3. Subdivide each triangle into 4 little triangles and pull the new vertices out so they are separated from the center just as far as the old vertices. Draw triangles all over again, with texture.

4. Perform such subdivision k times until it reaches the desired shape, where k = 0, 1, 2, 3...

5. Make the "planet" rotate

Goal:

Instead of painting a picture on individual triangles, I want the picture to cover the entire planet. Also, it should work with any number of subdivisions.

A Wikipedia article on Dymaxion map provides some clue, but it doesn't explain the math behind it.

There are many ways to unfold the polygon for Dymaxion map, but I prefer the way discussed in

http://freeciv.wikia.com/wiki/Talk:Sphere

It will fit into a rectangular texture file. Also, the equator will look straight, which is a good thing.

I'll probably have to subdivide the picture and assign coorninates to each vertex. I'm unable to devise an algorithm that does that. The vertices in my sphere are not indexed in any way.

Any suggestion?