Offscreen Buffers

Offscreen Buffers — Fuctions for creating and manipulating offscreen framebuffers.

Synopsis

CoglHandle          cogl_offscreen_new_to_texture       (CoglHandle handle);
CoglHandle          cogl_offscreen_ref                  (CoglHandle handle);
void                cogl_offscreen_unref                (CoglHandle handle);
gboolean            cogl_is_offscreen                   (CoglHandle handle);
void                cogl_set_framebuffer                (CoglHandle buffer);
void                cogl_push_framebuffer               (CoglHandle buffer);
void                cogl_pop_framebuffer                (void);
void                cogl_set_draw_buffer                (CoglBufferTarget target,
                                                         CoglHandle offscreen);
void                cogl_pop_draw_buffer                (void);
void                cogl_push_draw_buffer               (void);

Description

Cogl allows creating and operating on offscreen framebuffers.

Details

cogl_offscreen_new_to_texture ()

CoglHandle          cogl_offscreen_new_to_texture       (CoglHandle handle);

This creates an offscreen buffer object using the given texture as the primary color buffer. It doesn't just initialize the contents of the offscreen buffer with the texture; they are tightly bound so that drawing to the offscreen buffer effectivly updates the contents of the given texture. You don't need to destroy the offscreen buffer before you can use the texture again.

Note: This does not work with sliced Cogl textures.

handle :

A CoglHandle for a Cogl texture

Returns :

a CoglHandle for the new offscreen buffer or COGL_INVALID_HANDLE if it wasn't possible to create the buffer.

cogl_offscreen_ref ()

CoglHandle          cogl_offscreen_ref                  (CoglHandle handle);

Warning

cogl_offscreen_ref has been deprecated since version 1.2 and should not be used in newly-written code. cogl_handle_ref should be used in new code.

Increments the reference count on the offscreen buffer.

handle :

A CoglHandle for an offscreen buffer

Returns :

For convenience it returns the given CoglHandle

cogl_offscreen_unref ()

void                cogl_offscreen_unref                (CoglHandle handle);

Warning

cogl_offscreen_unref has been deprecated since version 1.2 and should not be used in newly-written code. cogl_handle_unref should be used in new code.

Decreases the reference count for the offscreen buffer and frees it when the count reaches 0.

handle :

A CoglHandle for an offscreen buffer

cogl_is_offscreen ()

gboolean            cogl_is_offscreen                   (CoglHandle handle);

Determines whether the given CoglHandle references an offscreen buffer object.

handle :

A CoglHandle for an offscreen buffer

Returns :

TRUE if the handle references an offscreen buffer, FALSE otherwise

cogl_set_framebuffer ()

void                cogl_set_framebuffer                (CoglHandle buffer);

This redirects all subsequent drawing to the specified framebuffer. This can either be an offscreen buffer created with cogl_offscreen_new_to_texture() or you can revert to your original onscreen window buffer.

buffer :

The CoglHandle of a Cogl framebuffer; either onscreen or offscreen.

Since 1.2


cogl_push_framebuffer ()

void                cogl_push_framebuffer               (CoglHandle buffer);

Redirects all subsequent drawing to the specified framebuffer. This can either be an offscreen buffer created with cogl_offscreen_new_to_texture() or you can revert to your original onscreen window buffer.

The previous framebuffer can be restored by calling cogl_pop_framebuffer()

buffer :

The CoglHandle of a Cogl framebuffer; either onscreen or offscreen.

Since 1.2


cogl_pop_framebuffer ()

void                cogl_pop_framebuffer                (void);

Restores the framebuffer that was previously at the top of the stack. All subsequent drawing will be redirected to this framebuffer.

Since 1.2


cogl_set_draw_buffer ()

void                cogl_set_draw_buffer                (CoglBufferTarget target,
                                                         CoglHandle offscreen);

Warning

cogl_set_draw_buffer has been deprecated since version 1.2 and should not be used in newly-written code. The target argument was redundant since we could look at the type of CoglHandle given instead.

Redirects all subsequent drawing to the specified framebuffer. This can either be an offscreen buffer created with cogl_offscreen_new_to_texture() or you can revert to your original on screen window buffer.

target :

A CoglBufferTarget that specifies what kind of framebuffer you are setting as the render target.

offscreen :

If you are setting a framebuffer of type COGL_OFFSCREEN_BUFFER then this is a CoglHandle for the offscreen buffer.

cogl_pop_draw_buffer ()

void                cogl_pop_draw_buffer                (void);

Warning

cogl_pop_draw_buffer has been deprecated since version 1.2 and should not be used in newly-written code. The draw buffer API was replaced with a framebuffer API

Restore cogl_set_draw_buffer() state.


cogl_push_draw_buffer ()

void                cogl_push_draw_buffer               (void);

Warning

cogl_push_draw_buffer has been deprecated since version 1.2 and should not be used in newly-written code. The draw buffer API was replaced with a framebuffer API

Save cogl_set_draw_buffer() state.