| 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> |
| 3 | <!-- saved from url=(0013)about:internet --> |
| 4 | <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="stylesheet" type="text/css" href="opengl-man.css" /><title>glLineWidth</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /></head><body><div class="refentry" title="glLineWidth"><a id="glLineWidth"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glLineWidth — specify the width of rasterized lines</p></div><div class="refsynopsisdiv" title="C Specification"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">void <b class="fsfunc">glLineWidth</b>(</code></td><td>GLfloat <var class="pdparam">width</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Parameters"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>width</code></em></span></dt><dd><p> |
| 5 | Specifies the width of rasterized lines. |
| 6 | The initial value is 1. |
| 7 | </p></dd></dl></div></div><div class="refsect1" title="Description"><a id="description"></a><h2>Description</h2><p> |
| 8 | <code class="function">glLineWidth</code> specifies the rasterized width of both aliased and antialiased |
| 9 | lines. |
| 10 | Using a line width other than 1 has different effects, |
| 11 | depending on whether line antialiasing is enabled. |
| 12 | To enable and disable line antialiasing, call |
| 13 | <a class="citerefentry" href="glEnable.xml"><span class="citerefentry"><span class="refentrytitle">glEnable</span></span></a> and <a class="citerefentry" href="glDisable.xml"><span class="citerefentry"><span class="refentrytitle">glDisable</span></span></a> |
| 14 | with argument <code class="constant">GL_LINE_SMOOTH</code>. Line antialiasing is initially |
| 15 | disabled. |
| 16 | </p><p> |
| 17 | If line antialiasing is disabled, |
| 18 | the actual width is determined by rounding the supplied width |
| 19 | to the nearest integer. |
| 20 | (If the rounding results in the value 0, |
| 21 | it is as if the line width were 1.) |
| 22 | If |
| 23 | <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll"> |
| 24 | |
| 25 | <mml:mrow> |
| 26 | <mml:mfenced open="∣" close="∣"> |
| 27 | <mml:mrow> |
| 28 | <mml:mo>Δ</mml:mo> |
| 29 | <mml:mi mathvariant="italic">x</mml:mi> |
| 30 | </mml:mrow> |
| 31 | </mml:mfenced> |
| 32 | <mml:mo>>=</mml:mo> |
| 33 | <mml:mfenced open="∣" close="∣"> |
| 34 | <mml:mrow> |
| 35 | <mml:mo>Δ</mml:mo> |
| 36 | <mml:mi mathvariant="italic">y</mml:mi> |
| 37 | </mml:mrow> |
| 38 | </mml:mfenced> |
| 39 | </mml:mrow> |
| 40 | </mml:math>, |
| 41 | <span class="emphasis"><em>i</em></span> pixels are filled in each column that is rasterized, |
| 42 | where <span class="emphasis"><em>i</em></span> is the rounded value of <em class="parameter"><code>width</code></em>. |
| 43 | Otherwise, |
| 44 | <span class="emphasis"><em>i</em></span> pixels are filled in each row that is rasterized. |
| 45 | </p><p> |
| 46 | If antialiasing is enabled, |
| 47 | line rasterization produces a fragment for each pixel square |
| 48 | that intersects the region lying within the rectangle having width |
| 49 | equal to the current line width, |
| 50 | length equal to the actual length of the line, |
| 51 | and centered on the mathematical line segment. |
| 52 | The coverage value for each fragment is the window coordinate area |
| 53 | of the intersection of the rectangular region with the corresponding |
| 54 | pixel square. |
| 55 | This value is saved and used in the final rasterization step. |
| 56 | </p><p> |
| 57 | Not all widths can be supported when line antialiasing is enabled. If an |
| 58 | unsupported width is requested, the nearest supported width is used. |
| 59 | Only width 1 is guaranteed to be supported; others depend on the |
| 60 | implementation. Likewise, there is a range for aliased line widths as well. |
| 61 | To query the range of supported widths and the size |
| 62 | difference between supported widths within the range, call <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> |
| 63 | with arguments <code class="constant">GL_ALIASED_LINE_WIDTH_RANGE</code>, |
| 64 | <code class="constant">GL_SMOOTH_LINE_WIDTH_RANGE</code>, and <code class="constant">GL_SMOOTH_LINE_WIDTH_GRANULARITY</code>. |
| 65 | </p></div><div class="refsect1" title="Notes"><a id="notes"></a><h2>Notes</h2><p> |
| 66 | The line width specified by <code class="function">glLineWidth</code> is always returned when <code class="constant">GL_LINE_WIDTH</code> |
| 67 | is queried. |
| 68 | Clamping and rounding for aliased and antialiased lines have no effect on the specified value. |
| 69 | </p><p> |
| 70 | Nonantialiased line width may be clamped to an implementation-dependent maximum. Call <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with <code class="constant">GL_ALIASED_LINE_WIDTH_RANGE</code> to determine the maximum width. |
| 71 | </p><p> |
| 72 | In OpenGL 1.2, the tokens <code class="constant">GL_LINE_WIDTH_RANGE</code> and <code class="constant">GL_LINE_WIDTH_GRANULARITY</code> were replaced by <code class="constant">GL_ALIASED_LINE_WIDTH_RANGE</code>, |
| 73 | <code class="constant">GL_SMOOTH_LINE_WIDTH_RANGE</code>, and <code class="constant">GL_SMOOTH_LINE_WIDTH_GRANULARITY</code>. The old names are retained for backward compatibility, but should not be used in new code. |
| 74 | </p></div><div class="refsect1" title="Errors"><a id="errors"></a><h2>Errors</h2><p> |
| 75 | <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>width</code></em> is less than or equal to 0. |
| 76 | </p></div><div class="refsect1" title="Associated Gets"><a id="associatedgets"></a><h2>Associated Gets</h2><p> |
| 77 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_LINE_WIDTH</code> |
| 78 | </p><p> |
| 79 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_ALIASED_LINE_WIDTH_RANGE</code> |
| 80 | </p><p> |
| 81 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_SMOOTH_LINE_WIDTH_RANGE</code> |
| 82 | </p><p> |
| 83 | <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_SMOOTH_LINE_WIDTH_GRANULARITY</code> |
| 84 | </p><p> |
| 85 | <a class="citerefentry" href="glIsEnabled.xml"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument <code class="constant">GL_LINE_SMOOTH</code> |
| 86 | </p></div><div class="refsect1" title="See Also"><a id="seealso"></a><h2>See Also</h2><p> |
| 87 | <a class="citerefentry" href="glEnable.xml"><span class="citerefentry"><span class="refentrytitle">glEnable</span></span></a> |
| 88 | </p></div><div class="refsect1" title="Copyright"><a id="Copyright"></a><h2>Copyright</h2><p> |
| 89 | Copyright <span class="trademark"></span>© 1991-2006 |
| 90 | Silicon Graphics, Inc. This document is licensed under the SGI |
| 91 | Free Software B License. For details, see |
| 92 | <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>. |
| 93 | </p></div></div></body></html> |