OpenGL ES Texture Mapping

Discussion in 'Public Game Developers Forum' started by Raithwall, Jun 9, 2009.

  1. Raithwall

    Raithwall Member

    May 30, 2009
    7
    0
    0
    Cooking for the U.S. Army
    Ky
    #1 Raithwall, Jun 9, 2009
    Last edited: Jun 9, 2009
    Quick question for you developers out there. I was wondering if it would be more economically efficient (require less memory) if I use the same image for 4 textures? For example. say I have a square image, every quarter of that square has a different image, can I take that image and basicilly use it as four different textures? If so does the image degrade very much? Thanks for any help.
     
  2. ChaoticBox

    ChaoticBox Well-Known Member

    Oct 8, 2008
    878
    6
    18
    Male
    Developer
    Toronto Canada
    It won't use less memory but it will cut down on texture uploads which is definitely a plus. Apple recommends this technique in their documentation (Google "texture atlas") but there are some caveats so it may not work for all situations.
     
  3. Eric5h5

    Eric5h5 Well-Known Member

    Realmaze3D uses this technique extensively...there are normally only 5 actual textures visible: 1 for walls/floor/ceiling (1024x1024 texture divided into 3x3 square segments for a total of 9 'textures'), 1 for the various decorations (512x512 divided arbitrarily depending on objects), 1 for ladders (512x512 also arbitrarily divided), 1 for light halos (64x64 divided into 2x2 square segments), and 1 for the UI stuff (256x256 divided arbitrarily). The biggest problem is probably preventing mipmap bleeding. Also getting the walls/floor/ceiling texture segments to tile took quite a bit more work than usual, although that's partially because the 3 wall sections have to tile with each other (same for floor and ceiling).

    --Eric
     
  4. ChaoticBox

    ChaoticBox Well-Known Member

    Oct 8, 2008
    878
    6
    18
    Male
    Developer
    Toronto Canada
    To be clear, I should've said: *can* cut down on texture uploads. Ideally your atlases should only be bound once per frame - bind once, draw lots. Same goes for other GL state changes.
     

Share This Page