[Bf-python] BGL docs

Willian Padovani Germano wgermano at ig.com.br
Mon Oct 20 16:10:45 CEST 2003


> Here's a rough draft of my attempt to document the BGL module.

Hey, thanks Joseph, you're a brave man! : )

Once you're happy with it please commit.  We should have a new release of
the ref docs for Blender 2.30 in +- two weeks.

> There is a class in BGL called buffer. The class only has one funtion
called
> buffer.  I couldn't figure out why this is there, but I have an idea.
Alot
> of the OpenGL commands require a void*  to put data into - a sort of empty
> container. I was thinking that the purpose of the buffer was for handling
> pointer type notation in python.

Yes.  Buffer is a "helper" type, like NMVert, NMCol, NMFace, rgbTuple, Bone,
etc.  It wraps an array of user defined type (int, float, etc).  With its
methods  you can treat this array as a pylist/tuple/sequence, aka:
buffer[n] = value
slice = buffer[3:200], etc.

This is, of course, for faster access with smaller mem footprint -- you get
direct access to the C array, things are not wrapped (and later unwrapped)
unless needed.

Currently only BGL uses it, but as one guy mentioned in the blender python
forum, for example, it can be useful for direct pixel access in Image, among
other things.

--
Willian, wgermano at ig.com.br





More information about the Bf-python mailing list