CALayers powerful enough?

Discussion in 'Mac Programming' started by MatthewF, Nov 5, 2010.

  1. MatthewF, Nov 5, 2010
    Last edited: Nov 5, 2010

    macrumors newbie

    Would CALayers be powerful enough to handle a tile-based game with around 800 tiles moving at once?
    (Would it also work well with one CALayer per tile?)

    P.S. Would OpenGl be better for this task then CALayers? I really like using CAAnimation instead of making timers and manually doing it by hand. Is there a way to have incredible performance and CAAnimation?
  2. macrumors 68030


    Of course openGL would be better.

    The only good way to tell would be to try it out.
  3. macrumors newbie

    An OpenGl tile base engine produces good results. I'm working on the CALayer tile engine at the moment.

    If CALayer results are dissatisfying is there a way for me to use OpenGl with CAAnimation?
    I think I saw something about a CAEAGLLayer...

  4. Moderator emeritus


    That is for iOS. For OS X you can use CAOpenGLLayer.
  5. macrumors 601


    Is this a Mac game or an iPhone/iPad game? 800 layers on the desktop seems entirely reasonable (in fact I've seen CoreAnimation layer demos with more than that moving simultaneously). On a mobile device it's questionable, especially if most of your layers are not very small. If I had to guess, I'd say 800 layers on an iPad is not going to work very well currently. Also have to consider the limited RAM. Big difference between a 2+ GHz multicore desktop CPU with dedicated GPU and a mobile CPU/GPU with limited resources.
  6. MatthewF, Nov 5, 2010
    Last edited: Nov 5, 2010

    macrumors newbie

    I have my CALayer tile engine working and the results are great. Though the only downside is that it appears that a white line can appear between the tiles as the world moves... is there any way to fix that?

    Figured it out. Just had to make the frame extend 1 pixel out on each side.

    P.S. Would CAOpenGLLayer have better performance than a CALayer when just displaying an image?

Share This Page