diff --git a/src/Windowing/Silk.NET.Windowing.Common/Internals/ViewImplementationBase.cs b/src/Windowing/Silk.NET.Windowing.Common/Internals/ViewImplementationBase.cs index 3fad92c4c9..69fe7c06c9 100644 --- a/src/Windowing/Silk.NET.Windowing.Common/Internals/ViewImplementationBase.cs +++ b/src/Windowing/Silk.NET.Windowing.Common/Internals/ViewImplementationBase.cs @@ -283,6 +283,8 @@ public Vector2D PointToFramebuffer(Vector2D point) Unsafe.As>(ref framebufferSizeElements[0]) = FramebufferSize; var framebufferSize = new Vector(framebufferSizeElements); Span sizeElements = stackalloc int[Vector.Count]; + // HACK: Avoid divide by zero errors + sizeElements[2..].Fill(1); Unsafe.As>(ref sizeElements[0]) = Size; var size = new Vector(sizeElements); Span pointElements = stackalloc int[Vector.Count]; @@ -295,6 +297,11 @@ public Vector2D PointToFramebuffer(Vector2D point) Unsafe.As>(ref a[0]) = FramebufferSize; Unsafe.As>(ref a[c]) = Size; Unsafe.As>(ref a[c * 2]) = point; + + // HACK: Avoid divide by zero errors + for (var i = c + 2; i < c * 2; i++) + a[i] = 1; + var framebufferSize = new Vector(a, 0); var size = new Vector(a, c); var thePoint = new Vector(a, c * 2);