1Name 2 3 EXT_texture 4 5Name Strings 6 7 GL_EXT_texture 8 9Version 10 11 $Date: 1996/04/05 19:17:03 $ $Revision: 1.21 $ 12 13Number 14 15 4 16 17Dependencies 18 19 None 20 21Overview 22 23 The original intention of this extension was simply to support various 24 numeric resolutions of color components in texture images. While it 25 accomplishes this, it also accomplishes a larger task, that of 26 formalizing the notion of an internal format for images, corresponding 27 to the external format that already existed for image data in host 28 memory. This notion of an internal image format will be used 29 extensively in later extensions, especially those concerned with pixel 30 manipulation. 31 32 The idea of an internal format is simple: rather than treating a 33 retained image as having 1, 2, 3, or 4 components, treat it as though 34 it has a specific format, such as LUMINANCE_ALPHA, or just ALPHA. Then 35 define the semantics of the use of internal images with these formats in 36 a consistent way. Because texture mapping is already defined in GL, the 37 semantics for internal-format images were chosen to match those of the 1, 38 2, 3, and 4 component internal images that already existed. The new 39 semantics are a superset of the old ones, however, so this extension 40 adds capabilities to GL, as well as allowing internal resolutions to be 41 specified. 42 43 This extension also defines a robust method for applications to 44 determine what combinations of texture dimensions and resolutions are 45 supported by an implementation. It also introduces a new texture 46 environment: REPLACE_EXT. 47 48New Procedures and Functions 49 50 None 51 52New Tokens 53 54 Accepted by the <components> parameter of TexImage1D and TexImage2D: 55 56 ALPHA4_EXT 0x803B 57 ALPHA8_EXT 0x803C 58 ALPHA12_EXT 0x803D 59 ALPHA16_EXT 0x803E 60 LUMINANCE4_EXT 0x803F 61 LUMINANCE8_EXT 0x8040 62 LUMINANCE12_EXT 0x8041 63 LUMINANCE16_EXT 0x8042 64 LUMINANCE4_ALPHA4_EXT 0x8043 65 LUMINANCE6_ALPHA2_EXT 0x8044 66 LUMINANCE8_ALPHA8_EXT 0x8045 67 LUMINANCE12_ALPHA4_EXT 0x8046 68 LUMINANCE12_ALPHA12_EXT 0x8047 69 LUMINANCE16_ALPHA16_EXT 0x8048 70 INTENSITY_EXT 0x8049 71 INTENSITY4_EXT 0x804A 72 INTENSITY8_EXT 0x804B 73 INTENSITY12_EXT 0x804C 74 INTENSITY16_EXT 0x804D 75 RGB2_EXT 0x804E 76 RGB4_EXT 0x804F 77 RGB5_EXT 0x8050 78 RGB8_EXT 0x8051 79 RGB10_EXT 0x8052 80 RGB12_EXT 0x8053 81 RGB16_EXT 0x8054 82 RGBA2_EXT 0x8055 83 RGBA4_EXT 0x8056 84 RGB5_A1_EXT 0x8057 85 RGBA8_EXT 0x8058 86 RGB10_A2_EXT 0x8059 87 RGBA12_EXT 0x805A 88 RGBA16_EXT 0x805B 89 90 Accepted by the <pname> parameters of GetTexLevelParameteriv and 91 GetTexLevelParameterfv: 92 93 TEXTURE_RED_SIZE_EXT 0x805C 94 TEXTURE_GREEN_SIZE_EXT 0x805D 95 TEXTURE_BLUE_SIZE_EXT 0x805E 96 TEXTURE_ALPHA_SIZE_EXT 0x805F 97 TEXTURE_LUMINANCE_SIZE_EXT 0x8060 98 TEXTURE_INTENSITY_SIZE_EXT 0x8061 99 100 Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, and 101 TexEnvfi when the <pname> parameter value is 102 GL_TEXTURE_ENV_MODE 103 104 REPLACE_EXT 0x8062 105 106 Accepted by the <target> parameters of TexImage1D, 107 GetTexLevelParameteriv, and GetTexLevelParameterfv: 108 109 PROXY_TEXTURE_1D_EXT 0x8063 110 111 Accepted by the <target> parameters of TexImage2D, 112 GetTexLevelParameteriv, and GetTexLevelParameterfv: 113 114 PROXY_TEXTURE_2D_EXT 0x8064 115 116Additions to Chapter 2 of the GL Specification (OpenGL Operation) 117 118 A new error token value, TEXTURE_TOO_LARGE_EXT, is defined and added to 119 table 2.3: 120 121 Offending 122 command 123 Error Description ignored? 124 ----- ----------- --------- 125 INVALID_ENUM enum argument out of range Yes 126 INVALID_VALUE Numeric argument out of range Yes 127 INVALID_OPERATION Operation illegal in current state Yes 128 STACK_OVERFLOW Command would cause a stack overflow Yes 129 STACK_UNDERFLOW Command would cause a stack underflow Yes 130 TEXTURE_TOO_LARGE_EXT The specified texture is too large Yes 131 OUT_OF_MEMORY Not enough memory left to execute command Unknown 132 133 Table 2.3: Summary of GL errors 134 135 and defined as follows: 136 137 TEXTURE_TOO_LARGE_EXT 0x8065 138 139Additions to Chapter 3 of the GL Specification (Rasterization) 140 141 Many additional values can be specified for the <components> parameter 142 of TexImage1D and TexImage2D. The GL Specification indicates (in 143 section 3.8) that only values 1, 2, 3, and 4 can be specified. This 144 extension defines semantics for the currently existing tokens ALPHA, 145 RGB, RGBA, LUMINANCE, and LUMINANCE_ALPHA, and also defines semantics 146 for many new tokens. Each of the new tokens (except INTENSITY_EXT) 147 indicates a desired storage resolution, as well as a base format. These 148 tokens are: 149 150 Red Green Blue Alpha Luminance Intensity 151 Token name Base format Bits Bits Bits Bits Bits Bits 152 ---------- ----------- ---- ---- ---- ---- ---- ---- 153 154 ALPHA4_EXT ALPHA 4 155 ALPHA8_EXT ALPHA 8 156 ALPHA12_EXT ALPHA 12 157 ALPHA16_EXT ALPHA 16 158 LUMINANCE4_EXT LUMINANCE 4 159 LUMINANCE8_EXT LUMINANCE 8 160 LUMINANCE12_EXT LUMINANCE 12 161 LUMINANCE16_EXT LUMINANCE 16 162 LUMINANCE4_ALPHA4_EXT LUMINANCE_ALPHA 4 4 163 LUMINANCE6_ALPHA2_EXT LUMINANCE_ALPHA 2 6 164 LUMINANCE8_ALPHA8_EXT LUMINANCE_ALPHA 8 8 165 LUMINANCE12_ALPHA4_EXT LUMINANCE_ALPHA 4 12 166 LUMINANCE12_ALPHA12_EXT LUMINANCE_ALPHA 12 12 167 LUMINANCE16_ALPHA16_EXT LUMINANCE_ALPHA 16 16 168 INTENSITY_EXT INTENSITY_EXT ? 169 INTENSITY4_EXT INTENSITY_EXT 4 170 INTENSITY8_EXT INTENSITY_EXT 8 171 INTENSITY12_EXT INTENSITY_EXT 12 172 INTENSITY16_EXT INTENSITY_EXT 16 173 RGB2_EXT RGB 2 2 2 174 RGB4_EXT RGB 4 4 4 175 RGB5_EXT RGB 5 5 5 176 RGB8_EXT RGB 8 8 8 177 RGB10_EXT RGB 10 10 10 178 RGB12_EXT RGB 12 12 12 179 RGB16_EXT RGB 16 16 16 180 RGBA2_EXT RGBA 2 2 2 2 181 RGBA4_EXT RGBA 4 4 4 4 182 RGB5_A1_EXT RGBA 5 5 5 1 183 RGBA8_EXT RGBA 8 8 8 8 184 RGB10_A2_EXT RGBA 10 10 10 2 185 RGBA12_EXT RGBA 12 12 12 12 186 RGBA16_EXT RGBA 16 16 16 16 187 188 All implementations of this extension support the base formats ALPHA, 189 LUMINANCE, LUMINANCE_ALPHA, RGB, and RGBA. All implementations also 190 accept all the tokens in the table above, but may not allocate storage 191 exactly equal to that indicated in the table. Instead, storage is 192 allocated to best match the resolutions in the table. The determination 193 of best match is left to the implementation. Storage allocation for the 194 base formats (as well as for formats "1", "2", "3", and "4") is an 195 implementation dependent compromise of component resolution, 196 performance, image size, and memory availability. 197 198 It is acceptable for an implementation to vary its allocation of 199 internal component resolution based on any TexImage1D or TexImage2D 200 parameter, but the allocation must not be a function of any other 201 factor, and cannot be changed once it is established. In particular, 202 allocations must be invariant -- the same allocation must be made each 203 time a texture image is specified with the same parameter values. 204 Provision is made for an application to determine what component 205 resolutions are available without having to fully specify the texture 206 (see below). 207 208 A set of mipmap arrays is incomplete (see the Mipmapping section of the 209 GL Specification) if different internal formats are specified for arrays 210 in the set, even if the resulting formats of the arrays are identical. 211 An implementation can, however, report different component precisions 212 for the arrays in the set, even if all were specified with the same 213 internal format. (The set of arrays will be complete in this case.) 214 215 The assignments of texture component values from color components 216 "extracted" from the incoming image (see the discussion in section 3.8 217 of the GL Specification) are defined by this new version of Table 3.6: 218 219 Base Internal Format red green blue alpha luminance intensity 220 -------------------- --- ----- ---- ----- --------- --------- 221 222 ALPHA A 223 LUMINANCE R 224 LUMINANCE_ALPHA A R 225 INTENSITY_EXT R 226 RGB R G B 227 RGBA R G B A 228 229 Table 3.6: Correspondence of texture components to extracted 230 R, G, B, and A values. 231 232 Texture components are assigned to Rt, Gt, Bt, and At. 233 Table 3.8 (Texture functions) refers to these components. 234 The assignments are defined by the following table: 235 236 Texture Environment 237 ------------------- 238 239 Base Texture Format Rt Gt Bt At 240 ------------------- -- -- -- -- 241 242 LUMINANCE Lt Lt Lt x 243 244 ALPHA x x x At 245 246 INTENSITY_EXT It It It It 247 248 LUMINANCE_ALPHA Lt Lt Lt At 249 250 RGB Rt Gt Bt x 251 252 RGBA Rt Gt Bt At 253 254 Table ??: Mapping of Texture Components to Rt, Gt, Bt, At. 255 256 Where there appears an "x", the assignment is "don't care", since 257 that component is not used by the texture environment. 258 259 This extension redefines the application of a texture to the color 260 components of a fragment. In particular, a new texture environment, REPLACE, 261 and two new texture formats, ALPHA and INTENSITY_EXT, are included. 262 Table 3.8 (Texture functions) of the GL 263 Specification is replaced by the following table: 264 265 Texture Environment 266 ------------------- 267 268 Base Texture Format REPLACE MODULATE BLEND DECAL 269 ------------------- ------- -------- ----- ----- 270 271 LUMINANCE Rv = Rt Rv = Rf * Rt Rv = Rf * (1-Rt) + Rc * Rt undefined 272 Gv = Gt Gv = Gf * Gt Gv = Gf * (1-Gt) + Gc * Gt 273 Bv = Bt Bv = Bf * Bt Bv = Bf * (1-Bt) + Bc * Bt 274 Av = Af Av = Af Av = Af 275 276 ALPHA Rv = Rf Rv = Rf Rv = Rf undefined 277 Gv = Gf Gv = Gf Gv = Gf 278 Bv = Bf Bv = Bf Bv = Bf 279 Av = At Av = Af * At Av = Af * At 280 281 INTENSITY_EXT Rv = Rt Rv = Rf * Rt Rv = Rf * (1-Rt) + Rc * Rt undefined 282 Gv = Gt Gv = Gf * Gt Gv = Gf * (1-Gt) + Gc * Gt 283 Bv = Bt Bv = Bf * Bt Bv = Bf * (1-Bt) + Bc * Bt 284 Av = At Av = Af * At Av = Af * (1-At) + Ac * At 285 286 LUMINANCE_ALPHA Rv = Rt Rv = Rf * Rt Rv = Rf * (1-Rt) + Rc * Rt undefined 287 Gv = Gt Gv = Gf * Gt Gv = Gf * (1-Gt) + Gc * Gt 288 Bv = Bt Bv = Bf * Bt Bv = Bf * (1-Bt) + Bc * Bt 289 Av = At Av = Af * At Av = Af * At 290 291 RGB Rv = Rt Rv = Rf * Rt Rv = Rf * (1-Rt) + Rc * Rt Rv = Rt 292 Gv = Gt Gv = Gf * Gt Gv = Gf * (1-Gt) + Gc * Gt Gv = Gt 293 Bv = Bt Bv = Bf * Bt Bv = Bf * (1-Bt) + Bc * Bt Bv = Bt 294 Av = Af Av = Af Av = Af Av = Af 295 296 RGBA Rv = Rt Rv = Rf * Rt Rv = Rf * (1-Rt) + Rc * Rt Rv = Rf * (1-At) + Rt * At 297 Gv = Gt Gv = Gf * Gt Gv = Gf * (1-Gt) + Gc * Gt Gv = Gf * (1-At) + Gt * At 298 Bv = Bt Bv = Bf * Bt Bv = Bf * (1-Bt) + Bc * Bt Bv = Bf * (1-At) + Bt * At 299 Av = At Av = Af * At Av = Af * At Av = Af 300 301 Table 3.8: Texture functions. 302 303 Finally, for backward compatibility, the semantics of <components> 304 values 1, 2, 3, and 4 are identical to those of LUMINANCE, 305 LUMINANCE_ALPHA, RGB, and RGBA respectively. The one exception is that 306 the token values for 1, 2, 3, and 4 are not the same as the token values 307 LUMINANCE, LUMINANCE_ALPHA, RGB, and RGBA. 308 309 Query support 310 ------------- 311 312 Alternate sets of partial per-level texture state are defined for 313 the proxy textures PROXY_TEXTURE_1D_EXT and PROXY_TEXTURE_2D_EXT. 314 Specifically, TEXTURE_WIDTH, TEXTURE_HEIGHT, TEXTURE_BORDER, 315 TEXTURE_COMPONENTS, TEXTURE_RED_SIZE_EXT, TEXTURE_GREEN_SIZE_EXT, 316 TEXTURE_BLUE_SIZE_EXT, TEXTURE_ALPHA_SIZE_EXT, 317 TEXTURE_LUMINANCE_SIZE_EXT, and TEXTURE_INTENSITY_SIZE_EXT are 318 maintained for proxy textures. When TexImage2D is called with 319 <target> set to PROXY_TEXTURE_2D_EXT, these proxy state values are 320 always recomputed and updated, even if the texture is too large to 321 actually be used. If the texture is too large, all of these state 322 variables are set to zero. If the texture could be accommodated 323 by TexImage2D called with <target> TEXTURE_2D, these values are 324 set as though TEXTURE_2D were being defined. All of these state 325 value can be queried with GetTexLevelParameteriv or 326 GetTexLevelParameterfv with <target> set to PROXY_TEXTURE_2D_EXT. 327 Calling TexImage2D with <target> PROXY_TEXTURE_2D_EXT has no 328 effect on the actual 2-dimensional texture or its state. 329 330 To determine the maximum array size for a mipmap texture, specify and 331 query the proxy texture at the highest level that accurately reflects the 332 aspect ratio of the desired level zero array. 333 334 There is no image associated with PROXY_TEXTURE_2D_EXT. Therefore 335 PROXY_TEXTURE_2D_EXT cannot be used as a texture, and its image must 336 never be queried using GetTexImage. (The error INVALID_ENUM results if 337 this is attempted.) Likewise, there is no nonlevel-related state 338 associated with a proxy texture, so calling GetTexParameteriv or 339 GetTexParameterfv with <target> PROXY_TEXTURE_2D_EXT results in the 340 error INVALID_ENUM. 341 342 The proxy 1-dimensional texture behaves identically to the proxy 343 2-dimensional texture, except that its state does not include 344 TEXTURE_HEIGHT. 345 346Additions to Chapter 4 of the GL Specification (Per-Fragment Operations 347and the Framebuffer) 348 349 None 350 351Additions to Chapter 5 of the GL Specification (Special Functions) 352 353 TexImage1D with a proxy target and TexImage2D with a proxy target 354 are not included in display lists, but are instead executed 355 immediately. 356 357Additions to Chapter 6 of the GL Specification (State and State Requests) 358 359 GetTexLevelParameteriv, when called with <pname> TEXTURE_COMPONENTS, 360 returns the value of the <components> state variable as specified by the 361 application. This remains true even if the actual internal format 362 matches that of another token. 363 364 GetTexLevelParameteriv, when called with <pname> TEXTURE_RED_SIZE_EXT, 365 TEXTURE_GREEN_SIZE_EXT, TEXTURE_BLUE_SIZE_EXT, TEXTURE_ALPHA_SIZE_EXT, 366 TEXTURE_LUMINANCE_SIZE_EXT, or TEXTURE_INTENSITY_SIZE_EXT returns the 367 actual number of bits of internal storage for red, green, blue, alpha, 368 luminance, or intensity. This value may not match the value of the 369 specified internal format. 370 371 GetTexImage continues to operate as though ReadPixels were called with 372 the texture image as the framebuffer. The assignments of texture 373 component values to the initial R, G, B, and A values of the read-back 374 texel (prior to PixelTransfer and PixelStorage operations) are: 375 376 Base Internal Format R G B A 377 -------------------- - - - - 378 379 ALPHA 0.0 0.0 0.0 alpha 380 LUMINANCE luminance 0.0 0.0 0.0 381 LUMINANCE_ALPHA luminance 0.0 0.0 alpha 382 INTENSITY_EXT intensity 0.0 0.0 0.0 383 RGB red green blue 0.0 384 RGBA red green blue alpha 385 386Additions to the GLX Specification 387 388 None 389 390GLX Protocol 391 392 None 393 394Dependencies on EXT_abgr 395 396 Token ABGR_EXT cannot be used to specify internal texture image formats. 397 398Errors 399 400 The GL Specification requires that INVALID_VALUE be generated if any 401 texture dimension is specified less than zero, greater than 402 MAX_TEXTURE_SIZE, or with a value that cannot be represented as 2**k + 403 2*border, for some integer k. This extension eliminates the requirement 404 that all dimensions be specified less than or equal to MAX_TEXTURE_SIZE, 405 and replaces it with a new error token and error condition. 406 INVALID_VALUE is generated if any texture dimension is specified less 407 than zero, or with a value that cannot be represented as 2**k + 2*border. 408 TEXTURE_TOO_LARGE_EXT is generated if the texture is too large to be 409 accommodated, for whatever reason. An implementation must specify 410 MAX_TEXTURE_SIZE such that TEXTURE_TOO_LARGE_EXT is never generated if 411 all the dimensions of the texture are less than or equal to 412 MAX_TEXTURE_SIZE. Also, TEXTURE_TOO_LARGE_EXT is never generated when 413 the target is a proxy texture, such as PROXY_TEXTURE_1D_EXT or 414 PROXY_TEXTURE_2D_EXT. 415 416 This change to the error semantics does not require that the major 417 revision level be incremented, because the GL Specification allows for 418 changes to error semantics (Section 2.5). 419 420New State 421 422 Initial 423 Get Value Get Command Type Value Attrib 424 --------- ----------- ---- ------- ------ 425 TEXTURE_RED_SIZE_EXT GetTexLevelParameteriv 2 x 2 x levels x Z+ 0 - 426 TEXTURE_GREEN_SIZE_EXT GetTexLevelParameteriv 2 x 2 x levels x Z+ 0 - 427 TEXTURE_BLUE_SIZE_EXT GetTexLevelParameteriv 2 x 2 x levels x Z+ 0 - 428 TEXTURE_ALPHA_SIZE_EXT GetTexLevelParameteriv 2 x 2 x levels x Z+ 0 - 429 TEXTURE_LUMINANCE_SIZE_EXT GetTexLevelParameteriv 2 x 2 x levels x Z+ 0 - 430 TEXTURE_INTENSITY_SIZE_EXT GetTexLevelParameteriv 2 x 2 x levels x Z+ 0 - 431 432 TEXTURE GetTexImage 2 x 1 x levels x I null - 433 TEXTURE_WIDTH GetTexLevelParameteriv 2 x 2 x levels x Z+ 0 - 434 TEXTURE_HEIGHT GetTexLevelParameteriv 1 x 2 x levels x Z+ 0 - 435 TEXTURE_BORDER GetTexLevelParameteriv 2 x 2 x levels x Z+ 0 - 436 TEXTURE_COMPONENTS GetTexLevelParameteriv 2 x 2 x levels x Z42 1 - 437 438New Implementation Dependent State 439 440 None 441