passing Numeric arrays to PyOpenGL

TheDustbustr thedustbustr at aol.com
Sun May 11 16:29:41 EDT 2003


Here's the code.

VertexArray=[[0,0,0],[1,0,0],[2,0,0],
             [0,1,0],[1,1,0],[2,1,0],
             [0,2,0],[1,2,0],[2,2,0]]
IndiceArray=[0,3,4,0,4,1,1,4,5,1,5,2,3,6,7,3,7,4,4,7,8,4,8,5]

#VertexArray=array(VertexArray, 'f')    #Here's the problem line
IndiceArray=array(IndiceArray, 'i')

glVertexPointerf(VertexArray)
glDrawElementsui(GL_TRIANGLES, IndiceArray)

With the noted line commented, a Python list is passed to glVertexPointer, and
everything is dandy.  When the noted line is uncommented, nothing is drawn.  No
Numeric errors.

Whats the deal here?  Why isn't IndiceArray affected by being converted to an
array, and why IS VertexArray affected?

Thanks, Dustin




More information about the Python-list mailing list