private bool RenderToRenderTarget(IRenderTarget target, IList<IRenderable> renderables, IList<ISprite> sprites, bool doPresent, Camera camera, Light light) { this.device.SetRenderTarget(target); if (target.ClearBackGround) this.device.RawDevice.Clear(target.ClearOptions, target.ClearColor.ToArgb(), 1.0f, 0); Result result = this.device.RawDevice.BeginScene(); if (result.IsFailure) { Log.Msg(TraceLevel.Error, this, "BeginScene failed, " + result.ToString()); return false; } try { if (renderables != null && renderables.Count > 0) { foreach (var renderable in renderables) { renderable.Render(camera, light); } } if (sprites != null && sprites.Count > 0) { this.spriteRenderer.RawSprite.Begin(SpriteFlags.AlphaBlend); foreach (var sprite in sprites) { sprite.Render(this.spriteRenderer); } this.spriteRenderer.RawSprite.End(); } } finally { this.device.RawDevice.EndScene(); } if (doPresent) this.device.RawDevice.Present(); target.OnRender(); return true; }