private void glControl_Load(object sender, EventArgs e) { _font = new FontGroup(glControl.Font); _font.Color = _fgColor; _width = _font.MonoSpaceWidth; _height = _font.LineSpacing; glControl.Width = Convert.ToInt32(_width * _columns); glControl.Height = Convert.ToInt32(_height * _rows); _cursor = new RectangleF(0, 0, _width, _height); _backBuffer = new FrameBuffer(glControl.Width, glControl.Height); _pingPongBuffer = new FrameBuffer(glControl.Width, glControl.Height); GL.MatrixMode(MatrixMode.Projection); GL.LoadIdentity(); GL.Ortho(0, glControl.Width, glControl.Height, 0, -1, 1); GL.Viewport(0, 0, glControl.Width, glControl.Height); GL.MatrixMode(MatrixMode.Modelview); GL.LoadIdentity(); GL.Disable(EnableCap.DepthTest); GL.Disable(EnableCap.Lighting); GL.ClearColor(_bgColor); }
private void InitialDimension() { font = new FontGroup(glControl.Font) { Color = fgColor }; width = font.MonoSpaceWidth; height = font.LineSpacing; var columns = mainPanel.Width / (int)width; var rows = mainPanel.Height / (int)height; }