Mpi wrote:
> Suppose I have
>
> indices = [[0, 4, 1, 5, 2, 6, 3, 7],
> [4, 8, 5, 9, 6, 10, 7, 11]]
> glMultiDrawElements(GL_QUAD_STRIP, 8, GL_UNSIGNED_BYTE, indices, 1)
>
> I get the error
>
> ArgumentError: argument 4: <type 'exceptions.TypeError'>: expected
> LP_c_void_p instance instead of list
>
> Any clues regarding how to set up a pointer to the list of indices and pass
> this to glMultiDrawElements?
>
There's currently no Pythonic wrapper around the method (I don't have
any hardware with the functionality to test it). The wrapper to get it
working would look something like this:
glMultiDrawElements = wrapper.wrapper( glMultiDrawElements ).setPyConverter(
'indices', arrays.AsArrayOfType( 'indices', 'type' ),
).setCResolver(
'indices', arrays.ArrayDatatype.voidDataPointer ,
).setPyConverter(
'count', arrays.AsArrayTyped( 'count', arrays.GLsizeiArray ),
).setCResolver(
'count', arrays.ArrayDatatype.voidDataPointer ,
)
put into OpenGL/GL/VERSION/GL_1_4.py
However, it should be noted that it would only work by chance with your
call, as the "count" parameter is an array. PyOpenGL supports passing a
single integer as an array and you have specified 1 as your primcount
and *happen* to have a uniform multi-dimensional array. The above
wrapper is assuming that you normally have a single-dimensional
data-type for indices and count. If you happened to have a non-uniform
indices set (which is AFAICS the whole point of the function) you'd blow
up trying to convert the indices set.
That is, normally indices would be expected to be a single array of
index values. The choices array would then control iteration over that
array. The reason I wouldn't likely relax that is that the resulting
code would have to copy the values from each individual sub-array into a
contiguous array for passing to the function.
I've added the wrapper shown above to current bzr trunk. If you're
willing, please try the wrapper and see if it works for you.
Thanks,
Mike
--
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com
|