<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.2//EN" "DTD/docbook/docbookx.dtd">
<!--
License Applicability. Except to the extent portions of this file are
made subject to an alternative license as permitted in the SGI Free
Software License B, Version 1.1 (the "License"), the contents of this
file are subject only to the provisions of the License. You may not use
this file except in compliance with the License. You may obtain a copy
of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
http://oss.sgi.com/projects/FreeB
Note that, as provided in the License, the Software is distributed on an
"AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
Original Code. The Original Code is: OpenGL ES Reference Manual,
Version 1.0, released September 2003, developed by Silicon Graphics,
Inc. The Original Code is Copyright (c) 2003 Silicon Graphics, Inc.
Copyright in any portions created by third parties is as indicated
elsewhere herein. All Rights Reserved.
-->
<refentry id="glLineWidth">
<refmeta>
<refentrytitle>glLineWidth</refentrytitle>
<manvolnum>3G</manvolnum>
</refmeta>
<refnamediv>
<refdescriptor>glLineWidth</refdescriptor>
<refname>glLineWidth</refname>
<refname>glLineWidthx</refname>
<refpurpose>specify the width of rasterized lines</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>C Specification</title>
<funcsynopsis>
<funcprototype>
<funcdef>void <function>glLineWidth</function></funcdef>
<paramdef>GLfloat <parameter>width</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>void <function>glLineWidthx</function></funcdef>
<paramdef>GLfixed <parameter>width</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term>
<parameter>width</parameter>
</term>
<listitem>
<para>Specifies the width of rasterized lines. The
initial value is 1.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>
<function>glLineWidth</function>
specifies the rasterized width of both aliased and antialiased
lines. Using a line width other than 1 has different effects,
depending on whether line antialiasing is enabled. To enable
and disable line antialiasing, call
<citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry> and
<citerefentry><refentrytitle>glDisable</refentrytitle></citerefentry>
with argument <constant>GL_LINE_SMOOTH</constant>.
Line antialiasing is initially disabled.</para>
<para>If line antialiasing is disabled, the actual width is
determined by rounding the supplied width to the nearest
integer. (If the rounding results in the value 0, it is as if
the line width were 1.) If
<inlineequation><math>
<mrow>
<mo>|</mo>
<mrow><mo>Δ</mo><mi>x</mi></mrow>
<mo>|</mo>
</mrow>
<mo>>=</mo>
<mrow>
<mo>|</mo>
<mrow><mo>Δ</mo><mi>y</mi></mrow>
<mo>|</mo>
</mrow>
</math></inlineequation>,
<parameter>i</parameter>
pixels are filled in each column that is rasterized, where
<parameter>i</parameter> is the rounded value of
<parameter>width</parameter>. Otherwise, <parameter>i</parameter>
pixels are filled in each row that is rasterized.</para>
<para>If antialiasing is enabled, line rasterization produces a
fragment for each pixel square that intersects the region lying
within the rectangle having width equal to the current line
width, length equal to the actual length of the line, and
centered on the mathematical line segment. The coverage value
for each fragment is the window coordinate area of the
intersection of the rectangular region with the corresponding
pixel square. This value is saved and used in the final
rasterization step.</para>
<para>Not all widths can be supported when line antialiasing is
enabled. If an unsupported width is requested, the nearest
supported width is used. Only width 1 is guaranteed to be
supported; others depend on the implementation. Likewise, there
is a range for aliased line widths as well. To query the range
of supported widths and the size difference between supported
widths within the range, call
<citerefentry><refentrytitle>glGetInteger</refentrytitle></citerefentry>
with arguments
<constant>GL_ALIASED_LINE_WIDTH_RANGE</constant>,
<constant>GL_SMOOTH_LINE_WIDTH_RANGE</constant>,
<constant>GL_SMOOTH_LINE_WIDTH_GRANULARITY</constant>.</para>
</refsect1>
<refsect1>
<title>Notes</title>
<para>Nonantialiased line width may be clamped to an
implementation-dependent maximum. Call
<citerefentry><refentrytitle>glGetInteger</refentrytitle></citerefentry>
with <constant>GL_ALIASED_LINE_WIDTH_RANGE</constant>
to determine the maximum width.</para>
</refsect1>
<refsect1>
<title>Errors</title>
<para><constant>GL_INVALID_VALUE</constant> is generated if
<parameter>width</parameter> is less than or equal to 0.</para>
</refsect1>
<refsect1>
<title>Associated Gets</title>
<para>
<citerefentry><refentrytitle>glGetInteger</refentrytitle></citerefentry>
with argument <constant>GL_ALIASED_LINE_WIDTH_RANGE</constant></para>
<para>
<citerefentry><refentrytitle>glGetInteger</refentrytitle></citerefentry>
with argument <constant>GL_SMOOTH_LINE_WIDTH_RANGE</constant></para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>glEnable</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glGetInteger</refentrytitle></citerefentry>
</para>
</refsect1>
</refentry>