OpenGL ES: Aligning Data

Discussion in 'iOS Programming' started by Blakeasd, May 18, 2013.

  1. Blakeasd macrumors 6502a

    Joined:
    Dec 29, 2009
    #1
    Hello, I am reading the iOS guide by Apple for avoiding misaligned data in OpenGL ES. I don't understand. Here is the excerpt from the article that I don't understand:

    "When you are designing your vertex structure, align the beginning of each attribute to an offset that is either a multiple of its component size or 4 bytes, whichever is larger."

    I think I understand why it must be a multiple of four, is it because iOS has memory granularity of 4, meaning that it can pull 4 bytes in one CPU call (making padding necessary)? Or is this something entirely different? What would be the purpose of making the size of the vertex structure a multiple of the component size? It's my understanding that it still must be a multiple of four to avoid misaligned data due to the granularity of 4.

    It's possible that I am completely misinformed, any help is greatly appreciated.

    Thanks!
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    ARM processors have 32 bit ( = 4 byte ) wide words... not sure if that's related or not.
     

Share This Page