Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-3005

calling QOpenGLShaderProgram.setUniformValueArray(float) not possible

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4: Low
    • 6.9.0
    • 6.8.2
    • PySide
    • None
    • MacOS 15.2 (ARM, M1)
      Python 3.12.8
      PySide6 6.8.2
    • macOS
    • a7b1ef20f (dev)

    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

        1. pyside3005.py
          6 kB
        2. qtbug.py
          5 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            doralitze Leon Dietrich
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes