I do have all frames of the same animation in the same texture.
The problem arises when doing movements by just swapping the texture
coordinates.
say i have a 1x2 array of vertex lists. one is the water animation and
one is a static terrain tile.
i animate this by switching the textureregion of the water tile and i
move the scene by doing the same.
but when i want to draw the static terrain in the same vertex lists
where the animated water once was it is not enough to just switch the
vertex list's texture region. this will just fail and display junk.
my solution is to delete my two vertex lists with the water and the
static terrain, and create new ones by adding them to the batch in
their new positions.
i seem to lack a bit understanding here and hope you get what i want
to do.
in case this is not clear here is the code i use for now: 
http://phpfi.com/352930
the vertex_list list is created with several batch.add() for each tile
that are to be drawn on the screen.
for movement it is then only moved max. 32 px in each direction. after
that it is drawn at its original position and the textureregions are
swapped.
i hope you find some free time for this after pygame's end :)

On Sep 13, 2:25 pm, "Alex Holkner" <[EMAIL PROTECTED]> wrote:
> On 9/13/08, josch <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> >  As all begins to get bigger I need some additional advice.
> >  For my viewport I manage vertext lists that i only need to modify in
> >  their texture or coordinates to move around the map or do animations.
> >  I only need to delete them and create new vertex lists with
> >  batch.add() when the window is being resized.
> >  the rest of the time i only access the vertex lists and modify their
> >  parameters (tex_coords and vertices).
> >  this is quite fast but the problem comes in when i need more than one
> >  texture to draw my map because i can no longer simply swap the
> >  textureregion when moving and animating as eventually the texture
> >  itself has to change too.
> >  as i understand it now i have to do a batch.add() again to attach a
> >  TextureGroup that will do this for me.
> >  again this works fine but calling batch.add() for every movement is
> >  MUCH slower than just switching out the textureregions as i did
> >  before.
> >  any ideas on that?
>
> You can actually migrate a vertex list from one group to another, but
> this has a similar performance penalty.  Ideally you would keep frames
> of an animation in a single texture; vertices can then keep their
> group.  There's no problem with having multiple groups in a batch;
> this is actually quite an efficient way of managing the drawing of
> several textures.
>
> 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