2 :mod:`gl` --- *Graphics Library* interface
3 ==========================================
7 :synopsis: Functions from the Silicon Graphics Graphics Library.
12 The :mod:`gl` module has been deprecated for removal in Python 3.0.
15 This module provides access to the Silicon Graphics *Graphics Library*. It is
16 available only on Silicon Graphics machines.
20 Some illegal calls to the GL library cause the Python interpreter to dump core.
21 In particular, the use of most GL calls is unsafe before the first window is
24 The module is too large to document here in its entirety, but the following
25 should help you to get started. The parameter conventions for the C functions
26 are translated to Python as follows:
28 * All (short, long, unsigned) int values are represented by Python integers.
30 * All float and double values are represented by Python floating point numbers.
31 In most cases, Python integers are also allowed.
33 * All arrays are represented by one-dimensional Python lists. In most cases,
34 tuples are also allowed.
36 * All string and character arguments are represented by Python strings, for
37 instance, ``winopen('Hi There!')`` and ``rotate(900, 'z')``.
39 * All (short, long, unsigned) integer arguments or return values that are only
40 used to specify the length of an array argument are omitted. For example, the C
43 lmdef(deftype, index, np, props)
45 is translated to Python as ::
47 lmdef(deftype, index, props)
49 * Output arguments are omitted from the argument list; they are transmitted as
50 function return values instead. If more than one value must be returned, the
51 return value is a tuple. If the C function has both a regular return value (that
52 is not omitted because of the previous rule) and an output argument, the return
53 value comes first in the tuple. Examples: the C call ::
55 getmcolor(i, &red, &green, &blue)
57 is translated to Python as ::
59 red, green, blue = getmcolor(i)
61 The following functions are non-standard or have special argument conventions:
64 .. function:: varray(argument)
66 Equivalent to but faster than a number of ``v3d()`` calls. The *argument* is a
67 list (or tuple) of points. Each point must be a tuple of coordinates ``(x, y,
68 z)`` or ``(x, y)``. The points may be 2- or 3-dimensional but must all have the
69 same dimension. Float and int values may be mixed however. The points are always
70 converted to 3D double precision points by assuming ``z = 0.0`` if necessary (as
71 indicated in the man page), and for each point ``v3d()`` is called.
73 .. XXX the argument-argument added
76 .. function:: nvarray()
78 Equivalent to but faster than a number of ``n3f`` and ``v3f`` calls. The
79 argument is an array (list or tuple) of pairs of normals and points. Each pair
80 is a tuple of a point and a normal for that point. Each point or normal must be
81 a tuple of coordinates ``(x, y, z)``. Three coordinates must be given. Float and
82 int values may be mixed. For each pair, ``n3f()`` is called for the normal, and
83 then ``v3f()`` is called for the point.
86 .. function:: vnarray()
88 Similar to ``nvarray()`` but the pairs have the point first and the normal
92 .. function:: nurbssurface(s_k, t_k, ctl, s_ord, t_ord, type)
94 Defines a nurbs surface. The dimensions of ``ctl[][]`` are computed as follows:
95 ``[len(s_k) - s_ord]``, ``[len(t_k) - t_ord]``.
97 .. XXX s_k[], t_k[], ctl[][]
100 .. function:: nurbscurve(knots, ctlpoints, order, type)
102 Defines a nurbs curve. The length of ctlpoints is ``len(knots) - order``.
105 .. function:: pwlcurve(points, type)
107 Defines a piecewise-linear curve. *points* is a list of points. *type* must be
111 .. function:: pick(n)
114 The only argument to these functions specifies the desired size of the pick or
118 .. function:: endpick()
121 These functions have no arguments. They return a list of integers representing
122 the used part of the pick/select buffer. No method is provided to detect buffer
125 Here is a tiny but complete example GL program in Python::
131 gl.prefposition(500, 900, 500, 900)
132 w = gl.winopen('CrissCross')
133 gl.ortho2(0.0, 400.0, 0.0, 400.0)
152 `PyOpenGL: The Python OpenGL Binding <http://pyopengl.sourceforge.net/>`_
157 An interface to OpenGL is also available; see information about the **PyOpenGL**
158 project online at http://pyopengl.sourceforge.net/. This may be a better option
159 if support for SGI hardware from before about 1996 is not required.
162 :mod:`DEVICE` --- Constants used with the :mod:`gl` module
163 ==========================================================
167 :synopsis: Constants used with the gl module.
172 The :mod:`DEVICE` module has been deprecated for removal in Python 3.0.
175 This modules defines the constants used by the Silicon Graphics *Graphics
176 Library* that C programmers find in the header file ``<gl/device.h>``. Read the
177 module source file for details.
180 :mod:`GL` --- Constants used with the :mod:`gl` module
181 ======================================================
185 :synopsis: Constants used with the gl module.
190 The :mod:`GL` module has been deprecated for removal in Python 3.0.
192 This module contains constants used by the Silicon Graphics *Graphics Library*
193 from the C header file ``<gl/gl.h>``. Read the module source file for details.