Re: Antialiased text rendering with GL3?
Posted by farrellf on May 06, 2020; 7:02am
URL: https://forum.jogamp.org/Antialiased-text-rendering-with-GL3-tp4040593p4040597.html
It seems that adding "caps.setSampleBuffers(true);" before creating the GLWindow does the trick. Now the text is antialiased.
But more testing leads me to a few other problems:
1. When using the "C:/Windows/Fonts/verdana.ttf" font, the number 9 renders incorrectly. The "hole" in the 9 is filled in.
2. The font rendering looks slightly less accurate than the results of the old AWT-based API. It looks as if the curves are overly simplified or overly hinted. Is there some setting for this?
2. The method "com.jogamp.graph.font.Font.getMetricWidth(text, size)" does not seem to give an accurate width. The text drawn on screen uses roughly 8% fewer pixels, as least when using the verdana.ttf font. (If i multiply the return value by 0.92f, it seems more accurate, but it's still not perfect.) Is there some better way to figure out how wide a string of 2D text will be on screen? (I'm only doing 2D text rendering.)
3. Does the new graph font rendering API have an easier way to specify a font? The old AWT-based API let you specifiy a font name and the JVM would try to map it to whatever was available. Now I have to know the file path, or bundle my own font?
Thanks,
-Farrell