Remember when I suggested instancing and geometry shaders?
Yes, and I remember the fifty other suggestions you made that aren’t there. That doesn’t exactly make you Cassandra.
And instancing wasn’t a hard prediction, since D3D had it in D3D9.
glFont(fontName, "TimesNewRoman") laugh
glFonti(fontName, 12, GL_FONT_STYLE_BOLD, ...) laugh
glDrawText2D(fontName, "Hello World!", x, y, rotation);
If this was the original content of your post, I can understand why the Aether decided to consume it rather than make these forums less useful by allowing its presence.
What amazes me is just how little you really understand about what you’re asking for here. Just how much stuff would have to happen to make these 3 commands not only possible, but possible to the extent that actual people would want them.
So, you are suggesting that IHVs introduce the following into their drivers:
1: The ability to interface with some kind of global font repository. This is necessary to translate things like “TimesNewRoman” and “GL_FONT_STYLE_BOLD” into an actual file containing that particular typeface.
Note: not all operating systems have global font repositories. Also, OpenGL is not supposed to be talking directly to OS’s like that; this is why commands like swapping the default framebuffer are WGL/GLX/AGL/EGL calls.
2: The ability to parse through the myriad of font formats and rasterize these glyphs into images on the screen. This is not a trivial undertaking. Fortunately, there’s an entire open-source library (FreeType2) dedicated to doing this, and it uses a reasonably liberal license.
That being said, rasterization has issues as well. Many good glyph rasterization algorithms are patented. While FT2 does support them, IHVs would also have to license those algorithms from the patent holders. If they can’t, then they have to use crappier glyph rasterization algorithms. And licenses would essentially be a dollar value added to every GPU they make (corresponding to every driver they use).
3: Text layout. You cannot begin to fathom the complexity here. It starts with the very string you give this “glDrawText2D” function. Is that string in UTF-8? Shouldn’t it also support UTF-16, which is a common Unicode encoding? Or are we going to render this functionality of zero value to anyone not writing in English by saying that it’s ASCII-only?
If you’re wanting useful text rendering support, then some from of Unicode needs to be supported. UNIX’s tend to prefer UTF-8 strings, while Windows users are used to UTF-16 strings (since those are the Unicode encoding that each OS supports). Picking one is essentially making the other less useful.
And that hasn’t even begun to scratch the surface of text layout. Are you writing in left-to-right, top-to-bottom style like English and most western languages? Are you writing right-to-left, top-to-bottom like Hebrew or Arabic? And what about spans of text that have left-to-right layout within an Arabic string (things like numbers are written left-to-right in Arabic)?
Speaking of Arabic, how do you deal with the fact that Unicode codepoints do not have a 1:1 mapping to glyphs? You have to pick glyphs based on the neighboring codepoints. There is a fairly complicated algorithm for doing this.
And then there’s Chinese. Or rather, CJK unification. A Unicode string that maps certain CJK characters need to be rendered with different fonts based on whether the text is Japanese, Chinese, or old-style Korean.
And these are just the things that I, as someone who has a passing familiarity with text formatting, know about. There can easily be more things that I don’t know about, since I’m not an expert.
4: Lastly, how exactly do you decide what the X and Y components mean? First, what space are they in? Clip-space? Window-space? Viewport-space? Does this command generate triangles that are passed through a vertex shader? How does this generate values for a fragment shader? Does a fragment shader even get executed?
In short: what you have suggested is about as complicated as writing a GLSL compiler. And we’ve already seen how good IHVs are at that.
And even those arguments ignore the simple and obvious fact that a low-level graphics API has no business rendering text. The next thing you’ll be asking for is glBSP, glPortal, and glHeightMap.