15bd8deadSopenharmony_ci 25bd8deadSopenharmony_ciName 35bd8deadSopenharmony_ci 45bd8deadSopenharmony_ci SGIX_sprite 55bd8deadSopenharmony_ci 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ciName Strings 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ci GL_SGIX_sprite 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ciVersion 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ci $Date: 1996/04/09 22:54:47 $ $Revision: 1.11 $ 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ciNumber 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ci 52 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ciDependencies 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ci None 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ciOverview 245bd8deadSopenharmony_ci 255bd8deadSopenharmony_ci This extension provides support for viewpoint dependent alignment 265bd8deadSopenharmony_ci of geometry, in particular geometry that rotates about a point or 275bd8deadSopenharmony_ci a specified axis to face the eye point. The primary use is for 285bd8deadSopenharmony_ci quickly rendering roughly cylindrically or spherically symmetric 295bd8deadSopenharmony_ci objects, e.g. trees, smoke, clouds, etc. using geometry textured 305bd8deadSopenharmony_ci with a partially transparent texture map. 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ci Rendering sprite geometry requires applying a transformation to 335bd8deadSopenharmony_ci primitives before the current model view. This matrix includes a 345bd8deadSopenharmony_ci rotation which is computed based on the current model view matrix 355bd8deadSopenharmony_ci and a translation which is specified explicitly 365bd8deadSopenharmony_ci (SPRITE_TRANSLATION_SGIX). The current model view matrix itself 375bd8deadSopenharmony_ci is not modified. 385bd8deadSopenharmony_ci 395bd8deadSopenharmony_ci Primitives are first transformed by a rotation, depending on the 405bd8deadSopenharmony_ci sprite mode: 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci SPRITE_AXIAL_SGIX: The front of the object is rotated about 435bd8deadSopenharmony_ci an axis so that it faces the eye as much as the axis 445bd8deadSopenharmony_ci constraint allows. This is used for roughly rendering cylindrical 455bd8deadSopenharmony_ci objects such as trees in visual simulation. 465bd8deadSopenharmony_ci 475bd8deadSopenharmony_ci SPRITE_OBJECT_ALIGNED_SGIX: The front of the object is 485bd8deadSopenharmony_ci rotated about a point to face the eye with the remaining 495bd8deadSopenharmony_ci rotational degree of freedom specified by aligning the top 505bd8deadSopenharmony_ci of the object with a specified axis in object coordinates. 515bd8deadSopenharmony_ci This is used for spherical objects and special effects such 525bd8deadSopenharmony_ci as smoke which must maintain an alignment in object 535bd8deadSopenharmony_ci coordinates for realism. 545bd8deadSopenharmony_ci 555bd8deadSopenharmony_ci SPRITE_EYE_ALIGNED_SGIX: The front of the object is rotated 565bd8deadSopenharmony_ci about a point to face the eye with the remaining rotational 575bd8deadSopenharmony_ci degree of freedom specified by aligning the top of the object 585bd8deadSopenharmony_ci with a specified axis in eye coordinates. This is used for 595bd8deadSopenharmony_ci rendering sprites which must maintain an alignment on the 605bd8deadSopenharmony_ci screen, such as 3D annotations. 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci The axis of rotation or alignment, SPRITE_AXIS_SGIX, can be 635bd8deadSopenharmony_ci an arbitrary direction to support geocentric coordinate frames 645bd8deadSopenharmony_ci in which "up" is not along X, Y or Z. 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci Sprite geometry is modeled in a canonical frame: +Z is the up 675bd8deadSopenharmony_ci vector. -Y is the front vector which is rotated to point towards 685bd8deadSopenharmony_ci the eye. In the discussion below, the eye vector is the vector to 695bd8deadSopenharmony_ci the eye from the origin of the model view frame translated by the 705bd8deadSopenharmony_ci sprite position. 715bd8deadSopenharmony_ci 725bd8deadSopenharmony_ciNew Procedures and Functions 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci void SpriteParameteriSGIX(enum pname, int param); 755bd8deadSopenharmony_ci void SpriteParameterfSGIX(enum pname, float param); 765bd8deadSopenharmony_ci void SpriteParameterivSGIX(enum pname, int* params); 775bd8deadSopenharmony_ci void SpriteParameterfvSGIX(enum pname, float* params); 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ciIssues 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci * Should the canonical modeling frame of the geometry be specifiable? 825bd8deadSopenharmony_ci - requires API for "up" and "front" vectors; additional math 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci * Should sprites for annotation be clip or eye aligned? Clip 855bd8deadSopenharmony_ci alignment is a nearly trivial extension of object aligned. 865bd8deadSopenharmony_ci However, once the projection matrix assumes rotation things 875bd8deadSopenharmony_ci are unpredictable and we should avoid this complexity. 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ciNew Tokens 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, 925bd8deadSopenharmony_ci and by the <pname> parameter of GetBooleanv, GetIntegerv, 935bd8deadSopenharmony_ci GetFloatv, and GetDoublev: 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ci SPRITE_SGIX 965bd8deadSopenharmony_ci 975bd8deadSopenharmony_ci Accepted by the <pname> parameter of SpriteParameteriSGIX, and 985bd8deadSopenharmony_ci SpriteParameterfSGIX: 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci SPRITE_MODE_SGIX 1015bd8deadSopenharmony_ci 1025bd8deadSopenharmony_ci Accepted by the <pname> parameter of SpriteParameterivSGIX, and 1035bd8deadSopenharmony_ci SpriteParameterfvSGIX, and by the <pname> parameter of GetBooleanv, 1045bd8deadSopenharmony_ci GetIntegerv, GetFloatv, and GetDoublev: 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci SPRITE_MODE_SGIX 1075bd8deadSopenharmony_ci SPRITE_AXIS_SGIX 1085bd8deadSopenharmony_ci SPRITE_TRANSLATION_SGIX 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci Accepted by the <param> parameter of SpriteParameteriSGIX and 1115bd8deadSopenharmony_ci and SpriteParameterfSGIX, and by the <params> parameter of 1125bd8deadSopenharmony_ci SpriteParameterivSGIX and SpriteParameterfvSGIX, when the 1135bd8deadSopenharmony_ci <pname> parameter is SPRITE_MODE_SGIX: 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci SPRITE_AXIAL_SGIX 1165bd8deadSopenharmony_ci SPRITE_OBJECT_ALIGNED_SGIX 1175bd8deadSopenharmony_ci SPRITE_EYE_ALIGNED_SGIX 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.0 Specification (OpenGL Operation) 1205bd8deadSopenharmony_ci 1215bd8deadSopenharmony_ci SPRITE_SGIX is enabled and disabled using Enable and Disable with 1225bd8deadSopenharmony_ci target equal to SPRITE_SGIX. When SPRITE_SGIX is enabled, the 1235bd8deadSopenharmony_ci current sprite mode, axis, translation and the ModelView matrix 1245bd8deadSopenharmony_ci are used to generate a sprite transformation which is applied to 1255bd8deadSopenharmony_ci subsequent primitives before applying the current model view matrix. 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ci When the sprite mode is SPRITE_AXIAL_SGIX, the sprite transformation 1285bd8deadSopenharmony_ci is arranged such that, after sprite and ModelView transformation, 1295bd8deadSopenharmony_ci the front vector is pointing as nearly towards the origin of the 1305bd8deadSopenharmony_ci eye coordinate system as possible. 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ci Each primitive is first rotated so that the sprite up vector aligns 1335bd8deadSopenharmony_ci with the sprite axis which is specified in the current model view 1345bd8deadSopenharmony_ci frame. Then the primitive is rotated about the axis so its 1355bd8deadSopenharmony_ci front vector is parallel with the projection of the eye vector 1365bd8deadSopenharmony_ci into the plane perpendicular to the rotation axis. Then the 1375bd8deadSopenharmony_ci primitive is translated by the specified translation. 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ci There are four unique matrices involved in computing the transformation 1405bd8deadSopenharmony_ci required for sprite geometry: 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci M - model-view matrix 1435bd8deadSopenharmony_ci T - sprite translation matrix 1445bd8deadSopenharmony_ci A - sprite axis rotation matrix 1455bd8deadSopenharmony_ci R - sprite up vector/axis alignment rotation matrix 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ci Note that in SPRITE_AXIAL_SGIX mode, the R matrix is a function of M, 1485bd8deadSopenharmony_ci T and A since the eye vector is derived from the inverse transpose matrix 1495bd8deadSopenharmony_ci of the compound (M * T * A). In both the SPRITE_OBJECT_ALIGNED_SGIX and 1505bd8deadSopenharmony_ci the SPRITE_EYE_ALIGNED_SGIX modes, the eye vector is extracted from the 1515bd8deadSopenharmony_ci inverse transpose of the compound (M * T). 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ci Given the coordinates of SPRITE_TRANSLATION_SGIX the sprite translation 1545bd8deadSopenharmony_ci matrix (T) is constructed. Both A and R are rotation matrices generated 1555bd8deadSopenharmony_ci by computing an angle of rotation and the sprite axis (computing sine and 1565bd8deadSopenharmony_ci cosine of the rotation angle suffices for computing a rotation matrix). 1575bd8deadSopenharmony_ci The computation of the matrices (T, A, R) are given in Chapter 2.9 of 1585bd8deadSopenharmony_ci the 1.0 OpenGL Specification (Matrices). 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci The angle and axis of rotation parameters for generating rotation matrix 1615bd8deadSopenharmony_ci A are computed as follows: 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci cosTheta = (V0 (dot) V1); 1645bd8deadSopenharmony_ci rotAxis = (V0 (cross) V1); 1655bd8deadSopenharmony_ci sinTheta = |rotAxis|; 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci V0 is the canonical up vector. V1 is the sprite axis (SPRITE_AXIS_SGIX) 1685bd8deadSopenharmony_ci when in SPRITE_AXIAL_SGIX mode. In either the SPRITE_OBJECT_ALIGNED_SGIX 1695bd8deadSopenharmony_ci and the SPRITE_EYE_ALIGNED_SGIX modes V1 is the sprite axis aligned by 1705bd8deadSopenharmony_ci removing its component along the eye vector. The computation of V1 in 1715bd8deadSopenharmony_ci the latter cases is as follows: 1725bd8deadSopenharmony_ci 1735bd8deadSopenharmony_ci scalar = Eye (dot) spriteAxis; 1745bd8deadSopenharmony_ci alignedSpriteAxis = spriteAxis - (scalar * Eye); 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ci The rotation axis for computing the R matrix is the canonical up 1775bd8deadSopenharmony_ci vector. The angle of rotation is computed as follows: 1785bd8deadSopenharmony_ci 1795bd8deadSopenharmony_ci cosTheta = (Eye (dot) canonicalFront); 1805bd8deadSopenharmony_ci sinTheta = (Eye (dot) canonicalRight); 1815bd8deadSopenharmony_ci 1825bd8deadSopenharmony_ci Sprite primitive geometry is transformed from object coordinates 1835bd8deadSopenharmony_ci to eye coordinates by the following compound matrix (MM): 1845bd8deadSopenharmony_ci 1855bd8deadSopenharmony_ci MM = M * T * A * R 1865bd8deadSopenharmony_ci 1875bd8deadSopenharmony_ci Sprite geometry is not limited to vertex based primitives and evaluators 1885bd8deadSopenharmony_ci may apply as well. 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ci Normals associated with sprite geometry are transformed by the inverse 1915bd8deadSopenharmony_ci transpose of the compound matrix (MM). In general, the user would not 1925bd8deadSopenharmony_ci want clip planes to be transformed by the compound matrix. In a similar 1935bd8deadSopenharmony_ci manner, raster position and texture coordinates (for certain texgen 1945bd8deadSopenharmony_ci modes). The user should be warrant that once glClipPlanes, glTexGen or 1955bd8deadSopenharmony_ci glRasterPos are called within a glEnable/Disable (SPRITE_SGIX) delimitors, 1965bd8deadSopenharmony_ci the associated geometry will be transformed by the compound matrix (MM). 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ci When the sprite mode is SPRITE_OBJECT_ALIGN or SPRITE_EYE_ALIGN, 1995bd8deadSopenharmony_ci the sprite transformation rotates the front vector towards the eye 2005bd8deadSopenharmony_ci while keeping the up vector as aligned as possible with the 2015bd8deadSopenharmony_ci current sprite axis, i.e. the up vector is rotated to be parallel 2025bd8deadSopenharmony_ci to the projection of the current sprite axis into the plane 2035bd8deadSopenharmony_ci perpendicular to the front vector. Depending on the current 2045bd8deadSopenharmony_ci sprite mode, the sprite axis is taken to be expressed in object 2055bd8deadSopenharmony_ci (SPRITE_OBJECT_ALIGNED_SGIX) or transformed into eye 2065bd8deadSopenharmony_ci (SPRITE_EYE_ALIGNED_SGIX) coordinates. The transformation into 2075bd8deadSopenharmony_ci eye space uses the compound (M * T). 2085bd8deadSopenharmony_ci 2095bd8deadSopenharmony_ci Regardless of the sprite transformation mode, the projection matrix 2105bd8deadSopenharmony_ci obviously assumes no rotation elements. This is again to warrant the 2115bd8deadSopenharmony_ci user against overriding the sprite transformation. 2125bd8deadSopenharmony_ci 2135bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.0 Specification (Rasterization) 2145bd8deadSopenharmony_ci 2155bd8deadSopenharmony_ci None 2165bd8deadSopenharmony_ci 2175bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations 2185bd8deadSopenharmony_ciand the Frame Buffer) 2195bd8deadSopenharmony_ci 2205bd8deadSopenharmony_ci None 2215bd8deadSopenharmony_ci 2225bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.0 Specification (Special Functions) 2235bd8deadSopenharmony_ci 2245bd8deadSopenharmony_ci None 2255bd8deadSopenharmony_ci 2265bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.0 Specification (State and State Requests) 2275bd8deadSopenharmony_ci 2285bd8deadSopenharmony_ci None 2295bd8deadSopenharmony_ci 2305bd8deadSopenharmony_ciAdditions to the GLX Specification 2315bd8deadSopenharmony_ci 2325bd8deadSopenharmony_ci None 2335bd8deadSopenharmony_ci 2345bd8deadSopenharmony_ciDependencies on SGI_extension_name 2355bd8deadSopenharmony_ci 2365bd8deadSopenharmony_ci None 2375bd8deadSopenharmony_ci 2385bd8deadSopenharmony_ciErrors 2395bd8deadSopenharmony_ci 2405bd8deadSopenharmony_ci INVALID_ENUM is generated if SpriteParameteriSGIX or SpriteParameterfSGIX 2415bd8deadSopenharmony_ci parameter <pname> is not SPRITE_MODE_SGIX. 2425bd8deadSopenharmony_ci 2435bd8deadSopenharmony_ci INVALID_ENUM is generated if SpriteParameterivSGIX or SpriteParameterfvSGIX 2445bd8deadSopenharmony_ci parameter <pname> is not SPRITE_AXIS_SGIX or SPRITE_TRANSLATION_SGIX. 2455bd8deadSopenharmony_ci 2465bd8deadSopenharmony_ci INVALID_ENUM is generated if SpriteParameteriSGIX or SpriteParameterfSGIX 2475bd8deadSopenharmony_ci parameter <pname> is SPRITE_MODE_SGIX, and parameter <param> is not 2485bd8deadSopenharmony_ci SPRITE_AXIAL_SGIX, SPRITE_OBJECT_ALIGNED_SGIX, or SPRITE_EYE_ALIGNED_SGIX. 2495bd8deadSopenharmony_ci 2505bd8deadSopenharmony_ci INVALID_OPERATION is generated if glSpriteParameterSGIX is executed 2515bd8deadSopenharmony_ci between the execution of glBegin and the corresponding execution of 2525bd8deadSopenharmony_ci glEnd. 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ciNew State 2555bd8deadSopenharmony_ci 2565bd8deadSopenharmony_ci Initial 2575bd8deadSopenharmony_ci Get Value Get Command Type Value Attrib 2585bd8deadSopenharmony_ci --------- ----------- ---- ------- ------ 2595bd8deadSopenharmony_ci SPRITE_SGIX IsEnabled B FALSE transform/enable 2605bd8deadSopenharmony_ci SPRITE_MODE_SGIX GetIntegerv I SPRITE_AXIAL_SGIX transform 2615bd8deadSopenharmony_ci SPRITE_AXIS_SGIX GetFloatv V (0,0,1) transform 2625bd8deadSopenharmony_ci SPRITE_TRANSLATION_SGIX GetFloatv V (0,0,0) transform 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ciNew Implementation Dependent State 2655bd8deadSopenharmony_ci 2665bd8deadSopenharmony_ci None 2675bd8deadSopenharmony_ci 268