<!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
<link rel=
"STYLESHEET" href=
"lib.css" type='text/css'
/>
<link rel=
"SHORTCUT ICON" href=
"../icons/pyfav.png" type=
"image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index'
/>
<link rel=
"first" href=
"lib.html" title='Python Library Reference'
/>
<link rel='contents' href='contents.html'
title=
"Contents" />
<link rel='index' href='genindex.html' title='Index'
/>
<link rel='last' href='about.html' title='About this document...'
/>
<link rel='help' href='about.html' title='About this document...'
/>
<link rel=
"next" href=
"module-DEVICE.html" />
<link rel=
"prev" href=
"module-fm.html" />
<link rel=
"parent" href=
"sgi.html" />
<link rel=
"next" href=
"module-DEVICE.html" />
<meta name='aesop' content='information'
/>
<title>20.8 gl -- Graphics Library interface
</title>
<div id='top-navigation-panel' xml:id='top-navigation-panel'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"20.7 fm "
href=
"module-fm.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"20. SGI IRIX Specific"
href=
"sgi.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"20.9 DEVICE "
href=
"module-DEVICE.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Python Library Reference
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"module-fm.html">20.7 fm
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"sgi.html">20. SGI IRIX Specific
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"module-DEVICE.html">20.9 DEVICE
</A>
<!--End of Navigation Panel-->
<H1><A NAME=
"SECTION0022800000000000000000">
20.8 <tt class=
"module">gl
</tt> --
<em>Graphics Library
</em> interface
</A>
<p class=
"availability">Availability:
<span
class=
"platform">IRIX
</span>.
</p>
This module provides access to the Silicon Graphics
<em>Graphics Library
</em>.
It is available only on Silicon Graphics machines.
<span class=
"warning"><b class=
"label">Warning:
</b>
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
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
<LI>All (short, long, unsigned) int values are represented by Python
<LI>All float and double values are represented by Python floating point
In most cases, Python integers are also allowed.
<LI>All arrays are represented by one-dimensional Python lists.
In most cases, tuples are also allowed.
<LI>All string and character arguments are represented by Python strings,
<code>winopen('Hi There!')
</code>
<code>rotate(
900, 'z')
</code>.
<LI>All (short, long, unsigned) integer arguments or return values that are
only used to specify the length of an array argument are omitted.
<div class=
"verbatim"><pre>
lmdef(deftype, index, np, props)
is translated to Python as
<div class=
"verbatim"><pre>
lmdef(deftype, index, props)
<LI>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.
<div class=
"verbatim"><pre>
getmcolor(i,
&red,
&green,
&blue)
is translated to Python as
<div class=
"verbatim"><pre>
red, green, blue = getmcolor(i)
The following functions are non-standard or have special argument
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5192' xml:id='l2h-
5192'
class=
"function">varray
</tt></b>(
</nobr></td>
<td><var>argument
</var>)
</td></tr></table></dt>
Equivalent to but faster than a number of
The
<var>argument
</var> is a list (or tuple) of points.
Each point must be a tuple of coordinates
<code>(
<var>x
</var>,
<var>y
</var>,
<var>z
</var>)
</code> or
<code>(
<var>x
</var>,
<var>y
</var>)
</code>.
The points may be
2- or
3-dimensional but must all have the
Float and int values may be mixed however.
The points are always converted to
3D double precision points
by assuming
<code><var>z
</var> =
0.0</code> if necessary (as indicated in the man page),
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5193' xml:id='l2h-
5193'
class=
"function">nvarray
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Equivalent to but faster than a number of
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
<code>(
<var>x
</var>,
<var>y
</var>,
<var>z
</var>)
</code>.
Three coordinates must be given.
Float and int values may be mixed.
is called for the normal, and then
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5194' xml:id='l2h-
5194'
class=
"function">vnarray
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
but the pairs have the point first and the normal second.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5195' xml:id='l2h-
5195'
class=
"function">nurbssurface
</tt></b>(
</nobr></td>
<td><var>s_k, t_k, ctl, s_ord, t_ord, type
</var>)
</td></tr></table></dt>
<code><var>ctl
</var>[][]
</code>
<code>[len(
<var>s_k
</var>) -
<var>s_ord
</var>]
</code>,
<code>[len(
<var>t_k
</var>) -
<var>t_ord
</var>]
</code>.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5196' xml:id='l2h-
5196'
class=
"function">nurbscurve
</tt></b>(
</nobr></td>
<td><var>knots, ctlpoints, order, type
</var>)
</td></tr></table></dt>
The length of ctlpoints is
<code>len(
<var>knots
</var>) -
<var>order
</var></code>.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5197' xml:id='l2h-
5197'
class=
"function">pwlcurve
</tt></b>(
</nobr></td>
<td><var>points, type
</var>)
</td></tr></table></dt>
Defines a piecewise-linear curve.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5198' xml:id='l2h-
5198'
class=
"function">pick
</tt></b>(
</nobr></td>
<td><var>n
</var>)
</td></tr></table></dt>
<dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt class=
"function">select
</tt></b>(
</nobr></td>
<td><var>n
</var>)
</td></tr></table></dt>
<dd>The only argument to these functions specifies the desired size of the
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
5200' xml:id='l2h-
5200'
class=
"function">endpick
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
<dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt class=
"function">endselect
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
<dd>These functions have no arguments.
They return a list of integers representing the used part of the
No method is provided to detect buffer overrun.
Here is a tiny but complete example GL program in Python:
<div class=
"verbatim"><pre>
gl.prefposition(
500,
900,
500,
900)
w = gl.winopen('CrissCross')
gl.ortho2(
0.0,
400.0,
0.0,
400.0)
<p class=
"heading">See Also:
</p>
<dl compact=
"compact" class=
"seetitle">
<dt><em class=
"citetitle"><a href=
"http://pyopengl.sourceforge.net/"
>PyOpenGL: The Python OpenGL Binding
</a></em></dt>
<dd>An interface to OpenGL
<a id='l2h-
5202' xml:id='l2h-
5202'
></a> is also available;
see information about the
<strong>PyOpenGL
</strong><a id='l2h-
5203' xml:id='l2h-
5203'
></a> project online at
<a class=
"url" 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.
</dd>
<div class='online-navigation'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"20.7 fm "
href=
"module-fm.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"20. SGI IRIX Specific"
href=
"sgi.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"20.9 DEVICE "
href=
"module-DEVICE.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Python Library Reference
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"module-fm.html">20.7 fm
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"sgi.html">20. SGI IRIX Specific
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"module-DEVICE.html">20.9 DEVICE
</A>
<span class=
"release-info">Release
2.4.2, documentation updated on
28 September
2005.
</span>
<!--End of Navigation Panel-->
See
<i><a href=
"about.html">About this document...
</a></i> for information on suggesting changes.