Cogl.Renderer

g Cogl.Object Cogl.Object Cogl.Renderer Cogl.Renderer Cogl.Object->Cogl.Renderer

Subclasses:

None

Methods

Inherited:

Cogl.Object (2)

class

new ()

add_constraint (constraint)

check_onscreen_template (onscreen_template)

connect ()

foreach_output (callback, *user_data)

get_driver ()

get_n_fragment_texture_units ()

get_winsys_id ()

remove_constraint (constraint)

set_driver (driver)

set_winsys_id (winsys_id)

Virtual Methods

None

Fields

None

Class Details

class Cogl.Renderer
Bases:

Cogl.Object

Abstract:

No

classmethod new()
Returns:

A newly created Cogl.Renderer.

Return type:

Cogl.Renderer

Instantiates a new (unconnected) Cogl.Renderer object. A Cogl.Renderer represents a means to render. It encapsulates the selection of an underlying driver, such as OpenGL or OpenGL-ES and a selection of a window system binding API such as GLX, or EGL or WGL.

While the renderer is unconnected it can be configured so that applications may specify backend constraints, such as “must use x11” for example via Cogl.Renderer.add_constraint().

There are also some platform specific configuration apis such as cogl_xlib_renderer_set_foreign_display() that may also be used while the renderer is unconnected.

Once the renderer has been configured, then it may (optionally) be explicitly connected using Cogl.Renderer.connect() which allows errors to be handled gracefully and potentially fallback configurations can be tried out if there are initial failures.

If a renderer is not explicitly connected then Cogl.Display.new() will automatically connect the renderer for you. If you don’t have any code to deal with error/fallback situations then its fine to just let Cogl do the connection for you.

Once you have setup your renderer then the next step is to create a Cogl.Display using Cogl.Display.new().

Many applications don’t need to explicitly use Cogl.Renderer.new() or Cogl.Display.new() and can just jump straight to Cogl.Context.new() and pass a None display argument so Cogl will automatically connect and setup a renderer and display.

New in version 1.10.

add_constraint(constraint)
Parameters:

constraint (Cogl.RendererConstraint) – A Cogl.RendererConstraint to add

This adds a renderer selection constraint.

Applications should ideally minimize how many of these constraints they depend on to ensure maximum portability.

New in version 1.10.

check_onscreen_template(onscreen_template)
Parameters:

onscreen_template (Cogl.OnscreenTemplate) – A Cogl.OnscreenTemplate

Raises:

GLib.Error

Returns:

True if the onscreen_template can be supported, else False.

Return type:

int

Tests if a given onscreen_template can be supported with the given self.

New in version 1.10.

connect()
Raises:

GLib.Error

Returns:

True if there was no error while connecting the given self. False if there was an error.

Return type:

int

Connects the configured self. Renderer connection isn’t a very active process, it basically just means validating that any given constraint criteria can be satisfied and that a usable driver and window system backend can be found.

New in version 1.10.

foreach_output(callback, *user_data)
Parameters:

Iterates all known display outputs for the given self and passes a corresponding Cogl.Output pointer to the given callback for each one, along with the given user_data.

New in version 1.14.

get_driver()
Return type:

Cogl.Driver

Queries what underlying driver is being used by Cogl.

This may only be called on a connected Cogl.Renderer.

New in version 1.10.

get_n_fragment_texture_units()
Returns:

the number of texture image units.

Return type:

int

Queries how many texture units can be used from fragment programs

New in version 1.8.

get_winsys_id()
Returns:

The Cogl.WinsysID corresponding to the chosen window system backend.

Return type:

Cogl.WinsysID

Queries which window system backend Cogl has chosen to use.

This may only be called on a connected Cogl.Renderer.

remove_constraint(constraint)
Parameters:

constraint (Cogl.RendererConstraint) – A Cogl.RendererConstraint to remove

This removes a renderer selection constraint.

Applications should ideally minimize how many of these constraints they depend on to ensure maximum portability.

New in version 1.10.

set_driver(driver)
Parameters:

driver (Cogl.Driver) –

Requests that Cogl should try to use a specific underlying driver for rendering.

If you select an unsupported driver then Cogl.Renderer.connect() will fail and report an error. Most applications should not explicitly select a driver and should rely on Cogl automatically choosing the driver.

This may only be called on an un-connected Cogl.Renderer.

New in version 1.10.

set_winsys_id(winsys_id)
Parameters:

winsys_id (Cogl.WinsysID) – An ID of the winsys you explicitly want to use.

This allows you to explicitly select a winsys backend to use instead of letting Cogl automatically select a backend.

if you select an unsupported backend then Cogl.Renderer.connect() will fail and report an error.

This may only be called on an un-connected Cogl.Renderer.