<?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="glDepthRange">
<refmeta>
<refentrytitle>glDepthRange</refentrytitle>
<manvolnum>3G</manvolnum>
</refmeta>
<refnamediv>
<refdescriptor>glDepthRange</refdescriptor>
<refname>glDepthRangef</refname>
<refname>glDepthRangex</refname>
<refpurpose>specify mapping of depth values from normalized
device coordinates to window coordinates</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>C Specification</title>
<funcsynopsis>
<funcprototype>
<funcdef>void <function>glDepthRangef</function></funcdef>
<paramdef>GLclampf <parameter>near</parameter></paramdef>
<paramdef>GLclampf <parameter>far</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>void <function>glDepthRangex</function></funcdef>
<paramdef>GLclampx <parameter>near</parameter></paramdef>
<paramdef>GLclampx <parameter>far</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term>
<parameter>near</parameter>
</term>
<listitem>
<para>Specifies the mapping of the near clipping plane to
window coordinates. The initial value is 0.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>far</parameter>
</term>
<listitem>
<para>Specifies the mapping of the far clipping plane to
window coordinates. The initial value is 1.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<para>After clipping and division by <parameter>w</parameter>,
depth coordinates range from -1 to 1, corresponding to the
near and far clipping planes. <function>glDepthRange</function>
specifies a linear mapping of the normalized depth coordinates
in this range to window depth coordinates. Regardless of the
actual depth buffer implementation, window coordinate depth
values are treated as though they range from 0 through 1 (like
color components). Thus, the values accepted by
<function>glDepthRange</function>
are both clamped to this range before they are accepted.</para>
<para>The setting of (0, 1) maps the near plane to 0 and the far
plane to 1. With this mapping, the depth buffer range is fully
utilized.</para>
</refsect1>
<refsect1>
<title>Notes</title>
<para>It is not necessary that <parameter>near</parameter>
be less than <parameter>far</parameter>.
Reverse mappings such as
<inlineequation><math>
<mi>near</mi>
<mo>=</mo>
<mn>1</mn>
</math></inlineequation>,
and
<inlineequation><math>
<mi>far</mi>
<mo>=</mo>
<mn>0</mn>
</math></inlineequation>
are acceptable.</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry><refentrytitle>glDepthFunc</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glPolygonOffset</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glViewport</refentrytitle></citerefentry>
</para>
</refsect1>
</refentry>