Textures are mirrored (DevIL/LibPNG)

Started by
11 comments, last by thorpe 19 years, 8 months ago
When I load my textures using DevIL, they get mirrored. How do I get around these problems?
Johan Torp - http://www.destruction.nu
Advertisement
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... :)

"Game Maker For Life, probably never professional thou." =)
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.
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.
Johan Torp - http://www.destruction.nu
Well, you could try using the texture matrix. Just add a glScalef on it to mirror around the axis in question.
Could I do this before loading the textures and then resetting it?
Johan Torp - http://www.destruction.nu
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 ;)
Look what I found: link
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!
Johan Torp - http://www.destruction.nu
You're welcome. :)
I read some more docs, and I assume that it's ilOriginFunc you've tried? You need to do ilEnable(IL_ORIGIN_SET) for it to work.

This topic is closed to new replies.

Advertisement