CSharpGL.LabelRenderer.Create C# (CSharp) Method

Create() public static method

Create a label renderer.
public static Create ( int maxCharCount = 64, int labelHeight = 32, IFontTexture fontTexture = null ) : LabelRenderer
maxCharCount int Max char count to display for this label. Careful to set this value because greater means more space ocupied in GPU nemory.
labelHeight int Label height(in pixels)
fontTexture IFontTexture Use which font to render text?
return LabelRenderer
        public static LabelRenderer Create(int maxCharCount = 64, int labelHeight = 32, IFontTexture fontTexture = null)
        {
            if (fontTexture == null) { fontTexture = FontTexture.Default; }

            var model = new TextModel(maxCharCount);

            var shaderCodes = new ShaderCode[2];
            shaderCodes[0] = new ShaderCode(ManifestResourceLoader.LoadTextFile(
                @"Resources\Label.vert"), ShaderType.VertexShader);
            shaderCodes[1] = new ShaderCode(ManifestResourceLoader.LoadTextFile(
                @"Resources\Label.frag"), ShaderType.FragmentShader);

            var map = new AttributeMap();
            map.Add("in_Position", TextModel.strPosition);
            map.Add("in_UV", TextModel.strUV);

            var blendState = new BlendState(BlendingSourceFactor.SourceAlpha, BlendingDestinationFactor.One);

            var renderer = new LabelRenderer(model, shaderCodes, map, blendState);
            renderer.blendState = blendState;
            renderer.fontTexture = fontTexture;
            renderer.LabelHeight = labelHeight;

            return renderer;
        }