Results 1 to 2 of 2

Thread: Problems while generating compressed_paletted_texture

  1. #1
    Junior Member
    Join Date
    Feb 2011

    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:

    Code :
    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
    return bout.toByteArray();

    The structure of compressed image is the next(is it correct?):

    Could anyone advise me what the problem is?


  2. #2
    Junior Member
    Join Date
    Feb 2011

    Re: Problems while generating compressed_paletted_texture

    Hopefully I have found the problem.

    Maybe it will help someone:
    Bitmap in java is not 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.

Similar Threads

  1. Replies: 3
    Last Post: 01-28-2013, 07:25 PM
  2. OpenGLES for generating 3d view
    By shihabkb in forum OpenGL ES
    Replies: 1
    Last Post: 08-23-2011, 02:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean