<!doctype html>
<html>
  <head>
    <meta content="width=device-width, initial-scale=1" name="viewport">
    <meta charset="utf-8">
    <title>GL.glOrtho() - Pike Reference Manual</title>
    <!-- 221-->
    <link rel='stylesheet' href='../../../style.css'>
    <script src='../../../site.js'></script>
    <script src='../../../constants.js'></script>
    <script>PikeDoc.NO_DYNAMIC = false;</script>
    <style type='text/css'>
svg line { stroke:#343434; stroke-width:2; }
svg text { fill:#343434; }
svg a { fill:#0768b2; text-decoration: underline; }
</style>

  </head>
  <body>
    <header>
      <div class="header">
        <div id="version"><strong data-id="version">Pike v8.0 release 1956</strong></div>
        <button id="burger">
          <span class="bar"></span>
          <span class="bar"></span>
          <span class="bar"></span>
          <span class="bar"></span>
        </button><!-- Hamburger icon -->
        <h1>
          <a href="http://pike.lysator.liu.se/" class="logo">
            <span>Pike programming language</span>
          </a>
        </h1>
      </div>
    </header>
    <div id="page">
      <div class="navbar">
        <nav>
          <div class="inner" id="navbar">
            <a href='../../../index.html'><b class='top head'>Top</b></a>
<a href='../../../ex/predef_3A_3A/GL.html'><b class='head'>GL</b></a>
<script></script>
<noscript>
<div class='sidebar'>
<a href='../../../ex/predef_3A_3A/GL/index.html'><b>Symbol index</b></a><br />
</div>
</noscript>

          </div>
        </nav>
      </div>
      <div class="content">
        <div class="navbox">
          <nav>
            <div class="sidebar">
              <a href="../../../ex/predef_3A_3A/GL/glNormal.html" class="prev"><span>&#10148;</span> GL.glNormal()</a>
              <a href="../../../ex/predef_3A_3A/GL/glPassThrough.html" class="next">GL.glPassThrough() <span>&#10148;</span></a>
            </div>
          </nav>
        </div>
        <div class="contentbox">
          <article>
            <h1>Method GL.glOrtho()</h1>
            

<hr />
<dl class='group--doc'>
<dt class='head--type'><span class='homogen--type'>Method</span>
<span class='homogen--name'><b>glOrtho</b></span>
</dt>
<dd><p><code><code class='datatype'>void</code> <b><span class='method'>glOrtho</span>(</b><code class='datatype'>float</code> <code class='argument'>left</code>, <code class='datatype'>float</code> <code class='argument'>right</code>, <code class='datatype'>float</code> <code class='argument'>bottom</code>, <code class='datatype'>float</code> <code class='argument'>top</code>, <code class='datatype'>float</code> <code class='argument'>zNear</code>, <code class='datatype'>float</code> <code class='argument'>zFar</code><b>)</b></code></p></dd>

<dt class='head--doc'>Description</dt>
<dd class='body--doc'><p><a class='ms reference' href='../../predef_3A_3A/GL/glOrtho.html'>glOrtho</a> describes a transformation that produces a parallel projection.
The current matrix (see <a class='ms reference' href='../../predef_3A_3A/GL/glMatrixMode.html'>glMatrixMode</a>) is multiplied by this matrix
and the result replaces the current matrix, as if
<a class='ms reference' href='../../predef_3A_3A/GL/glMultMatrix.html'>glMultMatrix</a> were called with the following matrix
as its argument:
.sp
.ce
.EQ
left (  matrix {
   ccol { {2 over {"right" - "left"}} above 0 above 0 above 0 }
   ccol { 0 above {2 over {"top" - "bottom"}} above 0 above 0 }
   ccol { 0 above 0 above {-2 over {"zFar" - "zNear"}}  above 0 }
   ccol { {t sub x}~ above {t sub y}~ above {t sub z}~ above 1~ }
} right )
.EN</p>
<p>where
.ce
.EQ
t sub x ~=~ -{{"right" + "left"} over {"right" - "left"}}
.EN</p>
<p>.ce
.EQ
t sub y ~=~ -{{"top" + "bottom"} over {"top" - "bottom"}}
.EN</p>
<p>.ce
.EQ
t sub z ~=~ -{{"zFar" + "zNear"} over {"zFar" - "zNear"}}
.EN</p>
<p>.RE</p>
<p>Typically, the matrix mode is <a class='ms reference' 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,
respectively,
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> can be either positive or negative.</p>
<p>Use <a class='ms reference' href='../../predef_3A_3A/GL/glPushMatrix.html'>glPushMatrix</a> and <a class='ms reference' href='../../predef_3A_3A/GL/glPopMatrix.html'>glPopMatrix</a> to save and restore
the current matrix stack.</p>
</dd>
<dt class='head--doc'><span id='p-left'></span>Parameter <code class='parameter'>left</code></dt>
<dd></dd><dd class='body--doc'><p>Specify the coordinates for the left and right vertical clipping planes.</p>
</dd>
<dt class='head--doc'><span id='p-bottom'></span>Parameter <code class='parameter'>bottom</code></dt>
<dd></dd><dd class='body--doc'><p>Specify the coordinates for the bottom and top horizontal clipping planes.</p>
</dd>
<dt class='head--doc'><span id='p-zNear'></span>Parameter <code class='parameter'>zNear</code></dt>
<dd></dd><dd class='body--doc'><p>Specify the distances to the nearer and farther depth clipping planes.
These values are negative if the plane is to be behind the viewer.</p>
</dd>
<dt class='head--doc'>Throws</dt>
<dd class='body--doc'><p><a class='ms reference' href='../../predef_3A_3A/GL.html'>GL_INVALID_OPERATION</a> is generated if <a class='ms reference' href='../../predef_3A_3A/GL/glOrtho.html'>glOrtho</a>
is executed between the execution of 
<a class='ms reference' href='../../predef_3A_3A/GL/glBegin.html'>glBegin</a>
and the corresponding execution of <a class='ms reference' href='../../predef_3A_3A/GL/glEnd.html'>glEnd</a>.</p>
</dd></dl>

          </article>
        </div>
      </div>
    </div>
    <footer>
      <div id="build-date">Extracted from <strong data-id="version">Pike v8.0 release 1956</strong> as of <strong data-id="date" data-timestamp="1746135183">2025-05-01</strong>.</div>
    </footer>
    <script>PikeDoc.current = {"link":"ex/predef_3A_3A/GL/glOrtho.html","name":"glOrtho"};</script>
<script src='../../../ex/predef_3A_3A/GL/index.js'></script>
<script src='../../../ex/predef_3A_3A/GL/load_index.js'></script>
    <script>
      // Tell PikeDoc that next actions are from loaded scripts
      PikeDoc.isInline = false;
    </script>
  </body>
</html>
