cp_frame_t
A type that provides access to the timing information and data types you need to render a single frame of content.
Declaration
typedef struct cp_frame * cp_frame_t;Discussion
A frame represents a snapshot of your app’s content at a single moment in time. In your rendering loop, you render your content into static images many times a second to create the illusion of animation. A cp_frame_t provides the Metal textures and information you need to render one of those images.
During each iteration of your app’s rendering loop, call cp_layer_query_next_frame to retrieve the next frame to render The system manages a finite number of frames and recycles them to maximize efficiency. You typically draw only one frame at a time, starting work on each new frame only after completing the previous frame.
Separate the work you do for each frame into two phases: the update phase and the encode phase. Use the update phase to perform tasks that don’t depend on the current device pose. For example, you might update your app’s data structures to reflect recent interactions with your content. Use the submission phase to retrieve the current pose and render the frame’s content using that information. Each frame provides a cp_drawable_t type with access to the specific textures and rendering details for that frame.