Sprites and textures

Sprites and textures
0.0 0


Hi, i am studying cocos2d-x and would like to ask the following question. It seems to me that when i init my sprite with CCSprite::spriteWithFile( … ),
the image is loaded in host memory (heap), a texture is allocated on the gpu-device memory, the image is uploaded to the device memory and freed from host memory.

At the end of sprite object creation/initialization, the CCTexture2D object associated with the sprite has reference count 3: *1 at object creation,*1 for CCTextureCache rataining, +1 for CCSprite retaining.

Now, suppose i have N scenes in memory. Every scene has some nodes as child (for example, CCSprite nodes). If i want to delete a specific scene, i would like
also to free all resources allocated to that scene (opengl textures included, so to free device memory) that are NOT added to other scene, how should i do?



~~1 when CCSprite is destroyed,~~1 it use autorelease after it is created, –1 if you invoke CCTextrueCache::removeUnusedTextures().