lid6j86's picture

OpenTK and fonts

What is the best alternative to FreeType for C#? does OpenTK have anything built into it to help with rendering text?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
puklaus's picture
lid6j86's picture

thanks. took a second but I got it up and running

lid6j86's picture

Ok, ran into my first issues with QuickFont.

GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);
            GL.LoadMatrix(ref camView);
            int qFontLine = 0;
            InfFont.Print("FPS: " + Math.Round(RenderFrequency, 2), new Vector2(0, 0));
            InfFont.Print(new String('\n', ++qFontLine) + "X: " + Math.Round(camCoord.X, 2));
            InfFont.Print(new String('\n', ++qFontLine) + "Y: " + Math.Round(camCoord.Y, 2));
            InfFont.Print(new String('\n', ++qFontLine) + "Z: " + Math.Round(camCoord.Z, 2));
            InfFont.Print(new String('\n', ++qFontLine) + "H-Angle: " + Math.Round(camAngle.Y, 2));
            InfFont.Print(new String('\n', ++qFontLine) + "V-Angle: " + Math.Round(camAngle.X, 2));

now when I run this, the coordsys that I draw disappears. Is there something about quickfont that clears the screen at QFont.Begin or QFont.Print, etc... that is causing everything else to disappear?

lid6j86's picture

took some time but I finally figured it out.

using GL.PushAttrib(AttribMask.ColorBufferBit); before

and GL.PopAttrib(); after the Qfont render allowed for both to be drawn, and both bright (I saw some other people had dimming issues)

AltSoftLab's picture

You can use AltSketch. It has AltNETType - C# port of FreeType. Look at AltSketch C# vector graphics library

AltNETType (transformation + centering + kerning)
AltSketch QuickFont

AltSoftLab's picture

AltSketch also contains high level classes to operate with fonts (system fonts, custom font files) in System.Drawing.Font style. High level AltSketch render system can draw raster & vectorized outline data.

AltSketch QuickFont
AltSketch QuickFont

AltSketch Vector Text Single Path Transformer
AltSketch QuickFont