*/ĬCSpriteFrame *frameWater = [frameCache *texWater = frameWater. Use Photoshop and other tools to make a single picture, place it in one or several directories under the Resources directory, use TexturePacker to package the picture into a pvr.ccz file, use CCSpriteBatchNode to optimize drawing, use FrameCache to cache and read, and use spriteWithFrameName to get a single picture. Spritesheets are composed of a texture file and a data file. Next well give the spritesheet settings to ensure it creates an optimal texture, then publish it. This adds all the ninja sprites to the sheet. * You may need to use frameFire.rectInPixels and frameFire.rotated for the texture coordinates. Optimus: How to use pictures efficiently in cocos2d. Open up TexturePacker, click the Add Folder button and select the Ninja-HDR folder. GlBindTexture(GL_TEXTURE_2D, texFire.name) [frameCache *frameFire = [frameCache *texFire = frameFire.texture Use TexturePacker to create a spritesheet. Its similar to Zwoptex, and it can also create sprite sheets, but it also has some very handy, amazing features. Then, heres a new tool called Texture Packer. You can get CCTexture2D instance from CCSpriteFrameCache with zwoptext plist. Zwoptex is a great tool - I use it in many of my programs and it really saves me a lot of time. It returns immediately CCTexture2D instance if the specified file is already cached. Also, of course, CCTextureCache always caches textures. You must not use OpenGL ES API such as glTexImage2D or so forth. The animation still plays as expected because the animation frames reference the identical sprites. It is easy to use for loading OpenGL texture. TexturePacker detects these identical sprites and only adds them to the sprite sheet once. Why do the examples do addImage: it's because it's not added two times? I strongly recommend you to use TexturePacker to create texture sheets. Please take a look at " How to Create and Optimize Sprite Sheets in Cocos2D with Texture Packer and Pixel Formats". Should I create a zwoptext with them? If so, how?Ī texture sheet might improve the performance for rendering, because it would not change OpenGL ES state (binding textures). If I am going to have more than a particle system with different textures.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |