__init__(type,
dimensions,
template=None)
(Constructor)
This will create a new Buffer object for use with other BGL OpenGL
commands. Only the type of argument to store in the buffer and the
dimensions of the buffer are necessary. Buffers are zeroed by default
unless a template is supplied, in which case the buffer is initialized
to the template.
-
- Parameters:
type -
The format to store data in. The type should be one of
GL_BYTE, GL_SHORT, GL_INT, or GL_FLOAT.
(type=int)
dimensions -
If the dimensions are specified as an int a linear array will
be created for the buffer. If a sequence is passed for the
dimensions, the buffer becomes n-Dimensional, where n is equal to
the number of parameters passed in the sequence. Example: [256,2]
is a two- dimensional buffer while [256,256,4] creates a three-
dimensional buffer. You can think of each additional dimension as
a subitem of the dimension to the left. i.e. [10,2] is a 10
element array each with 2 subitems. [(0,0), (0,1), (1,0), (1,1),
(2,0), ...] etc.
(type=An int or sequence object specifying the dimensions of
the buffer.)
template -
A sequence of matching dimensions which will be used to
initialize the Buffer. If a template is not passed in all fields
will be initialized to 0.
(type=A python sequence object (optional))
- Returns:
-
The newly created buffer as a PyObject.
(type=Buffer object)
|