Table of Contents
Most of the functions which appear in PyOpenGL 2 are identical in calling method and functionality to that of the appropriate specification. There are a few exceptions because of the differences between C and Python. Most of these exceptions are due to the difference between C and Python in the way that they access arrays. For example, a C function like this:
void foo(int count, const int *args);
will have the Python binding:
foo(args) -> None
Also C functions which write array data to a function argument like:
void bar(int args[4]);
will have the Python binding:
bar() -> args[]
The following sections will document changes other than simple changes like the above examples. When in doubt about the Python binding for a specific function one can always check the docstring explicitly. For instance, to check the Python binding of the C function glDeleteTextures which has the C binding
void glDeleteTextures(GLsizei n, const GLuint *textures);
one could do the following from the Python prompt
>>> from OpenGL.GL import * >>> glDeleteTextures.__doc__ 'glDeleteTextures(textures[]) -> None'
Notice that the parameter n is missing from the Python prototype since this can automatically be determined from the parameter textures. Also note that the notation textures[] is used in docstrings to indicate that the textures parameter should be a Python sequence. If the textures parameter was required to be a two dimensional array than this would be indicated by textures[][]. If one of the array dimensions is expected to have a fixed size than this will be indicated by a number enclosed in the brackets. For instance, glePolyCone of the GLE module has the prototype
glePolyCone(point_array[][3], color_array[][3], radius_array[]) -> None
Of course in many Python IDEs the first line of the function docstring will be displayed in a tool-tip when you type the function name in a Python script. Another way to see all the functions, attributes, or docstrings of a specific module is to use the pydoc utility. Python 2.1 includes this utility. For other versions of Python see Ka-Ping Lee's Python Things.