On Fri, 2008-10-03 at 15:19 +0200, Jörn Reder wrote:

> still playing around with Clutter I faced a problem with proper hiding 
> 3D surfaces. I ripped down a simple example (in Perl) which reproduces 
> it. It's a cube (in fact just a ring with four sides, no top no bottom)
> you can rotate using left/right arrow keys. While rotating you see that
> the lastly added actor in the group is drawn on the top ignoring actual
> positions and depths.

> Is this intended?

yes, it is intended - in the sense that there is no proper solution that
guarantees a consistent behaviour in all the cases.

>  How can I fix this?

you have to enable GL depth testing for the duration of the paint
sequence of the actor's parent.

use the Cogl->enable_depth_test() function to enable the depth testing
before painting the group containing your actor, and disables it when
done; something like:

  $group->signal_connect(paint => sub { Clutter::Cogl->enable_depth_test(TRUE) 
});
  $group->signal_connect_after(paint => sub { 
Clutter::Cogl->enable_depth_test(FALSE) });

or subclass Clutter::Group overriding the PAINT function, like:

  package My::DepthGroup;

  use Glib qw( :constants );
  use Clutter;
  use Glib::Object::Subclass 'Clutter::Group';

  sub PAINT {
      my ($self) = @_;

      Clutter::Cogl->enable_depth_test(TRUE);

      foreach my $child ($self->get_children()) {
          $child->paint() if $child->visible();
      }

      Clutter::Cogl->enable_depth_test(FALSE);
  }

and then use My::DepthGroup instead of Clutter::Group.

ciao,
 Emmanuele.

-- 
Emmanuele Bassi, Intel Open Source Technology Center
-- 
Emmanuele Bassi, Intel Open Source Technology Center

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

Reply via email to