SFML community forums

Help => Graphics => Topic started by: Williamson on July 02, 2009, 11:34:03 am

Title: How to texture a sphere?
Post by: Williamson on July 02, 2009, 11:34:03 am
Hi
For a game I am making, I need to draw a sphere, representing a planet.
However, I cannot work out how do texture a sphere create dwith this code, by using a sf::Image
Code: [Select]
gluSphere(params,25,20,20);
Thanks for any help that can be offered :)
Williamson
Title: How to texture a sphere?
Post by: Williamson on July 03, 2009, 12:50:13 pm
I may have found a solution: does anyone know of an example of the Bind() function of the Image class, used in conjunction with a gluSphere.
Thanks!
Williamson
Title: How to texture a sphere?
Post by: Laurent on July 03, 2009, 01:01:08 pm
It has nothing to do with SFML and sf::Image, you just have to generate proper texture coordinates for your sphere.

If I remember correctly, you can't do that directly with gluSphere.
Title: How to texture a sphere?
Post by: nitram_cero on July 06, 2009, 11:13:52 pm
Take into notice that SFML Clamps the images. You must reset the texture wrapping to GL_REPEAT using glTexParameter after calling sf::Image::Bind()

:)

Goodluck!
Title: How to texture a sphere?
Post by: Laurent on July 07, 2009, 07:52:41 am
Quote
Take into notice that SFML Clamps the images. You must reset the texture wrapping to GL_REPEAT using glTexParameter after calling sf::Image::Bind()

Which won't work if there's padding in your texture ;)