[PyQt] some bugs in opengl examples

Francis Cho geburstag at gmail.com
Wed May 27 02:47:23 BST 2009


Hello,

I found some bugs in opengl examples.

1. Wrong conversion of the original C++ code.

It is in grabber.py.
I changed as following to get the correct behavior.

FROM
 def resizeGL(self, height, width):
TO
 def resizeGL(self, width, height):

Before changing the code like the above, the opengl widget portion of the
window couldn't be shrinked or enlarged correctly.
>From the original C++ code, we can see that the modified is correct.

2. OpenGL related error message from grabber.py, hellogl.py and textures.py
on mac osx.

I got the following OpenGL related error message from the above three files
on mac osx only.

Traceback (most recent call last):
  File "grabber.py", line 131, in resizeGL
    glViewport((width - side) / 2, (height - side) / 2, side, side)
  File "/Library/Python/2.5/site-packages/OpenGL/error.py", line 194, in
glCheckError
    baseOperation = baseOperation,
OpenGL.error.GLError: GLError(
        err = 1281,
        description = 'invalid value',
        baseOperation = glViewport,
        cArguments = (0, 0, -1, -1)
)

I inserted a line to see the value of width and height in resizeGL and I
could notice that the resizeGL was called twice.

francis-macbook-pro:opengl ycc$ python grabber.py 2>/dev/null
-1 0
179 164

As you can see from above, the first line contains strange values.
So, I entered the following two lines right after "def resizeGL..." as a
workarround.

        if height < 0 or width < 0:
                return

This was not happened with some old snapshots.
I forgot the specific name of the snapshots.


Thanks,

Francis Cho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090527/5c4768a6/attachment.html


More information about the PyQt mailing list