| 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="glLineWidth"> |
| 5 | <refmeta> |
| 6 | <refmetainfo> |
| 7 | <copyright> |
| 8 | <year>1991-2006</year> |
| 9 | <holder>Silicon Graphics, Inc.</holder> |
| 10 | </copyright> |
| 11 | </refmetainfo> |
| 12 | <refentrytitle>glLineWidth</refentrytitle> |
| 13 | <manvolnum>3G</manvolnum> |
| 14 | </refmeta> |
| 15 | <refnamediv> |
| 16 | <refname>glLineWidth</refname> |
| 17 | <refpurpose>specify the width of rasterized lines</refpurpose> |
| 18 | </refnamediv> |
| 19 | <refsynopsisdiv><title>C Specification</title> |
| 20 | <funcsynopsis> |
| 21 | <funcprototype> |
| 22 | <funcdef>void <function>glLineWidth</function></funcdef> |
| 23 | <paramdef>GLfloat <parameter>width</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>width</parameter></term> |
| 32 | <listitem> |
| 33 | <para> |
| 34 | Specifies the width of rasterized lines. |
| 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>glLineWidth</function> specifies the rasterized width of both aliased and antialiased |
| 44 | lines. |
| 45 | Using a line width other than 1 has different effects, |
| 46 | depending on whether line antialiasing is enabled. |
| 47 | To enable and disable line antialiasing, call |
| 48 | <citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry> and <citerefentry><refentrytitle>glDisable</refentrytitle></citerefentry> |
| 49 | with argument <constant>GL_LINE_SMOOTH</constant>. Line antialiasing is initially |
| 50 | disabled. |
| 51 | </para> |
| 52 | <para> |
| 53 | If line antialiasing is disabled, |
| 54 | the actual width is determined by rounding the supplied width |
| 55 | to the nearest integer. |
| 56 | (If the rounding results in the value 0, |
| 57 | it is as if the line width were 1.) |
| 58 | If |
| 59 | <inlineequation><mml:math> |
| 60 | <!-- eqn: | DELTA x | >= | DELTA y |:--> |
| 61 | <mml:mrow> |
| 62 | <mml:mfenced open="∣" close="∣"> |
| 63 | <mml:mrow> |
| 64 | <mml:mo>Δ</mml:mo> |
| 65 | <mml:mi mathvariant="italic">x</mml:mi> |
| 66 | </mml:mrow> |
| 67 | </mml:mfenced> |
| 68 | <mml:mo>>=</mml:mo> |
| 69 | <mml:mfenced open="∣" close="∣"> |
| 70 | <mml:mrow> |
| 71 | <mml:mo>Δ</mml:mo> |
| 72 | <mml:mi mathvariant="italic">y</mml:mi> |
| 73 | </mml:mrow> |
| 74 | </mml:mfenced> |
| 75 | </mml:mrow> |
| 76 | </mml:math></inlineequation>, |
| 77 | <emphasis>i</emphasis> pixels are filled in each column that is rasterized, |
| 78 | where <emphasis>i</emphasis> is the rounded value of <parameter>width</parameter>. |
| 79 | Otherwise, |
| 80 | <emphasis>i</emphasis> pixels are filled in each row that is rasterized. |
| 81 | </para> |
| 82 | <para> |
| 83 | If antialiasing is enabled, |
| 84 | line rasterization produces a fragment for each pixel square |
| 85 | that intersects the region lying within the rectangle having width |
| 86 | equal to the current line width, |
| 87 | length equal to the actual length of the line, |
| 88 | and centered on the mathematical line segment. |
| 89 | The coverage value for each fragment is the window coordinate area |
| 90 | of the intersection of the rectangular region with the corresponding |
| 91 | pixel square. |
| 92 | This value is saved and used in the final rasterization step. |
| 93 | </para> |
| 94 | <para> |
| 95 | Not all widths can be supported when line antialiasing is enabled. If an |
| 96 | unsupported width is requested, the nearest supported width is used. |
| 97 | Only width 1 is guaranteed to be supported; others depend on the |
| 98 | implementation. Likewise, there is a range for aliased line widths as well. |
| 99 | To query the range of supported widths and the size |
| 100 | difference between supported widths within the range, call <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> |
| 101 | with arguments <constant>GL_ALIASED_LINE_WIDTH_RANGE</constant>, |
| 102 | <constant>GL_SMOOTH_LINE_WIDTH_RANGE</constant>, and <constant>GL_SMOOTH_LINE_WIDTH_GRANULARITY</constant>. |
| 103 | </para> |
| 104 | </refsect1> |
| 105 | <refsect1 id="notes"><title>Notes</title> |
| 106 | <para> |
| 107 | The line width specified by <function>glLineWidth</function> is always returned when <constant>GL_LINE_WIDTH</constant> |
| 108 | is queried. |
| 109 | Clamping and rounding for aliased and antialiased lines have no effect on the specified value. |
| 110 | </para> |
| 111 | <para> |
| 112 | Nonantialiased line width may be clamped to an implementation-dependent maximum. Call <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with <constant>GL_ALIASED_LINE_WIDTH_RANGE</constant> to determine the maximum width. |
| 113 | </para> |
| 114 | <para> |
| 115 | In OpenGL 1.2, the tokens <constant>GL_LINE_WIDTH_RANGE</constant> and <constant>GL_LINE_WIDTH_GRANULARITY</constant> were replaced by <constant>GL_ALIASED_LINE_WIDTH_RANGE</constant>, |
| 116 | <constant>GL_SMOOTH_LINE_WIDTH_RANGE</constant>, and <constant>GL_SMOOTH_LINE_WIDTH_GRANULARITY</constant>. The old names are retained for backward compatibility, but should not be used in new code. |
| 117 | </para> |
| 118 | </refsect1> |
| 119 | <refsect1 id="errors"><title>Errors</title> |
| 120 | <para> |
| 121 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>width</parameter> is less than or equal to 0. |
| 122 | </para> |
| 123 | </refsect1> |
| 124 | <refsect1 id="associatedgets"><title>Associated Gets</title> |
| 125 | <para> |
| 126 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_LINE_WIDTH</constant> |
| 127 | </para> |
| 128 | <para> |
| 129 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_ALIASED_LINE_WIDTH_RANGE</constant> |
| 130 | </para> |
| 131 | <para> |
| 132 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_SMOOTH_LINE_WIDTH_RANGE</constant> |
| 133 | </para> |
| 134 | <para> |
| 135 | <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_SMOOTH_LINE_WIDTH_GRANULARITY</constant> |
| 136 | </para> |
| 137 | <para> |
| 138 | <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_LINE_SMOOTH</constant> |
| 139 | </para> |
| 140 | </refsect1> |
| 141 | <refsect1 id="seealso"><title>See Also</title> |
| 142 | <para> |
| 143 | <citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry> |
| 144 | </para> |
| 145 | </refsect1> |
| 146 | <refsect1 id="Copyright"><title>Copyright</title> |
| 147 | <para> |
| 148 | Copyright <trademark class="copyright"></trademark> 1991-2006 |
| 149 | Silicon Graphics, Inc. This document is licensed under the SGI |
| 150 | Free Software B License. For details, see |
| 151 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. |
| 152 | </para> |
| 153 | </refsect1> |
| 154 | </refentry> |