Per default, if objects in your scene use textures from multiple atlases, they will end up in separate draw calls. It's a huge challenge to optimize your scene in a way that keeps the number of draw calls as small as possible.
To overcome this limit, you can now use this extension. If you render your objects with this style, meshes with up to four different textures will be batched together. All that you have to do is make the MultiTextureStyle
the default for all your meshes:
Mesh.defaultStyle = MultiTextureStyle;
That's it! (Ideally, you'd do this before starting Starling.)
Beware that this means that your fragment shaders will become much more complex than with the standard MeshStyle
, so this is no silver bullet: you simply exchange load on the CPU with load on the GPU. But since many Starling apps are CPU bound, that's often just what you need.
When you use this style, it's especially important that you start Starling with the “auto” profile selector, or force one of the “standard” profiles. That's because only beginning with the “standard” profile, Stage3D supports if-statements in the AGAL code, and those are used to simplify the complexity of the fragment shader. The extension will also work in all of the “baseline” profiles, but it's not as efficient.
Feel free to edit this part of the page if you want to add information that's lacking in the above description.
Questions are better asked in the forum, though.