On Tue, Mar 4, 2008 at 5:53 PM, Jonathan Doda <[EMAIL PROTECTED]> wrote:
>
>
>
>  On Mar 4, 12:53 am, "Richard Jones" <[EMAIL PROTECTED]> wrote:
>
> > On Tue, Mar 4, 2008 at 4:46 PM, Jonathan Doda <[EMAIL PROTECTED]> wrote:
>  > > The changes in 1.1 look great, but I have two questions. First, how do
>  > > you control the order in which Sprites in a Batch are drawn so that
>  > > when rendering the correct sprites are occluded?
>  >
>  > Use OrderedGroups. Create one for each "layer" of sprites and pass the
>  > layer's OrderedGroup in as the sprite's group argument. The sprites will
>  > then be drawn according to the ordering of the OrderedGroups.
>
>  But sprites within a single group are rendered in an arbitrary order,
>  correct? Is there a (reasonably straight-forward) way to do depth
>  testing with Sprites?

No.  The current implementation of VertexDomain (vertices that are
drawn in the same group with the same mode and attributes) uses
arbitrary ordering to reduce memory fragmentation when vertices are
added and removed.  Conceivably another allocation algorithm could be
substituted that maintains an order, but this isn't a priority for me.

If the sprites have no partial alpha (i.e., only fully on or fully
off) you could use the OpenGL depth buffer and order sprites by their
Z values (the Z coordinate is not exposed because this is not a common
case, but you could easily modify Sprite to add it).

>
>
>  > Second, since the
>  >
>  > > Sprite class appears to support only one Animation at a time, what's
>  > > the best way to create a "sprite" (as in the conceptual entity, not
>  > > necessarily the class) that has more than one animation?
>  >
>  > You can just assign the new animation as the "image" attribute on the
>  > sprite.
>
>  That was my first thought, but I wasn't sure if there was some magic
>  it would break.

Well, it might break, but that would be a bug.  But then I'd fix it :-)

Alex.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to