a buffer object
Retrieves the update hints set using cogl_buffer_set_update_hint()
a buffer object
Maps the buffer into the application address space for direct access. This is equivalent to calling cogl_buffer_map_range() with zero as the offset and the size of the entire buffer as the size.
It is strongly recommended that you pass %COGL_BUFFER_MAP_HINT_DISCARD as a hint if you are going to replace all the buffer's data. This way if the buffer is currently being used by the GPU then the driver won't have to stall the CPU and wait for the hardware to finish because it can instead allocate a new buffer to map.
The behaviour is undefined if you access the buffer in a way
conflicting with the access
mask you pass. It is also an error to
release your last reference while the buffer is mapped.
a buffer object
how the mapped buffer will be used by the application
A mask of #CoglBufferMapHints that tell Cogl how the data will be modified once mapped.
Maps a sub-region of the buffer into the application's address space for direct access.
It is strongly recommended that you pass %COGL_BUFFER_MAP_HINT_DISCARD as a hint if you are going to replace all the buffer's data. This way if the buffer is currently being used by the GPU then the driver won't have to stall the CPU and wait for the hardware to finish because it can instead allocate a new buffer to map. You can pass %COGL_BUFFER_MAP_HINT_DISCARD_RANGE instead if you want the regions outside of the mapping to be retained.
The behaviour is undefined if you access the buffer in a way
conflicting with the access
mask you pass. It is also an error to
release your last reference while the buffer is mapped.
a buffer object
Offset within the buffer to start the mapping
The size of data to map
how the mapped buffer will be used by the application
A mask of #CoglBufferMapHints that tell Cogl how the data will be modified once mapped.
Updates part of the buffer with new data from data
. Where to put this new
data is controlled by offset
and offset
+ data
should be less than the
buffer size.
a buffer object
destination offset (in bytes) in the buffer
a pointer to the data to be copied into the buffer
number of bytes to copy
Sets the update hint on a buffer. See #CoglBufferUpdateHint for a description of the available hints.
a buffer object
the new hint
Unmaps a buffer previously mapped by cogl_buffer_map().
a buffer object
Allows visualizing the operations that build up the given entry
for debugging purposes by printing to stdout.
A #CoglMatrixEntry
Invokes func
once for each type of object that Cogl uses and
passes a count of the number of objects for that type. This is
intended to be used solely for debugging purposes to track down
issues with objects leaking.
A callback function for each type
Prints a list of all the object types that Cogl uses along with the number of objects of that type that are currently in use. This is intended to be used solely for debugging purposes to track down issues with objects leaking.
Compares the two given euler angles v1
and v1
and it they are
equal returns %TRUE else %FALSE.
The first euler angle to compare
The second euler angle to compare
Iterates through all the context level features currently supported
for a given context
and for each feature callback
is called.
A #CoglContext pointer
A #CoglFeatureCallback called for each supported feature
Returns the current time value from Cogl's internal clock. This clock is used for measuring times such as the presentation time in a #CoglFrameInfo.
This method is meant for converting timestamps retrieved from Cogl to other time systems, and is not meant to be used as a standalone timing system. For that reason, if this function is called without having retrieved a valid (non-zero) timestamp from Cogl first, it may return 0 to indicate that Cogl has no active internal clock.
Gets the current #CoglFramebuffer as set using cogl_push_framebuffer()
Returns a pointer to a singleton quaternion constant describing the canonical identity [1 (0, 0, 0)] which represents no rotation.
If you multiply a quaternion with the identity quaternion you will get back the same value as the original quaternion.
Gets an OpenGL ES 2.0 texture handle for a #CoglTexture that can then be referenced by a #CoglGLES2Context. As well as returning a texture handle the texture's target (such as GL_TEXTURE_2D) is also returned.
If the #CoglTexture can not be shared with a #CoglGLES2Context then this function will return %FALSE.
This api does not affect the lifetime of the CoglTexture and you must take care not to reference the returned handle after the original texture has been freed.
A #CoglTexture
A return location for an OpenGL ES 2.0 texture handle
A return location for an OpenGL ES 2.0 texture target
Creates a #GSource which handles Cogl's internal system event processing. This can be used as a convenience instead of cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch() in applications that are already using the GLib main loop. After this is called the #GSource should be attached to the main loop using g_source_attach().
Creates a #GSource which handles Cogl's internal system event processing. This can be used as a convenience instead of cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch() in applications that are already using the GLib main loop. After this is called the #GSource should be attached to the main loop using g_source_attach().
Applications that manually connect to a #CoglRenderer before they create a #CoglContext should instead use cogl_glib_renderer_source_new() so that events may be dispatched before a context has been created. In that case you don't need to use this api in addition later, it is simply enough to use cogl_glib_renderer_source_new() instead.
Drecreases the reference count of handle
by 1; if the reference
count reaches 0, the resources allocated by handle
will be freed
a #CoglHandle
Checks if a given feature
is currently available
Cogl does not aim to be a lowest common denominator API, it aims to expose all the interesting features of GPUs to application which means applications have some responsibility to explicitly check that certain features are available before depending on them.
Asks Cogl to explicitly reset the crtc output modes at the next #CoglOnscreen swap_buffers request. For applications that support VT switching they may want to re-assert the output modes when switching back to the applications VT since the modes are often not correctly restored automatically.
display
must have been either explicitly setup via
cogl_display_setup() or implicitily setup by having created a
context using the display<
/note>
Configures display
to use a framebuffer sized width
x height,
covering
the CRTCS in crtcs
.
width
and height
must be within the driver framebuffer limits, and crtcs
must be valid KMS API IDs.
Calling this function overrides the automatic mode setting done by Cogl, and for this reason must be called before the first call to cogl_onscreen_swap_buffers().
If you want to restore the default behaviour, you can call this function
with width
and height
set to -1.
the framebuffer width
the framebuffer height
the array of #CoglKmsCrtc structure with the desired CRTC layout
Compares two matrices to see if they represent the same transformation. Although internally the matrices may have different annotations associated with them and may potentially have a cached inverse matrix these are not considered in the comparison.
A 4x4 transformation matrix
A 4x4 transformation matrix
This should be called whenever an application is woken up from
going idle in its main loop. The poll_fds
array should contain a
list of file descriptors matched with the events that occurred in
revents. The events field is ignored. It is safe to pass in extra
file descriptors that Cogl didn't request when calling
cogl_poll_renderer_get_info() or a shorter array missing some file
descriptors that Cogl requested.
A #CoglRenderer
An array of #CoglPollFDs describing the events that have occurred since the application went idle.
The length of the poll_fds
array.
Is used to integrate Cogl with an application mainloop that is based on the unix poll(2) api (or select() or something equivalent). This api should be called whenever an application is about to go idle so that Cogl has a chance to describe what file descriptor events it needs to be woken up for.
After the function is called *poll_fds
will contain a pointer to
an array of #CoglPollFD structs describing the file descriptors
that Cogl expects. The fd and events members will be updated
accordingly. After the application has completed its idle it is
expected to either update the revents members directly in this
array or to create a copy of the array and update them
there.
When the application mainloop returns from calling poll(2) (or its equivalent) then it should call cogl_poll_renderer_dispatch() passing a pointer the array of CoglPollFDs with updated revent values.
When using the %COGL_WINSYS_ID_WGL winsys (where file descriptors don't make any sense) or %COGL_WINSYS_ID_SDL (where the event handling functions of SDL don't allow blocking on a file descriptor) *n_poll_fds is guaranteed to be zero.
timeout
will contain a maximum amount of time to wait in
microseconds before the application should wake up or -1 if the
application should wait indefinitely. This can also be 0 if
Cogl needs to be woken up immediately.
A #CoglRenderer
A return location for a pointer to an array of #CoglPollFDs
A return location for the number of entries in *poll_fds
A return location for the maximum length of time to wait in microseconds, or -1 to wait indefinitely.
Restores the previously active #CoglGLES2Context if there were nested calls to cogl_push_gles2_context() or otherwise restores the ability to render with the Cogl api instead of OpenGLES 2.0.
The behaviour is undefined if calls to cogl_pop_gles2_context() are not balenced with the number of corresponding calls to cogl_push_gles2_context().
Pushes the given gles2
_ctx onto a stack associated with ctx
so
that the OpenGLES 2.0 api can be used instead of the Cogl
rendering apis to read and write to the specified framebuffers.
Usage of the api available through a #CoglGLES2Vtable is only allowed between cogl_push_gles2_context() and cogl_pop_gles2_context() calls.
If there is a runtime problem with switching over to the given
gles2
_ctx then this function will return %FALSE and return
an error through error
.
A #CoglContext
A #CoglGLES2Context allocated with cogl_gles2_context_new()
A #CoglFramebuffer to access to read operations such as glReadPixels. (must be a #CoglOffscreen framebuffer currently)
A #CoglFramebuffer to access for drawing operations such as glDrawArrays. (must be a #CoglOffscreen framebuffer currently)
Adds each of the corresponding components in vectors a
and b
storing the results in result
.
Where you want the result written
The first vector operand
The second vector operand
Allocates a new 3 component float vector on the heap initializing
the components from the given vector
and returns a pointer to the
newly allocated vector. You should free the memory using
cogl_vector3_free()
The 3 component vector you want to copy
Calculates the cross product between the two vectors u
and v
.
The cross product is a vector perpendicular to both u
and v
. This
can be useful for calculating the normal of a polygon by creating
two vectors in its plane using the polygons vertices and taking
their cross product.
If the two vectors are parallel then the cross product is 0.
You can use a right hand rule to determine which direction the
perpendicular vector will point: If you place the two vectors tail,
to tail and imagine grabbing the perpendicular line that extends
through the common tail with your right hand such that you fingers
rotate in the direction from u
to v
then the resulting vector
points along your extended thumb.
Where you want the result written
Your first 3 component vector
Your second 3 component vector
If you consider the two given vectors as (x,y,z) points instead then this will compute the distance between those two points.
The first point
The second point
Divides each of the vector
components by the given scalar.
The 3 component vector you want to manipulate
The scalar you want to divide the vector components by
Calculates the dot product of the two 3 component vectors. This can be used to determine the magnitude of one vector projected onto another. (for example a surface normal)
For example if you have a polygon with a given normal vector and some other point for which you want to calculate its distance from the polygon, you can create a vector between one of the polygon vertices and that point and use the dot product to calculate the magnitude for that vector but projected onto the normal of the polygon. This way you don't just get the distance from the point to the edge of the polygon you get the distance from the point to the nearest part of the polygon.
The dot product is calculated as: |[ (a->x * b->x + a->y * b->y + a->z * b->z)
For reference, the dot product can also be calculated from the
angle between two vectors as:
|[
|a||b|cos𝜃
Your first 3 component vector
Your second 3 component vector
Compares the components of two vectors and returns TRUE if they are the same.
The comparison of the components is done with the '==' operator such that -0 is considered equal to 0, but otherwise there is no fuzziness such as an epsilon to consider vectors that are essentially identical except for some minor precision error differences due to the way they have been manipulated.
The first 3 component vector you want to compare
The second 3 component vector you want to compare
Compares the components of two vectors using the given epsilon and returns TRUE if they are the same, using an internal epsilon for comparing the floats.
Each component is compared against the epsilon value in this way: |[ if (fabsf (vector0->x - vector1->x) < epsilon)
@param vector0 The first 3 component vector you want to compare
@param vector1 The second 3 component vector you want to compare
@param epsilon The allowable difference between components to still be considered equal
Frees a 3 component vector that was previously allocated with cogl_vector3_copy()
The 3 component you want to free
Initializes a 3 component, single precision float vector which can then be manipulated with the cogl_vector convenience APIs. Vectors can also be used in places where a "point" is often desired.
The 3 component vector you want to initialize
The x component
The y component
The z component
Initializes a 3 component, single precision float vector with zero for each component.
The 3 component vector you want to initialize
Inverts/negates all the components of the given vector
.
The 3 component vector you want to manipulate
Calculates the scalar magnitude or length of vector
.
The 3 component vector you want the magnitude for
Multiplies each of the vector
components by the given scalar.
The 3 component vector you want to manipulate
The scalar you want to multiply the vector components by
Updates the vector so it is a "unit vector" such that the
vector<
!-- -->s magnitude or length is equal to 1.
The 3 component vector you want to manipulate
Subtracts each of the corresponding components in vector b
from
a
storing the results in result
.
Where you want the result written
The first vector operand
The second vector operand
Resizes the backbuffer of the given onscreen
framebuffer to the
given size. Since a buffer is usually conceptually scaled with a
center point the offset_x
and offset_y
arguments allow the newly
allocated buffer to be positioned relative to the old buffer size.
For example a buffer that is being resized by moving the bottom right corner, and the top left corner is remaining static would use x and y offsets of (0, 0) since the top-left of the new buffer should have the same position as the old buffer. If the center of the old buffer is being zoomed into then all the corners of the new buffer move out from the center and the x and y offsets would be (-half_x_size_increase, -half_y_size_increase) where x/y_size_increase is how many pixels bigger the buffer is on the x and y axis.
Note that if some drawing commands have been applied to the framebuffer since the last swap buffers then the resize will be queued and will only take effect in the next swap buffers.
If multiple calls to cogl_wayland_onscreen_resize() get queued
before the next swap buffers request then the relative x and y
offsets accumulate instead of being replaced. The width
and
height
values superseed the old values.
A #CoglOnscreen framebuffer
The desired width of the framebuffer
The desired height of the framebuffer
A relative x offset for the new framebuffer
A relative y offset for the new framebuffer
Allows you to explicitly notify Cogl of an existing Wayland surface to use,
which prevents Cogl from allocating a surface and shell surface for the
onscreen
. An allocated surface will not be destroyed when the onscreen
is
freed.
This function must be called before onscreen
is allocated.
An unallocated framebuffer. surface
A Wayland surface to associate with the onscreen
.
Retrieves the Wayland display that Cogl is using. If a foreign display has been specified using cogl_wayland_renderer_set_foreign_display() then that display will be returned. If no foreign display has been specified then the display that Cogl creates internally will be returned unless the renderer has not yet been connected (either implicitly or explicitly by calling cogl_renderer_connect()) in which case %NULL is returned.
Sets whether Cogl should handle calling wl_display_dispatch() and wl_display_flush() as part of its main loop integration via cogl_poll_renderer_get_info() and cogl_poll_renderer_dispatch(). The default value is %TRUE. When it is enabled the application can register listeners for Wayland interfaces and the callbacks will be invoked during cogl_poll_renderer_dispatch(). If the application wants to integrate with its own code that is already handling reading from the Wayland display socket, it should disable this to avoid having competing code read from the socket.
Sets the pixels in a rectangular subregion of texture
from a
Wayland SHM buffer. Generally this would be used in response to
wl_surface.damage event in a compositor in order to update the
texture with the damaged region. This is just a convenience wrapper
around getting the SHM buffer pointer and calling
cogl_texture_set_region(). See that function for a description of
the level parameter.
texture
has not previously been allocated then this
api can return %FALSE and throw an exceptional error
if there is
not enough memory to allocate storage for texture
.
a #CoglTexture
The X offset within the source bufer to copy from
The Y offset within the source bufer to copy from
The width of the region to copy
The height of the region to copy
The source buffer
The X offset within the texture to copy to
The Y offset within the texture to copy to
The mipmap level of the texture to copy to
Assuming you know the given onscreen
framebuffer is based on an x11 window
this queries the XID of that window. If
cogl_x11_onscreen_set_foreign_window_xid() was previously called then it
will return that same XID otherwise it will be the XID of a window Cogl
created internally. If the window has not been allocated yet and a foreign
xid has not been set then it's undefined what value will be returned.
It's undefined what this function does if called when not using an x11 based renderer.
A #CoglOnscreen framebuffer
Retrieves the size of buffer