Skip to content

PythonQt.QtGui.QOpenGLFramebufferObject

QOpenGLFramebufferObject

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

The QOpenGLFramebufferObject class encapsulates an OpenGL framebuffer object, defined by the GL_EXT_framebuffer_object extension. It provides a rendering surface that can be painted on with a QPainter with the help of QOpenGLPaintDevice, or rendered to using native OpenGL calls. This surface can be bound and used as a regular texture in your own OpenGL drawing code. By default, the QOpenGLFramebufferObject class generates a 2D OpenGL texture (using the GL_TEXTURE_2D target), which is used as the internal rendering target.

It is important to have a current OpenGL context when creating a QOpenGLFramebufferObject, otherwise initialization will fail.

Create the QOpenGLFrameBufferObject instance with the CombinedDepthStencil attachment if you want QPainter to render correctly. Note that you need to create a QOpenGLFramebufferObject with more than one sample per pixel for primitives to be antialiased when drawing using a QPainter. To create a multisample framebuffer object you should use one of the constructors that take a QOpenGLFramebufferObjectFormat parameter, and set the QOpenGLFramebufferObjectFormat::samples() property to a non-zero value.

For multisample framebuffer objects a color render buffer is created, otherwise a texture with the specified texture target is created. The color render buffer or texture will have the specified internal format, and will be bound to the GL_COLOR_ATTACHMENT0 attachment in the framebuffer object.

Multiple render targets are also supported, in case the OpenGL implementation supports this. Here there will be multiple textures (or, in case of multisampling, renderbuffers) present and each of them will get attached to GL_COLOR_ATTACHMENT0, 1, 2, ...

If you want to use a framebuffer object with multisampling enabled as a texture, you first need to copy from it to a regular framebuffer object using QOpenGLContext::blitFramebuffer().

It is possible to draw into a QOpenGLFramebufferObject using QPainter and QOpenGLPaintDevice in a separate thread.

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.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
Attachment attribute type Convert a number or string to an integer, or return 0 if no arguments are given.
CombinedDepthStencil attribute Any
Depth attribute Any
NoAttachment attribute Any
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
addColorAttachment function (self, width: Any, height: Any, internalFormat: int) -> None X.addColorAttachment(width, height, internalFormat)
attachment function (self) -> Any Returns the status of the depth and stencil buffers attached to this framebuffer object.
bind function (self) -> bool X.bind() -> bool
bindDefault function (self) -> bool X.bindDefault() -> bool
blitFramebuffer function (self, target: Any, targetRect: Any, source: Any, sourceRect: Any, buffers: int, filter: int, readColorAttach… X.blitFramebuffer(target, targetRect, source, sourceRect, buffers, filter, readColorAttachmentIndex, drawColorAttachmentIndex)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
format function (self) -> Any X.format() -> PythonQt.QtGui.QOpenGLFramebufferObjectFormat
handle function (self) -> int X.handle() -> int
hasOpenGLFramebufferBlit function (self) -> bool X.hasOpenGLFramebufferBlit() -> bool
hasOpenGLFramebufferObjects function (self) -> bool X.hasOpenGLFramebufferObjects() -> bool
height function (self) -> int X.height() -> int
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)
isBound function (self) -> bool X.isBound() -> bool
isValid function (self) -> bool X.isValid() -> bool
release function (self) -> bool X.release() -> bool
setAttachment function (self, attachment: Any) -> None Sets the attachments of the framebuffer object to attachment.
size function (self) -> Any X.size() -> PythonQt.QtCore.QSize
sizes function (self) -> tuple X.sizes() -> tuple
takeTexture function (self, colorAttachmentIndex: Any) -> int X.takeTexture(colorAttachmentIndex) -> int
texture function (self) -> int X.texture() -> int
textures function (self) -> tuple X.textures() -> tuple
toImage function (self, arg0: flipped, colorAttachmentIndex: Any) -> Any X.toImage(flipped, colorAttachmentIndex) -> PythonQt.QtGui.QImage
width function (self) -> int X.width() -> int