Has Tomasz's (h3r3tic's) OpenGL font rendering code been ported to D2?

Chad J chadjoan at __spam.is.bad__gmail.com
Sun Mar 11 06:18:12 PDT 2012


On 03/11/2012 09:09 AM, Jacob Carlborg wrote:
> On 2012-03-11 03:23, Chad J wrote:
>> I've been looking for a good way to render font in OpenGL with D.
>>
>> Back in they day I was very impressed with Tomasz's article on the
>> subject: http://h3.gd/dmedia/?n=Tutorials.TextRendering1
>> I was wonder if anyone has ported it.
>
> Just use FreeType?
>

FreeType is quite cool, but it will only render glyphs onto small 
bitmaps.  Getting those glyphs onto the screen becomes more complicated 
after that: you can't just blit them like in SDL or somesuch.  Since 
textures don't come in "supersmall" size, it is effective to pack the 
glyphs into a larger texture like the article suggests.  Then you have 
to texture-map correctly to only render the glyphs you want.  Somewhere 
in there is a bunch of other font-setting stuff like kerning, sub-pixel 
anti-aliasing, line offsets, etc.  FreeType doesn't do that stuff for 
anyone, it just provides the tools necessary to make it possible.  It's 
fairly complicated; I'd rather just write "Font f = new Font("Courier 
New"); f.draw(100, 100, "Hello world!");".


More information about the Digitalmars-d mailing list