#[repr(C)]
pub struct QOpenGLFramebufferObject { /* private fields */ }
Expand description

The QOpenGLFramebufferObject class encapsulates an OpenGL framebuffer object.

C++ class: QOpenGLFramebufferObject.

C++ documentation:

The QOpenGLFramebufferObject class encapsulates an OpenGL framebuffer object.

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.

Implementations§

source§

impl QOpenGLFramebufferObject

source

pub unsafe fn add_color_attachment_q_size_uint( &self, size: impl CastInto<Ref<QSize>>, internal_format: c_uint )

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

Calls C++ function: void QOpenGLFramebufferObject::addColorAttachment(const QSize& size, unsigned int internalFormat = …).

C++ documentation:

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.

source

pub unsafe fn add_color_attachment_2_int_uint( &self, width: c_int, height: c_int, internal_format: c_uint )

This is an overloaded function.

Calls C++ function: void QOpenGLFramebufferObject::addColorAttachment(int width, int height, unsigned int internalFormat = …).

C++ documentation:

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.

source

pub unsafe fn add_color_attachment_q_size( &self, size: impl CastInto<Ref<QSize>> )

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

Calls C++ function: void QOpenGLFramebufferObject::addColorAttachment(const QSize& size).

C++ documentation:

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.

source

pub unsafe fn add_color_attachment_2_int(&self, width: c_int, height: c_int)

This is an overloaded function.

Calls C++ function: void QOpenGLFramebufferObject::addColorAttachment(int width, int height).

C++ documentation:

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.

source

pub unsafe fn attachment(&self) -> Attachment

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

Calls C++ function: QOpenGLFramebufferObject::Attachment QOpenGLFramebufferObject::attachment() const.

C++ documentation:

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

See also setAttachment().

source

pub unsafe fn bind(&self) -> bool

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

Calls C++ function: bool QOpenGLFramebufferObject::bind().

C++ documentation:

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().

source

pub unsafe fn bind_default() -> bool

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

Calls C++ function: static bool QOpenGLFramebufferObject::bindDefault().

C++ documentation:

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

See also bind() and release().

source

pub unsafe fn blit_framebuffer_q_opengl_framebuffer_object_q_rect_q_opengl_framebuffer_object_q_rect2_uint2_int_framebuffer_restore_policy( target: impl CastInto<Ptr<QOpenGLFramebufferObject>>, target_rect: impl CastInto<Ref<QRect>>, source: impl CastInto<Ptr<QOpenGLFramebufferObject>>, source_rect: impl CastInto<Ref<QRect>>, buffers: c_uint, filter: c_uint, read_color_attachment_index: c_int, draw_color_attachment_index: c_int, restore_policy: FramebufferRestorePolicy )

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

Calls C++ function: static void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject* target, const QRect& targetRect, QOpenGLFramebufferObject* source, const QRect& sourceRect, unsigned int buffers, unsigned int filter, int readColorAttachmentIndex, int drawColorAttachmentIndex, QOpenGLFramebufferObject::FramebufferRestorePolicy restorePolicy).

C++ documentation:

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().

source

pub unsafe fn blit_framebuffer_q_opengl_framebuffer_object_q_rect_q_opengl_framebuffer_object_q_rect2_uint2_int( target: impl CastInto<Ptr<QOpenGLFramebufferObject>>, target_rect: impl CastInto<Ref<QRect>>, source: impl CastInto<Ptr<QOpenGLFramebufferObject>>, source_rect: impl CastInto<Ref<QRect>>, buffers: c_uint, filter: c_uint, read_color_attachment_index: c_int, draw_color_attachment_index: c_int )

This is an overloaded function.

Calls C++ function: static void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject* target, const QRect& targetRect, QOpenGLFramebufferObject* source, const QRect& sourceRect, unsigned int buffers, unsigned int filter, int readColorAttachmentIndex, int drawColorAttachmentIndex).

C++ documentation:

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).

source

pub unsafe fn blit_framebuffer_q_opengl_framebuffer_object_q_rect_q_opengl_framebuffer_object_q_rect2_uint( target: impl CastInto<Ptr<QOpenGLFramebufferObject>>, target_rect: impl CastInto<Ref<QRect>>, source: impl CastInto<Ptr<QOpenGLFramebufferObject>>, source_rect: impl CastInto<Ref<QRect>>, buffers: c_uint, filter: c_uint )

This is an overloaded function.

Calls C++ function: static void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject* target, const QRect& targetRect, QOpenGLFramebufferObject* source, const QRect& sourceRect, unsigned int buffers = …, unsigned int filter = …).

C++ documentation:

This is an overloaded function.

* Convenience overload to blit between two framebuffer objects.

source

pub unsafe fn blit_framebuffer_2_q_opengl_framebuffer_object2_uint( target: impl CastInto<Ptr<QOpenGLFramebufferObject>>, source: impl CastInto<Ptr<QOpenGLFramebufferObject>>, buffers: c_uint, filter: c_uint )

This is an overloaded function.

Calls C++ function: static void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject* target, QOpenGLFramebufferObject* source, unsigned int buffers = …, unsigned int filter = …).

C++ documentation:

This is an overloaded function.

Convenience overload to blit between two framebuffer objects.

source

pub unsafe fn blit_framebuffer_q_opengl_framebuffer_object_q_rect_q_opengl_framebuffer_object_q_rect_uint( target: impl CastInto<Ptr<QOpenGLFramebufferObject>>, target_rect: impl CastInto<Ref<QRect>>, source: impl CastInto<Ptr<QOpenGLFramebufferObject>>, source_rect: impl CastInto<Ref<QRect>>, buffers: c_uint )

This is an overloaded function.

Calls C++ function: static void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject* target, const QRect& targetRect, QOpenGLFramebufferObject* source, const QRect& sourceRect, unsigned int buffers = …).

C++ documentation:

This is an overloaded function.

* Convenience overload to blit between two framebuffer objects.

source

pub unsafe fn blit_framebuffer_q_opengl_framebuffer_object_q_rect_q_opengl_framebuffer_object_q_rect( target: impl CastInto<Ptr<QOpenGLFramebufferObject>>, target_rect: impl CastInto<Ref<QRect>>, source: impl CastInto<Ptr<QOpenGLFramebufferObject>>, source_rect: impl CastInto<Ref<QRect>> )

This is an overloaded function.

Calls C++ function: static void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject* target, const QRect& targetRect, QOpenGLFramebufferObject* source, const QRect& sourceRect).

C++ documentation:

This is an overloaded function.

* Convenience overload to blit between two framebuffer objects.

source

pub unsafe fn blit_framebuffer_2_q_opengl_framebuffer_object_uint( target: impl CastInto<Ptr<QOpenGLFramebufferObject>>, source: impl CastInto<Ptr<QOpenGLFramebufferObject>>, buffers: c_uint )

This is an overloaded function.

Calls C++ function: static void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject* target, QOpenGLFramebufferObject* source, unsigned int buffers = …).

C++ documentation:

This is an overloaded function.

Convenience overload to blit between two framebuffer objects.

source

pub unsafe fn blit_framebuffer_2_q_opengl_framebuffer_object( target: impl CastInto<Ptr<QOpenGLFramebufferObject>>, source: impl CastInto<Ptr<QOpenGLFramebufferObject>> )

This is an overloaded function.

Calls C++ function: static void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject* target, QOpenGLFramebufferObject* source).

C++ documentation:

This is an overloaded function.

Convenience overload to blit between two framebuffer objects.

source

pub unsafe fn format(&self) -> CppBox<QOpenGLFramebufferObjectFormat>

Returns the format of this framebuffer object.

Calls C++ function: QOpenGLFramebufferObjectFormat QOpenGLFramebufferObject::format() const.

C++ documentation:

Returns the format of this framebuffer object.

source

pub unsafe fn handle(&self) -> u32

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.

Calls C++ function: GLuint QOpenGLFramebufferObject::handle() const.

C++ documentation:

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.

source

pub unsafe fn has_opengl_framebuffer_blit() -> bool

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

Calls C++ function: static bool QOpenGLFramebufferObject::hasOpenGLFramebufferBlit().

C++ documentation:

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

See also blitFramebuffer().

source

pub unsafe fn has_opengl_framebuffer_objects() -> bool

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

Calls C++ function: static bool QOpenGLFramebufferObject::hasOpenGLFramebufferObjects().

C++ documentation:

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

source

pub unsafe fn height(&self) -> c_int

Returns the height of the framebuffer object attachments.

Calls C++ function: int QOpenGLFramebufferObject::height() const.

C++ documentation:

Returns the height of the framebuffer object attachments.

source

pub unsafe fn is_bound(&self) -> bool

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

Calls C++ function: bool QOpenGLFramebufferObject::isBound() const.

C++ documentation:

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

source

pub unsafe fn is_valid(&self) -> bool

Returns true if the framebuffer object is valid.

Calls C++ function: bool QOpenGLFramebufferObject::isValid() const.

C++ documentation:

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.

source

pub unsafe fn from_q_size_uint( size: impl CastInto<Ref<QSize>>, target: c_uint ) -> CppBox<QOpenGLFramebufferObject>

Constructs an OpenGL framebuffer object and binds a 2D OpenGL texture to the buffer of the size size. The texture is bound to the GL_COLOR_ATTACHMENT0 target in the framebuffer object.

Calls C++ function: [constructor] void QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize& size, unsigned int target = …).

C++ documentation:

Constructs an OpenGL framebuffer object and binds a 2D OpenGL texture to the buffer of the size size. The texture is bound to the GL_COLOR_ATTACHMENT0 target in the framebuffer object.

The target parameter is used to specify the OpenGL texture target. The default target is GL_TEXTURE_2D. Keep in mind that GL_TEXTURE_2D textures must have a power of 2 width and height (e.g. 256x512), unless you are using OpenGL 2.0 or higher.

By default, no depth and stencil buffers are attached. This behavior can be toggled using one of the overloaded constructors.

The default internal texture format is GL_RGBA8 for desktop OpenGL, and GL_RGBA for OpenGL/ES.

It is important that you have a current OpenGL context set when creating the QOpenGLFramebufferObject, otherwise the initialization will fail.

See also size(), texture(), and attachment().

source

pub unsafe fn from_2_int_uint( width: c_int, height: c_int, target: c_uint ) -> CppBox<QOpenGLFramebufferObject>

This is an overloaded function.

Calls C++ function: [constructor] void QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, unsigned int target = …).

C++ documentation:

This is an overloaded function.

Constructs an OpenGL framebuffer object and binds a 2D OpenGL texture to the buffer of the given width and height.

See also size() and texture().

source

pub unsafe fn from_q_size_attachment2_uint( size: impl CastInto<Ref<QSize>>, attachment: Attachment, target: c_uint, internal_format: c_uint ) -> CppBox<QOpenGLFramebufferObject>

This is an overloaded function.

Calls C++ function: [constructor] void QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize& size, QOpenGLFramebufferObject::Attachment attachment, unsigned int target = …, unsigned int internalFormat = …).

C++ documentation:

This is an overloaded function.

Constructs an OpenGL framebuffer object and binds a texture to the buffer of the given size.

The attachment parameter describes the depth/stencil buffer configuration, target the texture target and internalFormat the internal texture format. The default texture target is GL_TEXTURE_2D, while the default internal format is GL_RGBA8 for desktop OpenGL and GL_RGBA for OpenGL/ES.

See also size(), texture(), and attachment().

source

pub unsafe fn from_2_int_attachment2_uint( width: c_int, height: c_int, attachment: Attachment, target: c_uint, internal_format: c_uint ) -> CppBox<QOpenGLFramebufferObject>

This is an overloaded function.

Calls C++ function: [constructor] void QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, QOpenGLFramebufferObject::Attachment attachment, unsigned int target = …, unsigned int internalFormat = …).

C++ documentation:

This is an overloaded function.

Constructs an OpenGL framebuffer object and binds a texture to the buffer of the given width and height.

The attachment parameter describes the depth/stencil buffer configuration, target the texture target and internalFormat the internal texture format. The default texture target is GL_TEXTURE_2D, while the default internal format is GL_RGBA8 for desktop OpenGL and GL_RGBA for OpenGL/ES.

See also size(), texture(), and attachment().

source

pub unsafe fn from_q_size_q_opengl_framebuffer_object_format( size: impl CastInto<Ref<QSize>>, format: impl CastInto<Ref<QOpenGLFramebufferObjectFormat>> ) -> CppBox<QOpenGLFramebufferObject>

This is an overloaded function.

Calls C++ function: [constructor] void QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize& size, const QOpenGLFramebufferObjectFormat& format).

C++ documentation:

This is an overloaded function.

Constructs an OpenGL framebuffer object of the given size based on the supplied format.

source

pub unsafe fn from_2_int_q_opengl_framebuffer_object_format( width: c_int, height: c_int, format: impl CastInto<Ref<QOpenGLFramebufferObjectFormat>> ) -> CppBox<QOpenGLFramebufferObject>

This is an overloaded function.

Calls C++ function: [constructor] void QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, const QOpenGLFramebufferObjectFormat& format).

C++ documentation:

This is an overloaded function.

Constructs an OpenGL framebuffer object of the given width and height based on the supplied format.

source

pub unsafe fn from_q_size( size: impl CastInto<Ref<QSize>> ) -> CppBox<QOpenGLFramebufferObject>

Constructs an OpenGL framebuffer object and binds a 2D OpenGL texture to the buffer of the size size. The texture is bound to the GL_COLOR_ATTACHMENT0 target in the framebuffer object.

Calls C++ function: [constructor] void QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize& size).

C++ documentation:

Constructs an OpenGL framebuffer object and binds a 2D OpenGL texture to the buffer of the size size. The texture is bound to the GL_COLOR_ATTACHMENT0 target in the framebuffer object.

The target parameter is used to specify the OpenGL texture target. The default target is GL_TEXTURE_2D. Keep in mind that GL_TEXTURE_2D textures must have a power of 2 width and height (e.g. 256x512), unless you are using OpenGL 2.0 or higher.

By default, no depth and stencil buffers are attached. This behavior can be toggled using one of the overloaded constructors.

The default internal texture format is GL_RGBA8 for desktop OpenGL, and GL_RGBA for OpenGL/ES.

It is important that you have a current OpenGL context set when creating the QOpenGLFramebufferObject, otherwise the initialization will fail.

See also size(), texture(), and attachment().

source

pub unsafe fn from_2_int( width: c_int, height: c_int ) -> CppBox<QOpenGLFramebufferObject>

This is an overloaded function.

Calls C++ function: [constructor] void QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height).

C++ documentation:

This is an overloaded function.

Constructs an OpenGL framebuffer object and binds a 2D OpenGL texture to the buffer of the given width and height.

See also size() and texture().

source

pub unsafe fn from_q_size_attachment_uint( size: impl CastInto<Ref<QSize>>, attachment: Attachment, target: c_uint ) -> CppBox<QOpenGLFramebufferObject>

This is an overloaded function.

Calls C++ function: [constructor] void QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize& size, QOpenGLFramebufferObject::Attachment attachment, unsigned int target = …).

C++ documentation:

This is an overloaded function.

Constructs an OpenGL framebuffer object and binds a texture to the buffer of the given size.

The attachment parameter describes the depth/stencil buffer configuration, target the texture target and internalFormat the internal texture format. The default texture target is GL_TEXTURE_2D, while the default internal format is GL_RGBA8 for desktop OpenGL and GL_RGBA for OpenGL/ES.

See also size(), texture(), and attachment().

source

pub unsafe fn from_q_size_attachment( size: impl CastInto<Ref<QSize>>, attachment: Attachment ) -> CppBox<QOpenGLFramebufferObject>

This is an overloaded function.

Calls C++ function: [constructor] void QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize& size, QOpenGLFramebufferObject::Attachment attachment).

C++ documentation:

This is an overloaded function.

Constructs an OpenGL framebuffer object and binds a texture to the buffer of the given size.

The attachment parameter describes the depth/stencil buffer configuration, target the texture target and internalFormat the internal texture format. The default texture target is GL_TEXTURE_2D, while the default internal format is GL_RGBA8 for desktop OpenGL and GL_RGBA for OpenGL/ES.

See also size(), texture(), and attachment().

source

pub unsafe fn from_2_int_attachment_uint( width: c_int, height: c_int, attachment: Attachment, target: c_uint ) -> CppBox<QOpenGLFramebufferObject>

This is an overloaded function.

Calls C++ function: [constructor] void QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, QOpenGLFramebufferObject::Attachment attachment, unsigned int target = …).

C++ documentation:

This is an overloaded function.

Constructs an OpenGL framebuffer object and binds a texture to the buffer of the given width and height.

The attachment parameter describes the depth/stencil buffer configuration, target the texture target and internalFormat the internal texture format. The default texture target is GL_TEXTURE_2D, while the default internal format is GL_RGBA8 for desktop OpenGL and GL_RGBA for OpenGL/ES.

See also size(), texture(), and attachment().

source

pub unsafe fn from_2_int_attachment( width: c_int, height: c_int, attachment: Attachment ) -> CppBox<QOpenGLFramebufferObject>

This is an overloaded function.

Calls C++ function: [constructor] void QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, QOpenGLFramebufferObject::Attachment attachment).

C++ documentation:

This is an overloaded function.

Constructs an OpenGL framebuffer object and binds a texture to the buffer of the given width and height.

The attachment parameter describes the depth/stencil buffer configuration, target the texture target and internalFormat the internal texture format. The default texture target is GL_TEXTURE_2D, while the default internal format is GL_RGBA8 for desktop OpenGL and GL_RGBA for OpenGL/ES.

See also size(), texture(), and attachment().

source

pub unsafe fn release(&self) -> bool

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

Calls C++ function: bool QOpenGLFramebufferObject::release().

C++ documentation:

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

See also bind().

source

pub unsafe fn set_attachment(&self, attachment: Attachment)

Sets the attachments of the framebuffer object to attachment.

Calls C++ function: void QOpenGLFramebufferObject::setAttachment(QOpenGLFramebufferObject::Attachment attachment).

C++ documentation:

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().

source

pub unsafe fn size(&self) -> CppBox<QSize>

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

Calls C++ function: QSize QOpenGLFramebufferObject::size() const.

C++ documentation:

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

source

pub unsafe fn sizes(&self) -> CppBox<QVectorOfQSize>

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

Calls C++ function: QVector<QSize> QOpenGLFramebufferObject::sizes() const.

C++ documentation:

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

This function was introduced in Qt 5.6.

source

pub unsafe fn take_texture_0a(&self) -> u32

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

Calls C++ function: GLuint QOpenGLFramebufferObject::takeTexture().

C++ documentation:

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().

source

pub unsafe fn take_texture_1a(&self, color_attachment_index: c_int) -> u32

This is an overloaded function.

Calls C++ function: GLuint QOpenGLFramebufferObject::takeTexture(int colorAttachmentIndex).

C++ documentation:

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.

source

pub unsafe fn texture(&self) -> u32

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.

Calls C++ function: GLuint QOpenGLFramebufferObject::texture() const.

C++ documentation:

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().

source

pub unsafe fn textures(&self) -> CppBox<QVectorOfU32>

Returns the texture id for all attached textures.

Calls C++ function: QVector<GLuint> QOpenGLFramebufferObject::textures() const.

C++ documentation:

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().

source

pub unsafe fn to_image_0a(&self) -> CppBox<QImage>

This is an overloaded function.

Calls C++ function: QImage QOpenGLFramebufferObject::toImage() const.

C++ documentation:

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.

source

pub unsafe fn to_image_1a(&self, flipped: bool) -> CppBox<QImage>

Returns the contents of this framebuffer object as a QImage.

Calls C++ function: QImage QOpenGLFramebufferObject::toImage(bool flipped) const.

C++ documentation:

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.

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().

source

pub unsafe fn to_image_2a( &self, flipped: bool, color_attachment_index: c_int ) -> CppBox<QImage>

This is an overloaded function.

Calls C++ function: QImage QOpenGLFramebufferObject::toImage(bool flipped, int colorAttachmentIndex) const.

C++ documentation:

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.

source

pub unsafe fn width(&self) -> c_int

Returns the width of the framebuffer object attachments.

Calls C++ function: int QOpenGLFramebufferObject::width() const.

C++ documentation:

Returns the width of the framebuffer object attachments.

Trait Implementations§

source§

impl CppDeletable for QOpenGLFramebufferObject

source§

unsafe fn delete(&self)

Destroys the framebuffer object and frees any allocated resources.

Calls C++ function: virtual [destructor] void QOpenGLFramebufferObject::~QOpenGLFramebufferObject().

C++ documentation:

Destroys the framebuffer object and frees any allocated resources.

source§

impl Size for QOpenGLFramebufferObject

source§

unsafe fn size(&self) -> usize

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

Calls C++ function: QSize QOpenGLFramebufferObject::size() const.

C++ documentation:

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

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.