another attempt to make the most of pyglet:

forget the code, it's unreadable anyway.
here are my ideas:

given the following view of a map:
(different chars mean there are different textures used)

ooooooooooooAAAA
oooooooooooooAAA
XoooooooooooooAA
XXoooooooooooooA
XXoooooooooooooo
Xooooooooooooooo
oooooooooooooooo

now we move the camera to the east by two steps

ooooooooooAAAAAA
oooooooooooAAAAA
ooooooooooooAAAA
oooooooooooooAAA
ooooooooooooooAA
oooooooooooooooA
oooooooooooooooo

how do we do this?
well, there are three posibilities that came to my mind:

1.
this is what i currently do:
for each different texture used by the tiles in the scene i create a
seperate vertex list with batch.add(). this would be three lists in
the first map view and two in the second containing all those tiles
that use this texture.
when the map is moved i only delete() the old lists and create new
ones again with batch.add()
actually up to now this is quite fast and i get 600fps while scrolling
but of course i dont know how it scales.

2.
one could also create one vertex list for every tile currently visible
on the screen. so there would be tiles_x*tiles_y vertex lists with one
GL_QUAD with 4 vertices each.
movement would be done by swapping the textureregions of every tile
and also swap the texture (respectively the group) by migrating the
vertexlist if necessary

3.
a last option that came to my mind is to dynamically delete and create
vertex lists.
in the example above one would delete() the list for the X texture and
resize() the other two.
then setting the new coordinates and textureregions in the resized
lists.

------------------------------------

and some additional thoughts about storing my tile images in textures.

of course i could use resource.image and i would like to use it as it
is nicely distribution independent (also usable with py2exe and
py2app) but with using it i would add some overhead in animation and
movement since i would have to check whether the new animation frame
is still in the same texture or not and then migrating the vertex list
to the new group (again overhead) and after that back again.
plz correct me but for this reason, isnt it most practical to let all
animation frames be in one texture?
and i see no way to do this with the ressource module so i will
probably implement my own loading mechanisms while borrowing stuff
from resource.py. is this the right way to do it?
--~--~---------~--~----~------------~-------~--~----~
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