<html>
  <head>
    <title>Pike Reference Manual - GL.glFrustum()</title>
    <link rel='stylesheet' href='../../../style.css' />
    <meta charset='utf-8' />
<style type='text/css'>
svg line { stroke:#343434; stroke-width:2; }
svg text { fill:#343434; }
svg a { fill:#0768b2; text-decoration: underline; }
</style>
<script language='javascript'>
var current = {
  "link": "ex/predef_3A_3A/GL/glFrustum.html",
  "name": "glFrustum"
};
</script>
<script language='javascript' src='../../../navigation.js'>
</script>
<script language='javascript' src='../../../ex/predef_3A_3A/GL/index.js'>
</script>
<script language='javascript'>
siblings = children;
clear_children();
</script>
<script language='javascript' src='../../../ex/predef_3A_3A/GL/load_index.js'>
</script>

  </head>
  <body link="#0768b2" alink="#002040" vlink="#0768b2">
    <header>
      <div>
	<div style="text-align:right;">Extracted from Pike v8.0 release 164 as of 2018-07-18.</div>
	<div style="overflow:hidden;">
	  <a href="http://pike.lysator.liu.se/"
	     style="float:left; width:181px; height:41px; margin:10px;
		    margin-left:22px; margin-right:25px;
		    background-image:url('../../../images/pike_logo.gif');"></a>
	  <div style="margin:10px; height:11px;
		      margin-top:26px; margin-right:19px;
		      overflow:hidden;
		      background-image:url('../../../images/pike_line_middle.gif');">
	    <span style="float:left; width:5px; height:11px;
			 background-image:url('../../../images/pike_line_left.gif');">&nbsp;</span>
	    <span style="float:right; width:5px; height:11px;
			 background-image:url('../../../images/pike_line_right.gif');">&nbsp;</span>
	  </div>
	</div>
      </div>
    </header>

    <div>
      <div class="navbar">
	<nav>
	  <a href='../../../index.html'><b>[Top]</b></a><br />
<a href='../../../ex/predef_3A_3A/GL.html'><b>GL</b></a><br />
<script language='javascript'>navbar(document)</script>
<noscript>
<div class='sidebar'>
<a href='../../../ex/predef_3A_3A/GL/index.html'><b>Symbol index</b></a><br />
</div>
</noscript>

	</nav>
      </div>
      <div class="navbox">
	<nav>
	  <div class="sidebar">
	    <a href="../../../ex/predef_3A_3A/GL/glFrontFace.html" class="left"
	       ><img src="../../../images/prev.gif" hspace="3"
		     border="0" alt="previous"
		     >GL.glFrontFace()</a>
	    <a href="../../../ex/predef_3A_3A/GL/glGenLists.html" class="right"
	       >GL.glGenLists()<img src="../../../images/next.gif" hspace="3"
				 border="0" alt="next"
				 ></a>
	  </div>
	</nav>
      </div>
      <div class="contentbox">
	<article>
	  <h1>Method GL.glFrustum()</h1>
	  

<hr clear='all' size='1' noshadow='noshadow' />
<dl>
<dt style='font-family: sans-serif'><font face='Helvetica'>Method</font>
<font size='+1'><b>glFrustum</b></font>
</dt>
<dd><p><tt><font color='#202020'>void</font> <b><font color='#000066'>glFrustum</font>(</b><font color='#202020'>float</font> <font color='#005080'>left</font>, <font color='#202020'>float</font> <font color='#005080'>right</font>, <font color='#202020'>float</font> <font color='#005080'>bottom</font>, <font color='#202020'>float</font> <font color='#005080'>top</font>, <font color='#202020'>float</font> <font color='#005080'>zNear</font>, <font color='#202020'>float</font> <font color='#005080'>zFar</font><b>)</b></tt></p></dd>

<dt style='font-family: sans-serif'>Description</dt>
<dd style='font-family: sans-serif'><p><a style='font-family:courier;' href='../../predef_3A_3A/GL/glFrustum.html'>glFrustum</a> describes a perspective matrix that produces a perspective projection.
The current matrix (see <a style='font-family:courier;' href='../../predef_3A_3A/GL/glMatrixMode.html'>glMatrixMode</a>) is multiplied by this matrix
and the result replaces the current matrix, as if
<a style='font-family:courier;' href='../../predef_3A_3A/GL/glMultMatrix.html'>glMultMatrix</a> were called with the following matrix
as its argument:</p>
<p>.sp 5
.ce
.EQ
down 130 {left ( ~~ matrix {
   ccol { {{2 ~ "zNear"} over {"right" - "left"}} above 0 above 0 above 0 }
   ccol { 0 above {{2 ~ "zNear"} over {"top" - "bottom"}} ~ above 0 above 0 }
   ccol { A ~~~~ above B ~~~~ above C ~~~~ above -1 ~~~~}
   ccol { 0 above 0 above D above 0}
}  ~~~ right )}
.EN
.sp
.ce
.EQ
down 130
{A ~=~ {"right" + "left"} over {"right" - "left"}}
.EN
.sp
.ce
.EQ
down 130
{B ~=~ {"top" + "bottom"} over {"top" - "bottom"}}
.EN
.sp
.ce
.EQ
down 130
{C ~=~ -{{"zFar" + "zNear"} over {"zFar" - "zNear"}}}
.EN
.sp
.ce
.EQ
down 130
{D ~=~ -{{2 ~ "zFar" ~ "zNear"} over {"zFar" - "zNear"}}}
.EN
.sp</p>
<p>Typically, the matrix mode is <a style='font-family:courier;' href='../../predef_3A_3A/GL.html'>GL_PROJECTION</a>, and
(<i>left</i>, <i>bottom</i>, -<i>zNear</i>) and (<i>right</i>, <i>top</i>,  -<i>zNear</i>)
specify the points on the near clipping plane that are mapped
to the lower left and upper right corners of the window,
assuming that the eye is located at (0, 0, 0).
-<i>zFar</i> specifies the location of the far clipping plane.
Both <i>zNear</i> and <i>zFar</i> must be positive.</p>
<p>Use <a style='font-family:courier;' href='../../predef_3A_3A/GL/glPushMatrix.html'>glPushMatrix</a> and <a style='font-family:courier;' href='../../predef_3A_3A/GL/glPopMatrix.html'>glPopMatrix</a> to save and restore
the current matrix stack.</p>
</dd>
<dt style='font-family: sans-serif'>Parameter <tt><font color='#8000F0'>left</font></tt></dt>
<dd></dd><dd style='font-family: sans-serif'><p>Specify the coordinates for the left and right vertical clipping planes.</p>
</dd>
<dt style='font-family: sans-serif'>Parameter <tt><font color='#8000F0'>bottom</font></tt></dt>
<dd></dd><dd style='font-family: sans-serif'><p>Specify the coordinates for the bottom and top horizontal clipping planes.</p>
</dd>
<dt style='font-family: sans-serif'>Parameter <tt><font color='#8000F0'>zNear</font></tt></dt>
<dd></dd><dd style='font-family: sans-serif'><p>Specify the distances to the near and far depth clipping planes.
Both distances must be positive.</p>
</dd>
<dt style='font-family: sans-serif'>Throws</dt>
<dd style='font-family: sans-serif'><p><a style='font-family:courier;' href='../../predef_3A_3A/GL.html'>GL_INVALID_VALUE</a> is generated if <i>zNear</i> or <i>zFar</i> is not positive.</p>
<p><a style='font-family:courier;' href='../../predef_3A_3A/GL.html'>GL_INVALID_OPERATION</a> is generated if <a style='font-family:courier;' href='../../predef_3A_3A/GL/glFrustum.html'>glFrustum</a>
is executed between the execution of <a style='font-family:courier;' href='../../predef_3A_3A/GL/glBegin.html'>glBegin</a>
and the corresponding execution of <a style='font-family:courier;' href='../../predef_3A_3A/GL/glEnd.html'>glEnd</a>.</p>
</dd></dl>

	</article>
	<footer>
	  <hr size="1" noshade="1" />
	</footer>
      </div>
    </div>
  </body>
</html>
