Jump to content

  • Log In with Google      Sign In   
  • Create Account


Flip (Mirror Vertical) a texture


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 SelethD   Members   -  Reputation: 390

Like
0Likes
Like

Posted 14 November 2012 - 09:21 PM

I have been having issues 'building' a texture from several others. At first I thought I needed to 'blit' one texture upon the other, then I realized, I need to 'render' onto a texture.

So , I have my src textures, and I render them onto my destination texture, this works great, until I then try to use that destination texture, and its totally upside down, mirrored.

After some reading, it appears this is a common issue with rendering onto a texture.

I dont really feel like making a duplicate for all my text drawing, sprite drawing functions just to make them reverse the Y

So, my question is.... once I have my destination texture, is there an easy way to simply Flip the texture, so then when I do use it to render, it will be correct.

I was thinking... is it possible to render the texture onto itself?

such as, if I have my dst texture as my render target, can I simply render it to itself, on a quad with an inverted texture Y coord?

Thanks for any advice.

Sponsor:

#2 SelethD   Members   -  Reputation: 390

Like
0Likes
Like

Posted 14 November 2012 - 10:14 PM

Ok, I have tried to render a quad textured with the 'render target' texture, onto itself, and this works.

However, i cant figure out to flip it vertically, I tried to swap the UV for the Y portion (cant remember if the Y is the U or the V) when drawing the quad, but it displays it scrambled, instead of mirrored.

Any suggestions on how to render the quad with the mirrored texture?

Thanks.

#3 Ashaman73   Crossbones+   -  Reputation: 7126

Like
1Likes
Like

Posted 15 November 2012 - 12:37 AM

You either need to invert the y coord (y = 1-y) or best to flip the texture before uploading it to the GPU.

#4 SelethD   Members   -  Reputation: 390

Like
0Likes
Like

Posted 15 November 2012 - 06:29 AM

Thanks, I inverted the y-coord. All is well




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS