SFML community forums

Help => General => Topic started by: asdatapel on July 03, 2013, 07:34:22 pm

Title: Flipped Textures
Post by: asdatapel 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.
Title: Re: Flipped Textures
Post by: Laurent on July 03, 2013, 08:08:33 pm
Why don't you flip your texture coordinates instead?
Title: Re: Flipped Textures
Post by: asdatapel on July 03, 2013, 08:56:11 pm
what do you mean?
Title: Re: Flipped Textures
Post by: Laurent 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.
Title: Re: Flipped Textures
Post by: asdatapel 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
Title: Re: Flipped Textures
Post by: Nexus on July 04, 2013, 10:46:48 pm
Write a function that does it for you.
Title: Re: Flipped Textures
Post by: Laurent 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.