1Name 2 3 ARB_point_parameters 4 5Name Strings 6 7 GL_ARB_point_parameters 8 9Contact 10 11 Michael Gold, NVIDIA (gold 'at' nvidia.com) 12 13Notice 14 15 Copyright (c) 2000-2013 The Khronos Group Inc. Copyright terms at 16 http://www.khronos.org/registry/speccopyright.html 17 18Specification Update Policy 19 20 Khronos-approved extension specifications are updated in response to 21 issues and bugs prioritized by the Khronos OpenGL Working Group. For 22 extensions which have been promoted to a core Specification, fixes will 23 first appear in the latest version of that core Specification, and will 24 eventually be backported to the extension document. This policy is 25 described in more detail at 26 https://www.khronos.org/registry/OpenGL/docs/update_policy.php 27 28Status 29 30 Approved by the ARB, 21 June 2000. 31 32Version 33 34 Revision Date: September 23, 2010 35 Version: 0.6 36 37 Based on: EXT_point_parameters 38 $Date: 1997/08/21 21:26:36 $ $Revision: 1.6 $ 39 40Number 41 42 ARB Extension #14 43 44Dependencies 45 46 OpenGL 1.0 is required. 47 ARB_multisample affects the definition of this extension. 48 The extension is written against the OpenGL 1.2.1 Specification. 49 50Overview 51 52 This extension supports additional geometric characteristics of 53 points. It can be used to render particles or tiny light sources, 54 commonly referred to as "Light points". 55 56 The raster brightness of a point is a function of the point area, 57 point color, point transparency, and the response of the display's 58 electron gun and phosphor. The point area and the point transparency 59 are derived from the point size, currently provided with the <size> 60 parameter of glPointSize. 61 62 The primary motivation is to allow the size of a point to be 63 affected by distance attenuation. When distance attenuation has an 64 effect, the final point size decreases as the distance of the point 65 from the eye increases. 66 67 The secondary motivation is a mean to control the mapping from the 68 point size to the raster point area and point transparency. This is 69 done in order to increase the dynamic range of the raster brightness 70 of points. In other words, the alpha component of a point may be 71 decreased (and its transparency increased) as its area shrinks below 72 a defined threshold. 73 74 This extension defines a derived point size to be closely related to 75 point brightness. The brightness of a point is given by: 76 77 1 78 dist_atten(d) = ------------------- 79 a + b * d + c * d^2 80 81 brightness(Pe) = Brightness * dist_atten(|Pe|) 82 83 where 'Pe' is the point in eye coordinates, and 'Brightness' is some 84 initial value proportional to the square of the size provided with 85 PointSize. Here we simplify the raster brightness to be a function 86 of the rasterized point area and point transparency. 87 88 brightness(Pe) brightness(Pe) >= Threshold_Area 89 area(Pe) = 90 Threshold_Area Otherwise 91 92 factor(Pe) = brightness(Pe)/Threshold_Area 93 94 alpha(Pe) = Alpha * factor(Pe) 95 96 where 'Alpha' comes with the point color (possibly modified by 97 lighting). 98 99 'Threshold_Area' above is in area units. Thus, it is proportional to 100 the square of the threshold provided by the programmer through this 101 extension. 102 103 The new point size derivation method applies to all points, while 104 the threshold applies to multisample points only. 105 106IP Status 107 108 None. 109 110Issues 111 112 * Does point alpha modification affect the current color ? 113 114 No. 115 116 * Do we need a special function GetPointParameterfvARB, or get by 117 with GetFloat ? 118 119 GetFloat is sufficient. 120 121 * If alpha is 0, then we could toss the point before it reaches the 122 fragment stage. 123 124 No. This can be achieved with enabling the alpha test with 125 reference of 0 and function of LEQUAL. 126 127 * Do we need a disable for applying the threshold ? The default 128 threshold value is 1.0. It is applied even if the point size is 129 constant. 130 131 If the default threshold is not overridden, the area of 132 multisample points with provided constant size of less than 1.0, 133 is mapped to 1.0, while the alpha component is modulated 134 accordingly, to compensate for the larger area. For multisample 135 points this is not a problem, as there are no relevant 136 applications yet. As mentioned above, the threshold does not apply 137 to alias or antialias points. 138 139 The alternative is to have a disable of threshold application, and 140 state that threshold (if not disabled) applies to non antialias 141 points only (that is, alias and multisample points). 142 143 The behavior without an enable/disable looks fine. 144 145 * Future extensions (to the extension) 146 147 1. POINT_FADE_ALPHA_CLAMP_ARB 148 149 When the derived point size is larger than the threshold size 150 defined by the POINT_FADE_THRESHOLD_SIZE_ARB parameter, it might 151 be desired to clamp the computed alpha to a minimum value, in 152 order to keep the point visible. In this case the formula below 153 change: 154 155 factor = (derived_size/threshold)^2 156 157 factor clamp <= factor 158 clamped_value = 159 clamp factor < clamp 160 161 1.0 derived_size >= threshold 162 alpha *= 163 clamped_value Otherwise 164 165 where clamp is defined by the POINT_FADE_ALPHA_CLAMP_ARB new 166 parameter. 167 168New Procedures and Functions 169 170 void PointParameterfARB(enum pname, 171 float param); 172 void PointParameterfvARB(enum pname, 173 const float *params); 174 175New Tokens 176 177 Accepted by the <pname> parameter of PointParameterfARB, and the 178 <pname> of Get: 179 180 POINT_SIZE_MIN_ARB 181 POINT_SIZE_MAX_ARB 182 POINT_FADE_THRESHOLD_SIZE_ARB 183 184 Accepted by the <pname> parameter of PointParameterfvARB, and the 185 <pname> of Get: 186 187 POINT_SIZE_MIN_ARB 0x8126 188 POINT_SIZE_MAX_ARB 0x8127 189 POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 190 POINT_DISTANCE_ATTENUATION_ARB 0x8129 191 192Additions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation) 193 194 None 195 196Additions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization) 197 198 In section 3.3, the following is inserted after the description of 199 PointSize: 200 201 The point size is multiplied with a distance attenuation factor 202 and clamped as follows: 203 204 derived_size = Clamp(size * sqrt(dist_atten(dist))) 205 206 where dist_atten is specified as 207 208 1 209 dist_atten(d) = ------------------- 210 a + b * d + c * d^2 211 212 and 'd' is the eye-coordinate distance from the eye, (0, 0, 0, 1) in 213 eye coordinates, to the vertex. 214 215 The derived point size is clamped to a given range, and then 216 clamped to the implementation-dependent point size range. 217 218 If multisampling is enabled, an implementation may optionally fade 219 the point alpha (section 3.12) instead of allowing the size to go 220 below a given threshold. In this case, the diameter of the 221 rasterized point is 222 223 derived_size derived_size >= threshold 224 diameter = 225 threshold Otherwise 226 227 and the fade factor is computed as follows: 228 229 1 derived_size >= threshold 230 fade = 231 (derived_size/threshold)^2 Otherwise 232 233 The distance attenuation function coefficients, 'a', 'b', and 'c', 234 the bounds of the clamp, and the point fade 'threshold', are 235 specified with 236 237 void PointParameterfARB( enum pname, float param ); 238 void PointParameterfvARB( enum pname, const float *params ); 239 240 If <pname> is POINT_SIZE_MIN_ARB or POINT_SIZE_MAX_ARB, then 241 <param> specifies, or <params> points to the lower or upper bound 242 respectively on the derived point size. If the lower bound is 243 greater than the upper bound, the resulting point size is 244 undefined. If <pname> is POINT_DISTANCE_ATTENUATION_ARB, then 245 <params> points to the coefficients 'a', 'b', and 'c'. If <pname> 246 is POINT_FADE_THRESHOLD_SIZE_ARB, <param> specifies, or <params> 247 points to the point fade threshold. 248 249 This extension doesn't change the feedback or selection behavior of 250 points. 251 252 In section 3.11, the word "Finally" is removed from the first 253 sentence. 254 255 Add the following after section 3.11. 256 257 Section 3.12 Multisample Point Fade 258 259 If multisampling is enabled and the rasterized fragment results 260 from a point primitive, then the computed fade factor is applied 261 to the fragment. In RGBA mode, the fade factor is multiplied by 262 the fragment's alpha (A) value to yield a final alpha value. In 263 color index mode, the fade factor has no effect. 264 265Additions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment 266Operations and the Frame Buffer) 267 268 None 269 270Additions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions) 271 272 None 273 274Additions to Chapter 6 of the OpenGL 1.2.1 Specification (State and 275State Requests) 276 277 None 278 279Additions to Appendix A of the OpenGL 1.2.1 Specification (Invariance) 280 281 None 282 283Additions to the GLX / WGL / AGL Specifications 284 285 None 286 287GLX Protocol 288 289 Two new GL rendering commands are added. The following commands are 290 sent to the server as part of a glXRender request: 291 292 PointParameterfARB 293 2 8+4*n rendering command length 294 2 2065 rendering command opcode 295 4 ENUM pname 296 0x8126 n=1 POINT_SIZE_MIN_ARB 297 0x8127 n=1 POINT_SIZE_MAX_ARB 298 0x8128 n=1 POINT_FADE_THRESHOLD_SIZE_ARB 299 4 FLOAT32 param 300 301 PointParameterfvARB 302 2 8+4*n rendering command length 303 2 2066 rendering command opcode 304 4 ENUM pname 305 0x8126 n=1 POINT_SIZE_MIN_ARB 306 0x8127 n=1 POINT_SIZE_MAX_ARB 307 0x8128 n=1 POINT_FADE_THRESHOLD_SIZE_ARB 308 0x8129 n=3 POINT_DISTANCE_ATTENUATION_ARB 309 4*n LISTofFLOAT32 params 310 311Dependencies on ARB_multisample 312 313 If ARB_multisample is not implemented, then the references to 314 multisample points are invalid, and should be ignored. 315 316Errors 317 318 INVALID_ENUM is generated if PointParameterfARB parameter <pname> is 319 not POINT_SIZE_MIN_ARB, POINT_SIZE_MAX_ARB, or 320 POINT_FADE_THRESHOLD_SIZE_ARB. 321 322 INVALID_ENUM is generated if PointParameterfvARB parameter <pname> 323 is not POINT_SIZE_MIN_ARB, POINT_SIZE_MAX_ARB, 324 POINT_FADE_THRESHOLD_SIZE_ARB, or POINT_DISTANCE_ATTENUATION_ARB 325 326 INVALID_VALUE is generated when values are out of range according 327 to: 328 329 <pname> valid range 330 -------- ----------- 331 POINT_SIZE_MIN_ARB >= 0 332 POINT_SIZE_MAX_ARB >= 0 333 POINT_FADE_THRESHOLD_SIZE_ARB >= 0 334 335 336New State 337 338(table 6.11, p. 201) 339 Initial 340 Get Value Type Get Command Value Description Sec. Attribute 341 --------- ---- ----------- ------- ----------- ---- --------- 342 POINT_SIZE_MIN_ARB R+ GetFloatv 0.0 Attenuated 3.3 point 343 Min point 344 size 345 346 POINT_SIZE_MAX_ARB R+ GetFloatv M Attenuated 3.3 point 347 Max point 348 size 349 350 POINT_FADE_THRESHOLD_SIZE_ARB R+ GetFloatv 1.0 Threshold 3.3 point 351 for alpha 352 attenuation 353 354 POINT_DISTANCE_ATTENUATION_ARB 3xR GetFloatv (1.0,0.0,0.0) 3.3 point 355 Attenuation 356 coefficients 357 358 M is the larger of the max antialiased and non antialiased point 359 sizes. 360 361New Implementation Dependent State 362 363 None 364 365Revision History 366 367 11/09/1999 0.1 368 - First ARB draft based on the original SGI and EXT drafts. 369 370 12/07/1999 0.2 371 - clarified behavior when POINT_SIZE_MIN exceeds POINT_SIZE_MAX 372 - clarified when the point size is clamped to the supported range 373 - removed issues from "Errors" section 374 - fixed various typos 375 - Updated to new extension template 376 - added GLX protocol 377 378 04/20/2000 0.3 379 - rewritten to fit within the context of the 1.2 specification 380 - added language describing where the fade alpha is applied. 381 - added language which indicates that some implementations may not 382 implement POINT_FADE_THRESHOLD_SIZE_ARB 383 384 06/20/2000 0.4 385 - removed alternate behavior for fade alpha, since it is optional 386 - added new section describing fade alpha application 387 388 03/12/2002 0.5 389 - added GLX protocol for PointParameterfARB and assigned ropcodes 390 391 09/23/2010 0.6 (pbrown) 392 - add "const" qualifier to <params> argument to PointParameterfvARB 393