Details
Description
Calling QOpenGLShaderProgram.setUniformValueArray fails with an error claiming that the signature does not match. In particular it complains, that a Sequence[float] cannot be used as an argument where a Sequence[float] is required.
The following code produces the this error:
vert_projection_matricies = {color:#94558d}self{color}._gl_program.uniformLocation({color:#6aab73}"projection_matrices"{color}) r = {color:#94558d}self{color}.width() t = {color:#94558d}self{color}.height() f = {color:#94558d}self{color}.END_Z_CLIPPING_DISTANCE n = {color:#94558d}self{color}.BEGIN_Z_CLIPPING_DISTANCE projection_matrix = [ {color:#2aacb8}1.0 {color}/ r, {color:#2aacb8}0.0{color}, {color:#2aacb8}0.0{color}, {color:#2aacb8}0.0{color}, {color:#2aacb8}0.0{color}, {color:#2aacb8}1.0 {color}/ t, {color:#2aacb8}0.0{color}, {color:#2aacb8}0.0{color}, {color:#2aacb8}0.0{color}, {color:#2aacb8}0.0{color}, -{color:#2aacb8}2.0 {color}/ (f - n), -(f + n) / (f - n), {color:#2aacb8}0.0{color}, {color:#2aacb8}0.0{color}, {color:#2aacb8}0.0{color}, {color:#2aacb8}1.0{color}] count = {color:#8888c6}len{color}(projection_matrix) #This fails as well with the same issue {color:#6f737a}#f {color}= {color:#94558d}self{color}.context().functions() {color:#7a7e85}#f.glUniform1fv(vert_projection_matricies, count, projection_matrix){color} {color:#7a7e85}# But this is the method call in question{color}{color:#94558d}self{color}._gl_program.setUniformValueArray(vert_projection_matricies, projection_matrix, count)
The produced error message is the following:
self._gl_program.setUniformValueArray(vert_projection_matricies, projection_matrix, count) TypeError: Error calling Python override of QOpenGLWidget::initializeGL(): 'PySide6.QtOpenGL.QOpenGLShaderProgram.setUniformValueArray' called with wrong argument types: PySide6.QtOpenGL.QOpenGLShaderProgram.setUniformValueArray(int, list, int) Supported signatures: PySide6.QtOpenGL.QOpenGLShaderProgram.setUniformValueArray(Union[bytes, bytearray, memoryview], Sequence[int], int, /) PySide6.QtOpenGL.QOpenGLShaderProgram.setUniformValueArray(Union[bytes, bytearray, memoryview], Sequence[float], int, int, /) PySide6.QtOpenGL.QOpenGLShaderProgram.setUniformValueArray(int, Sequence[int], int, /) PySide6.QtOpenGL.QOpenGLShaderProgram.setUniformValueArray(int, Sequence[float], int, int, /) python-BaseException
I have tried this with multiple instances of python sequence containers, as well as numpy arrays.
void QOpenGLShaderProgram::setUniformValueArray(int location, const GLint *values, int count)
Attachments
For Gerrit Dashboard: PYSIDE-3005 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
623046,4 | Fix QOpenGLShaderProgram.setUniformValueArray(int,float*,int,int) | dev | pyside/pyside-setup | Status: MERGED | +2 | +1 |