private void onContextCreated(Object _event)
 {
     mVertexBuffer = null;
     mIndexBuffer  = null;
     mPassTextures = null;
     createPrograms();
 }
        private void createBuffers()
        {
            int         numVertices = mVertexData.getNumVertices();
            int         numIndices  = (int)(mIndexData.getLength());
            AsContext3D context     = AsStarling.getContext();

            if (mVertexBuffer != null)
            {
                mVertexBuffer.dispose();
            }
            if (mIndexBuffer != null)
            {
                mIndexBuffer.dispose();
            }
            if (numVertices == 0)
            {
                return;
            }
            if (context == null)
            {
                throw new AsMissingContextError();
            }
            mVertexBuffer = context.createVertexBuffer(numVertices, AsVertexData.ELEMENTS_PER_VERTEX);
            mVertexBuffer.uploadFromVector(mVertexData.getRawData(), 0, numVertices);
            mIndexBuffer = context.createIndexBuffer(numIndices);
            mIndexBuffer.uploadFromVector(mIndexData, 0, numIndices);
            mSyncRequired = false;
        }
 private void updateBuffers(AsContext3D context, AsRectangle bounds)
 {
     mVertexData.setPosition(0, bounds.x, bounds.y);
     mVertexData.setPosition(1, bounds.getRight(), bounds.y);
     mVertexData.setPosition(2, bounds.x, bounds.getBottom());
     mVertexData.setPosition(3, bounds.getRight(), bounds.getBottom());
     if (mVertexBuffer == null)
     {
         mVertexBuffer = context.createVertexBuffer(4, AsVertexData.ELEMENTS_PER_VERTEX);
         mIndexBuffer  = context.createIndexBuffer(6);
         mIndexBuffer.uploadFromVector(mIndexData, 0, 6);
     }
     mVertexBuffer.uploadFromVector(mVertexData.getRawData(), 0, 4);
 }