add_frame_callback


Description:

public FrameClosure add_frame_callback (FrameCallback callback, UserDataDestroyCallback? destroy)

Installs a callback function that will be called for significant events relating to the given this 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 FrameInfo 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 FrameInfo corresponding to the newly presented frame. The meaning of "ended" here simply means that no more timing information will be collected within the corresponding FrameInfo 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.

Parameters:

this

A Onscreen framebuffer

callback

A callback function to call for frame events

destroy

An optional callback to destroy user_data when the callback is removed or this is freed.

user_data

A private pointer to be passed to callback

Returns:

a FrameClosure pointer that can be used to remove the callback and associated user_data later.