Server : Apache System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64 User : nobody ( 99) PHP Version : 8.1.23 Disable Function : NONE Directory : /usr/share/doc/python-docs-2.7.5/html/library/ |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>38.8. gl — Graphics Library interface — Python 2.7.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '2.7.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/sidebar.js"></script> <link rel="search" type="application/opensearchdescription+xml" title="Search within Python 2.7.5 documentation" href="../_static/opensearch.xml"/> <link rel="author" title="About these documents" href="../about.html" /> <link rel="copyright" title="Copyright" href="../copyright.html" /> <link rel="top" title="Python 2.7.5 documentation" href="../index.html" /> <link rel="up" title="38. SGI IRIX Specific Services" href="sgi.html" /> <link rel="next" title="38.11. imgfile — Support for SGI imglib files" href="imgfile.html" /> <link rel="prev" title="38.7. fm — Font Manager interface" href="fm.html" /> <link rel="shortcut icon" type="image/png" href="../_static/py.png" /> <script type="text/javascript" src="../_static/copybutton.js"></script> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="imgfile.html" title="38.11. imgfile — Support for SGI imglib files" accesskey="N">next</a> |</li> <li class="right" > <a href="fm.html" title="38.7. fm — Font Manager interface" accesskey="P">previous</a> |</li> <li><img src="../_static/py.png" alt="" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="http://www.python.org/">Python</a> »</li> <li> <a href="../index.html">Python 2.7.5 documentation</a> » </li> <li><a href="index.html" >The Python Standard Library</a> »</li> <li><a href="sgi.html" accesskey="U">38. SGI IRIX Specific Services</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="module-gl"> <span id="gl-graphics-library-interface"></span><h1>38.8. <a class="reference internal" href="#module-gl" title="gl: Functions from the Silicon Graphics Graphics Library. (deprecated) (IRIX)"><tt class="xref py py-mod docutils literal"><span class="pre">gl</span></tt></a> — <em>Graphics Library</em> interface<a class="headerlink" href="#module-gl" title="Permalink to this headline">¶</a></h1> <p class="deprecated"> <span class="versionmodified">Deprecated since version 2.6: </span>The <a class="reference internal" href="#module-gl" title="gl: Functions from the Silicon Graphics Graphics Library. (deprecated) (IRIX)"><tt class="xref py py-mod docutils literal"><span class="pre">gl</span></tt></a> module has been removed in Python 3.</p> <p>This module provides access to the Silicon Graphics <em>Graphics Library</em>. It is available only on Silicon Graphics machines.</p> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">Some illegal calls to the GL library cause the Python interpreter to dump core. In particular, the use of most GL calls is unsafe before the first window is opened.</p> </div> <p>The module is too large to document here in its entirety, but the following should help you to get started. The parameter conventions for the C functions are translated to Python as follows:</p> <ul> <li><p class="first">All (short, long, unsigned) int values are represented by Python integers.</p> </li> <li><p class="first">All float and double values are represented by Python floating point numbers. In most cases, Python integers are also allowed.</p> </li> <li><p class="first">All arrays are represented by one-dimensional Python lists. In most cases, tuples are also allowed.</p> </li> <li><p class="first">All string and character arguments are represented by Python strings, for instance, <tt class="docutils literal"><span class="pre">winopen('Hi</span> <span class="pre">There!')</span></tt> and <tt class="docutils literal"><span class="pre">rotate(900,</span> <span class="pre">'z')</span></tt>.</p> </li> <li><p class="first">All (short, long, unsigned) integer arguments or return values that are only used to specify the length of an array argument are omitted. For example, the C call</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">lmdef</span><span class="p">(</span><span class="n">deftype</span><span class="p">,</span> <span class="n">index</span><span class="p">,</span> <span class="n">np</span><span class="p">,</span> <span class="n">props</span><span class="p">)</span> </pre></div> </div> <p>is translated to Python as</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">lmdef</span><span class="p">(</span><span class="n">deftype</span><span class="p">,</span> <span class="n">index</span><span class="p">,</span> <span class="n">props</span><span class="p">)</span> </pre></div> </div> </li> <li><p class="first">Output arguments are omitted from the argument list; they are transmitted as function return values instead. If more than one value must be returned, the return value is a tuple. If the C function has both a regular return value (that is not omitted because of the previous rule) and an output argument, the return value comes first in the tuple. Examples: the C call</p> <div class="highlight-python"><pre>getmcolor(i, &red, &green, &blue)</pre> </div> <p>is translated to Python as</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">red</span><span class="p">,</span> <span class="n">green</span><span class="p">,</span> <span class="n">blue</span> <span class="o">=</span> <span class="n">getmcolor</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> </pre></div> </div> </li> </ul> <p>The following functions are non-standard or have special argument conventions:</p> <dl class="function"> <dt id="gl.varray"> <tt class="descclassname">gl.</tt><tt class="descname">varray</tt><big>(</big><em>argument</em><big>)</big><a class="headerlink" href="#gl.varray" title="Permalink to this definition">¶</a></dt> <dd><p>Equivalent to but faster than a number of <tt class="docutils literal"><span class="pre">v3d()</span></tt> calls. The <em>argument</em> is a list (or tuple) of points. Each point must be a tuple of coordinates <tt class="docutils literal"><span class="pre">(x,</span> <span class="pre">y,</span> <span class="pre">z)</span></tt> or <tt class="docutils literal"><span class="pre">(x,</span> <span class="pre">y)</span></tt>. The points may be 2- or 3-dimensional but must all have the same dimension. Float and int values may be mixed however. The points are always converted to 3D double precision points by assuming <tt class="docutils literal"><span class="pre">z</span> <span class="pre">=</span> <span class="pre">0.0</span></tt> if necessary (as indicated in the man page), and for each point <tt class="docutils literal"><span class="pre">v3d()</span></tt> is called.</p> </dd></dl> <dl class="function"> <dt id="gl.nvarray"> <tt class="descclassname">gl.</tt><tt class="descname">nvarray</tt><big>(</big><big>)</big><a class="headerlink" href="#gl.nvarray" title="Permalink to this definition">¶</a></dt> <dd><p>Equivalent to but faster than a number of <tt class="docutils literal"><span class="pre">n3f</span></tt> and <tt class="docutils literal"><span class="pre">v3f</span></tt> calls. The argument is an array (list or tuple) of pairs of normals and points. Each pair is a tuple of a point and a normal for that point. Each point or normal must be a tuple of coordinates <tt class="docutils literal"><span class="pre">(x,</span> <span class="pre">y,</span> <span class="pre">z)</span></tt>. Three coordinates must be given. Float and int values may be mixed. For each pair, <tt class="docutils literal"><span class="pre">n3f()</span></tt> is called for the normal, and then <tt class="docutils literal"><span class="pre">v3f()</span></tt> is called for the point.</p> </dd></dl> <dl class="function"> <dt id="gl.vnarray"> <tt class="descclassname">gl.</tt><tt class="descname">vnarray</tt><big>(</big><big>)</big><a class="headerlink" href="#gl.vnarray" title="Permalink to this definition">¶</a></dt> <dd><p>Similar to <tt class="docutils literal"><span class="pre">nvarray()</span></tt> but the pairs have the point first and the normal second.</p> </dd></dl> <dl class="function"> <dt id="gl.nurbssurface"> <tt class="descclassname">gl.</tt><tt class="descname">nurbssurface</tt><big>(</big><em>s_k</em>, <em>t_k</em>, <em>ctl</em>, <em>s_ord</em>, <em>t_ord</em>, <em>type</em><big>)</big><a class="headerlink" href="#gl.nurbssurface" title="Permalink to this definition">¶</a></dt> <dd><p>Defines a nurbs surface. The dimensions of <tt class="docutils literal"><span class="pre">ctl[][]</span></tt> are computed as follows: <tt class="docutils literal"><span class="pre">[len(s_k)</span> <span class="pre">-</span> <span class="pre">s_ord]</span></tt>, <tt class="docutils literal"><span class="pre">[len(t_k)</span> <span class="pre">-</span> <span class="pre">t_ord]</span></tt>.</p> </dd></dl> <dl class="function"> <dt id="gl.nurbscurve"> <tt class="descclassname">gl.</tt><tt class="descname">nurbscurve</tt><big>(</big><em>knots</em>, <em>ctlpoints</em>, <em>order</em>, <em>type</em><big>)</big><a class="headerlink" href="#gl.nurbscurve" title="Permalink to this definition">¶</a></dt> <dd><p>Defines a nurbs curve. The length of ctlpoints is <tt class="docutils literal"><span class="pre">len(knots)</span> <span class="pre">-</span> <span class="pre">order</span></tt>.</p> </dd></dl> <dl class="function"> <dt id="gl.pwlcurve"> <tt class="descclassname">gl.</tt><tt class="descname">pwlcurve</tt><big>(</big><em>points</em>, <em>type</em><big>)</big><a class="headerlink" href="#gl.pwlcurve" title="Permalink to this definition">¶</a></dt> <dd><p>Defines a piecewise-linear curve. <em>points</em> is a list of points. <em>type</em> must be <tt class="docutils literal"><span class="pre">N_ST</span></tt>.</p> </dd></dl> <dl class="function"> <dt id="gl.pick"> <tt class="descclassname">gl.</tt><tt class="descname">pick</tt><big>(</big><em>n</em><big>)</big><a class="headerlink" href="#gl.pick" title="Permalink to this definition">¶</a></dt> <dt id="gl.select"> <tt class="descclassname">gl.</tt><tt class="descname">select</tt><big>(</big><em>n</em><big>)</big><a class="headerlink" href="#gl.select" title="Permalink to this definition">¶</a></dt> <dd><p>The only argument to these functions specifies the desired size of the pick or select buffer.</p> </dd></dl> <dl class="function"> <dt id="gl.endpick"> <tt class="descclassname">gl.</tt><tt class="descname">endpick</tt><big>(</big><big>)</big><a class="headerlink" href="#gl.endpick" title="Permalink to this definition">¶</a></dt> <dt id="gl.endselect"> <tt class="descclassname">gl.</tt><tt class="descname">endselect</tt><big>(</big><big>)</big><a class="headerlink" href="#gl.endselect" title="Permalink to this definition">¶</a></dt> <dd><p>These functions have no arguments. They return a list of integers representing the used part of the pick/select buffer. No method is provided to detect buffer overrun.</p> </dd></dl> <p>Here is a tiny but complete example GL program in Python:</p> <div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">gl</span><span class="o">,</span> <span class="nn">GL</span><span class="o">,</span> <span class="nn">time</span> <span class="k">def</span> <span class="nf">main</span><span class="p">():</span> <span class="n">gl</span><span class="o">.</span><span class="n">foreground</span><span class="p">()</span> <span class="n">gl</span><span class="o">.</span><span class="n">prefposition</span><span class="p">(</span><span class="mi">500</span><span class="p">,</span> <span class="mi">900</span><span class="p">,</span> <span class="mi">500</span><span class="p">,</span> <span class="mi">900</span><span class="p">)</span> <span class="n">w</span> <span class="o">=</span> <span class="n">gl</span><span class="o">.</span><span class="n">winopen</span><span class="p">(</span><span class="s">'CrissCross'</span><span class="p">)</span> <span class="n">gl</span><span class="o">.</span><span class="n">ortho2</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">400.0</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">,</span> <span class="mf">400.0</span><span class="p">)</span> <span class="n">gl</span><span class="o">.</span><span class="n">color</span><span class="p">(</span><span class="n">GL</span><span class="o">.</span><span class="n">WHITE</span><span class="p">)</span> <span class="n">gl</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span> <span class="n">gl</span><span class="o">.</span><span class="n">color</span><span class="p">(</span><span class="n">GL</span><span class="o">.</span><span class="n">RED</span><span class="p">)</span> <span class="n">gl</span><span class="o">.</span><span class="n">bgnline</span><span class="p">()</span> <span class="n">gl</span><span class="o">.</span><span class="n">v2f</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">)</span> <span class="n">gl</span><span class="o">.</span><span class="n">v2f</span><span class="p">(</span><span class="mf">400.0</span><span class="p">,</span> <span class="mf">400.0</span><span class="p">)</span> <span class="n">gl</span><span class="o">.</span><span class="n">endline</span><span class="p">()</span> <span class="n">gl</span><span class="o">.</span><span class="n">bgnline</span><span class="p">()</span> <span class="n">gl</span><span class="o">.</span><span class="n">v2f</span><span class="p">(</span><span class="mf">400.0</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">)</span> <span class="n">gl</span><span class="o">.</span><span class="n">v2f</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">400.0</span><span class="p">)</span> <span class="n">gl</span><span class="o">.</span><span class="n">endline</span><span class="p">()</span> <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> <span class="n">main</span><span class="p">()</span> </pre></div> </div> <div class="admonition-see-also admonition seealso"> <p class="first admonition-title">See also</p> <dl class="last docutils"> <dt><a class="reference external" href="http://pyopengl.sourceforge.net/">PyOpenGL: The Python OpenGL Binding</a></dt> <dd><p class="first last" id="index-0">An interface to OpenGL is also available; see information about the <strong>PyOpenGL</strong> project online at <a class="reference external" href="http://pyopengl.sourceforge.net/">http://pyopengl.sourceforge.net/</a>. This may be a better option if support for SGI hardware from before about 1996 is not required.</p> </dd> </dl> </div> </div> <div class="section" id="module-DEVICE"> <span id="device-constants-used-with-the-gl-module"></span><h1>38.9. <a class="reference internal" href="#module-DEVICE" title="DEVICE: Constants used with the gl module. (deprecated) (IRIX)"><tt class="xref py py-mod docutils literal"><span class="pre">DEVICE</span></tt></a> — Constants used with the <a class="reference internal" href="#module-gl" title="gl: Functions from the Silicon Graphics Graphics Library. (deprecated) (IRIX)"><tt class="xref py py-mod docutils literal"><span class="pre">gl</span></tt></a> module<a class="headerlink" href="#module-DEVICE" title="Permalink to this headline">¶</a></h1> <p class="deprecated"> <span class="versionmodified">Deprecated since version 2.6: </span>The <a class="reference internal" href="#module-DEVICE" title="DEVICE: Constants used with the gl module. (deprecated) (IRIX)"><tt class="xref py py-mod docutils literal"><span class="pre">DEVICE</span></tt></a> module has been removed in Python 3.</p> <p>This modules defines the constants used by the Silicon Graphics <em>Graphics Library</em> that C programmers find in the header file <tt class="docutils literal"><span class="pre"><gl/device.h></span></tt>. Read the module source file for details.</p> </div> <div class="section" id="module-GL"> <span id="gl-constants-used-with-the-gl-module"></span><h1>38.10. <a class="reference internal" href="#module-GL" title="GL: Constants used with the gl module. (deprecated) (IRIX)"><tt class="xref py py-mod docutils literal"><span class="pre">GL</span></tt></a> — Constants used with the <a class="reference internal" href="#module-gl" title="gl: Functions from the Silicon Graphics Graphics Library. (deprecated) (IRIX)"><tt class="xref py py-mod docutils literal"><span class="pre">gl</span></tt></a> module<a class="headerlink" href="#module-GL" title="Permalink to this headline">¶</a></h1> <p class="deprecated"> <span class="versionmodified">Deprecated since version 2.6: </span>The <a class="reference internal" href="#module-GL" title="GL: Constants used with the gl module. (deprecated) (IRIX)"><tt class="xref py py-mod docutils literal"><span class="pre">GL</span></tt></a> module has been removed in Python 3.</p> <p>This module contains constants used by the Silicon Graphics <em>Graphics Library</em> from the C header file <tt class="docutils literal"><span class="pre"><gl/gl.h></span></tt>. Read the module source file for details.</p> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../contents.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">38.8. <tt class="docutils literal"><span class="pre">gl</span></tt> — <em>Graphics Library</em> interface</a></li> <li><a class="reference internal" href="#module-DEVICE">38.9. <tt class="docutils literal"><span class="pre">DEVICE</span></tt> — Constants used with the <tt class="docutils literal"><span class="pre">gl</span></tt> module</a></li> <li><a class="reference internal" href="#module-GL">38.10. <tt class="docutils literal"><span class="pre">GL</span></tt> — Constants used with the <tt class="docutils literal"><span class="pre">gl</span></tt> module</a></li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="fm.html" title="previous chapter">38.7. <tt class="docutils literal"><span class="pre">fm</span></tt> — <em>Font Manager</em> interface</a></p> <h4>Next topic</h4> <p class="topless"><a href="imgfile.html" title="next chapter">38.11. <tt class="docutils literal"><span class="pre">imgfile</span></tt> — Support for SGI imglib files</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../bugs.html">Report a Bug</a></li> <li><a href="../_sources/library/gl.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="imgfile.html" title="38.11. imgfile — Support for SGI imglib files" >next</a> |</li> <li class="right" > <a href="fm.html" title="38.7. fm — Font Manager interface" >previous</a> |</li> <li><img src="../_static/py.png" alt="" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="http://www.python.org/">Python</a> »</li> <li> <a href="../index.html">Python 2.7.5 documentation</a> » </li> <li><a href="index.html" >The Python Standard Library</a> »</li> <li><a href="sgi.html" >38. SGI IRIX Specific Services</a> »</li> </ul> </div> <div class="footer"> © <a href="../copyright.html">Copyright</a> 1990-2020, Python Software Foundation. <br /> The Python Software Foundation is a non-profit corporation. <a href="http://www.python.org/psf/donations/">Please donate.</a> <br /> Last updated on Oct 13, 2020. <a href="../bugs.html">Found a bug</a>? <br /> Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3. </div> </body> </html>