Skip to content

PythonQt.QtGui.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.
AutomaticVisibility attribute Any
ExcludeTransients attribute Any
FullScreen attribute Any (shared captured text)
Hidden attribute Any (shared captured text)
IncludeTransients attribute Any
Maximized attribute Any
Minimized attribute Any
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
PartialUpdateBlit attribute Any
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.
Window attribute Any (shared captured text)
Windowed attribute Any
__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.QtGui.QOpenGLWindow.activeChanged; argument details are not documented.
alert function (self, msec: Any) -> Any
baseSize function (self) -> Any X.baseSize() -> PythonQt.QtCore.QSize
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
contentOrientationChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWindow.contentOrientationChanged; argument details are not documented.
context function (self) -> Any X.context() -> PythonQt.QtGui.QOpenGLContext
create function (self) -> Any
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
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
destroyed function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.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.
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
filePath function (self) -> str X.filePath() -> str
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
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.QtGui.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
frameGeometry function (self) -> Any X.frameGeometry() -> PythonQt.QtCore.QRect
frameMargins function (self) -> Any X.frameMargins() -> PythonQt.QtGui.QMargins
framePosition function (self) -> Any X.framePosition() -> PythonQt.QtCore.QPoint
frameSwapped function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWindow.frameSwapped; argument details are not documented.
fromWinId function (self, id: Any) -> Any X.fromWinId(id) -> PythonQt.QtGui.QWindow
geometry function (self) -> Any X.geometry() -> PythonQt.QtCore.QRect (shared captured text)
grabFramebuffer function (self) -> Any X.grabFramebuffer() -> PythonQt.QtGui.QImage
height attribute Any (shared captured text)
heightChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.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
icon function (self) -> Any X.icon() -> PythonQt.QtGui.QIcon
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…
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
isExposed function (self) -> bool X.isExposed() -> bool
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
isValid function (self) -> bool X.isValid() -> bool
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
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.
mapFromGlobal function (self, pos: Any) -> Any X.mapFromGlobal(pos) -> PythonQt.QtCore.QPoint
mapToGlobal function (self, pos: Any) -> Any X.mapToGlobal(pos) -> PythonQt.QtCore.QPoint
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.QtGui.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.QtGui.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
minimumHeight attribute Any (shared captured text)
minimumHeightChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.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.QtGui.QOpenGLWindow.minimumWidthChanged; argument details are not documented.
modality attribute Any
modalityChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.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
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.QtGui.QOpenGLWindow.objectNameChanged; argument details are not documented.
opacity attribute Any (shared captured text)
opacityChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.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).
paintGL function (self) -> None This virtual function is called whenever the window contents needs to be painted.
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)().
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)().
paintingActive function (self) -> bool X.paintingActive() -> bool (shared captured text)
parent function (self) -> Any X.parent() -> PythonQt.QtGui.QWindow
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
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
removeEventFilter function (self, obj: Any) -> Any (shared captured text)
reportContentOrientationChange function (self, orientation: Any) -> Any
requestActivate function (self) -> Any
requestUpdate function (self) -> Any
requestedFormat function (self) -> Any X.requestedFormat() -> PythonQt.QtGui.QSurfaceFormat
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).
resizeGL function (self, w: int, h: int) -> None X.resizeGL(w, h)
screen function (self) -> Any X.screen() -> PythonQt.QtGui.QScreen
screenChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.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
setCursor function (self, arg__1: Any) -> Any (shared captured text)
setFilePath function (self, filePath: Any) -> Any
setFlags function (self, arg0: flags) -> Any (shared captured text)
setFormat function (self, format: Any) -> Any
setFramePosition function (self, point: Any) -> Any
setGeometry function (self, posx: Any, posy: Any, w: Any, h: Any) -> Any X.setGeometry(posx, posy, w, h)
setHeight function (self, arg: Any) -> Any
setIcon function (self, icon: Any) -> Any (shared captured text)
setKeyboardGrabEnabled function (self, grab: Any) -> bool X.setKeyboardGrabEnabled(grab) -> bool
setMask function (self, region: Any) -> Any
setMaximumHeight function (self, h: Any) -> Any
setMaximumSize function (self, size: Any) -> Any
setMaximumWidth function (self, w: Any) -> Any
setMinimumHeight function (self, h: Any) -> Any
setMinimumSize function (self, size: Any) -> Any
setMinimumWidth function (self, w: Any) -> Any
setModality function (self, modality: Any) -> Any
setMouseGrabEnabled function (self, grab: Any) -> bool X.setMouseGrabEnabled(grab) -> bool
setObjectName function (self, name: Any) -> Any (shared captured text)
setOpacity function (self, level: Any) -> Any
setParent function (self, parent: Any) -> Any (shared captured text)
setPosition function (self, posx: Any, posy: Any) -> Any X.setPosition(posx, posy)
setProperty function (self, name: Any, value: Any) -> bool X.setProperty(name, value) -> bool (shared captured text)
setScreen function (self, screen: Any) -> Any
setSizeIncrement function (self, size: Any) -> Any
setSurfaceType function (self, surfaceType: Any) -> Any
setTitle function (self, a: Any) -> Any
setTransientParent function (self, parent: Any) -> Any
setVisibility function (self, v: Any) -> Any
setVisible function (self, visible: Any) -> Any (shared captured text)
setWidth function (self, arg: Any) -> Any
setWindowState function (self, state: Any) -> Any (shared captured text)
setX function (self, arg: Any) -> Any
setY function (self, arg: Any) -> Any
shareContext function (self) -> Any X.shareContext() -> PythonQt.QtGui.QOpenGLContext
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
startSystemMove function (self) -> bool X.startSystemMove() -> bool
startSystemResize function (self, edges: Any) -> bool X.startSystemResize(edges) -> bool
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
surfaceType function (self) -> Any
tabletEvent function (self, arg__1: Any) -> Any
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
tr function (self, text: Any, ambig: Any, n: Any) -> str X.tr(text, ambig, n) -> str (shared captured text)
transientParent attribute QWindow
transientParentChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.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
updateBehavior function (self) -> Any Returns the update behavior for this [QOpenGLWindow](https://doc.qt.io/archives/qt-5.15/qopenglwindow.html).
visibility attribute Any
visibilityChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWindow.visibilityChanged; argument details are not documented.
visible attribute Any (shared captured text)
visibleChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.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.QtGui.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.QtGui.QOpenGLWindow.windowStateChanged; argument details are not documented.
windowTitleChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWindow.windowTitleChanged; argument details are not documented.
x attribute Any (shared captured text)
xChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWindow.xChanged; argument details are not documented.
y attribute Any (shared captured text)
yChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWindow.yChanged; argument details are not documented.