Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Missing functions in PySide6 (textureId())?
Forum Updated to NodeBB v4.3 + New Features

Missing functions in PySide6 (textureId())?

Scheduled Pinned Locked Moved Unsolved Qt for Python
8 Posts 3 Posters 761 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AName
    wrote on 20 Aug 2021, 21:50 last edited by AName
    #1

    Hi everyone,

    I just started using PySide6 for my new application and so far the experience is pretty good. However, I try to start working on some bridging stuff for which I need to use OpenGL. According to the documentation, A QOpenGLTexture should have the method textureId(). This one does not seem to be present in PySide6 at the moment (I've installed the latest 6.1.2). Does anyone know what the cause of this could be? Or better yet, how to solve it?

    (Bonus question, does anyone know if there's some way to access the low-levels objects, so I can extract a raw pointer to the underlying GLContext? Something akin to QOpenGLContext::nativeHandle())

    Many thanks in advance!

    E 1 Reply Last reply 21 Aug 2021, 21:33
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 21 Aug 2021, 18:06 last edited by
      #2

      Hi and welcome to devnet,

      This looks like a bug on the binding side. You should check the bug report system to see if this is something known.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A AName
        20 Aug 2021, 21:50

        Hi everyone,

        I just started using PySide6 for my new application and so far the experience is pretty good. However, I try to start working on some bridging stuff for which I need to use OpenGL. According to the documentation, A QOpenGLTexture should have the method textureId(). This one does not seem to be present in PySide6 at the moment (I've installed the latest 6.1.2). Does anyone know what the cause of this could be? Or better yet, how to solve it?

        (Bonus question, does anyone know if there's some way to access the low-levels objects, so I can extract a raw pointer to the underlying GLContext? Something akin to QOpenGLContext::nativeHandle())

        Many thanks in advance!

        E Offline
        E Offline
        eyllanesc
        wrote on 21 Aug 2021, 21:33 last edited by
        #3

        @AName I don't check what the OP points out, if that method can be accessed in PySide6:

        from OpenGL.GL import GLuint
        
        import PySide6
        from PySide6.QtCore import qVersion
        from PySide6.QtGui import QGuiApplication, QOffscreenSurface, QOpenGLContext
        from PySide6.QtOpenGL import QOpenGLTexture
        
        
        if __name__ == "__main__":
            print(f"PySide6 version: {PySide6.__version__}, Qt version:  {qVersion()}")
        
            app = QGuiApplication()
            off_screen = QOffscreenSurface()
            off_screen.create()
            if off_screen.isValid():
                context = QOpenGLContext()
                if context.create():
                    context.makeCurrent(off_screen)
                    text = QOpenGLTexture(QOpenGLTexture.Target2D)
                    text.setMinMagFilters(QOpenGLTexture.Linear, QOpenGLTexture.Linear)
                    text.create()
                    texture_id = text.textureId()
                    print(texture_id, GLuint(texture_id))
                    text.destroy()
        

        Output:

        PySide6 version: 6.1.2, Qt version:  6.1.2
        1 c_uint(1)
        

        If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

        A 1 Reply Last reply 22 Aug 2021, 19:03
        0
        • E eyllanesc
          21 Aug 2021, 21:33

          @AName I don't check what the OP points out, if that method can be accessed in PySide6:

          from OpenGL.GL import GLuint
          
          import PySide6
          from PySide6.QtCore import qVersion
          from PySide6.QtGui import QGuiApplication, QOffscreenSurface, QOpenGLContext
          from PySide6.QtOpenGL import QOpenGLTexture
          
          
          if __name__ == "__main__":
              print(f"PySide6 version: {PySide6.__version__}, Qt version:  {qVersion()}")
          
              app = QGuiApplication()
              off_screen = QOffscreenSurface()
              off_screen.create()
              if off_screen.isValid():
                  context = QOpenGLContext()
                  if context.create():
                      context.makeCurrent(off_screen)
                      text = QOpenGLTexture(QOpenGLTexture.Target2D)
                      text.setMinMagFilters(QOpenGLTexture.Linear, QOpenGLTexture.Linear)
                      text.create()
                      texture_id = text.textureId()
                      print(texture_id, GLuint(texture_id))
                      text.destroy()
          

          Output:

          PySide6 version: 6.1.2, Qt version:  6.1.2
          1 c_uint(1)
          
          A Offline
          A Offline
          AName
          wrote on 22 Aug 2021, 19:03 last edited by
          #4

          @SGaist

          Yes this looked like such a simple feature that it seemed like a very unlikely bug, especially given that (most of?) the library code is auto-generated. So I wanted to double-check whether there was actually something wrong on my end.

          @eyllanesc
          Very strange, if I run your exact code I still get the same error message:

          Traceback (most recent call last):
          File ".../main.py", line 22, in <module>
          texture_id = text.textureId()
          AttributeError: 'PySide6.QtOpenGL.QOpenGLTexture' object has no attribute 'textureId'

          I'm running PySide6 version 6.1.2 and Qt version 6.1.2. Python is at 3.9.6. Any clue as to where the problem might be?

          E 1 Reply Last reply 22 Aug 2021, 19:12
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 22 Aug 2021, 19:04 last edited by
            #5

            How did you install PySide6 ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            A 1 Reply Last reply 22 Aug 2021, 21:08
            0
            • A AName
              22 Aug 2021, 19:03

              @SGaist

              Yes this looked like such a simple feature that it seemed like a very unlikely bug, especially given that (most of?) the library code is auto-generated. So I wanted to double-check whether there was actually something wrong on my end.

              @eyllanesc
              Very strange, if I run your exact code I still get the same error message:

              Traceback (most recent call last):
              File ".../main.py", line 22, in <module>
              texture_id = text.textureId()
              AttributeError: 'PySide6.QtOpenGL.QOpenGLTexture' object has no attribute 'textureId'

              I'm running PySide6 version 6.1.2 and Qt version 6.1.2. Python is at 3.9.6. Any clue as to where the problem might be?

              E Offline
              E Offline
              eyllanesc
              wrote on 22 Aug 2021, 19:12 last edited by
              #6

              @AName How have you installed the libraries? I have created a virtualenv and installed opengl and pyside6 using pip.

              If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

              1 Reply Last reply
              0
              • S SGaist
                22 Aug 2021, 19:04

                How did you install PySide6 ?

                A Offline
                A Offline
                AName
                wrote on 22 Aug 2021, 21:08 last edited by
                #7

                @SGaist

                I created a virtualenv and ran "pip3 install pyside6", also tried un- and reinstalling a couple times. I'm on macOS btw, if that could matter

                E 1 Reply Last reply 22 Aug 2021, 21:49
                0
                • A AName
                  22 Aug 2021, 21:08

                  @SGaist

                  I created a virtualenv and ran "pip3 install pyside6", also tried un- and reinstalling a couple times. I'm on macOS btw, if that could matter

                  E Offline
                  E Offline
                  eyllanesc
                  wrote on 22 Aug 2021, 21:49 last edited by
                  #8

                  @AName I just did a test using linux, windows and macos with python 3.7, 3.8 and 3.9 verifying that the textureId method is not available in macos, I recommend you report the bug.

                  If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

                  1 Reply Last reply
                  0

                  1/8

                  20 Aug 2021, 21:50

                  • Login

                  • Login or register to search.
                  1 out of 8
                  • First post
                    1/8
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved