/// <summary> /// Attachs this rendering target to the graphics driver, so that all rendering /// is done to it. /// </summary> bool IRenderTarget.Attach() { if (GraphicsManager.Driver != _driver) { ((Control)_graphicsCanvas).Dispose(); _graphicsCanvas = GraphicsManager.Driver.CreateCanvas(_renderControl, _graphicsCanvas.Flags); _driver = GraphicsManager.Driver; } return(_graphicsCanvas.Attach()); }
/// <summary> /// Attachs the given render target to this driver and detachs the old one. /// </summary> /// <param name="target">Render target to attach.</param> public void SetRenderTarget(IRenderTarget target) { if (target == _renderTarget || target == null) { return; } if (_renderTarget != null) { _renderTarget.Detach(); } ResetState(target); _renderTarget = target; if (target.Attach() != true) { throw new Exception("An error occured while attempting to attach the graphics driver to a render target."); } }
/// <summary> /// Attachs the given render target to this driver and detachs the old one. /// </summary> /// <param name="target">Render target to attach.</param> public void SetRenderTarget(IRenderTarget target) { if (target == _renderTarget || target == null) return; if (_renderTarget != null) _renderTarget.Detach(); ResetState(target); _renderTarget = target; if (target.Attach() != true) throw new Exception("An error occured while attempting to attach the graphics driver to a render target."); }