On Mon, Dec 21, 2009 at 3:24 PM, Jonathan Hartley <[email protected]> wrote: > On Dec 21, 1:12 pm, Hello3171 <[email protected]> wrote: [..] >> How are the lifetimes of sprites, text labels and sprite batches >> managed? Do I need to do anything (such as call sprite.delete() ) for >> anything? > > I was wondering exactly the same thing, especially since my Sprite > images are dynamically generated Textures (derived from Labels to > accelerate text rendering) Do I need to call delete on the Texture, if > no other Sprites reference it, or just on the Sprite?
Calling delete on the sprite deletes the vertex list and removes the reference to the texture from the sprite, but does not explicitly delete the texture from video memory because other things may still be using it. Note that if nothing else is referencing the texture, it will eventually get removed from video memory when the texture object is garbage collected. This is probably fine unless you know you need to reclaim the video memory immediately for other uses. In that case you should call delete on the texture yourself. -Casey -- 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.
