__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 (int) - The format to store data in. The type should be one of GL_BYTE,
GL_SHORT, GL_INT, or GL_FLOAT.
dimensions (An int or sequence object specifying the dimensions of the
buffer.) - 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 sub-item of the dimension to the left. i.e. [10,2] is a 10
element array each with 2 sub-items. [(0,0), (0,1), (1,0), (1,1),
(2,0), ...] etc.
template (A python sequence object (optional)) - 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.
- Returns: Buffer object
- The newly created buffer as a PyObject.
|