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

Author Topic: Flipped Textures  (Read 2490 times)

0 Members and 1 Guest are viewing this topic.

asdatapel

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Flipped Textures
« on: July 03, 2013, 07:34:22 pm »
Im using Opengl with SFML and im trying to map a texture, but its coming out flipped. In order to get the texture to appear the 'proper' OpenGL way (with the origin at the bottom left), I have to flip the sf::Image horizontally and then vertically. Is this the right way, or am I doing it wrong?

Ive looked around for answer to this but i cant find one. I found this:
http://en.sfml-dev.org/forums/index.php?topic=1273.0
but it doesnt seem to have a solution.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Flipped Textures
« Reply #1 on: July 03, 2013, 08:08:33 pm »
Why don't you flip your texture coordinates instead?
Laurent Gomila - SFML developer

asdatapel

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Flipped Textures
« Reply #2 on: July 03, 2013, 08:56:11 pm »
what do you mean?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Flipped Textures
« Reply #3 on: July 03, 2013, 08:58:29 pm »
You define texture coordinates, right? So you can change these values (swap top and bottom coordinates) instead of flipping the whole texture.
Laurent Gomila - SFML developer

asdatapel

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Flipped Textures
« Reply #4 on: July 04, 2013, 10:45:28 pm »
Gotcha, but that is knid of annoying though, because then you have to do it for every single coordinate

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Flipped Textures
« Reply #5 on: July 04, 2013, 10:46:48 pm »
Write a function that does it for you.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Flipped Textures
« Reply #6 on: July 05, 2013, 07:58:58 am »
And? You already define all the texture coordinates in your code, right? So there's no extra work, just swap the values for top and bottom coordinates.
Laurent Gomila - SFML developer