15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    OES_compressed_paletted_texture
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_OES_compressed_paletted_texture
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContact
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Aaftab Munshi, ATI (amunshi@ati.com)
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciNotice
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    Copyright (c) 2003-2013 The Khronos Group Inc. Copyright terms at
165bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ciSpecification Update Policy
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
215bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL ES Working Group. For
225bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
235bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
245bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
255bd8deadSopenharmony_ci    described in more detail at
265bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ciIP Status
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ci    No known IP issues
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ciStatus
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    Ratified by the Khronos BOP, July 23, 2003.
355bd8deadSopenharmony_ci
365bd8deadSopenharmony_ciVersion
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci    Last Modifed Date: 12 November 2005
395bd8deadSopenharmony_ci    Author Revision: 0.6
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ciNumber
425bd8deadSopenharmony_ci
435bd8deadSopenharmony_ci    OpenGL ES Extension #6 (formerly OpenGL Extension #294)
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ciDependencies
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ci    Written based on the wording of the OpenGL ES 1.0 specification
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ciOverview
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ci    The goal of this extension is to allow direct support of palettized
525bd8deadSopenharmony_ci    textures in OpenGL ES.
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci    Palettized textures are implemented in OpenGL ES using the
555bd8deadSopenharmony_ci    CompressedTexImage2D call. The definition of the following parameters
565bd8deadSopenharmony_ci    "level" and "internalformat" in the CompressedTexImage2D call have
575bd8deadSopenharmony_ci    been extended to support paletted textures.
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    A paletted texture is described by the following data:
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ci        palette format
625bd8deadSopenharmony_ci            can be R5_G6_B5, RGBA4, RGB5_A1, RGB8, or RGBA8
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ci        number of bits to represent texture data
655bd8deadSopenharmony_ci            can be 4 bits or 8 bits per texel.  The number of bits
665bd8deadSopenharmony_ci            also detemine the size of the palette.  For 4 bits/texel
675bd8deadSopenharmony_ci            the palette size is 16 entries and for 8 bits/texel the
685bd8deadSopenharmony_ci            palette size will be 256 entries.
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci            The palette format and bits/texel are encoded in the
715bd8deadSopenharmony_ci            "internalformat" parameter.
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ci        palette data and texture mip-levels
745bd8deadSopenharmony_ci            The palette data followed by all necessary mip levels are
755bd8deadSopenharmony_ci            passed in "data" parameter of CompressedTexImage2D.
765bd8deadSopenharmony_ci
775bd8deadSopenharmony_ci            The size of palette is given by palette format and bits / texel.
785bd8deadSopenharmony_ci            A palette format of RGB_565 with 4 bits/texel imply a palette
795bd8deadSopenharmony_ci            size of 2 bytes/palette entry * 16 entries = 32 bytes.
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci            The level value is used to indicate how many mip levels
825bd8deadSopenharmony_ci            are described.  Negative level values are used to define
835bd8deadSopenharmony_ci            the number of miplevels described in the "data" component.
845bd8deadSopenharmony_ci            A level of zero indicates a single mip-level.
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ciIssues
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci    *   Should glCompressedTexSubImage2D be allowed for modifying paletted
895bd8deadSopenharmony_ci        texture data.
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci        RESOLVED:  No, this would then require implementations that do not
925bd8deadSopenharmony_ci        support paletted formats internally to also store the palette
935bd8deadSopenharmony_ci        per texture.  This can be a memory overhead on platforms that are
945bd8deadSopenharmony_ci        memory constrained.
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ci    *   Should palette format and number of bits used to represent each
975bd8deadSopenharmony_ci        texel be part of data or internal format.
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci        RESOLVED:  Should be part of the internal format since this makes
1005bd8deadSopenharmony_ci        the palette format and texture data size very explicit for the
1015bd8deadSopenharmony_ci        application programmer.
1025bd8deadSopenharmony_ci
1035bd8deadSopenharmony_ci    *   Should the size of palette be fixed i.e 16 entries for 4-bit texels
1045bd8deadSopenharmony_ci        and 256 entries for 8-bit texels or be programmable.
1055bd8deadSopenharmony_ci
1065bd8deadSopenharmony_ci        RESOLVED:  Should be fixed.  The application can expand the palette
1075bd8deadSopenharmony_ci        to 16 or 256 if internally it is using a smaller palette.
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ci
1105bd8deadSopenharmony_ciNew Procedures and Functions
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ci    None
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ciNew Tokens
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci    Accepted by the <level> parameter of CompressedTexImage2D
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ci        Zero and negative values.  |level| + 1 determines the number of
1205bd8deadSopenharmony_ci        mip levels defined for the paletted texture.
1215bd8deadSopenharmony_ci
1225bd8deadSopenharmony_ci    Accepted by the <internalformat> paramter of CompressedTexImage2D
1235bd8deadSopenharmony_ci
1245bd8deadSopenharmony_ci        PALETTE4_RGB8_OES         0x8B90
1255bd8deadSopenharmony_ci        PALETTE4_RGBA8_OES        0x8B91
1265bd8deadSopenharmony_ci        PALETTE4_R5_G6_B5_OES     0x8B92
1275bd8deadSopenharmony_ci        PALETTE4_RGBA4_OES        0x8B93
1285bd8deadSopenharmony_ci        PALETTE4_RGB5_A1_OES      0x8B94
1295bd8deadSopenharmony_ci        PALETTE8_RGB8_OES         0x8B95
1305bd8deadSopenharmony_ci        PALETTE8_RGBA8_OES        0x8B96
1315bd8deadSopenharmony_ci        PALETTE8_R5_G6_B5_OES     0x8B97
1325bd8deadSopenharmony_ci        PALETTE8_RGBA4_OES        0x8B98
1335bd8deadSopenharmony_ci        PALETTE8_RGB5_A1_OES      0x8B99
1345bd8deadSopenharmony_ci
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 1.3 Specification (OpenGL Operation)
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci    None
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci
1415bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.3 Specification (Rasterization)
1425bd8deadSopenharmony_ci
1435bd8deadSopenharmony_ci    Add to Table 3.17:  Specific Compressed Internal Formats
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ci        Compressed Internal Format         Base Internal Format
1465bd8deadSopenharmony_ci        ==========================         ====================
1475bd8deadSopenharmony_ci        PALETTE4_RGB8_OES                     RGB
1485bd8deadSopenharmony_ci        PALETTE4_RGBA8_OES                    RGBA
1495bd8deadSopenharmony_ci        PALETTE4_R5_G6_B5_OES                 RGB
1505bd8deadSopenharmony_ci        PALETTE4_RGBA4_OES                    RGBA
1515bd8deadSopenharmony_ci        PALETTE4_RGB5_A1_OES                  RGBA
1525bd8deadSopenharmony_ci        PALETTE8_RGB8_OES                     RGB
1535bd8deadSopenharmony_ci        PALETTE8_RGBA8_OES                    RGBA
1545bd8deadSopenharmony_ci        PALETTE8_R5_G6_B5_OES                 RGB
1555bd8deadSopenharmony_ci        PALETTE8_RGBA4_OES                    RGBA
1565bd8deadSopenharmony_ci        PALETTE8_RGB5_A1_OES                  RGBA
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    Add to Section 3.8.3, Alternate Image Specification 
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ci    If <internalformat> is PALETTE4_RGB8, PALETTE4_RGBA8, PALETTE4_R5_G6_B5,
1615bd8deadSopenharmony_ci    PALETTE4_RGBA4, PALETTE4_RGB5_A1, PALETTE8_RGB8, PALETTE8_RGBA8,
1625bd8deadSopenharmony_ci    PALETTE8_R5_G6_B5, PALETTE8_RGBA4 or PALETTE8_RGB5_A1, the compressed
1635bd8deadSopenharmony_ci    texture is a compressed paletted texture.  The texture data contains the
1645bd8deadSopenharmony_ci    palette data following by the mip-levels where the number of mip-levels
1655bd8deadSopenharmony_ci    stored is given by |level| + 1.  The number of bits that represent a
1665bd8deadSopenharmony_ci    texel is 4 bits if <interalformat> is given by PALETTE4_xxx and is 8
1675bd8deadSopenharmony_ci    bits if <internalformat> is given by PALETTE8_xxx.
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ci    The number of bits that represent each palette entry is:
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci        Compressed Internal Format         # of bits / palette entry
1725bd8deadSopenharmony_ci        ==========================         =========================
1735bd8deadSopenharmony_ci        PALETTE4_RGB8_OES                     24
1745bd8deadSopenharmony_ci        PALETTE4_RGBA8_OES                    32
1755bd8deadSopenharmony_ci        PALETTE4_R5_G6_B5_OES                 16
1765bd8deadSopenharmony_ci        PALETTE4_RGBA4_OES                    16
1775bd8deadSopenharmony_ci        PALETTE4_RGB5_A1_OES                  16
1785bd8deadSopenharmony_ci        PALETTE8_RGB8_OES                     24
1795bd8deadSopenharmony_ci        PALETTE8_RGBA8_OES                    32
1805bd8deadSopenharmony_ci        PALETTE8_R5_G6_B5_OES                 16
1815bd8deadSopenharmony_ci        PALETTE8_RGBA4_OES                    16
1825bd8deadSopenharmony_ci        PALETTE8_RGB5_A1_OES                  16
1835bd8deadSopenharmony_ci
1845bd8deadSopenharmony_ci    Compressed paletted textures support only 2D images without
1855bd8deadSopenharmony_ci    borders. CompressedTexImage2D will produce an INVALID_OPERATION
1865bd8deadSopenharmony_ci    error if <border> is non-zero.
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ci    To determine palette format refer to tables 3.10 and 3.11 of Chapter
1905bd8deadSopenharmony_ci    3 where the data ordering for different <type> formats are described.
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ci    Add table 3.17.1:  Texel Data Formats for compressed paletted textures
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ci    PALETTE4_xxx:
1955bd8deadSopenharmony_ci
1965bd8deadSopenharmony_ci         7 6 5 4 3 2 1 0
1975bd8deadSopenharmony_ci         ---------------
1985bd8deadSopenharmony_ci        |  1st  |  2nd  |
1995bd8deadSopenharmony_ci        | texel | texel |
2005bd8deadSopenharmony_ci         ---------------
2015bd8deadSopenharmony_ci
2025bd8deadSopenharmony_ci    PALETTE8_xxx
2035bd8deadSopenharmony_ci
2045bd8deadSopenharmony_ci
2055bd8deadSopenharmony_ci  31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
2065bd8deadSopenharmony_ci  -------------------------------------------------------------------------------------
2075bd8deadSopenharmony_ci |         4th           |          3nd          |          2rd        |     1st       |
2085bd8deadSopenharmony_ci |        texel          |         texel         |         texel       |    texel      |
2095bd8deadSopenharmony_ci  -------------------------------------------------------------------------------------
2105bd8deadSopenharmony_ci
2115bd8deadSopenharmony_ci
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.3 Specification  (Per-Fragment
2145bd8deadSopenharmony_ciOperations and the Frame Buffer)
2155bd8deadSopenharmony_ci
2165bd8deadSopenharmony_ci    None
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci
2195bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.3 Specification (Special Functions)
2205bd8deadSopenharmony_ci
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ci    None
2235bd8deadSopenharmony_ci
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.3 Specification (State and
2265bd8deadSopenharmony_ciState Requests)
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ci    None
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci
2315bd8deadSopenharmony_ciAdditions to Appendix A of the OpenGL 1.3 Specification (Invariance)
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci
2345bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specification
2355bd8deadSopenharmony_ci
2365bd8deadSopenharmony_ci    None
2375bd8deadSopenharmony_ci
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ciGLX Protocol
2405bd8deadSopenharmony_ci
2415bd8deadSopenharmony_ci    None
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ci
2445bd8deadSopenharmony_ciErrors
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ci    INVALID_OPERATION is generated by TexImage2D, CompressedTexSubImage2D,
2475bd8deadSopenharmony_ci    CopyTexSubImage2D if <internalformat> is PALETTE4_RGB8_OES,
2485bd8deadSopenharmony_ci    PALETTE4_RGBA8_OES, PALETTE4_R5_G6_B5_OES, PALETTE4_RGBA4_OES,
2495bd8deadSopenharmony_ci    PALETTE4_RGB5_A1_OES, PALETTE8_RG8_OES, PALETTE8_RGBA8_OES,
2505bd8deadSopenharmony_ci    PALETTE8_R5_G6_B5_OES, PALETTE8_RGBA4_OES, or PALETTE8_RGB5_A1_OES.
2515bd8deadSopenharmony_ci
2525bd8deadSopenharmony_ci    INVALID_VALUE is generated by CompressedTexImage2D if
2535bd8deadSopenharmony_ci    if <internalformat> is PALETTE4_RGB8_OES, PALETTE4_RGBA8_OES,
2545bd8deadSopenharmony_ci    PALETTE4_R5_G6_B5_OES, PALETTE4_RGBA4_OES, PALETTE4_RGB5_A1_OES,
2555bd8deadSopenharmony_ci    PALETTE8_RGB8_OES, PALETTE8_RGBA8_OES, PALETTE8_R5_G6_B5_OES,
2565bd8deadSopenharmony_ci    PALETTE8_RGBA4_OES, or PALETTE8_RGB5_A1_OES and <level> value is
2575bd8deadSopenharmony_ci    neither zero or a negative value.
2585bd8deadSopenharmony_ci
2595bd8deadSopenharmony_ci
2605bd8deadSopenharmony_ciNew State
2615bd8deadSopenharmony_ci
2625bd8deadSopenharmony_ci    The queries for NUM_COMPRESSED_TEXTURE_FORMATS and 
2635bd8deadSopenharmony_ci    COMPRESSED_TEXTURE_FORMATS include these ten new formats.
2645bd8deadSopenharmony_ci
2655bd8deadSopenharmony_ciRevision History
2665bd8deadSopenharmony_ci    04/28/2003    0.1    (Aaftab Munshi)
2675bd8deadSopenharmony_ci         - Original draft.
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci    05/29/2003    0.2    (David Blythe)
2705bd8deadSopenharmony_ci         - Use paletted rather than palettized.  Change naming of internal
2715bd8deadSopenharmony_ci           format tokens to match scheme used for other internal formats.
2725bd8deadSopenharmony_ci
2735bd8deadSopenharmony_ci    07/08/2003    0.3    (David Blythe)
2745bd8deadSopenharmony_ci         - Add official enumerant values and extension number.
2755bd8deadSopenharmony_ci
2765bd8deadSopenharmony_ci    07/09/2003    0.4    (David Blythe)
2775bd8deadSopenharmony_ci         - Note that [NUM_]COMPRESSED_TEXTURE_FORMAT queries include the
2785bd8deadSopenharmony_ci           new formats.
2795bd8deadSopenharmony_ci
2805bd8deadSopenharmony_ci    07/21/2004    0.5    (Aaftab Munshi)
2815bd8deadSopenharmony_ci           - Fixed PALETTE_8xxx drawing
2825bd8deadSopenharmony_ci
2835bd8deadSopenharmony_ci    11/12/2005    0.6    (Aaftab Munshi)
2845bd8deadSopenharmony_ci       - Corrections
285