Virtual Method

CoglOnscreenget_buffer_age

Declaration [src]

int
get_buffer_age (
  CoglOnscreen* onscreen
)

Description [src]

Gets the current age of the buffer contents.

This function allows applications to query the age of the current back buffer contents for a CoglOnscreen as the number of frames elapsed since the contents were most recently defined.

These age values expose enough information to applications about how Cogl internally manages back buffers to allow applications to re-use the contents of old frames and minimize how much must be redrawn for the next frame.

The back buffer contents can either be reported as invalid (has an age of 0) or it may be reported to be the same contents as from n frames prior to the current frame.

The queried value remains valid until the next buffer swap.

Track previous frames’ damage regions in a circular buffer. For a buffer of age N, combine the current frame’s damage with the previous N - 1 frames’ damage to find everything that needs to be redrawn. For example, age 1 needs only the current damage; age 2 also needs the previous frame’s damage. If the age is 0 or the required damage history is unavailable, redraw the whole buffer.

If the system cannot track back buffer ages, this function returns 0 and the contents must be treated as undefined.

The COGL_WINSYS_FEATURE_BUFFER_AGE feature can optionally be explicitly checked to determine if Cogl is currently tracking the age of CoglOnscreen back buffer contents. If this feature is missing then this function will always return 0.

Return value

Type: int

The age of the buffer contents or 0 when the buffer contents are undefined.