I’ve been impressed by the Starling framework but like many I’ve struggled to get a solid 60fps on some of the older mobile devices out there. For example, my recent parallax scrolling demo was capped at 30fps on iPad 1 whereas the iPad 2 was easily capable of running it at a full 60fps without batting an eyelid.

Thankfully the latest version of Starling now supports blend modes and there’s one in particular that can really give your apps a performance boost in certain situations. It’s called BlendMode.NONE and it deactivates all Stage3D alpha blending on any display objects that it’s applied to. This is perfect for large background images or tile maps that don’t require an alpha channel.

Let’s take a look at a quick code example. First import the BlendMode class:

import starling.display.BlendMode;

Now simply apply the blend mode to your display object. We’ll use an Image in this example:

var image:Image = new Image(backgroundTexture);
image.blendMode = BlendMode.NONE;

And that’s basically it. If you’re applying BlendMode.NONE to large (or many) display objects then you’re likely to see a significant performance boost on a large number of devices. Remember however, if your display object requires the use of transparency then you won’t be able to use BlendMode.NONE without losing its alpha information.

For some additional detail and a list of the available blend modes, pop on over to this post on the Starling forum.

  1. Will this BlendMode eventually be the default?

  2. Great information! What is the default blendMode? Why isn’t it NONE?

  3. “if your display object requires the use of transparency then you won’t be able to use BlendMode.NONE without losing its alpha information.”

    That should answer your question, guys. BlendMode.NONE doesn’t make a good default because it removes transparency. It’s best for selective cases, like backgrounds, where you know that particular textures don’t have transparent pixels.

  4. thanks, great tip, keep em’ coming!

    nick
  5. How can you do your “parallax scrolling demo” widthout transperancy?

  6. Hi Mark. Of course it really depends on your project. For my demo, the two background layers can probably do without transparency. Also, some of the tiles that make-up the foreground don’t require transparency either. But you’re right, for many parallax scrolling games, it might not be possible.

    Christopher (Author)