1XXX - Not complete yet!!! 2 3Name 4 5 SGIX_clipmap 6 7Name Strings 8 9 GL_SGIX_clipmap 10 11Version 12 13 $Date: 1996/06/12 17:19:43 $ $Revision: 1.9 $ 14 15Number 16 17 33 18 19Dependencies 20 21 EXT_texture is required 22 EXT_texture_object affects the definition of this extension 23 SGIS_texture_lod affects the definition of this extension 24 SGI_detail_texture affects the definition of this extension 25 SGI_sharpen_texture affects the definition of this extension 26 27Overview 28 29 Mipmaps provide a general but expensive solution when the texture image 30 is very large. This extension defines clipmaps, which occupy a small 31 subset of the memory required by equivalent mipmaps, but provide much 32 of the mipmap rendering capabilities. Clipmaps are especially useful 33 for rendering terrain. 34 35Issues 36 37 * Is lod clamping treated properly if we have no texel data? 38 * Should we always have to specify a virtual depth? 39 40New Procedures and Functions 41 42 None 43 44New Tokens 45 46 Accepted by the <param> parameter of TexParameteri and TexParameterf, 47 and by the <params> parameter of TexParameteriv and TexParameterfv, 48 when their <pname> parameter is TEXTURE_MIN_FILTER: 49 50 LINEAR_CLIPMAP_LINEAR_SGIX 51 52 Accepted by the <pname> parameter of TexParameteri, TexParameterf, 53 TexParameteriv, TexParameterfv, GetTexParameteriv, and GetTexParameterfv: 54 55 TEXTURE_CLIPMAP_FRAME_SGIX 56 57 Accepted by the <pname> parameter of TexParameteriv, TexParameterfv, 58 GetTexParameteriv, and GetTexParameterfv: 59 60 TEXTURE_CLIPMAP_CENTER_SGIX 61 TEXTURE_CLIPMAP_OFFSET_SGIX 62 TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 63 64 Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, 65 GetFloatv, and GetDoublev: 66 67 MAX_CLIPMAP_DEPTH_SGIX 68 MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 69 70Additions to Chapter 2 of the 1.0 Specification (OpenGL Operation) 71 72 None 73 74Additions to Chapter 3 of the 1.0 Specification (Rasterization) 75 76 GL Specification Table 3.7 is updated as follows: 77 78 Name Type Legal Values 79 ---- ---- ------------ 80 TEXTURE_WRAP_S integer CLAMP, REPEAT 81 TEXTURE_WRAP_T integer CLAMP, REPEAT 82 TEXTURE_WRAP_R_EXT integer CLAMP, REPEAT 83 TEXTURE_MIN_FILTER integer NEAREST, LINEAR, 84 NEAREST_MIPMAP_NEAREST, 85 NEAREST_MIPMAP_LINEAR, 86 LINEAR_MIPMAP_NEAREST, 87 LINEAR_MIPMAP_LINEAR, 88 FILTER4_SGIS, 89 LINEAR_CLIPMAP_LINEAR_SGIX 90 TEXTURE_MAG_FILTER integer NEAREST, LINEAR, 91 FILTER4_SGIS, 92 LINEAR_DETAIL_SGIS, 93 LINEAR_DETAIL_ALPHA_SGIS, 94 LINEAR_DETAIL_COLOR_SGIS, 95 LINEAR_SHARPEN_SGIS, 96 LINEAR_SHARPEN_ALPHA_SGIS, 97 LINEAR_SHARPEN_COLOR_SGIS 98 TEXTURE_BORDER_COLOR 4 floats any 4 values in [0,1] 99 DETAIL_TEXTURE_LEVEL_SGIS integer any non-negative integer 100 DETAIL_TEXTURE_MODE_SGIS integer ADD, MODULATE 101 TEXTURE_MIN_LOD_SGIS float any value 102 TEXTURE_MAX_LOD_SGIS float any value 103 TEXTURE_BASE_LEVEL_SGIS integer any non-negative integer 104 TEXTURE_MAX_LEVEL_SGIS integer any non-negative integer 105 GENERATE_MIPMAP_SGIS boolean TRUE or FALSE 106 TEXTURE_CLIPMAP_FRAME_SGIX float any non-negative value 107 TEXTURE_CLIPMAP_CENTER_SGIX 2 integers any 2 non-negative integers 108 TEXTURE_CLIPMAP_OFFSET_SGIX 2 integers any 2 non-negative integers 109 TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 3 integers any 3 non-negative integers 110 111 Table 3.7: Texture parameters and their values. 112 113 Notes: 114 115 * Clipmap filtering is supported only for 2D, borderless textures. 116 117 * Clipmap filtering is performed when the texture minification filter 118 is LINEAR_CLIPMAP_LINEAR_SGIX. We could define other clipmap 119 filters with NEAREST sampling, but it probably isn't worth the 120 trouble. 121 122 * Clipmap filtering is supported with all magnification filters 123 except FILTER4_SGIS. Detail and sharpen filtering are performed 124 only when the texture data are supplied by the level 0 image. 125 126 * A clipmap virtualizes a mipmap by holding, at any given time, only a 127 portion of a full mipmap pyramid. A clipmap is complete only if 128 levels 0 through B have the same dimension, levels B through N form 129 the base of a valid mipmap, all image dimensions are a power of 2, 130 and N is less than MAX_CLIPMAP_DEPTH_SGIX. 131 132 Each image level P, where P ranges from B through N, is treated as 133 though it contains the full image from the same level of the complete 134 (N+1) level mipmap. 135 136 Each image level P, where P ranges from 0 through B-1, is treated as 137 though it contains a subimage from the same level of the complete 138 (N+1) level mipmap. This subimage is centered at texel coordinates 139 140 S = (Scenter >> P) 141 T = (Tcenter >> P) 142 143 where Scenter and Tcenter are specified by the application. 144 145 For instance, if the width of the clipmap is W=8, N=12, and Scenter= 146 2048, the clipmap will contain the data given by 0's in the S-edge 147 view below: 148 149 0 .********************************00000000********************************. 150 1 .********************************00000000********************************. 151 2 .********************************00000000********************************. 152 3 .********************************00000000********************************. 153 4 .********************************00000000********************************. 154 5 .********************************00000000********************************. 155 6 ****************************00000000**************************** 156 7 ************00000000************ 157 8 ****00000000**** 158B=9 00000000 159 10 0000 160 11 00 161N=12 0 162 163 Likewise, if Scenter=2016 (32 less than above): 164 165 0 .00000000****************************************************************. 166 1 .****************00000000************************************************. 167 2 .************************00000000****************************************. 168 3 .****************************00000000************************************. 169 4 .******************************00000000**********************************. 170 5 .*******************************00000000*********************************. 171 6 ****************************00000000***************************** 172 7 ************00000000************ 173 8 ****00000000**** 174 9 00000000 175 10 0000 176 11 00 177N=12 0 178 179 * Scenter and Tcenter are specified by the application by calling 180 TexParameteriv or TexParameterfv with <target> set to TEXTURE_2D, 181 <pname> set to <TEXTURE_CLIPMAP_CENTER_SGIX>, and <params> pointing 182 to a vector whose first component is Scenter and whose second 183 component is Tcenter. The center can be changed at any time. 184 185 * The clipped levels (i.e. those levels P, where P<B) of the map can 186 be framed with a region of texels guaranteed not to be displayed. 187 The frames allow for paging of new texture data into a non-active 188 portion of texture memory, enabling efficient roaming throughout the 189 larger virtual mipmap. The frames for all of the clipped levels are 190 the same width and are measured as a fraction of the width of the 191 clipped levels. Specifically, 192 193 width of frame in texels = Cframe * W / 2 194 195 The floating point value Cframe can take on values from 0.0 to 1.0 196 and is specified by the application. 197 198 Cframe is a non-negative fraction of half the level width specified 199 by calling TexParameterf or TexParameterfv with <target> set to 200 TEXTURE_2D, <pname> set to <TEXTURE_CLIPMAP_FRAME_SGIX>, and <param> 201 set to Cframe or <params> pointing to Cframe. Cframe is clamped to 202 the range [0,1]. The frame width can be changed at any time. 203 204 * During filtering a level of detail is determined just as it would be 205 for the equivalent (N+1) level mipmap. If the level of detail falls 206 into the clipped portion of the clipmap and the required texels are 207 not available within the framed region of the two closest image 208 levels, the level of detail is increased to the nearest image level 209 that does include the required texels. The values of TEXTURE_WRAP_S 210 and TEXTURE_WRAP_T have no effect during clipmap minification. 211 212 If SGIS_texture_lod is supported, the level of detail is clamped to 213 the range defined by TEXTURE_MIN_LOD_SGIS, TEXTURE_MAX_LOD_SGIS, 214 TEXTURE_BASE_LEVEL_SGIS, and TEXTURE_MAX_LEVEL_SGIS. (Issue: what 215 if texels do not exist on the level given by max_lod?) 216 217 * As the center moves, only texels along the edges of the clipmap levels 218 change. To allow for incremental loading only of these texels via 219 TexSubImage2DEXT, torroidal offset values are added to the texture 220 addresses of each level. For the Pth level where P ranges from 0 to 221 B-1, these offsets are 222 223 Soffsetp = (Soffset >> P) 224 Toffsetp = (Toffset >> P) 225 226 where Soffset and Toffset are specified by the application. Note that 227 Soffset and Toffset for the top level defines the offsets for 228 subsequent levels by a simple shift just as with the center. 229 230 Soffset and Toffset are specified by calling TexParameteriv or 231 TexParameterfv with <target> set to TEXTURE_2D, <pname> set to 232 <TEXTURE_CLIPMAP_OFFSET_SGIX>, and <params> pointing to a vector 233 whose first component is Soffset and whose second component is 234 Toffset. The offset can be changed at any time. 235 236 * To index into a clipmap of greater than MAX_CLIPMAP_DEPTH_SGIX levels 237 of detail, additional parameters are provided to restrictively index 238 a smaller clipmap of (N+1) levels located wholly within a complete, 239 larger clipmap. The larger clipmap is complete only if levels 0 240 through B have the same dimension, levels B through V form the base 241 of a valid mipmap, all image dimensions are a power of 2, and V is 242 less than MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX. These constraints are 243 precisely those given above with the exception of the depth, V, being 244 allowed to range up to MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX. 245 246 The second, smaller clipmap has a base level located at level D of 247 the larger clipmap and has a depth of N. Both parameters D and N are 248 specified by the application. The smaller clipmap is valid only if D 249 is between 0 and V, (D+N) is less than or equal to V, and D is less 250 than MAX_CLIPMAP_DEPTH_SGIX. 251 252 Scenter, Tcenter, Soffset, and Toffset are still relative the level 253 0, the base level of the larger, virtual mipmap, as are the minimum 254 and maximum levels of detail specified in the SGIS_texture_lod 255 extension. 256 257 For D=2, N=5, V=12, and Scenter=2048, the valid texels are given by 258 the x's in the diagram below. 259 260 0 ...******************************00000000******************************... 261 1 ...******************************00000000******************************... 262D=2 ...******************************xxxxxxxx******************************... 263 3 ...******************************xxxxxxxx******************************... 264 4 ...******************************xxxxxxxx******************************... 265 5 ...******************************00xxxx00******************************... 266 6 ****************************000xx000**************************** 267D+N=7 ************000x0000************ 268 8 ****00000000**** 269 9 00000000 270 10 0000 271 11 00 272V=12 0 273 274 Likewise, if Scenter=2016 (32 less than above): 275 276 0 .00000000**************************************************************... 277 1 .****************00000000**********************************************... 278D=2 ...**********************xxxxxxxx**************************************... 279 3 ...**************************xxxxxxxx**********************************... 280 4 ...****************************xxxxxxxx********************************... 281 5 ...*****************************00xxxx00*******************************... 282 6 ****************************000xx000****************************** 283D+N=7 ************000x0000************ 284 8 ****00000000**** 285 9 00000000 286 10 0000 287 11 00 288V=12 0 289 290 Texel address and level of detail generation proceed with the smaller 291 clipmap precisely as described above for the original clipmap. If 292 the level of detail is such that a level below D would be indexed, 293 texture magnification is performed even though the finer texture 294 information may be present in texture memory. Likewise, levels of 295 detail coarser than D+N may demonstrate aliasing. The onus is on the 296 application to choose parameters D and N to prevent unwanted 297 filtering operations. 298 299 The finest level of the clipmap, D, the depth of the clipmap, N+1, and 300 the depth of the virtual clipmap, V+1, are specified by calling 301 TexParameteriv, or TexParameterfv with <target> set to TEXTURE_2D, 302 <pname> set to <TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX>, and <params> set 303 to (D,N+1,V+1). These parameters can be changed at any time. 304 305 If the depth of the virtual clipmap is zero, clipmap virtualization 306 is ignored, and texturing proceeds as with a non-virtual clipmap. 307 308 * Special Case: 309 TEXTURE_CLIPMAP_LOD_OFFSET_SGIX is ignored 310 TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX === TEXTURE_CLIPMAP_DEPTH_SGIX 311 312Additions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations 313and the Frame Buffer) 314 315 None 316 317Additions to Chapter 5 of the 1.0 Specification (Special Functions) 318 319 None 320 321Additions to Chapter 6 of the 1.0 Specification (State and State Requests) 322 323 None 324 325Additions to the GLX Specification 326 327 None 328 329Dependencies on EXT_texture 330 331 EXT_texture is required 332 333Dependencies on EXT_texture_object 334 335 If EXT_texture_object is implemented, the state values named 336 337 TEXTURE_CLIPMAP_FRAME_SGIX 338 TEXTURE_CLIPMAP_CENTER_SGIX 339 TEXTURE_CLIPMAP_OFFSET_SGIX 340 TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 341 342 are added to the state vector of each texture object. When an attribute 343 set that includes texture information is popped, the bindings and 344 enables are first restored to their pushed values, then the bound 345 textures have their TEXTURE_CLIPMAP_FRAME_SGIX, 346 TEXTURE_CLIPMAP_CENTER_SGIX, TEXTURE_CLIPMAP_OFFSET_SGIX, and 347 TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX parameters restored to their pushed 348 values. 349 350Dependencies on SGIS_texture_lod 351 352 If SGIS_texture_lod is not supported, references to user-defined lod 353 clamping and ranges in this document are invalid and should be ignored. 354 355Dependencies on SGIS_detail_texture 356 357 If SGIS_detail_texture is not supported, references to detail texture 358 mapping in this document are invalid and should be ignored. 359 360Dependencies on SGIS_sharpen_texture 361 362 If SGIS_sharpen_texture is not supported, references to sharpen texture 363 mapping in this document are invalid and should be ignored. 364 365Errors 366 367 INVALID_VALUE is generated if TexParameteriv, TexParameterfv, 368 parameter <pname> is TEXTURE_CLIPMAP_CENTER_SGIX, and either of the two 369 parameters <params> points to are negative. 370 371 INVALID_VALUE is generated if TexParameteriv, TexParameterfv, 372 parameter <pname> is TEXTURE_CLIPMAP_OFFSET_SGIX, and either of the two 373 parameters <params> points to are negative. 374 375 INVALID_VALUE is generated if TexParameteriv, TexParameterfv, 376 parameter <pname> is TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX, and any of the 377 three parameters <params> points to are negative. 378 379 INVALID_VALUE is generated if TexParameteriv, TexParameterfv, 380 parameter <pname> is TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX, and the sum of 381 the clipmap level of detail offset and the clipmap depth is greater than 382 the virtual clipmap depth. 383 384New State 385 386 Initial 387 Get Value Get Command Type Value Attrib 388 --------- ----------- ---- ------- ------ 389 TEXTURE_CLIPMAP_FRAME_SGIX GetTexParameterf Z+ 0 texture 390 TEXTURE_CLIPMAP_CENTER_SGIX GetTexParameterfv 2 x Z+ 0,0 texture 391 TEXTURE_CLIPMAP_OFFSET_SGIX GetTexParameterfv 2 x Z+ 0,0 texture 392 TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX GetTexParameterfv 3 x Z+ 0,0,0 texture 393 394 395New Implementation Dependent State 396 397 Minimum 398 Get Value Get Command Type Value 399 --------- ----------- ---- ------- 400 MAX_CLIPMAP_DEPTH_SGIX GetIntegerv Z+ 10 401 MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX GetIntegerv Z+ 10 402