### Class

# Cogl Framebuffer

#### Description

    abstract class Cogl.Framebuffer : GObject.Object {
      parent_instance: GObject
    }

No description available.

#### Ancestors

- GObject

#### Descendants

- CoglOffscreen
- CoglOnscreen

#### Functions

###### cogl_framebuffer_error_quark

No description available.

#### Instance methods

###### cogl_framebuffer_allocate

Explicitly allocates a configured `CoglFramebuffer` allowing developers to check and handle any errors that might arise from an unsupported configuration so that fallback configurations may be tried.

###### cogl_framebuffer_clear

Clears all the auxiliary buffers identified in the `buffers` mask, and if that includes the color buffer then the specified `color` is used.

###### cogl_framebuffer_clear4f

Clears all the auxiliary buffers identified in the `buffers` mask, and if that includes the color buffer then the specified `color` is used.

###### cogl_framebuffer_create_timestamp_query

Creates a query for the GPU timestamp that will complete upon completion of all previously submitted GL commands related to this framebuffer. E.g. when the rendering is finished on this framebuffer.

###### cogl_framebuffer_discard_buffers

Declares that the specified `buffers` no longer need to be referenced by any further rendering commands. This can be an important optimization to avoid subsequent frames of rendering depending on the results of a previous frame.

###### cogl_framebuffer_draw_multitextured_rectangle

Draws a textured rectangle to `framebuffer` with the given `pipeline` state with the top left corner positioned at (`x_1`, `y_1`) and the bottom right corner positioned at (`x_2`, `y_2`). As a pipeline may contain multiple texture layers this interface lets you supply texture coordinates for each layer of the pipeline.

###### cogl_framebuffer_draw_rectangle

Draws a rectangle to `framebuffer` with the given `pipeline` state and with the top left corner positioned at (`x_1`, `y_1`) and the bottom right corner positioned at (`x_2`, `y_2`).

###### cogl_framebuffer_draw_rectangles

Draws a series of rectangles to `framebuffer` with the given `pipeline` state in the same way that `cogl_framebuffer_draw_rectangle()` does.

###### cogl_framebuffer_draw_textured_rectangle

Draws a textured rectangle to `framebuffer` using the given `pipeline` state with the top left corner positioned at (`x_1`, `y_1`) and the bottom right corner positioned at (`x_2`, `y_2`). The top left corner will have texture coordinates of (`s_1`, `t_1`) and the bottom right corner will have texture coordinates of (`s_2`, `t_2`).

###### cogl_framebuffer_draw_textured_rectangles

Draws a series of rectangles to `framebuffer` with the given `pipeline` state in the same way that `cogl_framebuffer_draw_textured_rectangle()` does.

###### cogl_framebuffer_finish

This blocks the CPU until all pending rendering associated with the specified framebuffer has completed. It’s very rare that developers should ever need this level of synchronization with the GPU and should never be used unless you clearly understand why you need to explicitly force synchronization.

###### cogl_framebuffer_flush

Flushes `framebuffer` to ensure the current batch of commands is submitted to the GPU.

###### cogl_framebuffer_frustum

Replaces the current projection matrix with a perspective matrix for a given viewing frustum defined by 4 side clip planes that all cross through the origin and 2 near and far clip planes.

###### cogl_framebuffer_get_alpha_bits

Retrieves the number of alpha bits of `framebuffer`.

###### cogl_framebuffer_get_blue_bits

Retrieves the number of blue bits of `framebuffer`.

###### cogl_framebuffer_get_context

Can be used to query the `CoglContext` a given `framebuffer` was instantiated within. This is the `CoglContext` that was passed to `cogl_onscreen_new()` for example.

###### cogl_framebuffer_get_depth_bits

Retrieves the number of depth bits of `framebuffer`.

###### cogl_framebuffer_get_depth_write_enabled

Queries whether depth buffer writing is enabled for `framebuffer`. This can be controlled via cogl_framebuffer_set_depth_write_enabled().

###### cogl_framebuffer_get_dither_enabled

Returns whether dithering has been requested for the given `framebuffer`. See `cogl_framebuffer_set_dither_enabled()` for more details about dithering.

###### cogl_framebuffer_get_green_bits

Retrieves the number of green bits of `framebuffer`.

###### cogl_framebuffer_get_height

Queries the current height of the given `framebuffer`.

###### cogl_framebuffer_get_is_stereo

No description available.

###### cogl_framebuffer_get_modelview_matrix

Stores the current model-view matrix in `matrix`.

###### cogl_framebuffer_get_projection_matrix

Stores the current projection matrix in `matrix`.

###### cogl_framebuffer_get_red_bits

Retrieves the number of red bits of `framebuffer`.

###### cogl_framebuffer_get_samples_per_pixel

Gets the number of points that are sampled per-pixel when rasterizing geometry. Usually by default this will return 0 which means that single-sample not multisample rendering has been chosen. When using a GPU supporting multisample rendering it’s possible to increase the number of samples per pixel using cogl_framebuffer_set_samples_per_pixel().

###### cogl_framebuffer_get_stereo_mode

Gets the current `CoglStereoMode`, which defines which stereo buffers should be drawn to. See cogl_framebuffer_set_stereo_mode().

###### cogl_framebuffer_get_viewport4fv

Queries the x, y, width and height components of the current viewport as set using `cogl_framebuffer_set_viewport()` or the default values which are 0, 0, framebuffer_width and framebuffer_height. The values are written into the given `viewport` array.

###### cogl_framebuffer_get_viewport_height

Queries the height of the viewport as set using `cogl_framebuffer_set_viewport()` or the default value which is the height of the framebuffer.

###### cogl_framebuffer_get_viewport_width

Queries the width of the viewport as set using `cogl_framebuffer_set_viewport()` or the default value which is the width of the framebuffer.

###### cogl_framebuffer_get_viewport_x

Queries the x coordinate of the viewport origin as set using `cogl_framebuffer_set_viewport()` or the default value which is 0.

###### cogl_framebuffer_get_viewport_y

Queries the y coordinate of the viewport origin as set using `cogl_framebuffer_set_viewport()` or the default value which is 0.

###### cogl_framebuffer_get_width

Queries the current width of the given `framebuffer`.

###### cogl_framebuffer_identity_matrix

Resets the current model-view matrix to the identity matrix.

###### cogl_framebuffer_orthographic

Replaces the current projection matrix with an orthographic projection matrix.

###### cogl_framebuffer_perspective

Replaces the current projection matrix with a perspective matrix based on the provided values.

###### cogl_framebuffer_pop_clip

Reverts the clipping region to the state before the last call to cogl_framebuffer_push_scissor_clip(), `cogl_framebuffer_push_rectangle_clip()` cogl_framebuffer_push_path_clip(), or cogl_framebuffer_push_primitive_clip().

###### cogl_framebuffer_pop_matrix

Restores the model-view matrix on the top of the matrix stack.

###### cogl_framebuffer_push_matrix

Copies the current model-view matrix onto the matrix stack. The matrix can later be restored with cogl_framebuffer_pop_matrix().

###### cogl_framebuffer_push_primitive_clip

Sets a new clipping area using a 2D shaped described with a `CoglPrimitive`. The shape must not contain self overlapping geometry and must lie on a single 2D plane. A bounding box of the 2D shape in local coordinates (the same coordinates used to describe the shape) must be given. It is acceptable for the bounds to be larger than the true bounds but behaviour is undefined if the bounds are smaller than the true bounds.

###### cogl_framebuffer_push_rectangle_clip

Specifies a modelview transformed rectangular clipping area for all subsequent drawing operations. Any drawing commands that extend outside the rectangle will be clipped so that only the portion inside the rectangle will be displayed. The rectangle dimensions are transformed by the current model-view matrix.

###### cogl_framebuffer_push_region_clip

No description available.

###### cogl_framebuffer_push_scissor_clip

Specifies a rectangular clipping area for all subsequent drawing operations. Any drawing commands that extend outside the rectangle will be clipped so that only the portion inside the rectangle will be displayed. The rectangle dimensions are not transformed by the current model-view matrix.

###### cogl_framebuffer_read_pixels

This is a convenience wrapper around `cogl_framebuffer_read_pixels_into_bitmap()` which allocates a temporary `CoglBitmap` to read pixel data directly into the given buffer. The rowstride of the buffer is assumed to be the width of the region times the bytes per pixel of the format. The source for the data is always taken from the color buffer. If you want to use any other rowstride or source, please use the `cogl_framebuffer_read_pixels_into_bitmap()` function directly.

###### cogl_framebuffer_read_pixels_into_bitmap

This reads a rectangle of pixels from the given framebuffer where position (0, 0) is the top left. The pixel at (x, y) is the first read, and a rectangle of pixels with the same size as the bitmap is read right and downwards from that point.

###### cogl_framebuffer_resolve_samples

When point sample rendering (also known as multisample rendering) has been enabled via `cogl_framebuffer_set_samples_per_pixel()` then you can optionally call this function (or cogl_framebuffer_resolve_samples_region()) to explicitly resolve the point samples into values for the final color buffer.

###### cogl_framebuffer_resolve_samples_region

When point sample rendering (also known as multisample rendering) has been enabled via `cogl_framebuffer_set_samples_per_pixel()` then you can optionally call this function (or cogl_framebuffer_resolve_samples()) to explicitly resolve the point samples into values for the final color buffer.

###### cogl_framebuffer_rotate

Multiplies the current model-view matrix by one that rotates the model around the axis-vector specified by `x`, `y` and `z`. The rotation follows the right-hand thumb rule so for example rotating by 10 degrees about the axis-vector (0, 0, 1) causes a small counter-clockwise rotation.

###### cogl_framebuffer_rotate_euler

Multiplies the current model-view matrix by one that rotates according to the rotation described by `euler`.

###### cogl_framebuffer_scale

Multiplies the current model-view matrix by one that scales the x, y and z axes by the given values.

###### cogl_framebuffer_set_depth_write_enabled

Enables or disables depth buffer writing when rendering to `framebuffer`. If depth writing is enabled for both the framebuffer and the rendering pipeline, and the framebuffer has an associated depth buffer, depth information will be written to this buffer during rendering.

###### cogl_framebuffer_set_dither_enabled

Enables or disabled dithering if supported by the hardware.

###### cogl_framebuffer_set_modelview_matrix

Sets `matrix` as the new model-view matrix.

###### cogl_framebuffer_set_projection_matrix

Sets `matrix` as the new projection matrix.

###### cogl_framebuffer_set_samples_per_pixel

Requires that when rendering to `framebuffer` then `n` point samples should be made per pixel which will all contribute to the final resolved color for that pixel. The idea is that the hardware aims to get quality similar to what you would get if you rendered everything twice as big (for 4 samples per pixel) and then scaled that image back down with filtering. It can effectively remove the jagged edges of polygons and should be more efficient than if you were to manually render at a higher resolution and downscale because the hardware is often able to take some shortcuts. For example the GPU may only calculate a single texture sample for all points of a single pixel, and for tile based architectures all the extra sample data (such as depth and stencil samples) may be handled on-chip and so avoid increased demand on system memory bandwidth.

###### cogl_framebuffer_set_stereo_mode

Sets which stereo buffers should be drawn to. The default is `COGL_STEREO_BOTH`, which means that both the left and right buffers will be affected by drawing. For this to have an effect, the display system must support stereo drawables, and the framebuffer must have been created with stereo enabled. (See cogl_onscreen_template_set_stereo_enabled(), cogl_framebuffer_get_is_stereo().)

###### cogl_framebuffer_set_viewport

Defines a scale and offset for everything rendered relative to the top-left of the destination framebuffer.

###### cogl_framebuffer_transform

Multiplies the current model-view matrix by the given matrix.

###### cogl_framebuffer_translate

Multiplies the current model-view matrix by one that translates the model along all three axes according to the given values.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### Cogl.Framebuffer:context

No description available.

###### Cogl.Framebuffer:driver-config

No description available.

###### Cogl.Framebuffer:height

No description available.

###### Cogl.Framebuffer:width

No description available.

#### Signals

###### Cogl.Framebuffer::destroy

No description available.

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct CoglFramebufferClass {
      gboolean (* allocate) (
        CoglFramebuffer* framebuffer,
        GError** error
      );
      gboolean (* is_y_flipped) (
        CoglFramebuffer* framebuffer
      );

    }

No description available.

###### Class members

`allocate: gboolean (* allocate) ( CoglFramebuffer* framebuffer, GError** error )`
  No description available.
`is_y_flipped: gboolean (* is_y_flipped) ( CoglFramebuffer* framebuffer )`
  No description available.

#### Virtual methods

###### Cogl.FramebufferClass.allocate

Explicitly allocates a configured `CoglFramebuffer` allowing developers to check and handle any errors that might arise from an unsupported configuration so that fallback configurations may be tried.

###### Cogl.FramebufferClass.is_y_flipped

No description available.