[PySide] total n00b question about hellogl geometry hookup

Dave Curtis davecurtis at sonic.net
Mon Nov 12 07:02:01 CET 2012


Hello,

I am a total n00b with OpenGL, and still very new to Qt/pyside as well, 
so this question is very basic, but every time I dive into the 
documentation I go down a rabbit hole and get lost in the sheer mass of it.

I am trying to modify the hellogl.py example found here:
http://qt.gitorious.org/pyside/pyside-examples/blobs/master/examples/opengl/hellogl.py

My geometry is coming from a new Python module called pyPolyCSG
https://github.com/jamesgregson/pyPolyCSG
which does constructive solid geometry.

My goal is to create a mesh using pyPolyCSG, and render that in place of 
the Qt logo in the hellogl example.  pyPolyCSG has these methods for 
extracting geometry:

obj.get_vertices() - returns vertex coordinates as a 2D numpy array
obj.get_triangles() - temporarily triangulates the mesh and returns a 2D 
numpy array of triangle vertex ids

and so I have gotten as far as creating nice numpy arrays of vertices 
and triangles of the object I want to render.  And of course, I can 
easily gut out the Qt logo construction code from hellogl.py :)  My 
problem is that I just can't seem to connect the dots here... given that 
I have a nice batch of vertices and triangles, how can I get that hooked 
up to OpenGL rendering?

Thanks,
   Dave




More information about the PySide mailing list