OpenGL ES: Aligning Data

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

  1. Blakeasd macrumors 6502a

    Dec 29, 2009
    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.

  2. ArtOfWarfare macrumors G3


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

Share This Page