private void GlControlPaint(object sender, PaintEventArgs e) { if (!_loaded) { GL.ClearColor(Color4.LightSteelBlue); GL.Clear(ClearBufferMask.ColorBufferBit); } else if (!_bound) { GL.ClearColor(Color4.SteelBlue); GL.Clear(ClearBufferMask.ColorBufferBit); } else if (_screenCap) { _screenCap = false; SuspendLayout(); _graph.HideUI(); Size tmp = glControl.Size; glControl.Size = new Size(2000, 750); CanvasManager.ChangeViewportSize(glControl.Size); GL.ClearColor(Color4.White); GL.Clear(ClearBufferMask.ColorBufferBit); _graph.DrawGraph(); Bitmap bmp = new Bitmap(glControl.Width, this.glControl.Height); BitmapData data = bmp.LockBits(glControl.ClientRectangle, ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb); GL.Finish(); GL.ReadPixels(0, 0, this.glControl.Width, this.glControl.Height, PixelFormat.Bgr, PixelType.UnsignedByte, data.Scan0); bmp.UnlockBits(data); bmp.RotateFlip(RotateFlipType.RotateNoneFlipY); bmp.Save(_screenCapFile, ImageFormat.Png); glControl.Size = tmp; CanvasManager.ChangeViewportSize(glControl.Size); _graph.ShowUI(); ResumeLayout(); } else { GL.ClearColor(Color4.White); GL.Clear(ClearBufferMask.ColorBufferBit); _graph.DrawGraph(); } glControl.SwapBuffers(); }
private void GraphControlResize(object sender, EventArgs e) { glControl.Size = this.Size; CanvasManager.ChangeViewportSize(glControl.Size); }