b2dLite is a quick Stage3D quad rendering engine. It batches the draw calls automatically, drastically improving the application performance. In order to take full advantage of the lib,  a developer must use spritesheets, trying to draw objects with the same texture together, which avoids context switches.

The lib has an API that is easy to use and understand. It starts with the instantiation of a b2dLite object, which will be used to performed all the drawing. After the object must initialized with on of the two rendering methods (state or context). Once it’s ready, a developer can create a texture and draw it as many times as needed. The developer is responsible for clearing the rendering buffer before any new frame is rendered.


public class Main extends Sprite 
    private var b2d:b2dLite;
    private var textureMap:BitmapData;
    private var texture:Texture;

    public function Main():void {
        if (stage) init();
        else addEventListener(Event.ADDED_TO_STAGE, init);

    private function init(e:Event = null):void  {
        removeEventListener(Event.ADDED_TO_STAGE, init);
        // entry point          
        b2d = new b2dLite();
        b2d.initializeFromStage(stage, start, 512, 512);

    private function start():void {
        textureMap = new BitmapData(32, 32, false, 0xFF0000);
        texture = b2d.createTexture(textureMap);

        stage.addEventListener(Event.ENTER_FRAME, update);

    private function update(e:Event):void {
        //draw stuff
        b2d.renderQuad(32, 32, stage.mouseX, stage.mouseY, texture);
Misc. URL.