On 9/11/08, josch <[EMAIL PROTECTED]> wrote:
>
>  wohoo this worked!! \o/
>  http://phpfi.com/352060
>  i already used the TextureGroup to automatically apply the state
>  changes you mentioned (by looking at the pyglet source TextureGroup
>  does excactly what you posted and even does glDisable() ) and also
>  draw a 60x38 grid of random water tiles (without animation yet).
>  however there are still a few issues:
>  first i disabled vsync and added an update function that (i hope) is
>  called as often as possible and get only around 110fps with core2duo/
>  gma965 - when i uncomment the clear() function in on_draw() i get up
>  to 180fps. but considering all the other stuff i will add (more layers
>  and animated tiles and map objects) isnt that a bit low? why?

Make sure you at least run python with "-O" option to disable OpenGL
error checking, which is expensive.  Keep in mind that most of the
benefits of using batches come when batches are large -- you may find
that you get only reasonable performance now, but that same reasonable
performance with 10x the amount of geometry (in the same batch).

>  also i got a bit troubled with the TextureGroup. It needs a texture
>  that it later will enable and bind and this works fine with using a
>  TextureAtlas as in my current code but when i try to use the
>  recommended resource.image module which automatically will create new
>  TextureAtlas'es - how do i get the (maybe multiple) textures then?

Use the texture target and id from the region returned by
resource.image.  For images on a shared texture atlas (common case
with small images), the target and id will be the same.  You can
safely create multiple TextureGroup's with the same target and id --
Batch will know that they can be grouped together efficiently if your
TextureGroup class correctly implements __eq__ and __hash__.

>
>  future questions:
>  when i now want to move on the map i have to refill the batch - i do
>  this via deleting the vertex_list and refilling the batch again with
>  add() right?
>  for animation it should suffice to only change the texture coordinates
>  in the vertex_list? another way to do animation would be to prepare
>  several vertex_lists with each animation step? i have to try out both
>  methods and compare how they perform later but at least for map
>  objects i have to change the textures directly as the objects there do
>  have different numbers of animation frames.

Sounds like a plan.

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