Top | ![]() |
![]() |
![]() |
![]() |
The LwCairoTexture object allows you to draw directly onto your OpenGL texture by using the cairo graphics library.
Example 7. Using a LwCairoTexture
GError *error = NULL; LwCairoTexture *tex = lw_cairo_texture_new(WIDTH, HEIGHT, error); cairo_t *cr; if(error != NULL) { g_warning("Could not create cairo texture: %s", error->message); g_error_free(error); return; } cr = lw_cairo_texture_cairo_create(tex); // use cairo to draw onto your texture ... cairo_destroy(cr); // update the texture everytime you draw on it lw_cairo_texture_update(tex); lw_texture_enable( LW_TEXTURE(tex) ); ...
LwCairoTexture * lw_cairo_texture_new (guint width
,guint height
);
Creates a new cairo texture with a specified size.
A new LwCairoTexture or NULL
in case of an error.
Use g_object_unref()
to free the LwCairoTexture.
cairo_t *
lw_cairo_texture_cairo_create (LwCairoTexture *self
);
Creates a cairo context for drawing to the texture. Call lw_cairo_texture_update()
to update the texture when you are done with drawing.
void
lw_cairo_texture_update (LwCairoTexture *self
);
Updates the texture.