Skip to content

PythonQt.Qt.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. (shared captured text)
CombinedDepthStencil attribute Any (shared captured text)
Depth attribute Any (shared captured text)
NoAttachment attribute Any (shared captured text)
__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) (shared captured text)
attachment function (self) -> Any Returns the status of the depth and stencil buffers attached to this framebuffer object. (shared captured text)
bind function (self) -> bool X.bind() -> bool (shared captured text)
bindDefault function (self) -> bool X.bindDefault() -> bool (shared captured text)
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) (shared captured text)
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 (shared captured text)
handle function (self) -> int X.handle() -> int (shared captured text)
hasOpenGLFramebufferBlit function (self) -> bool X.hasOpenGLFramebufferBlit() -> bool (shared captured text)
hasOpenGLFramebufferObjects function (self) -> bool X.hasOpenGLFramebufferObjects() -> bool (shared captured text)
height function (self) -> int X.height() -> 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)
isBound function (self) -> bool X.isBound() -> bool (shared captured text)
isValid function (self) -> bool X.isValid() -> bool (shared captured text)
release function (self) -> bool X.release() -> bool (shared captured text)
setAttachment function (self, attachment: Any) -> None Sets the attachments of the framebuffer object to attachment. (shared captured text)
size function (self) -> Any X.size() -> PythonQt.QtCore.QSize (shared captured text)
sizes function (self) -> tuple X.sizes() -> tuple (shared captured text)
takeTexture function (self, colorAttachmentIndex: Any) -> int X.takeTexture(colorAttachmentIndex) -> int (shared captured text)
texture function (self) -> int X.texture() -> int (shared captured text)
textures function (self) -> tuple X.textures() -> tuple (shared captured text)
toImage function (self, arg0: flipped, colorAttachmentIndex: Any) -> Any X.toImage(flipped, colorAttachmentIndex) -> PythonQt.QtGui.QImage (shared captured text)
width function (self) -> int X.width() -> int (shared captured text)