Problems while generating compressed_paletted_texture
I have faced up a problem on android device with compressed_paletted_texture and would really appreciate any help.
I have a bmp RGBA_8888. I am generating a paletted_texture PALETTE8_RGBA8_OES from it and than upload it to openGL with glCompressedTexImage2D. It works fine...except the colours are not right ones. I am getting some strange image as a result:
As you can see alpha channel is fine and that means that indexes and compressed img structure is ok, the problem is with the colours itself.
I believe it might be a problem with a difference in a colour representation in java and native openGL.
Here is my code(java android) to write colours in palette:
ByteArrayOutputStream bout = new ByteArrayOutputStream(size);
DataOutputStream out = new DataOutputStream(bout);
int colour = bmp.getPixel(i, j); //get a pixel colour, int = 4 bytes = RGBA_8888
The structure of compressed image is the next(is it correct?):
Could anyone advise me what the problem is?
Re: Problems while generating compressed_paletted_texture
Hopefully I have found the problem.
Maybe it will help someone:
Bitmap in java is not RGBA...it is ARGB. Thats the problem. So everything you need to do is to move first alpha colour byte to the end, so it will be openGL style RGBA.