By utilizing the GPU and cacheAsBitmapMatrix this Box2D demo went from a sluggish 18 – 20 fps to a consistent 24 fps! Check out the demo in the video below:
Turning on GPU Acceleration within AIR for Android:
Open the application descriptor XML file associated with your project. Edit the render mode to include gpu instead of auto. The hardware acceleration drop down within the publish settings does not currently modify this property, you need to set it manually.
Using cacheAsBitmapMatrix:
var matrix:Matrix = new Matrix(); // creates an identity matrix mySprite.cacheAsBitmapMatrix = matrix; mySprite.cacheAsBitmap = true;
Using this code actually flipped my asset vertically on the stage. To correct this I modified the asset vertically within Flash. Using the cacheAsBitmapMatrix significantly increased the performance of the application.
Summary:
Using Box2D, the GPU and cacheAsBitmapMatrix will allow developers to create high performing games with realistic physics. These applications will soon be distributable across multiple mobile platforms. What are you going to create?