I dont have a great test case to fiddle with it but I think this might help.

from OpenGL.raw import GL
buffer = GL.GLuint(0)
glGenBuffers(1, buffer)

Some docs
http://pyopengl.sourceforge.net/documentation/opengl_diffs.html
http://www.siafoo.net/article/58/diff?to=5&from=4


On Sun, Apr 18, 2010 at 1:15 PM, Justin Rosen <[email protected]> wrote:

> Has anyone done any in depth OpenGL with the python API?
>
> My plug-in is essentially a point cloud viewer displaying +millions of
> points.  My first implementation used display lists which is good for static
> geometry, but not so good for wanting to dial in density or using an
> interactive crop box.  The display lists need to be regenerated every time
> there's a change.
>
> My plan was to implement both vertex arrays and vertex buffer objects and
> have a toggle between display lists, vertex arrays and vertex buffer objects
> to see the performance of each.
>
> I was able to create vertex arrays using numpy.  But, I'm unable to create
> vertex buffer arrays.
>
> I'm trying to use glFT.glGenBuffersARB within a locator node with no luck.
>  glGenBuffersARB takes 2 arguments
>
> From the OpenGL 3.2 Spec
> * GenBuffers(sizei n, uint *buffers)*
> From PyOpenGL 3.0
> * glGenBuffers(GLsizei(n), GLuintArray(buffers))*
>
> No matter what I give it Maya throws the following error
>
> // Error: TypeError: file
> /Users/Justin/Documents/workspace/lidar/ptxViewer.py line 285: in method
> 'MGLFunctionTable_glGenBuffersARB', argument 3 of type 'MGLuint *' //
>
> Does anyone know how to create a MGLuint* in Maya's python?
>
> I've tried passing a few things in hopes that something would give, but to
> no avail.
>
> buffer = numpy.zeros(0, 'uint32')
> buffer = OpenMaya.MScriptUtil().asUintPtr()
> buffer = OpenMaya.MUintArray()
>
> glFT.glGenBuffersARB(1, buffer)
>
> I know this is probably doable through the C++ API, but I liked the idea of
> prototyping in python then porting it to see the performance benefits
> between the python/c++ implementations.
>
> Cheers,
> Justin
>
> --
> http://groups.google.com/group/python_inside_maya

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to