[PyKDE] QGLWidget rendering problems

Phil Thompson phil at riverbankcomputing.co.uk
Wed Dec 17 19:42:01 GMT 2003


On Wednesday 17 December 2003 4:05 pm, Tom Badran wrote:
> 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.

What type is expected by glTexImage2D()? The handling of the sip.voidptr type 
has been discussed before - but I'm not clear what type you need it 
converting to.

Phil




More information about the PyQt mailing list