Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4271760
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:29:09+00:00 2026-05-21T07:29:09+00:00

I am giving my first steps with cocos2d-iphone . I am using: CCSpriteFrameCache *frameCache

  • 0

I am giving my first steps with cocos2d-iphone.

I am using:

CCSpriteFrameCache *frameCache = [CCSpriteFrameCache sharedSpriteFrameCache];
[frameCache addSpriteFramesWithFile:@"textures.plist"];

to use my zwoptex file. With that set, I am creating my CCSprites using the frameCache like this:

[CCSprite spriteWithSpriteFrameName:@"filename.png"];

So far, so good. Now I am creating my own particle system and I need to set the texture. I guess it would make sense to read from the zwoptex but I couldn’t find a way to do it.
I also checked the examples and they do something like:

emitter.texture = [[CCTextureCache sharedTextureCache] addImage: @"fire.pvr"];

So my questions are:

  • If I am going to have more than a particle system with different textures. Should I create a zwoptext with them? If so, how?
  • Why do the examples do [[CCTextureCache sharedTextureCache] addImage: @"file"];? it’s because it’s not added two times?

EDIT:
I just posted this in the cocos2d’s forum.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:29:10+00:00Added an answer on May 21, 2026 at 7:29 am

    If I am going to have more than a particle system with different textures. Should I create a zwoptext with them? If so, how?

    A texture sheet might improve the performance for rendering, because it would not change OpenGL ES state (binding textures). Please take a look at “How to Create and Optimize Sprite Sheets in Cocos2D with Texture Packer and Pixel Formats“. I strongly recommend you to use TexturePacker to create texture sheets.

    Why do the examples do [[CCTextureCache sharedTextureCache] addImage: @”file”];? it’s because it’s not added two times?

    It is easy to use for loading OpenGL texture. You must not use OpenGL ES API such as glTexImage2D or so forth. Also, of course, CCTextureCache always caches textures. It returns immediately CCTexture2D instance if the specified file is already cached.

    EDIT:

    You can get CCTexture2D instance from CCSpriteFrameCache with zwoptext plist.

    CCSpriteFrameCache *frameCache = [CCSpriteFrameCache sharedSpriteFrameCache];
    [frameCache addSpriteFramesWithFile:@"textures.plist"];
    
    CCSpriteFrame *frameFire = [frameCache spriteFrameByName:@"particle_fire"];
    CCTexture2D *texFire = frameFire.texture;
    ...
    glBindTexture(GL_TEXTURE_2D, texFire.name);
    /* You may need to use frameFire.rectInPixels and frameFire.rotated for the texture coordinates. */
    ...
    
    CCSpriteFrame *frameWater = [frameCache spriteFrameByName:@"particle_water"];
    CCTexture2D *texWater = frameWater.texture;
    ...
    glBindTexture(GL_TEXTURE_2D, texWater.name);
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm giving my first steps with generics, and I've just coded a generic function
I'm giving my first steps on Python. I saw that we don't have switch
I've been giving my first steps with images and buffered images in Java (and
I'm giving the first steps with the GWT Request Factory and I'm having an
I'm giving my first steps with ElasticSearch and to test things I'm currently working
Consider following 2 programs giving same error First calss: public class Testing { Testing
How can i skip first argument without giving any value in function call,so that
The jQuery documentation covers the function jQuery.extend()s twice, giving it different definitions. The first
XCode is giving me the above error. This is my first experience with, what
Hey this is my first post so tell me if I am not giving

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.