Easy Fallback from DirectX to Software Rendering without code-behind
Posted by Andrew BT on 05 February 2019 04:19 PM
|
|
In the article Creating and Deploying Applications with the Direct3D11RenderSurface, we present how you can enable your applications to make use of the DirectX Renderer Plugin for accelerated performance in SciChart WPF Charts. If you haven't read about the benefits of the DirectX Renderer, you can do so at the article How Fast is SciChart's WPF Chart? DirectX vs. Software Comparison. Enabling DirectX Rendering with Software FallbackIf you deploy your application on multiple PCs, then it is possible that some will not support the DirectX renderer, which requires Windows Vista, 7, 8, 8.1 and DirectX10/11. You need to enable DirectX but also gracefully fall back to software rendering if DirectX is not available. To do this, we use the DirectXHelper class, which is covered by this video below: The DirectXHelper has two attached properties which allow us to define whether DirectX is enabled or not, and what fallback renderer to use in case DirectX is not available. Usage in XAML <SciChartSurface s3D:DirectXHelper.TryApplyDirectXRenderer="True" s3D:DirectXHelper.FallbackType="{x:Type s:HighSpeedRenderSurface}"> ... </SciChartSurface> Usage in Code SciChartSurface sciChart; DirectXHelper.SetTryApplyDirectXRenderer(sciChart, true); DirectXHelper.SetFallbackType(typeof(HighSpeedRenderSurface)); This helper class will check if the Direct3D11RenderSurface can be applied, and apply it. If not, it will apply the HighQualityRenderSurface. Optionally, you can change the above code to fall back to the HighSpeedRenderSurface. Deploying Applications with SciChart.DirectXIt is important that the dependencies that are required for SciChart.DirectX are deployed when enabling this feature in your application. If you intend to use Click Once, or MSI installer to deploy an application, please be sure to read Creating and Deploying Applicaitons with the Direct3D11RenderSurface to find out how to do this.
| |
|