15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_point_parameters 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_point_parameters 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciVersion 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Revision Date: September 23, 2010 125bd8deadSopenharmony_ci Version: 1.8 135bd8deadSopenharmony_ci 145bd8deadSopenharmony_ciNumber 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ci 54 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ciDependencies 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci SGIS_multisample affects the definition of this extension. 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ciOverview 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci This extension supports additional geometric characteristics of points. It 255bd8deadSopenharmony_ci can be used to render particles or tiny light sources, commonly referred 265bd8deadSopenharmony_ci as "Light points". 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ci The raster brightness of a point is a function of the point area, point 295bd8deadSopenharmony_ci color, point transparency, and the response of the display's electron gun 305bd8deadSopenharmony_ci and phosphor. The point area and the point transparency are derived from the 315bd8deadSopenharmony_ci point size, currently provided with the <size> parameter of glPointSize. 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ci The primary motivation is to allow the size of a point to be affected by 345bd8deadSopenharmony_ci distance attenuation. When distance attenuation has an effect, the final 355bd8deadSopenharmony_ci point size decreases as the distance of the point from the eye increases. 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci The secondary motivation is a mean to control the mapping from the point 385bd8deadSopenharmony_ci size to the raster point area and point transparency. This is done in order 395bd8deadSopenharmony_ci to increase the dynamic range of the raster brightness of points. In other 405bd8deadSopenharmony_ci words, the alpha component of a point may be decreased (and its transparency 415bd8deadSopenharmony_ci increased) as its area shrinks below a defined threshold. 425bd8deadSopenharmony_ci 435bd8deadSopenharmony_ci This extension defines a derived point size to be closely related to point 445bd8deadSopenharmony_ci brightness. The brightness of a point is given by: 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci 1 475bd8deadSopenharmony_ci dist_atten(d) = ------------------- 485bd8deadSopenharmony_ci a + b * d + c * d^2 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci brightness(Pe) = Brightness * dist_atten(|Pe|) 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci where 'Pe' is the point in eye coordinates, and 'Brightness' is some initial 535bd8deadSopenharmony_ci value proportional to the square of the size provided with glPointSize. Here 545bd8deadSopenharmony_ci we simplify the raster brightness to be a function of the rasterized point 555bd8deadSopenharmony_ci area and point transparency. 565bd8deadSopenharmony_ci 575bd8deadSopenharmony_ci brightness(Pe) brightness(Pe) >= Threshold_Area 585bd8deadSopenharmony_ci area(Pe) = 595bd8deadSopenharmony_ci Threshold_Area Otherwise 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci factor(Pe) = brightness(Pe)/Threshold_Area 625bd8deadSopenharmony_ci 635bd8deadSopenharmony_ci alpha(Pe) = Alpha * factor(Pe) 645bd8deadSopenharmony_ci 655bd8deadSopenharmony_ci where 'Alpha' comes with the point color (possibly modified by lighting). 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci 'Threshold_Area' above is in area units. Thus, it is proportional to the 685bd8deadSopenharmony_ci square of the threshold provided by the programmer through this extension. 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ci The new point size derivation method applies to all points, while the 715bd8deadSopenharmony_ci threshold applies to multisample points only. 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ciIssues 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ci * Does point alpha modification affect the current color ? 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci No. 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci * Do we need a special function glGetPointParameterfvEXT, or get by with 805bd8deadSopenharmony_ci glGetFloat ? 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ci No. 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci * If alpha is 0, then we could toss the point before it reaches the 855bd8deadSopenharmony_ci fragment stage. 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ci No. This can be achieved with enabling the alpha test with reference of 885bd8deadSopenharmony_ci 0 and function of LEQUAL. 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci * Do we need a disable for applying the threshold ? The default threshold 915bd8deadSopenharmony_ci value is 1.0. It is applied even if the point size is constant. 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci If the default threshold is not overriden, the area of multisample 945bd8deadSopenharmony_ci points with provided constant size of less than 1.0, is mapped to 1.0, 955bd8deadSopenharmony_ci while the alpha component is modulated accordingly, to compensate for 965bd8deadSopenharmony_ci the larger area. For multisample points this is not a problem, as there 975bd8deadSopenharmony_ci are no relevant applications yet. As mentioned above, the threshold does 985bd8deadSopenharmony_ci not apply to alias or antialias points. 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci The alternative is to have a disable of threshold application, and state 1015bd8deadSopenharmony_ci that threshold (if not disabled) applies to non antialias points only 1025bd8deadSopenharmony_ci (that is, alias and multisample points). 1035bd8deadSopenharmony_ci 1045bd8deadSopenharmony_ci The behavior without an enable/disable looks fine. 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci * Future extensions (to the extension) 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci 1. GL_POINT_FADE_ALPHA_CLAMP_EXT 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci When the derived point size is larger than the threshold size defined by 1115bd8deadSopenharmony_ci the GL_POINT_FADE_THRESHOLD_SIZE_EXT parameter, it might be desired to 1125bd8deadSopenharmony_ci clamp the computed alpha to a minimum value, in order to keep the point 1135bd8deadSopenharmony_ci visible. In this case the formula below change: 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci factor = (derived_size/threshold)^2 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci factor clamp <= factor 1185bd8deadSopenharmony_ci clamped_value = 1195bd8deadSopenharmony_ci clamp factor < clamp 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci 1.0 derived_size >= threshold 1225bd8deadSopenharmony_ci alpha *= 1235bd8deadSopenharmony_ci clamped_value Otherwise 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci where clamp is defined by the GL_POINT_FADE_ALPHA_CLAMP_EXT new parameter. 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ciNew Procedures and Functions 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci void glPointParameterfEXT ( GLenum pname, GLfloat param ); 1305bd8deadSopenharmony_ci void glPointParameterfvEXT ( GLenum pname, const GLfloat *params ); 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ciNew Tokens 1335bd8deadSopenharmony_ci 1345bd8deadSopenharmony_ci Accepted by the <pname> parameter of glPointParameterfEXT, and the <pname> 1355bd8deadSopenharmony_ci of glGet: 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci GL_POINT_SIZE_MIN_EXT 1385bd8deadSopenharmony_ci GL_POINT_SIZE_MAX_EXT 1395bd8deadSopenharmony_ci GL_POINT_FADE_THRESHOLD_SIZE_EXT 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci Accepted by the <pname> parameter of glPointParameterfvEXT, and the <pname> 1425bd8deadSopenharmony_ci of glGet: 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ci GL_POINT_SIZE_MIN_EXT 0x8126 1455bd8deadSopenharmony_ci GL_POINT_SIZE_MAX_EXT 0x8127 1465bd8deadSopenharmony_ci GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 1475bd8deadSopenharmony_ci GL_DISTANCE_ATTENUATION_EXT 0x8129 1485bd8deadSopenharmony_ci 1495bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.0 Specification (OpenGL Operation) 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ci None 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.0 Specification (Rasterization) 1545bd8deadSopenharmony_ci 1555bd8deadSopenharmony_ci All parameters of the glPointParameterfEXT and glPointParameterfvEXT 1565bd8deadSopenharmony_ci functions set various values applied to point rendering. The derived point 1575bd8deadSopenharmony_ci size is defined to be the <size> provided with glPointSize modulated with a 1585bd8deadSopenharmony_ci distance attenuation factor. 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci The parameters GL_POINT_SIZE_MIN_EXT and GL_POINT_SIZE_MAX_EXT simply 1615bd8deadSopenharmony_ci define an upper and lower bounds respectively on the derived point size. 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci The above parameters affect non multisample points as well as multisample 1645bd8deadSopenharmony_ci points, while the GL_POINT_FADE_THRESHOLD_SIZE_EXT parameter, has no effect 1655bd8deadSopenharmony_ci on non multisample points. If the derived point size is larger than 1665bd8deadSopenharmony_ci the threshold size defined by the GL_POINT_FADE_THRESHOLD_SIZE_EXT 1675bd8deadSopenharmony_ci parameter, the derived point size is used as the diameter of the rasterized 1685bd8deadSopenharmony_ci point, and the alpha component is intact. Otherwise, the threshold size is 1695bd8deadSopenharmony_ci set to be the diameter of the rasterized point, while the alpha component is 1705bd8deadSopenharmony_ci modulated accordingly, to compensate for the larger area. 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ci The distance attenuation function coefficients, namely a, b, and c in: 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci 1 1755bd8deadSopenharmony_ci dist_atten(d) = ------------------- 1765bd8deadSopenharmony_ci a + b * d + c * d^2 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci are defined by the <pname> parameter GL_DISTANCE_ATTENUATION_EXT of the 1795bd8deadSopenharmony_ci function glPointParameterfvEXT. By default a = 1, b = 0, and c = 0. 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ci Let 'size' be the point size provided with glPointSize, let 'dist' be the 1825bd8deadSopenharmony_ci distance of the point from the eye, and let 'threshold' be the threshold size 1835bd8deadSopenharmony_ci defined by the GL_POINT_FADE_THRESHOLD_SIZE parameter of 1845bd8deadSopenharmony_ci glPointParameterfEXT. The derived point size is given by: 1855bd8deadSopenharmony_ci 1865bd8deadSopenharmony_ci derived_size = size * sqrt(dist_atten(dist)) 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ci Note that when default values are used, the above formula reduces to: 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ci derived_size = size 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci the diameter of the rasterized point is given by: 1935bd8deadSopenharmony_ci 1945bd8deadSopenharmony_ci derived_size derived_size >= threshold 1955bd8deadSopenharmony_ci diameter = 1965bd8deadSopenharmony_ci threshold Otherwise 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ci The alpha of a point is calculated to allow the fading of points instead of 1995bd8deadSopenharmony_ci shrinking them past a defined threshold size. The alpha component of the 2005bd8deadSopenharmony_ci rasterized point is given by: 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ci 1 derived_size >= threshold 2035bd8deadSopenharmony_ci alpha *= 2045bd8deadSopenharmony_ci (derived_size/threshold)^2 Otherwise 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ci The threshold defined by GL_POINT_FADE_THRESHOLD_SIZE_EXT is not clamped 2075bd8deadSopenharmony_ci to the minimum and maximum point sizes. 2085bd8deadSopenharmony_ci 2095bd8deadSopenharmony_ci Points do not affect the current color. 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci This extension doesn't change the feedback or selection behavior of points. 2125bd8deadSopenharmony_ci 2135bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations 2145bd8deadSopenharmony_ciand the Framebuffer) 2155bd8deadSopenharmony_ci 2165bd8deadSopenharmony_ci None 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.0 Specification (Special Functions) 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci None 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.0 Specification (State and State Requests) 2235bd8deadSopenharmony_ci 2245bd8deadSopenharmony_ci None 2255bd8deadSopenharmony_ci 2265bd8deadSopenharmony_ciAdditions to the GLX Specification 2275bd8deadSopenharmony_ci 2285bd8deadSopenharmony_ci None 2295bd8deadSopenharmony_ci 2305bd8deadSopenharmony_ciGLX Protocol 2315bd8deadSopenharmony_ci 2325bd8deadSopenharmony_ci Two new GL rendering commands are added. The following commands are 2335bd8deadSopenharmony_ci sent to the server as part of a glXRender request: 2345bd8deadSopenharmony_ci 2355bd8deadSopenharmony_ci PointParameterfEXT 2365bd8deadSopenharmony_ci 2 8+4*n rendering command length 2375bd8deadSopenharmony_ci 2 2065 rendering command opcode 2385bd8deadSopenharmony_ci 4 ENUM pname 2395bd8deadSopenharmony_ci 0x8126 n=1 POINT_SIZE_MIN_EXT 2405bd8deadSopenharmony_ci 0x8127 n=1 POINT_SIZE_MAX_EXT 2415bd8deadSopenharmony_ci 0x8128 n=1 POINT_FADE_THRESHOLD_SIZE_EXT 2425bd8deadSopenharmony_ci 4 FLOAT32 param 2435bd8deadSopenharmony_ci 2445bd8deadSopenharmony_ci PointParameterfvEXT 2455bd8deadSopenharmony_ci 2 8+4*n rendering command length 2465bd8deadSopenharmony_ci 2 2066 rendering command opcode 2475bd8deadSopenharmony_ci 4 ENUM pname 2485bd8deadSopenharmony_ci 0x8126 n=1 POINT_SIZE_MIN_EXT 2495bd8deadSopenharmony_ci 0x8127 n=1 POINT_SIZE_MAX_EXT 2505bd8deadSopenharmony_ci 0x8128 n=1 POINT_FADE_THRESHOLD_SIZE_EXT 2515bd8deadSopenharmony_ci 0x8129 n=3 POINT_DISTANCE_ATTENUATION_EXT 2525bd8deadSopenharmony_ci 4*n LISTofFLOAT32 params 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ciDependencies on SGIS_multisample 2555bd8deadSopenharmony_ci 2565bd8deadSopenharmony_ci If SGIS_multisample is not implemented, then the references to 2575bd8deadSopenharmony_ci multisample points are invalid, and should be ignored. 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ciErrors 2605bd8deadSopenharmony_ci 2615bd8deadSopenharmony_ci INVALID_ENUM is generated if PointParameterfEXT parameter <pname> is not 2625bd8deadSopenharmony_ci GL_POINT_SIZE_MIN_EXT, GL_POINT_SIZE_MAX_EXT, or 2635bd8deadSopenharmony_ci GL_POINT_FADE_THRESHOLD_SIZE_EXT. 2645bd8deadSopenharmony_ci 2655bd8deadSopenharmony_ci INVALID_ENUM is generated if PointParameterfvEXT parameter <pname> is 2665bd8deadSopenharmony_ci not GL_POINT_SIZE_MIN_EXT, GL_POINT_SIZE_MAX_EXT, 2675bd8deadSopenharmony_ci GL_POINT_FADE_THRESHOLD_SIZE_EXT, or GL_DISTANCE_ATTENUATION_EXT 2685bd8deadSopenharmony_ci 2695bd8deadSopenharmony_ci INVALID_VALUE is generated when values are out of range according to: 2705bd8deadSopenharmony_ci 2715bd8deadSopenharmony_ci <pname> valid range 2725bd8deadSopenharmony_ci -------- ----------- 2735bd8deadSopenharmony_ci GL_POINT_SIZE_MIN_EXT >= 0 2745bd8deadSopenharmony_ci GL_POINT_SIZE_MAX_EXT >= 0 2755bd8deadSopenharmony_ci GL_POINT_FADE_THRESHOLD_SIZE_EXT >= 0 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ci Issues 2785bd8deadSopenharmony_ci ------ 2795bd8deadSopenharmony_ci - should we generate INVALID_VALUE or just clamp? 2805bd8deadSopenharmony_ci 2815bd8deadSopenharmony_ciNew State 2825bd8deadSopenharmony_ci 2835bd8deadSopenharmony_ci Get Value Get Command Type Initial Value Attribute 2845bd8deadSopenharmony_ci --------- ----------- ---- --------- --------- 2855bd8deadSopenharmony_ci GL_POINT_SIZE_MIN_EXT GetFloatv R 0 point 2865bd8deadSopenharmony_ci GL_POINT_SIZE_MAX_EXT GetFloatv R M point 2875bd8deadSopenharmony_ci GL_POINT_FADE_THRESHOLD_SIZE_EXT GetFloatv R 1 point 2885bd8deadSopenharmony_ci GL_DISTANCE_ATTENUATION_EXT GetFloatv 3xR (1,0,0) point 2895bd8deadSopenharmony_ci 2905bd8deadSopenharmony_ci M is the largest available point size. 2915bd8deadSopenharmony_ci 2925bd8deadSopenharmony_ciNew Implementation Dependent State 2935bd8deadSopenharmony_ci 2945bd8deadSopenharmony_ci None 2955bd8deadSopenharmony_ci 2965bd8deadSopenharmony_ciBackwards Compatibility 2975bd8deadSopenharmony_ci 2985bd8deadSopenharmony_ci This extension replaces SGIS_point_parameters. The procedures, tokens, 2995bd8deadSopenharmony_ci and name strings now refer to EXT instead of SGIS. Enumerant values are 3005bd8deadSopenharmony_ci unchanged. SGI implementations which previously provided this 3015bd8deadSopenharmony_ci functionality should support both forms of the extension. 3025bd8deadSopenharmony_ci 3035bd8deadSopenharmony_ci EXT_point_parameters was promoted to ARB_point_parameters on June 3045bd8deadSopenharmony_ci 20, 2000. The EXT version is now considered obsolete. 3055bd8deadSopenharmony_ci 3065bd8deadSopenharmony_ciRevision History 3075bd8deadSopenharmony_ci 3085bd8deadSopenharmony_ci * 1.8 (September 23, 2010) pbrown - add "const" qualifier to <params> 3095bd8deadSopenharmony_ci argument to PointParameterfvARB. 3105bd8deadSopenharmony_ci 3115bd8deadSopenharmony_ci * 1.7 (March 12, 2002) - added GLX protocol, reverse engineered from 3125bd8deadSopenharmony_ci SGI's GLX implementation. 3135bd8deadSopenharmony_ci 3145bd8deadSopenharmony_ci * 1.6 (August 21, 1997) - promoted from SGIS to EXT. Made the 3155bd8deadSopenharmony_ci dependency on SGIS_multisample optional. 316