Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd"> | |
4 | <refentry id="glPointSize"> | |
5 | <refmeta> | |
6 | <refmetainfo> | |
7 | <copyright> | |
8 | <year>1991-2006</year> | |
9 | <holder>Silicon Graphics, Inc.</holder> | |
10 | </copyright> | |
11 | </refmetainfo> | |
12 | <refentrytitle>glPointSize</refentrytitle> | |
13 | <manvolnum>3G</manvolnum> | |
14 | </refmeta> | |
15 | <refnamediv> | |
16 | <refname>glPointSize</refname> | |
17 | <refpurpose>specify the diameter of rasterized points</refpurpose> | |
18 | </refnamediv> | |
19 | <refsynopsisdiv><title>C Specification</title> | |
20 | <funcsynopsis> | |
21 | <funcprototype> | |
22 | <funcdef>void <function>glPointSize</function></funcdef> | |
23 | <paramdef>GLfloat <parameter>size</parameter></paramdef> | |
24 | </funcprototype> | |
25 | </funcsynopsis> | |
26 | </refsynopsisdiv> | |
27 | <!-- eqn: ignoring delim $$ --> | |
28 | <refsect1 id="parameters"><title>Parameters</title> | |
29 | <variablelist> | |
30 | <varlistentry> | |
31 | <term><parameter>size</parameter></term> | |
32 | <listitem> | |
33 | <para> | |
34 | Specifies the diameter of rasterized points. | |
35 | The initial value is 1. | |
36 | </para> | |
37 | </listitem> | |
38 | </varlistentry> | |
39 | </variablelist> | |
40 | </refsect1> | |
41 | <refsect1 id="description"><title>Description</title> | |
42 | <para> | |
43 | <function>glPointSize</function> specifies the rasterized diameter of both aliased and antialiased | |
44 | points. Using a point size other than 1 has different effects, depending | |
45 | on whether point antialiasing is enabled. To enable and disable point | |
46 | antialiasing, call <citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry> and <citerefentry><refentrytitle>glDisable</refentrytitle></citerefentry> with argument | |
47 | <constant>GL_POINT_SMOOTH</constant>. Point antialiasing is initially disabled. | |
48 | </para> | |
49 | <para> | |
50 | The specified point size is multiplied with a distance attenuation factor | |
51 | and clamped to the specified point size range, and further clamped to the | |
52 | implementation-dependent point size range to produce the derived point size | |
53 | using | |
54 | </para> | |
55 | <para> | |
56 | <informalequation><mml:math> | |
57 | <!-- eqn: pointSize = clamp left ( size * sqrt { left ( 1 over {a + b * d + c * {d sup 2}} right ) } right ):--> | |
58 | <mml:mrow> | |
59 | <mml:mi mathvariant="italic">pointSize</mml:mi> | |
60 | <mml:mo>=</mml:mo> | |
61 | <mml:mrow> | |
62 | <mml:mi mathvariant="italic">clamp</mml:mi> | |
63 | <mml:mo>⁢</mml:mo> | |
64 | <mml:mfenced open="(" close=")"> | |
65 | <mml:mrow> | |
66 | <mml:mi mathvariant="italic">size</mml:mi> | |
67 | <mml:mo>×</mml:mo> | |
68 | <mml:msqrt> | |
69 | <mml:mfenced open="" close=""> | |
70 | <mml:mfenced open="(" close=")"> | |
71 | <mml:mfrac> | |
72 | <mml:mn>1</mml:mn> | |
73 | <mml:mfenced open="" close=""> | |
74 | <mml:mrow> | |
75 | <mml:mi mathvariant="italic">a</mml:mi> | |
76 | <mml:mo>+</mml:mo> | |
77 | <mml:mrow> | |
78 | <mml:mi mathvariant="italic">b</mml:mi> | |
79 | <mml:mo>×</mml:mo> | |
80 | <mml:mi mathvariant="italic">d</mml:mi> | |
81 | </mml:mrow> | |
82 | <mml:mo>+</mml:mo> | |
83 | <mml:mrow> | |
84 | <mml:mi mathvariant="italic">c</mml:mi> | |
85 | <mml:mo>×</mml:mo> | |
86 | <mml:mfenced open="" close=""> | |
87 | <mml:msup><mml:mi mathvariant="italic">d</mml:mi> | |
88 | <mml:mn>2</mml:mn> | |
89 | </mml:msup> | |
90 | </mml:mfenced> | |
91 | </mml:mrow> | |
92 | </mml:mrow> | |
93 | </mml:mfenced> | |
94 | </mml:mfrac> | |
95 | </mml:mfenced> | |
96 | </mml:mfenced> | |
97 | </mml:msqrt> | |
98 | </mml:mrow> | |
99 | </mml:mfenced> | |
100 | </mml:mrow> | |
101 | </mml:mrow> | |
102 | </mml:math></informalequation> | |
103 | </para> | |
104 | <para> | |
105 | where | |
106 | <inlineequation><mml:math><mml:mi mathvariant="italic">d</mml:mi></mml:math></inlineequation> | |
107 | is the eye-coordinate distance from the eye to the vertex, and | |
108 | <inlineequation><mml:math><mml:mi mathvariant="italic">a</mml:mi></mml:math></inlineequation>, | |
109 | <inlineequation><mml:math><mml:mi mathvariant="italic">b</mml:mi></mml:math></inlineequation>, | |
110 | and | |
111 | <inlineequation><mml:math><mml:mi mathvariant="italic">c</mml:mi></mml:math></inlineequation> | |
112 | are the distance attenuation coefficients (see | |
113 | <citerefentry><refentrytitle>glPointParameter</refentrytitle></citerefentry>). | |
114 | </para> | |
115 | <para> | |
116 | If multisampling is disabled, the computed point size is used as the | |
117 | point's width. | |
118 | </para> | |
119 | <para> | |
120 | If multisampling is enabled, the point may be faded by modifying the point | |
121 | alpha value (see <citerefentry><refentrytitle>glSampleCoverage</refentrytitle></citerefentry>) instead of allowing the point width | |
122 | to go below a given threshold (see <citerefentry><refentrytitle>glPointParameter</refentrytitle></citerefentry>). In this case, | |
123 | the width is further modified in the following manner: | |
124 | </para> | |
125 | <para> | |
126 | <informalequation><mml:math> | |
127 | <!-- eqn: pointWidth = left { lpile { pointSize above threshold } lpile { pointSize >= threshold above otherwise }:--> | |
128 | <mml:mrow> | |
129 | <mml:mi mathvariant="italic">pointWidth</mml:mi> | |
130 | <mml:mo>=</mml:mo> | |
131 | <mml:mfenced open="{" close=""> | |
132 | <mml:mrow> | |
133 | <mml:mtable> | |
134 | <mml:mtr><mml:mtd> | |
135 | <mml:mi mathvariant="italic">pointSize</mml:mi> | |
136 | </mml:mtd></mml:mtr> | |
137 | <mml:mtr><mml:mtd> | |
138 | <mml:mi mathvariant="italic">threshold</mml:mi> | |
139 | </mml:mtd></mml:mtr> | |
140 | </mml:mtable> | |
141 | <mml:mo>⁢</mml:mo> | |
142 | <mml:mtable> | |
143 | <mml:mtr><mml:mtd> | |
144 | <mml:mrow> | |
145 | <mml:mi mathvariant="italic">pointSize</mml:mi> | |
146 | <mml:mo>>=</mml:mo> | |
147 | <mml:mi mathvariant="italic">threshold</mml:mi> | |
148 | </mml:mrow> | |
149 | </mml:mtd></mml:mtr> | |
150 | <mml:mtr><mml:mtd> | |
151 | <mml:mi mathvariant="italic">otherwise</mml:mi> | |
152 | </mml:mtd></mml:mtr> | |
153 | </mml:mtable> | |
154 | </mml:mrow> | |
155 | </mml:mfenced> | |
156 | </mml:mrow> | |
157 | </mml:math></informalequation> | |
158 | </para> | |
159 | <para> | |
160 | The point alpha value is modified by computing: | |
161 | </para> | |
162 | <para> | |
163 | <informalequation><mml:math> | |
164 | <!-- eqn: pointAlpha = left { lpile { 1 above left ( pointSize over threshold right ) sup 2 } lpile { pointSize >= threshold above otherwise }:--> | |
165 | <mml:mrow> | |
166 | <mml:mi mathvariant="italic">pointAlpha</mml:mi> | |
167 | <mml:mo>=</mml:mo> | |
168 | <mml:mfenced open="{" close=""> | |
169 | <mml:mrow> | |
170 | <mml:mtable> | |
171 | <mml:mtr><mml:mtd> | |
172 | <mml:mn>1</mml:mn> | |
173 | </mml:mtd></mml:mtr> | |
174 | <mml:mtr><mml:mtd> | |
175 | <mml:msup><mml:mfenced open="(" close=")"> | |
176 | <mml:mfrac> | |
177 | <mml:mi mathvariant="italic">pointSize</mml:mi> | |
178 | <mml:mi mathvariant="italic">threshold</mml:mi> | |
179 | </mml:mfrac> | |
180 | </mml:mfenced> | |
181 | <mml:mn>2</mml:mn> | |
182 | </mml:msup> | |
183 | </mml:mtd></mml:mtr> | |
184 | </mml:mtable> | |
185 | <mml:mo>⁢</mml:mo> | |
186 | <mml:mtable> | |
187 | <mml:mtr><mml:mtd> | |
188 | <mml:mrow> | |
189 | <mml:mi mathvariant="italic">pointSize</mml:mi> | |
190 | <mml:mo>>=</mml:mo> | |
191 | <mml:mi mathvariant="italic">threshold</mml:mi> | |
192 | </mml:mrow> | |
193 | </mml:mtd></mml:mtr> | |
194 | <mml:mtr><mml:mtd> | |
195 | <mml:mi mathvariant="italic">otherwise</mml:mi> | |
196 | </mml:mtd></mml:mtr> | |
197 | </mml:mtable> | |
198 | </mml:mrow> | |
199 | </mml:mfenced> | |
200 | </mml:mrow> | |
201 | </mml:math></informalequation> | |
202 | </para> | |
203 | <para> | |
204 | If point antialiasing is disabled, the actual size is determined by | |
205 | rounding the supplied size to the nearest integer. (If the rounding | |
206 | results in the value 0, it is as if the point size were 1.) If the rounded | |
207 | size is odd, then the center point | |
208 | (<inlineequation><mml:math> | |
209 | <!-- eqn: x:--> | |
210 | <mml:mi mathvariant="italic">x</mml:mi> | |
211 | </mml:math></inlineequation>, | |
212 | <inlineequation><mml:math> | |
213 | <!-- eqn: y:--> | |
214 | <mml:mi mathvariant="italic">y</mml:mi> | |
215 | </mml:math></inlineequation>) | |
216 | of the pixel fragment | |
217 | that represents the point is computed as | |
218 | </para> | |
219 | <para> | |
220 | <inlineequation><mml:math> | |
221 | <!-- eqn: ( \(lf x sub w \(rf + .5 , \(lf y sub w \(rf + .5 ):--> | |
222 | <mml:mfenced open="(" close=")"> | |
223 | <mml:mrow> | |
224 | <mml:mfenced open="⌊" close="⌋"> | |
225 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
226 | <mml:mi mathvariant="italic">w</mml:mi> | |
227 | </mml:msub> | |
228 | </mml:mfenced> | |
229 | <mml:mo>+</mml:mo> | |
230 | <mml:mn>.5</mml:mn> | |
231 | </mml:mrow> | |
232 | <mml:mrow> | |
233 | <mml:mfenced open="⌊" close="⌋"> | |
234 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
235 | <mml:mi mathvariant="italic">w</mml:mi> | |
236 | </mml:msub> | |
237 | </mml:mfenced> | |
238 | <mml:mo>+</mml:mo> | |
239 | <mml:mn>.5</mml:mn> | |
240 | </mml:mrow> | |
241 | </mml:mfenced> | |
242 | </mml:math></inlineequation> | |
243 | </para> | |
244 | <para> | |
245 | where | |
246 | <inlineequation><mml:math><mml:mi mathvariant="italic">w</mml:mi></mml:math></inlineequation> | |
247 | subscripts indicate window coordinates. All pixels that lie | |
248 | within the square grid of the rounded size centered at | |
249 | (<inlineequation><mml:math> | |
250 | <!-- eqn: x:--> | |
251 | <mml:mi mathvariant="italic">x</mml:mi> | |
252 | </mml:math></inlineequation>, | |
253 | <inlineequation><mml:math> | |
254 | <!-- eqn: y:--> | |
255 | <mml:mi mathvariant="italic">y</mml:mi> | |
256 | </mml:math></inlineequation>) | |
257 | make | |
258 | up the fragment. If the size is even, the center point is | |
259 | </para> | |
260 | <para> | |
261 | <inlineequation><mml:math> | |
262 | <!-- eqn: ( \(lf x sub w + .5 \(rf , \(lf y sub w + .5 \(rf ):--> | |
263 | <mml:mfenced open="(" close=")"> | |
264 | <mml:mfenced open="⌊" close="⌋"> | |
265 | <mml:mrow> | |
266 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
267 | <mml:mi mathvariant="italic">w</mml:mi> | |
268 | </mml:msub> | |
269 | <mml:mo>+</mml:mo> | |
270 | <mml:mn>.5</mml:mn> | |
271 | </mml:mrow> | |
272 | </mml:mfenced> | |
273 | <mml:mfenced open="⌊" close="⌋"> | |
274 | <mml:mrow> | |
275 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
276 | <mml:mi mathvariant="italic">w</mml:mi> | |
277 | </mml:msub> | |
278 | <mml:mo>+</mml:mo> | |
279 | <mml:mn>.5</mml:mn> | |
280 | </mml:mrow> | |
281 | </mml:mfenced> | |
282 | </mml:mfenced> | |
283 | </mml:math></inlineequation> | |
284 | </para> | |
285 | <para> | |
286 | and the rasterized fragment's centers are the half-integer window | |
287 | coordinates within the square of the rounded size centered at | |
288 | <inlineequation><mml:math> | |
289 | <!-- eqn: (x, y):--> | |
290 | <mml:mfenced open="(" close=")"> | |
291 | <mml:mi mathvariant="italic">x</mml:mi> | |
292 | <mml:mi mathvariant="italic">y</mml:mi> | |
293 | </mml:mfenced> | |
294 | </mml:math></inlineequation>. | |
295 | All pixel fragments produced in rasterizing a nonantialiased point are | |
296 | assigned the same associated data, that of the vertex corresponding to the | |
297 | point. | |
298 | </para> | |
299 | <para> | |
300 | If antialiasing is enabled, then point rasterization produces a fragment | |
301 | for each pixel square that intersects the region lying within the circle | |
302 | having diameter equal to the current point size and centered at the point's | |
303 | <inlineequation><mml:math> | |
304 | <!-- eqn: (x sub w, y sub w):--> | |
305 | <mml:mfenced open="(" close=")"> | |
306 | <mml:msub><mml:mi mathvariant="italic">x</mml:mi> | |
307 | <mml:mi mathvariant="italic">w</mml:mi> | |
308 | </mml:msub> | |
309 | <mml:msub><mml:mi mathvariant="italic">y</mml:mi> | |
310 | <mml:mi mathvariant="italic">w</mml:mi> | |
311 | </mml:msub> | |
312 | </mml:mfenced> | |
313 | </mml:math></inlineequation>. | |
314 | The coverage value for each fragment is the | |
315 | window coordinate area of the intersection of the circular region with the | |
316 | corresponding pixel square. This value is saved and used in the final | |
317 | rasterization step. The data associated with each fragment is the data | |
318 | associated with the point being rasterized. | |
319 | </para> | |
320 | <para> | |
321 | Not all sizes are supported when point antialiasing is enabled. If an | |
322 | unsupported size is requested, the nearest supported size is used. Only | |
323 | size 1 is guaranteed to be supported; others depend on the implementation. | |
324 | To query the range of supported sizes and the size difference between | |
325 | supported sizes within the range, call <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with arguments | |
326 | <constant>GL_SMOOTH_POINT_SIZE_RANGE</constant> and <constant>GL_SMOOTH_POINT_SIZE_GRANULARITY</constant>. | |
327 | For aliased points, query the supported ranges and granularity with | |
328 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with arguments <constant>GL_ALIASED_POINT_SIZE_RANGE</constant>. | |
329 | </para> | |
330 | </refsect1> | |
331 | <refsect1 id="notes"><title>Notes</title> | |
332 | <para> | |
333 | The point size specified by <function>glPointSize</function> is always returned when | |
334 | <constant>GL_POINT_SIZE</constant> is queried. Clamping and rounding for aliased and | |
335 | antialiased points have no effect on the specified value. | |
336 | </para> | |
337 | <para> | |
338 | A non-antialiased point size may be clamped to an implementation-dependent | |
339 | maximum. Although this maximum cannot be queried, it must be no less than | |
340 | the maximum value for antialiased points, rounded to the nearest integer | |
341 | value. | |
342 | </para> | |
343 | <para> | |
344 | <constant>GL_POINT_SIZE_RANGE</constant> and <constant>GL_POINT_SIZE_GRANULARITY</constant> are | |
345 | deprecated in GL versions 1.2 and greater. Their functionality has been | |
346 | replaced by <constant>GL_SMOOTH_POINT_SIZE_RANGE</constant> and | |
347 | <constant>GL_SMOOTH_POINT_SIZE_GRANULARITY</constant>. | |
348 | </para> | |
349 | </refsect1> | |
350 | <refsect1 id="errors"><title>Errors</title> | |
351 | <para> | |
352 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>size</parameter> is less than or equal to 0. | |
353 | </para> | |
354 | <para> | |
355 | <constant>GL_INVALID_OPERATION</constant> is generated if <function>glPointSize</function> | |
356 | is executed between the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> | |
357 | and the corresponding execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>. | |
358 | </para> | |
359 | </refsect1> | |
360 | <refsect1 id="associatedgets"><title>Associated Gets</title> | |
361 | <para> | |
362 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_ALIASED_POINT_SIZE_RANGE</constant> | |
363 | </para> | |
364 | <para> | |
365 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_POINT_SIZE</constant> | |
366 | </para> | |
367 | <para> | |
368 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_POINT_SIZE_MIN</constant> | |
369 | </para> | |
370 | <para> | |
371 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_POINT_SIZE_MAX</constant> | |
372 | </para> | |
373 | <para> | |
374 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_POINT_FADE_THRESHOLD_SIZE</constant> | |
375 | </para> | |
376 | <para> | |
377 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_POINT_DISTANCE_ATTENUATION</constant> | |
378 | </para> | |
379 | <para> | |
380 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_SMOOTH_POINT_SIZE_RANGE</constant> | |
381 | </para> | |
382 | <para> | |
383 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_SMOOTH_POINT_SIZE_GRANULARITY</constant> | |
384 | </para> | |
385 | <para> | |
386 | <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_POINT_SMOOTH</constant> | |
387 | </para> | |
388 | </refsect1> | |
389 | <refsect1 id="seealso"><title>See Also</title> | |
390 | <para> | |
391 | <citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry>, | |
392 | <citerefentry><refentrytitle>glPointParameter</refentrytitle></citerefentry> | |
393 | </para> | |
394 | </refsect1> | |
395 | <refsect1 id="Copyright"><title>Copyright</title> | |
396 | <para> | |
397 | Copyright <trademark class="copyright"></trademark> 1991-2006 | |
398 | Silicon Graphics, Inc. This document is licensed under the SGI | |
399 | Free Software B License. For details, see | |
400 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. | |
401 | </para> | |
402 | </refsect1> | |
403 | </refentry> |