Hi;

On Fri, 2008-02-15 at 13:37 -0200, Pedro Campos wrote:
> Hi,
> 
> 
> I'm developing an application that must rotate a card showing its
> front and its back.
> 
> For this I'm creating a group which will contain the face and the back
> of the cards as its children, using this snippet:
> 
>   pixbuf_front = gdk_pixbuf_new_from_file ("card_front.png", NULL);
>   pixbuf_back = gdk_pixbuf_new_from_file ("card_back.png", NULL);
> 
>   deck->front = clutter_texture_new_from_pixbuf (pixbuf_front);
>   deck->back = clutter_texture_new_from_pixbuf (pixbuf_back);
> 
>   deck->card = clutter_group_new();
>   clutter_container_add_actor (CLUTTER_CONTAINER (deck->card), deck->front);
>   clutter_container_add_actor (CLUTTER_CONTAINER (deck->card), deck->back);
>   clutter_actor_lower (deck->front, deck->back);
> 
>   clutter_actor_set_position (deck->card, x, y);
> 
> To rotate the card I'm adding this code on the timeline callback:
> 
>   clutter_actor_set_rotation (deck->card, CLUTTER_Y_AXIS,  - 6.0 *
> frame_num, 0, 0, 0);
> 
> When the card rotates, I see the back of the card on the face and
> back, if I add this code on the actor definition:
> 
>   clutter_actor_raise (deck->front, deck->back);
> 
> I have the opposite behavior, I got the front on both sides of the card.
> 
> How could I achieve the desired behavior? I've tried deal with the
> depth property but without success.
> 

Basically two options (assuming 0,5+);

  - Hook into behaviour/timeline to hide/show the back actor when 
    rotated out of view.

  - Subclass ClutterGroup overide the paint method calling 
    cogl_enable_depth_depth before chaining up and then disabling.
    Put the above in this group.  

Note we dont enable the depth test by default as it causes various odd
edge cases or which there is no real fix. Thus best to self contain it. 

  == Matthew

-- 
To unsubscribe send a mail to [EMAIL PROTECTED]

Reply via email to