1Name 2 3 EXT_texture_mirror_clamp 4 5Name Strings 6 7 GL_EXT_texture_mirror_clamp 8 9Contributors 10 11 Walt Donovan 12 Dan Ginsburg 13 14Contact 15 16 Mark J. Kilgard, NVIDIA Corporation (mjk 'at' nvidia.com) 17 18Status 19 20 Shipping as of May 2004 for GeForce6. 21 22Version 23 24 Last Modified Date: 2004/05/17 25 Version: 4 26 27Number 28 29 298 30 31Issues 32 33 How does EXT_texture_mirror_clamp extend ATI_texture_mirror_once? 34 35 This EXT extension provides the two wrap modes that 36 ATI_texture_mirror_once adds but also adds a third new wrap mode 37 (GL_MIRROR_CLAMP_TO_BORDER_EXT). This extension uses the same 38 enumerant values for the ATI_texture_mirror_once modes. 39 40 Why is the GL_MIRROR_CLAMP_TO_BORDER_EXT mode more interesting than 41 the two other modes? 42 43 Rather than clamp to 100% of the edge of the texture 44 (GL_MIRROR_CLAMP_TO_EDGE_EXT) or to 50% of the edge and border 45 color (GL_MIRROR_CLAMP), it is preferable to clamp to 100% 46 of the border color (GL_MIRROR_CLAMP_TO_BORDER_EXT). This 47 avoids "bleeding" at smaller mipmap levels. 48 49 Consider a texture that encodes a circular fall-off pattern such 50 as for a projected spotlight. A circular pattern is bi-symmetric 51 so a "mirror clamp" wrap modes can reduce the memory footprint 52 of the texture by a fourth. Far outside the spotlight pattern, 53 you'd like to sample 100% of the border color (typically black 54 for a spotlight texture). The way to achieve this without any 55 bleeding of edge texels is with GL_MIRROR_CLAMP_TO_BORDER_EXT. 56 57 Does this extension complete the orthogonality of the current five 58 OpenGL 1.5 wrap modes? 59 60 Yes. There are two ways for repetition to operate (repeated 61 & mirrored) and four ways for texture coordinate clamping to 62 operate (unclamped, clamp, clamp to edge, & clamp to border). 63 The complete table of all 8 modes looks like this: 64 65 Repeat Mirror 66 +---------------- ---------------------- 67 Unclamped | REPEAT MIRRORED_REPEAT 68 Clamp | CLAMP MIRROR_CLAMP 69 Clamp to edge | CLAMP_TO_EDGE MIRROR_CLAMP_TO_EDGE 70 Clamp to border | CLAMP_TO_BORDER MIRROR_CLAMP_TO_BORDER 71 72 OpenGL 1.0 introduced REPEAT & CLAMP. 73 OpenGL 1.2 introduced CLAMP_TO_EDGE 74 OpenGL 1.3 introduced CLAMP_TO_BORDER 75 OpenGL 1.4 introduced MIRRORED_REPEAT 76 ATI_texture_mirror_once introduced MIRROR_CLAMP & MIRROR_CLAMP_TO_EDGE 77 EXT_texture_mirror_clamp introduces MIRROR_CLAMP_TO_BORDER 78 79 Do these three new wrap modes work with 1D, 2D, 3D, and cube map 80 texture targets? 81 82 RESOLUTION: Yes. 83 84 Do these three new wrap modes work with ARB_texture_non_power_of_two 85 functionality? 86 87 RESOLUTION: Yes. 88 89 Do these three new wrap modes interact with NV_texture_rectangle? 90 91 RESOLUTION: Mirroring wrap modes are not supported by 92 GL_TEXTURE_RECTANGLE_NV textures. Conventional mirroring is 93 already not supported for texture rectangles so supporting 94 clamped mirroring modes should not be supported either. 95 96 Does the specification of MIRROR_CLAMP_EXT & MIRROR_CLAMP_TO_EDGE_EXT 97 match the ATI_texture_mirror_once specification? 98 99 I believe yes. The ATI_texture_mirror_once specification is 100 somewhat vague what happens to texture coordinates at or very 101 near (within half a texel of) zero. The presumption is that a 102 CLAMP_TO_EDGE behavior is used. This specification is quite 103 explicit that values near zero are clamped to plus or minus 104 1/(2*N) respectively so that the CLAMP_TO_EDGE behavior is 105 explicit. 106 107 What should this extension be called? 108 109 Calling the extension EXT_texture_mirror_once might cause 110 confusion since this extension has additional functionality. 111 Also, "once" never appears in the specification. 112 EXT_texture_mirror_clamp is a good name because it implies 113 support for all the clamped versions of mirroring. 114 115 There is GL_MIRRORED_REPEAT and then GL_MIRROR_CLAMP_EXT, 116 GL_MIRROR_CLAMP_TO_EDGE_EXT, and GL_MIRROR_CLAMP_TO_BORDER_EXT. 117 Why does the first enumerant name say "MIRRORED" while the other 118 three say "MIRROR"? 119 120 This extension follows the naming precedent set by the 121 ATI_texture_mirror_once specification. 122 123 Moreover, MIRRORED_REPEAT uses "mirrored" to help that the 124 mirroring repeats infinitely. For the other three modes, 125 there is just one mirror that occurs and then a clamp. 126 127Dependencies 128 129 Written based on the wording of the OpenGL 1.4. 130 131 Extends ATI_texture_mirror_once by adding 132 GL_MIRROR_CLAMP_TO_BORDER_EXT. 133 134 NV_texture_rectangle trivially affects the definition of this 135 extension. 136 137Overview 138 139 EXT_texture_mirror_clamp extends the set of texture wrap modes to 140 include three modes (GL_MIRROR_CLAMP_EXT, GL_MIRROR_CLAMP_TO_EDGE_EXT, 141 GL_MIRROR_CLAMP_TO_BORDER_EXT) that effectively use a texture map 142 twice as large as the original image in which the additional half 143 of the new image is a mirror image of the original image. 144 145 This new mode relaxes the need to generate images whose opposite 146 edges match by using the original image to generate a matching 147 "mirror image". This mode allows the texture to be mirrored only 148 once in the negative s, t, and r directions. 149 150New Procedure and Functions 151 152 None 153 154New Tokens 155 156 Accepted by the <param> parameter of TexParameteri and TexParameterf, 157 and by the <params> parameter of TexParameteriv and TexParameterfv, 158 when their <pname> parameter is TEXTURE_WRAP_S, TEXTURE_WRAP_T, 159 or TEXTURE_WRAP_R: 160 161 MIRROR_CLAMP_EXT 0x8742 (same value as MIRROR_CLAMP_ATI) 162 MIRROR_CLAMP_TO_EDGE_EXT 0x8743 (same value as MIRROR_CLAMP_TO_EDGE_ATI) 163 MIRROR_CLAMP_TO_BORDER_EXT 0x8912 164 165Additions to Chapter 2 of the OpenGL 1.2.1 Specification (Operation) 166 167 None 168 169Additions to Chapter 3 if the OpenGL 1.2.1 Specification (Rasterization): 170 171 - (3.8.4, page 136, as amended by the NV_texture_rectangle extension) 172 173 Add the 3 new wrap modes to the list of wrap modes unsupported for 174 the TEXTURE_RECTANGLE_NV texture target. 175 176 "Certain texture parameter values may not be specified for textures 177 with a target of TEXTURE_RECTANGLE_NV. The error INVALID_ENUM 178 is generated if the target is TEXTURE_RECTANGLE_NV and the 179 TEXTURE_WRAP_S, TEXTURE_WRAP_T, or TEXTURE_WRAP_R parameter is set to 180 REPEAT, MIRRORED_REPEAT_IBM, MIRROR_CLAMP_EXT, MIRROR_CLAMP_TO_EDGE_EXT, and 181 MIRROR_CLAMP_TO_BORDER_EXT. The error INVALID_ENUM is generated 182 if the target is TEXTURE_RECTANGLE_NV and the TEXTURE_MIN_FILTER is 183 set to a value other than NEAREST or LINEAR (no mipmap filtering 184 is permitted). The error INVALID_ENUM is generated if the target 185 is TEXTURE_RECTANGLE_NV and TEXTURE_BASE_LEVEL is set to any value 186 other than zero." 187 188 - Table 3.19, page 137: Change first three entries in table: 189 190 "TEXTURE_WRAP_S integer CLAMP, CLAMP_TO_BORDER, CLAMP_TO_EDGE, 191 MIRRORED_REPEAT, MIRROR_CLAMP_EXT, 192 MIRROR_CLAMP_TO_BORDER_EXT, 193 MIRROR_CLAMP_TO_EDGE_EXT, REPEAT 194 TEXTURE_WRAP_T integer CLAMP, CLAMP_TO_BORDER, CLAMP_TO_EDGE, 195 MIRRORED_REPEAT, MIRROR_CLAMP_EXT, 196 MIRROR_CLAMP_TO_BORDER_EXT, 197 MIRROR_CLAMP_TO_EDGE_EXT, REPEAT 198 TEXTURE_WRAP_R integer CLAMP, CLAMP_TO_BORDER, CLAMP_TO_EDGE, 199 MIRRORED_REPEAT, MIRROR_CLAMP_EXT, 200 MIRROR_CLAMP_TO_BORDER_EXT, 201 MIRROR_CLAMP_TO_EDGE_EXT, REPEAT" 202 203 - (3.8.7, page 140) After the last paragraph of the section add: 204 205 "Wrap Mode MIRROR_CLAMP_EXT 206 207 Wrap mode MIRROR_CLAMP_EXT mirrors and clamps the texture coordinate, 208 where mirroring and clamping a value f computes 209 210 mirrorClamp(f) = min(1, max(1/(2*N), abs(f))) 211 212 where N is the size of the one-, two-, or three-dimensional texture 213 image in the direction of wrapping. 214 215 Wrap Mode MIRROR_CLAMP_TO_EDGE_EXT 216 217 Wrap mode MIRROR_CLAMP_TO_EDGE_EXT mirrors and clamps to edge the 218 texture coordinate, where mirroring and clamping to edge a value f 219 computes 220 221 mirrorClampToEdge(f) = min(1-1/(2*N), max(1/(2*N), abs(f))) 222 223 where N is the size of the one-, two-, or three-dimensional texture 224 image in the direction of wrapping. 225 226 Wrap Mode MIRROR_CLAMP_TO_BORDER_EXT 227 228 Wrap mode MIRROR_CLAMP_TO_BORDER_EXT mirrors and clamps to border the 229 texture coordinate, where mirroring and clamping to border a value 230 f computes 231 232 mirrorClampToBorder(f) = min(1+1/(2*N), max(1/(2*N), abs(f))) 233 234 where N is the size of the one-, two-, or three-dimensional texture 235 image in the direction of wrapping." 236 237 - (3.8.8, page 142) Delete this phrase because it is out of date and 238 unnecessary given the current way section 3.8.7 is written: 239 240 "(if the wrap mode for a coordinate is CLAMP or CLAMP_TO_EDGE)" 241 242Additions to Chapter 4: 243 244 None 245 246Additions to Chapter 5: 247 248 None 249 250Additions to Chapter 6: 251 252 None 253 254Additions to the GLX Specification 255 256 None 257 258Dependencies on NV_texture_rectangle 259 260 If NV_texture_rectangle is not supported, ignore the statement that 261 the initial value for the S, T, and R wrap modes is CLAMP_TO_EDGE 262 for rectangular textures. 263 264 Ignore the error for a texture target of TEXTURE_RECTANGLE_NV. 265 266GLX Protocol 267 268 None 269 270Errors 271 272 INVALID_ENUM is generated when TexParameter is called with 273 a target of TEXTURE_RECTANGLE_NV and the TEXTURE_WRAP_S, 274 TEXTURE_WRAP_T, or TEXTURE_WRAP_R parameter is set to REPEAT, 275 MIRRORED_REPEAT_IBM, MIRROR_CLAMP_EXT, MIRROR_CLAMP_TO_EDGE_EXT, 276 or MIRROR_CLAMP_TO_BORDER_EXT. 277 278New State 279 280 (table 6.15, p230) amend the following entries [Z5 changed to Z8]: 281 282 Get Value Type Get Command Initial Value Description Sec Attribute 283 -------------- ---- --------------- --------------- ------------------- ----- --------- 284 TEXTURE_WRAP_S n*Z8 GetTexParameter REPEAT except Texture wrap mode S 3.8.7 texture 285 for rectangular 286 which is 287 CLAMP_TO_EDGE 288 TEXTURE_WRAP_T n*Z8 GetTexParameter REPEAT except Texture wrap mode T 3.8.7 texture 289 for rectangular 290 which is 291 CLAMP_TO_EDGE 292 TEXTURE_WRAP_R n*Z8 GetTexParameter REPEAT except Texture wrap mode R 3.8.7 texture 293 for rectangular 294 which is 295 CLAMP_TO_EDGE 296 297New Implementation Dependent State 298 299 None 300