1Name 2 3 OES_compressed_paletted_texture 4 5Name Strings 6 7 GL_OES_compressed_paletted_texture 8 9Contact 10 11 Aaftab Munshi, ATI (amunshi@ati.com) 12 13Notice 14 15 Copyright (c) 2003-2013 The Khronos Group Inc. Copyright terms at 16 http://www.khronos.org/registry/speccopyright.html 17 18Specification Update Policy 19 20 Khronos-approved extension specifications are updated in response to 21 issues and bugs prioritized by the Khronos OpenGL ES Working Group. For 22 extensions which have been promoted to a core Specification, fixes will 23 first appear in the latest version of that core Specification, and will 24 eventually be backported to the extension document. This policy is 25 described in more detail at 26 https://www.khronos.org/registry/OpenGL/docs/update_policy.php 27 28IP Status 29 30 No known IP issues 31 32Status 33 34 Ratified by the Khronos BOP, July 23, 2003. 35 36Version 37 38 Last Modifed Date: 12 November 2005 39 Author Revision: 0.6 40 41Number 42 43 OpenGL ES Extension #6 (formerly OpenGL Extension #294) 44 45Dependencies 46 47 Written based on the wording of the OpenGL ES 1.0 specification 48 49Overview 50 51 The goal of this extension is to allow direct support of palettized 52 textures in OpenGL ES. 53 54 Palettized textures are implemented in OpenGL ES using the 55 CompressedTexImage2D call. The definition of the following parameters 56 "level" and "internalformat" in the CompressedTexImage2D call have 57 been extended to support paletted textures. 58 59 A paletted texture is described by the following data: 60 61 palette format 62 can be R5_G6_B5, RGBA4, RGB5_A1, RGB8, or RGBA8 63 64 number of bits to represent texture data 65 can be 4 bits or 8 bits per texel. The number of bits 66 also detemine the size of the palette. For 4 bits/texel 67 the palette size is 16 entries and for 8 bits/texel the 68 palette size will be 256 entries. 69 70 The palette format and bits/texel are encoded in the 71 "internalformat" parameter. 72 73 palette data and texture mip-levels 74 The palette data followed by all necessary mip levels are 75 passed in "data" parameter of CompressedTexImage2D. 76 77 The size of palette is given by palette format and bits / texel. 78 A palette format of RGB_565 with 4 bits/texel imply a palette 79 size of 2 bytes/palette entry * 16 entries = 32 bytes. 80 81 The level value is used to indicate how many mip levels 82 are described. Negative level values are used to define 83 the number of miplevels described in the "data" component. 84 A level of zero indicates a single mip-level. 85 86Issues 87 88 * Should glCompressedTexSubImage2D be allowed for modifying paletted 89 texture data. 90 91 RESOLVED: No, this would then require implementations that do not 92 support paletted formats internally to also store the palette 93 per texture. This can be a memory overhead on platforms that are 94 memory constrained. 95 96 * Should palette format and number of bits used to represent each 97 texel be part of data or internal format. 98 99 RESOLVED: Should be part of the internal format since this makes 100 the palette format and texture data size very explicit for the 101 application programmer. 102 103 * Should the size of palette be fixed i.e 16 entries for 4-bit texels 104 and 256 entries for 8-bit texels or be programmable. 105 106 RESOLVED: Should be fixed. The application can expand the palette 107 to 16 or 256 if internally it is using a smaller palette. 108 109 110New Procedures and Functions 111 112 None 113 114 115New Tokens 116 117 Accepted by the <level> parameter of CompressedTexImage2D 118 119 Zero and negative values. |level| + 1 determines the number of 120 mip levels defined for the paletted texture. 121 122 Accepted by the <internalformat> paramter of CompressedTexImage2D 123 124 PALETTE4_RGB8_OES 0x8B90 125 PALETTE4_RGBA8_OES 0x8B91 126 PALETTE4_R5_G6_B5_OES 0x8B92 127 PALETTE4_RGBA4_OES 0x8B93 128 PALETTE4_RGB5_A1_OES 0x8B94 129 PALETTE8_RGB8_OES 0x8B95 130 PALETTE8_RGBA8_OES 0x8B96 131 PALETTE8_R5_G6_B5_OES 0x8B97 132 PALETTE8_RGBA4_OES 0x8B98 133 PALETTE8_RGB5_A1_OES 0x8B99 134 135 136Additions to Chapter 2 of the OpenGL 1.3 Specification (OpenGL Operation) 137 138 None 139 140 141Additions to Chapter 3 of the OpenGL 1.3 Specification (Rasterization) 142 143 Add to Table 3.17: Specific Compressed Internal Formats 144 145 Compressed Internal Format Base Internal Format 146 ========================== ==================== 147 PALETTE4_RGB8_OES RGB 148 PALETTE4_RGBA8_OES RGBA 149 PALETTE4_R5_G6_B5_OES RGB 150 PALETTE4_RGBA4_OES RGBA 151 PALETTE4_RGB5_A1_OES RGBA 152 PALETTE8_RGB8_OES RGB 153 PALETTE8_RGBA8_OES RGBA 154 PALETTE8_R5_G6_B5_OES RGB 155 PALETTE8_RGBA4_OES RGBA 156 PALETTE8_RGB5_A1_OES RGBA 157 158 Add to Section 3.8.3, Alternate Image Specification 159 160 If <internalformat> is PALETTE4_RGB8, PALETTE4_RGBA8, PALETTE4_R5_G6_B5, 161 PALETTE4_RGBA4, PALETTE4_RGB5_A1, PALETTE8_RGB8, PALETTE8_RGBA8, 162 PALETTE8_R5_G6_B5, PALETTE8_RGBA4 or PALETTE8_RGB5_A1, the compressed 163 texture is a compressed paletted texture. The texture data contains the 164 palette data following by the mip-levels where the number of mip-levels 165 stored is given by |level| + 1. The number of bits that represent a 166 texel is 4 bits if <interalformat> is given by PALETTE4_xxx and is 8 167 bits if <internalformat> is given by PALETTE8_xxx. 168 169 The number of bits that represent each palette entry is: 170 171 Compressed Internal Format # of bits / palette entry 172 ========================== ========================= 173 PALETTE4_RGB8_OES 24 174 PALETTE4_RGBA8_OES 32 175 PALETTE4_R5_G6_B5_OES 16 176 PALETTE4_RGBA4_OES 16 177 PALETTE4_RGB5_A1_OES 16 178 PALETTE8_RGB8_OES 24 179 PALETTE8_RGBA8_OES 32 180 PALETTE8_R5_G6_B5_OES 16 181 PALETTE8_RGBA4_OES 16 182 PALETTE8_RGB5_A1_OES 16 183 184 Compressed paletted textures support only 2D images without 185 borders. CompressedTexImage2D will produce an INVALID_OPERATION 186 error if <border> is non-zero. 187 188 189 To determine palette format refer to tables 3.10 and 3.11 of Chapter 190 3 where the data ordering for different <type> formats are described. 191 192 Add table 3.17.1: Texel Data Formats for compressed paletted textures 193 194 PALETTE4_xxx: 195 196 7 6 5 4 3 2 1 0 197 --------------- 198 | 1st | 2nd | 199 | texel | texel | 200 --------------- 201 202 PALETTE8_xxx 203 204 205 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 206 ------------------------------------------------------------------------------------- 207 | 4th | 3nd | 2rd | 1st | 208 | texel | texel | texel | texel | 209 ------------------------------------------------------------------------------------- 210 211 212 213Additions to Chapter 4 of the OpenGL 1.3 Specification (Per-Fragment 214Operations and the Frame Buffer) 215 216 None 217 218 219Additions to Chapter 5 of the OpenGL 1.3 Specification (Special Functions) 220 221 222 None 223 224 225Additions to Chapter 6 of the OpenGL 1.3 Specification (State and 226State Requests) 227 228 None 229 230 231Additions to Appendix A of the OpenGL 1.3 Specification (Invariance) 232 233 234Additions to the AGL/GLX/WGL Specification 235 236 None 237 238 239GLX Protocol 240 241 None 242 243 244Errors 245 246 INVALID_OPERATION is generated by TexImage2D, CompressedTexSubImage2D, 247 CopyTexSubImage2D if <internalformat> is PALETTE4_RGB8_OES, 248 PALETTE4_RGBA8_OES, PALETTE4_R5_G6_B5_OES, PALETTE4_RGBA4_OES, 249 PALETTE4_RGB5_A1_OES, PALETTE8_RG8_OES, PALETTE8_RGBA8_OES, 250 PALETTE8_R5_G6_B5_OES, PALETTE8_RGBA4_OES, or PALETTE8_RGB5_A1_OES. 251 252 INVALID_VALUE is generated by CompressedTexImage2D if 253 if <internalformat> is PALETTE4_RGB8_OES, PALETTE4_RGBA8_OES, 254 PALETTE4_R5_G6_B5_OES, PALETTE4_RGBA4_OES, PALETTE4_RGB5_A1_OES, 255 PALETTE8_RGB8_OES, PALETTE8_RGBA8_OES, PALETTE8_R5_G6_B5_OES, 256 PALETTE8_RGBA4_OES, or PALETTE8_RGB5_A1_OES and <level> value is 257 neither zero or a negative value. 258 259 260New State 261 262 The queries for NUM_COMPRESSED_TEXTURE_FORMATS and 263 COMPRESSED_TEXTURE_FORMATS include these ten new formats. 264 265Revision History 266 04/28/2003 0.1 (Aaftab Munshi) 267 - Original draft. 268 269 05/29/2003 0.2 (David Blythe) 270 - Use paletted rather than palettized. Change naming of internal 271 format tokens to match scheme used for other internal formats. 272 273 07/08/2003 0.3 (David Blythe) 274 - Add official enumerant values and extension number. 275 276 07/09/2003 0.4 (David Blythe) 277 - Note that [NUM_]COMPRESSED_TEXTURE_FORMAT queries include the 278 new formats. 279 280 07/21/2004 0.5 (Aaftab Munshi) 281 - Fixed PALETTE_8xxx drawing 282 283 11/12/2005 0.6 (Aaftab Munshi) 284 - Corrections 285