public Renderer(GLControl context, WindowsFormsHost host) { m_control = context; context.Width = (int)host.Width; context.Height = (int)host.Height; RenderableObjs = new List<IRenderable>(); Cam = new Camera(); SetUpViewport(); m_intervalTimer = new System.Windows.Forms.Timer(); m_intervalTimer.Interval = 16; // 60 FPS roughly m_intervalTimer.Enabled = true; m_intervalTimer.Tick += (args, o) => { Vector2 mousePosGlobal = new Vector2(System.Windows.Forms.Control.MousePosition.X, System.Windows.Forms.Control.MousePosition.Y); Vector2 glControlPosGlobal = new Vector2((float)host.PointToScreen(new Point(0, 0)).X, (float)host.PointToScreen(new Point(0, 0)).Y); Input.Internal_SetMousePos(new Vector2(System.Windows.Forms.Control.MousePosition.X, System.Windows.Forms.Control.MousePosition.Y)); Input.Internal_UpdateInputState(); if (host.IsFocused) { Cam.Update(); } Draw(); }; m_control.MouseUp += m_control_MouseUp; m_control.MouseDown += m_control_MouseDown; m_control.MouseMove += m_control_MouseMove; host.KeyUp += host_KeyUp; host.KeyDown += host_KeyDown; host.LayoutUpdated += host_LayoutUpdated; ProjectionMatrix = Matrix4.Identity; }