

See:įonts inside of the 3D geometry with perspective Downside: not very widely implemented for some reason.

I suspect that optimizing character placement to the smallest texture problem is an NP-hard problem, see: What algorithm can be used for packing rectangles of different sizes into the smallest rectangle possible in a fairly optimal way?
UNITY SYMBOL DRAWING FULL
The Wikipedia picture of the full texture, which is itself taken from freetype-gl, illustrates this well: This approach is called a texture atlas and it can be used not only for textures but also other repeatedly used textures, like tiles in a 2D game or web UI icons. The more efficient approach is to raster all characters you plan on using and cram them on a single texture.Īnd then transfer that to the GPU once, and use it texture with custom uv coordinates to choose the right character. We could raster characters for every frame and re-create the textures, but that is not very efficient, specially if characters have a fixed size.
UNITY SYMBOL DRAWING HOW TO
OpenGL then knows how to deal with arrays of pixels through textures very well. The easiest approach is to first raster fonts ourselves on the CPU, and then give the array of pixels to OpenGL as a texture. see Why is there no circle or ellipse primitive in OpenGL?) Transforming those formats into arrays of pixels (rasterization) is too specific and out of OpenGL's scope, specially because OpenGl does not have non-straight primitives (e.g. So I've changed my thinking on this topic.Popular font formats like TrueType and OpenType are vector outline formats: they use Bezier curves to define the boundary of the letter. No need to focus on "general-purpose" 2D. I now understand that Unity has plenty of 2D-related features. I conclude that its better to go with Unity's strengths. I also found the manual's "Introduction to 2D Animation". "Project: Ruby's Adventure" in particular sounds related to what I had in mind. After writing the above, I found 's "Beginning 2D Game Development". Using "make a 2D game" as the hook for learning.

UPDATE: I was thinking that have a general-purpose 2D graphics library to build on would be helpful in learning/teaching basic programming.
UNITY SYMBOL DRAWING ANDROID
(I'm painfully aware of XF's costs in app size and Android performance, when scaling up to a complex polished app. I recently experimented with Xamarin Forms widgets on top of a SkiaSharp canvas, to combine UI widgets with easy-to-write 2D, and it went quite smoothly. No more waiting for Unity-Tech China to move UIWidgets beyond Unity 2019 support. Not only would SkiaSharp make it trivial to write 2D graphics (its distinctly higher level than writing GL), but that would potentially bring Flutter widgets in as a UI option. I was hoping there was support for Skia in Unity, built on top of GL, so could integrate with 3D graphics.
