[PyQt] setting a uniform value

Phil Thompson phil at riverbankcomputing.com
Sun Aug 14 22:45:03 BST 2011


On Sun, 14 Aug 2011 13:14:20 -0700, Josh Stratton
<strattonbrazil at gmail.com> wrote:
> I'm getting type errors sending a QMatrixr4x4 to a QGLShaderProgram.
> The program was taken from a C++ version of comparable code, but I'm
> assuming I need to do something more on the pyqt side to get the value
> passed over correctly?

No.

> objToWorld = QMatrix4x4()
> flatShader.setUniformValue("objToWorld", objToWorld)
> 
> flatShader.setUniformValue("objToWorld", objToWorld)
> TypeError: arguments did not match any overloaded call:
>   QGLShaderProgram.setUniformValue(int, int): argument 1 has
> unexpected type 'str'
>   QGLShaderProgram.setUniformValue(int, float): argument 1 has
> unexpected type 'str'
>   QGLShaderProgram.setUniformValue(int, float, float): argument 1 has
> unexpected type 'str'
>   QGLShaderProgram.setUniformValue(int, float, float, float): argument
> 1 has unexpected type 'str'
>   QGLShaderProgram.setUniformValue(int, float, float, float, float):
> argument 1 has unexpected type 'str'
>   QGLShaderProgram.setUniformValue(int, QVector2D): argument 1 has
> unexpected type 'str'
>   QGLShaderProgram.setUniformValue(int, QVector3D): argument 1 has
> unexpected type 'str'
>   QGLShaderProgram.setUniformValue(int, QVector4D): argument 1 has
> unexpected type 'str'
>   QGLShaderProgram.setUniformValue(int, QColor): argument 1 has
> unexpected type 'str'
>   QGLShaderProgram.setUniformValue(str, QTransform): argument 2 has
> unexpected type 'PyQt4.QtCore.pyqtWrapperType'
>   etc.

A short, complete program to demonstrate the problem would help.

Phil


More information about the PyQt mailing list