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