1Name 2 3 OES_point_sprite 4 5Name Strings 6 7 GL_OES_point_sprite 8 9Contact 10 11 Aaftab Munshi (amunshi@ati.com) 12 13Notice 14 15 Copyright (c) 2004-2013 The Khronos Group Inc. Copyright terms at 16 http://www.khronos.org/registry/speccopyright.html 17 18Status 19 20 Ratified by the Khronos BOP, Aug 5, 2004. 21 22IP Status 23 24 No known IP issues. 25 26Version 27 28 Last Modified Date: August 5, 2004 29 30Number 31 32 OpenGL ES Extension #15 33 34Dependencies 35 36 OpenGL ES 1.0 is required 37 38Overview 39 40 Applications such as particle systems have tended to use OpenGL quads 41 rather than points to render their geometry, since they would like 42 to use a custom-drawn texture for each particle, rather than the 43 traditional OpenGL round antialiased points, and each fragment in 44 a point has the same texture coordinates as every other fragment. 45 46 Unfortunately, specifying the geometry for these quads can be 47 expensive, since it quadruples the amount of geometry required, and 48 may also require the application to do extra processing to compute 49 the location of each vertex. 50 51 The purpose of this extension is to allow such applications to use 52 points rather than quads. When GL_POINT_SPRITE_OES is enabled, 53 the state of point antialiasing is ignored. For each texture unit, 54 the app can then specify whether to replace the existing texture 55 coordinates with point sprite texture coordinates, which are 56 interpolated across the point. 57 58Issues 59 60 The following are the list of issues as discussed in the 61 ARB_point_sprite extension. I've deleted issues that are not related 62 to OpenGL ES such as vertex shader programs etc. 63 64 Tokens that use _ARB names are modified to use _OES. 65 66 * Should this spec say that point sprites get converted into quads? 67 68 RESOLVED: No, this would make the spec much uglier, because then 69 we'd have to say that polygon smooth and stipple get turned off, 70 etc. Better to provide a formula for computing the texture 71 coordinates and leave them as points. 72 73 * How are point sprite texture coordinates computed? 74 75 RESOLVED: They move smoothly as the point moves around on the 76 screen, even though the pixels touched by the point do not. The 77 exact formula is given in the spec below. 78 79 A point sprite can be thought of as a quad whose upper-left corner has 80 (s,t) texture coordinates of (0,0) and whose lower-right corner has 81 texture coordinates of (1,1), as illustrated in the following figure. 82 In the figure "P" is the center of the point sprite, and "O" is the 83 origin (0,0) of the window coordinate system. Note that the y window 84 coordinate increases from bottom-to-top but the t texture coordinate 85 of point sprites increases from top-to-bottom. 86 87 ^ 88 +y| (0,0) 89 | +-----+ 90 | | | 91 | | P | 92 | | | 93 | +-----+ 94 | (1,1) 95 | +x 96 O---------------> 97 98 Applications using a single texture for both point sprites and other 99 geometry need to account for the fixed coordinate mapping of point 100 sprites. 101 102 * How do point sizes for point sprites work? 103 104 RESOLVED: This specification treats point sprite sizes like 105 antialiased point sizes, but with more leniency. Implementations 106 may choose to not clamp the point size to the antialiased point 107 size range. The set of point sprite sizes available must be 108 a superset of the antialiased point sizes. However, whereas 109 antialiased point sizes are all evenly spaced by the point size 110 granularity, point sprites can have an arbitrary set of sizes. 111 This lets implementations use, e.g., floating-point sizes. 112 113 * Should there be a way to query the list of supported point sprite 114 sizes? 115 116 RESOLVED: No. If an implementation were to use, say, a single- 117 precision IEEE float to represent point sizes, the list would be 118 rather long. 119 120 * Do mipmaps apply to point sprites? 121 122 RESOLVED: Yes. They are similar to quads in this respect. 123 124 * What of this extension's state is per-texture unit and what 125 of this extension's state is state is global? 126 127 RESOLVED: The GL_POINT_SPRITE_OES enable is global. The 128 COORD_REPLACE_OES state is per-texture unit (state set by TexEnv is 129 per-texture unit). 130 131 * Should there be a global on/off switch for point sprites, or 132 should the per-unit enable imply that switch? 133 134 RESOLVED: There is a global switch to turn it on and off. This 135 is probably more convenient for both driver and app, and it 136 simplifies the spec. 137 138 * What should the TexEnv mode for point sprites be called? 139 140 RESOLVED: COORD_REPLACE_OES. 141 142 * What is the interaction with multisample points, which are round? 143 144 RESOLVED: Point sprites are rasterized as squares, even in 145 multisample mode. Leaving them as round points would make the 146 feature useless. 147 148 * How does this extension interact with the point size attenuation 149 functionality in OES_point_parameters and OpenGL 1.4? 150 151 RESOLVED: Point sprites sizes are attenuated just like the sizes of 152 non-sprite points. 153 154 * How are point sprites clipped? 155 156 RESOLVED: Point sprites are transformed as points, and standard point 157 clipping operations are performed. This can cause point sprites that 158 move off the edge of the screen to disappear abruptly, in the same way 159 that regular points do. As with any other primitive, standard 160 per-fragment clipping operations (scissoring, window ownership test) 161 still apply. 162 163New Procedures and Functions 164 165 None 166 167New Tokens 168 169 Accepted by the <cap> parameter of Enable, Disable, and by the 170 <target> parameter of TexEnvf, TexEnvfv, TexEnvx, TexEnvxv: 171 172 POINT_SPRITE_OES 0x8861 173 174 When the <target> parameter of TexEnvf, TexEnvfv, TexEnvx, TexEnvxv, 175 is POINT_SPRITE_OES, then the value of <pname> may be: 176 177 COORD_REPLACE_OES 0x8862 178 179 When the <target> and <pname> parameters of TexEnvf, TexEnvfv, 180 TexEnvx, TexEnvxv, are POINT_SPRITE_OES and COORD_REPLACE_OES 181 respectively, then the value of <param> or the value pointed 182 to by <params> may be: 183 184 FALSE 185 TRUE 186 187 188Additions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation) 189 190 None. 191 192Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization) 193 194 Insert the following paragraphs after the second paragraph of section 195 3.3 (page 66): 196 197 "Point sprites are enabled or disabled by calling Enable or Disable 198 with the symbolic constant POINT_SPRITE_OES. The default state is for 199 point sprites to be disabled. When point sprites are enabled, the 200 state of the point antialiasing enable is ignored. 201 202 The point sprite texture coordinate replacement mode is set with one 203 of the commands 204 205 void TexEnv{ixf}(enum target, enum pname, T param) 206 void TexEnv{ixf}v(enum target, enum pname, const T *params) 207 208 where target is POINT_SPRITE_OES and pname is COORD_REPLACE_OES. The 209 possible values for param are FALSE and TRUE. The default value for 210 each texture unit is for point sprite texture coordinate replacement 211 to be disabled." 212 213 Replace the first two sentences of the second paragraph of section 214 3.3.1 (page 67) with the following: 215 216 "The effect of a point width other than 1.0 depends on the state of 217 point antialiasing and point sprites. If antialiasing and point 218 sprites are disabled, ..." 219 220 Replace the first sentences of the fourth paragraph of section 3.3.1 221 (page 68) with the following: 222 223 "If antialiasing is enabled and point sprites are disabled, ..." 224 225 Insert the following paragraphs at the end of section 3.3.1 (page 226 70): 227 228 "When point sprites are enabled, then point rasterization produces a 229 fragment for each framebuffer pixel whose center lies inside a square 230 centered at the point's (x_w, y_w), with side length equal to the 231 current point size. 232 233 All fragments produced in rasterizing a point sprite are assigned the 234 same associated data, which are those of the vertex corresponding to 235 the point, with texture coordinates s, t, and r replaced with s/q, 236 t/q, and r/q, respectively. If q is less than or equal to zero, the 237 results are undefined. However, for each texture unit where 238 COORD_REPLACE_OES is TRUE, these texture coordinates are replaced 239 with point sprite texture coordinates. The s coordinate varies 240 from 0 to 1 across the point horizontally left-to-right, while 241 the t coordinate varies from 0 to 1 vertically top-to-bottom. 242 The r and q coordinates are replaced with the constants 0 and 1, 243 respectively. 244 245 The following formula is used to evaluate the s and t coordinates: 246 247 s = 1/2 + (x_f + 1/2 - x_w) / size 248 t = 1/2 - (y_f + 1/2 - y_w) / size 249 250 where size is the point's size, x_f and y_f are the (integral) window 251 coordinates of the fragment, and x_w and y_w are the exact, unrounded 252 window coordinates of the vertex for the point. 253 254 The widths supported for point sprites must be a superset of those 255 supported for antialiased points. There is no requirement that these 256 widths must be equally spaced. If an unsupported width is requested, 257 the nearest supported width is used instead." 258 259 Replace the text of section 3.3.2 (page 70) with the following: 260 261 "The state required to control point rasterization consists of the 262 floating-point point width, three floating-point values specifying 263 the minimum and maximum point size and the point fade threshold size, 264 three floating-point values specifying the distance attenuation 265 coefficients, a bit indicating whether or not antialiasing is 266 enabled, a bit indicating whether or not point sprites are enabled, 267 and a bit for the point sprite texture coordinate replacement mode 268 for each texture unit." 269 270 Replace the text of section 3.3.3 (page 70) with the following: 271 272 "If MULTISAMPLE is enabled, and the value of SAMPLE_BUFFERS is one, 273 then points are rasterized using the following algorithm, regardless 274 of whether point antialiasing (POINT_SMOOTH) is enabled or disabled. 275 Point rasterization produces a fragment for each framebuffer pixel 276 with one or more sample points that intersect a region centered at 277 the point's (x_w, y_w). This region is a circle having diameter 278 equal to the current point width if POINT_SPRITE_OES is disabled, or 279 a square with side equal to the current point width if 280 POINT_SPRITE_OES is enabled. Coverage bits that correspond to sample 281 points that intersect the region are 1, other coverage bits are 0. 282 All data associated with each sample for the fragment are the data 283 associated with the point being rasterized, with the exception of 284 texture coordinates when POINT_SPRITE_OES is enabled; these texture 285 coordinates are computed as described in section 3.3. 286 287 Point size range and number of gradations are equivalent to those 288 supported for antialiased points when POINT_SPRITE_OES is disabled. 289 The set of point sizes supported is equivalent to those for point 290 sprites without multisample when POINT_SPRITE_OES is enabled." 291 292Additions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment 293Operations and the Frame Buffer) 294 295 None. 296 297Additions to Chapter 5 of the OpenGL 1.4 Specification (Special 298Functions) 299 300 None. 301 302Additions to Chapter 6 of the OpenGL 1.4 Specification (State and 303State Requests) 304 305 None. 306 307Errors 308 309 None. 310 311New State 312 313(table 6.12, p. 220) 314 315Get Value Type Get Command Initial Value Description 316--------- ---- ----------- ------------- ----------- 317POINT_SPRITE_OES B IsEnabled False point sprite enable 318 319(table 6.17, p. 225) 320 321Get Value Type Get Command Initial Value Description 322--------- ---- ----------- ------------- ----------- 323COORD_REPLACE_OES 2* x B GetTexEnviv False coordinate replacement 324 enable 325 326Revision History 327 328 329