1 \section{\module{gl
} ---
2 \emph{Graphics Library
} interface
}
4 \declaremodule{builtin
}{gl
}
6 \modulesynopsis{Functions from the Silicon Graphics
\emph{Graphics Library
}.
}
9 This module provides access to the Silicon Graphics
10 \emph{Graphics Library
}.
11 It is available only on Silicon Graphics machines.
14 Some illegal calls to the GL library cause the Python interpreter to dump
16 In particular, the use of most GL calls is unsafe before the first
19 The module is too large to
document here in its entirety, but the
20 following should help you to get started.
21 The parameter conventions for the C functions are translated to Python as
26 All (short, long, unsigned) int values are represented by Python
29 All float and double values are represented by Python floating point
31 In most cases, Python integers are also allowed.
33 All arrays are represented by one-dimensional Python lists.
34 In most cases, tuples are also allowed.
37 All string and character arguments are represented by Python strings,
39 \code{winopen('Hi There!')
}
41 \code{rotate(
900, 'z')
}.
44 All (short, long, unsigned) integer arguments or return values that are
45 only used to specify the length of an array argument are omitted.
46 For example, the C call
49 lmdef(deftype, index, np, props)
52 is translated to Python as
55 lmdef(deftype, index, props)
59 Output arguments are omitted from the argument list; they are
60 transmitted as function return values instead.
61 If more than one value must be returned, the return value is a tuple.
62 If the C function has both a regular return value (that is not omitted
63 because of the previous rule) and an output argument, the return value
64 comes first in the tuple.
68 getmcolor(i, &red, &green, &blue)
71 is translated to Python as
74 red, green, blue = getmcolor(i)
79 The following functions are non-standard or have special argument
82 \begin{funcdesc
}{varray
}{argument
}
83 %JHXXX the argument-argument added
84 Equivalent to but faster than a number of
87 The
\var{argument
} is a list (or tuple) of points.
88 Each point must be a tuple of coordinates
89 \code{(
\var{x
},
\var{y
},
\var{z
})
} or
\code{(
\var{x
},
\var{y
})
}.
90 The points may be
2- or
3-dimensional but must all have the
92 Float and int values may be mixed however.
93 The points are always converted to
3D double precision points
94 by assuming
\code{\var{z
} =
0.0} if necessary (as indicated in the man page),
100 \begin{funcdesc
}{nvarray
}{}
101 Equivalent to but faster than a number of
106 The argument is an array (list or tuple) of pairs of normals and points.
107 Each pair is a tuple of a point and a normal for that point.
108 Each point or normal must be a tuple of coordinates
109 \code{(
\var{x
},
\var{y
},
\var{z
})
}.
110 Three coordinates must be given.
111 Float and int values may be mixed.
114 is called for the normal, and then
116 is called for the point.
119 \begin{funcdesc
}{vnarray
}{}
122 but the pairs have the point first and the normal second.
125 \begin{funcdesc
}{nurbssurface
}{s_k, t_k, ctl, s_ord, t_ord, type
}
126 % XXX s_k[], t_k[], ctl[][]
127 Defines a nurbs surface.
130 are computed as follows:
131 \code{[len(
\var{s_k
}) -
\var{s_ord
}]},
132 \code{[len(
\var{t_k
}) -
\var{t_ord
}]}.
135 \begin{funcdesc
}{nurbscurve
}{knots, ctlpoints, order, type
}
136 Defines a nurbs curve.
137 The length of ctlpoints is
138 \code{len(
\var{knots
}) -
\var{order
}}.
141 \begin{funcdesc
}{pwlcurve
}{points, type
}
142 Defines a piecewise-linear curve.
150 \begin{funcdesc
}{pick
}{n
}
152 The only argument to these functions specifies the desired size of the
153 pick or select buffer.
156 \begin{funcdesc
}{endpick
}{}
157 \funcline{endselect
}{}
158 These functions have no arguments.
159 They return a list of integers representing the used part of the
161 No method is provided to detect buffer overrun.
164 Here is a tiny but complete example GL program in Python:
171 gl.prefposition(
500,
900,
500,
900)
172 w = gl.winopen('CrissCross')
173 gl.ortho2(
0.0,
400.0,
0.0,
400.0)
192 \seetext{An interface to OpenGL
\index{OpenGL
} is also available; see
193 information about David Ascher's
\index{Ascher, David
}
194 \strong{PyOpenGL
}\index{PyOpenGL
} online at
195 \url{http://starship.python.net/crew/da/PyOpenGL/
}. This may
196 be a better option if support for SGI hardware from before about
197 1996 is not required.
}
201 \section{\module{DEVICE
} ---
202 Constants used with the
\module{gl
} module
}
204 \declaremodule{standard
}{DEVICE
}
206 \modulesynopsis{Constants used with the
\module{gl
} module.
}
208 This modules defines the constants used by the Silicon Graphics
209 \emph{Graphics Library
} that C programmers find in the header file
210 \code{<gl/device.h>
}.
211 Read the module source file for details.
214 \section{\module{GL
} ---
215 Constants used with the
\module{gl
} module
}
217 \declaremodule[gl-constants
]{standard
}{GL
}
219 \modulesynopsis{Constants used with the
\module{gl
} module.
}
221 This module contains constants used by the Silicon Graphics
222 \emph{Graphics Library
} from the C header file
\code{<gl/gl.h>
}.
223 Read the module source file for details.