OPENGL using textured layers and sprites, best choice?

Discussion in 'iOS Programming' started by mymac1, Aug 23, 2009.

  1. mymac1 macrumors newbie

    Jul 28, 2009
    Hi All,
    I have been reading through many posts on the internet and it seems that OpenGL is widely recommended API to be used for 2D games on the iphone as well as 3D.

    I am looking to develop a 2D game which has more than two background layers and several sprites.
    The technique I have used so far is to create a textured quad for each of the layers and sprites, rendering them in the sequence in which they appear (last drawn item on top).

    Regarding the texturing of the quads, I'm using a texture atlas and specifying texture coordinates in floating point for each of the background layers and indvividual sprites.

    Is this the best way to render layers and sprites? it seems kind of like a sort of makeshift way of doing things. Plus when animating the different sprite frames I have to change all four texture coordinates each time based on stored coords for each frame image.

    your thoughts?

    Thanks in advance
  2. Kingbombs macrumors member

    Jun 24, 2009
  3. xsmasher macrumors regular


    Jul 18, 2008
    That sounds about right; that's the way I built my game.

    You should also look into cocos2d, a framework for making 2d games without learning OpenGL. There's also the texture2d class files from Apple that wraps some simple openGL drawing.
  4. DUMBDOG macrumors newbie

    Oct 29, 2008
    But learning OpenGL is half the fun! :eek:
  5. xsmasher macrumors regular


    Jul 18, 2008
    Yeah but some folks are in a rush - or just don't like juggling arrays of vertices. :)

Share This Page