Proof that 30k lines can be rendered with up to 3000fps in a small window, fast GPU. Even
1000fps means that 30 million lines are drawn each second. More than 30k lines are possible
with multiple draw calls, but causes multiple CircularBuffer flushes and thus not faster.
View code on GitHub
Namespace: DeltaEngine.Graphics.TestsAssembly: DeltaEngine.Graphics.Tests (in DeltaEngine.Graphics.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Examples
/// <summary> /// Proof that 30k lines can be rendered with up to 3000fps in a small window, fast GPU. Even /// 1000fps means that 30 million lines are drawn each second. More than 30k lines are possible /// with multiple draw calls, but causes multiple CircularBuffer flushes and thus not faster. /// </summary> [Test, Category("Slow")] public void Draw30000LinesPerFrame() { var manyLines = new DrawingTests.Line(Vector2D.Zero, new Vector2D(1280, 720), Color.Red); const int NumberOfRandomLines = 30000; var vertices = new VertexPosition2DColor[2 * NumberOfRandomLines]; var random = Randomizer.Current; var viewport = Resolve<Window>().ViewportPixelSize; for (int i = 0; i < NumberOfRandomLines; i++) { var startPoint = new Vector2D(random.Get(0, viewport.Width), random.Get(0, viewport.Height)); var endPoint = startPoint + new Vector2D(random.Get(-50, 50), random.Get(-50, 50)); vertices[i * 2 + 0] = new VertexPosition2DColor(startPoint, Color.GetRandomColor()); vertices[i * 2 + 1] = new VertexPosition2DColor(endPoint, Color.GetRandomColor()); } manyLines.Set(vertices); }
See Also