Excerpts from brian mcgann's message of Tue Mar 01 10:57:17 +0000 2011:
> I have been working successfully with Clutter for quite a while now, but am
> just beginning with COGL. A very simple example would be very illustrative
> for a broad class of problems I would like to solve.
> 
> Specifically, if I could get a pointer on how to copy a source texture to a
> region of a different size in a destination texture. In pseudocode,
> 
> void copySourceTextureToDestinationRegionOfDifferentSize(
>    CoglHandle sourceTexture,
>    CoglHandle destTexture,
>    int        destX,
>    int        destY,
>    int        destWidth,
>    int        destHeight)
> {
>    ...
> }

I think for something like that you could do:

CoglHandle fbo = cogl_offscreen_new_to_texture (destTexture);

CoglMaterial *blit_state = cogl_material_new ();
/* make sure we don't blend src alpha with dest... */
cogl_material_set_blend (blit_state, "RGBA = ADD(SRC_COLOR, 0)", NULL);
cogl_material_set_layer (blit_state, 0, sourceTexture);

cogl_push_framebuffer (fbo);
cogl_ortho (0, cogl_texture_get_width (destTexture),
            0, cogl_texture_get_height (destTexture),
            -1, 1);
cogl_set_source (blit_state);
cogl_rectangle (destX, destY, destX + destWidth, destY + destHeight);
cogl_pop_framebuffer ();

cogl_object_unref (blit_state);
cogl_handle_unref (fbo);

I haven't tested that snippet out, but say if you get stuck or need
further details.

Note: sorry that mixing of cogl_object/handle_unref is a bit messy.  The
Cogl API is still evolving and we are in the process of phasing out
CoglHandle.

kind regards,
- Robert

> 
> Any help would be much appreciated.
> 
> Brian McGann
-- 
Robert Bragg, Intel Open Source Technology Center
_______________________________________________
clutter-app-devel-list mailing list
[email protected]
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to