コード例 #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 void SetUpBuffers()
        {
            VAO = GL.GenVertexArray();
            //IBO = GL.GenBuffer();
            vbo = GL.GenBuffer();
            ubo = GL.GenBuffer();

            /*GL.BindBuffer(BufferTarget.ElementArrayBuffer, IBO);
             * GL.BufferData(BufferTarget.ElementArrayBuffer, textMeshData.getVertexCount() * sizeof(int), _indices, BufferUsageHint.StaticDraw);*/

            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;
        }