1Name 2 3 NV_texture_env_combine4 4 5Name Strings 6 7 GL_NV_texture_env_combine4 8 9Contact 10 11 Michael Gold, NVIDIA Corporation (gold 'at' nvidia.com) 12 13Notice 14 15 Copyright NVIDIA Corporation, 1999, 2000, 2001. 16 17IP Status 18 19 NVIDIA Proprietary. 20 21Version 22 23 NVIDIA date: January 18, 2001 24 Version: 14 25 26Number 27 28 195 29 30Dependencies 31 32 EXT_texture_env_combine is required and is modified by this extension 33 ARB_multitexture affects the definition of this extension 34 35Overview 36 37 New texture environment function COMBINE4_NV allows programmable 38 texture combiner operations, including 39 40 ADD Arg0 * Arg1 + Arg2 * Arg3 41 ADD_SIGNED_EXT Arg0 * Arg1 + Arg2 * Arg3 - 0.5 42 43 where Arg0, Arg1, Arg2 and Arg3 are derived from 44 45 ZERO the value 0 46 PRIMARY_COLOR_EXT primary color of incoming fragment 47 TEXTURE texture color of corresponding texture unit 48 CONSTANT_EXT texture environment constant color 49 PREVIOUS_EXT result of previous texture environment; on 50 texture unit 0, this maps to PRIMARY_COLOR_EXT 51 TEXTURE<n>_ARB texture color of the <n>th texture unit 52 53 In addition, the result may be scaled by 1.0, 2.0 or 4.0. 54 55Issues 56 57 None 58 59New Procedures and Functions 60 61 None 62 63New Tokens 64 65 Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, and 66 TexEnviv when the <pname> parameter value is TEXTURE_ENV_MODE 67 68 COMBINE4_NV 0x8503 69 70 Accepted by the <pname> parameter of GetTexEnvfv, GetTexEnviv, 71 TexEnvf, TexEnvi, TexEnvfv, and TexEnviv when the <target> parameter 72 value is TEXTURE_ENV 73 74 SOURCE3_RGB_NV 0x8583 75 SOURCE3_ALPHA_NV 0x858B 76 OPERAND3_RGB_NV 0x8593 77 OPERAND3_ALPHA_NV 0x859B 78 79 Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, and 80 TexEnviv when the <pname> parameter value is SOURCE0_RGB_EXT, 81 SOURCE1_RGB_EXT, SOURCE2_RGB_EXT, SOURCE3_RGB_NV, SOURCE0_ALPHA_EXT, 82 SOURCE1_ALPHA_EXT, SOURCE2_ALPHA_EXT, or SOURCE3_ALPHA_NV 83 84 ZERO 85 TEXTURE<n>_ARB 86 87 where <n> is in the range 0 to NUMBER_OF_TEXTURE_UNITS_ARB-1. 88 89 Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, and 90 TexEnviv when the <pname> parameter value is OPERAND0_RGB_EXT, 91 OPERAND1_RGB_EXT, OPERAND2_RGB_EXT or OPERAND3_RGB_NV 92 93 SRC_COLOR 94 ONE_MINUS_SRC_COLOR 95 SRC_ALPHA 96 ONE_MINUS_SRC_ALPHA 97 98 Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, and 99 TexEnviv when the <pname> parameter value is OPERAND0_ALPHA_EXT, 100 OPERAND1_ALPHA_EXT, OPERAND2_ALPHA_EXT, or OPERAND3_ALPHA_NV 101 102 SRC_ALPHA 103 ONE_MINUS_SRC_ALPHA 104 105Additions to Chapter 2 of the OpenGL 1.2 Specification (OpenGL Operation) 106 107 None 108 109Additions to Chapter 3 of the OpenGL 1.2 Specification (Rasterization) 110 111 Added to subsection 3.8.9, before the paragraph describing the state 112 requirements: 113 114 If the value of TEXTURE_ENV_MODE is COMBINE4_NV, the form of the 115 texture function depends on the values of COMBINE_RGB_EXT and 116 COMBINE_ALPHA_EXT, according to table 3.21. The RGB and ALPHA results 117 of the texture function are then multiplied by the values of 118 RGB_SCALE_EXT and ALPHA_SCALE, respectively. The results are clamped 119 to [0,1]. If the value of COMBINE_RGB_EXT or COMBINE_ALPHA_EXT is not 120 one of the listed values, the result is undefined. 121 122 COMBINE_RGB_EXT or 123 COMBINE_ALPHA_EXT Texture Function 124 ------------------ ---------------- 125 ADD Arg0 * Arg1 + Arg2 * Arg3 126 ADD_SIGNED_EXT Arg0 * Arg1 + Arg2 * Arg3 - 0.5 127 128 Table 3.21: COMBINE4_NV texture functions 129 130 The arguments Arg0, Arg1, Arg2 and Arg3 are determined by the values 131 of SOURCE<n>_RGB_EXT, SOURCE<n>_ALPHA_EXT, OPERAND<n>_RGB_EXT and 132 OPERAND<n>_ALPHA_EXT. In the following two tables, Ct and At are the 133 filtered texture RGB and alpha values; Cc and Ac are the texture 134 environment RGB and alpha values; Cf and Af are the RGB and alpha of 135 the primary color of the incoming fragment; and Cp and Ap are the RGB 136 and alpha values resulting from the previous texture environment. On 137 texture environment 0, Cp and Ap are identical to Cf and Af, 138 respectively. Ct<n> and At<n> are the filtered texture RGB and alpha 139 values from the texture bound to the <n>th texture unit. If the <n>th 140 texture unit is disabled, the value of each component is 1. The 141 relationship is described in tables 3.22 and 3.23. 142 143 SOURCE<n>_RGB_EXT OPERAND<n>_RGB_EXT Argument 144 ----------------- -------------- -------- 145 ZERO SRC_COLOR 0 146 ONE_MINUS_SRC_COLOR 1 147 SRC_ALPHA 0 148 ONE_MINUS_SRC_ALPHA 1 149 TEXTURE SRC_COLOR Ct 150 ONE_MINUS_SRC_COLOR (1-Ct) 151 SRC_ALPHA At 152 ONE_MINUS_SRC_ALPHA (1-At) 153 CONSTANT_EXT SRC_COLOR Cc 154 ONE_MINUS_SRC_COLOR (1-Cc) 155 SRC_ALPHA Ac 156 ONE_MINUS_SRC_ALPHA (1-Ac) 157 PRIMARY_COLOR_EXT SRC_COLOR Cf 158 ONE_MINUS_SRC_COLOR (1-Cf) 159 SRC_ALPHA Af 160 ONE_MINUS_SRC_ALPHA (1-Af) 161 PREVIOUS_EXT SRC_COLOR Cp 162 ONE_MINUS_SRC_COLOR (1-Cp) 163 SRC_ALPHA Ap 164 ONE_MINUS_SRC_ALPHA (1-Ap) 165 TEXTURE<n>_ARB SRC_COLOR Ct<n> 166 ONE_MINUS_SRC_COLOR (1-Ct<n>) 167 SRC_ALPHA At<n> 168 ONE_MINUS_SRC_ALPHA (1-At<n>) 169 170 Table 3.22: Arguments for COMBINE_RGB_EXT functions 171 172 SOURCE<n>_ALPHA_EXT OPERAND<n>_ALPHA_EXT Argument 173 ----------------- -------------- -------- 174 ZERO SRC_ALPHA 0 175 ONE_MINUS_SRC_ALPHA 1 176 TEXTURE SRC_ALPHA At 177 ONE_MINUS_SRC_ALPHA (1-At) 178 CONSTANT_EXT SRC_ALPHA Ac 179 ONE_MINUS_SRC_ALPHA (1-Ac) 180 PRIMARY_COLOR_EXT SRC_ALPHA Af 181 ONE_MINUS_SRC_ALPHA (1-Af) 182 PREVIOUS_EXT SRC_ALPHA Ap 183 ONE_MINUS_SRC_ALPHA (1-Ap) 184 TEXTURE<n>_ARB SRC_ALPHA At<n> 185 ONE_MINUS_SRC_ALPHA (1-At<n>) 186 187 Table 3.23: Arguments for COMBINE_ALPHA_EXT functions 188 189Additions to Chapter 4 of the OpenGL 1.2 Specification (Per-Fragment Operations 190and the Framebuffer) 191 192 None 193 194Additions to Chapter 5 of the OpenGL 1.2 Specification (Special Functions) 195 196 None 197 198Additions to Chapter 6 of the OpenGL 1.2 Specification (State and State Requests) 199 200 None 201 202Additions to the AGL/GLX/WGL Specifications 203 204 None 205 206GLX Protocol 207 208 None 209 210Errors 211 212 INVALID_ENUM is generated if <params> value for SOURCE0_RGB_EXT, 213 SOURCE1_RGB_EXT, SOURCE2_RGB_EXT, SOURCE3_RGB_NV, SOURCE0_ALPHA_EXT, 214 SOURCE1_ALPHA_EXT, SOURCE2_ALPHA_EXT or SOURCE3_ALPHA_NV is not one of 215 ZERO, TEXTURE, CONSTANT_EXT, PRIMARY_COLOR_EXT, PREVIOUS_EXT or 216 TEXTURE<n>_ARB, where <n> is in the range 0 to 217 NUMBER_OF_TEXTURE_UNITS_ARB-1. 218 219 INVALID_ENUM is generated if <params> value for OPERAND0_RGB_EXT, 220 OPERAND1_RGB_EXT, OPERAND2_RGB_EXT or OPERAND3_RGB_NV is not one of 221 SRC_COLOR, ONE_MINUS_SRC_COLOR, SRC_ALPHA or ONE_MINUS_SRC_ALPHA. 222 223 INVALID_ENUM is generated if <params> value for OPERAND0_ALPHA_EXT 224 OPERAND1_ALPHA_EXT, OPERAND2_ALPHA_EXT, or OPERAND3_ALPHA_NV is not 225 one of SRC_ALPHA or ONE_MINUS_SRC_ALPHA. 226 227Modifications to EXT_texture_env_combine 228 229 This extension relaxes the restrictions on SOURCE<n>_RGB_EXT, 230 SOURCE<n>_ALPHA_EXT, OPERAND<n>_RGB_EXT and OPERAND<n>_ALPHA_EXT for 231 use with EXT_texture_env_combine. All params specified by Table 3.22 232 and Table 3.23 are valid. 233 234Dependencies on ARB_multitexture 235 236 If ARB_multitexture is not implemented, all references to 237 TEXTURE<n>_ARB and NUMBER_OF_TEXTURE_UNITS_ARB are deleted. 238 239New State 240 241 Get Value Get Command Type Initial Value Attribute 242 --------- ----------- ---- ------------- --------- 243 SOURCE3_RGB_NV GetTexEnviv n x Z5+n ZERO texture 244 SOURCE3_ALPHA_NV GetTexEnviv n x Z5+n ZERO texture 245 OPERAND3_RGB_NV GetTexEnviv n x Z2 ONE_MINUS_SRC_COLOR texture 246 OPERAND3_ALPHA_NV GetTexEnviv n x Z2 ONE_MINUS_SRC_ALPHA texture 247 248New Implementation Dependent State 249 250 None 251 252NVIDIA Implementation Details 253 254 Because of a hardware limitation, TNT, TNT2, GeForce, and Quadro 255 treat "scale by 4.0" with the COMBINE_RGB_EXT or COMBINE_ALPHA_EXT 256 mode of ADD_SIGNED_EXT as "scale by 2.0". 257 258Revision History 259 260 2/22/00 mjk - added NVIDIA Implementation Details 261 262