Missing functions in PySide6 (textureId())?
-
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!
-
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.
-
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!
@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)
-
@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)
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?
-
How did you install PySide6 ?
-
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?
-
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