1Name 2 3 EXT_paletted_texture 4 5Name Strings 6 7 GL_EXT_paletted_texture 8 9Contact 10 11 Mark J. Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com) 12 13Version 14 15 Last Modified Date: March 24, 2004 16 Revision: 1.4 17 18Number 19 20 78 21 22Support 23 24 Intel 810/815. 25 26 Mesa. 27 28 Microsoft software OpenGL implementation. 29 30 Selected NVIDIA GPUs: NV1x (GeForce 256, GeForce2, GeForce4 MX, 31 GeForce4 Go, Quadro, Quadro2), NV2x (GeForce3, GeForce4 Ti, 32 Quadro DCC, Quadro4 XGL), and NV3x (GeForce FX 5xxxx, Quadro FX 33 1000/2000/3000). NV3 (Riva 128) and NV4 (TNT, TNT2) GPUs and NV4x 34 GPUs do NOT support this functionality (no hardware support). 35 Future NVIDIA GPU designs will no longer support paletted textures. 36 37 S3 ProSavage, Savage 2000. 38 39 3Dfx Voodoo3, Voodoo5. 40 41 3Dlabs GLINT. 42 43Dependencies 44 45 GL_EXT_paletted_texture shares routines and enumerants with 46 GL_SGI_color_table with the minor modification that EXT replaces SGI. 47 In all other ways these calls should function in the same manner and the 48 enumerant values should be identical. The portions of 49 GL_SGI_color_table that are used are: 50 ColorTableSGI, GetColorTableSGI, GetColorTableParameterivSGI, 51 GetColorTableParameterfvSGI. 52 COLOR_TABLE_FORMAT_SGI, COLOR_TABLE_WIDTH_SGI, 53 COLOR_TABLE_RED_SIZE_SGI, COLOR_TABLE_GREEN_SIZE_SGI, 54 COLOR_TABLE_BLUE_SIZE_SGI, COLOR_TABLE_ALPHA_SIZE_SGI, 55 COLOR_TABLE_LUMINANCE_SIZE_SGI, COLOR_TABLE_INTENSITY_SIZE_SGI. 56 57 Portions of GL_SGI_color_table which are not used in 58 GL_EXT_paletted_texture are: 59 CopyColorTableSGI, ColorTableParameterivSGI, 60 ColorTableParameterfvSGI. 61 COLOR_TABLE_SGI, POST_CONVOLUTION_COLOR_TABLE_SGI, 62 POST_COLOR_MATRIX_COLOR_TABLE_SGI, PROXY_COLOR_TABLE_SGI, 63 PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI, 64 PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI, COLOR_TABLE_SCALE_SGI, 65 COLOR_TABLE_BIAS_SGI. 66 67 EXT_paletted_texture can be used in conjunction with EXT_texture3D. 68 EXT_paletted_texture modifies TexImage3DEXT to accept paletted image 69 data and allows TEXTURE_3D_EXT and PROXY_TEXTURE_3D_EXT to be used a 70 targets in the color table routines. If EXT_texture3D is unsupported 71 then references to 3D texture support in this spec are invalid and 72 should be ignored. 73 74 EXT_paletted_texture can be used in conjunction with 75 ARB_texture_cube_map. EXT_paletted_texture modifies TexImage2D 76 to accept paletted image data and allows TEXTURE_CUBE_MAP_ARB, and 77 PROXY_TEXTURE_CUBE_MAP_ARB to be used a targets in the color table 78 routines. If ARB_texture_cube_map is unsupported then references 79 to cube map texture support in this spec are invalid and should be 80 ignored. 81 82Overview 83 84 EXT_paletted_texture defines new texture formats and new calls to 85 support the use of paletted textures in OpenGL. A paletted texture is 86 defined by giving both a palette of colors and a set of image data which 87 is composed of indices into the palette. The paletted texture cannot 88 function properly without both pieces of information so it increases the 89 work required to define a texture. This is offset by the fact that the 90 overall amount of texture data can be reduced dramatically by factoring 91 redundant information out of the logical view of the texture and placing 92 it in the palette. 93 94 Paletted textures provide several advantages over full-color textures: 95 96 * As mentioned above, the amount of data required to define a 97 texture can be greatly reduced over what would be needed for full-color 98 specification. For example, consider a source texture that has only 256 99 distinct colors in a 256 by 256 pixel grid. Full-color representation 100 requires three bytes per pixel, taking 192K of texture data. By putting 101 the distinct colors in a palette only eight bits are required per pixel, 102 reducing the 192K to 64K plus 768 bytes for the palette. Now add an 103 alpha channel to the texture. The full-color representation increases 104 by 64K while the paletted version would only increase by 256 bytes. 105 This reduction in space required is particularly important for hardware 106 accelerators where texture space is limited. 107 108 * Paletted textures allow easy reuse of texture data for images 109 which require many similar but slightly different colored objects. 110 Consider a driving simulation with heavy traffic on the road. Many of 111 the cars will be similar but with different color schemes. If 112 full-color textures are used a separate texture would be needed for each 113 color scheme, while paletted textures allow the same basic index data to 114 be reused for each car, with a different palette to change the final 115 colors. 116 117 * Paletted textures also allow use of all the palette tricks 118 developed for paletted displays. Simple animation can be done, along 119 with strobing, glowing and other palette-cycling effects. All of these 120 techniques can enhance the visual richness of a scene with very little 121 data. 122 123IP Status 124 125 None. 126 127New Procedures and Functions 128 129 void ColorTableEXT( 130 enum target, 131 enum internalFormat, 132 sizei width, 133 enum format, 134 enum type, 135 const void *data); 136 137 void ColorSubTableEXT( 138 enum target, 139 sizei start, 140 sizei count, 141 enum format, 142 enum type, 143 const void *data); 144 145 void GetColorTableEXT( 146 enum target, 147 enum format, 148 enum type, 149 void *data); 150 151 void GetColorTableParameterivEXT( 152 enum target, 153 enum pname, 154 int *params); 155 156 void GetColorTableParameterfvEXT( 157 enum target, 158 enum pname, 159 float *params); 160 161New Tokens 162 163 Accepted by the internalformat parameter of TexImage1D, TexImage2D and 164 TexImage3DEXT: 165 COLOR_INDEX1_EXT 0x80E2 166 COLOR_INDEX2_EXT 0x80E3 167 COLOR_INDEX4_EXT 0x80E4 168 COLOR_INDEX8_EXT 0x80E5 169 COLOR_INDEX12_EXT 0x80E6 170 COLOR_INDEX16_EXT 0x80E7 171 172 Accepted by the pname parameter of GetColorTableParameterivEXT and 173 GetColorTableParameterfvEXT: 174 COLOR_TABLE_FORMAT_EXT 0x80D8 175 COLOR_TABLE_WIDTH_EXT 0x80D9 176 COLOR_TABLE_RED_SIZE_EXT 0x80DA 177 COLOR_TABLE_GREEN_SIZE_EXT 0x80DB 178 COLOR_TABLE_BLUE_SIZE_EXT 0x80DC 179 COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD 180 COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE 181 COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF 182 183 Accepted by the value parameter of GetTexLevelParameter{if}v: 184 TEXTURE_INDEX_SIZE_EXT 0x80ED 185 186 Accepted by the target parameter of ColorTableEXT, 187 GetColorTableParameterivEXT, and GetColorTableParameterfvEXT: 188 TEXTURE_1D 0x0DE0 189 TEXTURE_2D 0x0DE1 190 TEXTURE_3D_EXT 0x806F 191 TEXTURE_CUBE_MAP_ARB 0x8513 192 PROXY_TEXTURE_1D 0x8063 193 PROXY_TEXTURE_2D 0x8064 194 PROXY_TEXTURE_3D_EXT 0x8070 195 PROXY_TEXTURE_CUBE_MAP_ARB 0x851B 196 197 Accepted by the target parameter of ColorSubTableEXT and 198 GetColorTableEXT: 199 TEXTURE_1D 0x0DE0 200 TEXTURE_2D 0x0DE1 201 TEXTURE_3D_EXT 0x806F 202 TEXTURE_CUBE_MAP_ARB 0x8513 203 204Additions to Chapter 2 of the GL Specification (OpenGL Operation) 205 206 None 207 208Additions to Chapter 3 of the GL Specification (Rasterization) 209 210 Section 3.6.4, 'Pixel Transfer Operations,' subsection 'Color Index 211 Lookup,' 212 213 Point two is modified from 'The groups will be loaded as an 214 image into texture memory' to 'The groups will be loaded as an image 215 into texture memory and the internalformat parameter is not one of the 216 color index formats from table 3.8.' 217 218 Section 3.8, 'Texturing,' subsection 'Texture Image Specification' is 219 modified as follows: 220 221 The portion of the first paragraph discussing interpretation of format, 222 type and data is split from the portion discussing target, width and 223 height. The target, width and height section now ends with the sentence 224 'Arguments width and height specify the image's width and height.' 225 226 The format, type and data section is moved under a subheader 'Direct 227 Color Texture Formats' and begins with 'If internalformat is not one of 228 the color index formats from table 3.8,' and continues with the existing 229 text through the internalformat discussion. 230 231 After that section, a new section 'Paletted Texture Formats' has the 232 text: 233 If format is given as COLOR_INDEX then the image data is 234 composed of integer values representing indices into a table of colors 235 rather than colors themselves. If internalformat is given as one of the 236 color index formats from table 3.8 then the texture will be stored 237 internally as indices rather than undergoing index-to-RGBA mapping as 238 would previously have occurred. In this case the only valid values for 239 type are BYTE, UNSIGNED_BYTE, SHORT, UNSIGNED_SHORT, INT and 240 UNSIGNED_INT. 241 242 The image data is unpacked from memory exactly as for a 243 DrawPixels command with format of COLOR_INDEX for a context in color 244 index mode. The data is then stored in an internal format derived from 245 internalformat. In this case the only legal values of internalformat 246 are COLOR_INDEX1_EXT, COLOR_INDEX2_EXT, COLOR_INDEX4_EXT, 247 COLOR_INDEX8_EXT, COLOR_INDEX12_EXT and COLOR_INDEX16_EXT and the 248 internal component resolution is picked according to the index 249 resolution specified by internalformat. Any excess precision in the 250 data is silently truncated to fit in the internal component precision. 251 252 An application can determine whether a particular 253 implementation supports a particular paletted format (or any paletted 254 formats at all) by attempting to use the paletted format with a proxy 255 target. TEXTURE_INDEX_SIZE_EXT will be zero if the implementation 256 cannot support the texture as given. 257 258 An application can determine an implementation's desired 259 format for a particular paletted texture by making a TexImage call with 260 COLOR_INDEX as the internalformat, in which case target must be a proxy 261 target. After the call the application can query 262 TEXTURE_INTERNAL_FORMAT to determine what internal format the 263 implementation suggests for the texture image parameters. 264 TEXTURE_INDEX_SIZE_EXT can be queried after such a call to determine the 265 suggested index resolution numerically. The index resolution suggested 266 by the implementation does not have to be as large as the input data 267 precision. The resolution may also be zero if the implementation is 268 unable to support any paletted format for the given texture image. 269 270 Table 3.8 should be augmented with a column titled 'Index bits.' All 271 existing formats have zero index bits. The following formats are added 272 with zeroes in all existing columns: 273 Name Index bits 274 COLOR_INDEX1_EXT 1 275 COLOR_INDEX2_EXT 2 276 COLOR_INDEX4_EXT 4 277 COLOR_INDEX8_EXT 8 278 COLOR_INDEX12_EXT 12 279 COLOR_INDEX16_EXT 16 280 281 At the end of the discussion of level the following text should be 282 added: 283 284 All mipmapping levels share the same palette. If levels 285 are created with different precision indices then their internal formats 286 will not match and the texture will be inconsistent, as discussed above. 287 288 In the discussion of internalformat for CopyTexImage{12}D, at end of the 289 sentence specifying that 1, 2, 3 and 4 are illegal there should also be 290 a mention that paletted internalformat values are illegal. 291 292 At the end of the width, height, format, type and data section under 293 TexSubImage there should be an additional sentence: 294 295 If the target texture has an color index internal format 296 then format may only be COLOR_INDEX. 297 298 At the end of the first paragraph describing TexSubImage and 299 CopyTexSubImage the following sentence should be added: 300 301 If the target of a CopyTexSubImage is a paletted texture 302 image then INVALID_OPERATION is returned. 303 304 After the Alternate Image Specification Commands section, a new 'Palette 305 Specification Commands' section should be added. 306 307 Paletted textures require palette information to 308 translate indices into full colors. The command 309 void ColorTableEXT(enum target, enum internalformat, sizei width, 310 enum format, enum type, const void *data); 311 is used to specify the format and size of the palette for paletted 312 textures. target specifies which texture is to have its palette 313 changed and may be one of TEXTURE_1D, TEXTURE_2D, PROXY_TEXTURE_1D, 314 PROXY_TEXTURE_2D, TEXTURE_3D_EXT, PROXY_TEXTURE_3D_EXT, 315 TEXTURE_CUBE_MAP_ARB, or PROXY_TEXTURE_CUBE_MAP_ARB. internalformat 316 specifies the desired format and resolution of the palette when 317 in its internal form. internalformat can be any of the non-index 318 values legal for TexImage internalformat although implementations 319 are not required to support palettes of all possible formats. 320 width controls the size of the palette and must be a power of two 321 greater than or equal to one. format and type specify the number 322 of components and type of the data given by data. format can be 323 any of the formats legal for DrawPixels although implementations 324 are not required to support all possible formats. type can be 325 any of the types legal for DrawPixels except GL_BITMAP. 326 327 Data is taken from memory and converted just as if each 328 palette entry were a single pixel of a 1D texture. Pixel unpacking and 329 transfer modes apply just as with texture data. After unpacking and 330 conversion the data is translated into a internal format that matches 331 the given format as closely as possible. An implementation does not, 332 however, have a responsibility to support more than one precision for 333 the base formats. 334 335 If the palette's width is greater than than the range of 336 the color indices in the texture data then some of the palettes entries 337 will be unused. If the palette's width is less than the range of the 338 color indices in the texture data then the most-significant bits of the 339 texture data are ignored and only the appropriate number of bits of the 340 index are used when accessing the palette. 341 342 Specifying a proxy target causes the proxy texture's 343 palette to be resized and its parameters set but no data is transferred 344 or accessed. If an implementation cannot handle the palette data given 345 in the call then the color table width and component resolutions are set 346 to zero. 347 348 Portions of the current palette can be replaced with 349 void ColorSubTableEXT(enum target, sizei start, sizei count, 350 enum format, enum type, const void *data); 351 target can be any of the non-proxy values legal for 352 ColorTableEXT. start and count control which entries of the palette are 353 changed out of the range allowed by the internal format used for the 354 palette indices. count is silently clamped so that all modified entries 355 all within the legal range. format and type can be any of the values 356 legal for ColorTableEXT. The data is treated as a 1D texture just as in 357 ColorTableEXT. 358 359 In the 'Texture State and Proxy State' section the sentence fragment 360 beginning 'six integer values describing the resolutions...' should be 361 changed to refer to seven integer values, with the seventh being the 362 index resolution. 363 364 Palette data should be added in as a third category of texture state. 365 366 After the discussion of properties, the following should be added: 367 368 Next there is the texture palette. All textures have a 369 palette, even if their internal format is not color index. A texture's 370 palette is initially one RGBA element with all four components set to 371 1.0. 372 373 The sentence mentioning that proxies do not have image data or 374 properties should be extended with 'or palettes.' 375 376 The sentence beginning 'If the texture array is too large' describing 377 the effects of proxy failure should change to read: 378 379 If the implementation is unable to handle the texture 380 image data the proxy width, height, border width and component 381 resolutions are set to zero. This situation can occur when the texture 382 array is too large or an unsupported paletted format was requested. 383 384Additions to Chapter 4 of the GL Specification (Per-Fragment Operations 385and the Framebuffer) 386 387 None 388 389Additions to Chapter 5 of the GL Specification (Special Functions) 390 391 Section 5.4, 'Display Lists' is modified as follows: 392 393 Include PROXY_TEXTURE_1D, PROXY_TEXTURE_2D, PROXY_TEXTURE_3D, 394 and PROXY_TEXTURE_CUBE_MAP_ARB in the list of tokens for which 395 ColorTableEXT is executed immediately. 396 397Additions to Chapter 6 of the GL Specification (State and State 398Requests) 399 400 In the section on GetTexImage, the sentence saying 'The components are 401 assigned among R, G, B and A according to' should be changed to be 402 403 If the internal format of the texture is not a color 404 index format then the components are assigned among R, G, B, and A 405 according to Table 6.1. Specifying COLOR_INDEX for format in this case 406 will generate the error INVALID_ENUM. If the internal format of the 407 texture is color index then the components are handled in one of two 408 ways depending on the value of format. If format is not COLOR_INDEX, 409 the texture's indices are passed through the texture's palette and the 410 resulting components are assigned among R, G, B, and A according to 411 Table 6.1. If format is COLOR_INDEX then the data is treated as single 412 components and the palette indices are returned. Components are taken 413 starting... 414 415 Following the GetTexImage section there should be a new section: 416 417 GetColorTableEXT is used to get the current texture 418 palette. 419 void GetColorTableEXT(enum target, enum format, enum type, void *data); 420 421 GetColorTableEXT retrieves the texture palette of the 422 texture given by target. target can be any of the non-proxy targets 423 valid for ColorTableEXT. format and type are interpreted just as for 424 ColorTableEXT. All textures have a palette by default so 425 GetColorTableEXT will always be able to return data even if the internal 426 format of the texture is not a color index format. 427 428 Palette parameters can be retrieved using 429 void GetColorTableParameterivEXT(enum target, enum pname, int *params); 430 void GetColorTableParameterfvEXT(enum target, enum pname, float *params); 431 target specifies the texture being queried and pname 432 controls which parameter value is returned. Data is returned in the 433 memory pointed to by params. 434 435 Querying COLOR_TABLE_FORMAT_EXT returns the internal 436 format requested by the most recent ColorTableEXT call or the default. 437 COLOR_TABLE_WIDTH_EXT returns the width of the current palette. 438 COLOR_TABLE_RED_SIZE_EXT, COLOR_TABLE_GREEN_SIZE_EXT, 439 COLOR_TABLE_BLUE_SIZE_EXT and COLOR_TABLE_ALPHA_SIZE_EXT return the 440 actual size of the components used to store the palette data internally, 441 not the size requested when the palette was defined. 442 443 Table 6.11, "Texture Objects" should have a line appended for 444 TEXTURE_INDEX_SIZE_EXT: 445 446 TEXTURE_INDEX_SIZE_EXT n x Z+ GetTexLevelParameter 0 xD texture image i's index resolution 3.8 - 447 448New State 449 450 In table 6.16, Texture Objects, p. 224, add the following: 451 452Get Value Type Get Command Initial Value Description Sec. Attribute 453---------------------- -------- --------------------------- ------------- ---------------- ----- --------- 454TEXTURE_1D I GetColorTableEXT empty 1D palette 3.8 - 455TEXTURE_2D I GetColorTableEXT empty 2D palette 3.8 - 456TEXTURE_3D I GetColorTableEXT empty 3D palette 3.8 - 457TEXTURE_CUBE_MAP I GetColorTableEXT empty cube map palette 3.8 - 458COLOR_TABLE_FORMAT_EXT 2x4xZn GetColorTableParameterivEXT RGBA paletted texture 3.8 - 459 formats 460COLOR_TABLE_WIDTH_EXT 2x4xZ+ GetColorTableParameteriv 0 paletted texture 3.8 - 461 width 462COLOR_TABLE_x_SIZE_EXT 6x2x4xZ+ GetColorTableParameteriv 0 paletted texture 3.8 - 463 component sizes 464TEXTURE_INDEX_SIZE_EXT nxZ+ GetTexLevelParameter 0 texture image's 3.8 - 465 index resolution 466 467New Implementation Dependent State 468 469 None 470 471Revision History 472 473Original draft, revision 0.5, December 20, 1995 (drewb) Created 474 475Minor revisions and clarifications, revision 0.6, January 2, 1996 (drewb) 476 Replaced all request-for-comment blocks with final text 477 based on implementation. 478 479Minor revisions and clarifications, revision 0.7, Feburary 5, 1996 (drewb) 480 Specified the state of the palette color information 481 when existing data is replaced by new data. 482 483 Clarified behavior of TexPalette on inconsistent textures. 484 485Major changes due to ARB review, revision 0.8, March 1, 1996 (drewb) 486 Switched from using TexPaletteEXT and GetTexPaletteEXT 487 to using SGI's ColorTableEXT routines. Added ColorSubTableEXT so 488 equivalent functionality is available. 489 490 Allowed proxies in all targets. 491 492 Changed PALETTE?_EXT values to COLOR_INDEX?_EXT. Added 493 support for one and two bit palettes. Removed PALETTE_INDEX_EXT in 494 favor of COLOR_INDEX. 495 496 Decoupled palette size from texture data type. Palette 497 size is controlled only by ColorTableEXT. 498 499Changes due to ARB review, revision 1.0, May 23, 1997 (drewb) 500 Mentioned texture3D. 501 502 Defined TEXTURE_INDEX_SIZE_EXT. 503 504 Allowed implementations to return an index size of zero to indicate 505 no support for a particular format. 506 507 Allowed usage of GL_COLOR_INDEX as a generic format in 508 proxy queries for determining an optimal index size for a particular 509 texture. 510 511 Disallowed CopyTexImage and CopyTexSubImage to paletted 512 formats. 513 514 Deleted mention of index transfer operations during GetTexImage with 515 paletted formats. 516 517Changes due to ARB_texture_cube_map, revision 1.1, June 27, 2002 (Mark Kilgard) 518 Add language to section 5.4 about proxy texture tokens for ColorTable 519 executing immediately. 520 521 Document ARB_texture_cube_map interactions. 522 523 Document texture target usage for ColorTable API. 524 525 Add "New State" section with table and "New Implementation Dependent 526 State" sections. 527 528Changes when incorporating into the registry, September 4, 2002 (Jon Leech) 529 Added missing IP Status / Contact fields (without bumping the 530 revision) and incorporated Mark's changes into the registry. 531 532Changes, revision 1.4, March 24, 2004 (Mark Kilgard) 533 Document vendor support for this extension; note that future NVIDIA 534 GPU designs will not support this extension. 535