public void OnRenderFrame(FrameEventArgs e) { GL.ClearColor(Color.Black); GL.Clear(ClearBufferMask.ColorBufferBit); OrthoMode(); //background UpdateMouse(); DrawWidgets(currentForm); if (d_FormMessageBox.Visible) { DrawWidgets(d_FormMessageBox); } else { currentForm.Render(); } //PerspectiveMode(); try { d_MainWindow.SwapBuffers(); } catch { Application.Exit(); } //"failed to swap buffers" crash when exiting program. }