[PySide] PySide and OpenGL

Tim Doty thoromyr at mac.com
Fri Aug 30 00:58:08 CEST 2013


I'm working on a pyside application that will use OpenGL to display a mesh. I'm new to OpenGL, but there are a variety of tutorials online to help with that. However, there's precious little dealing with PySide.

I can make things "work" by putting the mesh information in the paintGL() function, but that seems very ugly and likely to be slow -- particularly with a real mesh of several thousand (or many more) polygons.

It looked like glGenLists was the solution to the problem, but using it results in an error. Specifically, the code between glBegin() and glEnd() that works in the paintGL() function causes an error* when called elsewhere. If the code is called in __init__() or initializeGL() (in either case as the final call in the function) an error occurs at glEnd() and the list is never populated so nothing is drawn.

I'm missing something, obviously.

The error is as follows and I've attached the (somewhat) minimal file that demonstrates the problem.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reduced.py
Type: text/x-python-script
Size: 4379 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20130829/af44824f/attachment.bin>
-------------- next part --------------


Traceback (most recent call last):
  File "./reduced.py", line 68, in initializeGL
    self.mesh = self.makeObject()
  File "./reduced.py", line 106, in makeObject
    glEnd()
  File "/Library/Python/2.7/site-packages/OpenGL/latebind.py", line 61, in __call__
    return self.wrapperFunction( self.baseFunction, *args, **named )
  File "/Library/Python/2.7/site-packages/OpenGL/GL/exceptional.py", line 57, in glEnd
    return baseFunction( )
  File "/Library/Python/2.7/site-packages/OpenGL/error.py", line 208, in glCheckError
    baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
	err = 1286,
	description = 'invalid framebuffer operation',
	baseOperation = glEnd,
	cArguments = ()
)




More information about the PySide mailing list