1
Graphics / Loading indexed images with transparency
« on: June 06, 2017, 12:06:12 pm »
Hello everybody,
I'm working on a SFML + OpenGL project that uses age of empires sprites (with indexed colors) and transparency. However when loading the images some weird artifacts appear. The alpha channel seems to modify the rgb channel on loading.
This is an OpenGL render without glblend where the texture behaves as expected: the transparent pixels have a black color.
See aoe1.png (I'm sorry I don't know how to integrate the image in the post).
The palette can be seen on aoe1_palette.png
But when using age of empires 2 palette, it gives some blue color to the transparent background, as seen on aoe2.png
The palette is aoe2_palette.png
Note that the color of the background is not present on the palette (even though some are close). The same effect appears with a custom palette.
It does work with unindexed color though, and I'll eventually come to using it, but I feel like it's a huge waste of space.
Edit: I'm using SFML 2.4.2 and the bug appears on Linux, Mac OS and Windows
Thanks in advance for your help !
Paul
I'm working on a SFML + OpenGL project that uses age of empires sprites (with indexed colors) and transparency. However when loading the images some weird artifacts appear. The alpha channel seems to modify the rgb channel on loading.
This is an OpenGL render without glblend where the texture behaves as expected: the transparent pixels have a black color.
See aoe1.png (I'm sorry I don't know how to integrate the image in the post).
The palette can be seen on aoe1_palette.png
But when using age of empires 2 palette, it gives some blue color to the transparent background, as seen on aoe2.png
The palette is aoe2_palette.png
Note that the color of the background is not present on the palette (even though some are close). The same effect appears with a custom palette.
It does work with unindexed color though, and I'll eventually come to using it, but I feel like it's a huge waste of space.
Edit: I'm using SFML 2.4.2 and the bug appears on Linux, Mac OS and Windows
Thanks in advance for your help !
Paul