private void glControl1_Paint(object sender, PaintEventArgs e) { if (ShapeMarkedForUpdate && (AutoUpdate || ForceShapeUpdate)) { //Console.WriteLine("updating shape.."); ThePanel.UpdateShape(); // check if needed? ShapeMarkedForUpdate = false; } glControl1.MakeCurrent(); DrawingScale = Math.Min(glControl1.Width, glControl1.Height) / (float)(Math.Max(ThePanel.TheSet.Height, ThePanel.TheSet.Width) + 10); GraphicsInterface GI = (GraphicsInterface) new GLGraphicsInterface(0, 0, glControl1.Width, glControl1.Height); GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity(); GL.Ortho(-glControl1.Width / 2, glControl1.Width / 2, glControl1.Height / 2, -glControl1.Height / 2, -100, 100); GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity(); GL.Viewport(0, 0, glControl1.Width, glControl1.Height); GL.Clear(ClearBufferMask.ColorBufferBit); GI.ScaleTransform((float)Zoom, -(float)Zoom); GI.TranslateTransform(-(float)(CenterPoint.X), -(float)(CenterPoint.Y)); GL.Disable(EnableCap.DepthTest); GL.Enable(EnableCap.Blend); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); GL.Hint(HintTarget.LineSmoothHint, HintMode.Nicest); GL.Hint(HintTarget.PointSmoothHint, HintMode.Nicest); ThePanel.DrawBoardBitmap(1.0f, GI, glControl1.Width, glControl1.Height, SelectedInstance, HoverShape, SnapDistance()); glControl1.SwapBuffers(); }