/// <summary> /// Initializes a new instance of the <see cref="Legend"/> class. /// </summary> /// <param name="textInstance">The text instance.</param> public Legend(TextInstance textInstance) { _legendEntries = new List <LegendEntry>(); _border = new GL_Border(Color.Black, textInstance.Shaders); _textInstance = textInstance; _linesShader = textInstance.Shaders.LineShader; _rect = new GLRectangleF(0, 0, 0, 0); _innerRect = new GLRectangleF(0, 0, 0, 0); _entryGapX = 2; _nEntriesVert = 5; _margin = new Margin(); _margin.Left = 10; _margin.Right = 10; _margin.Top = 2; _margin.Bottom = 5; _lineHeight = textInstance.FontSize * 0.8; _VBOLine = GL.GenBuffer();//set up OpenGL by generating buffers and using the shader _VAOLine = GL.GenVertexArray(); _linesShader.Use(); GL.BindVertexArray(_VAOLine);//setting up VAO states and binding the VBO GL.EnableVertexAttribArray(_linesShader.VertexLocation); GL.BindBuffer(BufferTarget.ArrayBuffer, _VBOLine); _mat = Matrix4.Identity; GL.UniformMatrix4(_linesShader.MatrixLocation, false, ref _mat); GL.VertexAttribPointer(_linesShader.VertexLocation, 2, VertexAttribPointerType.Float, false, 2 * sizeof(float), 0); GL.BindVertexArray(0); _linesShader.StopUse(); }
/// <summary> /// Initializes a new instance of the <see cref="Scale"/> class. /// </summary> /// <param name="ownerAxis">The owner axis.</param> /// <param name="TextInstance">The text instance.</param> public Scale(Axis ownerAxis, TextInstance TextInstance) { _ownerAxis = ownerAxis; _textInstance = TextInstance; _min = 0.0; _max = 10.0; _majorStep = 1; _minorStep = 0.1; _targetXSteps = 7; _targetYSteps = 7; _targetMinorXSteps = 5; _targetMinorYSteps = 5; _VBO = GL.GenBuffer(); //generate VBO, VAO and setting them up here _VAO = GL.GenVertexArray(); _linesShader = TextInstance.Shaders.LineShader; _linesShader.Use(); GL.BindVertexArray(_VAO); GL.EnableVertexAttribArray(_linesShader.VertexLocation); GL.BindBuffer(BufferTarget.ArrayBuffer, _VBO); _mat = Matrix4.Identity; GL.UniformMatrix4(_linesShader.MatrixLocation, false, ref _mat); GL.VertexAttribPointer(_linesShader.VertexLocation, 2, VertexAttribPointerType.Float, false, 2 * sizeof(float), 0); GL.BindVertexArray(0); _linesShader.StopUse(); }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.UserControl.Load" /> event. /// Sets all the properties up but only if the form is not in designer mode, /// because OpenGL calls in the Designer cause errors. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); _rect = new Rectangle(0, 0, this.Size.Width, this.Size.Height); this.MakeCurrent(); if (!(IsInDesignerMode())) { _shaders = new Shaders(Resources.LineShader_vert, Resources.LineShader_frag, Resources.TextShader_vert, Resources.TextShader_frag); _textInstance = new TextInstance(_shaders); _graphPane = new GraphPane(_rect, _textInstance); _graphPane.ReSize(new GLRectangleF(0, 0, (int)_rect.Width, (int)_rect.Height)); _textInstance.GenerateFontImage(_graphPane.Rect); GL.ClearColor(1.0f, 1.0f, 1.0f, 0.0f); _zoomPanState = new ZoomPanState(ref _graphPane); _FrameTimer.Tick += FrameTimer_Tick; _FrameTimer.Interval = 25; _FrameTimer.Start(); _stopwatch = new Stopwatch(); _stopwatch2 = new Stopwatch(); _stopwatch.Reset(); _stopwatch2.Reset(); _stopwatch.Start(); } }
/// <summary> /// Initializes a new instance of the <see cref="GraphPane"/> class /// using a Rectangle describing the screen space. /// </summary> /// <param name="PaneRect">The pane rect.</param> /// <param name="TextInstance">The text instance.</param> public GraphPane(RectangleF PaneRect, TextInstance TextInstance) : base(PaneRect, TextInstance) { _chart = new Chart(TextInstance.Shaders); _curveList = new CurveList(this, TextInstance); _xAxis = new XAxis(TextInstance); _yAxisList = new YAxisList(TextInstance); _textInstance = TextInstance; _shaders = TextInstance.Shaders; _margin.Left = 2; _margin.Top = 8; }
/// <summary> /// Initializes a new instance of the <see cref="Axis"/> class /// mostly with default values. /// </summary> /// <param name="TextInstance">The text instance.</param> public Axis(TextInstance TextInstance) { _majorTic = new MajorTic(); _minorTic = new MinorTic(); _zoomCorrection = Default.zoomCorrection; _zoomDiff = Default.zoomDiff; _axisGap = Default.AxisGap; _numSpace = Default.numSpace; _scale = new Scale(this, TextInstance); _textInstance = TextInstance; }
/// <summary> /// Initializes a new instance of the <see cref="PaneBase"/> class. /// </summary> /// <param name="paneRect">The pane rect.</param> /// <param name="textInstance">The text instance.</param> public PaneBase(RectangleF paneRect, TextInstance textInstance) { _rect = new GLRectangleF(0, 0, 0, 0); _rect.X = (int)paneRect.X; _rect.Height = (int)paneRect.Height; _rect.Width = (int)paneRect.Width; _rect.Y = (int)paneRect.Bottom; _margin = new Margin(); _glBorder = new GL_Border(Color.Black, textInstance.Shaders); _legend = new Legend(textInstance); }
/// <summary> /// Initializes a new instance of the <see cref="Axis"/> class /// with a given title string. /// </summary> /// <param name="title">The title.</param> /// <param name="TextInstance">The text instance.</param> public Axis(string title, TextInstance TextInstance) : this(TextInstance) { _title = new AxisLabel(title, TextInstance); }
/// <summary> /// Initializes a new instance of the <see cref="CurveList"/> class. /// </summary> /// <param name="pane">The <see cref="GraphPane"/>.</param> /// <param name="TextInstance">The <see cref="TextInstance"/>.</param> public CurveList(GraphPane pane, TextInstance TextInstance) { _textInstance = TextInstance; _pane = pane; }
/// <summary> /// Initializes a new instance of the <see cref="GraphPane"/> class, /// If there is only a TextInstance given. This is used in the /// <see cref="global::CPHControl"/> Constructor /// </summary> /// <param name="TextInstance">The text instance.</param> public GraphPane(TextInstance TextInstance) : this(new RectangleF(0, 0, 500, 375), TextInstance) { }
/// <summary> /// Initializes a new instance of the <see cref="YAxis"/> class /// with the given index. /// </summary> /// <param name="title">The title.</param> /// <param name="TextInstance">The text instance.</param> /// <param name="index">The index.</param> public YAxis(string title, TextInstance TextInstance, int index) : base(title, TextInstance) { _index = index; }
/// <summary> /// Initializes a new instance of the <see cref="YAxisList"/> class. /// </summary> /// <param name="TextInstance">The text instance.</param> public YAxisList(TextInstance TextInstance) { _textInstance = TextInstance; }