Sign in to follow this  
Followers 0
SelethD

Flip (Mirror Vertical) a texture

3 posts in this topic

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.
0

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites
You either need to invert the y coord (y = 1-y) or best to flip the texture before uploading it to the GPU.
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0