Availability: IRIX.
This module provides access to the Silicon Graphics Graphics Library. It is available only on Silicon Graphics machines.
Warning: 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.
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:
lmdef(deftype, index, np, props)
is translated to Python as
lmdef(deftype, index, props)
getmcolor(i, &red, &green, &blue)
is translated to Python as
red, green, blue = getmcolor(i)
The following functions are non-standard or have special argument conventions:
Here is a tiny but complete example GL program in Python:
import gl, GL, time def main(): gl.foreground() gl.prefposition(500, 900, 500, 900) w = gl.winopen('CrissCross') gl.ortho2(0.0, 400.0, 0.0, 400.0) gl.color(GL.WHITE) gl.clear() gl.color(GL.RED) gl.bgnline() gl.v2f(0.0, 0.0) gl.v2f(400.0, 400.0) gl.endline() gl.bgnline() gl.v2f(400.0, 0.0) gl.v2f(0.0, 400.0) gl.endline() time.sleep(5) main()
See Also:
An interface to OpenGL is also available; see information about David Ascher's PyOpenGL online at http://starship.python.net/crew/da/PyOpenGL/. This may be a better option if support for SGI hardware from before about 1996 is not required.