Oh God this is so complicated. kkk
Anyway thanks for the feedback. So I will try the shaders, first of all I will pick the example Audric posted.
I will code some thing using allegro5, and I will post here what I could get.
Just one more thing, using shaders will breack the multiplataform of my program?
Thanks in advance.
So I have done the palette swapping. But I found some problems. To swap the colors I have the image and some palettes. So What I do is:
Load the palettes;
Load the Image;
reindex theimage colors: This step is costy. What I do is, searching the image for the colors in palette - 1 (the original palette), then When I found the color in the image I put another color, this time I put like
Where pal is the position of the color in the palette...
Where I'm running my program, I pass the color palette for the shader, in the shader I pick the red component and use it as an index for acessing the palette color, get the right color than coloring it right.
The fact is: I have to do the remapping of the colors because allegro5 dont load the image in 8 bits, if it was like allegro4, I could just pick the colors indexes of the palette with get_pixel and use the correct index normally.
By the way there is another problem, I dont know if it is just in my PC or what, but when running my shader I get this error:
i915_program_error: bad opcode: ARL
I have searched in google and found almost nothing, just in some places say that this opcode ARL isn't suported and thats that. But how can I dont use it? XD
The code and the resources used in the experiment are attached .