Skip to content

PythonQt.QtGui.QOpenGLFramebufferObject · declarations 001

Back to PythonQt.QtGui.QOpenGLFramebufferObject

Attachment instance-attribute

Attachment: type

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.

int('0b100', base=0) 4

CombinedDepthStencil instance-attribute

CombinedDepthStencil: Any

Depth instance-attribute

Depth: Any

NoAttachment instance-attribute

NoAttachment: Any

addColorAttachment

addColorAttachment(width: Any, height: Any, internalFormat: int) -> None

X.addColorAttachment(width, height, internalFormat)

Supplemental documentation: Qt 5 reference:

void QOpenGLFramebufferObject::addColorAttachment(const QSize \&size, GLenum internalFormat \= 0)

Creates and attaches an additional texture or renderbuffer of size width and height.

There is always an attachment at GL_COLOR_ATTACHMENT0. Call this function to set up additional attachments at GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, ...

When internalFormat is not 0, it specifies the internal format of the texture or renderbuffer. Otherwise a default of GL_RGBA or GL_RGBA8 is used.

Note: This is only functional when multiple render targets are supported by the OpenGL implementation. When that is not the case, the function will not add any additional color attachments. Call QOpenGLFunctions::hasOpenGLFeature() with QOpenGLFunctions::MultipleRenderTargets at runtime to check if MRT is supported.

Note: The internal format of the color attachments may differ but there may be limitations on the supported combinations, depending on the drivers.

Note: The size of the color attachments may differ but rendering is limited to the area that fits all the attachments, according to the OpenGL specification. Some drivers may not be fully conformant in this respect, however.

This function was introduced in Qt 5.6.

void QOpenGLFramebufferObject::addColorAttachment(int width, int height, GLenum internalFormat \= 0)

This is an overloaded function.

Creates and attaches an additional texture or renderbuffer of size width and height.

When internalFormat is not 0, it specifies the internal format of the texture or renderbuffer. Otherwise a default of GL_RGBA or GL_RGBA8 is used.

This function was introduced in Qt 5.6.

Upstream PySide2 reference signatures (binding differences may apply):

addColorAttachment(self, size: PySide2.QtCore.QSize, internalFormat: int=...) -> None
addColorAttachment(self, width: int, height: int, internalFormat: int=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#addColorAttachment

attachment

attachment() -> Any

X.attachment()

Supplemental documentation: Qt 5 reference:

QOpenGLFramebufferObject::Attachment QOpenGLFramebufferObject::attachment() const

Returns the status of the depth and stencil buffers attached to this framebuffer object.

See also setAttachment().

Upstream PySide2 reference signatures (binding differences may apply):

attachment(self) -> PySide2.QtGui.QOpenGLFramebufferObject.Attachment

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#attachment

bind

bind() -> bool

X.bind() -> bool

Supplemental documentation: Qt 5 reference:

bool QOpenGLFramebufferObject::bind()

Switches rendering from the default, windowing system provided framebuffer to this framebuffer object. Returns true upon success, false otherwise.

Note: If takeTexture() was called, a new texture is created and associated with the framebuffer object. This is potentially expensive and changes the context state (the currently bound texture).

See also release().

Upstream PySide2 reference signatures (binding differences may apply):

bind(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#bind

bindDefault

bindDefault() -> bool

X.bindDefault() -> bool

Supplemental documentation: Qt 5 reference:

[static] bool QOpenGLFramebufferObject::bindDefault()

Switches rendering back to the default, windowing system provided framebuffer. Returns true upon success, false otherwise.

See also bind() and release().

Upstream PySide2 reference signatures (binding differences may apply):

bindDefault() -> bool

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#bindDefault

blitFramebuffer

blitFramebuffer(target: Any, targetRect: Any, source: Any, sourceRect: Any, buffers: int, filter: int, readColorAttachmentIndex: Any, drawColorAttachmentIndex: Any) -> None

X.blitFramebuffer(target, targetRect, source, sourceRect, buffers, filter, readColorAttachmentIndex, drawColorAttachmentIndex)

Supplemental documentation: Qt 5 reference:

[static] void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target, const QRect \&targetRect, QOpenGLFramebufferObject *source, const QRect \&sourceRect, GLbitfield buffers, GLenum filter, int readColorAttachmentIndex, int drawColorAttachmentIndex, QOpenGLFramebufferObject::FramebufferRestorePolicy restorePolicy)

Blits from the sourceRect rectangle in the source framebuffer object to the targetRect rectangle in the target framebuffer object.

If source or target is 0, the default framebuffer will be used instead of a framebuffer object as source or target respectively.

This function will have no effect unless hasOpenGLFramebufferBlit() returns true.

The buffers parameter should be a mask consisting of any combination of GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, and GL_STENCIL_BUFFER_BIT. Any buffer type that is not present both in the source and target buffers is ignored.

The sourceRect and targetRect rectangles may have different sizes; in this case buffers should not contain GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT. The filter parameter should be set to GL_LINEAR or GL_NEAREST, and specifies whether linear or nearest interpolation should be used when scaling is performed.

If source equals target a copy is performed within the same buffer. Results are undefined if the source and target rectangles overlap and have different sizes. The sizes must also be the same if any of the framebuffer objects are multisample framebuffers.

Note: The scissor test will restrict the blit area if enabled.

When multiple render targets are in use, readColorAttachmentIndex and drawColorAttachmentIndex specify the index of the color attachments in the source and destination framebuffers.

The restorePolicy determines if the framebuffer that was bound prior to calling this function should be restored, or if the default framebuffer should be bound before returning, of if the caller is responsible for tracking and setting the bound framebuffer. Restoring the previous framebuffer can be relatively expensive due to the call to glGetIntegerv which on some OpenGL drivers may imply a pipeline stall.

This function was introduced in Qt 5.7.

See also hasOpenGLFramebufferBlit().

[static] void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target, const QRect \&targetRect, QOpenGLFramebufferObject *source, const QRect \&sourceRect, GLbitfield buffers, GLenum filter, int readColorAttachmentIndex, int drawColorAttachmentIndex)

This is an overloaded function.

Convenience overload to blit between two framebuffer objects and to restore the previous framebuffer binding. Equivalent to calling blitFramebuffer(target, targetRect, source, sourceRect, buffers, filter, readColorAttachmentIndex, drawColorAttachmentIndex, RestoreFrameBufferBinding).

[static] void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target, const QRect \&targetRect, QOpenGLFramebufferObject *source, const QRect \&sourceRect, GLbitfield buffers \= GL_COLOR_BUFFER_BIT, GLenum filter \= GL_NEAREST)

This is an overloaded function.

* Convenience overload to blit between two framebuffer objects.

[static] void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target, QOpenGLFramebufferObject *source, GLbitfield buffers \= GL_COLOR_BUFFER_BIT, GLenum filter \= GL_NEAREST)

This is an overloaded function.

Convenience overload to blit between two framebuffer objects.

Upstream PySide2 reference signatures (binding differences may apply):

blitFramebuffer(target: PySide2.QtGui.QOpenGLFramebufferObject, source: PySide2.QtGui.QOpenGLFramebufferObject, buffers: int=..., filter: int=...) -> None
blitFramebuffer(target: PySide2.QtGui.QOpenGLFramebufferObject, targetRect: PySide2.QtCore.QRect, source: PySide2.QtGui.QOpenGLFramebufferObject, sourceRect: PySide2.QtCore.QRect, buffers: int, filter: int, readColorAttachmentIndex: int, drawColorAttachmentIndex: int) -> None
blitFramebuffer(target: PySide2.QtGui.QOpenGLFramebufferObject, targetRect: PySide2.QtCore.QRect, source: PySide2.QtGui.QOpenGLFramebufferObject, sourceRect: PySide2.QtCore.QRect, buffers: int, filter: int, readColorAttachmentIndex: int, drawColorAttachmentIndex: int, restorePolicy: PySide2.QtGui.QOpenGLFramebufferObject.FramebufferRestorePolicy) -> None
blitFramebuffer(target: PySide2.QtGui.QOpenGLFramebufferObject, targetRect: PySide2.QtCore.QRect, source: PySide2.QtGui.QOpenGLFramebufferObject, sourceRect: PySide2.QtCore.QRect, buffers: int=..., filter: int=...) -> None

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#blitFramebuffer

format

format() -> Any

X.format() -> PythonQt.QtGui.QOpenGLFramebufferObjectFormat

Supplemental documentation: Qt 5 reference:

QOpenGLFramebufferObjectFormat QOpenGLFramebufferObject::format() const

Returns the format of this framebuffer object.

Upstream PySide2 reference signatures (binding differences may apply):

format(self) -> PySide2.QtGui.QOpenGLFramebufferObjectFormat

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#format

handle

handle() -> int

X.handle() -> int

Supplemental documentation: Qt 5 reference:

GLuint QOpenGLFramebufferObject::handle() const

Returns the OpenGL framebuffer object handle for this framebuffer object (returned by the glGenFrameBuffersEXT() function). This handle can be used to attach new images or buffers to the framebuffer. The user is responsible for cleaning up and destroying these objects.

Upstream PySide2 reference signatures (binding differences may apply):

handle(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#handle

hasOpenGLFramebufferBlit

hasOpenGLFramebufferBlit() -> bool

X.hasOpenGLFramebufferBlit() -> bool

Supplemental documentation: Qt 5 reference:

[static] bool QOpenGLFramebufferObject::hasOpenGLFramebufferBlit()

Returns true if the OpenGL GL_EXT_framebuffer_blit extension is present on this system; otherwise returns false.

See also blitFramebuffer().

Upstream PySide2 reference signatures (binding differences may apply):

hasOpenGLFramebufferBlit() -> bool

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#hasOpenGLFramebufferBlit

hasOpenGLFramebufferObjects

hasOpenGLFramebufferObjects() -> bool

X.hasOpenGLFramebufferObjects() -> bool

Supplemental documentation: Qt 5 reference:

[static] bool QOpenGLFramebufferObject::hasOpenGLFramebufferObjects()

Returns true if the OpenGL GL_EXT_framebuffer_object extension is present on this system; otherwise returns false.

Upstream PySide2 reference signatures (binding differences may apply):

hasOpenGLFramebufferObjects() -> bool

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#hasOpenGLFramebufferObjects

height

height() -> int

X.height() -> int

Supplemental documentation: Qt 5 reference:

int QOpenGLFramebufferObject::height() const

Returns the height of the framebuffer object attachments.

Upstream PySide2 reference signatures (binding differences may apply):

height(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#height

isBound

isBound() -> bool

X.isBound() -> bool

Supplemental documentation: Qt 5 reference:

bool QOpenGLFramebufferObject::isBound() const

Returns true if the framebuffer object is currently bound to the current context, otherwise false is returned.

Upstream PySide2 reference signatures (binding differences may apply):

isBound(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#isBound

isValid

isValid() -> bool

X.isValid() -> bool

Supplemental documentation: Qt 5 reference:

bool QOpenGLFramebufferObject::isValid() const

Returns true if the framebuffer object is valid.

The framebuffer can become invalid if the initialization process fails, the user attaches an invalid buffer to the framebuffer object, or a non-power of two width/height is specified as the texture size if the texture target is GL_TEXTURE_2D. The non-power of two limitation does not apply if the OpenGL version is 2.0 or higher, or if the GL_ARB_texture_non_power_of_two extension is present.

The framebuffer can also become invalid if the QOpenGLContext that the framebuffer was created within is destroyed and there are no other shared contexts that can take over ownership of the framebuffer.

Upstream PySide2 reference signatures (binding differences may apply):

isValid(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#isValid

release

release() -> bool

X.release() -> bool

Supplemental documentation: Qt 5 reference:

bool QOpenGLFramebufferObject::release()

Switches rendering back to the default, windowing system provided framebuffer. Returns true upon success, false otherwise.

See also bind().

Upstream PySide2 reference signatures (binding differences may apply):

release(self) -> bool

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#release

setAttachment

setAttachment(attachment: Any) -> None

X.setAttachment(attachment)

Supplemental documentation: Qt 5 reference:

void QOpenGLFramebufferObject::setAttachment(QOpenGLFramebufferObject::Attachment attachment)

Sets the attachments of the framebuffer object to attachment.

This can be used to free or reattach the depth and stencil buffer attachments as needed.

Note: This function alters the current framebuffer binding.

See also attachment().

Upstream PySide2 reference signatures (binding differences may apply):

setAttachment(self, attachment: PySide2.QtGui.QOpenGLFramebufferObject.Attachment) -> None

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#setAttachment

size

size() -> Any

X.size() -> PythonQt.QtCore.QSize

Supplemental documentation: Qt 5 reference:

QSize QOpenGLFramebufferObject::size() const

Returns the size of the color and depth/stencil attachments attached to this framebuffer object.

Upstream PySide2 reference signatures (binding differences may apply):

size(self) -> PySide2.QtCore.QSize

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#size

sizes

sizes() -> tuple

X.sizes() -> tuple

Supplemental documentation: Qt 5 reference:

QVector\<QSize> QOpenGLFramebufferObject::sizes() const

Returns the sizes of all color attachments attached to this framebuffer object.

This function was introduced in Qt 5.6.

Upstream PySide2 reference signatures (binding differences may apply):

sizes(self) -> typing.List[PySide2.QtCore.QSize]

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#sizes

takeTexture

takeTexture(colorAttachmentIndex: Any) -> int

X.takeTexture(colorAttachmentIndex) -> int

Supplemental documentation: Qt 5 reference:

GLuint QOpenGLFramebufferObject::takeTexture()

Returns the texture id for the texture attached to this framebuffer object. The ownership of the texture is transferred to the caller.

If the framebuffer object is currently bound, an implicit release() will be done. During the next call to bind() a new texture will be created.

If a multisample framebuffer object is used, then there is no texture and the return value from this function will be invalid. Similarly, incomplete framebuffer objects will also return 0.

This function was introduced in Qt 5.3.

See also texture(), bind(), and release().

GLuint QOpenGLFramebufferObject::takeTexture(int colorAttachmentIndex)

This is an overloaded function.

Returns the texture id for the texture attached to the color attachment of index colorAttachmentIndex of this framebuffer object. The ownership of the texture is transferred to the caller.

When colorAttachmentIndex is 0, the behavior is identical to the parameter-less variant of this function.

If the framebuffer object is currently bound, an implicit release() will be done. During the next call to bind() a new texture will be created.

If a multisample framebuffer object is used, then there is no texture and the return value from this function will be invalid. Similarly, incomplete framebuffer objects will also return 0.

This function was introduced in Qt 5.6.

Upstream PySide2 reference signatures (binding differences may apply):

takeTexture(self) -> int
takeTexture(self, colorAttachmentIndex: int) -> int

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#takeTexture

texture

texture() -> int

X.texture() -> int

Supplemental documentation: Qt 5 reference:

GLuint QOpenGLFramebufferObject::texture() const

Returns the texture id for the texture attached as the default rendering target in this framebuffer object. This texture id can be bound as a normal texture in your own OpenGL code.

If a multisample framebuffer object is used then the value returned from this function will be invalid.

When multiple textures are attached, the return value is the ID of the first one.

See also takeTexture() and textures().

Upstream PySide2 reference signatures (binding differences may apply):

texture(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#texture

textures

textures() -> tuple

X.textures() -> tuple

Supplemental documentation: Qt 5 reference:

QVector\<GLuint> QOpenGLFramebufferObject::textures() const

Returns the texture id for all attached textures.

If a multisample framebuffer object is used, then an empty vector is returned.

This function was introduced in Qt 5.6.

See also takeTexture() and texture().

Upstream PySide2 reference signatures (binding differences may apply):

textures(self) -> typing.List[int]

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#textures

toImage

toImage(arg0: flipped, colorAttachmentIndex: Any) -> Any

X.toImage(flipped, colorAttachmentIndex) -> PythonQt.QtGui.QImage

Supplemental documentation: Qt 5 reference:

QImage QOpenGLFramebufferObject::toImage(bool flipped) const

Returns the contents of this framebuffer object as a QImage.

If flipped is true the image is flipped from OpenGL coordinates to raster coordinates. If used together with QOpenGLPaintDevice, flipped should be the opposite of the value of QOpenGLPaintDevice::paintFlipped().

The returned image has a format of premultiplied ARGB32 or RGB32. The latter is used only when internalTextureFormat() is set to GL_RGB. Since Qt 5.2 the function will fall back to premultiplied RGBA8888 or RGBx8888 when reading to (A)RGB32 is not supported, and this includes OpenGL ES. Since Qt 5.4 an A2BGR30 image is returned if the internal format is RGB10_A2, and since Qt 5.12 a RGBA64 image is return if the internal format is RGBA16.

If the rendering in the framebuffer was not done with premultiplied alpha in mind, create a wrapper QImage with a non-premultiplied format. This is necessary before performing operations like QImage::save() because otherwise the image data would get unpremultiplied, even though it was not premultiplied in the first place. To create such a wrapper without performing a copy of the pixel data, do the following:

QImage fboImage(fbo.toImage());
QImage image(fboImage.constBits(), fboImage.width(), fboImage.height(), QImage::Format_ARGB32);

For multisampled framebuffer objects the samples are resolved using the GL_EXT_framebuffer_blit extension. If the extension is not available, the contents of the returned image is undefined.

For singlesampled framebuffers the contents is retrieved via glReadPixels. This is a potentially expensive and inefficient operation. Therefore it is recommended that this function is used as seldom as possible.

See also QOpenGLPaintDevice::paintFlipped().

QImage QOpenGLFramebufferObject::toImage() const

This is an overloaded function.

Returns the contents of this framebuffer object as a QImage. This method flips the image from OpenGL coordinates to raster coordinates.

QImage QOpenGLFramebufferObject::toImage(bool flipped, int colorAttachmentIndex) const

This is an overloaded function.

Returns the contents of the color attachment of index colorAttachmentIndex of this framebuffer object as a QImage. This method flips the image from OpenGL coordinates to raster coordinates when flipped is set to true.

Note: This overload is only fully functional when multiple render targets are supported by the OpenGL implementation. When that is not the case, only one color attachment will be set up.

This function was introduced in Qt 5.6.

Upstream PySide2 reference signatures (binding differences may apply):

toImage(self) -> PySide2.QtGui.QImage
toImage(self, flipped: bool) -> PySide2.QtGui.QImage
toImage(self, flipped: bool, colorAttachmentIndex: int) -> PySide2.QtGui.QImage

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#toImage

width

width() -> int

X.width() -> int

Supplemental documentation: Qt 5 reference:

int QOpenGLFramebufferObject::width() const

Returns the width of the framebuffer object attachments.

Upstream PySide2 reference signatures (binding differences may apply):

width(self) -> int

Source: https://doc.qt.io/archives/qt-5.15/qopenglframebufferobject.html#width