I'm working on a mobile game and I am using a texture atlas. The problem is I had the beleif that using a texture atlas would mean 1 draw call for all textures but everytime I use part of the artlas my "DrawCalls" goes up by 2..... here's how I am calling it ...
GUI.BeginGroup(new Rect(0,0,Screen.width,Screen.height) );
foreach (GUIBit gb in SceneElements)
{
if (gb.Show)
{
if (gb.AtlasTextureNumber == 0)
Graphics.DrawTexture( new Rect(gb.x, gb.y, gb.width, gb.height), textureAtlas.texture, new Rect(textureAtlas.areas[gb.AtlasNumber]), 0, 0, 0, 0 );
if (gb.HasText)
{
GUI.Label(new Rect(gb.x, gb.y, gb.width, gb.height), gb.TextToShow, GuiStyles[gb.styleIndex]);
GuiStyles[gb.styleIndex].normal.textColor = Color.white;
}
}
}
GUI.EndGroup();
basically what I am doing here is loading in a texture atlas and then storing an array of points on the texture atlas these are the ... "textureAtlas.areas[gb.AtlasNumber]"
I am then storing an array opf "GUIBits" which store info such as which texture to use from "textureAtlas.areas[]" and where to display them on screen and a boolean for show or not so I can turn them on and off at run time.
So yeh, everytime I turn one on I am getting a +2 to the draw calls even though the texture is only added to my "TextureAtlas" class the once ?
Thank's for any help on this
↧