Sign in to follow this  
thorpe

Textures are mirrored (DevIL/LibPNG)

Recommended Posts

mirror them in photoshop? =)

no, seriously.. you could manually change the pixels after you´ve loaded the textures... I don't know how your texture loading code looks, so you´re on your own there...

It's seems like the easiest way would be to mirror them in photoshop thou... :)

Share this post


Link to post
Share on other sites
Quote:
Original post by thorpe
When I load my textures using DevIL, they get mirrored. How do I get around these problems?


You're probably drawing your quads/triangles in the wrong vertex order (or maybe the texcoords). Mess around a little until it gets right.

Share this post


Link to post
Share on other sites
Thing is, everything worked properly before when I had my own bmp read code. When I call glu functions, the textures get mirrored and I want to be able to use glu (and have proper coordinates). I suspect you have to call some DevIL function but I can't find any good example code.

Share this post


Link to post
Share on other sites
Well, you could try using the texture matrix. Just add a glScalef on it to mirror around the axis in question.

Share this post


Link to post
Share on other sites
No, the texture matrix is applied to the texture coordinates, not the textures, so you would have to have this transformation there every time you render an object that needs the texture coordinates mirrored.
Perhaps not the best solution, but it's a solution ;)

Share this post


Link to post
Share on other sites
Cheers!
Managed to solve it with iluFlipImage() which flips it around the x-axis (while iluMirrorImage() flips it around the y axis - good naming :) ). Quite ineffective having to flip the image once loaded though. DevIL doesn't seem to be too good implemented and documentation sucks.

ilOrigin() didn't work which would do these things before loading didn't work :(

Ah well, now it's working....

Thanks guys!

Share this post


Link to post
Share on other sites
Quote:
Original post by thorpe
Thing is, everything worked properly before when I had my own bmp read code. When I call glu functions, the textures get mirrored and I want to be able to use glu (and have proper coordinates). I suspect you have to call some DevIL function but I can't find any good example code.


Out of interest, did you remember that BMP format stores the data from bottom to top and therefore invert the order of the rows in your loader ?

If you didn't then you must have adjusted the texture coordinates to fix it which would make all the DevIL loaded images appear to be flipped top to bottom.

Share this post


Link to post
Share on other sites
Dunno, I've deleted my BMP handling code :) It worked fine together with glu calls though so I think it was correct and that DevIL is wrong (by default).

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