#### Archived

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

# Texture mapping for a sphere

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

## Recommended Posts

Hi, I am having trouble mapping texture onto a sphere. The sphere data is read in from a file, and I have the following to calculate the coordinates:
float u=0, v=0;
else u=(PI+acos(x/(radius*sin(PI*(v)))))/TWOPI; 
This is what I got, can someone help me on this plz? Thanks. http://www.eq2cn.com/image/jupiter.jpg [edited by - tanissian on November 8, 2003 6:26:50 PM]

##### Share on other sites
If it''s a true sphere (ie, it''s a perfect sphere, no bulge at the equator) then i would suggest just using Quadrics, cuz they can generate their own tex coords.

##### Share on other sites
From tutorial 18 from NEHE, it seems quite easy to texture quadrics. However, how do we change the texture coordinates of a quadric? If we want to increase the number of tiles?

Thanks!

##### Share on other sites
quote:
Original post by Dragon88
If it''s a true sphere (ie, it''s a perfect sphere, no bulge at the equator) then i would suggest just using Quadrics, cuz they can generate their own tex coords.

Thx for the reply, but I have to use the points specified in the file.

##### Share on other sites

Without testing..

u = atan2(y,x) / (2*PI)v = acos(z) / PI

##### Share on other sites

use your own model, check out a skydome tutorial (google) and you''ll find out how to gen texcoords for a sphere.

[ My Site ]
All your source are belong to us
/*ilici*/

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 13
• ### Forum Statistics

• Total Topics
632960
• Total Posts
3009475
• ### Who's Online (See full list)

There are no registered users currently online

×