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.
13 \warning{Some illegal calls to the GL library cause the Python
14 interpreter to dump core.
15 In particular, the use of most GL calls is unsafe before the first
18 The module is too large to
document here in its entirety, but the
19 following should help you to get started.
20 The parameter conventions for the C functions are translated to Python as
25 All (short, long, unsigned) int values are represented by Python
28 All float and double values are represented by Python floating point
30 In most cases, Python integers are also allowed.
32 All arrays are represented by one-dimensional Python lists.
33 In most cases, tuples are also allowed.
36 All string and character arguments are represented by Python strings,
38 \code{winopen('Hi There!')
}
40 \code{rotate(
900, 'z')
}.
43 All (short, long, unsigned) integer arguments or return values that are
44 only used to specify the length of an array argument are omitted.
45 For example, the C call
48 lmdef(deftype, index, np, props)
51 is translated to Python as
54 lmdef(deftype, index, props)
58 Output arguments are omitted from the argument list; they are
59 transmitted as function return values instead.
60 If more than one value must be returned, the return value is a tuple.
61 If the C function has both a regular return value (that is not omitted
62 because of the previous rule) and an output argument, the return value
63 comes first in the tuple.
67 getmcolor(i, &red, &green, &blue)
70 is translated to Python as
73 red, green, blue = getmcolor(i)
78 The following functions are non-standard or have special argument
81 \begin{funcdesc
}{varray
}{argument
}
82 %JHXXX the argument-argument added
83 Equivalent to but faster than a number of
86 The
\var{argument
} is a list (or tuple) of points.
87 Each point must be a tuple of coordinates
88 \code{(
\var{x
},
\var{y
},
\var{z
})
} or
\code{(
\var{x
},
\var{y
})
}.
89 The points may be
2- or
3-dimensional but must all have the
91 Float and int values may be mixed however.
92 The points are always converted to
3D double precision points
93 by assuming
\code{\var{z
} =
0.0} if necessary (as indicated in the man page),
99 \begin{funcdesc
}{nvarray
}{}
100 Equivalent to but faster than a number of
105 The argument is an array (list or tuple) of pairs of normals and points.
106 Each pair is a tuple of a point and a normal for that point.
107 Each point or normal must be a tuple of coordinates
108 \code{(
\var{x
},
\var{y
},
\var{z
})
}.
109 Three coordinates must be given.
110 Float and int values may be mixed.
113 is called for the normal, and then
115 is called for the point.
118 \begin{funcdesc
}{vnarray
}{}
121 but the pairs have the point first and the normal second.
124 \begin{funcdesc
}{nurbssurface
}{s_k, t_k, ctl, s_ord, t_ord, type
}
125 % XXX s_k[], t_k[], ctl[][]
126 Defines a nurbs surface.
129 are computed as follows:
130 \code{[len(
\var{s_k
}) -
\var{s_ord
}]},
131 \code{[len(
\var{t_k
}) -
\var{t_ord
}]}.
134 \begin{funcdesc
}{nurbscurve
}{knots, ctlpoints, order, type
}
135 Defines a nurbs curve.
136 The length of ctlpoints is
137 \code{len(
\var{knots
}) -
\var{order
}}.
140 \begin{funcdesc
}{pwlcurve
}{points, type
}
141 Defines a piecewise-linear curve.
149 \begin{funcdesc
}{pick
}{n
}
151 The only argument to these functions specifies the desired size of the
152 pick or select buffer.
155 \begin{funcdesc
}{endpick
}{}
156 \funcline{endselect
}{}
157 These functions have no arguments.
158 They return a list of integers representing the used part of the
160 No method is provided to detect buffer overrun.
163 Here is a tiny but complete example GL program in Python:
170 gl.prefposition(
500,
900,
500,
900)
171 w = gl.winopen('CrissCross')
172 gl.ortho2(
0.0,
400.0,
0.0,
400.0)
191 \seetitle[http://pyopengl.sourceforge.net/
]
192 {PyOpenGL: The Python OpenGL Binding
}
193 {An interface to OpenGL
\index{OpenGL
} is also available;
194 see information about the
195 \strong{PyOpenGL
}\index{PyOpenGL
} project online at
196 \url{http://pyopengl.sourceforge.net/
}. This may be a
197 better option if support for SGI hardware from before
198 about
1996 is not required.
}
202 \section{\module{DEVICE
} ---
203 Constants used with the
\module{gl
} module
}
205 \declaremodule{standard
}{DEVICE
}
207 \modulesynopsis{Constants used with the
\module{gl
} module.
}
209 This modules defines the constants used by the Silicon Graphics
210 \emph{Graphics Library
} that C programmers find in the header file
211 \code{<gl/device.h>
}.
212 Read the module source file for details.
215 \section{\module{GL
} ---
216 Constants used with the
\module{gl
} module
}
218 \declaremodule[gl-constants
]{standard
}{GL
}
220 \modulesynopsis{Constants used with the
\module{gl
} module.
}
222 This module contains constants used by the Silicon Graphics
223 \emph{Graphics Library
} from the C header file
\code{<gl/gl.h>
}.
224 Read the module source file for details.