private void GLSurface_GLPaint(object sender, EventArgs e) { try { long time = DateTimeOffset.Now.ToUnixTimeMilliseconds(); float ox = GLSurface.ClientSize.Width % 2 == 0 ? 0 : 0.5f / GLSurface.Zoom; float oy = GLSurface.ClientSize.Height % 2 == 0 ? 0 : 0.5f / GLSurface.Zoom; GLSurface.Render(-ox - OffsetX, -oy - OffsetY); float tx = (int)Math.Round(-OffsetX + MouseManager.CurrentLocation.X - GLSurface.FieldW / 2 + 0.5) + OffsetX + (float)GLSurface.FieldW / 2 - 0.5f; float ty = (int)Math.Round(-OffsetY + MouseManager.CurrentLocation.Y - GLSurface.FieldH / 2 + 0.5) + OffsetY + (float)GLSurface.FieldH / 2 - 0.5f; gl.Color4ub(255, 0, 0, 255); gl.Begin(GL.LINE_LOOP); gl.Vertex2f(tx - 0.5f, ty - 0.5f); gl.Vertex2f(tx + 0.5f, ty - 0.5f); gl.Vertex2f(tx + 0.5f, ty + 0.5f); gl.Vertex2f(tx - 0.5f, ty + 0.5f); gl.End(); } catch (Exception ex) { GLFrameTimer.Stop(); MessageBox.Show(this, ex.ToString(), "Error: Can not render frame.", MessageBoxButtons.OK, MessageBoxIcon.Error); } }