On Wed, Jul 2, 2008 at 1:12 PM, tomas <[EMAIL PROTECTED]> wrote: > > On Jul 2, 1:53 am, "Alex Holkner" <[EMAIL PROTECTED]> wrote: >> If it's possible to reorganise your code so that the batch and group >> are created first, you should do so. Doing things in the order you >> describe will result in wasted effort, including allocating and >> deallocating resources on the GPU (these won't even be freed until the >> Python GC gets to them). >> >> The warning above is really to discourage migrating sprites often, you >> probably won't notice any performance problems in the situation you >> describe (as Sprite creation is fairly slow anyway). >> >> Alex. > > Thanks for the quick reply. Reorganizing to create sprites with the > correct group is just a matter of adopting a slightly more round-about > way of creating sprites. If it's worth it for efficiency its no big > deal to do. > > When you say sprite creation by itself if fairly slow, this got me > thinking. I've begun work on a game that will use a rather hefty > amount of sprites for projectiles and particles. Would it make sense > to reuse sprites? By this I mean, for certain groups of sprites such > as particles, instead of destroying a sprite, just set it invisible > until I need it again. Then later I would just make it visible and > update all it's properties such as image, position, scale, etc. The > group and batch properties will obviously stay the same. > > The question is, would such recycling be more efficient than killing > and creating new sprites? Absolutely? Perhaps slightly? Not at all?
Um. I look forward to your benchmark results :-) 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 -~----------~----~----~----~------~----~------~--~---
