Ok all i want to do is load images into textures for a 2d game using devil, i want the origin of the images to be at the top left.
My problems are:
Why on earth do some image formats get loaded upside down when others dont?
How do i make alpha work?
Ok all i want to do is load images into textures for a 2d game using devil, i want the origin of the images to be at the top left.
My problems are:
Why on earth do some image formats get loaded upside down when others dont?
How do i make alpha work?
To flip the image, use ILU.iluFlipImage() after your IL.ilBindImage() call.
To get alpha, just make sure you have the right format in IL.ilCopyPixels, e.g.:
ByteBuffer data = BufferUtils.createByteBuffer(numPixels * 4);
IL.ilCopyPixels(0, 0, 0, width, height, 1, IL.IL_RGBA, IL.IL_BYTE, data);
How can i find out if i need to flip the image?
You just have to know what kind of data is incoming. In my experience, artists & their tools like to think of the texture UVS at the bottom left & top right as 0,0 & 1,1, respectively. OpenGL image space is flipped from this (0,1 & 1,0)… I flip all my incoming textures as a matter of course. I also flip my modelview matrix into a left-handed coordinate system to be consistent with what most artists are used to.