1Name 2 3 EXT_point_parameters 4 5Name Strings 6 7 GL_EXT_point_parameters 8 9Version 10 11 Revision Date: September 23, 2010 12 Version: 1.8 13 14Number 15 16 54 17 18Dependencies 19 20 SGIS_multisample affects the definition of this extension. 21 22Overview 23 24 This extension supports additional geometric characteristics of points. It 25 can be used to render particles or tiny light sources, commonly referred 26 as "Light points". 27 28 The raster brightness of a point is a function of the point area, point 29 color, point transparency, and the response of the display's electron gun 30 and phosphor. The point area and the point transparency are derived from the 31 point size, currently provided with the <size> parameter of glPointSize. 32 33 The primary motivation is to allow the size of a point to be affected by 34 distance attenuation. When distance attenuation has an effect, the final 35 point size decreases as the distance of the point from the eye increases. 36 37 The secondary motivation is a mean to control the mapping from the point 38 size to the raster point area and point transparency. This is done in order 39 to increase the dynamic range of the raster brightness of points. In other 40 words, the alpha component of a point may be decreased (and its transparency 41 increased) as its area shrinks below a defined threshold. 42 43 This extension defines a derived point size to be closely related to point 44 brightness. The brightness of a point is given by: 45 46 1 47 dist_atten(d) = ------------------- 48 a + b * d + c * d^2 49 50 brightness(Pe) = Brightness * dist_atten(|Pe|) 51 52 where 'Pe' is the point in eye coordinates, and 'Brightness' is some initial 53 value proportional to the square of the size provided with glPointSize. Here 54 we simplify the raster brightness to be a function of the rasterized point 55 area and point transparency. 56 57 brightness(Pe) brightness(Pe) >= Threshold_Area 58 area(Pe) = 59 Threshold_Area Otherwise 60 61 factor(Pe) = brightness(Pe)/Threshold_Area 62 63 alpha(Pe) = Alpha * factor(Pe) 64 65 where 'Alpha' comes with the point color (possibly modified by lighting). 66 67 'Threshold_Area' above is in area units. Thus, it is proportional to the 68 square of the threshold provided by the programmer through this extension. 69 70 The new point size derivation method applies to all points, while the 71 threshold applies to multisample points only. 72 73Issues 74 75 * Does point alpha modification affect the current color ? 76 77 No. 78 79 * Do we need a special function glGetPointParameterfvEXT, or get by with 80 glGetFloat ? 81 82 No. 83 84 * If alpha is 0, then we could toss the point before it reaches the 85 fragment stage. 86 87 No. This can be achieved with enabling the alpha test with reference of 88 0 and function of LEQUAL. 89 90 * Do we need a disable for applying the threshold ? The default threshold 91 value is 1.0. It is applied even if the point size is constant. 92 93 If the default threshold is not overriden, the area of multisample 94 points with provided constant size of less than 1.0, is mapped to 1.0, 95 while the alpha component is modulated accordingly, to compensate for 96 the larger area. For multisample points this is not a problem, as there 97 are no relevant applications yet. As mentioned above, the threshold does 98 not apply to alias or antialias points. 99 100 The alternative is to have a disable of threshold application, and state 101 that threshold (if not disabled) applies to non antialias points only 102 (that is, alias and multisample points). 103 104 The behavior without an enable/disable looks fine. 105 106 * Future extensions (to the extension) 107 108 1. GL_POINT_FADE_ALPHA_CLAMP_EXT 109 110 When the derived point size is larger than the threshold size defined by 111 the GL_POINT_FADE_THRESHOLD_SIZE_EXT parameter, it might be desired to 112 clamp the computed alpha to a minimum value, in order to keep the point 113 visible. In this case the formula below change: 114 115 factor = (derived_size/threshold)^2 116 117 factor clamp <= factor 118 clamped_value = 119 clamp factor < clamp 120 121 1.0 derived_size >= threshold 122 alpha *= 123 clamped_value Otherwise 124 125 where clamp is defined by the GL_POINT_FADE_ALPHA_CLAMP_EXT new parameter. 126 127New Procedures and Functions 128 129 void glPointParameterfEXT ( GLenum pname, GLfloat param ); 130 void glPointParameterfvEXT ( GLenum pname, const GLfloat *params ); 131 132New Tokens 133 134 Accepted by the <pname> parameter of glPointParameterfEXT, and the <pname> 135 of glGet: 136 137 GL_POINT_SIZE_MIN_EXT 138 GL_POINT_SIZE_MAX_EXT 139 GL_POINT_FADE_THRESHOLD_SIZE_EXT 140 141 Accepted by the <pname> parameter of glPointParameterfvEXT, and the <pname> 142 of glGet: 143 144 GL_POINT_SIZE_MIN_EXT 0x8126 145 GL_POINT_SIZE_MAX_EXT 0x8127 146 GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 147 GL_DISTANCE_ATTENUATION_EXT 0x8129 148 149Additions to Chapter 2 of the 1.0 Specification (OpenGL Operation) 150 151 None 152 153Additions to Chapter 3 of the 1.0 Specification (Rasterization) 154 155 All parameters of the glPointParameterfEXT and glPointParameterfvEXT 156 functions set various values applied to point rendering. The derived point 157 size is defined to be the <size> provided with glPointSize modulated with a 158 distance attenuation factor. 159 160 The parameters GL_POINT_SIZE_MIN_EXT and GL_POINT_SIZE_MAX_EXT simply 161 define an upper and lower bounds respectively on the derived point size. 162 163 The above parameters affect non multisample points as well as multisample 164 points, while the GL_POINT_FADE_THRESHOLD_SIZE_EXT parameter, has no effect 165 on non multisample points. If the derived point size is larger than 166 the threshold size defined by the GL_POINT_FADE_THRESHOLD_SIZE_EXT 167 parameter, the derived point size is used as the diameter of the rasterized 168 point, and the alpha component is intact. Otherwise, the threshold size is 169 set to be the diameter of the rasterized point, while the alpha component is 170 modulated accordingly, to compensate for the larger area. 171 172 The distance attenuation function coefficients, namely a, b, and c in: 173 174 1 175 dist_atten(d) = ------------------- 176 a + b * d + c * d^2 177 178 are defined by the <pname> parameter GL_DISTANCE_ATTENUATION_EXT of the 179 function glPointParameterfvEXT. By default a = 1, b = 0, and c = 0. 180 181 Let 'size' be the point size provided with glPointSize, let 'dist' be the 182 distance of the point from the eye, and let 'threshold' be the threshold size 183 defined by the GL_POINT_FADE_THRESHOLD_SIZE parameter of 184 glPointParameterfEXT. The derived point size is given by: 185 186 derived_size = size * sqrt(dist_atten(dist)) 187 188 Note that when default values are used, the above formula reduces to: 189 190 derived_size = size 191 192 the diameter of the rasterized point is given by: 193 194 derived_size derived_size >= threshold 195 diameter = 196 threshold Otherwise 197 198 The alpha of a point is calculated to allow the fading of points instead of 199 shrinking them past a defined threshold size. The alpha component of the 200 rasterized point is given by: 201 202 1 derived_size >= threshold 203 alpha *= 204 (derived_size/threshold)^2 Otherwise 205 206 The threshold defined by GL_POINT_FADE_THRESHOLD_SIZE_EXT is not clamped 207 to the minimum and maximum point sizes. 208 209 Points do not affect the current color. 210 211 This extension doesn't change the feedback or selection behavior of points. 212 213Additions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations 214and the Framebuffer) 215 216 None 217 218Additions to Chapter 5 of the 1.0 Specification (Special Functions) 219 220 None 221 222Additions to Chapter 6 of the 1.0 Specification (State and State Requests) 223 224 None 225 226Additions to the GLX Specification 227 228 None 229 230GLX Protocol 231 232 Two new GL rendering commands are added. The following commands are 233 sent to the server as part of a glXRender request: 234 235 PointParameterfEXT 236 2 8+4*n rendering command length 237 2 2065 rendering command opcode 238 4 ENUM pname 239 0x8126 n=1 POINT_SIZE_MIN_EXT 240 0x8127 n=1 POINT_SIZE_MAX_EXT 241 0x8128 n=1 POINT_FADE_THRESHOLD_SIZE_EXT 242 4 FLOAT32 param 243 244 PointParameterfvEXT 245 2 8+4*n rendering command length 246 2 2066 rendering command opcode 247 4 ENUM pname 248 0x8126 n=1 POINT_SIZE_MIN_EXT 249 0x8127 n=1 POINT_SIZE_MAX_EXT 250 0x8128 n=1 POINT_FADE_THRESHOLD_SIZE_EXT 251 0x8129 n=3 POINT_DISTANCE_ATTENUATION_EXT 252 4*n LISTofFLOAT32 params 253 254Dependencies on SGIS_multisample 255 256 If SGIS_multisample is not implemented, then the references to 257 multisample points are invalid, and should be ignored. 258 259Errors 260 261 INVALID_ENUM is generated if PointParameterfEXT parameter <pname> is not 262 GL_POINT_SIZE_MIN_EXT, GL_POINT_SIZE_MAX_EXT, or 263 GL_POINT_FADE_THRESHOLD_SIZE_EXT. 264 265 INVALID_ENUM is generated if PointParameterfvEXT parameter <pname> is 266 not GL_POINT_SIZE_MIN_EXT, GL_POINT_SIZE_MAX_EXT, 267 GL_POINT_FADE_THRESHOLD_SIZE_EXT, or GL_DISTANCE_ATTENUATION_EXT 268 269 INVALID_VALUE is generated when values are out of range according to: 270 271 <pname> valid range 272 -------- ----------- 273 GL_POINT_SIZE_MIN_EXT >= 0 274 GL_POINT_SIZE_MAX_EXT >= 0 275 GL_POINT_FADE_THRESHOLD_SIZE_EXT >= 0 276 277 Issues 278 ------ 279 - should we generate INVALID_VALUE or just clamp? 280 281New State 282 283 Get Value Get Command Type Initial Value Attribute 284 --------- ----------- ---- --------- --------- 285 GL_POINT_SIZE_MIN_EXT GetFloatv R 0 point 286 GL_POINT_SIZE_MAX_EXT GetFloatv R M point 287 GL_POINT_FADE_THRESHOLD_SIZE_EXT GetFloatv R 1 point 288 GL_DISTANCE_ATTENUATION_EXT GetFloatv 3xR (1,0,0) point 289 290 M is the largest available point size. 291 292New Implementation Dependent State 293 294 None 295 296Backwards Compatibility 297 298 This extension replaces SGIS_point_parameters. The procedures, tokens, 299 and name strings now refer to EXT instead of SGIS. Enumerant values are 300 unchanged. SGI implementations which previously provided this 301 functionality should support both forms of the extension. 302 303 EXT_point_parameters was promoted to ARB_point_parameters on June 304 20, 2000. The EXT version is now considered obsolete. 305 306Revision History 307 308 * 1.8 (September 23, 2010) pbrown - add "const" qualifier to <params> 309 argument to PointParameterfvARB. 310 311 * 1.7 (March 12, 2002) - added GLX protocol, reverse engineered from 312 SGI's GLX implementation. 313 314 * 1.6 (August 21, 1997) - promoted from SGIS to EXT. Made the 315 dependency on SGIS_multisample optional. 316