Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to texture a sphere?  (Read 4304 times)

0 Members and 1 Guest are viewing this topic.

Williamson

  • Newbie
  • *
  • Posts: 16
    • View Profile
How to texture a sphere?
« 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

Williamson

  • Newbie
  • *
  • Posts: 16
    • View Profile
How to texture a sphere?
« Reply #1 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How to texture a sphere?
« Reply #2 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.
Laurent Gomila - SFML developer

nitram_cero

  • Full Member
  • ***
  • Posts: 166
    • View Profile
How to texture a sphere?
« Reply #3 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!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
How to texture a sphere?
« Reply #4 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 ;)
Laurent Gomila - SFML developer

 

anything