Functions

begin_gl ()

bitmap_error_quark ()

blend_string_error_quark ()

check_extension (name, ext)

clear (color, buffers)

clip_ensure ()

clip_pop ()

clip_push (x_offset, y_offset, width, height)

clip_push_rectangle (x0, y0, x1, y1)

clip_push_window_rect (x_offset, y_offset, width, height)

clip_push_window_rectangle (x_offset, y_offset, width, height)

clip_stack_restore ()

clip_stack_save ()

clutter_check_extension_CLUTTER (name, ext)

clutter_winsys_has_feature_CLUTTER (feature)

color_equal (v1, v2)

color_init_from_hsl (hue, saturation, luminance)

create_program ()

create_shader (shader_type)

debug_matrix_print (matrix)

disable_fog ()

double_to_int (value)

double_to_uint (value)

end_gl ()

features_available (features)

flush ()

frustum (left, right, bottom, top, z_near, z_far)

get_backface_culling_enabled ()

get_bitmasks ()

get_depth_test_enabled ()

get_features ()

get_modelview_matrix ()

get_option_group ()

get_projection_matrix ()

get_source ()

get_viewport ()

gtype_matrix_get_type ()

handle_get_type ()

handle_ref (handle)

handle_unref (handle)

is_bitmap (object)

is_material (handle)

is_offscreen (object)

is_program (handle)

is_shader (handle)

is_texture (object)

is_vertex_buffer (handle)

is_vertex_buffer_indices (handle)

material_ref (material)

material_unref (material)

matrix_equal (v1, v2)

onscreen_clutter_backend_set_size_CLUTTER (width, height)

ortho (left, right, bottom, top, near, far)

perspective (fovy, aspect, z_near, z_far)

polygon (vertices, n_vertices, use_color)

pop_draw_buffer ()

pop_framebuffer ()

pop_matrix ()

pop_source ()

program_attach_shader (program_handle, shader_handle)

program_get_uniform_location (handle, uniform_name)

program_link (handle)

program_ref (handle)

program_set_uniform_1f (program, uniform_location, value)

program_set_uniform_1i (program, uniform_location, value)

program_set_uniform_float (program, uniform_location, n_components, value)

program_set_uniform_int (program, uniform_location, n_components, value)

program_set_uniform_matrix (program, uniform_location, dimensions, transpose, value)

program_uniform_1f (uniform_no, value)

program_uniform_1i (uniform_no, value)

program_uniform_float (uniform_no, size, value)

program_uniform_int (uniform_no, size, value)

program_uniform_matrix (uniform_no, size, transpose, value)

program_unref (handle)

program_use (handle)

push_draw_buffer ()

push_matrix ()

push_source (material)

read_pixels (x, y, width, height, source, format, pixels)

rectangle (x_1, y_1, x_2, y_2)

rectangle_with_multitexture_coords (x1, y1, x2, y2, tex_coords, tex_coords_len)

rectangle_with_texture_coords (x1, y1, x2, y2, tx1, ty1, tx2, ty2)

rectangles (verts, n_rects)

rectangles_with_texture_coords (verts, n_rects)

rotate (angle, x, y, z)

scale (x, y, z)

set_backface_culling_enabled (setting)

set_depth_test_enabled (setting)

set_draw_buffer (target, offscreen)

set_fog (fog_color, mode, density, z_near, z_far)

set_modelview_matrix (matrix)

set_projection_matrix (matrix)

set_source (material)

set_source_color (color)

set_source_color4f (red, green, blue, alpha)

set_source_color4ub (red, green, blue, alpha)

set_source_texture (texture)

set_viewport (x, y, width, height)

shader_compile (handle)

shader_get_info_log (handle)

shader_get_type (handle)

shader_is_compiled (handle)

shader_ref (handle)

shader_source (shader, source)

shader_unref (handle)

sqrti (x)

texture_error_quark ()

transform (matrix)

translate (x, y, z)

vertex_buffer_add (handle, attribute_name, n_components, type, normalized, stride, pointer)

vertex_buffer_delete (handle, attribute_name)

vertex_buffer_disable (handle, attribute_name)

vertex_buffer_draw (handle, mode, first, count)

vertex_buffer_draw_elements (handle, mode, indices, min_index, max_index, indices_offset, count)

vertex_buffer_enable (handle, attribute_name)

vertex_buffer_get_n_vertices (handle)

vertex_buffer_indices_get_for_quads (n_indices)

vertex_buffer_indices_get_type (indices)

vertex_buffer_new (n_vertices)

vertex_buffer_ref (handle)

vertex_buffer_submit (handle)

vertex_buffer_unref (handle)

viewport (width, height)

Details

Cogl.begin_gl()

We do not advise nor reliably support the interleaving of raw GL drawing and Cogl drawing functions, but if you insist, Cogl.begin_gl() and Cogl.end_gl() provide a simple mechanism that may at least give you a fighting chance of succeeding.

Note: this doesn’t help you modify the behaviour of Cogl drawing functions through the modification of GL state; that will never be reliably supported, but if you are trying to do something like:

{
   - setup some OpenGL state.
   - draw using OpenGL (e.g. glDrawArrays() )
   - reset modified OpenGL state.
   - continue using Cogl to draw
}

You should surround blocks of drawing using raw GL with Cogl.begin_gl() and Cogl.end_gl():

{
   cogl_begin_gl ();
   - setup some OpenGL state.
   - draw using OpenGL (e.g. glDrawArrays() )
   - reset modified OpenGL state.
   cogl_end_gl ();
   - continue using Cogl to draw
}

Don’t ever try and do:

{
   - setup some OpenGL state.
   - use Cogl to draw
   - reset modified OpenGL state.
}

When the internals of Cogl evolves, this is very liable to break.

This function will flush all batched primitives, and subsequently flush all internal Cogl state to OpenGL as if it were going to draw something itself.

The result is that the OpenGL modelview matrix will be setup; the state corresponding to the current source material will be set up and other world state such as backface culling, depth and fogging enabledness will be sent to OpenGL.

No special material state is flushed, so if you want Cogl to setup a simplified material state it is your responsibility to set a simple source material before calling Cogl.begin_gl(). E.g. by calling Cogl.set_source_color4ub(). It is your responsibility to restore any OpenGL state that you modify to how it was after calling Cogl.begin_gl() if you don’t do this then the result of further Cogl calls is undefined. You can not nest begin/end blocks. Again we would like to stress, we do not advise the use of this API and if possible we would prefer to improve Cogl than have developers require raw OpenGL.

New in version 1.0.

Deprecated since version 1.16: Use the #CoglGLES2Context api instead

Cogl.bitmap_error_quark()
Return type:

int

Cogl.blend_string_error_quark()
Return type:

int

Cogl.check_extension(name, ext)
Parameters:
  • name (str) – extension to check for

  • ext (str) – list of extensions

Returns:

True if the extension occurs in the list, False otherwise.

Return type:

int

Check whether name occurs in list of extensions in ext.

Deprecated since version 1.2: OpenGL is an implementation detail for Cogl and so it’s not appropriate to expose OpenGL extensions through the Cogl API. This function can be replaced by the following equivalent code: CoglBool retval = (strstr (ext, name) != NULL) ? TRUE : FALSE;

Cogl.clear(color, buffers)
Parameters:
  • color (Cogl.Color) – Background color to clear to

  • buffers (int) – A mask of Cogl.BufferBit ‘s identifying which auxiliary buffers to clear

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

Deprecated since version 1.16: Use cogl_framebuffer_clear() api instead

Cogl.clip_ensure()

Ensures that the current clipping region has been set in GL. This will automatically be called before any Cogl primitives but it maybe be neccessary to call if you are using raw GL calls with clipping.

New in version 1.0.

Deprecated since version 1.2: Calling this function has no effect

Cogl.clip_pop()

Reverts the clipping region to the state before the last call to Cogl.clip_push().

Deprecated since version 1.16: Use cogl_framebuffer_pop_clip() instead

Cogl.clip_push(x_offset, y_offset, width, height)
Parameters:
  • x_offset (float) – left edge of the clip rectangle

  • y_offset (float) – top edge of the clip rectangle

  • width (float) – width of the clip rectangle

  • height (float) – height 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 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.clip_pop().

Deprecated since version 1.16: The x, y, width, height arguments are inconsistent with other API that specify rectangles in model space, and when used with a coordinate space that puts the origin at the center and y+ extending up, it’s awkward to use. Please use cogl_framebuffer_push_rectangle_clip()

Cogl.clip_push_rectangle(x0, y0, x1, y1)
Parameters:
  • x0 (float) – x coordinate for top left corner of the clip rectangle

  • y0 (float) – y coordinate for top left corner of the clip rectangle

  • x1 (float) – x coordinate for bottom right corner of the clip rectangle

  • y1 (float) – 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 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.clip_pop().

New in version 1.2.

Deprecated since version 1.16: Use cogl_framebuffer_push_rectangle_clip() instead

Cogl.clip_push_window_rect(x_offset, y_offset, width, height)
Parameters:
  • x_offset (float) – left edge of the clip rectangle in window coordinates

  • y_offset (float) – top edge of the clip rectangle in window coordinates

  • width (float) – width of the clip rectangle

  • height (float) – height 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.clip_pop().

Deprecated since version 1.16: Use cogl_framebuffer_push_scissor_clip() instead

Cogl.clip_push_window_rectangle(x_offset, y_offset, width, height)
Parameters:
  • x_offset (int) – left edge of the clip rectangle in window coordinates

  • y_offset (int) – top edge of the clip rectangle in window coordinates

  • width (int) – width of the clip rectangle

  • height (int) – height 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.clip_pop().

New in version 1.2.

Deprecated since version 1.16: Use cogl_framebuffer_push_scissor_clip() instead

Cogl.clip_stack_restore()

Restore the state of the clipping stack that was previously saved by Cogl.clip_stack_save().

New in version 0.8.2.

Deprecated since version 1.2: This was originally added to allow us to restore the clip stack when switching back from an offscreen framebuffer, but it’s not necessary anymore given that framebuffers now own separate clip stacks which will be automatically switched between when a new buffer is set. Calling this function has no effect

Cogl.clip_stack_save()

Save the entire state of the clipping stack and then clear all clipping. The previous state can be returned to with Cogl.clip_stack_restore(). Each call to Cogl.clip_push() after this must be matched by a call to Cogl.clip_pop() before calling Cogl.clip_stack_restore().

New in version 0.8.2.

Deprecated since version 1.2: This was originally added to allow us to save the clip stack when switching to an offscreen framebuffer, but it’s not necessary anymore given that framebuffers now own separate clip stacks which will be automatically switched between when a new buffer is set. Calling this function has no effect

Cogl.clutter_check_extension_CLUTTER(name, ext)
Parameters:
  • name (str) –

  • ext (str) –

Return type:

int

Cogl.clutter_winsys_has_feature_CLUTTER(feature)
Parameters:

feature (Cogl.WinsysFeature) –

Return type:

int

Cogl.color_equal(v1, v2)
Parameters:
Returns:

True if the two colors are the same.

Return type:

int

Compares two Cogl.Color s and checks if they are the same.

This function can be passed to g_hash_table_new() as the key_equal_func parameter, when using Cogl.Color s as keys in a GLib.HashTable.

New in version 1.0.

Cogl.color_init_from_hsl(hue, saturation, luminance)
Parameters:
  • hue (float) – hue value, in the 0 .. 360 range

  • saturation (float) – saturation value, in the 0 .. 1 range

  • luminance (float) – luminance value, in the 0 .. 1 range

Returns:

return location for a Cogl.Color

Return type:

color: Cogl.Color

Converts a color expressed in HLS (hue, luminance and saturation) values into a Cogl.Color.

New in version 1.16.

Cogl.create_program()
Returns:

a new cogl program.

Return type:

object

Create a new cogl program object that can be used to replace parts of the GL rendering pipeline with custom code.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.create_shader(shader_type)
Parameters:

shader_type (Cogl.ShaderType) – Cogl.ShaderType.VERTEX or Cogl.ShaderType.FRAGMENT.

Returns:

a new shader handle.

Return type:

object

Create a new shader handle, use Cogl.shader_source() to set the source code to be used on it.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.debug_matrix_print(matrix)
Parameters:

matrix (Cogl.Matrix) – A Cogl.Matrix

Prints the contents of a Cogl.Matrix to stdout.

New in version 2.0.

Cogl.disable_fog()

This function disables fogging, so primitives drawn afterwards will not be blended with any previously set fog color.

Deprecated since version 1.16: Use #CoglSnippet shader api for fog

Cogl.double_to_int(value)
Parameters:

value (float) –

Return type:

int

Cogl.double_to_uint(value)
Parameters:

value (float) –

Return type:

int

Cogl.end_gl()

This is the counterpart to Cogl.begin_gl() used to delimit blocks of drawing code using raw OpenGL. Please refer to Cogl.begin_gl() for full details.

New in version 1.0.

Deprecated since version 1.16: Use the #CoglGLES2Context api instead

Cogl.features_available(features)
Parameters:

features (Cogl.FeatureFlags) – A bitmask of features to check for

Returns:

True if the features are available, False otherwise.

Return type:

int

Checks whether the given COGL features are available. Multiple features can be checked for by or-ing them together with the ‘|’ operator. True is only returned if all of the requested features are available.

Deprecated since version 1.10: Use cogl_has_feature() instead

Cogl.flush()

This function should only need to be called in exceptional circumstances.

As an optimization Cogl drawing functions may batch up primitives internally, so if you are trying to use raw GL outside of Cogl you stand a better chance of being successful if you ask Cogl to flush any batched geometry before making your state changes.

It only ensure that the underlying driver is issued all the commands necessary to draw the batched primitives. It provides no guarantees about when the driver will complete the rendering.

This provides no guarantees about the GL state upon returning and to avoid confusing Cogl you should aim to restore any changes you make before resuming use of Cogl.

If you are making state changes with the intention of affecting Cogl drawing primitives you are 100% on your own since you stand a good chance of conflicting with Cogl internals. For example clutter-gst which currently uses direct GL calls to bind ARBfp programs will very likely break when Cogl starts to use ARBfb programs itself for the material API.

New in version 1.0.

Cogl.frustum(left, right, bottom, top, z_near, z_far)
Parameters:
  • left (float) – X position of the left clipping plane where it intersects the near clipping plane

  • right (float) – X position of the right clipping plane where it intersects the near clipping plane

  • bottom (float) – Y position of the bottom clipping plane where it intersects the near clipping plane

  • top (float) – Y position of the top clipping plane where it intersects the near clipping plane

  • z_near (float) – The distance to the near clipping plane (Must be positive)

  • z_far (float) – The distance to the far clipping plane (Must be positive)

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.

New in version 0.8.2.

Deprecated since version 1.10: Use cogl_framebuffer_frustum() instead

Cogl.get_backface_culling_enabled()
Returns:

True if backface culling is enabled, and False otherwise

Return type:

int

Queries if backface culling has been enabled via Cogl.set_backface_culling_enabled()

Deprecated since version 1.16: Use cogl_pipeline_get_cull_face_mode() instead

Cogl.get_bitmasks()
Returns:

red:

Return location for the number of red bits or None

green:

Return location for the number of green bits or None

blue:

Return location for the number of blue bits or None

alpha:

Return location for the number of alpha bits or None

Return type:

(red: int, green: int, blue: int, alpha: int)

Gets the number of bitplanes used for each of the color components in the color buffer. Pass None for any of the arguments if the value is not required.

Deprecated since version 1.8: Use cogl_framebuffer_get_red/green/blue/alpha_bits() instead

Cogl.get_depth_test_enabled()
Returns:

True if depth testing is enabled, and False otherwise

Return type:

int

Queries if depth testing has been enabled via cogl_set_depth_test_enable()

Deprecated since version 1.16: Use cogl_pipeline_set_depth_state() instead

Cogl.get_features()
Returns:

A logical OR of all the supported COGL features.

Return type:

Cogl.FeatureFlags

Returns all of the features supported by COGL.

New in version 0.8.

Deprecated since version 1.10: Use cogl_foreach_feature() instead

Cogl.get_modelview_matrix()
Returns:

return location for the model-view matrix

Return type:

matrix: Cogl.Matrix

Stores the current model-view matrix in matrix.

Deprecated since version 1.10: Use cogl_framebuffer_get_modelview_matrix() instead

Cogl.get_option_group()
Returns:

a GLib.OptionGroup

Return type:

GLib.OptionGroup

Retrieves the GLib.OptionGroup used by Cogl to parse the command line options. Clutter uses this to handle the Cogl command line options during its initialization process.

New in version 1.0.

Deprecated since version 1.16: Not replaced

Cogl.get_projection_matrix()
Returns:

return location for the projection matrix

Return type:

matrix: Cogl.Matrix

Stores the current projection matrix in matrix.

Deprecated since version 1.10: Use cogl_framebuffer_get_projection_matrix() instead

Cogl.get_source()
Returns:

The current source material.

Return type:

object or None

Returns the current source material as previously set using Cogl.set_source().

You should typically consider the returned material immutable and not try to change any of its properties unless you own a reference to that material. At times you may be able to get a reference to an internally managed materials and the result of modifying such materials is undefined.

New in version 1.6.

Deprecated since version 1.16: Latest drawing apis all take an explicit #CoglPipeline argument so this stack of Cogl.Material s shouldn’t be used.

Cogl.get_viewport()
Returns:

pointer to a 4 element array of #float s to receive the viewport dimensions.

Return type:

v: [float]

Stores the current viewport in v. v[0] and v[1] get the x and y position of the viewport and v[2] and v[3] get the width and height.

Deprecated since version 1.10: Use cogl_framebuffer_get_viewport4fv() instead

Cogl.gtype_matrix_get_type()
Returns:

the GObject.GType for the registered “Cogl.Matrix" boxed type. This can be used for example to define GObject.Object properties that accept a Cogl.Matrix value.

Return type:

GObject.GType

Deprecated since version 1.18: Use cogl_matrix_get_gtype() instead.

Cogl.handle_get_type()
Return type:

GObject.GType

Cogl.handle_ref(handle)
Parameters:

handle (object) – a #CoglHandle

Returns:

the handle, with its reference count increased

Return type:

object

Increases the reference count of handle by 1

Cogl.handle_unref(handle)
Parameters:

handle (object) – a #CoglHandle

Drecreases the reference count of handle by 1; if the reference count reaches 0, the resources allocated by handle will be freed

Cogl.is_bitmap(object)
Parameters:

object (object or None) – a #CoglObject pointer

Returns:

True if the passed object represents a bitmap, and False otherwise

Return type:

int

Checks whether object is a Cogl.Bitmap

New in version 1.0.

Cogl.is_material(handle)
Parameters:

handle (object) – A CoglHandle

Returns:

True if the handle references a Cogl.Material, False otherwise

Return type:

int

Gets whether the given handle references an existing material object.

Deprecated since version 1.16: Use cogl_is_pipeline() instead

Cogl.is_offscreen(object)
Parameters:

object (object or None) – A pointer to a #CoglObject

Returns:

True if object is a Cogl.Offscreen framebuffer, False otherwise

Return type:

int

Determines whether the given #CoglObject references an offscreen framebuffer object.

Cogl.is_program(handle)
Parameters:

handle (object) – A CoglHandle

Returns:

True if the handle references a program, False otherwise

Return type:

int

Gets whether the given handle references an existing program object.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.is_shader(handle)
Parameters:

handle (object) – A CoglHandle

Returns:

True if the handle references a shader, False otherwise

Return type:

int

Gets whether the given handle references an existing shader object.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.is_texture(object)
Parameters:

object (object or None) – A #CoglObject pointer

Returns:

True if the object references a texture, and False otherwise

Return type:

int

Gets whether the given object references a texture object.

Cogl.is_vertex_buffer(handle)
Parameters:

handle (object) – a #CoglHandle for a vertex buffer object

Returns:

True if the handle is a VBO, and False otherwise

Return type:

int

Checks whether handle is a Vertex Buffer Object

New in version 1.0.

Deprecated since version 1.16: Use the #CoglPrimitive api instead

Cogl.is_vertex_buffer_indices(handle)
Parameters:

handle (object) – a #CoglHandle

Returns:

True if the handle is indices, and False otherwise

Return type:

int

Checks whether handle is a handle to the indices for a vertex buffer object

New in version 1.4.

Deprecated since version 1.16: Use the #CoglPrimitive api instead

Cogl.material_ref(material)
Parameters:

material (object) – a Cogl.Material object.

Returns:

the material.

Return type:

object

Increment the reference count for a Cogl.Material.

New in version 1.0.

Deprecated since version 1.2: Use cogl_object_ref() instead

Cogl.material_unref(material)
Parameters:

material (object) – a Cogl.Material object.

Decrement the reference count for a Cogl.Material.

New in version 1.0.

Deprecated since version 1.2: Use cogl_object_unref() instead

Cogl.matrix_equal(v1, v2)
Parameters:
  • v1 (object or None) – A 4x4 transformation matrix

  • v2 (object or None) – A 4x4 transformation matrix

Return type:

int

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.

New in version 1.4.

Cogl.onscreen_clutter_backend_set_size_CLUTTER(width, height)
Parameters:
  • width (int) –

  • height (int) –

Cogl.ortho(left, right, bottom, top, near, far)
Parameters:
  • left (float) – The coordinate for the left clipping plane

  • right (float) – The coordinate for the right clipping plane

  • bottom (float) – The coordinate for the bottom clipping plane

  • top (float) – The coordinate for the top clipping plane

  • near (float) – The distance to the near clipping plane (negative if the plane is behind the viewer)

  • far (float) – The distance for the far clipping plane (negative if the plane is behind the viewer)

Replaces the current projection matrix with an orthographic projection matrix. See to see how the matrix is calculated.

This function copies the arguments from OpenGL’s glOrtho() even though they are unnecessarily confusing due to the z near and z far arguments actually being a “distance” from the origin, where negative values are behind the viewer, instead of coordinates for the z clipping planes which would have been consistent with the left, right bottom and top arguments.

New in version 1.0.

Deprecated since version 1.10: Use cogl_framebuffer_orthographic() instead

Cogl.perspective(fovy, aspect, z_near, z_far)
Parameters:
  • fovy (float) – Vertical field of view angle in degrees.

  • aspect (float) – The (width over height) aspect ratio for display

  • z_near (float) – The distance to the near clipping plane (Must be positive)

  • z_far (float) – The distance to the far clipping plane (Must be positive)

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

You should be careful not to have to great a 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.

Deprecated since version 1.10: Use cogl_framebuffer_perspective() instead

Cogl.polygon(vertices, n_vertices, use_color)
Parameters:

Draws a convex polygon using the current source material to fill / texture with according to the texture coordinates passed.

If use_color is True then the color will be changed for each vertex using the value specified in the color member of Cogl.TextureVertex. This can be used for example to make the texture fade out by setting the alpha value of the color.

All of the texture coordinates must be in the range [0,1] and repeating the texture is not supported.

Because of the way this function is implemented it will currently only work if either the texture is not sliced or the backend is not OpenGL ES and the minifying and magnifying functions are both set to Cogl.MaterialFilter.NEAREST.

New in version 1.0.

Cogl.pop_draw_buffer()

Restore Cogl.set_draw_buffer() state.

Deprecated since version 1.16: The latest drawing apis take explicit #CoglFramebuffer arguments so this stack of framebuffers shouldn’t be used anymore.

Cogl.pop_framebuffer()

Restores the framebuffer that was previously at the top of the stack. All subsequent drawing will be redirected to this framebuffer.

New in version 1.2.

Deprecated since version 1.16: The latest drawing apis take explicit #CoglFramebuffer arguments so this stack of framebuffers shouldn’t be used anymore.

Cogl.pop_matrix()

Restores the current model-view matrix from the matrix stack.

Deprecated since version 1.10: Use cogl_framebuffer_pop_matrix() instead

Cogl.pop_source()

Removes the material at the top of the source stack. The material at the top of this stack defines the GPU state used to process later primitives as defined by Cogl.set_source().

New in version 1.6.

Deprecated since version 1.16: Latest drawing apis all take an explicit #CoglPipeline argument so this stack of Cogl.Material s shouldn’t be used.

Cogl.program_attach_shader(program_handle, shader_handle)
Parameters:
  • program_handle (object) – a #CoglHandle for a shdaer program.

  • shader_handle (object) – a #CoglHandle for a vertex of fragment shader.

Attaches a shader to a program object. A program can have multiple vertex or fragment shaders but only one of them may provide a main() function. It is allowed to use a program with only a vertex shader or only a fragment shader.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.program_get_uniform_location(handle, uniform_name)
Parameters:
  • handle (object) – a #CoglHandle for a shader program.

  • uniform_name (str) – the name of a uniform.

Returns:

the offset of a uniform in a specified program. This uniform can be set using Cogl.program_uniform_1f() when the program is in use.

Return type:

int

Retrieve the location (offset) of a uniform variable in a shader program, a uniform is a variable that is constant for all vertices/fragments for a shader object and is possible to modify as an external parameter.

Deprecated since version 1.16: Use #CoglSnippet api instead

Parameters:

handle (object) – a #CoglHandle for a shader program.

Links a program making it ready for use. Note that calling this function is optional. If it is not called the program will automatically be linked the first time it is used.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.program_ref(handle)
Parameters:

handle (object) – A #CoglHandle to a program.

Returns:

handle

Return type:

object

Add an extra reference to a program.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.program_set_uniform_1f(program, uniform_location, value)
Parameters:

Changes the value of a floating point uniform for the given linked program.

New in version 1.4.

Deprecated since version 1.16: Use #CoglSnippet api instead

Cogl.program_set_uniform_1i(program, uniform_location, value)
Parameters:

Changes the value of an integer uniform for the given linked program.

New in version 1.4.

Deprecated since version 1.16: Use #CoglSnippet api instead

Cogl.program_set_uniform_float(program, uniform_location, n_components, value)
Parameters:
  • program (object) – A #CoglHandle for a linked program

  • uniform_location (int) – the uniform location retrieved from Cogl.program_get_uniform_location().

  • n_components (int) – The number of components for the uniform. For example with glsl you’d use 3 for a vec3 or 4 for a vec4.

  • value ([float]) – the new value of the uniform[s].

Changes the value of a float vector uniform, or uniform array for the given linked program.

New in version 1.4.

Deprecated since version 1.16: Use #CoglSnippet api instead

Cogl.program_set_uniform_int(program, uniform_location, n_components, value)
Parameters:
  • program (object) – A #CoglHandle for a linked program

  • uniform_location (int) – the uniform location retrieved from Cogl.program_get_uniform_location().

  • n_components (int) – The number of components for the uniform. For example with glsl you’d use 3 for a vec3 or 4 for a vec4.

  • value ([int]) – the new value of the uniform[s].

Changes the value of a int vector uniform, or uniform array for the given linked program.

New in version 1.4.

Deprecated since version 1.16: Use #CoglSnippet api instead

Cogl.program_set_uniform_matrix(program, uniform_location, dimensions, transpose, value)
Parameters:
  • program (object) – A #CoglHandle for a linked program

  • uniform_location (int) – the uniform location retrieved from Cogl.program_get_uniform_location().

  • dimensions (int) – The dimensions of the matrix. So for for example pass 2 for a 2x2 matrix or 3 for 3x3.

  • transpose (int) – Whether to transpose the matrix when setting the uniform.

  • value ([float]) – the new value of the uniform.

Changes the value of a matrix uniform, or uniform array in the given linked program.

New in version 1.4.

Deprecated since version 1.16: Use #CoglSnippet api instead

Cogl.program_uniform_1f(uniform_no, value)
Parameters:
  • uniform_no (int) – the uniform to set.

  • value (float) – the new value of the uniform.

Changes the value of a floating point uniform in the currently used (see Cogl.program_use()) shader program.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.program_uniform_1i(uniform_no, value)
Parameters:
  • uniform_no (int) – the uniform to set.

  • value (int) – the new value of the uniform.

Changes the value of an integer uniform in the currently used (see Cogl.program_use()) shader program.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.program_uniform_float(uniform_no, size, value)
Parameters:
  • uniform_no (int) – the uniform to set.

  • size (int) – Size of float vector.

  • value ([float]) – the new value of the uniform.

Changes the value of a float vector uniform, or uniform array in the currently used (see Cogl.program_use()) shader program.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.program_uniform_int(uniform_no, size, value)
Parameters:
  • uniform_no (int) – the uniform to set.

  • size (int) – Size of int vector.

  • value ([int]) – the new value of the uniform.

Changes the value of a int vector uniform, or uniform array in the currently used (see Cogl.program_use()) shader program.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.program_uniform_matrix(uniform_no, size, transpose, value)
Parameters:
  • uniform_no (int) – the uniform to set.

  • size (int) – Size of matrix.

  • transpose (int) – Whether to transpose the matrix when setting the uniform.

  • value ([float]) – the new value of the uniform.

Changes the value of a matrix uniform, or uniform array in the currently used (see Cogl.program_use()) shader program. The size parameter is used to determine the square size of the matrix.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.program_unref(handle)
Parameters:

handle (object) – A #CoglHandle to a program.

Removes a reference to a program. If it was the last reference the program object will be destroyed.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.program_use(handle)
Parameters:

handle (object) – a #CoglHandle for a shader program or %COGL_INVALID_HANDLE.

Activate a specific shader program replacing that part of the GL rendering pipeline, if passed in %COGL_INVALID_HANDLE the default behavior of GL is reinstated.

This function affects the global state of the current Cogl context. It is much more efficient to attach the shader to a specific material used for rendering instead by calling Cogl.Material.set_user_program().

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.push_draw_buffer()

Save Cogl.set_draw_buffer() state.

Deprecated since version 1.16: The latest drawing apis take explicit #CoglFramebuffer arguments so this stack of framebuffers shouldn’t be used anymore.

Cogl.push_matrix()

Stores the current model-view matrix on the matrix stack. The matrix can later be restored with Cogl.pop_matrix().

Deprecated since version 1.10: Use cogl_framebuffer_push_matrix() instead

Cogl.push_source(material)
Parameters:

material (object or None) – A Cogl.Material

Pushes the given material to the top of the source stack. The material at the top of this stack defines the GPU state used to process later primitives as defined by Cogl.set_source().

New in version 1.6.

Deprecated since version 1.16: Latest drawing apis all take an explicit #CoglPipeline argument so this stack of Cogl.Material s shouldn’t be used.

Cogl.read_pixels(x, y, width, height, source, format, pixels)
Parameters:
  • x (int) – The window x position to start reading from

  • y (int) – The window y position to start reading from

  • width (int) – The width of the rectangle you want to read

  • height (int) – The height of the rectangle you want to read

  • source (Cogl.ReadPixelsFlags) – Identifies which auxillary buffer you want to read (only Cogl.ReadPixelsFlags.COLOR_BUFFER supported currently)

  • format (Cogl.PixelFormat) – The pixel format you want the result in (only Cogl.PixelFormat.RGBA_8888 supported currently)

  • pixels (int) – The location to write the pixel data.

This reads a rectangle of pixels from the current framebuffer where position (0, 0) is the top left. The pixel at (x, y) is the first read, and the data is returned with a rowstride of (width * 4).

Currently Cogl assumes that the framebuffer is in a premultiplied format so if format 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.

Deprecated since version 1.16: Use cogl_framebuffer_read_pixels() instead

Cogl.rectangle(x_1, y_1, x_2, y_2)
Parameters:
  • x_1 (float) – X coordinate of the top-left corner

  • y_1 (float) – Y coordinate of the top-left corner

  • x_2 (float) – X coordinate of the bottom-right corner

  • y_2 (float) – Y coordinate of the bottom-right corner

Fills a rectangle at the given coordinates with the current source material

Cogl.rectangle_with_multitexture_coords(x1, y1, x2, y2, tex_coords, tex_coords_len)
Parameters:
  • x1 (float) – x coordinate upper left on screen.

  • y1 (float) – y coordinate upper left on screen.

  • x2 (float) – x coordinate lower right on screen.

  • y2 (float) – y coordinate lower right on screen.

  • tex_coords ([float]) – An array containing groups of 4 float values: [tx1, ty1, tx2, ty2] that are interpreted as two texture coordinates; one for the upper left texel, and one for the lower 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.

  • tex_coords_len (int) – The length of the tex_coords array. (e.g. for one layer and one group of texture coordinates, this would be 4)

This function draws a rectangle using the current source material to texture or fill with. As a material may contain multiple texture layers this interface lets you supply texture coordinates for each layer of the material.

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.

New in version 1.0.

Cogl.rectangle_with_texture_coords(x1, y1, x2, y2, tx1, ty1, tx2, ty2)
Parameters:
  • x1 (float) – x coordinate upper left on screen.

  • y1 (float) – y coordinate upper left on screen.

  • x2 (float) – x coordinate lower right on screen.

  • y2 (float) – y coordinate lower right on screen.

  • tx1 (float) – x part of texture coordinate to use for upper left pixel

  • ty1 (float) – y part of texture coordinate to use for upper left pixel

  • tx2 (float) – x part of texture coordinate to use for lower right pixel

  • ty2 (float) – y part of texture coordinate to use for left pixel

Draw a rectangle using the current material and supply texture coordinates to be used for the first texture layer of the material. To draw the entire texture pass in tx1=0.0 ty1=0.0 tx2=1.0 ty2=1.0.

New in version 1.0.

Cogl.rectangles(verts, n_rects)
Parameters:
  • verts ([float]) – an array of vertices

  • n_rects (int) – number of rectangles to draw

Draws a series of rectangles in the same way that Cogl.rectangle() does. In some situations it can give a significant performance boost to use this function rather than calling Cogl.rectangle() separately for each rectangle.

verts should point to an array of #float s with n_rects * 4 elements. Each group of 4 values corresponds to the parameters x1, y1, x2, and y2, and have the same meaning as in Cogl.rectangle().

New in version 1.0.

Cogl.rectangles_with_texture_coords(verts, n_rects)
Parameters:
  • verts ([float]) – an array of vertices

  • n_rects (int) – number of rectangles to draw

Draws a series of rectangles in the same way that Cogl.rectangle_with_texture_coords() does. In some situations it can give a significant performance boost to use this function rather than calling Cogl.rectangle_with_texture_coords() separately for each rectangle.

verts should point to an array of #float s with n_rects * 8 elements. Each group of 8 values corresponds to the parameters x1, y1, x2, y2, tx1, ty1, tx2 and ty2 and have the same meaning as in Cogl.rectangle_with_texture_coords().

New in version 0.8.6.

Cogl.rotate(angle, x, y, z)
Parameters:
  • angle (float) – Angle in degrees to rotate.

  • x (float) – X-component of vertex to rotate around.

  • y (float) – Y-component of vertex to rotate around.

  • z (float) – Z-component of vertex to rotate around.

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

Deprecated since version 1.10: Use cogl_framebuffer_rotate() instead

Cogl.scale(x, y, z)
Parameters:
  • x (float) – Amount to scale along the x-axis

  • y (float) – Amount to scale along the y-axis

  • z (float) – Amount to scale along the z-axis

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

Deprecated since version 1.10: Use cogl_framebuffer_pop_matrix() instead

Cogl.set_backface_culling_enabled(setting)
Parameters:

setting (int) – True to enable backface culling or False to disable.

Sets whether textures positioned so that their backface is showing should be hidden. This can be used to efficiently draw two-sided textures or fully closed cubes without enabling depth testing. This only affects calls to the Cogl.rectangle family of functions and Cogl.vertex_buffer_draw. Backface culling is disabled by default.

Deprecated since version 1.16: Use cogl_pipeline_set_cull_face_mode() instead

Cogl.set_depth_test_enabled(setting)
Parameters:

setting (int) – True to enable depth testing or False to disable.

Sets whether depth testing is enabled. If it is disabled then the order that actors are layered on the screen depends solely on the order specified using clutter_actor_raise() and clutter_actor_lower(), otherwise it will also take into account the actor’s depth. Depth testing is disabled by default.

Deprecated since version 1.16: Use cogl_pipeline_set_depth_state() instead

Cogl.set_draw_buffer(target, offscreen)
Parameters:

Redirects all subsequent drawing to the specified framebuffer. This can either be an offscreen buffer created with Cogl.Offscreen.new_to_texture () or you can revert to your original on screen window buffer.

Deprecated since version 1.16: The latest drawing apis take explicit #CoglFramebuffer arguments so this stack of framebuffers shouldn’t be used anymore.

Cogl.set_fog(fog_color, mode, density, z_near, z_far)
Parameters:

Enables fogging. Fogging causes vertices that are further away from the eye to be rendered with a different color. The color is determined according to the chosen fog mode; at it’s simplest the color is linearly interpolated so that vertices at z_near are drawn fully with their original color and vertices at z_far are drawn fully with fog_color. Fogging will remain enabled until you call Cogl.disable_fog().

The fogging functions only work correctly when primitives use unmultiplied alpha colors. By default Cogl will premultiply textures and Cogl.set_source_color() will premultiply colors, so unless you explicitly load your textures requesting an unmultiplied internal format and use Cogl.Material.set_color() you can only use fogging with fully opaque primitives. This might improve in the future when we can depend on fragment shaders.

Deprecated since version 1.16: Use #CoglSnippet shader api for fog

Cogl.set_modelview_matrix(matrix)
Parameters:

matrix (Cogl.Matrix) – the new model-view matrix

Loads matrix as the new model-view matrix.

Deprecated since version 1.10: Use cogl_framebuffer_set_modelview_matrix() instead

Cogl.set_projection_matrix(matrix)
Parameters:

matrix (Cogl.Matrix) – the new projection matrix

Loads matrix as the new projection matrix.

Deprecated since version 1.10: Use cogl_framebuffer_set_projection_matrix() instead

Cogl.set_source(material)
Parameters:

material (object or None) – A Cogl.Material

This function changes the material at the top of the source stack. The material at the top of this stack defines the GPU state used to process subsequent primitives, such as rectangles drawn with Cogl.rectangle() or vertices drawn using Cogl.vertex_buffer_draw().

New in version 1.0.

Deprecated since version 1.16: Latest drawing apis all take an explicit #CoglPipeline argument so this stack of Cogl.Material s shouldn’t be used.

Cogl.set_source_color(color)
Parameters:

color (Cogl.Color) – a Cogl.Color

This is a convenience function for creating a solid fill source material from the given color. This color will be used for any subsequent drawing operation.

The color will be premultiplied by Cogl, so the color should be non-premultiplied. For example: use (1.0, 0.0, 0.0, 0.5) for semi-transparent red.

See also Cogl.set_source_color4ub() and Cogl.set_source_color4f() if you already have the color components.

New in version 1.0.

Deprecated since version 1.16: Latest drawing apis all take an explicit #CoglPipeline argument so this stack of Cogl.Material s shouldn’t be used.

Cogl.set_source_color4f(red, green, blue, alpha)
Parameters:
  • red (float) – value of the red channel, between 0 and %1.0

  • green (float) – value of the green channel, between 0 and %1.0

  • blue (float) – value of the blue channel, between 0 and %1.0

  • alpha (float) – value of the alpha channel, between 0 and %1.0

This is a convenience function for creating a solid fill source material from the given color using normalized values for each component. This color will be used for any subsequent drawing operation.

The value for each component is a fixed point number in the range between 0 and %1.0. If the values passed in are outside that range, they will be clamped.

New in version 1.0.

Deprecated since version 1.16: Latest drawing apis all take an explicit #CoglPipeline argument so this stack of Cogl.Material s shouldn’t be used.

Cogl.set_source_color4ub(red, green, blue, alpha)
Parameters:
  • red (int) – value of the red channel, between 0 and 255

  • green (int) – value of the green channel, between 0 and 255

  • blue (int) – value of the blue channel, between 0 and 255

  • alpha (int) – value of the alpha channel, between 0 and 255

This is a convenience function for creating a solid fill source material from the given color using unsigned bytes for each component. This color will be used for any subsequent drawing operation.

The value for each component is an unsigned byte in the range between 0 and 255.

New in version 1.0.

Deprecated since version 1.16: Latest drawing apis all take an explicit #CoglPipeline argument so this stack of Cogl.Material s shouldn’t be used.

Cogl.set_source_texture(texture)
Parameters:

texture (Cogl.Texture) – The Cogl.Texture you want as your source

This is a convenience function for creating a material with the first layer set to texture and setting that material as the source with Cogl.set_source.

Note: There is no interaction between calls to Cogl.set_source_color and Cogl.set_source_texture. If you need to blend a texture with a color then you can create a simple material like this:

material = cogl_material_new ();
cogl_material_set_color4ub (material, 0xff, 0x00, 0x00, 0x80);
cogl_material_set_layer (material, 0, tex_handle);
cogl_set_source (material);

New in version 1.0.

Deprecated since version 1.16: Latest drawing apis all take an explicit #CoglPipeline argument so this stack of Cogl.Material s shouldn’t be used.

Cogl.set_viewport(x, y, width, height)
Parameters:
  • x (int) – X offset of the viewport

  • y (int) – Y offset of the viewport

  • width (int) – Width of the viewport

  • height (int) – Height of the viewport

Replaces the current viewport with the given values.

New in version 1.2.

Deprecated since version 1.8: Use cogl_framebuffer_set_viewport() instead

Cogl.shader_compile(handle)
Parameters:

handle (object) – #CoglHandle for a shader.

Compiles the shader, no return value, but the shader is now ready for linking into a program. Note that calling this function is optional. If it is not called then the shader will be automatically compiled when it is linked.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.shader_get_info_log(handle)
Parameters:

handle (object) – #CoglHandle for a shader.

Returns:

a newly allocated string containing the info log. Use GLib.free() to free it

Return type:

str

Retrieves the information log for a coglobject, can be used in conjunction with cogl_shader_get_parameteriv() to retrieve the compiler warnings/error messages that caused a shader to not compile correctly, mainly useful for debugging purposes.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.shader_get_type(handle)
Parameters:

handle (object) – #CoglHandle for a shader.

Returns:

Cogl.ShaderType.VERTEX if the shader is a vertex processor or Cogl.ShaderType.FRAGMENT if the shader is a frament processor

Return type:

Cogl.ShaderType

Retrieves the type of a shader #CoglHandle

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.shader_is_compiled(handle)
Parameters:

handle (object) – #CoglHandle for a shader.

Returns:

True if the shader object has sucessfully be compiled

Return type:

int

Retrieves whether a shader #CoglHandle has been compiled

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.shader_ref(handle)
Parameters:

handle (object) – A #CoglHandle to a shader.

Returns:

handle

Return type:

object

Add an extra reference to a shader.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.shader_source(shader, source)
Parameters:
  • shader (object) – #CoglHandle for a shader.

  • source (str) – Shader source.

Replaces the current source associated with a shader with a new one.

Please see ‘above [cogl-Shaders-and-Programmable-Pipeline.description]’ for a description of the recommended format for the shader code.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.shader_unref(handle)
Parameters:

handle (object) – A #CoglHandle to a shader.

Removes a reference to a shader. If it was the last reference the shader object will be destroyed.

Deprecated since version 1.16: Use #CoglSnippet api

Cogl.sqrti(x)
Parameters:

x (int) – integer value

Returns:

integer square root.

Return type:

int

Very fast fixed point implementation of square root for integers.

This function is at least 6x faster than clib sqrt() on x86, and (this is not a typo!) about 500x faster on ARM without FPU. It’s error is less than 5% for arguments smaller than Cogl.SQRTI_ARG_5_PERCENT and less than 10% for narguments smaller than Cogl.SQRTI_ARG_10_PERCENT. The maximum argument that can be passed to this function is Cogl.SQRTI_ARG_MAX.

New in version 1.0.

Cogl.texture_error_quark()
Return type:

int

Cogl.transform(matrix)
Parameters:

matrix (Cogl.Matrix) – the matrix to multiply with the current model-view

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

New in version 1.4.

Deprecated since version 1.10: Use cogl_framebuffer_transform() instead

Cogl.translate(x, y, z)
Parameters:
  • x (float) – Distance to translate along the x-axis

  • y (float) – Distance to translate along the y-axis

  • z (float) – Distance to translate along the z-axis

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

Deprecated since version 1.10: Use cogl_framebuffer_translate() instead

Cogl.vertex_buffer_add(handle, attribute_name, n_components, type, normalized, stride, pointer)
Parameters:
  • handle (object) – A vertex buffer handle

  • attribute_name (str) –

    The name of your attribute. It should be a valid GLSL variable name and standard attribute types must use one of following built-in names: (Note: they correspond to the built-in names of GLSL)

    • ”gl_Color”

    • ”gl_Normal”

    • ”gl_MultiTexCoord0, gl_MultiTexCoord1, …”

    • ”gl_Vertex”

    To support adding multiple variations of the same attribute the name can have a detail component, E.g. “gl_Color::active” or “gl_Color::inactive”

  • n_components (int) – The number of components per attribute and must be 1, 2, 3 or 4

  • type (Cogl.AttributeType) – a Cogl.AttributeType specifying the data type of each component.

  • normalized (int) – If True, this specifies that values stored in an integer format should be mapped into the range [-1.0, 1.0] or [0.0, 1.0] for unsigned values. If False they are converted to floats directly.

  • stride (int) – This specifies the number of bytes from the start of one attribute value to the start of the next value (for the same attribute). So, for example, with a position interleved with color like this: XYRGBAXYRGBAXYRGBA, then if each letter represents a byte, the stride for both attributes is 6. The special value 0 means the values are stored sequentially in memory.

  • pointer (object or None) – This addresses the first attribute in the vertex array. This must remain valid until you either call Cogl.vertex_buffer_submit() or issue a draw call.

Adds an attribute to a buffer, or replaces a previously added attribute with the same name.

You either can use one of the built-in names such as “gl_Vertex”, or “gl_MultiTexCoord0” to add standard attributes, like positions, colors and normals, or you can add custom attributes for use in shaders.

The number of vertices declared when calling Cogl.vertex_buffer_new() determines how many attribute values will be read from the supplied pointer.

The data for your attribute isn’t copied anywhere until you call Cogl.vertex_buffer_submit(), or issue a draw call which automatically submits pending attribute changes. so the supplied pointer must remain valid until then. If you are updating an existing attribute (done by re-adding it) then you still need to re-call Cogl.vertex_buffer_submit() to commit the changes to the GPU. Be carefull to minimize the number of calls to Cogl.vertex_buffer_submit(), though.

If you are interleving attributes it is assumed that each interleaved attribute starts no farther than +- stride bytes from the other attributes it is interleved with. I.e. this is ok: |-0-0-0-0-0-0-0-0-0-0| This is not ok: |- - - - -0-0-0-0-0-0 0 0 0 0| (Though you can have multiple groups of interleved attributes)

Deprecated since version 1.16: Use the #CoglPrimitive api instead

Cogl.vertex_buffer_delete(handle, attribute_name)
Parameters:
  • handle (object) – A vertex buffer handle

  • attribute_name (str) – The name of a previously added attribute

Deletes an attribute from a buffer. You will need to call Cogl.vertex_buffer_submit() or issue a draw call to commit this change to the GPU.

Deprecated since version 1.16: Use the #CoglPrimitive api instead

Cogl.vertex_buffer_disable(handle, attribute_name)
Parameters:
  • handle (object) – A vertex buffer handle

  • attribute_name (str) – The name of the attribute you want to disable

Disables a previosuly added attribute.

Since it can be costly to add and remove new attributes to buffers; to make individual buffers more reuseable it is possible to enable and disable attributes before using a buffer for drawing.

You don’t need to call Cogl.vertex_buffer_submit() after using this function.

Deprecated since version 1.16: Use the #CoglPrimitive api instead

Cogl.vertex_buffer_draw(handle, mode, first, count)
Parameters:
  • handle (object) – A vertex buffer handle

  • mode (Cogl.VerticesMode) – A Cogl.VerticesMode specifying how the vertices should be interpreted.

  • first (int) – Specifies the index of the first vertex you want to draw with

  • count (int) – Specifies the number of vertices you want to draw.

Allows you to draw geometry using all or a subset of the vertices in a vertex buffer.

Any un-submitted attribute changes are automatically submitted before drawing.

Deprecated since version 1.16: Use the #CoglPrimitive api instead

Cogl.vertex_buffer_draw_elements(handle, mode, indices, min_index, max_index, indices_offset, count)
Parameters:
  • handle (object) – A vertex buffer handle

  • mode (Cogl.VerticesMode) – A Cogl.VerticesMode specifying how the vertices should be interpreted.

  • indices (object) – A CoglHandle for a set of indices allocated via cogl_vertex_buffer_indices_new ()

  • min_index (int) – Specifies the minimum vertex index contained in indices

  • max_index (int) – Specifies the maximum vertex index contained in indices

  • indices_offset (int) – An offset into named indices. The offset marks the first index to use for drawing.

  • count (int) – Specifies the number of vertices you want to draw.

This function lets you use an array of indices to specify the vertices within your vertex buffer that you want to draw. The indices themselves are created by calling cogl_vertex_buffer_indices_new ()

Any un-submitted attribute changes are automatically submitted before drawing.

Deprecated since version 1.16: Use the #CoglPrimitive api instead

Cogl.vertex_buffer_enable(handle, attribute_name)
Parameters:
  • handle (object) – A vertex buffer handle

  • attribute_name (str) – The name of the attribute you want to enable

Enables a previosuly disabled attribute.

Since it can be costly to add and remove new attributes to buffers; to make individual buffers more reuseable it is possible to enable and disable attributes before using a buffer for drawing.

You don’t need to call Cogl.vertex_buffer_submit() after using this function

Deprecated since version 1.16: Use the #CoglPrimitive api instead

Cogl.vertex_buffer_get_n_vertices(handle)
Parameters:

handle (object) – A vertex buffer handle

Returns:

the number of vertices

Return type:

int

Retrieves the number of vertices that handle represents

Deprecated since version 1.16: Use the #CoglPrimitive api instead

Cogl.vertex_buffer_indices_get_for_quads(n_indices)
Parameters:

n_indices (int) – the number of indices in the vertex buffer.

Returns:

A %CoglHandle containing the indices. The handled is owned by Cogl and should not be modified or unref’d.

Return type:

object

Creates a vertex buffer containing the indices needed to draw pairs of triangles from a list of vertices grouped as quads. There will be at least n_indices entries in the buffer (but there may be more).

The indices will follow this pattern:

0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7 … etc

For example, if you submit vertices for a quad like like that shown in then you can request 6 indices to render two triangles like those shown in .

Example of vertices submitted to form a quad
Illustration of the triangle indices that will be generated

Deprecated since version 1.16: Use the #CoglPrimitive api instead

Cogl.vertex_buffer_indices_get_type(indices)
Parameters:

indices (object) – An indices handle

Returns:

The Cogl.IndicesType used

Return type:

Cogl.IndicesType

Queries back the data type used for the given indices

Deprecated since version 1.16: Use the #CoglPrimitive api instead

Cogl.vertex_buffer_new(n_vertices)
Parameters:

n_vertices (int) – The number of vertices that your attributes will correspond to.

Returns:

a new #CoglHandle

Return type:

object

Creates a new vertex buffer that you can use to add attributes.

Deprecated since version 1.16: Use the #CoglPrimitive api instead

Cogl.vertex_buffer_ref(handle)
Parameters:

handle (object) – a CoglHandle.

Returns:

the handle.

Return type:

object

Increment the reference count for a vertex buffer

Deprecated since version 1.2: Use cogl_object_ref() instead

Cogl.vertex_buffer_submit(handle)
Parameters:

handle (object) – A vertex buffer handle

Submits all the user added attributes to the GPU; once submitted, the attributes can be used for drawing.

You should aim to minimize calls to this function since it implies validating your data; it potentially incurs a transport cost (especially if you are using GLX indirect rendering) and potentially a format conversion cost if the GPU doesn’t natively support any of the given attribute formats.

Deprecated since version 1.16: Use the #CoglPrimitive api instead

Cogl.vertex_buffer_unref(handle)
Parameters:

handle (object) – a CoglHandle.

Decrement the reference count for a vertex buffer

Deprecated since version 1.2: Use cogl_object_unref() instead

Cogl.viewport(width, height)
Parameters:
  • width (int) – Width of the viewport

  • height (int) – Height of the viewport

Replace the current viewport with the given values.

New in version 0.8.2.

Deprecated since version 1.8: Use cogl_framebuffer_set_viewport instead