コード例 #1
0
        public void UpdateText(string text)
        {
            GenRectangle();

            textString = text;

            Ready        = false;
            textMeshData = null;

            textMeshData = createTextMesh();

            GL.BindVertexArray(VAO);

            GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
            GL.BufferData(BufferTarget.ArrayBuffer, textMeshData.getVertexLength() * Vector2.SizeInBytes, textMeshData.getVertexPositions(), BufferUsageHint.DynamicDraw);
            GL.VertexAttribPointer(0, 2, VertexAttribPointerType.Float, false, 0, 0);
            GL.EnableVertexAttribArray(0);

            GL.BindBuffer(BufferTarget.ArrayBuffer, ubo);
            GL.BufferData(BufferTarget.ArrayBuffer, textMeshData.getTextureCoordsLength() * Vector2.SizeInBytes, textMeshData.getTextureCoords(), BufferUsageHint.DynamicDraw);
            GL.VertexAttribPointer(1, 2, VertexAttribPointerType.Float, false, 0, 0);
            GL.EnableVertexAttribArray(1);

            Ready = true;
        }
コード例 #2
0
        private TextMeshData createTextMesh()
        {
            List <Line>  lines = createStructure();
            TextMeshData data  = createQuadVertices(lines);

            return(data);
        }
コード例 #3
0
        public FontRender(string text, float fontsize, string fontName, Vector2 Position, float maxLineLength, Rectangle frec)
        {
            textString       = text;
            fontSize         = fontsize;
            position         = Position;
            lineMaxSize      = maxLineLength;
            FontName         = fontName;
            _ParentRectangle = frec;

            font = AssetsManager.GetFont(FontName);

            GenRectangle();

            textMeshData = createTextMesh();
            SetUpBuffers();
        }
コード例 #4
0
        public void Dispose()
        {
            textMeshData = null;

            /*GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0);
             * GL.BindVertexArray(0);*/

            GL.BindVertexArray(0);
            GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
            GL.DisableVertexAttribArray(0);

            GL.BindVertexArray(0);
            GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
            GL.DisableVertexAttribArray(0);

            //GL.DeleteBuffer(IBO);
            GL.DeleteBuffer(vbo);
            GL.DeleteBuffer(ubo);
            GL.DeleteVertexArray(VAO);
        }