1Name 2 3 SGIS_detail_texture 4 5Name Strings 6 7 GL_SGIS_detail_texture 8 9Version 10 11 $Date: 1995/07/09 06:48:46 $ $Revision: 1.31 $ 12 13Number 14 15 21 16 17Dependencies 18 19 EXT_texture is required 20 EXT_subtexture affects the definition of this extension 21 EXT_copy_texture affects the definition of this extension 22 EXT_texture_object affects the definition of this extension 23 24Overview 25 26 This extension introduces texture magnification filters that blend 27 between the level 0 image and a separately defined "detail" image. 28 The detail image represents the characteristics of the high frequency 29 subband image above the band-limited level 0 image. The detail image is 30 typically a rectangular portion of the subband image which is modified 31 so that it can be repeated without discontinuities along its edges. 32 Detail blending can be enabled for all color channels, for the alpha 33 channel only, or for the red, green, and blue channels only. It is 34 available only for 2D textures. 35 36 WARNING - Silicon Graphics has filed for patent protection for some 37 of the techniques described in this extension document. 38 39Issues 40 41 * Should detail textures be supported in 1D? 3D? (Currently 42 written to support 2D only) 43 44 * Is there any need to support detail textures with NEAREST 45 or FILTER4 filtering? (No) 46 47 * How does detail texture interact with a texture whose 48 minimum LOD image is not layer zero? (Handle this in the LOD 49 extension.) 50 51 * Should six detail filters be defined, so that the MODE is part 52 of the filter name? (LINEAR_ADD_DETAIL_SGIS, 53 LINEAR_ADD_DETAIL_ALPHA_SGIS, ...) (No) 54 55 * I have scaled and biased the detail texture value to the range [-1,1] 56 in this specification. I believe that Iris GL scaled and biased to 57 [-0.5,0.5]. The [-1,1] range seems clearer to me, if it allows F() 58 to be limited to [0,1]. Is this acceptable? 59 60 * Should detail texture objects and 2D texture objects be separate 61 sets, or should it be possible to use the same texture object both 62 as a detail texture and as a 2D texture? (Keep them separate) 63 64New Procedures and Functions 65 66 void DetailTexFuncSGIS(enum target, 67 sizei n, 68 const float* points); 69 70 void GetDetailTexFuncSGIS(enum target, 71 float* points); 72 73New Tokens 74 75 Accepted by the <target> parameters of GetTexImage, 76 GetTexLevelParameterfv, GetTexLevelParameteriv, GetTexParameterfv, 77 GetTexParameteriv, TexImage2D, TexParameterf, TexParameterfv, 78 TexParameteri, and TexParameteriv. If the corresponding extensions are 79 supported, also accepted by the <target> parameters of TexSubImage2DEXT, 80 CopyTexImage2DEXT, CopyTexSubImage2DEXT, and BindTextureEXT: 81 82 DETAIL_TEXTURE_2D_SGIS 83 84 Accepted by the <pname> parameters of GetBooleanv, GetIntegerv, 85 GetFloatv, and GetDoublev: 86 87 DETAIL_TEXTURE_2D_BINDING_SGIS 88 89 Accepted by the <param> parameter of TexParameteri and TexParameterf, 90 and by the <params> parameter of TexParameteriv and TexParameterfv, 91 when their <pname> parameter is TEXTURE_MAG_FILTER: 92 93 LINEAR_DETAIL_SGIS 94 LINEAR_DETAIL_ALPHA_SGIS 95 LINEAR_DETAIL_COLOR_SGIS 96 97 Accepted by the <pname> parameter of TexParameteri, TexParameterf, 98 TexParameteriv, TexParameterfv, GetTexParameteriv, and GetTexParameterfv: 99 100 DETAIL_TEXTURE_LEVEL_SGIS 101 DETAIL_TEXTURE_MODE_SGIS 102 103 Accepted by the <pname> parameter of GetTexParameteriv and 104 GetTexParameterfv: 105 106 DETAIL_TEXTURE_FUNC_POINTS_SGIS 107 108Additions to Chapter 2 of the 1.0 Specification (OpenGL Operation) 109 110 None 111 112Additions to Chapter 3 of the 1.0 Specification (Rasterization) 113 114 GL Specification Table 3.7 is updated as follows: 115 116 Name Type Legal Values 117 ---- ---- ------------ 118 TEXTURE_WRAP_S integer CLAMP, REPEAT 119 TEXTURE_WRAP_T integer CLAMP, REPEAT 120 TEXTURE_WRAP_R_EXT integer CLAMP, REPEAT 121 TEXTURE_MIN_FILTER integer NEAREST, LINEAR, 122 NEAREST_MIPMAP_NEAREST, 123 NEAREST_MIPMAP_LINEAR, 124 LINEAR_MIPMAP_NEAREST, 125 LINEAR_MIPMAP_LINEAR, 126 FILTER4_SGIS 127 TEXTURE_MAG_FILTER integer NEAREST, LINEAR, 128 FILTER4_SGIS, 129 LINEAR_DETAIL_SGIS, 130 LINEAR_DETAIL_ALPHA_SGIS, 131 LINEAR_DETAIL_COLOR_SGIS 132 TEXTURE_BORDER_COLOR 4 floats any 4 values in [0,1] 133 DETAIL_TEXTURE_LEVEL_SGIS integer any non-positive integer 134 DETAIL_TEXTURE_MODE_SGIS integer ADD, MODULATE 135 136 Table 3.7: Texture parameters and their values. 137 138 3.8.2.1 Texture magnification with detail 139 140 Three additional texture magnification filters are defined for texture 141 magnification. These values, which are assigned to TEXTURE_MAG_FILTER, 142 are LINEAR_DETAIL_SGIS, LINEAR_DETAIL_ALPHA_SGIS, and 143 LINEAR_DETAIL_COLOR_SGIS. All three filters sample the level zero 144 texture array exactly as it would be sampled with filter mode LINEAR. 145 All three also sample the level zero texture array of a second 146 texture, known as the detail texture, when three conditions are met. 147 The detail texture corresponding to texture TEXTURE_2D is 148 DETAIL_TEXTURE_2D_SGIS. The conditions are: 149 150 1. The active texture must be TEXTURE_2D. 151 152 2. The internal formats of TEXTURE_2D and DETAIL_TEXTURE_2D_SGIS 153 must have been specified identically. 154 155 3. The level 0 array of DETAIL_TEXTURE_2D_SGIS must have nonzero width 156 and height. 157 158 If these conditions are not met, it is as though the magnification 159 texture filter was LINEAR. (Although querying the magnification filter 160 value will return the value as specified.) If they are met, the level 161 zero array of the detail texture is also linearly sampled, using the 162 following arithmetic: 163 164 n = log base 2 of the width of the level zero array of TEXTURE_2D 165 m = log base 2 of the height of the level zero array of TEXTURE_2D 166 N = log base 2 of the width of DETAIL_TEXTURE_2D_SGIS 167 M = log base 2 of the height of DETAIL_TEXTURE_2D_SGIS 168 L = DETAIL_TEXTURE_LEVEL_SGIS value of TEXTURE_2D 169 170 u = s * 2**(n-L) 171 v = t * 2**(m-L) 172 173 i0 = floor(u - 1/2) mod 2**N 174 j0 = floor(v - 1/2) mod 2**M 175 176 i1 = (i0 + 1) mod 2**N 177 j1 = (j0 + 1) mod 2**M 178 179 A = frac(u - 1/2) 180 B = frac(v - 1/2) 181 182 Tdetail = (1-A) * (1-B) * detail[i0,j0] + 183 A * (1-B) * detail[i1,j0] + 184 (1-A) * B * detail[i0,j1] + 185 A * B * detail[i1,j1] 186 187 Note that magnification corresponds to negative values of level-of-detail 188 and minification corresponds to positive values. Hence L, the value of the 189 DETAIL_TEXTURE_LEVEL_SGIS parameter of TEXTURE_2D, must be negative. The 190 absolute value of L can be thought of as the number of levels that 191 separate the level 0 image of TEXTURE_2D and the image of 192 DETAIL_TEXTURE_2D, which is replicated as necessary to fill the appropriate 193 number of texels. For example, if L is -2, the detail texture image is 194 replicated as necessary in x and y to form a single image whose dimensions 195 are four times larger than the level zero array of TEXTURE_2D. 196 197 The texture value computed from the primary texture (Ttexture) and 198 the value computed from the detail texture (Tdetail) are combined 199 in one of two ways to compute the final texture value (T). The 200 values of Ttexture, Tdetail, and T are treated as though they range 201 from 0.0 through 1.0 in these equations. 202 203 If DETAIL_TEXTURE_MODE_SGIS of TEXTURE_2D is ADD, then 204 205 T' = Ttexture + F(LOD) * (2*Tdetail-1) 206 207 / 0 T' < 0 208 T = < T' 0 <= T' <= 1 209 \ 1 T' > 1 210 211 where F is a function of the level-of-detail parameter LOD, which is 212 represented by the Greek character lambda in the GL specification. In 213 effect, the detail texture is scaled and biased so that its range is 214 [-1,1]. The resulting signed value is scaled by a function of LOD, 215 added to the base texture, and clamped to [0,1]. 216 217 If DETAIL_TEXTURE_MODE_SGIS or TEXTURE_2D is MODULATE, then 218 219 T' = Ttexture * (1 + F(LOD) * (2*Tdetail-1)) 220 221 / 0 T' < 0 222 T = < T' 0 <= T' <= 1 223 \ 1 T' > 1 224 225 Here again the detail texture is scaled and biased so that its range 226 is [-1,1]. The resulting signed value is scaled by a function of LOD, 227 and biased by 1. This result scales the base texture, which is then 228 clamped to [0,1]. 229 230 The function F of level-of-detail parameter LOD is specified by calling 231 DetailTexFuncSGIS with <target> set to TEXTURE_2D, <points> pointing at 232 an array of pairs of floating point values, and <n> set to the number 233 of value pairs in <points>. The first value of each value pair in 234 <points> specifies a value of LOD, and the second value of each value 235 pair specifies the corresponding function value. The order in which 236 the points are specified is not significant. The <n> value pairs in 237 <points> completely specify the function, replacing any previous 238 specification that may have existed. Since negative values of LOD 239 correspond to magnification and positive values correspond to 240 minification, the points should have negative values for LOD (though it 241 is not an error to specify positive values). 242 243 Function F is evaluated by sorting the value pairs specified by 244 DetailTexFuncSGIS by LOD value, then fitting a curve through these 245 points. This curve may be linear between adjacent points, or it may be 246 smoothed, but it will pass exactly through the points, limited only by 247 the resolution of the implementation. The value pair with the lowest 248 LOD value specifies the function value F for all values of LOD less than 249 or equal to that pair's LOD. Likewise, the value pair with the greatest 250 LOD value specifies the function value F for all values of LOD greater 251 than or equal to that pair's LOD. F is undefined if two or more value 252 pairs have the same LOD value. 253 254 If the texture magnification filter is LINEAR_DETAIL_SGIS, then both 255 the color and the alpha components of T are computed as described 256 in the equations above. If the filter is LINEAR_DETAIL_COLOR_SGIS, 257 then all components of T other than alpha are computed as described 258 above, and the alpha component of T is computed as if the texture 259 magnification filter were LINEAR. Finally, if the filter is 260 LINEAR_DETAIL_ALPHA_SGIS, the alpha component of T is computed as 261 described in the equations above, and all other components of T 262 are computed as if the texture magnification filter were LINEAR. 263 264 All OpenGL texture commands that accept a target value of TEXTURE_2D 265 also accept the target value DETAIL_TEXTURE_2D_SGIS. These commands 266 operate on and return state of the detail texture just as they do 267 of the 2-dimensional texture. 268 269 If EXT_texture_object is supported, detail texture objects can be 270 created, operated on, and bound just as their 2D counterparts are. The 271 sets of detail textures and 2D textures are exclusive, however, so it 272 is not possible to use a texture object both as a 2D texture and as 273 a detail texture. By default zero is bound to DETAIL_TEXTURE_2D_SGIS, 274 just as zero is bound to TEXTURE_2D. 275 276 Specification of a detail texture 277 --------------------------------- 278 279 A detail texture is specified by calling TexImage2D or CopyTexImage2DEXT 280 with <target> set to DETAIL_TEXTURE_2D_SGIS, <level> set to 0, <border> 281 set to 0, and the other parameters specified to generate the desired 282 image. 283 284 Minification vs. Magnification 285 ------------------------------ 286 287 If the magnification filter is given by LINEAR_DETAIL_SGIS, 288 LINEAR_DETAIL_ALPHA_SGIS, or LINEAR_DETAIL_COLOR_SGIS, and the 289 minification filter is given by NEAREST_MIPMAP_NEAREST or 290 LINEAR_MIPMAP_NEAREST, then c = 0.5. The parameter c is used to 291 determine whether minification or magnification filtering is done, 292 as described in Section 3.8.2 of the GL Specification (Texture 293 Magnification). 294 295Additions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations 296and the Framebuffer) 297 298 None 299 300Additions to Chapter 5 of the 1.0 Specification (Special Functions) 301 302 GetDetailTexFuncSGIS is not included in display lists. 303 304Additions to Chapter 6 of the 1.0 Specification (State and State Requests) 305 306 Although many of the parameter values of a detail texture have no 307 effect on texture operation, they are maintained and may be queried. 308 There is no value associated with the binding point 309 DETAIL_TEXTURE_2D_SGIS, so it is not accepted as the <pname> parameter 310 of GetBooleanv, GetIntegerv, GetFloatv, or GetDoublev. The name of 311 the detail texture that is bound to DETAIL_TEXTURE_2D_SGIS is queried 312 by calling GetBooleanv, GetIntegerv, GetFloatv, or GetDoublev with 313 <pname> set to DETAIL_TEXTURE_2D_BINDING_SGIS. Zero is returned if 314 no texture has been bound. 315 316 The number of points in the detail texture function specification of 317 a texture is queried by calling GetTexParameteriv or GetTexParameterfv 318 with <target> set to the target of the desired texture and <pname> set 319 to DETAIL_TEXTURE_FUNC_POINTS_SGIS. The function 320 GetDetailTexFuncSGIS returns in <points> all of the points in the detail 321 texture function of texture <target>. 322 323Additions to the GLX Specification 324 325 None 326 327GLX Protocol 328 329 Two new GLX protocol commands are added. 330 331 DetailTexFuncSGIS 332 2 12+4*2*n rendering command length 333 2 2051 rendering command opcode 334 4 ENUM target 335 4 INT32 n 336 4*2*n LISTofFLOAT points 337 338 GetDetailTexFuncSGIS 339 1 CARD8 opcode (X assigned) 340 1 17 GLX opcode (glXVendorPrivateWithReply) 341 2 4 request length 342 4 4096 vendor specific opcode 343 4 GLX_CONTEXT_TAG context tag 344 4 ENUM target 345 => 346 1 1 reply 347 1 unused 348 2 CARD16 sequence number 349 4 n reply length, m = n 350 4 unused 351 4 CARD32 n 352 16 unused 353 n*4 LISTofFLOAT32 points 354 355 Note that n may be zero, indicating that a GL error occurred. 356 Otherwise n must be even and n >= 2. 357 358Dependencies on EXT_texture 359 360 EXT_texture is required. 361 362Dependencies on EXT_texture3D 363 364 None, because detail texture is not specified for 3D textures. This 365 extensions is designed to allow a subsequent extension to define 3D 366 detail textures, however. 367 368Dependencies on EXT_subtexture 369 370 If EXT_subtexture is not implemented, then the references to 371 TexSubImage2DEXT and CopyTexSubImage2DEXT in this file are invalid, 372 and should be ignored. 373 374Dependencies on EXT_copy_texture 375 376 If EXT_copy_texture is not implemented, then the references to 377 CopyTexImage2DEXT and CopyTexSubImage2DEXT in this file are invalid, 378 and should be ignored. 379 380Dependencies on EXT_texture_object 381 382 If EXT_texture_object is not implemented, then the references to 383 BindTextureEXT are invalid, and should be ignored. 384 385 If EXT_texture_object is implemented, the state values named 386 387 DETAIL_TEXTURE_LEVEL_SGIS 388 DETAIL_TEXTURE_MODE_SGIS 389 DETAIL_TEXTURE_FUNC_POINTS_SGIS 390 <DETAIL_TEXTURE_FUNC> 391 392 are added to the state vector of each texture object. When an attribute 393 set that includes texture information is popped, the bindings and 394 enables are first restored to their pushed values, then the bound 395 textures have their detail parameters restored to their pushed values. 396 397Errors 398 399 INVALID_VALUE is generated if TexImage2D or CopyTexImage2DEXT 400 parameter <target> is DETAIL_TEXTURE_2D_SGIS, and parameter <level> 401 or parameter <border> is not zero. 402 403 INVALID_VALUE is generated if BindTextureEXT parameter <target> is 404 DETAIL_TEXTURE_2D_SGIS, and parameter <texture> is not the name of a 405 detail texture, the name of an as yet unbound texture, or zero. 406 407 INVALID_VALUE is generated if TexParameteri, TexParameterf, 408 TexParameteriv, or TexParameterfv parameter <pname> is 409 DETAIL_TEXTURE_MODE_SGIS, and parameter <param> is not ADD or MODULATE, 410 or parameter <params> doesn't point to ADD or MODULATE. 411 412 INVALID_VALUE is generated if TexParameteri, TexParameterf, 413 TexParameteriv, or TexParameterfv parameter <pname> is 414 DETAIL_TEXTURE_LEVEL_SGIS, and parameter <param> is positive, 415 or parameter <params> points to a positive value. 416 417 INVALID_ENUM is generated if DetailTexFuncSGIS or 418 GetDetailTexFuncSGIS parameter <target> is not TEXTURE_2D. 419 420 INVALID_VALUE is generated if DetailTexFuncSGIS parameter <n> is 421 negative. 422 423 INVALID_OPERATION is generated if DetailTexFuncSGIS or 424 GetDetailTexFuncSGIS is executed between execution of Begin and the 425 corresponding execution to End. 426 427New State 428 429 Get Value Get Command Type Initial Value Attribute 430 --------- ----------- ---- ------------- --------- 431 DETAIL_TEXTURE_2D_BINDING_SGIS GetIntegerv Z+ 0 texture 432 DETAIL_TEXTURE_LEVEL_SGIS GetTexParameteriv n x Z- -4 texture 433 DETAIL_TEXTURE_MODE_SGIS GetTexParameteriv n x Z2 ADD texture 434 DETAIL_TEXTURE_FUNC_POINTS_SGIS GetTexParameteriv n x Z+ 2 texture 435 <DETAIL_TEXTURE_FUNC> GetDetailTexFuncSGIS n x m x R {0, 0}, {-4, 1} texture 436 437New Implementation Dependent State 438 439 None 440