Skip to content

PythonQt.Qt.QOpenGLPaintDevice

QOpenGLPaintDevice

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

The QOpenGLPaintDevice uses the current QOpenGL context to render QPainter draw commands. The context is captured upon construction. It requires support for OpenGL (ES) 2.0 or higher.

Performance

The QOpenGLPaintDevice is almost always hardware accelerated and has the potential of being much faster than software rasterization. However, it is more sensitive to state changes, and therefore requires the drawing commands to be carefully ordered to achieve optimal performance.

Antialiasing and Quality

Antialiasing in the OpenGL paint engine is done using multisampling. Most hardware require significantly more memory to do multisampling and the resulting quality is not on par with the quality of the software paint engine. The OpenGL paint engine's strength lies in its performance, not its visual rendering quality.

State Changes

When painting to a QOpenGLPaintDevice using QPainter, the state of the current OpenGL context will be altered by the paint engine to reflect its needs. Applications should not rely upon the OpenGL state being reset to its original conditions, particularly the current shader program, OpenGL viewport, texture units, and drawing modes.

Mixing QPainter and OpenGL

When intermixing QPainter and OpenGL, it is important to notify QPainter that the OpenGL state may have been cluttered so it can restore its internal state. This is achieved by calling QPainter::beginNativePainting() before starting the OpenGL rendering and calling QPainter::endNativePainting() after finishing.

Source: https://doc.qt.io/archives/qt-5.15/qopenglpaintdevice.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)
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.QtGui.QOpenGLContext (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (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)
dotsPerMeterX function (self) -> float X.dotsPerMeterX() -> float (shared captured text)
dotsPerMeterY function (self) -> float X.dotsPerMeterY() -> float (shared captured text)
ensureActiveTarget function (self) -> Any This virtual method is provided as a callback to allow re-binding a target frame buffer object or context when different… (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)
logicalDpiX function (self) -> int X.logicalDpiX() -> int (shared captured text)
logicalDpiY function (self) -> int X.logicalDpiY() -> int (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)
paintFlipped function (self) -> bool X.paintFlipped() -> bool (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)
setDevicePixelRatio function (self, devicePixelRatio: Any) -> Any Sets the device pixel ratio for the paint device to devicePixelRatio. (shared captured text)
setDotsPerMeterX function (self, arg__1: Any) -> Any Sets the number of pixels per meter horizontally to dpmx. (shared captured text)
setDotsPerMeterY function (self, arg__1: Any) -> Any Sets the number of pixels per meter vertically to dpmy. (shared captured text)
setPaintFlipped function (self, arg0: flipped) -> Any Sets whether painting should be flipped around the Y-axis or not to flipped. (shared captured text)
setSize function (self, size: Any) -> Any Sets the pixel size of the paint device to size. (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)
width function (self) -> int X.width() -> int (shared captured text)
widthMM function (self) -> int X.widthMM() -> int (shared captured text)