OpenGL_accelerate.vbo
Cython-coded VBO implementation
Classes
Instances can be passed into array-handling routines
You can check for whether VBOs are supported by accessing the implementation
attribute of the VBO, which will raise a RuntimeError if there is no available
implementation.
Attributes:
int copied -- whether we are copied to back-end yet
int created -- whether we've created a buffer yet
unsigned int buffer -- our buffer once created
object data -- our data-holding array-compatible object
target -- our resolved GL constant target
target_spec -- our (unresolved) GL constant specifier
usage -- our resolved GL constant usage
usage_spec -- our (unresolved) GL constant usage specifier
_copy_segments -- slices of data to copy to back-end
_I_ -- our implementation object
arrayType -- our reference to arraydatatype.ArrayDatatype
__add__
Add an integer to this VBO (offset)
__delitem__
x.__delitem__(y) <==> del x[y]
__enter__
Bind this buffer for use in vertex calls
__exit__
Context manager exit
__getattr__
__getattribute__
x.__getattribute__('name') <==> x.name
__init__
Initialize the VBO
- data
- array-compatible data format object
- usage
- string/GLenum constant specifying streaming usage for the VBO, normal values:
- GL_STREAM_DRAW
- updated every frame from client to card
- GL_STREAM_COPY
- read and written from card each frame
- GL_STATIC_DRAW
- just written from client (once)
- GL_STATIC_READ
- just read from client
- GL_STATIC_COPY
- read and written from client (once)
- GL_DYNAMIC_DRAW
- updated from client every once in a while
- GL_DYNAMIC_COPY
- read and written from client every once in a while
- GL_DYNAMIC_READ
- read from the client every once in a while
- target
- string/GLenum constant specifying the role for the buffer normal values:
- GL_ARRAY_BUFFER
- vertex attribute values
- GL_ELEMENT_ARRAY_BUFFER
- vertex index valuesGL_PIXEL_PACK_BUFFER/GL_PIXEL_UNPACK_BUFFER -- client-side image source/sink for image-manipulation operations.
__int__
Get our VBO id
__len__
x.__len__() <==> len(x)
__long__
x.__long__() <==> long(x)
__radd__
x.__radd__(y) <==> y+x
__setitem__
Set slice of data on the array and vbo (if copied already)
- slice
- the Python slice object determining how the data should be copied into the vbo/array
- array
- something array-compatible that will be used as the source of the data, note that the data-format will have to be the same as the internal data-array to work properly, if not, the amount of data copied will be wrong.
This is a reasonably complex operation, it has to have all sorts
of state-aware changes to correctly map the source into the low-level
OpenGL view of the buffer (which is just bytes as far as the GL
is concerned).
_copy_segments
_I_
arrayType
bind
Bind this buffer for use in vertex calls
buffer
copied
copy_data
Copy our data into the buffer on the GL side
create_buffers
Create the internal buffer(s)
created
data
delete
Delete this buffer explicitly
implementation
Retrieve our implementation reference
resolved
set_array
Update our entire array with new data
size
target
target_spec
unbind
Unbind the buffer (make normal array operations active)
usage
usage_spec
class VBOHandler(
FormatHandler
):
Offset into a VBO instance
This is just a convenience object that lets you say
vbo + integer and have the value passed as the correct
data-type instead of being interpreted as a pointer to
an integer-array of the offset.
__add__
x.__add__(y) <==> x+y
__getattr__
__getattribute__
x.__getattribute__('name') <==> x.name
__radd__
x.__radd__(y) <==> y+x
offset
vbo
class VBOOffsetHandler(
FormatHandler
):