On Tue, Sep 16, 2008 at 10:41 PM, josch <[EMAIL PROTECTED]> wrote:
>
> okay i managed to boil my code down to 1/6 of its original size and
> simulated my drawing: http://phpfi.com/353846
> you can take and 32x32 image as the tile.
> but i still suspect that there is something wrong on my side ;)

Thanks for the test case.  Fixed in r2257 (in
branches/pyglet-1.1-maintenance) and r2258 (trunk).

>
> why is migrating vertex lists hairy?
>
> when i combine resource.image with animation then i HAVE to switch the
> group as i have no direct control over the texture my frames will be
> packed into and the new animation frame could be in a new texture.
>
> i also have to switch the group (respctively migrate the vertex list)
> when i want to move around the map by switching the tile texture in my
> vertex lists (which is what i have to do because there are more tile
> types than even a 2048x2048 texture can handle)
>
> so why is it hairy and not used very often? do i do it wrong?

It's just a complicated and error-prone (as you've discovered) method.
 It's quite costly to do (though not as costly as delete+add), and if
you can think of other ways of organising your vertices, they'll
probably work better.

>
> this night a fourth method to do movement came to my mind and it's a
> variance of my second method:
> one could first delete tiles (respectively vertex lists) that will go
> off screen,
> then move the tiles that are still to be drawn
> and then adding new vertex lists with batch.add() but obviously only
> on the border
> with this method no group changing would be necessary

You don't need to move the tiles in this case: just glTranslate the
whole scene.  This is similar to the method I used in Make Me, except
that I was adding several rows (about 2/3rds of a screenful) of tiles
at a time, rather than just the one that was required.  Remember that
batches work fastest when you don't touch them, and there's usually
very little penalty for rendering off-screen (if the memory transfer
is fast, which is what batch gives you).

>
> i still do not know what method should be prefered.
> method 1 seems to be a little too much overhead because batch.add() is
> called to often - but is still acceptably fast
> method 2 is like 4% faster than method 1 but needs to change the
> texture of the vertex lists with migrate
> method 3 seems a bit complicated because of the texture management
> method 4 is also more complicated but combines method 1 and 2 to not
> need any texture change
>
> there is still the issue whether i should use resource.image() or not
> - is the checking or storing of the texture each tile or animation
> frame is packed into and the vertex list migration on animation worth
> the convenience?

resource.image doesn't give that much convenience.  The image packing
procedure is available in the TextureBin and TextureAtlas classes, and
pyglet.resource.file gives you the path/zip-finding shortcut.
Creating your own resource function that packs into specific textures
shouldn't be difficult.

>
> http://pyglet.googlecode.com/svn/trunk/DESIGN <= i read about scene2d.
> how are you gonna do it? will your approach solve my problems?

That's a super-old document. (Richard: didn't we delete it?).  I'm not
working on that area any more at all, but Richard's more or less taken
over (in the cocos2d project).

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