void RenderApps(VirtualCamera camera, RenderLayer renderLayer)
        {
            GraphicsDevice device = canvas.GetDevice();
            DepthStencilBuffer dsOld = device.DepthStencilBuffer;
            device.DepthStencilBuffer = canvas.GetDepthStencil();
            device.SetRenderTarget(0, renderLayer.RenderTarget);
            device.SetRenderTarget(1, renderLayer.GlowTarget);
            device.Clear(Color.TransparentBlack);
            device.RenderState.DepthBufferEnable = true;
            device.RenderState.DepthBufferWriteEnable = true;
            device.RenderState.DepthBufferFunction = CompareFunction.LessEqual;
            device.SetVertexShaderConstant(CanvasShaderConstants.VC_MODELVIEW, camera.ViewProjection);

            for (int i = 0; i < apps.Count; i++)
            {
                apps[i].OnRender(canvas);
            }

            device.SetRenderTarget(0, null);
            device.SetRenderTarget(1, null);
            device.DepthStencilBuffer = dsOld;
        }
 void InitializeCameras(Canvas canvas)
 {
     camerasInitialized = true;
     cameraA = new CameraDevice(canvas, 0, 640, 480, 24);
     cameraA.Play();
     SetupCameraParameters(cameraA);
     cameraB = new CameraDevice(canvas, 1, 640, 480, 24);
     cameraB.Play();
     SetupCameraParameters(cameraB);
     GraphicsDevice device = canvas.GetDevice();
     int width = device.PresentationParameters.BackBufferWidth/2;
     int height = device.PresentationParameters.BackBufferHeight;
     renderLayerA = new RenderLayer(canvas, width, height);
     renderLayerB = new RenderLayer(canvas, width, height);
 }