So this is a problem that has plagued our 2-man dev team for a while now. When
we originally started using FreeImage a year or so ago for our project using
SDL OpenGL for rendering, we discovered that images loaded by FreeImage, of
any type we used (jpg, png, tga), seems to swap the red and blue channels upon
loading.
We have fixed this, as of right now, by telling OpenGL that a RGB image is BGR
and RGBA image is BGRA, which works fine. It is still nagging at me, however.
Hum, I have no experience using FI + OpenGL, but in general you can swap R-B
in the freeimage.h line 104 and recompile...
I have done this myself, though there is some problems(inconsistencies) still
(now, IIRC, images with alpha are swapped).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't know if this can help, but there's a OpenGL sample in the distribution
that show how to display an image with OpenGL. See
FreeImage\Examples\OpenGL\TextureManager
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey guys.
So this is a problem that has plagued our 2-man dev team for a while now. When
we originally started using FreeImage a year or so ago for our project using
SDL OpenGL for rendering, we discovered that images loaded by FreeImage, of
any type we used (jpg, png, tga), seems to swap the red and blue channels upon
loading.
We have fixed this, as of right now, by telling OpenGL that a RGB image is BGR
and RGBA image is BGRA, which works fine. It is still nagging at me, however.
We load the image with the following code.
We then try to load the image as a texture using the following code...
As you can see, RGB is put in as GLenum BGR, and RGBA as BGRA. That causes the
correct behavior - otherwise we have swapped red/blue channels.
I had found a bug report about swapped channels that mentioned it being
existent for an earlier version, so I updated FreeImage, but no dice.
Any ideas? Couldn't find the answer through searching.
Thanks,
James
Hum, I have no experience using FI + OpenGL, but in general you can swap R-B
in the freeimage.h line 104 and recompile...
I have done this myself, though there is some problems(inconsistencies) still
(now, IIRC, images with alpha are swapped).
I don't know if this can help, but there's a OpenGL sample in the distribution
that show how to display an image with OpenGL. See
FreeImage\Examples\OpenGL\TextureManager