A #CoglContext
The desired framebuffer width
The desired framebuffer height
Installs a callback
function that will be called whenever the
window system has lost the contents of a region of the onscreen
buffer and the application should redraw it to repair the buffer.
For example this may happen in a window system without a compositor
if a window that was previously covering up the onscreen window has
been moved causing a region of the onscreen to be exposed.
The callback
will be passed a #CoglOnscreenDirtyInfo struct which
decribes a rectangle containing the newly dirtied region. Note that
this may be called multiple times to describe a non-rectangular
region composed of multiple smaller rectangles.
The dirty events are separate from %COGL_FRAME_EVENT_SYNC events so the application should also listen for this event before rendering the dirty region to ensure that the framebuffer is actually ready for rendering.
A callback function to call for dirty events
An optional callback to destroy user_data
when the callback
is removed or onscreen
is freed.
Installs a callback
function that will be called for significant
events relating to the given onscreen
framebuffer.
The callback
will be used to notify when the system compositor is
ready for this application to render a new frame. In this case
%COGL_FRAME_EVENT_SYNC will be passed as the event argument to the
given callback
in addition to the #CoglFrameInfo corresponding to
the frame beeing acknowledged by the compositor.
The callback
will also be called to notify when the frame has
ended. In this case %COGL_FRAME_EVENT_COMPLETE will be passed as
the event argument to the given callback
in addition to the
#CoglFrameInfo corresponding to the newly presented frame. The
meaning of "ended" here simply means that no more timing
information will be collected within the corresponding
#CoglFrameInfo and so this is a good opportunity to analyse the
given info. It does not necessarily mean that the GPU has finished
rendering the corresponding frame.
We highly recommend throttling your application according to %COGL_FRAME_EVENT_SYNC events so that your application can avoid wasting resources, drawing more frames than your system compositor can display.
A callback function to call for frame events
An optional callback to destroy user_data
when the callback
is removed or onscreen
is freed.
Registers a callback
with onscreen
that will be called whenever
the onscreen
framebuffer changes size.
The callback
can be removed using
cogl_onscreen_remove_resize_callback() passing the returned closure
pointer.
onscreen
framebuffer that is resized, a resize callback can also be used to
track when the viewport has been changed automatically by Cogl in
case your application needs more specialized control over the
viewport.
A #CoglOnscreenResizeCallback to call when the onscreen
changes size.
An optional callback to destroy user_data
when the callback
is removed or onscreen
is freed.
Installs a callback
function that should be called whenever a swap buffers
request (made using cogl_onscreen_swap_buffers()) for the given
onscreen
completes.
We recommend using this mechanism when available to manually throttle your applications (in conjunction with cogl_onscreen_set_swap_throttled()) so your application will be able to avoid long blocks in the driver caused by throttling when you request to swap buffers too quickly.
A callback function to call when a swap has completed
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.
Creates a binding between source_property
on source
and target_property
on target
.
Whenever the source_property
is changed the target_property
is
updated using the same value. For instance:
g_object_bind_property (action, "active", widget, "sensitive", 0);
Will result in the "sensitive" property of the widget #GObject instance to be updated with the same value of the "active" property of the action #GObject instance.
If flags
contains %G_BINDING_BIDIRECTIONAL then the binding will be mutual:
if target_property
on target
changes then the source_property
on source
will be updated as well.
The binding will automatically be removed when either the source
or the
target
instances are finalized. To remove the binding without affecting the
source
and the target
you can just call g_object_unref() on the returned
#GBinding instance.
Removing the binding by calling g_object_unref() on it must only be done if
the binding, source
and target
are only used from a single thread and it
is clear that both source
and target
outlive the binding. Especially it
is not safe to rely on this if the binding, source
or target
can be
finalized from different threads. Keep another reference to the binding and
use g_binding_unbind() instead to be on the safe side.
A #GObject can have multiple bindings.
the property on source
to bind
the target #GObject
the property on target
to bind
flags to pass to #GBinding
Creates a binding between source_property
on source
and target_property
on target,
allowing you to set the transformation functions to be used by
the binding.
This function is the language bindings friendly version of g_object_bind_property_full(), using #GClosures instead of function pointers.
the property on source
to bind
the target #GObject
the property on target
to bind
flags to pass to #GBinding
a #GClosure wrapping the transformation function from the source
to the target,
or %NULL to use the default
a #GClosure wrapping the transformation function from the target
to the source,
or %NULL to use the default
Removes a fence previously submitted with cogl_framebuffer_add_fence_callback(); the callback will not be called.
The #CoglFenceClosure returned from cogl_framebuffer_add_fence_callback()
Clears all the auxiliary buffers identified in the buffers
mask, and if
that includes the color buffer then the specified color
is used.
A mask of #CoglBufferBit's identifying which auxiliary buffers to clear
The color to clear the color buffer too if specified in buffers
.
Clears all the auxiliary buffers identified in the buffers
mask, and if
that includes the color buffer then the specified color
is used.
A mask of #CoglBufferBit's identifying which auxiliary buffers to clear
The red component of color to clear the color buffer too if specified in buffers
.
The green component of color to clear the color buffer too if specified in buffers
.
The blue component of color to clear the color buffer too if specified in buffers
.
The alpha component of color to clear the color buffer too if specified in 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.
For example; some tile-based rendering GPUs are able to avoid allocating and accessing system memory for the depth and stencil buffer so long as these buffers are not required as input for subsequent frames and that can save a significant amount of memory bandwidth used to save and restore their contents to system memory between frames.
It is currently considered an error to try and explicitly discard the color buffer by passing %COGL_BUFFER_BIT_COLOR. This is because the color buffer is already implicitly discard when you finish rendering to a #CoglOnscreen framebuffer, and it's not meaningful to try and discard the color buffer of a #CoglOffscreen framebuffer since they are single-buffered.
A #CoglBufferBit mask of which ancillary buffers you want to discard.
First defines a geometry primitive by grouping a set of vertex attributes;
specifying a first_vertex;
a number of vertices (n_vertices)
and
specifying what kind of topology the vertices have via mode
.
Then the function draws the given primitive
geometry to the specified
destination framebuffer
using the graphics processing pipeline described by
pipeline
.
The list of #CoglAttributes define the attributes of the vertices to
be drawn, such as positions, colors and normals and the number of attributes
is given as n_attributes
.
This drawing api doesn't support high-level meta texture types such
as #CoglTexture2DSliced so it is the user's responsibility to
ensure that only low-level textures that can be directly sampled by
a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D
are associated with layers of the given pipeline
.
A #CoglPipeline state object
The #CoglVerticesMode defining the topology of vertices
The vertex offset within the given attributes to draw from
The number of vertices to draw from the given attributes
An array of pointers to #CoglAttribute<-- -->s defining vertex geometry
The number of attributes in the attributes
array.
Behaves the same as cogl_framebuffer_draw_attributes() except that
instead of reading vertex data sequentially from the specified
attributes
the indices
provide an indirection for how the data
should be indexed allowing a random access order to be
specified.
For example an indices array of [0, 1, 2, 0, 2, 3] could be used
used to draw two triangles (mode
= %COGL_VERTICES_MODE_TRIANGLES +
n_vertices
= 6) but only provide attribute data for the 4 corners
of a rectangle. When the GPU needs to read in each of the 6
vertices it will read the indices
array for each vertex in
sequence and use the index to look up the vertex attribute data. So
here you can see that first and fourth vertex will point to the
same data and third and fifth vertex will also point to shared
data.
Drawing with indices can be a good way of minimizing the size of a mesh by allowing you to avoid data for duplicate vertices because multiple entries in the index array can refer back to a single shared vertex.
indices
array must be at least as long as first_vertex
n_vertices
otherwise the GPU will overrun the indices array when
looking up vertex data.Since it's very common to want to draw a run of rectangles using indices to avoid duplicating vertex data you can use cogl_get_rectangle_indices() to get a set of indices that can be shared.
This drawing api doesn't support high-level meta texture types such
as #CoglTexture2DSliced so it is the user's responsibility to
ensure that only low-level textures that can be directly sampled by
a GPU such as #CoglTexture2D, #CoglTextureRectangle or
#CoglTexture3D are associated with layers of the given pipeline
.
A #CoglPipeline state object
The #CoglVerticesMode defining the topology of vertices
The vertex offset within the given attributes to draw from
The number of vertices to draw from the given attributes
The array of indices used by the GPU to lookup attribute data for each vertex.
An array of pointers to #CoglAttribute<-- -->s defining vertex geometry
The number of attributes in the attributes
array.
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.
This is a high level drawing api that can handle any kind of #CoglMetaTexture texture for the first layer such as #CoglTexture2DSliced textures which may internally be comprised of multiple low-level textures. This is unlike low-level drawing apis such as cogl_primitive_draw() which only support low level texture types that are directly supported by GPUs such as #CoglTexture2D.
The top left texture coordinate for layer 0 of any pipeline will be (tex_coords[0], tex_coords[1]) and the bottom right coordinate will be (tex_coords[2], tex_coords[3]). The coordinates for layer 1 would be (tex_coords[4], tex_coords[5]) (tex_coords[6], tex_coords[7]) and so on...
The given texture coordinates should always be normalized such that (0, 0) corresponds to the top left and (1, 1) corresponds to the bottom right. To map an entire texture across the rectangle pass in tex_coords[0]=0, tex_coords[1]=0, tex_coords[2]=1, tex_coords[3]=1.
The first pair of coordinates are for the first layer (with the smallest layer index) and if you supply less texture coordinates than there are layers in the current source material then default texture coordinates (0.0, 0.0, 1.0, 1.0) are generated.
A #CoglPipeline state object
x coordinate upper left on screen.
y coordinate upper left on screen.
x coordinate lower right on screen.
y coordinate lower right on screen.
An array containing groups of 4 float values: [s_1, t_1, s_2, t_2] that are interpreted as two texture coordinates; one for the top left texel, and one for the bottom right texel. Each value should be between 0.0 and 1.0, where the coordinate (0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the bottom right.
The length of the tex_coords
array. (For one layer and one group of texture coordinates, this would be 4)
Draws the given primitive
geometry to the specified destination
framebuffer
using the graphics processing state described by pipeline
.
This drawing api doesn't support high-level meta texture types such
as #CoglTexture2DSliced so it is the user's responsibility to
ensure that only low-level textures that can be directly sampled by
a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D
are associated with layers of the given pipeline
.
A #CoglPipeline state object
A #CoglPrimitive geometry object
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
).
A #CoglPipeline state object
X coordinate of the top-left corner
Y coordinate of the top-left corner
X coordinate of the bottom-right corner
Y coordinate of the bottom-right corner
Draws a series of rectangles to framebuffer
with the given
pipeline
state in the same way that
cogl_framebuffer_draw_rectangle() does.
The top left corner of the first rectangle is positioned at (coordinates[0], coordinates[1]) and the bottom right corner is positioned at (coordinates[2], coordinates[3]). The positions for the second rectangle are (coordinates[4], coordinates[5]) and (coordinates[6], coordinates[7]) and so on...
As a general rule for better performance its recommended to use
this this API instead of calling
cogl_framebuffer_draw_textured_rectangle() separately for multiple
rectangles if all of the rectangles will be drawn together with the
same pipeline
state.
A #CoglPipeline state object
an array of coordinates containing groups of 4 float values: [x_1, y_1, x_2, y_2] that are interpreted as two position coordinates; one for the top left of the rectangle (x1, y1), and one for the bottom right of the rectangle (x2, y2).
number of rectangles defined in coordinates
.
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
).
This is a high level drawing api that can handle any kind of #CoglMetaTexture texture such as #CoglTexture2DSliced textures which may internally be comprised of multiple low-level textures. This is unlike low-level drawing apis such as cogl_primitive_draw() which only support low level texture types that are directly supported by GPUs such as #CoglTexture2D.
s_1
=0.0 t_1
=0.0 s_2
=1.0 t_2
=1.0
The given texture coordinates should always be normalized such that
(0, 0) corresponds to the top left and (1, 1) corresponds to the
bottom right. To map an entire texture across the rectangle pass
in s_1
=0, t_1
=0, s_2
=1, t_2
=1.
pipeline
layers which normally implies working
with non-normalized texture coordinates this api should still be
passed normalized texture coordinates.
A #CoglPipeline state object
x coordinate upper left on screen.
y coordinate upper left on screen.
x coordinate lower right on screen.
y coordinate lower right on screen.
S texture coordinate of the top-left coorner
T texture coordinate of the top-left coorner
S texture coordinate of the bottom-right coorner
T texture coordinate of the bottom-right coorner
Draws a series of rectangles to framebuffer
with the given
pipeline
state in the same way that
cogl_framebuffer_draw_textured_rectangle() does.
This is a high level drawing api that can handle any kind of #CoglMetaTexture texture such as #CoglTexture2DSliced textures which may internally be comprised of multiple low-level textures. This is unlike low-level drawing apis such as cogl_primitive_draw() which only support low level texture types that are directly supported by GPUs such as #CoglTexture2D.
The top left corner of the first rectangle is positioned at (coordinates[0], coordinates[1]) and the bottom right corner is positioned at (coordinates[2], coordinates[3]). The top left texture coordinate is (coordinates[4], coordinates[5]) and the bottom right texture coordinate is (coordinates[6], coordinates[7]). The coordinates for subsequent rectangles are defined similarly by the subsequent coordinates.
As a general rule for better performance its recommended to use
this this API instead of calling
cogl_framebuffer_draw_textured_rectangle() separately for multiple
rectangles if all of the rectangles will be drawn together with the
same pipeline
state.
The given texture coordinates should always be normalized such that (0, 0) corresponds to the top left and (1, 1) corresponds to the bottom right. To map an entire texture across the rectangle pass in tex_coords[0]=0, tex_coords[1]=0, tex_coords[2]=1, tex_coords[3]=1.
A #CoglPipeline state object
an array containing groups of 8 float values: [x_1, y_1, x_2, y_2, s_1, t_1, s_2, t_2] that have the same meaning as the arguments for cogl_framebuffer_draw_textured_rectangle().
number of rectangles to coordinates
to draw
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.
One example might be for benchmarking purposes to be sure timing measurements reflect the time that the GPU is busy for not just the time it takes to queue rendering commands.
This function is intended for #GObject implementations to re-enforce a [floating][floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink().
Increases the freeze count on object
. If the freeze count is
non-zero, the emission of "notify" signals on object
is
stopped. The signals are queued until the freeze count is decreased
to zero. Duplicate notifications are squashed so that at most one
#GObject::notify signal is emitted for each property modified while the
object is frozen.
This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.
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.
X position of the left clipping plane where it intersects the near clipping plane
X position of the right clipping plane where it intersects the near clipping plane
Y position of the bottom clipping plane where it intersects the near clipping plane
Y position of the top clipping plane where it intersects the near clipping plane
The distance to the near clipping plane (Must be positive)
The distance to the far clipping plane (Must be positive)
Retrieves the number of alpha bits of framebuffer
Retrieves the number of blue bits of framebuffer
Gets the current age of the buffer contents.
This function allows applications to query the age of the current back buffer contents for a #CoglOnscreen as the number of frames elapsed since the contents were most recently defined.
These age values exposes enough information to applications about how Cogl internally manages back buffers to allow applications to re-use the contents of old frames and minimize how much must be redrawn for the next frame.
The back buffer contents can either be reported as invalid (has an age of 0) or it may be reported to be the same contents as from n frames prior to the current frame.
The queried value remains valid until the next buffer swap.
The recommended way to take advantage of this buffer age api is to
build up a circular buffer of length 3 for tracking damage regions
over the last 3 frames and when starting a new frame look at the
age of the buffer and combine the damage regions for the current
frame with the damage regions of previous age
frames so you know
everything that must be redrawn to update the old contents for the
new frame.
Gets a named field from the objects table of associations (see g_object_set_data()).
name of the key for that association
Retrieves the number of depth bits of framebuffer
Retrieves the depth buffer of framebuffer
as a #CoglTexture. You need to
call cogl_framebuffer_get_depth_texture(fb, TRUE); before using this
function.
Queries whether texture based depth buffer has been enabled via cogl_framebuffer_set_depth_texture_enabled().
Queries whether depth buffer writing is enabled for framebuffer
. This
can be controlled via cogl_framebuffer_set_depth_write_enabled().
Returns whether dithering has been requested for the given framebuffer
.
See cogl_framebuffer_set_dither_enabled() for more details about dithering.
framebuffer
display pipeline does not support dithering. This value only represents
the user's request for dithering.
Gets the value of the framebuffers frame counter. This is a counter that increases by one each time cogl_onscreen_swap_buffers() or cogl_onscreen_swap_region() is called.
Retrieves the number of green bits of framebuffer
Queries the current height of the given framebuffer
.
Gets a property of an object.
The value
can be:
In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling g_value_unset().
Note that g_object_get_property() is really intended for language bindings, g_object_get() is much more convenient for C programming.
the name of the property to get
return location for the property value
This function gets back user data pointers stored via g_object_set_qdata().
A #GQuark, naming the user data pointer
Retrieves the number of red bits of framebuffer
Lets you query whether onscreen
has been marked as resizable via
the cogl_onscreen_set_resizable() api.
By default, if possible, a onscreen
will be created by Cogl
as non resizable, but it is not guaranteed that this is always
possible for all window systems.
onscreen,
%TRUE) has been
previously called then this function will return %TRUE, but it's
possible that the current windowing system being used does not
support window resizing (consider fullscreen windows on a phone or
a TV). This function is not aware of whether resizing is truly
meaningful with your window system, only whether the onscreen
has
been marked as resizable.
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().
Calling cogl_framebuffer_get_samples_per_pixel() before the framebuffer has been allocated will simply return the value set using cogl_framebuffer_set_samples_per_pixel(). After the framebuffer has been allocated the value will reflect the actual number of samples that will be made by the GPU.
Gets the current #CoglStereoMode, which defines which stereo buffers should be drawn to. See cogl_framebuffer_set_stereo_mode().
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.
Queries the height of the viewport as set using cogl_framebuffer_set_viewport() or the default value which is the height of the framebuffer.
Queries the width of the viewport as set using cogl_framebuffer_set_viewport() or the default value which is the width of the framebuffer.
Queries the x coordinate of the viewport origin as set using cogl_framebuffer_set_viewport() or the default value which is 0.
Queries the y coordinate of the viewport origin as set using cogl_framebuffer_set_viewport() or the default value which is 0.
Queries the current width of the given framebuffer
.
Gets n_properties
properties for an object
.
Obtained properties will be set to values
. All properties must be valid.
Warnings will be emitted and undefined behaviour may result if invalid
properties are passed in.
the names of each property to get
the values of each property to get
This requests to make onscreen
invisible to the user.
Actually the precise semantics of this function depend on the window system currently in use, and if you don't have a multi-windowining system this function may in-fact do nothing.
This function does not implicitly allocate the given onscreen
framebuffer before hiding it.
Resets the current model-view matrix to the identity matrix.
Checks whether object
has a [floating][floating-ref] reference.
Emits a "notify" signal for the property property_name
on object
.
When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.
Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.
the name of a property installed on the class of object
.
Emits a "notify" signal for the property specified by pspec
on object
.
This function omits the property name lookup, hence it is faster than g_object_notify().
One way to avoid using g_object_notify() from within the class that registered the properties, and using g_object_notify_by_pspec() instead, is to store the GParamSpec used with g_object_class_install_property() inside a static array, e.g.:
enum
{
PROP_0,
PROP_FOO,
PROP_LAST
};
static GParamSpec *properties[PROP_LAST];
static void
my_object_class_init (MyObjectClass *klass)
{
properties[PROP_FOO] = g_param_spec_int ("foo", "Foo", "The foo",
0, 100,
50,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class,
PROP_FOO,
properties[PROP_FOO]);
}
and then notify a change on the "foo" property with:
g_object_notify_by_pspec (self, properties[PROP_FOO]);
the #GParamSpec of a property installed on the class of object
.
Replaces the current projection matrix with an orthographic projection matrix.
The x coordinate for the first vertical clipping plane
The y coordinate for the first horizontal clipping plane
The x coordinate for the second vertical clipping plane
The y coordinate for the second horizontal clipping plane
The
The
Replaces the current projection matrix with a perspective matrix based on the provided values.
z_far
/ z_near
ratio since that will reduce the effectiveness of depth testing
since there wont be enough precision to identify the depth of
objects near to each other.
Vertical field of view angle in degrees.
The (width over height) aspect ratio for display
The distance to the near clipping plane (Must be positive, and must not be 0)
The distance to the far clipping plane (Must be positive)
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().
Restores the model-view matrix on the top of the matrix stack.
Copies the current model-view matrix onto the matrix stack. The matrix can later be restored with cogl_framebuffer_pop_matrix().
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.
The primitive is transformed by the current model-view matrix and the silhouette is intersected with the previous clipping area. To restore the previous clipping area, call cogl_framebuffer_pop_clip().
A #CoglPrimitive describing a flat 2D shape
x coordinate for the top-left corner of the primitives bounds
y coordinate for the top-left corner of the primitives bounds
x coordinate for the bottom-right corner of the primitives bounds.
y coordinate for the bottom-right corner of the primitives bounds.
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.
The rectangle is intersected with the current clip region. To undo the effect of this function, call cogl_framebuffer_pop_clip().
x coordinate for top left corner of the clip rectangle
y coordinate for top left corner of the clip rectangle
x coordinate for bottom right corner of the clip rectangle
y coordinate for bottom right corner of the clip rectangle
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.
The rectangle is intersected with the current clip region. To undo the effect of this function, call cogl_framebuffer_pop_clip().
left edge of the clip rectangle in window coordinates
top edge of the clip rectangle in window coordinates
width of the clip rectangle
height of the clip rectangle
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.
The implementation of the function looks like this:
|[ bitmap = cogl_bitmap_new_for_data (context, width, height, format, /* rowstride */ bpp * width, pixels); cogl_framebuffer_read_pixels_into_bitmap (framebuffer, x, y, COGL_READ_PIXELS_COLOR_BUFFER, bitmap); cogl_object_unref (bitmap);
@param x The x position to read from
@param y The y position to read from
@param width The width of the region of rectangles to read
@param height The height of the region of rectangles to read
@param format The pixel format to store the data in
@param pixels The address of the buffer to store the data in
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.
Currently Cogl assumes that the framebuffer is in a premultiplied
format so if the format of bitmap
is non-premultiplied it will
convert it. To read the pixel values without any conversion you
should either specify a format that doesn't use an alpha channel or
use one of the formats ending in PRE.
The x position to read from
The y position to read from
Identifies which auxillary buffer you want to read (only COGL_READ_PIXELS_COLOR_BUFFER supported currently)
The bitmap to store the results in.
Increase the reference count of object,
and possibly remove the
[floating][floating-ref] reference, if object
has a floating reference.
In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one.
Since GLib 2.56, the type of object
will be propagated to the return type
under the same conditions as for g_object_ref().
Removes a callback and associated user data that were previously registered using cogl_onscreen_add_dirty_callback().
If a destroy callback was passed to cogl_onscreen_add_dirty_callback() to destroy the user data then this will also get called.
A #CoglOnscreenDirtyClosure returned from cogl_onscreen_add_dirty_callback()
Removes a callback and associated user data that were previously registered using cogl_onscreen_add_frame_callback().
If a destroy callback was passed to cogl_onscreen_add_frame_callback() to destroy the user data then this will get called.
A #CoglFrameClosure returned from cogl_onscreen_add_frame_callback()
Removes a resize callback
and user_data
pair that were previously
associated with onscreen
via cogl_onscreen_add_resize_callback().
An identifier returned from cogl_onscreen_add_resize_callback()
Removes a callback that was previously registered using cogl_onscreen_add_swap_buffers_callback().
An identifier returned from cogl_onscreen_add_swap_buffers_callback()
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.
Some GPUs will implicitly resolve the point samples during rendering and so this function is effectively a nop, but with other architectures it is desirable to defer the resolve step until the end of the frame.
Since Cogl will automatically ensure samples are resolved if the target color buffer is used as a source this API only needs to be used if explicit control is desired - perhaps because you want to ensure that the resolve is completed in advance to avoid later having to wait for the resolve to complete.
If you are performing incremental updates to a framebuffer you should consider using cogl_framebuffer_resolve_samples_region() instead to avoid resolving redundant pixels.
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.
Some GPUs will implicitly resolve the point samples during rendering and so this function is effectively a nop, but with other architectures it is desirable to defer the resolve step until the end of the frame.
Use of this API is recommended if incremental, small updates to a framebuffer are being made because by default Cogl will implicitly resolve all the point samples of the framebuffer which can result in redundant work if only a small number of samples have changed.
Because some GPUs implicitly resolve point samples this function only guarantees that at-least the region specified will be resolved and if you have rendered to a larger region then it's possible that other samples may be implicitly resolved.
top-left x coordinate of region to resolve
top-left y coordinate of region to resolve
width of region to resolve
height of region to resolve
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.
Angle in degrees to rotate.
X-component of vertex to rotate around.
Y-component of vertex to rotate around.
Z-component of vertex to rotate around.
Multiplies the current model-view matrix by one that rotates
according to the rotation described by quaternion
.
A #CoglQuaternion
Releases all references to other objects. This can be used to break reference cycles.
This function should only be called from object system implementations.
Multiplies the current model-view matrix by one that scales the x, y and z axes by the given values.
Amount to scale along the x-axis
Amount to scale along the y-axis
Amount to scale along the z-axis
Each object carries around a table of associations from strings to pointers. This function lets you set an association.
If the object already had an association with that name, the old association will be destroyed.
Internally, the key
is converted to a #GQuark using g_quark_from_string().
This means a copy of key
is kept permanently (even after object
has been
finalized) — so it is recommended to only use a small, bounded set of values
for key
in your program, to avoid the #GQuark storage growing unbounded.
name of the key
data to associate with that key
If enabled
is #TRUE, the depth buffer used when rendering to framebuffer
is available as a texture. You can retrieve the texture with
cogl_framebuffer_get_depth_texture().
TRUE or FALSE
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.
Depth buffer writing is enabled by default.
%TRUE to enable depth writing or %FALSE to disable
Enables or disabled dithering if supported by the hardware.
Dithering is a hardware dependent technique to increase the visible color resolution beyond what the underlying hardware supports by playing tricks with the colors placed into the framebuffer to give the illusion of other colors. (For example this can be compared to half-toning used by some news papers to show varying levels of grey even though their may only be black and white are available).
If the current display pipeline for framebuffer
does not support dithering
then this has no affect.
Dithering is enabled by default.
%TRUE to enable dithering or %FALSE to disable
Sets a property on an object.
the name of the property to set
the value
Lets you request Cogl to mark an onscreen
framebuffer as
resizable or not.
By default, if possible, a onscreen
will be created by Cogl
as non resizable, but it is not guaranteed that this is always
possible for all window systems.
onscreen
framebuffer
is truly meaningful for your current window system (consider
applications being run fullscreen on a phone or TV) so this
function may not have any useful effect. If you are running on a
multi windowing system such as X11 or Win32 or OSX then Cogl will
request to the window system that users be allowed to resize the
onscreen,
although it's still possible that some other window
management policy will block this possibility.
onscreen
framebuffer is resized the viewport
will be automatically updated to match the new size of the
framebuffer with an origin of (0,0). If your application needs more
specialized control of the viewport it will need to register a
resize handler using cogl_onscreen_add_resize_callback() so that it
can track when the viewport has been changed automatically.
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.
By default this value is usually set to 0 and that is referred to as "single-sample" rendering. A value of 1 or greater is referred to as "multisample" rendering.
The minimum number of samples per pixel
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().)
A #CoglStereoMode specifying which stereo buffers should be drawn tow.
Requests that the given onscreen
framebuffer should have swap buffer
requests (made using cogl_onscreen_swap_buffers()) throttled either by a
displays vblank period or perhaps some other mechanism in a composited
environment.
Whether swap throttling is wanted or not.
Defines a scale and offset for everything rendered relative to the top-left of the destination framebuffer.
By default the viewport has an origin of (0,0) and width and height that match the framebuffer's size. Assuming a default projection and modelview matrix then you could translate the contents of a window down and right by leaving the viewport size unchanged by moving the offset to (10,10). The viewport coordinates are measured in pixels. If you left the x and y origin as (0,0) you could scale the windows contents down by specify and width and height that's half the real size of the framebuffer.
The top-left x coordinate of the viewport origin (only integers supported currently)
The top-left y coordinate of the viewport origin (only integers supported currently)
The width of the viewport (only integers supported currently)
The height of the viewport (only integers supported currently)
This requests to make onscreen
visible to the user.
Actually the precise semantics of this function depend on the window system currently in use, and if you don't have a multi-windowining system this function may in-fact do nothing.
This function will implicitly allocate the given onscreen
framebuffer before showing it if it hasn't already been allocated.
When using the Wayland winsys calling this will set the surface to a toplevel type which will make it appear. If the application wants to set a different type for the surface, it can avoid calling cogl_onscreen_show() and set its own type directly with the Wayland client API via cogl_wayland_onscreen_get_surface().
Remove a specified datum from the object's data associations, without invoking the association's destroy handler.
name of the key
This function gets back user data pointers stored via
g_object_set_qdata() and removes the data
from object
without invoking its destroy() function (if any was
set).
Usually, calling this function is only required to update
user data pointers with a destroy notifier, for example:
void
object_add_to_user_list (GObject *object,
const gchar *new_string)
{
// the quark, naming the object data
GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
// retrieve the old string list
GList *list = g_object_steal_qdata (object, quark_string_list);
// prepend new string
list = g_list_prepend (list, g_strdup (new_string));
// this changed 'list', so we need to set it again
g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
}
static void
free_string_list (gpointer data)
{
GList *node, *list = data;
for (node = list; node; node = node->next)
g_free (node->data);
g_list_free (list);
}
Using g_object_get_qdata() in the above example, instead of g_object_steal_qdata() would have left the destroy function set, and thus the partial string list would have been freed upon g_object_set_qdata_full().
A #GQuark, naming the user data pointer
Swaps the current back buffer being rendered too, to the front for display.
This function also implicitly discards the contents of the color, depth and stencil buffers as if cogl_framebuffer_discard_buffers() were used. The significance of the discard is that you should not expect to be able to start a new frame that incrementally builds on the contents of the previous frame.
Swaps the current back buffer being rendered too, to the front for display and provides information to any system compositor about what regions of the buffer have changed (damage) with respect to the last swapped buffer.
This function has the same semantics as cogl_framebuffer_swap_buffers() except that it additionally allows applications to pass a list of damaged rectangles which may be passed on to a compositor so that it can minimize how much of the screen is redrawn in response to this applications newly swapped front buffer.
For example if your application is only animating a small object in the corner of the screen and everything else is remaining static then it can help the compositor to know that only the bottom right corner of your newly swapped buffer has really changed with respect to your previously swapped front buffer.
If n_rectangles
is 0 then the whole buffer will implicitly be
reported as damaged as if cogl_onscreen_swap_buffers() had been
called.
This function also implicitly discards the contents of the color, depth and stencil buffers as if cogl_framebuffer_discard_buffers() were used. The significance of the discard is that you should not expect to be able to start a new frame that incrementally builds on the contents of the previous frame. If you want to perform incremental updates to older back buffers then please refer to the cogl_onscreen_get_buffer_age() api.
Whenever possible it is recommended that applications use this function instead of cogl_onscreen_swap_buffers() to improve performance when running under a compositor.
An array of integer 4-tuples representing damaged rectangles as (x, y, width, height) tuples.
The number of 4-tuples to be read from rectangles
Swaps a region of the back buffer being rendered too, to the front for
display. rectangles
represents the region as array of n_rectangles
each
defined by 4 sequential (x, y, width, height) integers.
This function also implicitly discards the contents of the color, depth and stencil buffers as if cogl_framebuffer_discard_buffers() were used. The significance of the discard is that you should not expect to be able to start a new frame that incrementally builds on the contents of the previous frame.
An array of integer 4-tuples representing rectangles as (x, y, width, height) tuples.
The number of 4-tuples to be read from rectangles
Reverts the effect of a previous call to
g_object_freeze_notify(). The freeze count is decreased on object
and when it reaches zero, queued "notify" signals are emitted.
Duplicate notifications for each property are squashed so that at most one #GObject::notify signal is emitted for each property, in the reverse order in which they have been queued.
It is an error to call this function when the freeze count is zero.
Multiplies the current model-view matrix by one that translates the model along all three axes according to the given values.
Distance to translate along the x-axis
Distance to translate along the y-axis
Distance to translate along the z-axis
Decreases the reference count of object
. When its reference count
drops to 0, the object is finalized (i.e. its memory is freed).
If the pointer to the #GObject may be reused in future (for example, if it is an instance variable of another object), it is recommended to clear the pointer to %NULL rather than retain a dangling pointer to a potentially invalid #GObject instance. Use g_clear_object() for this.
Emits a "notify" signal for the property property_name
on object
.
When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.
Note that emission of the notify signal may be blocked with g_object_freeze_notify(). In this case, the signal emissions are queued and will be emitted (in reverse order) when g_object_thaw_notify() is called.
This function essentially limits the life time of the closure
to
the life time of the object. That is, when the object is finalized,
the closure
is invalidated by calling g_closure_invalidate() on
it, in order to prevent invocations of the closure with a finalized
(nonexisting) object. Also, g_object_ref() and g_object_unref() are
added as marshal guards to the closure,
to ensure that an extra
reference count is held on object
during invocation of the
closure
. Usually, this function will be called on closures that
use this object
as closure data.
#GClosure to watch
Find the #GParamSpec with the given name for an
interface. Generally, the interface vtable passed in as g_iface
will be the default vtable from g_type_default_interface_ref(), or,
if you know the interface has already been loaded,
g_type_default_interface_peek().
any interface vtable for the interface, or the default vtable for the interface
name of a property to look up.
Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created #GParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property.
This function is meant to be called from the interface's default
vtable initialization function (the class_init
member of
#GTypeInfo.) It must not be called after after class_init
has
been called for any object types implementing this interface.
If pspec
is a floating reference, it will be consumed.
any interface vtable for the interface, or the default vtable for the interface.
the #GParamSpec for the new property
Lists the properties of an interface.Generally, the interface
vtable passed in as g_iface
will be the default vtable from
g_type_default_interface_ref(), or, if you know the interface has
already been loaded, g_type_default_interface_peek().
any interface vtable for the interface, or the default vtable for the interface
Instantiates an "unallocated" #CoglOnscreen framebuffer that may be configured before later being allocated, either implicitly when it is first used or explicitly via cogl_framebuffer_allocate().
A #CoglContext
The desired framebuffer width
The desired framebuffer height
Creates a new instance of a #GObject subtype and sets its properties.
Construction parameters (see %G_PARAM_CONSTRUCT, %G_PARAM_CONSTRUCT_ONLY) which are not explicitly specified are set to their default values.
the type id of the #GObject subtype to instantiate
an array of #GParameter
Instantiates an "unallocated" #CoglOnscreen framebuffer that may be configured before later being allocated, either implicitly when it is first used or explicitly via cogl_framebuffer_allocate().