Cogl.Onscreen.prototype.add_frame_callback

function add_frame_callback(callback: Cogl.FrameCallback, destroy: Cogl.UserDataDestroyCallback): Cogl.FrameClosure {
    // Gjs wrapper for cogl_onscreen_add_frame_callback()
}
  

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.FrameEvent.sync will be passed as the event argument to the given callback in addition to the Cogl.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.FrameEvent.complete will be passed as the event argument to the given callback in addition to the Cogl.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 Cogl.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.FrameEvent.sync events so that your application can avoid wasting resources, drawing more frames than your system compositor can display.

Since 1.14

callback

A callback function to call for frame events

destroy

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

Returns

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