Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Different paletted texture formats

  1. #1

    Different paletted texture formats

    How to create data samples for each of the paletted texture formats supported by Opengl-es?

    Thank you.

  2. #2

    Re: Different paletted texture formats

    I googled for any tool to generate the palettized texture, but unfortunately not successful.

    So i plan to create the sample data by hand. But my next question is how to decide on the size of each texel.

    For Eg: PALETTE4_RGB8_OES, the spec says its 4 bits per texel, but what does RGB8 signify? 8 bits per color component?

    Simillarly for other palette formats.

    PALETTE4_RGBA8_OES
    PALETTE4_R5_G6_B5_OES
    PALETTE4_RGBA4_OES
    PALETTE4_RGB5_A1_OES
    PALETTE8_RGB8_OES
    PALETTE8_RGBA8_OES
    PALETTE8_R5_G6_B5_OES
    PALETTE8_RGBA4_OES
    PALETTE8_RGB5_A1_OES

    Is creating the texture samples by hand (using random number generation) a good idea?

  3. #3
    Junior Member
    Join Date
    Dec 2008
    Location
    Oslo, Norway
    Posts
    25

    Re: Different paletted texture formats

    RGB8 / RGBA8 / R5_G6_B5 etc is the format of the palette data, yes. PALETTE4 and PALETTE8 means the color-indices (or the bitmap) are 4 or 8 bits respectively (= 16 or 256 colors).
    Erik "kusma" Faye-Lund

  4. #4
    Junior Member
    Join Date
    Dec 2008
    Location
    Oslo, Norway
    Posts
    25

    Re: Different paletted texture formats

    I'd reccomend libraries like FreeImage that contains color quantizing functions for generating paletted images.
    Erik "kusma" Faye-Lund

  5. #5

    Re: Different paletted texture formats

    I would reframe my doubt as below:
    For Eg: PALETTE4_RGB8_OES : If each texel in this format is 4 bits, How is R,G,B each of 8 bits represented in each texel.

  6. #6
    Junior Member
    Join Date
    Dec 2008
    Location
    Oslo, Norway
    Posts
    25

    Re: Different paletted texture formats

    RGB isn't represented in a texel in paletted textures. Instead, you reference a color from a palette. So, for PALETTE4_RGB8_OES you have an array of 16 RGB8 colors (24bit packed), and a bitmap of references to that arrays (4 bit packed indices to that first array).
    Erik "kusma" Faye-Lund

  7. #7

    Re: Different paletted texture formats

    OK, Now i understand the meaning. Thank you.

    I would check the "FreeImage" suggested by you.

  8. #8

    Re: Different paletted texture formats

    To experiment,

    i have created a packed "unsigned char" array of random numbers to represent PALETTE4_RGB8_0ES format. The array is of size (128 * 12.

    For the API:
    glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_PALETTE4_RGB8_OES, 256, 256, 0, size, data);

    How to calculate "size" for a given width and height? Can i have a single mip-map level "0"?

  9. #9
    Senior Member
    Join Date
    May 2006
    Posts
    353

    Re: Different paletted texture formats

    The data passed to glCompressedTexImage2D for paletted textures consists of two parts: first the palette, followed by either a single mipmap level or the whole mipmap pyramid.

    PALETTE4_* formats have 16 palette entries and use 4 bits per pixel.
    PALETTE8_* formats have 256 palette entries and use 8 bits per pixel.

    *_RGBA8_OES formats use 32 bits per palette entry.
    *_RGB8_OES formats use 24 bits per palette entry.
    The other formats use 16 bits per palette entry.

    So the size of the palette in bytes is the number of palette entries times the bits per palette entry divided by 8. The size of each mipmap level is its width * height * bits per pixel / 8 (rounded up for 1x1 at 4bpp).

    So a single mipmap level for a PALETTE4_RGB8 texture of size 128 x 128 is 16 * 24 / 8 + 128 * 128 * 4 / 8 = 8240 bytes.
    Georg Kolling, Imagination Technologies
    Please ask questions specific to PowerVR hardware or SDKs on the PowerVR Insider Forum
    DevTech@imgtec.com | http://www.powervrinsider.com

  10. #10

    Re: Different paletted texture formats

    Thank you very much.

    I could display all the palette textures at mip map level 0, by using the equation and hand made array.

    But I was not successful for other miplevels, with the same equation, with corresponding level-width and level-height.

Page 1 of 2 12 LastLast

Similar Threads

  1. RGB Internal Texture formats in SC standard
    By Xuzuthor in forum OpenGL SC for Safety Critical Markets
    Replies: 3
    Last Post: 04-05-2010, 07:09 AM
  2. Possible error in paletted texture spec
    By mike260 in forum OpenGL ES general technical discussions
    Replies: 5
    Last Post: 03-16-2005, 02:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •