private static void SetUpMonitorData() { ImGuiPlatformIOPtr platformIO = ImGui.GetPlatformIO(); var platformMonitors = new List <ImGuiPlatformMonitor>(); { Monitor *[] monitors = GLFW.GetMonitors(); for (int i = 0; i < monitors.Length; i++) { Monitor * monitor = monitors[i]; ImGuiPlatformMonitor m = new ImGuiPlatformMonitor(); var vidMode = GLFW.GetVideoMode(monitor); GLFW.GetMonitorPos(monitor, out int x, out int y); m.MainPos = m.WorkPos = new Vector2(x, y); m.MainSize = m.WorkSize = new Vector2(vidMode->Width, vidMode->Height); GLFW.GetMonitorContentScale(monitor, out float xScale, out float yScale); m.DpiScale = xScale; platformMonitors.Add(m); } } _monitorData = platformMonitors.ToArray(); _monitorDataPin = GCHandle.Alloc(_monitorData, GCHandleType.Pinned); var platformMonitorsPtrs = new ImGuiPlatformMonitorPtr[_monitorData.Length]; for (int i = 0; i < _monitorData.Length; i++) { fixed(ImGuiPlatformMonitor *ptr = &_monitorData[i]) { platformMonitorsPtrs[i] = new ImGuiPlatformMonitorPtr(ptr); } } _monitorPtrData = platformMonitorsPtrs; _monitorPtrDataPin = GCHandle.Alloc(_monitorPtrData, GCHandleType.Pinned); _monitorsPtrVector = new ImVector <ImGuiPlatformMonitor>(_monitorPtrData.Length, _monitorPtrData.Length, _monitorDataPin.AddrOfPinnedObject()); { ImGuiPlatformIO *ptr = platformIO; ImVector v = Unsafe.As <ImVector <ImGuiPlatformMonitor>, ImVector>(ref _monitorsPtrVector); ptr->Monitors = v; } }