1Name 2 3 ARB_texture_env_combine 4 5Name Strings 6 7 GL_ARB_texture_env_combine 8 9Contact 10 11 Bimal Poddar, Intel (bimal.poddar 'at' intel.com) 12 Michael Gold, NVIDIA (gold 'at' nvidia.com) 13 Tom Frisinger, AMD (tom.frisinger 'at' amd.com) 14 Rick Hammerstone, AMD (rick.hammerstone 'at' amd.com) 15 16Notice 17 18 Copyright (c) 2001-2013 The Khronos Group Inc. Copyright terms at 19 http://www.khronos.org/registry/speccopyright.html 20 21Specification Update Policy 22 23 Khronos-approved extension specifications are updated in response to 24 issues and bugs prioritized by the Khronos OpenGL Working Group. For 25 extensions which have been promoted to a core Specification, fixes will 26 first appear in the latest version of that core Specification, and will 27 eventually be backported to the extension document. This policy is 28 described in more detail at 29 https://www.khronos.org/registry/OpenGL/docs/update_policy.php 30 31Status 32 33 Complete. Approved by ARB on February 16, 2001. 34 35Version 36 37 Last modified date: 2006/11/04 38 39Number 40 41 ARB Extension #17 42 43Dependencies 44 45 This extension is written against the OpenGL 1.2.1 Specification. 46 OpenGL 1.1 and ARB_multitexture are required for this extension. 47 48Overview 49 50 New texture environment function COMBINE_ARB allows programmable 51 texture combiner operations, including: 52 53 REPLACE Arg0 54 MODULATE Arg0 * Arg1 55 ADD Arg0 + Arg1 56 ADD_SIGNED_ARB Arg0 + Arg1 - 0.5 57 SUBTRACT_ARB Arg0 - Arg1 58 INTERPOLATE_ARB Arg0 * (Arg2) + Arg1 * (1-Arg2) 59 60 where Arg0, Arg1 and Arg2 are derived from 61 62 PRIMARY_COLOR_ARB primary color of incoming fragment 63 TEXTURE texture color of corresponding texture unit 64 CONSTANT_ARB texture environment constant color 65 PREVIOUS_ARB result of previous texture environment; on 66 texture unit 0, this maps to PRIMARY_COLOR_ARB 67 68 In addition, the result may be scaled by 1.0, 2.0 or 4.0. 69 70Issues 71 72 1. Should the explicit bias be removed in favor of an implcit bias as 73 part of a ADD_SIGNED_ARB function? 74 75 - RESOLVED: Yes. This pre-scale bias is a special case and will 76 be treated as such. 77 78 2. Should the primary color of the incoming fragment be available to 79 all texture environments? Currently it is only available to the 80 texture environment of texture unit 0. 81 82 - RESOLVED: Yes. PRIMARY_COLOR_ARB has been added as an input 83 source. 84 85 3. Should textures from other texture units be allowed as sources? 86 87 - RESOLVED: NO. Even though this adds a lot of flexibility that 88 folks can use today, there is not enough support amonst the 89 ARB participants to add it to the base spec. 90 91 4. All of the 1.2 modes except BLEND can be expressed in terms of 92 this extension. Should texture color be allowed as a source for 93 Arg2, so all of the 1.2 modes can be expressed? If so, should all 94 color sources be allowed, to maintain orthogonality? 95 96 - RESOLVED: Yes. This seems to be a reasonable area to expand 97 functionality and remain backwards compatible with the EXT 98 version of the extension. 99 100 5. If the texture environment for a given texture unit does not 101 reference the texture object that is bound to that texture unit, 102 does a valid texture object need to be bound that unit? 103 104 - RESOLVED: Yes. Each texture unit implicitly references the 105 texture object that is bound to that unit, regardless of the 106 texture environment function. This may require that 107 applications bind a dummy texture to the texture unit. 108 109 6. Should we allow the secondary color to take part in texture blending? 110 111 - RESOLVED: Not in this extension. Secondary color was defined 112 as a specular part of the lit color and does not have associated 113 alpha. In order to do this right, the secondary color extension 114 needs to be fixed first to allow a full featured color and clearly 115 state the interaction of how it interacts with the color sum stage. 116 117 7. How exactly is this ARB extension different from the EXT version? 118 119 - RESOLVED: 120 121 1) This extension adds the GL_SUBTRACT_ARB mode 122 123 2) OPERAND2_RGB_ARB can use SRC_COLOR, ONE_MINUS_SRC_COLOR, 124 SRC_ALPHA, and ONE_MINUS_SRC_ALPHA instead of just SRC_ALPHA 125 (NV_texture_env_combine4 already provides this). 126 127 3) OPERAND2_ALPHA_ARB can use SRC_ALPHA and ONE_MINUS_SRC_ALPHA 128 instead of just SRC_ALPHA (NV_texture_env_combine4 already 129 provides this). 130 131New Procedures and Functions 132 133 None 134 135New Tokens 136 137 Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, 138 and TexEnviv when the <pname> parameter value is TEXTURE_ENV_MODE 139 140 COMBINE_ARB 0x8570 141 142 Accepted by the <pname> parameter of TexEnvf, TexEnvi, TexEnvfv, 143 and TexEnviv when the <target> parameter value is TEXTURE_ENV 144 145 COMBINE_RGB_ARB 0x8571 146 COMBINE_ALPHA_ARB 0x8572 147 SOURCE0_RGB_ARB 0x8580 148 SOURCE1_RGB_ARB 0x8581 149 SOURCE2_RGB_ARB 0x8582 150 SOURCE0_ALPHA_ARB 0x8588 151 SOURCE1_ALPHA_ARB 0x8589 152 SOURCE2_ALPHA_ARB 0x858A 153 OPERAND0_RGB_ARB 0x8590 154 OPERAND1_RGB_ARB 0x8591 155 OPERAND2_RGB_ARB 0x8592 156 OPERAND0_ALPHA_ARB 0x8598 157 OPERAND1_ALPHA_ARB 0x8599 158 OPERAND2_ALPHA_ARB 0x859A 159 RGB_SCALE_ARB 0x8573 160 ALPHA_SCALE 161 162 Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, 163 and TexEnviv when the <pname> parameter value is COMBINE_RGB_ARB 164 or COMBINE_ALPHA_ARB 165 166 REPLACE 167 MODULATE 168 ADD 169 ADD_SIGNED_ARB 0x8574 170 INTERPOLATE_ARB 0x8575 171 SUBTRACT_ARB 0x84E7 172 173 Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, 174 and TexEnviv when the <pname> parameter value is SOURCE0_RGB_ARB, 175 SOURCE1_RGB_ARB, SOURCE2_RGB_ARB, SOURCE0_ALPHA_ARB, 176 SOURCE1_ALPHA_ARB, or SOURCE2_ALPHA_ARB 177 178 TEXTURE 179 CONSTANT_ARB 0x8576 180 PRIMARY_COLOR_ARB 0x8577 181 PREVIOUS_ARB 0x8578 182 183 Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, 184 and TexEnviv when the <pname> parameter value is 185 OPERAND0_RGB_ARB, OPERAND1_RGB_ARB, or OPERAND2_RGB_ARB 186 187 SRC_COLOR 188 ONE_MINUS_SRC_COLOR 189 SRC_ALPHA 190 ONE_MINUS_SRC_ALPHA 191 192 Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, 193 and TexEnviv when the <pname> parameter value is 194 OPERAND0_ALPHA_ARB, OPERAND1_ALPHA_ARB, or OPERAND2_ALPHA_ARB 195 196 SRC_ALPHA 197 ONE_MINUS_SRC_ALPHA 198 199 Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, 200 and TexEnviv when the <pname> parameter value is RGB_SCALE_ARB or 201 ALPHA_SCALE 202 203 1.0 204 2.0 205 4.0 206 207Additions to Chapter 2 of the GL Specification (OpenGL Operation) 208 209 None 210 211Additions to Chapter 3 of the GL Specification (Rasterization) 212 213 Added to subsection 3.8.9, before the paragraph describing the 214 state requirements: 215 216 If the value of TEXTURE_ENV_MODE is COMBINE_ARB, the form of the 217 texture function depends on the values of COMBINE_RGB_ARB and 218 COMBINE_ALPHA_ARB, according to table 3.20. The RGB and ALPHA 219 results of the texture function are then multiplied by the values 220 of RGB_SCALE_ARB and ALPHA_SCALE, respectively. The results are 221 clamped to [0,1]. 222 223 COMBINE_RGB_ARB Texture Function 224 ------------------ ---------------- 225 REPLACE Arg0 226 MODULATE Arg0 * Arg1 227 ADD Arg0 + Arg1 228 ADD_SIGNED_ARB Arg0 + Arg1 - 0.5 229 INTERPOLATE_ARB Arg0 * (Arg2) + Arg1 * (1-Arg2) 230 SUBTRACT_ARB Arg0 - Arg1 231 232 COMBINE_ALPHA_ARB Texture Function 233 ------------------ ---------------- 234 REPLACE Arg0 235 MODULATE Arg0 * Arg1 236 ADD Arg0 + Arg1 237 ADD_SIGNED_ARB Arg0 + Arg1 - 0.5 238 INTERPOLATE_ARB Arg0 * (Arg2) + Arg1 * (1-Arg2) 239 SUBTRACT_ARB Arg0 - Arg1 240 241 Table 3.20: COMBINE_ARB texture functions 242 243 The arguments Arg0, Arg1 and Arg2 are determined by the values of 244 SOURCE<n>_RGB_ARB, SOURCE<n>_ALPHA_ARB, OPERAND<n>_RGB_ARB and 245 OPERAND<n>_ALPHA_ARB. In the following two tables, Ct and At are 246 the filtered texture RGB and alpha values; Cc and Ac are the 247 texture environment RGB and alpha values; Cf and Af are the RGB 248 and alpha of the primary color of the incoming fragment; and Cp 249 and Ap are the RGB and alpha values resulting from the previous 250 texture environment. On texture environment 0, Cp and Ap are 251 identical to Cf and Af, respectively. The relationship is 252 described in tables 3.21 and 3.22. 253 254 SOURCE<n>_RGB_ARB OPERAND<n>_RGB_ARB Argument 255 ----------------- -------------- -------- 256 TEXTURE SRC_COLOR Ct 257 ONE_MINUS_SRC_COLOR (1-Ct) 258 SRC_ALPHA At 259 ONE_MINUS_SRC_ALPHA (1-At) 260 CONSTANT_ARB SRC_COLOR Cc 261 ONE_MINUS_SRC_COLOR (1-Cc) 262 SRC_ALPHA Ac 263 ONE_MINUS_SRC_ALPHA (1-Ac) 264 PRIMARY_COLOR_ARB SRC_COLOR Cf 265 ONE_MINUS_SRC_COLOR (1-Cf) 266 SRC_ALPHA Af 267 ONE_MINUS_SRC_ALPHA (1-Af) 268 PREVIOUS_ARB SRC_COLOR Cp 269 ONE_MINUS_SRC_COLOR (1-Cp) 270 SRC_ALPHA Ap 271 ONE_MINUS_SRC_ALPHA (1-Ap) 272 273 Table 3.21: Arguments for COMBINE_RGB_ARB functions 274 275 SOURCE<n>_ALPHA_ARB OPERAND<n>_ALPHA_ARB Argument 276 ----------------- -------------- -------- 277 TEXTURE SRC_ALPHA At 278 ONE_MINUS_SRC_ALPHA (1-At) 279 CONSTANT_ARB SRC_ALPHA Ac 280 ONE_MINUS_SRC_ALPHA (1-Ac) 281 PRIMARY_COLOR_ARB SRC_ALPHA Af 282 ONE_MINUS_SRC_ALPHA (1-Af) 283 PREVIOUS_ARB SRC_ALPHA Ap 284 ONE_MINUS_SRC_ALPHA (1-Ap) 285 286 Table 3.22: Arguments for COMBINE_ALPHA_ARB functions 287 288 The mapping of texture components to source components is 289 summarized in Table 3.23. In the following table, At, Lt, It, Rt, 290 Gt and Bt are the filtered texel values. 291 292 Base Internal Format RGB Values Alpha Value 293 -------------------- ---------- ----------- 294 ALPHA 0, 0, 0 At 295 LUMINANCE Lt, Lt, Lt 1 296 LUMINANCE_ALPHA Lt, Lt, Lt At 297 INTENSITY It, It, It It 298 RGB Rt, Gt, Bt 1 299 RGBA Rt, Gt, Bt At 300 301 Table 3.23: Correspondence of texture components to source 302 components for COMBINE_RGB_ARB and COMBINE_ALPHA_ARB arguments 303 304Additions to Chapter 4 of the GL Specification (Per-Fragment Operations 305and the Framebuffer) 306 307 None 308 309Additions to Chapter 5 of the GL Specification (Special Functions) 310 311 None 312 313Additions to Chapter 6 of the GL Specification (State and State Requests) 314 315 None 316 317Additions to Appendix F of the GL Specification (ARB Extensions) 318 319 Inserted after the second paragraph of F.2.12: 320 321 If the value of TEXTURE_ENV_MODE is COMBINE_ARB, the texture 322 function associated with a given texture unit is computed using 323 the values specified by SOURCE<n>_RGB_ARB, SOURCE<n>_ALPHA_ARB, 324 OPERAND<n>_RGB_ARB and OPERAND<n>_ALPHA_ARB. If TEXTURE<n>_ARB is 325 specified as SOURCE<n>_RGB_ARB or SOURCE<n>_ALPHA_ARB, the texture 326 value from texture unit <n> will be used in computing the texture 327 function for this texture unit. 328 329 Inserted after the third paragraph of F.2.12: 330 331 If a texture environment for a given texture unit references a 332 texture unit that is disabled or does not have a valid texture 333 object bound to it, then it is as if texture is disabled for the 334 given texture unit. Every texture unit implicitly references the 335 texture object that is bound to it, regardless of the texture 336 function specified by COMBINE_RGB_ARB or COMBINE_ALPHA_ARB. 337 338Additions to the GLX Specification 339 340 None 341 342GLX Protocol 343 344 None 345 346Errors 347 348 INVALID_ENUM is generated if <params> value for COMBINE_RGB_ARB or 349 COMBINE_ALPHA_ARB is not one of REPLACE, MODULATE, ADD, 350 ADD_SIGNED_ARB, INTERPOLATE_ARB, or SUBTRACT_ARB 351 352 INVALID_ENUM is generated if <params> value for SOURCE0_RGB_ARB, 353 SOURCE1_RGB_ARB, SOURCE2_RGB_ARB, SOURCE0_ALPHA_ARB, 354 SOURCE1_ALPHA_ARB or SOURCE2_ALPHA_ARB is not one of TEXTURE, 355 CONSTANT_ARB, PRIMARY_COLOR_ARB, or PREVIOUS_ARB. 356 357 INVALID_ENUM is generated if <params> value for OPERAND0_RGB_ARB, 358 OPERAND1_RGB_ARB, or OPERAND2_RGB_ARB is not one of SRC_COLOR, 359 ONE_MINUS_SRC_COLOR, SRC_ALPHA or ONE_MINUS_SRC_ALPHA. 360 361 INVALID_ENUM is generated if <params> value for OPERAND0_ALPHA_ARB, 362 OPERAND1_ALPHA_ARB, or OPERAND2_ALPHA_ARB is not one of SRC_ALPHA 363 or ONE_MINUS_SRC_ALPHA. 364 365 INVALID_VALUE is generated if <params> value for RGB_SCALE_ARB or 366 ALPHA_SCALE is not one of 1.0, 2.0, or 4.0. 367 368New State 369 370 Get Value Get Command Type Initial Value Attribute 371 --------- ----------- ---- ------------- --------- 372 COMBINE_RGB_ARB GetTexEnviv n x Z4 MODULATE texture 373 COMBINE_ALPHA_ARB GetTexEnviv n x Z4 MODULATE texture 374 SOURCE0_RGB_ARB GetTexEnviv n x Z3 TEXTURE texture 375 SOURCE1_RGB_ARB GetTexEnviv n x Z3 PREVIOUS_ARB texture 376 SOURCE2_RGB_ARB GetTexEnviv n x Z3 CONSTANT_ARB texture 377 SOURCE0_ALPHA_ARB GetTexEnviv n x Z3 TEXTURE texture 378 SOURCE1_ALPHA_ARB GetTexEnviv n x Z3 PREVIOUS_ARB texture 379 SOURCE2_ALPHA_ARB GetTexEnviv n x Z3 CONSTANT_ARB texture 380 OPERAND0_RGB_ARB GetTexEnviv n x Z6 SRC_COLOR texture 381 OPERAND1_RGB_ARB GetTexEnviv n x Z6 SRC_COLOR texture 382 OPERAND2_RGB_ARB GetTexEnviv n x Z1 SRC_ALPHA texture 383 OPERAND0_ALPHA_ARB GetTexEnviv n x Z4 SRC_ALPHA texture 384 OPERAND1_ALPHA_ARB GetTexEnviv n x Z4 SRC_ALPHA texture 385 OPERAND2_ALPHA_ARB GetTexEnviv n x Z1 SRC_ALPHA texture 386 RGB_SCALE_ARB GetTexEnvfv n x R3 1.0 texture 387 ALPHA_SCALE GetTexEnvfv n x R3 1.0 texture 388 389New Implementation Dependent State 390 391 None 392 393Revision History 394 395 06/11/04 benj Updated contact info after ATI/AMD merger. 396 397 01/05/21 mjk Added ARB versus EXT differences issue 398 399 01/02/02 bpoddar Added original EXT/ARB contributors to the contact 400 list 401 402 00/12/13 bpoddar Added enum value for SUBTRACT_ARB 403 404 00/12/06 bpoddar Moved references to Ct<n> and At<n> to 405 ARB_texture_env_crossbar spec. 406 407 00/12/01 bpoddar Removed TEXTURE<n>_ARB since several companies 408 had problems with this addition in the base spec. 409 410 00/11/13 bpoddar Recreated 6/20 spec with language for dealing 411 with inconsistent textures moved to appendix F. 412 413 00/06/20 rhammers Changed behavior when dealing with references 414 do disabled and inconsistent textures. 415 416 00/05/23 rhammers Cleaned up for first draft of ARB version. 417 Added issue -- TEXTURE with TEXTURE<n>_ARB 418 Added issue .. "upstream" textures 419 Listed get functions with description of 420 enumerants. 421 Added 1.1 and multitexture to dependencies 422 423 00/05/18 rhammers First rev of ARB version of the spec. Based on 424 EXT_texture_env_combine. 425 Relaxed restriction on Arg2. 426 Added support for TEXTURE<n>_ARB. 427 Added SUBTRACT_ARB combiner function. 428 do disabled and inconsistent textures. 429