Skip to content

PythonQt.Qt.QGLPixelBuffer

QGLPixelBuffer

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

Rendering into a pbuffer is normally done using full hardware acceleration. This can be significantly faster than rendering into a QPixmap.

There are three approaches to using this class:

  1. We can draw into the pbuffer and convert it to a QImage using toImage(). This is normally much faster than calling QGLWidget::renderPixmap().
  2. We can draw into the pbuffer and copy the contents into an OpenGL texture using updateDynamicTexture(). This allows us to create dynamic textures and works on all systems with pbuffer support.
  3. On systems that support it, we can bind the pbuffer to an OpenGL texture. The texture is then updated automatically when the pbuffer contents change, eliminating the need for additional copy operations. This is supported only on Windows and macOS systems that provide the render_texture extension. Note that under Windows, a multi-sampled pbuffer can't be used in conjunction with the render_texture extension. If a multi-sampled pbuffer is requested under Windows, the render_texture extension is turned off for that pbuffer.

Note: This class has been deprecated, use QOpenGLFramebufferObject for offscreen rendering.

Threading

As of Qt 4.8, it's possible to render into a QGLPixelBuffer using a QPainter in a separate thread. Note that OpenGL 2.0 or OpenGL ES 2.0 is required for this to work.

Pbuffers are provided by the OpenGL pbuffer extension; call hasOpenGLPbuffer() to find out if the system provides pbuffers.

Source: https://doc.qt.io/archives/qt-5.15/qglpixelbuffer.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
PaintDeviceMetric attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
PdmDepth attribute Any (shared captured text)
PdmDevicePixelRatio attribute Any (shared captured text)
PdmDevicePixelRatioScaled attribute Any (shared captured text)
PdmDpiX attribute Any (shared captured text)
PdmDpiY attribute Any (shared captured text)
PdmHeight attribute Any (shared captured text)
PdmHeightMM attribute Any (shared captured text)
PdmNumColors attribute Any (shared captured text)
PdmPhysicalDpiX attribute Any (shared captured text)
PdmPhysicalDpiY attribute Any (shared captured text)
PdmWidth attribute Any (shared captured text)
PdmWidthMM attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
bindTexture function (self, image: Any, target: Any) -> int X.bindTexture(image, target) -> int (shared captured text)
bindToDynamicTexture function (self, texture: int) -> bool X.bindToDynamicTexture(texture) -> bool (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
colorCount function (self) -> int X.colorCount() -> int (shared captured text)
context function (self) -> Any X.context() -> PythonQt.QtOpenGL.QGLContext (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
deleteTexture function (self, texture_id: int) -> None Removes the texture identified by texture_id from the texture cache. (shared captured text)
depth function (self) -> int X.depth() -> int (shared captured text)
devType function (self) -> int X.devType() -> int (shared captured text)
devicePixelRatio function (self) -> int X.devicePixelRatio() -> int (shared captured text)
devicePixelRatioF function (self) -> float X.devicePixelRatioF() -> float (shared captured text)
devicePixelRatioFScale function (self) -> float X.devicePixelRatioFScale() -> float (shared captured text)
doneCurrent function (self) -> bool X.doneCurrent() -> bool (shared captured text)
drawTexture function (self, point: Any, textureId: int, textureTarget: int) -> None X.drawTexture(point, textureId, textureTarget) (shared captured text)
format function (self) -> Any X.format() -> PythonQt.QtOpenGL.QGLFormat (shared captured text)
generateDynamicTexture function (self) -> int X.generateDynamicTexture() -> int (shared captured text)
handle function (self) -> int Returns the native pbuffer handle. (shared captured text)
hasOpenGLPbuffers function (self) -> bool X.hasOpenGLPbuffers() -> bool (shared captured text)
height function (self) -> int X.height() -> int (shared captured text)
heightMM function (self) -> int X.heightMM() -> int (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
initPainter function (self, painter: Any) -> Any (shared captured text)
isValid function (self) -> bool X.isValid() -> bool (shared captured text)
logicalDpiX function (self) -> int X.logicalDpiX() -> int (shared captured text)
logicalDpiY function (self) -> int X.logicalDpiY() -> int (shared captured text)
makeCurrent function (self) -> bool X.makeCurrent() -> bool (shared captured text)
metric function (self, metric: Any) -> int X.metric(metric) -> int (shared captured text)
paintEngine function (self) -> Any X.paintEngine() -> PythonQt.QtGui.QPaintEngine (shared captured text)
paintingActive function (self) -> bool X.paintingActive() -> bool (shared captured text)
physicalDpiX function (self) -> int X.physicalDpiX() -> int (shared captured text)
physicalDpiY function (self) -> int X.physicalDpiY() -> int (shared captured text)
redirected function (self, offset: Any) -> Any X.redirected(offset) -> PythonQt.QtGui.QPaintDevice (shared captured text)
releaseFromDynamicTexture function (self) -> None Releases the pbuffer from any previously bound texture. (shared captured text)
sharedPainter function (self) -> Any X.sharedPainter() -> PythonQt.QtGui.QPainter (shared captured text)
size function (self) -> Any X.size() -> PythonQt.QtCore.QSize (shared captured text)
toImage function (self) -> Any X.toImage() -> PythonQt.QtGui.QImage (shared captured text)
updateDynamicTexture function (self, texture_id: int) -> None Copies the pbuffer contents into the texture specified with texture_id. (shared captured text)
width function (self) -> int X.width() -> int (shared captured text)
widthMM function (self) -> int X.widthMM() -> int (shared captured text)