

Font glyphs opengl plus#
You might want to add points just in the middle, so the same letter at a bigger size will contain all the points of a smaller size letter plus additional ones, and the curves will look the same.įor best quality, make sure that the area where the polygon is to the left of the spline and the area where it is to the right is about the same. I'd start with the points that are given to be on the curve, then figure out how many points you need to add between these points to keep the error low enough. Don't do that, and your problem goes away. Control points are NOT part of the spline! So adding them to your straight line segments is a massive mistake.
Font glyphs opengl driver#
Letting the OpenGL driver manage the font outlines is smart because the driver keeps the path data for the glyphs cached efficiently on the GPU. Because OpenGL loads the glyphs from the system fonts, OpenGL applications can portably access outline fonts for path rendering. You'll add enough points to the polygon so that the difference between spline and polygon is negligible. HTML where fonts are listed in priority order. Your graphics hardware is usually not capable of handling splines directly, so you convert the spline into a polygon. The points and control points define a spline curve. Is there a better algorithm I can use to do this to avoid situations like this? This shows an example of the issue I am having, I can no longer triangulate this because the red lines at the bottom cross outside the shape and then back in again. For the control points that curve in to the shape I keep them for the opposite reason to above.įor the example above I have shown some additional red lines showing what the new outline would look like with the outer control points removed. For the curves that curve out side the shape I need to remove the control points from the triangulation routine (because I don't want to fill in these triangles completely, I leave that to the bezier shader). They way I split things up is to take the control points, the start points and end points of the bezier spline and pass those to the bezier shader. I have a triangulation process that can take all these points and render them in opengl, I'd like to render the bezier curves in a shader, I have something that does this and it works.

The X represent control points of a bezier spline, circular and square points represent points on the glyph but they can also be the start / end points of the bezier splines. The below image shows an example glyph (Taken fron FontForge application). I am trying to triangulate TTF glyphs for drawing in opengl.
