コード例 #1
0
ファイル: Legend.cs プロジェクト: CP-H/CPHControl
        /// <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();
        }
コード例 #2
0
ファイル: PaneBase.cs プロジェクト: CP-H/CPHControl
        /// <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);
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Chart"/> class.
 /// </summary>
 /// <param name="shaders">The shaders.</param>
 public Chart(Shaders shaders)
 {
     _glBorder = new GL_Border(Color.Black, shaders);
 }