Skip to content

PythonQt.Qt.QOpenGLWindow

QOpenGLWindow

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

QOpenGLWindow is an enhanced QWindow that allows easily creating windows that perform OpenGL rendering using an API that is compatible with QOpenGLWidget and is similar to the legacy QGLWidget. Unlike QOpenGLWidget, QOpenGLWindow has no dependency on the widgets module and offers better performance.

A typical application will subclass QOpenGLWindow and reimplement the following virtual functions:

  • initializeGL() to perform OpenGL resource initialization
  • resizeGL() to set up the transformation matrices and other window size dependent resources
  • paintGL() to issue OpenGL commands or draw using QPainter

To schedule a repaint, call the update() function. Note that this will not immediately result in a call to paintGL(). Calling update() multiple times in a row will not change the behavior in any way.

This is a slot so it can be connected to a QTimer::timeout() signal to perform animation. Note however that in the modern OpenGL world it is a much better choice to rely on synchronization to the vertical refresh rate of the display. See setSwapInterval() on a description of the swap interval. With a swap interval of 1, which is the case on most systems by default, the swapBuffers() call, that is executed internally by QOpenGLWindow after each repaint, will block and wait for vsync. This means that whenever the swap is done, an update can be scheduled again by calling update(), without relying on timers.

To request a specific configuration for the context, use setFormat() like for any other QWindow. This allows, among others, requesting a given OpenGL version and profile, or enabling depth and stencil buffers.

Unlike QWindow, QOpenGLWindow allows opening a painter on itself and perform QPainter-based drawing.

QOpenGLWindow supports multiple update behaviors. The default, NoPartialUpdate is equivalent to a regular, OpenGL-based QWindow or the legacy QGLWidget. In contrast, PartialUpdateBlit and PartialUpdateBlend are more in line with QOpenGLWidget's way of working, where there is always an extra, dedicated framebuffer object present. These modes allow, by sacrificing some performance, redrawing only a smaller area on each paint and having the rest of the content preserved from of the previous frame. This is useful for applications than render incrementally using QPainter, because this way they do not have to redraw the entire window content on each paintGL() call.

Similarly to QOpenGLWidget, QOpenGLWindow supports the Qt::AA_ShareOpenGLContexts attribute. When enabled, the OpenGL contexts of all QOpenGLWindow instances will share with each other. This allows accessing each other's shareable OpenGL resources.

For more information on graphics in Qt, see Graphics.

Source: https://doc.qt.io/archives/qt-5.15/qopenglwindow.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
AncestorMode attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
AutomaticVisibility attribute Any (shared captured text)
ExcludeTransients attribute Any (shared captured text)
FullScreen attribute Any (shared captured text)
Hidden attribute Any (shared captured text)
IncludeTransients attribute Any (shared captured text)
Maximized attribute Any (shared captured text)
Minimized attribute Any (shared captured text)
NoPartialUpdate attribute Any (shared captured text)
Offscreen attribute Any (shared captured text)
OpenGLSurface attribute Any (shared captured text)
PaintDeviceMetric attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
PartialUpdateBlend attribute Any (shared captured text)
PartialUpdateBlit attribute Any (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)
RasterGLSurface attribute Any (shared captured text)
RasterSurface attribute Any (shared captured text)
SurfaceClass attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
SurfaceType attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
UpdateBehavior attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
Visibility attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
Window attribute Any (shared captured text)
Windowed attribute Any (shared captured text)
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
active attribute Any (shared captured text)
activeChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.activeChanged; argument details are not documented.
alert function (self, msec: Any) -> Any (shared captured text)
baseSize function (self) -> Any X.baseSize() -> PythonQt.QtCore.QSize (shared captured text)
blockSignals function (self, b: Any) -> bool X.blockSignals(b) -> bool (shared captured text)
childEvent function (self, event: Any) -> Any (shared captured text)
children function (self) -> tuple X.children() -> tuple (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
close function (self) -> bool X.close() -> bool (shared captured text)
colorCount function (self) -> int X.colorCount() -> int (shared captured text)
connect function (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool X.connect(signal, receiver, slot, type) -> bool (shared captured text)
contentOrientation attribute Any (shared captured text)
contentOrientationChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.contentOrientationChanged; argument details are not documented.
context function (self) -> Any X.context() -> PythonQt.QtGui.QOpenGLContext (shared captured text)
create function (self) -> Any (shared captured text)
cursor function (self) -> Any X.cursor() -> PythonQt.QtGui.QCursor (shared captured text)
customEvent function (self, event: Any) -> Any (shared captured text)
defaultFramebufferObject function (self) -> int X.defaultFramebufferObject() -> int (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
deleteLater function (self) -> Any (shared captured text)
depth function (self) -> int X.depth() -> int (shared captured text)
destroy function (self) -> Any (shared captured text)
destroyed function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.destroyed; argument details are not documented.
devType function (self) -> int X.devType() -> int (shared captured text)
devicePixelRatio function (self) -> float X.devicePixelRatio() -> float (shared captured text)
devicePixelRatioF function (self) -> float X.devicePixelRatioF() -> float (shared captured text)
devicePixelRatioFScale function (self) -> float X.devicePixelRatioFScale() -> float (shared captured text)
disconnect function (self, signal: Any, receiver: Any, slot: Any) -> bool X.disconnect(signal, receiver, slot) -> bool (shared captured text)
doneCurrent function (self) -> None Releases the context. (shared captured text)
dumpObjectInfo function (self) -> Any (shared captured text)
dumpObjectTree function (self) -> Any (shared captured text)
dynamicPropertyNames function (self) -> Any (shared captured text)
event function (self, event: Any) -> bool X.event(event) -> bool (shared captured text)
eventFilter function (self, watched: Any, event: Any) -> bool X.eventFilter(watched, event) -> bool (shared captured text)
exposeEvent function (self, arg__1: Any) -> Any (shared captured text)
filePath function (self) -> str X.filePath() -> str (shared captured text)
findChild function (self, type: Any, name: Any) -> Any X.findChild(type, name) -> PythonQt.private.QObject (shared captured text)
findChildren function (self, type: Any, name: Any) -> tuple X.findChildren(type, name) -> tuple (shared captured text)
flags attribute Any (shared captured text)
focusInEvent function (self, arg__1: Any) -> Any (shared captured text)
focusObject function (self) -> Any X.focusObject() -> PythonQt.private.QObject (shared captured text)
focusObjectChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.focusObjectChanged; argument details are not documented.
focusOutEvent function (self, arg__1: Any) -> Any (shared captured text)
format function (self) -> Any X.format() -> PythonQt.QtGui.QSurfaceFormat (shared captured text)
frameGeometry function (self) -> Any X.frameGeometry() -> PythonQt.QtCore.QRect (shared captured text)
frameMargins function (self) -> Any X.frameMargins() -> PythonQt.QtGui.QMargins (shared captured text)
framePosition function (self) -> Any X.framePosition() -> PythonQt.QtCore.QPoint (shared captured text)
frameSwapped function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.frameSwapped; argument details are not documented.
fromWinId function (self, id: Any) -> Any X.fromWinId(id) -> PythonQt.QtGui.QWindow (shared captured text)
geometry function (self) -> Any X.geometry() -> PythonQt.QtCore.QRect (shared captured text)
grabFramebuffer function (self) -> Any X.grabFramebuffer() -> PythonQt.QtGui.QImage (shared captured text)
height attribute Any (shared captured text)
heightChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.heightChanged; argument details are not documented.
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)
hide function (self) -> Any (shared captured text)
hideEvent function (self, arg__1: Any) -> Any (shared captured text)
icon function (self) -> Any X.icon() -> PythonQt.QtGui.QIcon (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)
initializeGL function (self) -> None This virtual function is called once before the first call to [paintGL](https://doc.qt.io/archives/qt-5.15/qopenglwindow.html#paintGL)() or… (shared captured text)
installEventFilter function (self, filterObj: Any) -> Any (shared captured text)
isActive function (self) -> bool X.isActive() -> bool (shared captured text)
isAncestorOf function (self, child: Any, mode: Any) -> bool X.isAncestorOf(child, mode) -> bool (shared captured text)
isExposed function (self) -> bool X.isExposed() -> bool (shared captured text)
isModal function (self) -> bool X.isModal() -> bool (shared captured text)
isSignalConnected function (self, signal: Any) -> bool X.isSignalConnected(signal) -> bool (shared captured text)
isTopLevel function (self) -> bool X.isTopLevel() -> bool (shared captured text)
isValid function (self) -> bool X.isValid() -> bool (shared captured text)
isVisible function (self) -> bool X.isVisible() -> bool (shared captured text)
isWidgetType function (self) -> bool X.isWidgetType() -> bool (shared captured text)
isWindowType function (self) -> bool X.isWindowType() -> bool (shared captured text)
keyPressEvent function (self, arg__1: Any) -> Any (shared captured text)
keyReleaseEvent function (self, arg__1: Any) -> Any (shared captured text)
killTimer function (self, id: 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)
lower function (self) -> Any (shared captured text)
makeCurrent function (self) -> None Prepares for rendering OpenGL content for this window by making the corresponding context current and binding the framebuffer object, if there is one, in that context context. (shared captured text)
mapFromGlobal function (self, pos: Any) -> Any X.mapFromGlobal(pos) -> PythonQt.QtCore.QPoint (shared captured text)
mapToGlobal function (self, pos: Any) -> Any X.mapToGlobal(pos) -> PythonQt.QtCore.QPoint (shared captured text)
mask function (self) -> Any X.mask() -> PythonQt.QtGui.QRegion (shared captured text)
maximumHeight attribute Any (shared captured text)
maximumHeightChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.maximumHeightChanged; argument details are not documented.
maximumSize function (self) -> Any X.maximumSize() -> PythonQt.QtCore.QSize (shared captured text)
maximumWidth attribute Any (shared captured text)
maximumWidthChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.maximumWidthChanged; argument details are not documented.
metaObject function (self) -> Any X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text)
metric function (self, metric: Any) -> int X.metric(metric) -> int (shared captured text)
minimumHeight attribute Any (shared captured text)
minimumHeightChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.minimumHeightChanged; argument details are not documented.
minimumSize function (self) -> Any X.minimumSize() -> PythonQt.QtCore.QSize (shared captured text)
minimumWidth attribute Any (shared captured text)
minimumWidthChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.minimumWidthChanged; argument details are not documented.
modality attribute Any (shared captured text)
modalityChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.modalityChanged; argument details are not documented.
mouseDoubleClickEvent function (self, arg__1: Any) -> Any (shared captured text)
mouseMoveEvent function (self, arg__1: Any) -> Any (shared captured text)
mousePressEvent function (self, arg__1: Any) -> Any (shared captured text)
mouseReleaseEvent function (self, arg__1: Any) -> Any (shared captured text)
moveEvent function (self, arg__1: Any) -> Any (shared captured text)
moveToThread function (self, thread: Any) -> Any (shared captured text)
nativeEvent function (self, eventType: Any, message: Any, result: Any) -> bool X.nativeEvent(eventType, message, result) -> bool (shared captured text)
objectName attribute Any (shared captured text)
objectNameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.objectNameChanged; argument details are not documented.
opacity attribute Any (shared captured text)
opacityChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.opacityChanged; argument details are not documented.
paintEngine function (self) -> Any X.paintEngine() -> PythonQt.QtGui.QPaintEngine (shared captured text)
paintEvent function (self, event: Any) -> None Reimplements: [QPaintDeviceWindow::paintEvent](https://doc.qt.io/archives/qt-5.15/qpaintdevicewindow.html#paintEvent)(QPaintEvent *event). (shared captured text)
paintGL function (self) -> None This virtual function is called whenever the window contents needs to be painted. (shared captured text)
paintOverGL function (self) -> None This virtual function is called after each invocation of [paintGL](https://doc.qt.io/archives/qt-5.15/qopenglwindow.html#paintGL)(). (shared captured text)
paintUnderGL function (self) -> None The virtual function is called before each invocation of [paintGL](https://doc.qt.io/archives/qt-5.15/qopenglwindow.html#paintGL)(). (shared captured text)
paintingActive function (self) -> bool X.paintingActive() -> bool (shared captured text)
parent function (self) -> Any X.parent() -> PythonQt.QtGui.QWindow (shared captured text)
physicalDpiX function (self) -> int X.physicalDpiX() -> int (shared captured text)
physicalDpiY function (self) -> int X.physicalDpiY() -> int (shared captured text)
position function (self) -> Any X.position() -> PythonQt.QtCore.QPoint (shared captured text)
property function (self, name: Any) -> Any X.property(name) -> object (shared captured text)
raise_ function (self) -> Any Native spelling: raise; access it through getattr on the native object. (shared captured text)
redirected function (self, arg__1: Any) -> Any X.redirected(arg__1) -> PythonQt.QtGui.QPaintDevice (shared captured text)
removeEventFilter function (self, obj: Any) -> Any (shared captured text)
reportContentOrientationChange function (self, orientation: Any) -> Any (shared captured text)
requestActivate function (self) -> Any (shared captured text)
requestUpdate function (self) -> Any (shared captured text)
requestedFormat function (self) -> Any X.requestedFormat() -> PythonQt.QtGui.QSurfaceFormat (shared captured text)
resize function (self, w: Any, h: Any) -> Any X.resize(w, h) (shared captured text)
resizeEvent function (self, event: Any) -> None Reimplements: [QWindow::resizeEvent](https://doc.qt.io/archives/qt-5.15/qwindow.html#resizeEvent)(QResizeEvent *ev). (shared captured text)
resizeGL function (self, w: int, h: int) -> None X.resizeGL(w, h) (shared captured text)
screen function (self) -> Any X.screen() -> PythonQt.QtGui.QScreen (shared captured text)
screenChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.screenChanged; argument details are not documented.
sender function (self) -> Any X.sender() -> PythonQt.private.QObject (shared captured text)
senderSignalIndex function (self) -> int X.senderSignalIndex() -> int (shared captured text)
setBaseSize function (self, size: Any) -> Any (shared captured text)
setCursor function (self, arg__1: Any) -> Any (shared captured text)
setFilePath function (self, filePath: Any) -> Any (shared captured text)
setFlags function (self, arg0: flags) -> Any (shared captured text)
setFormat function (self, format: Any) -> Any (shared captured text)
setFramePosition function (self, point: Any) -> Any (shared captured text)
setGeometry function (self, posx: Any, posy: Any, w: Any, h: Any) -> Any X.setGeometry(posx, posy, w, h) (shared captured text)
setHeight function (self, arg: Any) -> Any (shared captured text)
setIcon function (self, icon: Any) -> Any (shared captured text)
setKeyboardGrabEnabled function (self, grab: Any) -> bool X.setKeyboardGrabEnabled(grab) -> bool (shared captured text)
setMask function (self, region: Any) -> Any (shared captured text)
setMaximumHeight function (self, h: Any) -> Any (shared captured text)
setMaximumSize function (self, size: Any) -> Any (shared captured text)
setMaximumWidth function (self, w: Any) -> Any (shared captured text)
setMinimumHeight function (self, h: Any) -> Any (shared captured text)
setMinimumSize function (self, size: Any) -> Any (shared captured text)
setMinimumWidth function (self, w: Any) -> Any (shared captured text)
setModality function (self, modality: Any) -> Any (shared captured text)
setMouseGrabEnabled function (self, grab: Any) -> bool X.setMouseGrabEnabled(grab) -> bool (shared captured text)
setObjectName function (self, name: Any) -> Any (shared captured text)
setOpacity function (self, level: Any) -> Any (shared captured text)
setParent function (self, parent: Any) -> Any (shared captured text)
setPosition function (self, posx: Any, posy: Any) -> Any X.setPosition(posx, posy) (shared captured text)
setProperty function (self, name: Any, value: Any) -> bool X.setProperty(name, value) -> bool (shared captured text)
setScreen function (self, screen: Any) -> Any (shared captured text)
setSizeIncrement function (self, size: Any) -> Any (shared captured text)
setSurfaceType function (self, surfaceType: Any) -> Any (shared captured text)
setTitle function (self, a: Any) -> Any (shared captured text)
setTransientParent function (self, parent: Any) -> Any (shared captured text)
setVisibility function (self, v: Any) -> Any (shared captured text)
setVisible function (self, visible: Any) -> Any (shared captured text)
setWidth function (self, arg: Any) -> Any (shared captured text)
setWindowState function (self, state: Any) -> Any (shared captured text)
setX function (self, arg: Any) -> Any (shared captured text)
setY function (self, arg: Any) -> Any (shared captured text)
shareContext function (self) -> Any X.shareContext() -> PythonQt.QtGui.QOpenGLContext (shared captured text)
sharedPainter function (self) -> Any X.sharedPainter() -> PythonQt.QtGui.QPainter (shared captured text)
show function (self) -> Any (shared captured text)
showEvent function (self, arg__1: Any) -> Any (shared captured text)
showFullScreen function (self) -> Any (shared captured text)
showMaximized function (self) -> Any (shared captured text)
showMinimized function (self) -> Any (shared captured text)
showNormal function (self) -> Any (shared captured text)
signalsBlocked function (self) -> bool X.signalsBlocked() -> bool (shared captured text)
size function (self) -> Any X.size() -> PythonQt.QtCore.QSize (shared captured text)
sizeIncrement function (self) -> Any X.sizeIncrement() -> PythonQt.QtCore.QSize (shared captured text)
startSystemMove function (self) -> bool X.startSystemMove() -> bool (shared captured text)
startSystemResize function (self, edges: Any) -> bool X.startSystemResize(edges) -> bool (shared captured text)
startTimer function (self, interval: Any, timerType: Any) -> int X.startTimer(interval, timerType) -> int (shared captured text)
supportsOpenGL function (self) -> bool X.supportsOpenGL() -> bool (shared captured text)
surfaceClass function (self) -> Any (shared captured text)
surfaceHandle function (self) -> Any (shared captured text)
surfaceType function (self) -> Any (shared captured text)
tabletEvent function (self, arg__1: Any) -> Any (shared captured text)
thread function (self) -> Any (shared captured text)
timerEvent function (self, event: Any) -> Any (shared captured text)
title attribute Any (shared captured text)
touchEvent function (self, arg__1: Any) -> Any (shared captured text)
tr function (self, text: Any, ambig: Any, n: Any) -> str X.tr(text, ambig, n) -> str (shared captured text)
transientParent attribute QWindow (shared captured text)
transientParentChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.transientParentChanged; argument details are not documented.
type function (self) -> Any (shared captured text)
unsetCursor function (self) -> Any (shared captured text)
update function (self, rect: Any) -> Any (shared captured text)
updateBehavior function (self) -> Any Returns the update behavior for this [QOpenGLWindow](https://doc.qt.io/archives/qt-5.15/qopenglwindow.html). (shared captured text)
visibility attribute Any (shared captured text)
visibilityChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.visibilityChanged; argument details are not documented.
visible attribute Any (shared captured text)
visibleChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.visibleChanged; argument details are not documented.
wheelEvent function (self, arg__1: Any) -> Any (shared captured text)
width attribute Any (shared captured text)
widthChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.widthChanged; argument details are not documented.
widthMM function (self) -> int X.widthMM() -> int (shared captured text)
winId function (self) -> int X.winId() -> int (shared captured text)
windowState function (self) -> Any (shared captured text)
windowStateChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.windowStateChanged; argument details are not documented.
windowTitleChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.windowTitleChanged; argument details are not documented.
x attribute Any (shared captured text)
xChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.xChanged; argument details are not documented.
y attribute Any (shared captured text)
yChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.Qt.QOpenGLWindow.yChanged; argument details are not documented.