[PyKDE] QGLWidget rendering problems

Tom Badran tb100 at doc.ic.ac.uk
Wed Dec 17 17:10:01 GMT 2003


I have a widget that inherits from QGLWidget which is basically for drawing an 
image to the screen. I override the paintGL method in order to be able to 
draw, and it contains only the following code:

tex = QGLWidget.convertToGLFormat(self.imageData)
glTexImage2D(GL_TEXTURE_2D, 0, 3, tex.width(), tex.height(), 0, GL_RGBA, 
GL_UNSIGNED_BYTE, tex.bits() )

self.imageData is a QImage object created in the constructor. I also have 
'from OpenGL.GL import *' otherwise glTexImage2D doesnt exist. This gives me 
the following non descriptive error:

 File "/home/tb100/development/wizard/src/imagedisplay.py", line 61, in 
paintGL
    glTexImage2D(GL_TEXTURE_2D, 0, 3, tex.width(), tex.height(), 0, GL_RGBA, 
GL_UNSIGNED_BYTE, tex.bits() )
ValueError: expect source sequence

This is basically copied from the documentation of QGLWidget so i assumed it 
would work ok. I have no idea what to do, any pointers would be brilliant.

Thanks

Tom




More information about the PyQt mailing list